[ofa-general] ***SPAM*** [PATCHv2 2/2] opensm: Utilize ib_gid_is_notzero routine

Hal Rosenstock hnrose at comcast.net
Thu Mar 12 13:20:08 PDT 2009


Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>

---
Changes since v1:
Rebased osm_sa_path_record.c


diff --git a/opensm/opensm/osm_inform.c b/opensm/opensm/osm_inform.c
index f0dab30..dd3f41e 100644
--- a/opensm/opensm/osm_inform.c
+++ b/opensm/opensm/osm_inform.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -108,7 +109,6 @@ __match_inf_rec(IN const cl_list_item_t * const p_list_item, IN void *context)
 	osm_infr_t *p_infr = (osm_infr_t *) p_list_item;
 	osm_log_t *p_log = p_infr_rec->sa->p_log;
 	cl_status_t status = CL_NOT_FOUND;
-	ib_gid_t all_zero_gid;
 
 	OSM_LOG_ENTER(p_log);
 
@@ -118,11 +118,8 @@ __match_inf_rec(IN const cl_list_item_t * const p_list_item, IN void *context)
 		goto Exit;
 	}
 
-	memset(&all_zero_gid, 0, sizeof(ib_gid_t));
-
 	/* if inform_info.gid is not zero, ignore lid range */
-	if (memcmp(&p_infr_rec->inform_record.inform_info.gid, &all_zero_gid,
-		    sizeof(p_infr_rec->inform_record.inform_info.gid))) {
+	if (ib_gid_is_notzero(&p_infr_rec->inform_record.inform_info.gid)) {
 		if (memcmp(&p_infr->inform_record.inform_info.gid,
 			   &p_infr_rec->inform_record.inform_info.gid,
 			   sizeof(p_infr->inform_record.inform_info.gid))) {
diff --git a/opensm/opensm/osm_sa_informinfo.c b/opensm/opensm/osm_sa_informinfo.c
index 5863753..fb81008 100644
--- a/opensm/opensm/osm_sa_informinfo.c
+++ b/opensm/opensm/osm_sa_informinfo.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -95,7 +96,6 @@ __validate_ports_access_rights(IN osm_sa_t * sa,
 	ib_net16_t lid_range_end;
 	ib_net16_t lid;
 	const cl_ptr_vector_t *p_tbl;
-	ib_gid_t zero_gid;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -103,9 +103,7 @@ __validate_ports_access_rights(IN osm_sa_t * sa,
 	p_requester_physp = osm_get_physp_by_mad_addr(sa->p_log, sa->p_subn,
 						      &p_infr_rec->report_addr);
 
-	memset(&zero_gid, 0, sizeof(zero_gid));
-	if (memcmp(&(p_infr_rec->inform_record.inform_info.gid),
-		   &zero_gid, sizeof(ib_gid_t))) {
+	if (ib_gid_is_notzero(&p_infr_rec->inform_record.inform_info.gid)) {
 		/* a gid is defined */
 		portguid =
 		    p_infr_rec->inform_record.inform_info.gid.unicast.
diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
index 431977d..978c1a5 100644
--- a/opensm/opensm/osm_sa_path_record.c
+++ b/opensm/opensm/osm_sa_path_record.c
@@ -2,7 +2,8 @@
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
- * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved.
+ * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -83,12 +84,6 @@ typedef struct osm_path_parms {
 	boolean_t reversible;
 } osm_path_parms_t;
 
-static const ib_gid_t zero_gid = { {0x00, 0x00, 0x00, 0x00,
-				    0x00, 0x00, 0x00, 0x00,
-				    0x00, 0x00, 0x00, 0x00,
-				    0x00, 0x00, 0x00, 0x00},
-};
-
 /**********************************************************************
  **********************************************************************/
 static inline boolean_t
@@ -775,10 +770,8 @@ __osm_pr_rcv_build_pr(IN osm_sa_t * sa,
 
 	p_src_physp = p_src_port->p_physp;
 
-	if (p_dgid) {
-		if (memcmp(p_dgid, &zero_gid, sizeof(*p_dgid)))
-			is_nonzero_gid = 1;
-	}
+	if (p_dgid)
+		is_nonzero_gid = ib_gid_is_notzero(p_dgid);
 
 	if (is_nonzero_gid)
 		p_pr->dgid = *p_dgid;



More information about the general mailing list