[openib-general] [PATCH] osm: pkey manager fail to clear unused block

Eitan Zahavi eitan at mellanox.co.il
Sun Jun 25 12:29:34 PDT 2006


Hi Hal

Done some basic test with the simulator. Seems that the manager miss all
blocks needed to be cleared (as they used to have some pkeys that are not part of 
the policy). The following trivial patch fixes the issue. The bug sneaked in 
through the last few patched.

The fix avoids skipping cases where the new pkey block is null and for that
sake requires an empty block to be used in the lower level function.

Eitan

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

Index: opensm/osm_pkey_mgr.c
===================================================================
--- opensm/osm_pkey_mgr.c	(revision 8189)
+++ opensm/osm_pkey_mgr.c	(working copy)
@@ -194,10 +194,12 @@ pkey_mgr_update_pkey_entry(
   IN const ib_pkey_table_t *block,
   IN const uint16_t block_index )
 {
+	ib_pkey_table_t empty_block = {0, };
   osm_madw_context_t context;
   osm_node_t *p_node = osm_physp_get_node_ptr( p_physp );
   uint32_t attr_mod;
 
+  if (!block) block = &empty_block;
   context.pkey_context.node_guid = osm_node_get_node_guid( p_node );
   context.pkey_context.port_guid = osm_physp_get_port_guid( p_physp );
   context.pkey_context.set_method = TRUE;
@@ -360,7 +362,7 @@ static boolean_t pkey_mgr_update_port(
     block = osm_pkey_tbl_block_get( p_pkey_tbl, block_index );
     new_block = osm_pkey_tbl_new_block_get( p_pkey_tbl, block_index );
 
-    if (block && (!new_block || !memcmp( new_block, block, sizeof( *block ) ))) 
+    if (block && new_block && !memcmp( new_block, block, sizeof( *block ) )) 
 	continue;
 
     status = pkey_mgr_update_pkey_entry( p_req, p_physp , new_block, block_index );





More information about the general mailing list