]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[infiniband] Assign names to queue pairs
authorMichael Brown <mcb30@ipxe.org>
Tue, 8 Mar 2016 15:48:53 +0000 (15:48 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 8 Mar 2016 15:51:53 +0000 (15:51 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/infiniband/hermon.c
src/drivers/net/ipoib.c
src/include/ipxe/infiniband.h
src/net/infiniband.c
src/net/infiniband/ib_cmrc.c
src/net/infiniband/ib_mi.c

index a9c728706b8a54464c75e1a920da2e8df7f76fc8..cac5fe991814e7f4c7281583482118bc8957361e 100644 (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 );
index d545b6f402d848370d0116a4655ff58d16aee331..b52ccb1947cf7649148e75974b0e908faea53104 100644 (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 );
index 065e421807bbb6a2b5ca53011f4a3cde3be279c3..5910390da3127af3310434325e705e00c9d215b3 100644 (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 );
index 106371c2f78d87926b114ef2c34ebb68880323b0..df95579d10e849107693bcdb9503f1e80b68eb2c 100644 (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 )
index f4cd583d1a489c87a6edb98337f427e5b58d176a..2cd49018fd1fbba085b48d0287222f2198cc754f 100644 (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 );
index f9c0862b989063c5818aa681e9a108d5b74a4ede..548a1c82972bbcd1d8e9afead314b778bf31bfd2 100644 (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 );