[openib-general] [PATCH] osm.mcfdbs - ignore "empty" MLID or switch]

Eitan Zahavi eitan at mellanox.co.il
Wed Dec 6 05:18:52 PST 2006


Hi Hal,

Here is the same patch against GIT for your convenience.

Thanks

EZ

The simulated regression caught this:
The osm.mcfdbs have now the format:
Switch 0x0002c90000000006
LID    : Out Port(s)
0xC000 : 0x003  0x004  0x005  0x006
0xC001 :0xC002 :0xC003 :0xC004 :0xC005 :0xC006 :0xC007 :0xC008 :0xC009 
:0xC00A :0xC00B :0xC00C :0xC00D :0xC00E :0xC00F :0xC010 :0xC011 :0xC012 
:0xC013 :0xC014 :0xC015 :0xC016 :0xC017 :0xC018 :0xC019 :0xC01A :0xC01B 
:0xC01C :0xC01D :0xC01E :0xC01F :

Which should probably just be:
Switch 0x0002c90000000006
LID    : Out Port(s)
0xC000 : 0x003  0x004  0x005  0x006

Actually switches that do not have any MCG entry will not be included
in the dump file.

Signed-off-by:  Eitan Zahavi <eitan at mellanox.co.il>

--- osm/opensm/osm_mcast_mgr.c    2006-12-06 12:39:13.018015000 +0200
+++ osm/opensm/osm_mcast_mgr.c    2006-12-06 12:06:29.602097000 +0200
@@ -1388,10 +1389,13 @@ mcast_mgr_dump_sw_routes(
   int16_t               mlid_start_ho;
   uint8_t               position = 0;
   int16_t               block_num = 0;
-  boolean_t             print_lid;
+  boolean_t             first_mlid;
+  boolean_t             first_port;
   const osm_node_t*     p_node;
   uint16_t              i, j;
   uint16_t              mask_entry;
+  char                  sw_hdr[256];
+  char                  mlid_hdr[32];
 
   OSM_LOG_ENTER( p_mgr->p_log, mcast_mgr_dump_sw_routes );
  
@@ -1402,9 +1406,10 @@ mcast_mgr_dump_sw_routes(
 
   p_tbl = osm_switch_get_mcast_tbl_ptr( p_sw );
 
-  fprintf( file, "\nSwitch 0x%016" PRIx64 "\n"
+  sprintf( sw_hdr, "\nSwitch 0x%016" PRIx64 "\n"
            "LID    : Out Port(s)\n",
-           cl_ntoh64( osm_node_get_node_guid( p_node ) ) ); 
+           cl_ntoh64( osm_node_get_node_guid( p_node ) ) );
+  first_mlid = TRUE;
   while ( block_num <= p_tbl->max_block_in_use )
   {
     mlid_start_ho = (uint16_t)(block_num * IB_MCAST_BLOCK_SIZE);
@@ -1412,8 +1417,8 @@ mcast_mgr_dump_sw_routes(
     {
       mlid_ho = mlid_start_ho + i;
       position = 0;
-      print_lid = FALSE;
-      fprintf( file, "0x%04X :", mlid_ho + IB_LID_MCAST_START_HO );
+      first_port = TRUE;
+      sprintf( mlid_hdr, "0x%04X :", mlid_ho + IB_LID_MCAST_START_HO );
       while ( position <= p_tbl->max_position )
       {
         mask_entry = cl_ntoh16((*p_tbl->p_mask_tbl)[mlid_ho][position]);
@@ -1422,17 +1427,27 @@ mcast_mgr_dump_sw_routes(
           position++;
           continue;
         }
-        print_lid = TRUE;
         for (j = 0 ; j < 16 ; j++)
         {
-          if ( (1 << j) & mask_entry )
-            fprintf( file, " 0x%03X ", j+(position*16) );
+              if ( (1 << j) & mask_entry ) {
+              if (first_mlid)
+              {
+                 fprintf( file,"%s", sw_hdr );
+                 first_mlid = FALSE;
+              }
+              if (first_port)
+              {
+                 fprintf( file,"%s", mlid_hdr );
+                 first_port = FALSE;
+              }
+                  fprintf( file, " 0x%03X ", j+(position*16) );
+              }
         }
         position++;
       }
-      if (print_lid)
+      if (first_port == FALSE)
       {
-        fprintf( file, "\n" );
+         fprintf( file, "\n" );
       }
     }
     block_num++;








More information about the general mailing list