david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[infiniband] Assign names to queue pairs

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2016-03-08 15:48:53 +00:00
parent 174bf6b569
commit 6a3ffa0114
6 changed files with 19 additions and 12 deletions

View File

@ -3242,7 +3242,7 @@ static int hermon_eth_open ( struct net_device *netdev ) {
port->eth_qp = ib_create_qp ( ibdev, IB_QPT_ETH,
HERMON_ETH_NUM_SEND_WQES, port->eth_cq,
HERMON_ETH_NUM_RECV_WQES, port->eth_cq,
&hermon_eth_qp_op );
&hermon_eth_qp_op, netdev->name );
if ( ! port->eth_qp ) {
DBGC ( hermon, "Hermon %p port %d could not create queue "
"pair\n", hermon, ibdev->port );

View File

@ -865,7 +865,7 @@ static int ipoib_open ( struct net_device *netdev ) {
/* Allocate queue pair */
ipoib->qp = ib_create_qp ( ibdev, IB_QPT_UD, IPOIB_NUM_SEND_WQES,
ipoib->cq, IPOIB_NUM_RECV_WQES, ipoib->cq,
&ipoib_qp_op );
&ipoib_qp_op, netdev->name );
if ( ! ipoib->qp ) {
DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
ipoib );

View File

@ -158,6 +158,8 @@ struct ib_queue_pair {
struct ib_device *ibdev;
/** List of queue pairs on this Infiniband device */
struct list_head list;
/** Queue pair name */
const char *name;
/** Queue pair number */
unsigned long qpn;
/** Externally-visible queue pair number
@ -498,7 +500,7 @@ extern struct ib_queue_pair *
ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq,
struct ib_queue_pair_operations *op );
struct ib_queue_pair_operations *op, const char *name );
extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
extern void ib_destroy_qp ( struct ib_device *ibdev,
struct ib_queue_pair *qp );

View File

@ -107,7 +107,7 @@ ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
if ( ! cq )
goto err_alloc_cq;
cq->ibdev = ibdev;
list_add ( &cq->list, &ibdev->cqs );
list_add_tail ( &cq->list, &ibdev->cqs );
cq->num_cqes = num_cqes;
INIT_LIST_HEAD ( &cq->work_queues );
cq->op = op;
@ -185,6 +185,7 @@ void ib_poll_cq ( struct ib_device *ibdev,
* @v num_recv_wqes Number of receive work queue entries
* @v recv_cq Receive completion queue
* @v op Queue pair operations
* @v name Queue pair name
* @ret qp Queue pair
*
* The queue pair will be left in the INIT state; you must call
@ -196,7 +197,8 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
struct ib_completion_queue *send_cq,
unsigned int num_recv_wqes,
struct ib_completion_queue *recv_cq,
struct ib_queue_pair_operations *op ) {
struct ib_queue_pair_operations *op,
const char *name ) {
struct ib_queue_pair *qp;
size_t total_size;
int rc;
@ -211,24 +213,25 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
if ( ! qp )
goto err_alloc_qp;
qp->ibdev = ibdev;
list_add ( &qp->list, &ibdev->qps );
list_add_tail ( &qp->list, &ibdev->qps );
qp->type = type;
qp->send.qp = qp;
qp->send.is_send = 1;
qp->send.cq = send_cq;
list_add ( &qp->send.list, &send_cq->work_queues );
list_add_tail ( &qp->send.list, &send_cq->work_queues );
qp->send.psn = ( random() & 0xffffffUL );
qp->send.num_wqes = num_send_wqes;
qp->send.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) );
qp->recv.qp = qp;
qp->recv.cq = recv_cq;
list_add ( &qp->recv.list, &recv_cq->work_queues );
list_add_tail ( &qp->recv.list, &recv_cq->work_queues );
qp->recv.psn = ( random() & 0xffffffUL );
qp->recv.num_wqes = num_recv_wqes;
qp->recv.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) +
( num_send_wqes * sizeof ( qp->send.iobufs[0] ) ));
INIT_LIST_HEAD ( &qp->mgids );
qp->op = op;
qp->name = name;
/* Perform device-specific initialisation and get QPN */
if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) {
@ -756,7 +759,7 @@ int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
goto err_alloc_mgid;
}
memcpy ( &mgid->gid, gid, sizeof ( mgid->gid ) );
list_add ( &mgid->list, &qp->mgids );
list_add_tail ( &mgid->list, &qp->mgids );
/* Add to hardware multicast GID list */
if ( ( rc = ibdev->op->mcast_attach ( ibdev, qp, gid ) ) != 0 )

View File

@ -435,7 +435,7 @@ int ib_cmrc_open ( struct interface *xfer, struct ib_device *ibdev,
/* Create queue pair */
cmrc->qp = ib_create_qp ( ibdev, IB_QPT_RC, IB_CMRC_NUM_SEND_WQES,
cmrc->cq, IB_CMRC_NUM_RECV_WQES, cmrc->cq,
&ib_cmrc_queue_pair_ops );
&ib_cmrc_queue_pair_ops, name );
if ( ! cmrc->qp ) {
DBGC ( cmrc, "CMRC %s %s could not create queue pair\n",
ibdev->name, cmrc->name );

View File

@ -346,6 +346,7 @@ void ib_destroy_madx ( struct ib_device *ibdev __unused,
struct ib_mad_interface * ib_create_mi ( struct ib_device *ibdev,
enum ib_queue_pair_type type ) {
struct ib_mad_interface *mi;
const char *name;
int rc;
/* Allocate and initialise fields */
@ -363,16 +364,17 @@ struct ib_mad_interface * ib_create_mi ( struct ib_device *ibdev,
}
/* Create queue pair */
name = ( ( type == IB_QPT_SMI ) ? "SMI" : "GSI" );
mi->qp = ib_create_qp ( ibdev, type, IB_MI_NUM_SEND_WQES, mi->cq,
IB_MI_NUM_RECV_WQES, mi->cq,
&ib_mi_queue_pair_ops );
&ib_mi_queue_pair_ops, name );
if ( ! mi->qp ) {
DBGC ( mi, "MI %p could not allocate queue pair\n", mi );
goto err_create_qp;
}
ib_qp_set_ownerdata ( mi->qp, mi );
DBGC ( mi, "MI %p (%s) running on QPN %#lx\n",
mi, ( ( type == IB_QPT_SMI ) ? "SMI" : "GSI" ), mi->qp->qpn );
mi, mi->qp->name, mi->qp->qpn );
/* Set queue key */
mi->qp->qkey = ( ( type == IB_QPT_SMI ) ? IB_QKEY_SMI : IB_QKEY_GSI );