Hey Sasha,

Here's the patches to support routers in the switchbalance console
command and the check_lft_balance.pl script.

Thanks,
Al

On Thu, 2008-03-13 at 14:23 -0700, Al Chu wrote:
> Hey Sasha,
> 
> On Thu, 2008-03-13 at 20:47 +0000, Sasha Khapyorsky wrote:
> > On 15:37 Wed 12 Mar     , Al Chu wrote:
> > > Hey Sasha,
> > > 
> > > Forgot to run this through osm_indent.  Here's the cleaned up patch.
> > > 
> > > Al
> > > 
> > > On Wed, 2008-03-12 at 09:57 -0700, Al Chu wrote:
> > > > Hey Sasha,
> > > > 
> > > > Here's a patch that does the previously discussed switchbalance console
> > > > option.  Algorithmically it does pretty much the exact same thing as the
> > > > check_lft_balance script, but everything is faster of course b/c opensm
> > > > already knows everything.
> > > > 
> > > > Al
> > > > 
> > > > _______________________________________________
> > > > general mailing list
> > > > [email protected]
> > > > http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> > > > 
> > > > To unsubscribe, please visit 
> > > > http://openib.org/mailman/listinfo/openib-general
> > > -- 
> > > Albert Chu
> > > [EMAIL PROTECTED]
> > > 925-422-5311
> > > Computer Scientist
> > > High Performance Systems Division
> > > Lawrence Livermore National Laboratory
> > 
> > > From ffdba2635aeea1d1be58c8966f8f6137bb048dea Mon Sep 17 00:00:00 2001
> > > From: Albert L. Chu <[EMAIL PROTECTED]>
> > > Date: Wed, 12 Mar 2008 15:34:49 -0700
> > > Subject: [PATCH] add switchbalance command to console
> > > 
> > > 
> > > Signed-off-by: Albert L. Chu <[EMAIL PROTECTED]>
> > 
> > Applied. Thanks. Small question is below.
> > 
> > [snip...]
> > >  
> > > +static void switchbalance_check(osm_opensm_t * p_osm,
> > > +                         osm_switch_t * p_sw, FILE * out, int verbose)
> > > +{
> > > + uint8_t port_num;
> > > + uint8_t num_ports;
> > > + const cl_qmap_t *p_port_tbl;
> > > + osm_port_t *p_port;
> > > + osm_physp_t *p_physp;
> > > + osm_physp_t *p_rem_physp;
> > > + osm_node_t *p_rem_node;
> > > + uint32_t count[255];    /* max ports is a uint8_t */
> > > + uint8_t output_ports[255];
> > > + uint8_t output_ports_count = 0;
> > > + uint32_t min_count = 0xFFFFFFFF;
> > > + uint32_t max_count = 0;
> > > + unsigned int i;
> > > +
> > > + memset(count, '\0', sizeof(uint32_t) * 255);
> > > +
> > > + /* Count port usage */
> > > + p_port_tbl = &p_osm->subn.port_guid_tbl;
> > > + for (p_port = (osm_port_t *) cl_qmap_head(p_port_tbl);
> > > +      p_port != (osm_port_t *) cl_qmap_end(p_port_tbl);
> > > +      p_port = (osm_port_t *) cl_qmap_next(&p_port->map_item)) {
> > > +         uint16_t min_lid_ho;
> > > +         uint16_t max_lid_ho;
> > > +         uint16_t lid_ho;
> > > +
> > > +         /* Don't count switches in port usage */
> > > +         if (osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_SWITCH)
> > > +                 continue;
> > > +
> > > +         osm_port_get_lid_range_ho(p_port, &min_lid_ho, &max_lid_ho);
> > > +
> > > +         if (min_lid_ho == 0 || max_lid_ho == 0)
> > > +                 continue;
> > > +
> > > +         for (lid_ho = min_lid_ho; lid_ho <= max_lid_ho; lid_ho++) {
> > > +                 port_num = osm_fwd_tbl_get(&(p_sw->fwd_tbl), lid_ho);
> > > +                 if (port_num == OSM_NO_PATH)
> > > +                         continue;
> > > +
> > > +                 count[port_num]++;
> > > +         }
> > > + }
> > > +
> > > + num_ports = p_sw->num_ports;
> > > + for (port_num = 1; port_num < num_ports; port_num++) {
> > > +         p_physp = osm_node_get_physp_ptr(p_sw->p_node, port_num);
> > > +
> > > +         /* if port is down/unhealthy, don't consider it in 
> > > +          * min/max calculations
> > > +          */
> > > +         if (!p_physp || !osm_physp_is_healthy(p_physp)
> > > +             || !osm_physp_get_remote(p_physp))
> > > +                 continue;
> > > +
> > > +         p_rem_physp = osm_physp_get_remote(p_physp);
> > > +         p_rem_node = osm_physp_get_node_ptr(p_rem_physp);
> > > +
> > > +         /* If we are directly connected to a CA, its not really 
> > > +          * up for balancing consideration.
> > > +          */
> > > +         if (osm_node_get_type(p_rem_node) == IB_NODE_TYPE_CA)
> > > +                 continue;
> > 
> > Should this be
> > 
> >     if (osm_node_get_type(p_rem_node) != IB_NODE_TYPE_SWITCH)
> > 
> > ? So routers will be not counted too?
> 
> I think you're right.  I should adjust for this in my 'lidbalance'
> script and 'check_lft_balance.pl' tool.
> 
> I'll post some new patches.
> 
> Al
> 
> > Sasha
> -- 
> Albert Chu
> [EMAIL PROTECTED]
> 925-422-5311
> Computer Scientist
> High Performance Systems Division
> Lawrence Livermore National Laboratory
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
-- 
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 002ebc6b2d0397d188d19b5889e0f0177a965bc5 Mon Sep 17 00:00:00 2001
From: Albert L. Chu <[EMAIL PROTECTED]>
Date: Thu, 13 Mar 2008 14:32:30 -0700
Subject: [PATCH] handle routers in switchbalance console command


Signed-off-by: Albert L. Chu <[EMAIL PROTECTED]>
---
 opensm/opensm/osm_console.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opensm/opensm/osm_console.c b/opensm/opensm/osm_console.c
index 191f813..bda48a3 100644
--- a/opensm/opensm/osm_console.c
+++ b/opensm/opensm/osm_console.c
@@ -775,10 +775,10 @@ static void switchbalance_check(osm_opensm_t * p_osm,
 		p_rem_physp = osm_physp_get_remote(p_physp);
 		p_rem_node = osm_physp_get_node_ptr(p_rem_physp);
 
-		/* If we are directly connected to a CA, its not really
+		/* If we are directly connected to a CA/router, its not really
 		 * up for balancing consideration.
 		 */
-		if (osm_node_get_type(p_rem_node) == IB_NODE_TYPE_CA)
+		if (osm_node_get_type(p_rem_node) != IB_NODE_TYPE_SWITCH)
 			continue;
 
 		output_ports[output_ports_count] = port_num;
-- 
1.5.1

>From 1c7f5496d397bceb18d1fd9ec43cc021515879aa Mon Sep 17 00:00:00 2001
From: Albert L. Chu <[EMAIL PROTECTED]>
Date: Thu, 13 Mar 2008 14:51:31 -0700
Subject: [PATCH] add router support to check_lft_balance.pl


Signed-off-by: Albert L. Chu <[EMAIL PROTECTED]>
---
 infiniband-diags/scripts/check_lft_balance.pl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/infiniband-diags/scripts/check_lft_balance.pl b/infiniband-diags/scripts/check_lft_balance.pl
index 71b7aaa..66f5f0f 100755
--- a/infiniband-diags/scripts/check_lft_balance.pl
+++ b/infiniband-diags/scripts/check_lft_balance.pl
@@ -278,8 +278,8 @@ foreach $lft_line (@lft_lines) {
 		@host_ports                            = ();
 		$lids_per_port                         = 0;
 		$lids_per_port_calculated              = 0;
-	} elsif ($lft_line =~ /Channel/) {
-		$lft_line =~ /.+ (.+) : \(Channel Adapter portguid .+: '(.+)'\)/;
+	} elsif ($lft_line =~ /Channel/ || $lft_line =~ /Router/) {
+		$lft_line =~ /.+ (.+) : \(.+ portguid .+: '(.+)'\)/;
 		$host = $2;
 		$switch_port_count{$1}++;
 		if (@host_ports) {
-- 
1.5.1

_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to