[ofa-general] [PATCH 1/2] libibmad: add a drpath2str function for easier printing of DR Paths.
Ira Weiny
weiny2 at llnl.gov
Tue Jun 24 14:48:38 PDT 2008
>From e5d47f962f7ce9b71f12d31306ae1e0400e46836 Mon Sep 17 00:00:00 2001
From: Ira K. Weiny <weiny2 at llnl.gov>
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/portid.c | 12 ++++++++++++
2 files changed, 13 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/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