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

Eitan Zahavi eitan at mellanox.co.il
Mon Jun 26 00:00:48 PDT 2006


Hi Hal

Had some second thought (slept on it) about this patch. 
It has a problem as it would continuously set a block if it is all empty (since the new
block does not exist)

The new patch fixes it by catching the case of null new_block and
still comparing to the old block. 

I also hope I did better job on the indentation (at least I used untabify).

> 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.

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)
@@ -276,6 +276,7 @@ static boolean_t pkey_mgr_update_port(
   boolean_t ret_val = FALSE;
   osm_pending_pkey_t *p_pending;
   boolean_t found;
+  ib_pkey_table_t empty_block = {.pkey_entry = {0}, };
 
   p_physp = osm_port_get_default_phys_ptr( p_port );
   if ( !osm_physp_is_valid( p_physp ) )
@@ -360,7 +361,8 @@ 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 (!new_block) new_block = &empty_block;
+    if (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