On Tue, 24 Jun 2008 19:22:51 -0700
Ira Weiny <[EMAIL PROTECTED]> wrote:

> On Wed, 25 Jun 2008 10:33:13 +1000
> Max Matveev <[EMAIL PROTECTED]> wrote:
> 

<snip>

> > Same as above. In fact, consider factoring that bit out.
> 
> Ah, yes...
> 
> Actually...  there is already a portid2str functions...  :-(
> 
> I will have to leave this till tomorrow to make sure I don't mess anything 
> else up tonight.
> 

Included are 2 patches which accomplish the same thing "print warning when
_do_madrpc fails with destination port information".  However, they now use the
existing portid2str function and modify that to A) print gids in nice ipv6
format and B) print slid,dlid and drpath.

Ira


>From ec5c867213d58a2a297a2ca817b50266f55a35bd Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <[EMAIL PROTECTED]>
Date: Tue, 24 Jun 2008 14:43:24 -0700
Subject: [PATCH] libibmad: print warning containing destination port when 
_do_madrpc fails


Signed-off-by: Ira K. Weiny <[EMAIL PROTECTED]>
---
 libibmad/src/rpc.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c
index 15543b2..a2cec95 100644
--- a/libibmad/src/rpc.c
+++ b/libibmad/src/rpc.c
@@ -185,13 +185,16 @@ mad_rpc(const 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) {
+               IBWARN("_do_madrpc failed; dport (%s)", portid2str(dport));
                return 0;
+       }
 
        mad = umad_get_mad(rcvbuf);
 
        if ((status = mad_get_field(mad, 0, IB_DRSMP_STATUS_F)) != 0) {
-               ERRS("MAD completed with error status 0x%x", status);
+               ERRS("MAD completed with error status 0x%x; dport (%s)",
+                       status, portid2str(dport));
                return 0;
        }
 
@@ -223,13 +226,16 @@ mad_rpc_rmpp(const 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) {
+               IBWARN("_do_madrpc failed; dport (%s)", portid2str(dport));
                return 0;
+       }
 
        mad = umad_get_mad(rcvbuf);
 
        if ((status = mad_get_field(mad, 0, IB_MAD_STATUS_F)) != 0) {
-               ERRS("MAD completed with error status 0x%x", status);
+               ERRS("MAD completed with error status 0x%x; dport (%s)",
+                       status, portid2str(dport));
                return 0;
        }
 
-- 
1.5.1

>From 31c73fc09fab80e599559e5de501708dc0f0899e Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <[EMAIL PROTECTED]>
Date: Wed, 25 Jun 2008 15:08:13 -0700
Subject: [PATCH] libibmad: update portid2str to use inet_ntop and drpath2str 
functions for gid

and drpath printing respectively

Signed-off-by: Ira K. Weiny <[EMAIL PROTECTED]>
---
 libibmad/src/portid.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/libibmad/src/portid.c b/libibmad/src/portid.c
index 7279e14..01f9530 100644
--- a/libibmad/src/portid.c
+++ b/libibmad/src/portid.c
@@ -42,6 +42,7 @@
 #include <sys/time.h>
 #include <string.h>
 #include <inttypes.h>
+#include <arpa/inet.h>
 
 #include <mad.h>
 #include <infiniband/common.h>
@@ -65,29 +66,24 @@ char *
 portid2str(ib_portid_t *portid)
 {
        static char buf[1024] = "local";
+       char drpath[512];
        char *s = buf;
        int i;
 
        if (portid->lid > 0) {
                s += sprintf(s, "Lid %d", portid->lid);
                if (portid->grh_present) {
-                       s += sprintf(s, " Gid 0x%" PRIx64 "%" PRIx64,
-                                       ntohll(*(uint64_t *)portid->gid),
-                                       ntohll(*(uint64_t *)(portid->gid+8)));
+                       char gid[sizeof 
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
+                       inet_ntop(AF_INET6, portid->gid, gid, sizeof(gid));
+                       s += sprintf(s, " Gid %s", gid);
                }
                if (portid->drpath.cnt)
                        s += sprintf(s, " ");
                else
                        return buf;
        }
-       s += sprintf(s, "DR path ");
-       for (i = 0; i < portid->drpath.cnt+1; i++) {
-               if (i == 0)
-                       s += sprintf( s, "%d", portid->drpath.p[i] );
-               else
-                       s += sprintf( s, ",%d", portid->drpath.p[i] );
-       }
-
+       s += sprintf(s, "DR path %s",
+               drpath2str(&(portid->drpath), drpath, sizeof(drpath)));
 
        return buf;
 }
-- 
1.5.1

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to