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 15 years ago
parent
commit
a0d337912e

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

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

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

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

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

76
 	struct ib_mad_hdr *hdr = &mad->hdr;
76
 	struct ib_mad_hdr *hdr = &mad->hdr;
77
 	struct ib_mad_transaction *madx;
77
 	struct ib_mad_transaction *madx;
78
 	struct ib_mad_agent *agent;
78
 	struct ib_mad_agent *agent;
79
-	int rc;
80
 
79
 
81
 	/* Look for a matching transaction by TID */
80
 	/* Look for a matching transaction by TID */
82
 	list_for_each_entry ( madx, &mi->madx, list ) {
81
 	list_for_each_entry ( madx, &mi->madx, list ) {
83
 		if ( memcmp ( &hdr->tid, &madx->mad.hdr.tid,
82
 		if ( memcmp ( &hdr->tid, &madx->mad.hdr.tid,
84
 			      sizeof ( hdr->tid ) ) != 0 )
83
 			      sizeof ( hdr->tid ) ) != 0 )
85
 			continue;
84
 			continue;
86
-		/* Get transaction result status */
87
-		rc = ( ( hdr->status == htons ( IB_MGMT_STATUS_OK ) ) ?
88
-		       0 : -EIO );
89
 		/* Found a matching transaction */
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
 		return 0;
87
 		return 0;
92
 	}
88
 	}
93
 
89
 

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

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

Loading…
Cancel
Save