[ofa-general] [PATCH] opensm: remove unneeded anymore physp initializations

Sasha Khapyorsky sashak at voltaire.com
Sat Feb 28 09:35:09 PST 2009


Removed unneeded anymore physical port initializations - all should be
already initialized in osm_node_new(). Also put some debug assertions
(CL_ASSERT()).

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_node_info_rcv.c |   28 +++-------------------------
 opensm/opensm/osm_port_info_rcv.c |   32 +++++++-------------------------
 2 files changed, 10 insertions(+), 50 deletions(-)

diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
index 9de68f9..ac86b9a 100644
--- a/opensm/opensm/osm_node_info_rcv.c
+++ b/opensm/opensm/osm_node_info_rcv.c
@@ -155,14 +155,9 @@ __osm_ni_rcv_set_links(IN osm_sm_t * sm,
 
 	/* When setting the link, ports on both
 	   sides of the link should be initialized */
-	if (!osm_node_link_has_valid_ports(p_node, port_num, p_neighbor_node,
-					   p_ni_context->port_num)) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Link at node 0x%" PRIx64 ", port %u - no valid ports\n",
-			cl_ntoh64(osm_node_get_node_guid(p_node)), port_num);
-		CL_ASSERT(0);
-		goto _exit;
-	}
+	CL_ASSERT(osm_node_link_has_valid_ports(p_node, port_num,
+						p_neighbor_node,
+						p_ni_context->port_num));
 
 	if (osm_node_link_exists(p_node, port_num,
 				 p_neighbor_node, p_ni_context->port_num)) {
@@ -529,25 +524,8 @@ __osm_ni_rcv_process_existing_switch(IN osm_sm_t * sm,
 				     IN osm_node_t * const p_node,
 				     IN const osm_madw_t * const p_madw)
 {
-	ib_smp_t *p_smp;
-	ib_node_info_t *p_ni;
-	uint8_t port_num;
-
 	OSM_LOG_ENTER(sm->p_log);
 
-	p_smp = osm_madw_get_smp_ptr(p_madw);
-	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
-	port_num = ib_node_info_get_local_port_num(p_ni);
-
-	if (!osm_node_get_physp_ptr(p_node, port_num)) {
-		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Creating physp for node GUID:0x%"
-			PRIx64 ", port %u\n",
-			cl_ntoh64(osm_node_get_node_guid(p_node)),
-			port_num);
-		osm_node_init_physp(p_node, port_num, p_madw);
-	}
-
 	/*
 	   If this switch has already been probed during this sweep,
 	   then don't bother reprobing it.
diff --git a/opensm/opensm/osm_port_info_rcv.c b/opensm/opensm/osm_port_info_rcv.c
index 95ebdb4..654ede7 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -614,31 +614,13 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
 
-		/*
-		   Determine if we encountered a new Physical Port.
-		   If so, initialize the new Physical Port then
-		   continue processing as normal.
-		 */
-		if (!p_physp) {
-			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-				"Initializing port number %u\n", port_num);
-			p_physp = &p_node->physp_table[port_num];
-			osm_physp_init(p_physp,
-				       port_guid,
-				       port_num,
-				       p_node,
-				       osm_madw_get_bind_handle(p_madw),
-				       p_smp->hop_count, p_smp->initial_path);
-		} else {
-			/*
-			   Update the directed route path to this port
-			   in case the old path is no longer usable.
-			 */
-			p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
-			osm_dr_path_init(p_dr_path,
-					 osm_madw_get_bind_handle(p_madw),
-					 p_smp->hop_count, p_smp->initial_path);
-		}
+		CL_ASSERT(p_physp);
+
+		/* Update the directed route path to this port
+		   in case the old path is no longer usable. */
+		p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
+		osm_dr_path_init(p_dr_path, osm_madw_get_bind_handle(p_madw),
+				 p_smp->hop_count, p_smp->initial_path);
 
 		/* if port just inited or reached INIT state (external reset)
 		   request update for port related tables */
-- 
1.6.1.2.319.gbd9e




More information about the general mailing list