[ofa-general] [PATCH] opensm: remove some unneeded assertions

Sasha Khapyorsky sashak at voltaire.com
Sun Jan 27 07:38:45 PST 2008


Remove some duplicated CL_ASSERT()s and invalid run-time checks.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_node.c          |   10 ----------
 opensm/opensm/osm_node_info_rcv.c |   27 ---------------------------
 2 files changed, 0 insertions(+), 37 deletions(-)

diff --git a/opensm/opensm/osm_node.c b/opensm/opensm/osm_node.c
index 176f916..4586ff5 100644
--- a/opensm/opensm/osm_node.c
+++ b/opensm/opensm/osm_node.c
@@ -65,13 +65,8 @@ osm_node_init_physp(IN osm_node_t * const p_node,
 	ib_node_info_t *p_ni;
 	uint8_t port_num;
 
-	CL_ASSERT(p_node);
-	CL_ASSERT(p_madw);
-
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
-	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);
-
 	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
 	port_guid = p_ni->port_guid;
 	port_num = ib_node_info_get_local_port_num(p_ni);
@@ -111,12 +106,7 @@ osm_node_t *osm_node_new(IN const osm_madw_t * const p_madw)
 	uint8_t i;
 	uint32_t size;
 
-	CL_ASSERT(p_madw);
-
 	p_smp = osm_madw_get_smp_ptr(p_madw);
-
-	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);
-
 	p_ni = (ib_node_info_t *) ib_smp_get_payload_ptr(p_smp);
 
 	/*
diff --git a/opensm/opensm/osm_node_info_rcv.c b/opensm/opensm/osm_node_info_rcv.c
index 50287dc..cfce437 100644
--- a/opensm/opensm/osm_node_info_rcv.c
+++ b/opensm/opensm/osm_node_info_rcv.c
@@ -281,9 +281,6 @@ __osm_ni_rcv_process_new_node(IN osm_sm_t * sm,
 
 	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_new_node);
 
-	CL_ASSERT(p_node);
-	CL_ASSERT(p_madw);
-
 	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);
@@ -298,11 +295,6 @@ __osm_ni_rcv_process_new_node(IN osm_sm_t * sm,
 	 */
 	p_physp = osm_node_get_physp_ptr(p_node, port_num);
 
-	CL_ASSERT(osm_physp_is_valid(p_physp));
-	CL_ASSERT(osm_madw_get_bind_handle(p_madw) ==
-		  osm_dr_path_get_bind_handle(osm_physp_get_dr_path_ptr
-					      (p_physp)));
-
 	context.pi_context.node_guid = p_ni->node_guid;
 	context.pi_context.port_guid = p_ni->port_guid;
 	context.pi_context.set_method = FALSE;
@@ -339,9 +331,6 @@ __osm_ni_rcv_get_node_desc(IN osm_sm_t * sm,
 
 	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_get_node_desc);
 
-	CL_ASSERT(p_node);
-	CL_ASSERT(p_madw);
-
 	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);
@@ -356,11 +345,6 @@ __osm_ni_rcv_get_node_desc(IN osm_sm_t * sm,
 	 */
 	p_physp = osm_node_get_physp_ptr(p_node, port_num);
 
-	CL_ASSERT(osm_physp_is_valid(p_physp));
-	CL_ASSERT(osm_madw_get_bind_handle(p_madw) ==
-		  osm_dr_path_get_bind_handle(osm_physp_get_dr_path_ptr
-					      (p_physp)));
-
 	context.nd_context.node_guid = osm_node_get_node_guid(p_node);
 
 	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
@@ -480,14 +464,6 @@ __osm_ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
 	} else {
 		p_physp = osm_node_get_physp_ptr(p_node, port_num);
-
-		if (!osm_physp_is_valid(p_physp)) {
-			osm_log(sm->p_log, OSM_LOG_ERROR,
-				"__osm_ni_rcv_process_existing_ca_or_router: ERR 0D19: "
-				"Invalid physical port. Aborting discovery\n");
-			goto Exit;
-		}
-
 		/*
 		   Update the DR Path to the port,
 		   in case the old one is no longer available.
@@ -532,9 +508,6 @@ __osm_ni_rcv_process_switch(IN osm_sm_t * sm,
 
 	OSM_LOG_ENTER(sm->p_log, __osm_ni_rcv_process_switch);
 
-	CL_ASSERT(p_node);
-	CL_ASSERT(p_madw);
-
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
 	osm_dr_path_init(&dr_path,
-- 
1.5.4.rc5




More information about the general mailing list