david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[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.
This commit is contained in:
Michael Brown 2009-08-10 11:32:13 +01:00
parent 0c30dc6bc5
commit a0d337912e
4 changed files with 8 additions and 6 deletions

View File

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

View File

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

View File

@ -76,18 +76,14 @@ static int ib_mi_handle ( struct ib_device *ibdev,
struct ib_mad_hdr *hdr = &mad->hdr; struct ib_mad_hdr *hdr = &mad->hdr;
struct ib_mad_transaction *madx; struct ib_mad_transaction *madx;
struct ib_mad_agent *agent; struct ib_mad_agent *agent;
int rc;
/* Look for a matching transaction by TID */ /* Look for a matching transaction by TID */
list_for_each_entry ( madx, &mi->madx, list ) { list_for_each_entry ( madx, &mi->madx, list ) {
if ( memcmp ( &hdr->tid, &madx->mad.hdr.tid, if ( memcmp ( &hdr->tid, &madx->mad.hdr.tid,
sizeof ( hdr->tid ) ) != 0 ) sizeof ( hdr->tid ) ) != 0 )
continue; continue;
/* Get transaction result status */
rc = ( ( hdr->status == htons ( IB_MGMT_STATUS_OK ) ) ?
0 : -EIO );
/* Found a matching transaction */ /* Found a matching transaction */
madx->op->complete ( ibdev, mi, madx, rc, mad, av ); madx->op->complete ( ibdev, mi, madx, 0, mad, av );
return 0; return 0;
} }

View 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; struct ib_path_record *pathrec = &mad->sa.sa_data.path_record;
/* Report failures */ /* Report failures */
if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
rc = -ENETUNREACH;
if ( rc != 0 ) { if ( rc != 0 ) {
DBGC ( ibdev, "IBDEV %p path lookup for %08x:%08x:%08x:%08x " DBGC ( ibdev, "IBDEV %p path lookup for %08x:%08x:%08x:%08x "
"failed: %s\n", ibdev, htonl ( dgid->u.dwords[0] ), "failed: %s\n", ibdev, htonl ( dgid->u.dwords[0] ),