Skip to contentSkip to conversation

OpenSM torus routing order list

PATCH Superseded Alex Netes 2 participants 4 messages Mar 21, 2011 – May 2, 2011 3 messages not in the archive InfiniBand

lore
Share & tools
lore

Alex Netes

author
#0 lore raw

PATCH 1/1 OpenSM torus routing order list

Enables to define list of switch ports so the SM will go over this list when creating a routing.
It helps balancing links load on some communication patterns where multipile links connect between the switches.

---
 man/torus-2QoS.conf.5.in |   19 ++++++++++++-
 opensm/osm_torus.c       |   65 +++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 79 insertions(+), 5 deletions(-)
man/torus-2QoS.conf.5.in +17 -2
index 147a7b1..dd1aafb 100644
@@ -62,7 +62,7 @@ see \fBUNICAST ROUTING\fR in torus-2QoS(8).
 \fIsw0_GUID sw1_GUID
 \fR
 .RS
-These keywords are used to seed the torus/mesh topolgy.
+These keywords are used to seed the torus/mesh topology.
 For example, "xp_link 0x2000 0x2001" specifies that a link from
 the switch with node GUID 0x2000 to the switch with node GUID 0x2001
 would point in the positive x direction,
@@ -78,7 +78,7 @@ for torus dimensions of radix four (see \fBTOPOLOGY DISCOVERY\fR in
 torus-2QoS(8)).  For such cases both the positive and negative coordinate
 directions must be specified.
 .P
-Based on the topology specifed via the \fBtorus\fR/\fBmesh\fR keyword,
+Based on the topology specified via the \fBtorus\fR/\fBmesh\fR keyword,
 torus-2QoS will detect and log when it has insufficient seed configuration.
 .RE
 .
@@ -140,6 +140,17 @@ parameter needs to be increased.
 If this keyword appears multiple times, the last instance prevails.
 .RE
 .
+.P
+\fBport_order
+\fIp1 p2 p3 ...
+\fR
+.RS
+This keyword specifies the order on which the ports would be chosen for routing.
+This keyword is optional and if given overrides the default order.
+It's possible to define any subset of ports that would be chosen before the
+others.
+.RE
+.
 .SH EXAMPLE
 .
 \f(RC
@@ -171,6 +182,10 @@ z_dateline -1  # back to its original position.
 # on a host attached to a switch from the second seed.
 # Both instances should use this torus-2QoS.conf to ensure
 # path SL values do not change in the event of SM failover.
+
+# port_order defines the order on which the ports would be
+# chosen for routing.
+port_order 7 10 8 11 9 12 25 28 26 29 27 30
 .fi
 \fR
 .
opensm/osm_torus.c +62 -3

111 lines not on this page · raw message

Signature · 6 lines
1.7.3.4

--
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): 20110321095823.GA22502-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org

#2 lore raw

Hi,

Quoted 39 lines · Alex Netes

Enables to define list of switch ports so the SM will go over this list when creating a routing.
It helps balancing links load on some communication patterns where multipile links connect between the switches.

---
 man/torus-2QoS.conf.5.in |   19 ++++++++++++-
 opensm/osm_torus.c       |   65 +++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 79 insertions(+), 5 deletions(-)
man/torus-2QoS.conf.5.in +3 -2
index 147a7b1..dd1aafb 100644
@@ -62,7 +62,7 @@ see \fBUNICAST ROUTING\fR in torus-2QoS(8).
 \fIsw0_GUID sw1_GUID
 \fR
 .RS
-These keywords are used to seed the torus/mesh topolgy.
+These keywords are used to seed the torus/mesh topology.
 For example, "xp_link 0x2000 0x2001" specifies that a link from
 the switch with node GUID 0x2000 to the switch with node GUID 0x2001
 would point in the positive x direction,
@@ -78,7 +78,7 @@ for torus dimensions of radix four (see \fBTOPOLOGY DISCOVERY\fR in
 torus-2QoS(8)).  For such cases both the positive and negative coordinate
 directions must be specified.
 .P
-Based on the topology specifed via the \fBtorus\fR/\fBmesh\fR keyword,
+Based on the topology specified via the \fBtorus\fR/\fBmesh\fR keyword,
 torus-2QoS will detect and log when it has insufficient seed configuration.
 .RE
 .
@@ -140,6 +140,17 @@ parameter needs to be increased.
 If this keyword appears multiple times, the last instance prevails.
 .RE
 .
+.P

man/torus-2QoS.conf.5.in parameter needs to be increased. · line 153

Quoted 10 lines
man/torus-2QoS.conf.5.in +10 -0
+\fBport_order
+\fIp1 p2 p3 ...
+\fR
+.RS
+This keyword specifies the order on which the ports would be chosen for routing.
+This keyword is optional and if given overrides the default order.
+It's possible to define any subset of ports that would be chosen before the
+others.
+.RE
+.

This documentation needs to tell me a little more about how to choose port_order values.

Something like this:

This keyword specifies the order in which CA ports on a destination switch are visited when computing routes. When the fabric contains switches connected with multiple parallel links, routes are distributed in a round-robin fashion across such links, and so changing the order that CA ports are visited changes the distribution of routes across such links. This may be advantageous for some specific traffic patterns.

