[openib-general] [PATCH] osm: ucast manager return wrong signal

eitan at mellanox.co.il eitan at mellanox.co.il
Mon Dec 18 12:19:34 PST 2006


Fix an issue with not providing SIGNAL_DONE_PENDING in case when
SwitchInfo was sent
---
 osm/opensm/osm_ucast_mgr.c |   96 ++++++++++++++++++++++++++++----------------
 1 files changed, 61 insertions(+), 35 deletions(-)

diff --git a/osm/opensm/osm_ucast_mgr.c b/osm/opensm/osm_ucast_mgr.c
index e977253..8cfe09e 100644
--- a/osm/opensm/osm_ucast_mgr.c
+++ b/osm/opensm/osm_ucast_mgr.c
@@ -885,6 +885,9 @@ osm_ucast_mgr_set_fwd_table(
   ib_switch_info_t si;
   uint32_t block_id_ho = 0;
   uint8_t block[IB_SMP_DATA_SIZE];
+  boolean_t set_swinfo_require = FALSE;
+  uint16_t lin_top;
+  uint8_t life_state;
 
   CL_ASSERT( p_mgr );
 
@@ -904,43 +907,59 @@ osm_ucast_mgr_set_fwd_table(
     Set the top of the unicast forwarding table.
   */
   si = *osm_switch_get_si_ptr( p_sw );
-  si.lin_top = cl_hton16( osm_switch_get_max_lid_ho( p_sw ) );
+  lin_top = cl_hton16( osm_switch_get_max_lid_ho( p_sw ) );
+  if (si.lin_top != lin_top) 
+  {
+     set_swinfo_require = TRUE;
+     si.lin_top  = lin_top;
+  }
 
   /* check to see if the change state bit is on. If it is - then we
      need to clear it. */
-   if( ib_switch_info_get_state_change( &si ) )
-    si.life_state = ( (p_mgr->p_subn->opt.packet_life_time <<3 )
-                      | ( si.life_state & IB_SWITCH_PSC ) )  & 0xfc;
+  if ( ib_switch_info_get_state_change( &si ) )
+     life_state = ( (p_mgr->p_subn->opt.packet_life_time <<3 )
+                    | ( si.life_state & IB_SWITCH_PSC ) )  & 0xfc;
   else
-    si.life_state = (p_mgr->p_subn->opt.packet_life_time <<3 ) & 0xf8;
+     life_state = (p_mgr->p_subn->opt.packet_life_time <<3 ) & 0xf8;
 
-  if( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
+  if (life_state != si.life_state)
   {
-    osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
-             "osm_ucast_mgr_set_fwd_table: "
-             "Setting switch FT top to LID 0x%X\n",
-             osm_switch_get_max_lid_ho( p_sw ) );
+     set_swinfo_require = TRUE;
+     si.life_state = life_state;
   }
-
-  context.si_context.light_sweep = FALSE;
-  context.si_context.node_guid = osm_node_get_node_guid( p_node );
-  context.si_context.set_method = TRUE;
-
-  status = osm_req_set( p_mgr->p_req,
-                        p_path,
-                        (uint8_t*)&si,
-                        sizeof(si),
-                        IB_MAD_ATTR_SWITCH_INFO,
-                        0,
-                        CL_DISP_MSGID_NONE,
-                        &context );
-
-  if( status != IB_SUCCESS )
+  
+  if ( set_swinfo_require )
   {
-    osm_log( p_mgr->p_log, OSM_LOG_ERROR,
-             "osm_ucast_mgr_set_fwd_table: ERR 3A06: "
-             "Sending SwitchInfo attribute failed (%s)\n",
-             ib_get_err_str( status ) );
+     if ( osm_log_is_active( p_mgr->p_log, OSM_LOG_DEBUG ) )
+     {
+        osm_log( p_mgr->p_log, OSM_LOG_DEBUG,
+                 "osm_ucast_mgr_set_fwd_table: "
+                 "Setting switch FT top to LID 0x%X\n",
+                 osm_switch_get_max_lid_ho( p_sw ) );
+     }
+     
+     context.si_context.light_sweep = FALSE;
+     context.si_context.node_guid = osm_node_get_node_guid( p_node );
+     context.si_context.set_method = TRUE;
+     
+     status = osm_req_set( p_mgr->p_req,
+                           p_path,
+                           (uint8_t*)&si,
+                           sizeof(si),
+                           IB_MAD_ATTR_SWITCH_INFO,
+                           0,
+                           CL_DISP_MSGID_NONE,
+                           &context );
+     
+     if( status != IB_SUCCESS )
+     {
+        osm_log( p_mgr->p_log, OSM_LOG_ERROR,
+                 "osm_ucast_mgr_set_fwd_table: ERR 3A06: "
+                 "Sending SwitchInfo attribute failed (%s)\n",
+                 ib_get_err_str( status ) );
+     } 
+     else 
+        p_mgr->any_change = TRUE;
   }
 
   /*
@@ -1215,13 +1234,14 @@ osm_ucast_mgr_process(
 
   CL_PLOCK_EXCL_ACQUIRE( p_mgr->p_lock );
 
+  p_mgr->any_change = FALSE;
+
   /*
     If there are no switches in the subnet, we are done.
   */
   if (cl_qmap_count( p_sw_guid_tbl ) == 0)
     goto Exit;
 
-  p_mgr->any_change = FALSE;
   cl_qmap_apply_func(p_sw_guid_tbl, __osm_ucast_mgr_clean_switch, NULL);
 
   if (!p_routing_eng->build_lid_matrices ||
@@ -1248,14 +1268,20 @@ osm_ucast_mgr_process(
   if ( osm_log_is_active( p_mgr->p_log, OSM_LOG_ROUTING ) )
     __osm_ucast_mgr_dump_tables( p_mgr );
 
-  if (p_mgr->any_change)
+  if (p_mgr->any_change) 
+  {
      signal = OSM_SIGNAL_DONE_PENDING;
+	  osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+				 "osm_ucast_mgr_process: "
+				 "LFT Tables configured on all switches\n");
+  }
   else
+  {
+	  osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
+				 "osm_ucast_mgr_process: "
+				 "No need to set any LFT Tables on all switches\n");
      signal = OSM_SIGNAL_DONE;
-
-  osm_log(p_mgr->p_log, OSM_LOG_VERBOSE,
-          "osm_ucast_mgr_process: "
-          "LFT Tables configured on all switches\n");
+  }
 
  Exit:
   CL_PLOCK_RELEASE( p_mgr->p_lock );
-- 
1.4.4.1.GIT





More information about the general mailing list