opensm/PkeyMgr: Don't change end port pkey index when simultaneously adding and removing partitions
PATCH 1/4 opensm/PkeyMgr: Don't change end port pkey index when simultaneously adding and removing partitions
--- include/opensm/osm_pkey.h | 35 +++++++++++++++++++ opensm/osm_pkey.c | 19 ++++++++++ opensm/osm_pkey_mgr.c | 81 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 118 insertions(+), 17 deletions(-)
include/opensm/osm_pkey.h +35 -0
@@ -82,15 +82,21 @@ struct osm_physp;* SYNOPSIS */ typedef struct osm_pkeybl { +cl_ptr_vector_t accum_pkeys;cl_ptr_vector_t blocks;cl_ptr_vector_t new_blocks;cl_map_t keys;cl_qlist_t pending; +uint16_t last_pkey_idx;uint16_t used_blocks;uint16_t max_blocks; }osm_pkey_tbl_t ;/* * FIELDS +* accum_pkeys +* Accumulated pkeys with pkey index. Used to +* preserve pkey index. +* * blocks * The IBA defined blocks of pkey values, updated from the subnet *
@@ -288,6 +294,35 @@ static inline ib_pkey_table_t *osm_pkey_tbl_new_block_get(const osm_pkey_tbl_t * &p_pkey_tbl->new_blocks, block) : NULL); }; +/****f* OpenSM: osm_pkey_tbl_set_accum_pkeys +* NAME +* osm_pkey_tbl_set_accum_pkeys +* +* DESCRIPTION +* Stores the given pkey in the "accum_pkeys" array and update +* update the "map" +* +* SYNOPSIS +*/ +cl_status_t +osm_pkey_tbl_set_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl, + IN uint16_t pkey, IN uint16_t pkey_idx); +/* +* p_pkey_tbl +* [in] Pointer to the PKey table +* +* pkey +* [in] PKey to store +* +* pkey_idx +* [in] The overall index +* +* RETURN VALUES +* CL_SUCCESS if OK +* CL_INSUFFICIENT_MEMORY if failed +* +*********/ +/****f* OpenSM: osm_pkey_tbl_set_new_entry * NAME * osm_pkey_tbl_set_new_entry
opensm/osm_pkey.c +19 -0
@@ -56,6 +56,7 @@ void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl) { +cl_ptr_vector_construct (&p_pkey_tbl->accum_pkeys);cl_ptr_vector_construct (&p_pkey_tbl->blocks);cl_ptr_vector_construct (&p_pkey_tbl->new_blocks);cl_map_construct (&p_pkey_tbl->keys);
@@ -79,16 +80,20 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl)free (p_block);cl_ptr_vector_destroy (&p_pkey_tbl->new_blocks); +cl_ptr_vector_destroy (&p_pkey_tbl->accum_pkeys); +cl_map_remove_all (&p_pkey_tbl->keys);cl_map_destroy (&p_pkey_tbl->keys); } ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl) { +cl_ptr_vector_init (&p_pkey_tbl->accum_pkeys,0 ,1 );cl_ptr_vector_init (&p_pkey_tbl->blocks,0 ,1 );cl_ptr_vector_init (&p_pkey_tbl->new_blocks,0 ,1 );cl_map_init (&p_pkey_tbl->keys,1 );cl_qlist_init (&p_pkey_tbl->pending); + p_pkey_tbl->last_pkey_idx =0 ; p_pkey_tbl->used_blocks =0 ; p_pkey_tbl->max_blocks =0 ;return IB_SUCCESS ;
@@ -173,6 +178,20 @@ ib_api_status_t osm_pkey_tbl_set(IN osm_pkey_tbl_t * p_pkey_tbl, }/* +Store the given pkey (along with it's overall index) in the accum_pkeys array. +*/ +cl_status_t osm_pkey_tbl_set_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl, + IN uint16_t pkey, + IN uint16_t pkey_idx) +{ +uintptr_t ptr = pkey_idx +1 ;/* 0 means not found so bias by 1 */ + +if (pkey_idx > p_pkey_tbl->last_pkey_idx) + p_pkey_tbl->last_pkey_idx = pkey_idx; +return cl_ptr_vector_set (&p_pkey_tbl->accum_pkeys, pkey, (void *)ptr); +} + +/* Store the given pkey in the "new" blocks array. Also, make sure the regular block exists. */
opensm/osm_pkey_mgr.c +64 -17
127 lines not on this page · raw message
Signature · 6 lines
1.5.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html