summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2009-08-10 12:32:13 +0200
committerMichael Brown2009-08-10 23:30:06 +0200
commita0d337912eee5ff0d72d0d85d83be88672d49004 (patch)
treeb435da11f960b440fe0696bd9cd0e536c86ee9af
parent[infiniband] Add support for SRP over Infiniband (diff)
downloadipxe-a0d337912eee5ff0d72d0d85d83be88672d49004.tar.gz
ipxe-a0d337912eee5ff0d72d0d85d83be88672d49004.tar.xz
ipxe-a0d337912eee5ff0d72d0d85d83be88672d49004.zip
[infiniband] Generate more specific errors in response to failure MADs
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.
-rw-r--r--src/net/infiniband/ib_cm.c4
-rw-r--r--src/net/infiniband/ib_mcast.c2
-rw-r--r--src/net/infiniband/ib_mi.c6
-rw-r--r--src/net/infiniband/ib_pathrec.c2
4 files changed, 8 insertions, 6 deletions
diff --git a/src/net/infiniband/ib_cm.c b/src/net/infiniband/ib_cm.c
index 13539b40..859d56f2 100644
--- a/src/net/infiniband/ib_cm.c
+++ b/src/net/infiniband/ib_cm.c
@@ -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;
}
diff --git a/src/net/infiniband/ib_mcast.c b/src/net/infiniband/ib_mcast.c
index c1d18d21..5cb395de 100644
--- a/src/net/infiniband/ib_mcast.c
+++ b/src/net/infiniband/ib_mcast.c
@@ -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 ) );
diff --git a/src/net/infiniband/ib_mi.c b/src/net/infiniband/ib_mi.c
index 662ef767..7511fd87 100644
--- a/src/net/infiniband/ib_mi.c
+++ b/src/net/infiniband/ib_mi.c
@@ -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;
}
diff --git a/src/net/infiniband/ib_pathrec.c b/src/net/infiniband/ib_pathrec.c
index 983623c7..136e628d 100644
--- a/src/net/infiniband/ib_pathrec.c
+++ b/src/net/infiniband/ib_pathrec.c
@@ -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] ),