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
