[ofa-general] [PATCH] infiniband-diags/ibtracert: fix port by direct path resolving
Sasha Khapyorsky
sashak at voltaire.com
Fri Sep 12 18:18:09 PDT 2008
Then option '-D' is used ports provided to ibtracert in direct path
format. This option was broken (bug #1136) due to incorrect resolution -
lack of lid. This addresses bug #1136.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
infiniband-diags/src/ibtracert.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/infiniband-diags/src/ibtracert.c b/infiniband-diags/src/ibtracert.c
index eb9329c..21edfba 100644
--- a/infiniband-diags/src/ibtracert.c
+++ b/infiniband-diags/src/ibtracert.c
@@ -673,6 +673,20 @@ free_name:
free(nodename);
}
+static int resolve_lid(ib_portid_t *portid, const void *srcport)
+{
+ uint8_t portinfo[64];
+ uint16_t lid;
+
+ if (!smp_query_via(portinfo, portid, IB_ATTR_PORT_INFO, 0, 0, srcport))
+ return -1;
+ mad_decode_field(portinfo, IB_PORT_LID_F, &lid);
+
+ ib_portid_set(portid, lid, 0, 0);
+
+ return 0;
+}
+
static void
usage(void)
{
@@ -806,6 +820,15 @@ main(int argc, char **argv)
if (ib_resolve_portid_str(&dest_portid, argv[1], dest_type, sm_id) < 0)
IBERROR("can't resolve destination port %s", argv[1]);
+ if (dest_type == IB_DEST_DRPATH) {
+ if (resolve_lid(&src_portid, NULL) < 0)
+ IBERROR("cannot resolve lid for port \'%s\'",
+ portid2str(&src_portid));
+ if (resolve_lid(&dest_portid, NULL) < 0)
+ IBERROR("cannot resolve lid for port \'%s\'",
+ portid2str(&dest_portid));
+ }
+
if (dest_portid.lid == 0 || src_portid.lid == 0) {
IBWARN("bad src/dest lid");
usage();
--
1.6.0.1.196.g01914
More information about the general
mailing list