[openib-general] [PATCH] opensm: eliminate port/switch_info access methods
Sasha Khapyorsky
sashak at voltaire.com
Sun Jan 7 15:01:47 PST 2007
Following previous patch ("remove osm_physp_get_port_info_ptr() checks")
this removes confused functions osm_physp_get_port_info_ptr() and
osm_switch_get_si_ptr().
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
osm/include/opensm/osm_port.h | 30 ------------------------------
osm/include/opensm/osm_switch.h | 29 -----------------------------
osm/opensm/osm_lid_mgr.c | 5 ++---
osm/opensm/osm_link_mgr.c | 7 ++-----
osm/opensm/osm_pkey_mgr.c | 4 ++--
osm/opensm/osm_port.c | 16 ++++------------
osm/opensm/osm_qos.c | 24 +++++++-----------------
osm/opensm/osm_sa_guidinfo_record.c | 9 +++------
osm/opensm/osm_sa_multipath_record.c | 8 ++++----
osm/opensm/osm_sa_path_record.c | 8 ++++----
osm/opensm/osm_sa_pkey_record.c | 6 +-----
osm/opensm/osm_sa_portinfo_record.c | 4 ++--
osm/opensm/osm_sa_slvl_record.c | 6 +-----
osm/opensm/osm_sa_vlarb_record.c | 6 +-----
osm/opensm/osm_state_mgr.c | 2 +-
osm/opensm/osm_ucast_mgr.c | 2 +-
16 files changed, 35 insertions(+), 131 deletions(-)
diff --git a/osm/include/opensm/osm_port.h b/osm/include/opensm/osm_port.h
index 060dcff..347ab3b 100644
--- a/osm/include/opensm/osm_port.h
+++ b/osm/include/opensm/osm_port.h
@@ -1044,36 +1044,6 @@ osm_physp_get_port_num(
* SEE ALSO
*********/
-/****f* OpenSM: Physical Port/osm_physp_get_port_info_ptr
-* NAME
-* osm_physp_get_port_info_ptr
-*
-* DESCRIPTION
-* Returns a pointer to the PortInfo attribute for this port.
-*
-* SYNOPSIS
-*/
-static inline ib_port_info_t*
-osm_physp_get_port_info_ptr(
- IN const osm_physp_t* const p_physp )
-{
- CL_ASSERT( p_physp );
- CL_ASSERT( osm_physp_is_valid( p_physp ) );
- return( (ib_port_info_t*)&p_physp->port_info );
-}
-/*
-* PARAMETERS
-* p_physp
-* [in] Pointer to an osm_physp_t object.
-*
-* RETURN VALUES
-* Returns a pointer to the PortInfo attribute for this port.
-*
-* NOTES
-*
-* SEE ALSO
-*********/
-
/****f* OpenSM: Physical Port/osm_physp_get_node_ptr
* NAME
* osm_physp_get_node_ptr
diff --git a/osm/include/opensm/osm_switch.h b/osm/include/opensm/osm_switch.h
index 3a05dcf..b2bf0db 100644
--- a/osm/include/opensm/osm_switch.h
+++ b/osm/include/opensm/osm_switch.h
@@ -629,35 +629,6 @@ osm_switch_get_route_by_lid(
* Switch object
*********/
-/****f* OpenSM: Switch/osm_switch_get_si_ptr
-* NAME
-* osm_switch_get_si_ptr
-*
-* DESCRIPTION
-* Returns a pointer to the SwitchInfo for this switch.
-*
-* SYNOPSIS
-*/
-static inline ib_switch_info_t*
-osm_switch_get_si_ptr(
- IN const osm_switch_t* const p_sw )
-{
- return( (ib_switch_info_t*)&p_sw->switch_info );
-}
-/*
-* PARAMETERS
-* p_sw
-* [in] Pointer to an osm_switch_t object.
-*
-* RETURN VALUES
-* Returns a pointer to the SwitchInfo for this switch.
-*
-* NOTES
-*
-* SEE ALSO
-* Switch object
-*********/
-
/****f* OpenSM: Switch/osm_switch_sp0_is_lmc_capable
* NAME
* osm_switch_sp0_is_lmc_capable
diff --git a/osm/opensm/osm_lid_mgr.c b/osm/opensm/osm_lid_mgr.c
index e6fb893..f44a0b4 100644
--- a/osm/opensm/osm_lid_mgr.c
+++ b/osm/opensm/osm_lid_mgr.c
@@ -943,8 +943,7 @@ __osm_lid_mgr_set_remote_pi_state_to_init(
return;
if (osm_physp_is_valid( p_rem_physp ))
- ib_port_info_set_port_state( osm_physp_get_port_info_ptr( p_rem_physp ),
- IB_LINK_INIT );
+ ib_port_info_set_port_state( &p_rem_physp->port_info, IB_LINK_INIT );
}
/**********************************************************************
@@ -1002,7 +1001,7 @@ __osm_lid_mgr_set_physp_pi(
goto Exit;
}
- p_old_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_old_pi = &p_physp->port_info;
/*
First, copy existing parameters from the PortInfo attribute we
diff --git a/osm/opensm/osm_link_mgr.c b/osm/opensm/osm_link_mgr.c
index 0f15f2b..de70368 100644
--- a/osm/opensm/osm_link_mgr.c
+++ b/osm/opensm/osm_link_mgr.c
@@ -140,8 +140,6 @@ __osm_link_mgr_set_physp_pi(
if( port_num == 0 )
{
- ib_switch_info_t* p_sw_info;
-
/*
HCA's don't have a port 0, and for switch port 0,
we need to check if this is enhanced port 0 or base port 0.
@@ -156,8 +154,7 @@ __osm_link_mgr_set_physp_pi(
goto Exit;
}
- p_sw_info = osm_switch_get_si_ptr(p_node->sw);
- if (ib_switch_info_is_enhanced_port0( p_sw_info ) == FALSE)
+ if (ib_switch_info_is_enhanced_port0( &p_node->sw->switch_info ) == FALSE)
{
/* This means the switch doesn't support enhanced port zero.
Can skip it. */
@@ -177,7 +174,7 @@ __osm_link_mgr_set_physp_pi(
PAST THIS POINT WE ARE HANDLING EITHER A NON PORT 0 OR ENHANCED PORT 0
*/
- p_old_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_old_pi = &p_physp->port_info;
memset( payload, 0, IB_SMP_DATA_SIZE );
diff --git a/osm/opensm/osm_pkey_mgr.c b/osm/opensm/osm_pkey_mgr.c
index 5581ce1..bbbe192 100644
--- a/osm/opensm/osm_pkey_mgr.c
+++ b/osm/opensm/osm_pkey_mgr.c
@@ -211,7 +211,7 @@ 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 osm_physp_t *p_physp,
IN const boolean_t enforce)
{
osm_madw_context_t context;
@@ -219,7 +219,7 @@ pkey_mgr_enforce_partition(
ib_port_info_t *p_pi;
ib_api_status_t status;
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
if ((p_pi->vl_enforce & 0xc) == (0xc)*(enforce == TRUE))
{
diff --git a/osm/opensm/osm_port.c b/osm/opensm/osm_port.c
index 2f427d2..3b69b75 100644
--- a/osm/opensm/osm_port.c
+++ b/osm/opensm/osm_port.c
@@ -419,23 +419,19 @@ osm_physp_calc_link_mtu(
IN osm_log_t* p_log,
IN const osm_physp_t* p_physp )
{
- const ib_port_info_t* p_old_pi;
- const ib_port_info_t* p_remote_pi;
const osm_physp_t* p_remote_physp;
uint8_t mtu;
uint8_t remote_mtu;
OSM_LOG_ENTER( p_log, osm_physp_calc_link_mtu );
- p_old_pi = osm_physp_get_port_info_ptr( p_physp );
/* use the available MTU */
- mtu = ib_port_info_get_mtu_cap( p_old_pi );
+ mtu = ib_port_info_get_mtu_cap(&p_physp->port_info);
p_remote_physp = osm_physp_get_remote( p_physp );
if( p_remote_physp && osm_physp_is_valid( p_remote_physp ) )
{
- p_remote_pi = osm_physp_get_port_info_ptr( p_remote_physp );
- remote_mtu = ib_port_info_get_mtu_cap( p_remote_pi );
+ remote_mtu = ib_port_info_get_mtu_cap(&p_remote_physp->port_info);
if( osm_log_is_active( p_log, OSM_LOG_DEBUG ) )
{
@@ -490,23 +486,19 @@ osm_physp_calc_link_op_vls(
IN const osm_subn_t* p_subn,
IN const osm_physp_t* p_physp )
{
- const ib_port_info_t* p_old_pi;
- const ib_port_info_t* p_remote_pi;
const osm_physp_t* p_remote_physp;
uint8_t op_vls;
uint8_t remote_op_vls;
OSM_LOG_ENTER( p_log, osm_physp_calc_link_op_vls );
- p_old_pi = osm_physp_get_port_info_ptr( p_physp );
/* use the available VL CAP */
- op_vls = ib_port_info_get_vl_cap(p_old_pi);
+ op_vls = ib_port_info_get_vl_cap(&p_physp->port_info);
p_remote_physp = osm_physp_get_remote( p_physp );
if( p_remote_physp && osm_physp_is_valid( p_remote_physp ) )
{
- p_remote_pi = osm_physp_get_port_info_ptr( p_remote_physp );
- remote_op_vls = ib_port_info_get_vl_cap(p_remote_pi);
+ remote_op_vls = ib_port_info_get_vl_cap(&p_remote_physp->port_info);
if( osm_log_is_active( p_log, OSM_LOG_DEBUG ) )
{
diff --git a/osm/opensm/osm_qos.c b/osm/opensm/osm_qos.c
index 92fe6fc..e71c053 100644
--- a/osm/opensm/osm_qos.c
+++ b/osm/opensm/osm_qos.c
@@ -77,12 +77,9 @@ static ib_api_status_t vlarb_update_table_block(osm_req_t * p_req,
ib_vl_arb_table_t block;
osm_madw_context_t context;
uint32_t attr_mod;
- ib_port_info_t *p_pi;
unsigned vl_mask, i;
- p_pi = osm_physp_get_port_info_ptr(p);
-
- vl_mask = (1 << (ib_port_info_get_op_vls(p_pi) - 1)) - 1;
+ vl_mask = (1 << (ib_port_info_get_op_vls(&p->port_info) - 1)) - 1;
memset(&block, 0, sizeof(block));
memcpy(&block, table_block,
@@ -111,11 +108,9 @@ static ib_api_status_t vlarb_update(osm_req_t * p_req,
const struct qos_config *qcfg)
{
ib_api_status_t status = IB_SUCCESS;
- ib_port_info_t *p_pi;
+ ib_port_info_t *p_pi = &p->port_info;
unsigned len;
- p_pi = osm_physp_get_port_info_ptr(p);
-
if (p_pi->vl_arb_low_cap > 0) {
len = p_pi->vl_arb_low_cap < IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK ?
p_pi->vl_arb_low_cap : IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK;
@@ -159,14 +154,11 @@ static ib_api_status_t sl2vl_update_table(osm_req_t * p_req,
ib_slvl_table_t tbl, *p_tbl;
osm_node_t *p_node = osm_physp_get_node_ptr(p);
uint32_t attr_mod;
- ib_port_info_t *p_pi;
unsigned vl_mask;
uint8_t vl1, vl2;
int i;
- p_pi = osm_physp_get_port_info_ptr(p);
-
- vl_mask = (1 << (ib_port_info_get_op_vls(p_pi) - 1)) - 1;
+ vl_mask = (1 << (ib_port_info_get_op_vls(&p->port_info) - 1)) - 1;
for (i = 0; i < IB_MAX_NUM_VLS / 2; i++) {
vl1 = sl2vl_table->raw_vl_by_sl[i] >> 4;
@@ -198,20 +190,18 @@ static ib_api_status_t sl2vl_update(osm_req_t * p_req, osm_port_t * p_port,
{
ib_api_status_t status;
uint8_t i, num_ports;
- ib_port_info_t *p_pi = osm_physp_get_port_info_ptr(p);
osm_physp_t *p_physp;
if (osm_node_get_type(osm_physp_get_node_ptr(p)) == IB_NODE_TYPE_SWITCH) {
- if (ib_port_info_get_vl_cap(p_pi) == 1) {
+ if (ib_port_info_get_vl_cap(&p->port_info) == 1) {
/* Check port 0's capability mask */
p_physp = osm_port_get_default_phys_ptr(p_port);
- p_pi = osm_physp_get_port_info_ptr(p_physp);
- if (!(p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP))
+ if (!(p_physp->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP))
return IB_SUCCESS;
}
num_ports = osm_node_get_num_physp(osm_physp_get_node_ptr(p));
} else {
- if (!(p_pi->capability_mask & IB_PORT_CAP_HAS_SL_MAP))
+ if (!(p->port_info.capability_mask & IB_PORT_CAP_HAS_SL_MAP))
return IB_SUCCESS;
num_ports = 1;
}
@@ -234,7 +224,7 @@ static ib_api_status_t vl_high_limit_update(osm_req_t * p_req,
osm_madw_context_t context;
ib_port_info_t *p_pi;
- p_pi = osm_physp_get_port_info_ptr(p);
+ p_pi = &p->port_info;
if (p_pi->vl_high_limit == qcfg->vl_high_limit)
return IB_SUCCESS;
diff --git a/osm/opensm/osm_sa_guidinfo_record.c b/osm/opensm/osm_sa_guidinfo_record.c
index 3eee05b..5d7c4ba 100644
--- a/osm/opensm/osm_sa_guidinfo_record.c
+++ b/osm/opensm/osm_sa_guidinfo_record.c
@@ -204,7 +204,6 @@ __osm_sa_gir_create_gir(
ib_net16_t max_lid_ho;
uint8_t lmc;
ib_net64_t port_guid;
- const ib_port_info_t* p_pi;
uint8_t block_num, start_block_num, end_block_num, num_blocks;
OSM_LOG_ENTER( p_rcv->p_log, __osm_sa_gir_create_gir );
@@ -245,8 +244,6 @@ __osm_sa_gir_create_gir(
if( match_port_guid && ( port_guid != match_port_guid ) )
continue;
- p_pi = osm_physp_get_port_info_ptr( p_physp );
-
/*
Note: the following check is a temporary workaround
Since 1. GUIDCap should never be 0 on ports where this applies
@@ -254,11 +251,11 @@ __osm_sa_gir_create_gir(
So this should really be a check for whether the port is a
switch external port or not!
*/
- if ( p_pi->guid_cap == 0 )
+ if ( p_physp->port_info.guid_cap == 0 )
continue;
- num_blocks = p_pi->guid_cap / 8;
- if ( p_pi->guid_cap % 8 )
+ num_blocks = p_physp->port_info.guid_cap / 8;
+ if ( p_physp->port_info.guid_cap % 8 )
num_blocks++;
if ( match_block_num == 255 )
{
diff --git a/osm/opensm/osm_sa_multipath_record.c b/osm/opensm/osm_sa_multipath_record.c
index 60a4930..2f61fb8 100644
--- a/osm/opensm/osm_sa_multipath_record.c
+++ b/osm/opensm/osm_sa_multipath_record.c
@@ -257,7 +257,7 @@ __osm_mpr_rcv_get_path_parms(
p_dest_physp = osm_port_get_default_phys_ptr( p_dest_port );
p_physp = osm_port_get_default_phys_ptr( p_src_port );
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
mtu = ib_port_info_get_mtu_cap( p_pi );
rate = ib_port_info_compute_rate( p_pi );
@@ -432,7 +432,7 @@ __osm_mpr_rcv_get_path_parms(
/*
Check parameters for the ingress port in this switch.
*/
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
if ( mtu > ib_port_info_get_mtu_cap( p_pi ) )
{
@@ -498,7 +498,7 @@ __osm_mpr_rcv_get_path_parms(
}
}
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
if ( mtu > ib_port_info_get_mtu_cap( p_pi ) )
{
@@ -535,7 +535,7 @@ __osm_mpr_rcv_get_path_parms(
/*
p_physp now points to the destination
*/
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
if ( mtu > ib_port_info_get_mtu_cap( p_pi ) )
{
diff --git a/osm/opensm/osm_sa_path_record.c b/osm/opensm/osm_sa_path_record.c
index 11058ab..a0d4675 100644
--- a/osm/opensm/osm_sa_path_record.c
+++ b/osm/opensm/osm_sa_path_record.c
@@ -255,7 +255,7 @@ __osm_pr_rcv_get_path_parms(
p_dest_physp = osm_port_get_default_phys_ptr( p_dest_port );
p_physp = osm_port_get_default_phys_ptr( p_src_port );
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
mtu = ib_port_info_get_mtu_cap( p_pi );
rate = ib_port_info_compute_rate( p_pi );
@@ -368,7 +368,7 @@ __osm_pr_rcv_get_path_parms(
/*
Check parameters for the ingress port in this switch.
*/
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
if( mtu > ib_port_info_get_mtu_cap( p_pi ) )
{
@@ -419,7 +419,7 @@ __osm_pr_rcv_get_path_parms(
CL_ASSERT( p_physp );
CL_ASSERT( osm_physp_is_valid( p_physp ) );
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
if( mtu > ib_port_info_get_mtu_cap( p_pi ) )
{
@@ -456,7 +456,7 @@ __osm_pr_rcv_get_path_parms(
/*
p_physp now points to the destination
*/
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
if( mtu > ib_port_info_get_mtu_cap( p_pi ) )
{
diff --git a/osm/opensm/osm_sa_pkey_record.c b/osm/opensm/osm_sa_pkey_record.c
index 8b6f69f..8e56c6c 100644
--- a/osm/opensm/osm_sa_pkey_record.c
+++ b/osm/opensm/osm_sa_pkey_record.c
@@ -151,13 +151,9 @@ __osm_sa_pkey_create(
}
if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)
- {
- lid = osm_physp_get_port_info_ptr( p_physp )->base_lid;
- }
+ lid = p_physp->port_info.base_lid;
else
- {
lid = osm_node_get_base_lid( p_physp->p_node, 0 );
- }
if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
{
diff --git a/osm/opensm/osm_sa_portinfo_record.c b/osm/opensm/osm_sa_portinfo_record.c
index 054ff1f..300d536 100644
--- a/osm/opensm/osm_sa_portinfo_record.c
+++ b/osm/opensm/osm_sa_portinfo_record.c
@@ -175,7 +175,7 @@ __osm_pir_rcv_new_pir(
memset( &p_rec_item->rec, 0, sizeof( p_rec_item->rec ) );
p_rec_item->rec.lid = lid;
- p_rec_item->rec.port_info = *osm_physp_get_port_info_ptr( p_physp );
+ p_rec_item->rec.port_info = p_physp->port_info;
p_rec_item->rec.port_num = osm_physp_get_port_num( p_physp );
cl_qlist_insert_tail( p_list, (cl_list_item_t*)&p_rec_item->pool_item );
@@ -260,7 +260,7 @@ __osm_sa_pir_check_physp(
p_rcvd_rec = p_ctxt->p_rcvd_rec;
comp_mask = p_ctxt->comp_mask;
p_comp_pi = &p_rcvd_rec->port_info;
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
osm_dump_port_info(
p_rcv->p_log,
diff --git a/osm/opensm/osm_sa_slvl_record.c b/osm/opensm/osm_sa_slvl_record.c
index 2476283..b9146b0 100644
--- a/osm/opensm/osm_sa_slvl_record.c
+++ b/osm/opensm/osm_sa_slvl_record.c
@@ -163,13 +163,9 @@ __osm_sa_slvl_create(
}
if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)
- {
- lid = osm_physp_get_port_info_ptr( p_physp )->base_lid;
- }
+ lid = p_physp->port_info.base_lid;
else
- {
lid = osm_node_get_base_lid( p_physp->p_node, 0 );
- }
if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
{
diff --git a/osm/opensm/osm_sa_vlarb_record.c b/osm/opensm/osm_sa_vlarb_record.c
index 8f1de4c..d7f341e 100644
--- a/osm/opensm/osm_sa_vlarb_record.c
+++ b/osm/opensm/osm_sa_vlarb_record.c
@@ -163,13 +163,9 @@ __osm_sa_vl_arb_create(
}
if (p_physp->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH)
- {
- lid = osm_physp_get_port_info_ptr( p_physp )->base_lid;
- }
+ lid = p_physp->port_info.base_lid;
else
- {
lid = osm_node_get_base_lid( p_physp->p_node, 0 );
- }
if( osm_log_is_active( p_rcv->p_log, OSM_LOG_DEBUG ) )
{
diff --git a/osm/opensm/osm_state_mgr.c b/osm/opensm/osm_state_mgr.c
index aa129a9..f91677d 100644
--- a/osm/opensm/osm_state_mgr.c
+++ b/osm/opensm/osm_state_mgr.c
@@ -1306,7 +1306,7 @@ __osm_state_mgr_report(
osm_get_node_type_str_fixed_width( node_type ),
port_num );
- p_pi = osm_physp_get_port_info_ptr( p_physp );
+ p_pi = &p_physp->port_info;
/*
* Port state is not defined for switch port 0
diff --git a/osm/opensm/osm_ucast_mgr.c b/osm/opensm/osm_ucast_mgr.c
index 214c05e..d91e278 100644
--- a/osm/opensm/osm_ucast_mgr.c
+++ b/osm/opensm/osm_ucast_mgr.c
@@ -906,7 +906,7 @@ osm_ucast_mgr_set_fwd_table(
/*
Set the top of the unicast forwarding table.
*/
- si = *osm_switch_get_si_ptr( p_sw );
+ si = p_sw->switch_info;
lin_top = cl_hton16( osm_switch_get_max_lid_ho( p_sw ) );
if (lin_top != si.lin_top)
{
--
1.5.0.rc0.g2484-dirty
More information about the general
mailing list