Browse Source

[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.
tags/v0.9.8
Michael Brown 14 years ago
parent
commit
a0d337912e

+ 3
- 1
src/net/infiniband/ib_cm.c View File

@@ -148,6 +148,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
148 148
 	size_t private_data_len = 0;
149 149
 
150 150
 	/* Report failures */
151
+	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
152
+		rc = -EIO;
151 153
 	if ( rc != 0 ) {
152 154
 		DBGC ( conn, "CM %p connection request failed: %s\n",
153 155
 		       conn, strerror ( rc ) );
@@ -195,7 +197,7 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
195 197
 	default:
196 198
 		DBGC ( conn, "CM %p unexpected response (attribute %04x)\n",
197 199
 		       conn, ntohs ( mad->hdr.attr_id ) );
198
-		rc = -EIO;
200
+		rc = -ENOTSUP;
199 201
 		break;
200 202
 	}
201 203
 

+ 2
- 0
src/net/infiniband/ib_mcast.c View File

@@ -86,6 +86,8 @@ static void ib_mcast_complete ( struct ib_device *ibdev,
86 86
 	unsigned long qkey;
87 87
 
88 88
 	/* Report failures */
89
+	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
90
+		rc = -ENOTCONN;
89 91
 	if ( rc != 0 ) {
90 92
 		DBGC ( ibdev, "IBDEV %p QPN %lx join failed: %s\n",
91 93
 		       ibdev, qp->qpn, strerror ( rc ) );

+ 1
- 5
src/net/infiniband/ib_mi.c View File

@@ -76,18 +76,14 @@ static int ib_mi_handle ( struct ib_device *ibdev,
76 76
 	struct ib_mad_hdr *hdr = &mad->hdr;
77 77
 	struct ib_mad_transaction *madx;
78 78
 	struct ib_mad_agent *agent;
79
-	int rc;
80 79
 
81 80
 	/* Look for a matching transaction by TID */
82 81
 	list_for_each_entry ( madx, &mi->madx, list ) {
83 82
 		if ( memcmp ( &hdr->tid, &madx->mad.hdr.tid,
84 83
 			      sizeof ( hdr->tid ) ) != 0 )
85 84
 			continue;
86
-		/* Get transaction result status */
87
-		rc = ( ( hdr->status == htons ( IB_MGMT_STATUS_OK ) ) ?
88
-		       0 : -EIO );
89 85
 		/* Found a matching transaction */
90
-		madx->op->complete ( ibdev, mi, madx, rc, mad, av );
86
+		madx->op->complete ( ibdev, mi, madx, 0, mad, av );
91 87
 		return 0;
92 88
 	}
93 89
 

+ 2
- 0
src/net/infiniband/ib_pathrec.c View File

@@ -53,6 +53,8 @@ static void ib_path_complete ( struct ib_device *ibdev,
53 53
 	struct ib_path_record *pathrec = &mad->sa.sa_data.path_record;
54 54
 
55 55
 	/* Report failures */
56
+	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
57
+		rc = -ENETUNREACH;
56 58
 	if ( rc != 0 ) {
57 59
 		DBGC ( ibdev, "IBDEV %p path lookup for %08x:%08x:%08x:%08x "
58 60
 		       "failed: %s\n", ibdev, htonl ( dgid->u.dwords[0] ),

Loading…
Cancel
Save