The default is to visit CA ports in increasing port order on destination switches.

Duplicate values in the list will be ignored.

Quoted 31 lines
man/torus-2QoS.conf.5.in +4 -0
 .SH EXAMPLE
 .
 \f(RC
@@ -171,6 +182,10 @@ z_dateline -1  # back to its original position.
 # on a host attached to a switch from the second seed.
 # Both instances should use this torus-2QoS.conf to ensure
 # path SL values do not change in the event of SM failover.
+
+# port_order defines the order on which the ports would be
+# chosen for routing.
+port_order 7 10 8 11 9 12 25 28 26 29 27 30
 .fi
 \fR
 .
opensm/osm_torus.c +2 -0
index add3cf9..7723a45 100644
@@ -287,6 +287,8 @@ struct torus {
 	unsigned seed_cnt, seed_idx;
 	unsigned x_sz, y_sz, z_sz;
 
+	unsigned port_order[IB_NODE_NUM_PORTS_MAX+1];
+
 	unsigned sw_pool_sz;
 	unsigned link_pool_sz;
 	unsigned seed_sz;
@@ -844,6 +846,47 @@ out:
 }
 
 static

opensm/osm_torus.c out: · line 858

Quoted 10 lines
opensm/osm_torus.c +10 -0
+bool parse_port(unsigned *pnum, const char *parse_sep)
+{
+	char *val, *nextchar;
+
+	val = strtok(NULL, parse_sep);
+	if (!val)
+		return false;
+	*pnum = strtoul(val, &nextchar, 0);
+	if (*pnum > IB_NODE_NUM_PORTS_MAX)
+		*pnum = 0;

Hmmm, user configuration was just silently discarded. Please warn to give the user a chance to correct it.

opensm/osm_torus.c out: · line 867

Quoted 9 lines
opensm/osm_torus.c +9 -0
+	return true;
+}
+
+static
+bool parse_port_order(struct torus *t, const char *parse_sep)
+{
+	unsigned i, j, k, n;
+
+	for (i = 0; i < (sizeof(t->port_order) / sizeof(unsigned)); i++) {

Please add this (from linux kernel):
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

and use it instead for all such loops.

opensm/osm_torus.c out: · line 872

Quoted 5 lines
opensm/osm_torus.c +5 -0
+		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]) {
+				i--;	/* Ignore duplicate port number */

Again, please warn that user configuration was discarded.

opensm/osm_torus.c out: · line 883

Quoted 11 lines
opensm/osm_torus.c +11 -0
+				break;
+			}
+		}
+	}
+
+	n = i;
+	for (j = 0; j < (sizeof(t->port_order) / sizeof(unsigned)); j++) {
+		for (k = 0; k < i; k++)
+			if (t->port_order[k] == j)
+				break;
+		if (k >= i) t->port_order[n++] = j;

Style nit: make that last line into two lines.

Quoted 27 lines
opensm/osm_torus.c +9 -0
+	}
+
+	return true;
+}
+
+static
 bool parse_pg_max_ports(struct torus *t, const char *parse_sep)
 {
 	char *val, *nextchar;
@@ -1018,6 +1061,8 @@ next_line:
 	} else if (strcmp("mesh", keyword) == 0) {
 		t->flags |= X_MESH | Y_MESH | Z_MESH;
 		kw_success = parse_torus(t, parse_sep);
+	} else if (strcmp("port_order", keyword) == 0) {
+		kw_success = parse_port_order(t, parse_sep);
 	} else if (strcmp("next_seed", keyword) == 0) {
 		kw_success = grow_seed_array(t, 1);
 		t->seed_cnt++;
@@ -8424,6 +8469,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];
 
 	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 8492

Quoted 9 lines
opensm/osm_torus.c +5 -1
@@ -8439,13 +8485,22 @@ bool torus_lft(struct torus *t, struct t_switch *sw)
 		dsw = t->sw_pool[s];
 		pgrp = &dsw->ptgrp[2 * TORUS_MAX_DIM];
 
