[ofa-general] [PATCH 4/4] opensm: dump functions adoption
Sasha Khapyorsky
sashak at voltaire.com
Thu Mar 8 05:45:06 PST 2007
This adopts routing dump functions to work properly with reduced min hop
tables.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
osm/opensm/osm_ucast_mgr.c | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/osm/opensm/osm_ucast_mgr.c b/osm/opensm/osm_ucast_mgr.c
index 4746d19..22a99ad 100644
--- a/osm/opensm/osm_ucast_mgr.c
+++ b/osm/opensm/osm_ucast_mgr.c
@@ -254,7 +254,7 @@ __osm_ucast_mgr_dump_ucast_routes(
uint8_t best_hops;
uint8_t best_port;
uint16_t max_lid_ho;
- uint16_t lid_ho;
+ uint16_t lid_ho, base_lid;
osm_switch_t* p_sw = (osm_switch_t *)p_map_item;
osm_ucast_mgr_t* p_mgr = ((struct ucast_mgr_dump_context *)cxt)->p_mgr;
FILE *file = ((struct ucast_mgr_dump_context *)cxt)->file;
@@ -298,14 +298,39 @@ __osm_ucast_mgr_dump_ucast_routes(
Therefore, ensure that the hop count is better than
OSM_NO_PATH.
*/
- num_hops = osm_switch_get_hop_count( p_sw, lid_ho, port_num );
+ if( p_port->p_node->sw )
+ {
+ base_lid = osm_node_get_base_lid(p_port->p_node, 0);
+ base_lid = cl_ntoh16(base_lid);
+ num_hops = osm_switch_get_hop_count( p_sw, base_lid, port_num );
+ }
+ else
+ {
+ osm_physp_t *p_physp = osm_port_get_default_phys_ptr(p_port);
+ if( !p_physp || !p_physp->p_remote_physp ||
+ !p_physp->p_remote_physp->p_node->sw )
+ num_hops = OSM_NO_PATH;
+ else
+ {
+ base_lid = osm_node_get_base_lid(p_physp->p_remote_physp->p_node, 0);
+ base_lid = cl_ntoh16(base_lid);
+ num_hops = p_physp->p_remote_physp->p_node->sw == p_sw ?
+ 0 : osm_switch_get_hop_count( p_sw, base_lid, port_num );
+ }
+ }
+
if( num_hops == OSM_NO_PATH )
{
fprintf( file, "UNREACHABLE\n" );
continue;
}
- best_hops = osm_switch_get_least_hops( p_sw, lid_ho );
+ best_hops = osm_switch_get_least_hops( p_sw, base_lid );
+ if (!p_port->p_node->sw) {
+ best_hops++;
+ num_hops++;
+ }
+
fprintf( file, "%03u : %02u : ", port_num, num_hops );
if( best_hops == num_hops )
@@ -343,7 +368,8 @@ ucast_mgr_dump_lid_matrix(cl_map_item_t *p_map_item, void *cxt)
cl_ntoh64(osm_node_get_node_guid(p_node)));
for (lid = 1; lid <= max_lid; lid++) {
osm_port_t *p_port;
-
+ if (osm_switch_get_least_hops(p_sw, lid) == OSM_NO_PATH)
+ continue;
fprintf(file, "0x%04x:", lid);
for (port = 0 ; port < max_port ; port++)
fprintf(file, " %02x",
--
1.5.0.3.307.gcf89
More information about the general
mailing list