]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[infiniband] Use connection's local ID as debug message identifier
authorMichael Brown <mcb30@ipxe.org>
Thu, 3 Mar 2016 18:09:03 +0000 (18:09 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 8 Mar 2016 12:08:58 +0000 (12:08 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/infiniband/ib_cm.c
src/net/infiniband/ib_cmrc.c

index 51e7c1ef1bd1b93b8c99e5aed03dd8722e97eccf..942939574bc8ea5b92e5ec8bbeadeff1c935a574 100644 (file)
@@ -86,8 +86,9 @@ static int ib_cm_send_rtu ( struct ib_device *ibdev,
        mad.hdr.attr_id = htons ( IB_CM_ATTR_READY_TO_USE );
        rtu->local_id = htonl ( local_id );
        rtu->remote_id = htonl ( remote_id );
-       if ( ( rc = ib_mi_send ( ibdev, mi, &mad, av ) ) != 0 ){
-               DBG ( "CM could not send RTU: %s\n", strerror ( rc ) );
+       if ( ( rc = ib_mi_send ( ibdev, mi, &mad, av ) ) != 0 ) {
+               DBGC ( local_id, "CM %08x could not send RTU: %s\n",
+                      local_id, strerror ( rc ) );
                return rc;
        }
 
@@ -125,7 +126,7 @@ static void ib_cm_recv_rep ( struct ib_device *ibdev,
                        /* Ignore errors; the remote end will retry */
                }
        } else {
-               DBG ( "CM unidentified connection %08x\n", local_id );
+               DBGC ( local_id, "CM %08x unexpected REP\n", local_id );
        }
 }
 
@@ -155,8 +156,9 @@ static int ib_cm_send_drep ( struct ib_device *ibdev,
        mad.hdr.attr_id = htons ( IB_CM_ATTR_DISCONNECT_REPLY );
        drep->local_id = htonl ( local_id );
        drep->remote_id = htonl ( remote_id );
-       if ( ( rc = ib_mi_send ( ibdev, mi, &mad, av ) ) != 0 ){
-               DBG ( "CM could not send DREP: %s\n", strerror ( rc ) );
+       if ( ( rc = ib_mi_send ( ibdev, mi, &mad, av ) ) != 0 ) {
+               DBGC ( local_id, "CM %08x could not send DREP: %s\n",
+                      local_id, strerror ( rc ) );
                return rc;
        }
 
@@ -191,7 +193,7 @@ static void ib_cm_recv_dreq ( struct ib_device *ibdev,
                                    &dreq->private_data,
                                    sizeof ( dreq->private_data ) );
        } else {
-               DBG ( "CM unidentified connection %08x\n", local_id );
+               DBGC ( local_id, "CM %08x unexpected DREQ\n", local_id );
        }
 
        /* Send reply */
@@ -256,6 +258,7 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
        struct ib_cm_common *common = &mad->cm.cm_data.common;
        struct ib_cm_connect_reply *rep = &mad->cm.cm_data.connect_reply;
        struct ib_cm_connect_reject *rej = &mad->cm.cm_data.connect_reject;
+       uint32_t local_id = conn->local_id;
        void *private_data = NULL;
        size_t private_data_len = 0;
 
@@ -263,8 +266,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
        if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
                rc = -EIO;
        if ( rc != 0 ) {
-               DBGC ( conn, "CM %p connection request failed: %s\n",
-                      conn, strerror ( rc ) );
+               DBGC ( local_id, "CM %08x connection request failed: %s\n",
+                      local_id, strerror ( rc ) );
                goto out;
        }
 
@@ -280,13 +283,13 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
                qp->send.psn = ( ntohl ( rep->starting_psn ) >> 8 );
                private_data = &rep->private_data;
                private_data_len = sizeof ( rep->private_data );
-               DBGC ( conn, "CM %p connected to QPN %#lx PSN %#x\n",
-                      conn, qp->av.qpn, qp->send.psn );
+               DBGC ( local_id, "CM %08x connected to QPN %#lx PSN %#x\n",
+                      local_id, qp->av.qpn, qp->send.psn );
 
                /* Modify queue pair */
                if ( ( rc = ib_modify_qp ( ibdev, qp ) ) != 0 ) {
-                       DBGC ( conn, "CM %p could not modify queue pair: %s\n",
-                              conn, strerror ( rc ) );
+                       DBGC ( local_id, "CM %08x could not modify queue "
+                              "pair: %s\n", local_id, strerror ( rc ) );
                        goto out;
                }
 
@@ -300,8 +303,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
 
        case htons ( IB_CM_ATTR_CONNECT_REJECT ) :
                /* Extract fields */
-               DBGC ( conn, "CM %p connection rejected (reason %d)\n",
-                      conn, ntohs ( rej->reason ) );
+               DBGC ( local_id, "CM %08x connection rejected (reason %d)\n",
+                      local_id, ntohs ( rej->reason ) );
                /* Private data is valid only for a Consumer Reject */
                if ( rej->reason == htons ( IB_CM_REJECT_CONSUMER ) ) {
                        private_data = &rej->private_data;
@@ -311,8 +314,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
                break;
 
        default:
-               DBGC ( conn, "CM %p unexpected response (attribute %04x)\n",
-                      conn, ntohs ( mad->hdr.attr_id ) );
+               DBGC ( local_id, "CM %08x unexpected response (attribute "
+                      "%04x)\n", local_id, ntohs ( mad->hdr.attr_id ) );
                rc = -ENOTSUP;
                break;
        }
@@ -347,12 +350,13 @@ static void ib_cm_path_complete ( struct ib_device *ibdev,
        struct ib_queue_pair *qp = conn->qp;
        union ib_mad mad;
        struct ib_cm_connect_request *req = &mad.cm.cm_data.connect_request;
+       uint32_t local_id = conn->local_id;
        size_t private_data_len;
 
        /* Report failures */
        if ( rc != 0 ) {
-               DBGC ( conn, "CM %p path lookup failed: %s\n",
-                      conn, strerror ( rc ) );
+               DBGC ( local_id, "CM %08x path lookup failed: %s\n",
+                      local_id, strerror ( rc ) );
                conn->op->changed ( ibdev, qp, conn, rc, NULL, 0 );
                goto out;
        }
@@ -405,8 +409,8 @@ static void ib_cm_path_complete ( struct ib_device *ibdev,
        conn->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, av,
                                      &ib_cm_req_op );
        if ( ! conn->madx ) {
-               DBGC ( conn, "CM %p could not create connection request\n",
-                      conn );
+               DBGC ( local_id, "CM %08x could not create connection "
+                      "request\n", local_id );
                conn->op->changed ( ibdev, qp, conn, rc, NULL, 0 );
                goto out;
        }
@@ -441,6 +445,7 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
                 void *private_data, size_t private_data_len,
                 struct ib_connection_operations *op ) {
        struct ib_connection *conn;
+       uint32_t local_id;
 
        /* Allocate and initialise request */
        conn = zalloc ( sizeof ( *conn ) + private_data_len );
@@ -451,7 +456,7 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
        memset ( &qp->av, 0, sizeof ( qp->av ) );
        qp->av.gid_present = 1;
        memcpy ( &qp->av.gid, dgid, sizeof ( qp->av.gid ) );
-       conn->local_id = random();
+       conn->local_id = local_id = random();
        memcpy ( &conn->service_id, service_id, sizeof ( conn->service_id ) );
        conn->op = op;
        conn->private_data_len = private_data_len;
@@ -466,10 +471,11 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
        /* Add to list of connections */
        list_add ( &conn->list, &ib_cm_conns );
 
-       DBGC ( conn, "CM %p created for IBDEV %s QPN %#lx\n",
-              conn, ibdev->name, qp->qpn );
-       DBGC ( conn, "CM %p connecting to " IB_GID_FMT " " IB_GUID_FMT "\n",
-              conn, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
+       DBGC ( local_id, "CM %08x created for IBDEV %s QPN %#lx\n",
+              local_id, ibdev->name, qp->qpn );
+       DBGC ( local_id, "CM %08x connecting to " IB_GID_FMT " "
+              IB_GUID_FMT "\n", local_id, IB_GID_ARGS ( dgid ),
+              IB_GUID_ARGS ( service_id ) );
 
        return conn;
 
index 1e6bda5b86bb7fbf801eeaca5812d04450601edd..16f85a9cdee7305d9e6610dbb0338d451866cf7f 100644 (file)
@@ -303,6 +303,8 @@ static int ib_cmrc_xfer_deliver ( struct ib_cmrc_connection *cmrc,
                        rc = -ENOMEM;
                        goto out;
                }
+               DBGC ( cmrc, "CMRC %p using CM %08x\n",
+                      cmrc, cmrc->conn->local_id );
 
        } else {