Skip to contentSkip to conversation

opensm: fixed port order configuration in torus routing engine

PATCH In review Alex Netes 2 participants 8 messages May 30, 2011 – Jun 3, 2011 6 messages not in the archive InfiniBand

lore
Share & tools
lore

Alex Netes

author
#0 lore raw

Commit 1c2a298b295eba7e24205519abc24e47106d15df broke port order configuration for torus routing engine. order was incorrectly initiated, causing setting LFTs to fail.

---
 opensm/osm_torus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
opensm/osm_torus.c +2 -2
index cd3d490..75724d2 100644
@@ -8484,7 +8484,7 @@ bool torus_lft(struct torus *t, struct t_switch *sw)
 	struct port_grp *pgrp;
 	struct t_switch *dsw;
 	osm_switch_t *osm_sw;
-	unsigned order[IB_NODE_NUM_PORTS_MAX+1];
+	unsigned char order[IB_NODE_NUM_PORTS_MAX+1];
 
 	if (!(sw->osm_switch && sw->osm_switch->priv == sw)) {
 		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
@@ -8506,7 +8506,7 @@ bool torus_lft(struct torus *t, struct t_switch *sw)
 
 		for (p = 0; p < ARRAY_SIZE(order); p++) {
 
-			unsigned px = order[t->port_order[p]];
+			unsigned char px = order[t->port_order[p]];
 
 			if (px == IB_INVALID_PORT_NUM)
 				continue;
Signature · 9 lines
1.7.5.2

-- 

-- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20110530132345.GB20342-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org

Acked-by
#2 lore raw

Hi Alex,

Quoted 23 lines · Alex Netes

Commit 1c2a298b295eba7e24205519abc24e47106d15df broke port order configuration for torus routing engine. order was incorrectly initiated, causing setting LFTs to fail.

---
 opensm/osm_torus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
opensm/osm_torus.c +1 -1
index cd3d490..75724d2 100644
@@ -8484,7 +8484,7 @@ bool torus_lft(struct torus *t, struct t_switch *sw)
 	struct port_grp *pgrp;
 	struct t_switch *dsw;
 	osm_switch_t *osm_sw;
-	unsigned order[IB_NODE_NUM_PORTS_MAX+1];
+	unsigned char order[IB_NODE_NUM_PORTS_MAX+1];
 
 	if (!(sw->osm_switch && sw->osm_switch->priv == sw)) {
 		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,

opensm/osm_torus.c bool torus_lft(struct torus *t, struct t_switch *sw) · line 8512

Quoted 8 lines
opensm/osm_torus.c +1 -1
@@ -8506,7 +8506,7 @@ bool torus_lft(struct torus *t, struct t_switch *sw)
 
 		for (p = 0; p < ARRAY_SIZE(order); p++) {
 
-			unsigned px = order[t->port_order[p]];
+			unsigned char px = order[t->port_order[p]];
 
 			if (px == IB_INVALID_PORT_NUM)
 				continue;

I guess the memset(order, IB_INVALID_PORT_NUM, sizeof(order)) a few lines up does the wrong thing without your fix, since we compare here with IB_INVALID_PORT_NUM?

Nice catch - I'm sorry I missed it.

FWIW, ib_types.h uses uint8_t for ports - maybe should do that here as well rather than unsigned char?

-- Jim

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw

PATCH 1/1 opensm: fixed port order configuration in torus routing engine

Commit 1c2a298b295eba7e24205519abc24e47106d15df broke port order configuration for torus routing engine. order was incorrectly initiated, causing setting LFTs to fail.

---
Changes since v1:
1. Defined order[] as uint8_t
2. Removed error message while parsing port_order. It gives false alarms, because strtok() returns NULL when no tokens left.

--

 opensm/osm_torus.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
opensm/osm_torus.c +4 -6
index cd3d490..29c1bb4 100644
@@ -868,11 +868,9 @@ bool parse_port_order(struct torus *t, const char *parse_sep)
 	unsigned i, j, k, n;
 
 	for (i = 0; i < ARRAY_SIZE(t->port_order); i++) {
-		if (!parse_port(&(t->port_order[i]), parse_sep)) {
-			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
-				"Error: cannot parse port_order");
+		if (!parse_port(&(t->port_order[i]), parse_sep))
 			break;
-		}
+
 		for (j = 0; j < i; j++) {
 			if (t->port_order[j] == t->port_order[i]) {
 				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
@@ -8484,7 +8482,7 @@ bool torus_lft(struct torus *t, struct t_switch *sw)
 	struct port_grp *pgrp;
 	struct t_switch *dsw;
 	osm_switch_t *osm_sw;
-	unsigned order[IB_NODE_NUM_PORTS_MAX+1];
+	uint8_t order[IB_NODE_NUM_PORTS_MAX+1];
 
 	if (!(sw->osm_switch && sw->osm_switch->priv == sw)) {
 		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
@@ -8506,7 +8504,7 @@ bool torus_lft(struct torus *t, struct t_switch *sw)
 
 		for (p = 0; p < ARRAY_SIZE(order); p++) {
 
-			unsigned px = order[t->port_order[p]];
+			uint8_t px = order[t->port_order[p]];
 
 			if (px == IB_INVALID_PORT_NUM)
 				continue;
Signature · 6 lines
1.7.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20110601154046.GA1098-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org

Acked-by
#6 lore raw
Quoted 5 lines · Alex Netes

Commit 1c2a298b295eba7e24205519abc24e47106d15df broke port order configuration for torus routing engine. order was incorrectly initiated, causing setting LFTs to fail.

Also, while reviewing this I noticed a couple things in the port-order patch that I should have noticed earlier, but didn't. I have a couple of minor fixup patches that go on top of this one, to send along in a minute.

-- Jim

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

PATCH 1/2 opensm: fail if configured torus port order references a port not available in all switches

---
 opensm/osm_torus.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)
opensm/osm_torus.c +20 -4
index 29c1bb4..47654ce 100644
@@ -856,9 +856,6 @@ bool parse_port(unsigned *pnum, const char *parse_sep)
 	if (!val)
 		return false;
 	*pnum = strtoul(val, &nextchar, 0);
-	if (*pnum > IB_NODE_NUM_PORTS_MAX) {
-		*pnum = 0;
-	}
 	return true;
 }
 
@@ -7018,7 +7015,8 @@ static
 bool verify_setup(struct torus *t, struct fabric *f)
 {
 	struct coord_dirs *o;
-	unsigned n = 0;
+	struct f_switch *sw;
+	unsigned p, s, n = 0;
 	bool success = false;
 	bool all_sw_present, need_seed = true;
 
@@ -7044,6 +7042,24 @@ bool verify_setup(struct torus *t, struct fabric *f)
 			"with two QoS levels (have %d need 8)\n",
 			(int)t->osm->subn.min_data_vls);
 	/*
+	 * Be sure all the switches in the torus support the port
+	 * ordering that might have been configured.
+	 */
+	for (s = 0; s < f->switch_cnt; s++) {
+		sw = f->sw[s];
+		for (p = 0; p < sw->port_cnt; p++) {
+			if (t->port_order[p] >= sw->port_cnt) {
+				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+					"Error: port_order configured using "
+					"port %u, but only %u ports in "
+					"switch w/ GUID 0x%04"PRIx64"\n",
+					t->port_order[p],  sw->port_cnt - 1,
+					cl_ntoh64(sw->n_id));
+				goto out;
+			}
+		}
+	}
+	/*
 	 * Unfortunately, there is a problem with non-unique topology for any
 	 * torus dimension which has radix four.  This problem requires extra
 	 * input, in the form of specifying both the positive and negative
Signature · 7 lines
1.6.2.2


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1306967581-1015-1-git-send-email-jaschut-4OHPYypu0djtX7QSmKvirg@public.gmane.org

#11 lore raw

PATCH 2/2 opensm: use OSM_LOG_INFO on duplicate torus port order parsing

In reply to a message not in the archive

Since it doesn't cause OpenSM to exit, it isn't an error. We just want to give the admin information that will allow them to clean up their configuration.

---
 opensm/osm_torus.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
opensm/osm_torus.c +2 -2
index 47654ce..d06cea9 100644
@@ -870,8 +870,8 @@ bool parse_port_order(struct torus *t, const char *parse_sep)
 
 		for (j = 0; j < i; j++) {
 			if (t->port_order[j] == t->port_order[i]) {
-				OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
-					"Error: ignoring duplicate port %u in "
+				OSM_LOG(&t->osm->log, OSM_LOG_INFO,
+					"Ignored duplicate port %u in"
 					" port_order parsing\n",
 					t->port_order[j]);
 				i--;	/* Ignore duplicate port number */
Signature · 7 lines
1.6.2.2


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1306967581-1015-2-git-send-email-jaschut-4OHPYypu0djtX7QSmKvirg@public.gmane.org

author
#13 lore raw

Re: [PATCH 2/2] opensm: use OSM_LOG_INFO on duplicate torus port order parsing

Quoted 6 lines · Jim Schutt

Since it doesn't cause OpenSM to exit, it isn't an error. We just want to give the admin information that will allow them to clean up their configuration.

---

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html