[openib-general] [PATCH] opensm: osm_pkey_tbl_make_block_pair() removal
Sasha Khapyorsky
sashak at voltaire.com
Wed Jun 21 06:52:38 PDT 2006
Since 'blocks' pkey vector is updated only by receiver, remove it from
osm_pkey_tbl_set_new_entry(), as well as osm_pkey_tbl_make_block_pair().
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
osm/include/opensm/osm_pkey.h | 35 ------------------------
osm/opensm/osm_pkey.c | 59 ++++++++---------------------------------
2 files changed, 11 insertions(+), 83 deletions(-)
diff --git a/osm/include/opensm/osm_pkey.h b/osm/include/opensm/osm_pkey.h
index a353ad0..44e932d 100644
--- a/osm/include/opensm/osm_pkey.h
+++ b/osm/include/opensm/osm_pkey.h
@@ -296,41 +296,6 @@ static inline ib_pkey_table_t *osm_pkey_
/*
*********/
-/****f* OpenSM: osm_pkey_tbl_make_block_pair
-* NAME
-* osm_pkey_tbl_make_block_pair
-*
-* DESCRIPTION
-* Find or create a pair of "old" and "new" blocks for the
-* given block index
-*
-* SYNOPSIS
-*/
-ib_api_status_t
-osm_pkey_tbl_make_block_pair(
- osm_pkey_tbl_t *p_pkey_tbl,
- uint16_t block_idx,
- ib_pkey_table_t **pp_old_block,
- ib_pkey_table_t **pp_new_block);
-/*
-* p_pkey_tbl
-* [in] Pointer to the PKey table
-*
-* block_idx
-* [in] The block index to use
-*
-* pp_old_block
-* [out] Pointer to the old block pointer arg
-*
-* pp_new_block
-* [out] Pointer to the new block pointer arg
-*
-* RETURN VALUES
-* IB_SUCCESS if OK
-* IB_ERROR if failed
-*
-*********/
-
/****f* OpenSM: osm_pkey_tbl_set_new_entry
* NAME
* osm_pkey_tbl_set_new_entry
diff --git a/osm/opensm/osm_pkey.c b/osm/opensm/osm_pkey.c
index caefe18..2937ac8 100644
--- a/osm/opensm/osm_pkey.c
+++ b/osm/opensm/osm_pkey.c
@@ -211,46 +211,6 @@ osm_pkey_tbl_set(
/**********************************************************************
**********************************************************************/
-ib_api_status_t
-osm_pkey_tbl_make_block_pair(
- osm_pkey_tbl_t *p_pkey_tbl,
- uint16_t block_idx,
- ib_pkey_table_t **pp_old_block,
- ib_pkey_table_t **pp_new_block)
-{
- if (block_idx >= p_pkey_tbl->max_blocks)
- return(IB_ERROR);
-
- if (pp_old_block)
- {
- *pp_old_block = osm_pkey_tbl_block_get(p_pkey_tbl, block_idx);
- if (! *pp_old_block)
- {
- *pp_old_block = (ib_pkey_table_t *)malloc(sizeof(ib_pkey_table_t));
- if (!*pp_old_block)
- return(IB_ERROR);
- memset(*pp_old_block, 0, sizeof(ib_pkey_table_t));
- cl_ptr_vector_set(&p_pkey_tbl->blocks, block_idx, *pp_old_block);
- }
- }
-
- if (pp_new_block)
- {
- *pp_new_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_idx);
- if (! *pp_new_block)
- {
- *pp_new_block = (ib_pkey_table_t *)malloc(sizeof(ib_pkey_table_t));
- if (!*pp_new_block)
- return(IB_ERROR);
- memset(*pp_new_block, 0, sizeof(ib_pkey_table_t));
- cl_ptr_vector_set(&p_pkey_tbl->new_blocks, block_idx, *pp_new_block);
- }
- }
- return(IB_SUCCESS);
-}
-
-/**********************************************************************
- **********************************************************************/
/*
store the given pkey in the "new" blocks array
also makes sure the regular block exists.
@@ -262,14 +222,17 @@ osm_pkey_tbl_set_new_entry(
IN uint8_t pkey_idx,
IN uint16_t pkey)
{
- ib_pkey_table_t *p_old_block;
- ib_pkey_table_t *p_new_block;
-
- if (osm_pkey_tbl_make_block_pair(p_pkey_tbl, block_idx, &p_old_block,
- &p_new_block))
- return(IB_ERROR);
-
- p_new_block->pkey_entry[pkey_idx] = pkey;
+ ib_pkey_table_t *p_block;
+
+ if (!(p_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_idx))) {
+ p_block = (ib_pkey_table_t *)malloc(sizeof(ib_pkey_table_t));
+ if (!p_block)
+ return(IB_ERROR);
+ memset(p_block, 0, sizeof(ib_pkey_table_t));
+ cl_ptr_vector_set(&p_pkey_tbl->new_blocks, block_idx, p_block);
+ }
+
+ p_block->pkey_entry[pkey_idx] = pkey;
if (p_pkey_tbl->used_blocks <= block_idx)
p_pkey_tbl->used_blocks = block_idx + 1;
More information about the general
mailing list