[ofa-general] [PATCH] opensm: remove osm_node_get_any_dr_part_ptr() function

Sasha Khapyorsky sashak at voltaire.com
Sun Nov 23 00:34:05 PST 2008


The function osm_node_get_any_dr_path_ptr() is dangerous because it uses
potentially outdated local port number from NodeInfo.

The port moving in combination with PortInfo Get failure may cause that
wrong DR path will be used and subnet will never up (the issue was
simulated with ibsim).

This patch removes this funtion completely and instead uses DR path of
switch port 0 which is always up to date.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_node.h |   39 --------------------------------------
 opensm/opensm/osm_mcast_mgr.c    |    4 +--
 opensm/opensm/osm_state_mgr.c    |    2 +-
 opensm/opensm/osm_ucast_mgr.c    |    4 +--
 4 files changed, 3 insertions(+), 46 deletions(-)

diff --git a/opensm/include/opensm/osm_node.h b/opensm/include/opensm/osm_node.h
index 24e399e..8d90f88 100644
--- a/opensm/include/opensm/osm_node.h
+++ b/opensm/include/opensm/osm_node.h
@@ -272,45 +272,6 @@ static inline osm_physp_t *osm_node_get_any_physp_ptr(IN const osm_node_t *
 *	Node object
 *********/
 
-/****f* OpenSM: Node/osm_node_get_any_path
-* NAME
-*	osm_node_get_any_path
-*
-* DESCRIPTION
-*	Returns a pointer to the physical port object at the
-*	specified local port number.
-*
-* SYNOPSIS
-*/
-static inline osm_dr_path_t *osm_node_get_any_dr_path_ptr(IN const osm_node_t *
-							  const p_node)
-{
-	CL_ASSERT(p_node);
-	return (osm_physp_get_dr_path_ptr
-		(&p_node->
-		 physp_table[ib_node_info_get_local_port_num
-			     (&p_node->node_info)]));
-}
-
-/*
-* PARAMETERS
-*	p_node
-*		[in] Pointer to an osm_node_t object.
-*
-*	port_num
-*		[in] Local port number.
-*
-* RETURN VALUES
-*	Returns a pointer to the physical port object at the
-*	specified local port number.
-*	A return value of zero means the port number was out of range.
-*
-* NOTES
-*
-* SEE ALSO
-*	Node object
-*********/
-
 /****f* OpenSM: Node/osm_node_get_type
 * NAME
 *	osm_node_get_type
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index 6d26694..2f9cb5e 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -356,9 +356,7 @@ __osm_mcast_mgr_set_tbl(osm_sm_t * sm, IN osm_switch_t * const p_sw)
 
 	CL_ASSERT(p_node);
 
-	p_path = osm_node_get_any_dr_path_ptr(p_node);
-
-	CL_ASSERT(p_path);
+	p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
 
 	/*
 	   Send multicast forwarding table blocks to the switch
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index 9404e24..599af0a 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -135,7 +135,7 @@ static void __osm_state_mgr_get_sw_info(IN cl_map_item_t * const p_object,
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_node = p_sw->p_node;
-	p_dr_path = osm_node_get_any_dr_path_ptr(p_node);
+	p_dr_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
 
 	memset(&mad_context, 0, sizeof(mad_context));
 
diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
index 175817c..1409e15 100644
--- a/opensm/opensm/osm_ucast_mgr.c
+++ b/opensm/opensm/osm_ucast_mgr.c
@@ -336,9 +336,7 @@ int osm_ucast_mgr_set_fwd_table(IN osm_ucast_mgr_t * const p_mgr,
 
 	CL_ASSERT(p_node);
 
-	p_path = osm_node_get_any_dr_path_ptr(p_node);
-
-	CL_ASSERT(p_path);
+	p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
 
 	/*
 	   Set the top of the unicast forwarding table.
-- 
1.6.0.4.766.g6fc4a




More information about the general mailing list