[ofa-general] [PATCH] libibnetdisc: add retract_dpath function

Ira Weiny weiny2 at llnl.gov
Wed Aug 26 10:31:42 PDT 2009


From: Ira Weiny <weiny2 at llnl.gov>
Date: Wed, 26 Aug 2009 09:25:00 -0700
Subject: [PATCH] libibnetdisc: add retract_dpath function

	When using combined routing some switches do not handle Hop Count of 0
	well.  Detect when the drpath count is 0 and return to lid based
	routing in this case.

Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/libibnetdisc/src/ibnetdisc.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c
index c69467e..da8572c 100644
--- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c
+++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c
@@ -175,6 +175,16 @@ static int add_port_to_dpath(ib_dr_path_t * path, int nextport)
 	return path->cnt;
 }
 
+static int retract_dpath(ib_portid_t * path)
+{
+	path->drpath.cnt--;	/* restore path */
+	if (path->drpath.cnt == 0 && path->lid) {
+		/* return to lid based routing on this path */
+		path->drpath.drslid = 0;
+		path->drpath.drdlid = 0;
+	}
+}
+
 static int extend_dpath(struct ibmad_port *ibmad_port, ibnd_fabric_t * fabric,
 			ib_portid_t * portid, int nextport)
 {
@@ -502,7 +512,7 @@ static int get_remote_node(struct ibmad_port *ibmad_port,
 	if (query_node(ibmad_port, fabric, &node_buf, &port_buf, path)) {
 		IBND_ERROR("Query remote node (%s) failed, skipping port\n",
 			   portid2str(path));
-		path->drpath.cnt--;	/* restore path */
+		retract_dpath(path);
 		return 1;	/* positive == non-fatal error */
 	}
 
@@ -530,7 +540,7 @@ static int get_remote_node(struct ibmad_port *ibmad_port,
 	link_ports(node, port, remotenode, remoteport);
 
 error:
-	path->drpath.cnt--;	/* restore path */
+	retract_dpath(path);
 	return (rc);
 }
 
-- 
1.5.4.5




More information about the general mailing list