[ofa-general] [PATCH 2/3] Add combined routing support to libibnetdisc
Ira Weiny
weiny2 at llnl.gov
Thu Apr 30 14:29:58 PDT 2009
From: Ira Weiny <weiny2 at llnl.gov>
Date: Wed, 29 Apr 2009 10:15:55 -0700
Subject: [PATCH] Add combined routing support to libibnetdisc
Also allow a scan to start at a switch.
Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
infiniband-diags/libibnetdisc/src/ibnetdisc.c | 28 ++++++++++++++++++------
1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c
index 0ff5134..fc19633 100644
--- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c
+++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c
@@ -177,11 +177,26 @@ add_port_to_dpath(ib_dr_path_t *path, int nextport)
}
static int
-extend_dpath(struct ibnd_fabric *f, ib_dr_path_t *path, int nextport)
+extend_dpath(struct ibnd_fabric *f, ib_portid_t *portid, int nextport)
{
- int rc = add_port_to_dpath(path, nextport);
- if ((rc != -1) && (path->cnt > f->fabric.maxhops_discovered))
- f->fabric.maxhops_discovered = path->cnt;
+ int rc = 0;
+
+ if (portid->lid && !portid->drpath.drslid) {
+ /* If we were LID routed
+ * AND have not done so already
+ * we need to set up the drslid
+ */
+ ib_portid_t selfportid = { 0 };
+ if (ib_resolve_self_via(&selfportid, NULL, NULL, f->fabric.ibmad_port) < 0)
+ return -1;
+ portid->drpath.drslid = selfportid.lid;
+ portid->drpath.drdlid = 0xFFFF;
+ }
+
+ rc = add_port_to_dpath(&portid->drpath, nextport);
+
+ if ((rc != -1) && (portid->drpath.cnt > f->fabric.maxhops_discovered))
+ f->fabric.maxhops_discovered = portid->drpath.cnt;
return (rc);
}
@@ -447,7 +462,7 @@ get_remote_node(struct ibnd_fabric *fabric, struct ibnd_node *node, struct ibnd_
!= IB_PORT_PHYS_STATE_LINKUP)
return -1;
- if (extend_dpath(fabric, &path->drpath, portnum) < 0)
+ if (extend_dpath(fabric, path, portnum) < 0)
return -1;
if (query_node(fabric, &node_buf, &port_buf, path)) {
@@ -546,8 +561,7 @@ ibnd_discover_fabric(struct ibmad_port *ibmad_port, int timeout_ms,
if (!port)
IBPANIC("out of memory");
- if (node->node.type != IB_NODE_SWITCH &&
- get_remote_node(fabric, node, port, from,
+ if(get_remote_node(fabric, node, port, from,
mad_get_field(node->node.info, 0, IB_NODE_LOCAL_PORT_F),
0) < 0)
return ((ibnd_fabric_t *)fabric);
--
1.5.4.5
More information about the general
mailing list