diff mbox

infiniband-diags: ibroute: add MAD status to query failure message

Message ID 20130203213300.a709c5004635e2f821679f64@llnl.gov (mailing list archive)
State Accepted, archived
Delegated to: Ira Weiny
Headers show

Commit Message

Ira Weiny Feb. 4, 2013, 5:33 a.m. UTC
Signed-off-by: Ira Weiny <weiny2@llnl.gov>
---
 src/ibroute.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/src/ibroute.c b/src/ibroute.c
index a0c7de8..df48382 100644
--- a/src/ibroute.c
+++ b/src/ibroute.c
@@ -210,15 +210,20 @@  char *dump_multicast_tables(ib_portid_t * portid, unsigned startlid,
 	lastblock = endlid / IB_MLIDS_IN_BLOCK;
 	for (block = startblock; block <= lastblock; block++) {
 		for (j = 0; j < chunks; j++) {
+			int status;
 			mod = (block - IB_MIN_MCAST_LID / IB_MLIDS_IN_BLOCK)
 			    | (j << 28);
 
 			DEBUG("reading block %x chunk %d mod %x", block, j,
 			      mod);
-			if (!smp_query_via
+			if (!smp_query_status_via
 			    (mft + j, portid, IB_ATTR_MULTICASTFORWTBL, mod, 0,
-			     srcport))
-				return "multicast forwarding table get failed";
+			     &status, srcport)) {
+				fprintf(stderr, "SubnGet() failed"
+						"; MAD status 0x%x AM 0x%x\n",
+						status, mod);
+				return NULL;
+			}
 		}
 
 		i = block * IB_MLIDS_IN_BLOCK;
@@ -356,10 +361,15 @@  char *dump_unicast_tables(ib_portid_t * portid, int startlid, int endlid)
 	startblock = startlid / IB_SMP_DATA_SIZE;
 	endblock = ALIGN(endlid, IB_SMP_DATA_SIZE) / IB_SMP_DATA_SIZE;
 	for (block = startblock; block <= endblock; block++) {
+		int status;
 		DEBUG("reading block %d", block);
-		if (!smp_query_via(lft, portid, IB_ATTR_LINEARFORWTBL, block,
-				   0, srcport))
-			return "linear forwarding table get failed";
+		if (!smp_query_status_via(lft, portid, IB_ATTR_LINEARFORWTBL, block,
+				   0, &status, srcport)) {
+			fprintf(stderr, "SubnGet() failed"
+					"; MAD status 0x%x AM 0x%x\n",
+					status, block);
+			return NULL;
+		}
 		i = block * IB_SMP_DATA_SIZE;
 		e = i + IB_SMP_DATA_SIZE;
 		if (i < startlid)