]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[infiniband] Generate more specific errors in response to failure MADs
authorMichael Brown <mcb30@etherboot.org>
Mon, 10 Aug 2009 10:32:13 +0000 (11:32 +0100)
committerMichael Brown <mcb30@etherboot.org>
Mon, 10 Aug 2009 21:30:06 +0000 (22:30 +0100)
Generate errors within individual MAD transaction consumers such as
ib_pathrec.c and ib_mcast.c, rather than within ib_mi.c.  This allows
for more meaningful error messages to eventually be displayed to the
user.

src/net/infiniband/ib_cm.c
src/net/infiniband/ib_mcast.c
src/net/infiniband/ib_mi.c
src/net/infiniband/ib_pathrec.c

index 13539b40edd4008afa3ff1b600d4d9e6fae9d888..859d56f20cfb7a9ac479c200b417e8905391471a 100644 (file)
@@ -148,6 +148,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
        size_t private_data_len = 0;
 
        /* Report failures */
+       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 ) );
@@ -195,7 +197,7 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
        default:
                DBGC ( conn, "CM %p unexpected response (attribute %04x)\n",
                       conn, ntohs ( mad->hdr.attr_id ) );
-               rc = -EIO;
+               rc = -ENOTSUP;
                break;
        }
 
index c1d18d21a4e0ecc0a2c15d1ce04ac75dd700b44b..5cb395de7ee2f671f0ece8eccbf4b9455d484179 100644 (file)
@@ -86,6 +86,8 @@ static void ib_mcast_complete ( struct ib_device *ibdev,
        unsigned long qkey;
 
        /* Report failures */
+       if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
+               rc = -ENOTCONN;
        if ( rc != 0 ) {
                DBGC ( ibdev, "IBDEV %p QPN %lx join failed: %s\n",
                       ibdev, qp->qpn, strerror ( rc ) );
index 662ef767e07dbe6aa107b2a5777f108cf0e19e55..7511fd87e308e7bb597dc5ba851bd7b204b1162c 100644 (file)
@@ -76,18 +76,14 @@ static int ib_mi_handle ( struct ib_device *ibdev,
        struct ib_mad_hdr *hdr = &mad->hdr;
        struct ib_mad_transaction *madx;
        struct ib_mad_agent *agent;
-       int rc;
 
        /* Look for a matching transaction by TID */
        list_for_each_entry ( madx, &mi->madx, list ) {
                if ( memcmp ( &hdr->tid, &madx->mad.hdr.tid,
                              sizeof ( hdr->tid ) ) != 0 )
                        continue;
-               /* Get transaction result status */
-               rc = ( ( hdr->status == htons ( IB_MGMT_STATUS_OK ) ) ?
-                      0 : -EIO );
                /* Found a matching transaction */
-               madx->op->complete ( ibdev, mi, madx, rc, mad, av );
+               madx->op->complete ( ibdev, mi, madx, 0, mad, av );
                return 0;
        }
 
index 983623c7edd235685ff06e657ba5b79075883307..136e628d295366cc62d47ac8d22e8fe5dcc366f6 100644 (file)
@@ -53,6 +53,8 @@ static void ib_path_complete ( struct ib_device *ibdev,
        struct ib_path_record *pathrec = &mad->sa.sa_data.path_record;
 
        /* Report failures */
+       if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
+               rc = -ENETUNREACH;
        if ( rc != 0 ) {
                DBGC ( ibdev, "IBDEV %p path lookup for %08x:%08x:%08x:%08x "
                       "failed: %s\n", ibdev, htonl ( dgid->u.dwords[0] ),