[ofa-general] [PATCH 1/2 v2] libibmad: add a drpath2str function for easier printing of DR Paths.
Ira Weiny
weiny2 at llnl.gov
Tue Jun 24 16:45:57 PDT 2008
On Tue, 24 Jun 2008 15:31:27 -0700
Hal Rosenstock <hrosenstock at xsigo.com> wrote:
> On Tue, 2008-06-24 at 14:48 -0700, Ira Weiny wrote:
> > --- a/libibmad/include/infiniband/mad.h
> > +++ b/libibmad/include/infiniband/mad.h
> > @@ -622,6 +622,7 @@ enum {
> > char * portid2str(ib_portid_t *portid);
> > int portid2portnum(ib_portid_t *portid);
> > int str2drpath(ib_dr_path_t *path, char *routepath, int drslid,
> > int drdlid);
> > +char * drpath2str(ib_dr_path_t *path, char *dstr, size_t dstr_size);
>
> Should drpath2str be added to libibmad.map too ?
>
> -- Hal
Ooops... yes... since I was only using it internally right now I did not
catch that.
Thanks,
Ira
>From 3e192dabd78f81342106b24ee0407725f8cf78eb Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at wopri.(none)>
Date: Tue, 24 Jun 2008 14:42:25 -0700
Subject: [PATCH] libibmad: add a drpath2str function for easier printing of DR Paths.
Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
---
libibmad/include/infiniband/mad.h | 1 +
libibmad/src/libibmad.map | 1 +
libibmad/src/portid.c | 12 ++++++++++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
index 4f19a31..ae3c644 100644
--- a/libibmad/include/infiniband/mad.h
+++ b/libibmad/include/infiniband/mad.h
@@ -622,6 +622,7 @@ enum {
char * portid2str(ib_portid_t *portid);
int portid2portnum(ib_portid_t *portid);
int str2drpath(ib_dr_path_t *path, char *routepath, int drslid, int drdlid);
+char * drpath2str(ib_dr_path_t *path, char *dstr, size_t dstr_size);
static inline int
ib_portid_set(ib_portid_t *portid, int lid, int qp, int qkey)
diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map
index c1eb613..5a45a64 100644
--- a/libibmad/src/libibmad.map
+++ b/libibmad/src/libibmad.map
@@ -56,6 +56,7 @@ IBMAD_1.3 {
portid2portnum;
portid2str;
str2drpath;
+ drpath2str;
mad_agent_class;
mad_class_agent;
mad_register_client;
diff --git a/libibmad/src/portid.c b/libibmad/src/portid.c
index 056b03d..7279e14 100644
--- a/libibmad/src/portid.c
+++ b/libibmad/src/portid.c
@@ -114,3 +114,15 @@ str2drpath(ib_dr_path_t *path, char *routepath, int drslid, int drdlid)
return path->cnt;
}
+
+char *
+drpath2str(ib_dr_path_t *path, char *dstr, size_t dstr_size)
+{
+ int i = 0;
+ int rc = snprintf(dstr, dstr_size, "slid %d; dlid %d; %d",
+ path->drslid, path->drdlid, path->p[0]);
+ for (i = 1; i <= path->cnt; i++) {
+ rc += snprintf(dstr+rc, dstr_size-rc, ",%d", path->p[i]);
+ }
+ return (dstr);
+}
--
1.5.1
More information about the general
mailing list