[ofa-general] [PATCH 2/2] libibmad: print warning when _do_madrpc fails with destination port information

Ira Weiny weiny2 at llnl.gov
Tue Jun 24 14:48:39 PDT 2008


>From e428df95fb65becd8bff82dc13ae40cfd3563d46 Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
Date: Tue, 24 Jun 2008 14:43:24 -0700
Subject: [PATCH] libibmad: print warning when _do_madrpc fails with destination port information


Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
 libibmad/src/rpc.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c
index cb1940b..7ff0aa5 100644
--- a/libibmad/src/rpc.c
+++ b/libibmad/src/rpc.c
@@ -42,6 +42,7 @@
 #include <sys/time.h>
 #include <string.h>
 #include <errno.h>
+#include <arpa/inet.h>
 
 #include <infiniband/umad.h>
 #include "mad.h"
@@ -185,8 +186,16 @@ mad_rpc(void *port_id, ib_rpc_t *rpc, ib_portid_t *dport, void *payload,
 
 	if ((len = _do_madrpc(p->port_id, sndbuf, rcvbuf,
 			      p->class_agents[rpc->mgtclass],
-			      len, rpc->timeout)) < 0)
+			      len, rpc->timeout)) < 0) {
+		static char gid[256];
+		static char drpath[256];
+		inet_ntop(AF_INET6, dport->gid, gid, 256);
+		drpath2str(&(dport->drpath), drpath, 256);
+		IBWARN("_do_madrpc failed; dport (lid %d; grh \"%s\"; gid %s; drpath %s)",
+				dport->lid, dport->grh_present ? "yes":"no",
+				gid, drpath);
 		return 0;
+	}
 
 	mad = umad_get_mad(rcvbuf);
 
@@ -223,8 +232,16 @@ mad_rpc_rmpp(void *port_id, ib_rpc_t *rpc, ib_portid_t *dport,
 
 	if ((len = _do_madrpc(p->port_id, sndbuf, rcvbuf,
 			      p->class_agents[rpc->mgtclass],
-			      len, rpc->timeout)) < 0)
+			      len, rpc->timeout)) < 0) {
+		static char gid[256];
+		static char drpath[256];
+		inet_ntop(AF_INET6, dport->gid, gid, 256);
+		drpath2str(&(dport->drpath), drpath, 256);
+		IBWARN("_do_madrpc failed; dport (lid %d; grh \"%s\"; gid %s; drpath %s)",
+				dport->lid, dport->grh_present ? "yes":"no",
+				gid, drpath);
 		return 0;
+	}
 
 	mad = umad_get_mad(rcvbuf);
 
-- 
1.5.1




More information about the general mailing list