-		for (p = 0; p < pgrp->port_cnt; p++) {
+		memset(order, IB_INVALID_PORT_NUM, sizeof(order));
+		for (p = 0; p < pgrp->port_cnt; p++)
+			order[pgrp->port[p]->port] = p;
+
+		for (p = 0; p < IB_NODE_NUM_PORTS_MAX; p++) {

For consistency, p < ARRAY_SIZE(order)?

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

Quoted 6 lines
opensm/osm_torus.c +4 -1
+
+			unsigned px = order[t->port_order[p]];
 
-			if (!get_lid(pgrp, p, &dlid_base, &dlid_lmc, &ca))
+			if (px >= pgrp->port_cnt)
+				continue;

I think the above test would be more clear as

+ if (px == IB_INVALID_PORT_NUM)
+ continue;

That is the only value px can have that is not in the range 0 <= px < pgrp->port_cnt; and for me makes it more clear you are discarding values of p that weren't set based on the ordering of ports in this port group.

Quoted 19 lines
opensm/osm_torus.c +4 -1
+
+			if (!get_lid(pgrp, px, &dlid_base, &dlid_lmc, &ca))
 				return false;
 
 			if (sw->n_id == dsw->n_id)
-				dp = pgrp->port[p]->port;
+				dp = pgrp->port[px]->port;
 			else
 				dp = lft_port(t, sw, dsw, true, ca);
 			/*
@@ -9128,6 +9183,7 @@ int torus_build_lfts(void *context)
 	struct torus_context *ctx = context;
 	struct fabric *fabric;
 	struct torus *torus;
+	unsigned i;
 
 	if (!ctx->osm->subn.opt.qos) {
 		OSM_LOG(&ctx->osm->log, OSM_LOG_ERROR,

opensm/osm_torus.c int torus_build_lfts(void *context) · line 9210

Quoted 6 lines
opensm/osm_torus.c +3 -0
@@ -9149,6 +9205,9 @@ int torus_build_lfts(void *context)
 	torus->osm = ctx->osm;
 	fabric->osm = ctx->osm;
 
+	for (i = 0; i < (sizeof(torus->port_order) / sizeof(unsigned)); i++)
+		torus->port_order[i] = i;
+

I think you should move the above bit to parse_config(), since it is default configuration, and since parse_port_order() relies for proper operation on the fact that this initialization be done this way.

opensm/osm_torus.c int torus_build_lfts(void *context) · line 9213

Quoted 3 lines
opensm/osm_torus.c +0 -0
 	if (!parse_config(ctx->osm->subn.opt.torus_conf_file,
 			  fabric, torus))
 		goto out;

-- 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): 1300746824.7744.71.camel-mgfCWIlwujvg4c9jKm7R2O1ftBKYq+Ku@public.gmane.org

author
#4 lore raw

PATCH v2 1/1 OpenSM torus routing order list

Enables to define list of switch ports so the SM will go over this list when creating a routing.
It helps balancing links load on some communication patterns where multipile links connect between the switches.

---
Changes since v1:
Added detailed description in man/torus-2QoS.conf.5.in Added error messages on configuration file parsing Fixed some styling

---
 man/torus-2QoS.conf.5.in |   26 ++++++++++++++-
 opensm/osm_torus.c       |   76 ++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 97 insertions(+), 5 deletions(-)
man/torus-2QoS.conf.5.in +24 -2
index 147a7b1..df38ad3 100644
@@ -62,7 +62,7 @@ see \fBUNICAST ROUTING\fR in torus-2QoS(8).
 \fIsw0_GUID sw1_GUID
 \fR
 .RS
-These keywords are used to seed the torus/mesh topolgy.
+These keywords are used to seed the torus/mesh topology.
 For example, "xp_link 0x2000 0x2001" specifies that a link from
 the switch with node GUID 0x2000 to the switch with node GUID 0x2001
 would point in the positive x direction,
@@ -78,7 +78,7 @@ for torus dimensions of radix four (see \fBTOPOLOGY DISCOVERY\fR in
 torus-2QoS(8)).  For such cases both the positive and negative coordinate
 directions must be specified.
 .P
-Based on the topology specifed via the \fBtorus\fR/\fBmesh\fR keyword,
+Based on the topology specified via the \fBtorus\fR/\fBmesh\fR keyword,
 torus-2QoS will detect and log when it has insufficient seed configuration.
 .RE
 .
@@ -140,6 +140,24 @@ parameter needs to be increased.
 If this keyword appears multiple times, the last instance prevails.
 .RE
 .
+.P
+\fBport_order
+\fIp1 p2 p3 ...
+\fR
+.RS
+This keyword specifies the order in which CA ports on a destination switch
+are visited when computing routes. When the fabric contains switches connected
+with multiple parallel links, routes are distributed in a round-robin fashion
+across such links, and so changing the order that CA ports are visited changes
+the distribution of routes across such links.  This may be advantageous for
+some specific traffic patterns.
+.P
+The default is to visit CA ports in increasing port
+order on destination switches.
+.P
+Duplicate values in the list will be ignored.
+.RE
+.
 .SH EXAMPLE
 .
 \f(RC
@@ -171,6 +189,10 @@ z_dateline -1  # back to its original position.
 # on a host attached to a switch from the second seed.
 # Both instances should use this torus-2QoS.conf to ensure
 # path SL values do not change in the event of SM failover.
+
+# port_order defines the order on which the ports would be
+# chosen for routing.
+port_order 7 10 8 11 9 12 25 28 26 29 27 30
 .fi
 \fR
 .
opensm/osm_torus.c +73 -3

128 lines not on this page · raw message

Signature · 6 lines
1.7.5

--
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): 20110502154131.GF2088-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org

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

Enables to define list of switch ports so the SM will go over this list when creating a routing.
It helps balancing links load on some communication patterns where multipile links connect between the switches.

Quoted 9 lines

---
Changes since v1:
Added detailed description in man/torus-2QoS.conf.5.in Added error messages on configuration file parsing Fixed some styling

---
 man/torus-2QoS.conf.5.in |   26 ++++++++++++++-
 opensm/osm_torus.c       |   76 ++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 97 insertions(+), 5 deletions(-)

--
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