libnetdisc: update to 518083dc46963eb5fb48855acbe2b351ce7361f8
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 27 May 2009 16:36:44 +0000 (16:36 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 27 May 2009 16:36:44 +0000 (16:36 +0000)
commit 518083dc46963eb5fb48855acbe2b351ce7361f8
Author: Doron Shoham <dorons@voltaire.com>
Date:   Sun May 10 11:17:11 2009 +0300

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2207 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/libibnetdisc/src/ibnetdisc.c
ulp/libibnetdisc/src/internal.h

index 0ff5134..1e93ff8 100644 (file)
@@ -177,11 +177,25 @@ 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) {
+               /* If we were LID routed we need to set up the drslid */
+               if (!f->selfportid.lid)
+                       if (ib_resolve_self_via(&f->selfportid, NULL, NULL,
+                                       f->fabric.ibmad_port) < 0)
+                               return -1;
+
+               portid->drpath.drslid = f->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 +461,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 +560,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);
index 4e6bb18..5785e33 100644 (file)
@@ -88,6 +88,7 @@ struct ibnd_fabric {
        struct ibnd_node *switches;
        struct ibnd_node *ch_adapters;
        struct ibnd_node *routers;
+       ib_portid_t selfportid;
 };
 #define CONV_FABRIC_INTERNAL(fabric) ((struct ibnd_fabric *)fabric)