[openib-general] [PATCH] osm: pkey manager returns wrong signal

eitan at mellanox.co.il eitan at mellanox.co.il
Mon Dec 18 12:17:54 PST 2006


Fix cases where the pkey manager returned OSM_SIGNAL_DONE and not
OSM_SIGNAL_DONE_PENDING by missing some sent packets
---
 osm/opensm/osm_pkey_mgr.c |  112 +++++++++++++++++++++++++++++++++------------
 1 files changed, 82 insertions(+), 30 deletions(-)

diff --git a/osm/opensm/osm_pkey_mgr.c b/osm/opensm/osm_pkey_mgr.c
index 48837bc..a33aec7 100644
--- a/osm/opensm/osm_pkey_mgr.c
+++ b/osm/opensm/osm_pkey_mgr.c
@@ -212,8 +212,9 @@ pkey_mgr_update_pkey_entry(
 
 /**********************************************************************
  **********************************************************************/
-static ib_api_status_t
+static boolean_t
 pkey_mgr_enforce_partition(
+  IN osm_log_t *p_log,
   IN const osm_req_t *p_req,
   IN const osm_physp_t *p_physp,
   IN const boolean_t enforce)
@@ -221,12 +222,33 @@ pkey_mgr_enforce_partition(
   osm_madw_context_t context;
   uint8_t payload[IB_SMP_DATA_SIZE];
   ib_port_info_t *p_pi;
+  ib_api_status_t status;
 
   if (!(p_pi = osm_physp_get_port_info_ptr( p_physp )))
-    return IB_ERROR;
+  {
+     osm_log( p_log, OSM_LOG_ERROR,
+              "pkey_mgr_enforce_partition: ERR 0507: "
+              "No port info for "
+              "node 0x%016" PRIx64 " port %u\n",
+              cl_ntoh64(
+                 osm_node_get_node_guid( 
+                    osm_physp_get_node_ptr( p_physp ))),
+              osm_physp_get_port_num( p_physp ) );
+     return FALSE;
+  }
 
-  if ((p_pi->vl_enforce & 0xc) == (0xc)*(enforce == TRUE))
-    return IB_SUCCESS;
+  if ((p_pi->vl_enforce & 0xc) == (0xc)*(enforce == TRUE)) 
+  {
+     osm_log( p_log, OSM_LOG_DEBUG,
+              "pkey_mgr_enforce_partition: "
+              "No need to update PortInfo for "
+              "node 0x%016" PRIx64 " port %u\n",
+              cl_ntoh64(
+                 osm_node_get_node_guid( 
+                    osm_physp_get_node_ptr( p_physp ))),
+              osm_physp_get_port_num( p_physp ) );
+    return FALSE;
+  }
 
   memset( payload, 0, IB_SMP_DATA_SIZE );
   memcpy( payload, p_pi, sizeof(ib_port_info_t) );
@@ -248,11 +270,35 @@ pkey_mgr_enforce_partition(
   context.pi_context.light_sweep = FALSE;
   context.pi_context.active_transition = FALSE;
 
-  return osm_req_set( p_req, osm_physp_get_dr_path_ptr( p_physp ),
-                      payload, sizeof(payload),
-                      IB_MAD_ATTR_PORT_INFO,
-                      cl_hton32( osm_physp_get_port_num( p_physp ) ),
-                      CL_DISP_MSGID_NONE, &context );
+  status = osm_req_set( p_req, osm_physp_get_dr_path_ptr( p_physp ),
+								payload, sizeof(payload),
+								IB_MAD_ATTR_PORT_INFO,
+								cl_hton32( osm_physp_get_port_num( p_physp ) ),
+								CL_DISP_MSGID_NONE, &context );
+  if (status != IB_SUCCESS) 
+  {
+     osm_log( p_log, OSM_LOG_ERROR,
+              "pkey_mgr_enforce_partition: ERR 0520: "
+              "Failed to set PortInfo for "
+              "node 0x%016" PRIx64 " port %u\n",
+              cl_ntoh64(
+                 osm_node_get_node_guid( 
+                    osm_physp_get_node_ptr( p_physp ))),
+              osm_physp_get_port_num( p_physp ) );
+     return FALSE;
+  }
+  else
+  {
+     osm_log( p_log, OSM_LOG_DEBUG,
+              "pkey_mgr_enforce_partition: "
+              "Set PortInfo for "
+              "node 0x%016" PRIx64 " port %u\n",
+              cl_ntoh64(
+                 osm_node_get_node_guid( 
+                    osm_physp_get_node_ptr( p_physp ))),
+              osm_physp_get_port_num( p_physp ) );
+	  return TRUE;
+  }
 }
 
 /**********************************************************************
@@ -369,15 +415,26 @@ static boolean_t pkey_mgr_update_port(
 
     status = pkey_mgr_update_pkey_entry( p_req, p_physp, new_block, block_index );
     if (status == IB_SUCCESS)
-      ret_val = TRUE;
+	 {
+		 osm_log( p_log, OSM_LOG_DEBUG,
+					 "pkey_mgr_update_port: "
+					 "Updated "
+					 "pkey table block %d for node 0x%016" PRIx64 " port %u\n",
+					 block_index,
+					 cl_ntoh64( osm_node_get_node_guid( p_node ) ),
+					 osm_physp_get_port_num( p_physp ) );
+		 ret_val = TRUE;
+	 }
     else
-      osm_log( p_log, OSM_LOG_ERROR,
-	       "pkey_mgr_update_port: ERR 0506: "
-	       "pkey_mgr_update_pkey_entry() failed to update "
-	       "pkey table block %d for node 0x%016" PRIx64 " port %u\n",
-	       block_index,
-	       cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-	       osm_physp_get_port_num( p_physp ) );
+	 {
+		 osm_log( p_log, OSM_LOG_ERROR,
+					 "pkey_mgr_update_port: ERR 0506: "
+					 "pkey_mgr_update_pkey_entry() failed to update "
+					 "pkey table block %d for node 0x%016" PRIx64 " port %u\n",
+					 block_index,
+					 cl_ntoh64( osm_node_get_node_guid( p_node ) ),
+					 osm_physp_get_port_num( p_physp ) );
+	 }
   }
 
   return ret_val;
@@ -405,8 +462,9 @@ pkey_mgr_update_peer_port(
   uint16_t peer_max_blocks;
   ib_api_status_t status = IB_SUCCESS;
   boolean_t ret_val = FALSE;
+  boolean_t port_info_set = FALSE;
   ib_pkey_table_t empty_block;
-
+  
   memset(&empty_block, 0, sizeof(ib_pkey_table_t));
 
   p_physp = osm_port_get_default_phys_ptr( p_port );
@@ -439,18 +497,11 @@ pkey_mgr_update_peer_port(
     enforce = FALSE;
   }
 
-  if (pkey_mgr_enforce_partition( p_req, peer, enforce ) != IB_SUCCESS)
-  {
-    osm_log( p_log, OSM_LOG_ERROR,
-	     "pkey_mgr_update_peer_port: ERR 0507: "
-	     "pkey_mgr_enforce_partition() failed to update "
-	     "node 0x%016" PRIx64 " port %u\n",
-	     cl_ntoh64( osm_node_get_node_guid( p_node ) ),
-	     osm_physp_get_port_num( peer ) );
-  }
+  if (pkey_mgr_enforce_partition( p_log, p_req, peer, enforce))
+	  port_info_set = TRUE;
 
   if (enforce == FALSE)
-    return FALSE;
+	 return port_info_set;
 
   p_peer_pkey_tbl->used_blocks = p_pkey_tbl->used_blocks;
   for (block_index = 0; block_index < p_pkey_tbl->used_blocks; block_index++)
@@ -487,6 +538,7 @@ pkey_mgr_update_peer_port(
              osm_physp_get_port_num( peer ) );
   }
 
+  if (port_info_set) return TRUE;
   return ret_val;
 }
 
@@ -541,10 +593,10 @@ osm_pkey_mgr_process(
       signal = OSM_SIGNAL_DONE_PENDING;
     p_node = osm_port_get_parent_node( p_port );
     if ( ( osm_node_get_type( p_node ) != IB_NODE_TYPE_SWITCH ) &&
-	 pkey_mgr_update_peer_port( &p_osm->log, &p_osm->sm.req, 
+			pkey_mgr_update_peer_port( &p_osm->log, &p_osm->sm.req, 
 				    &p_osm->subn, p_port,
 				    !p_osm->subn.opt.no_partition_enforcement ) )
-      signal = OSM_SIGNAL_DONE_PENDING;        
+      signal = OSM_SIGNAL_DONE_PENDING;
   }
 
  _err:
-- 
1.4.4.1.GIT





More information about the general mailing list