[ofa-general] [PATCH] opensm: move IBA constants from osm_sa_mcmember_record.h to ib_types.h

Sasha Khapyorsky sashak at voltaire.com
Fri Nov 30 07:44:01 PST 2007


Move IBA constants MC_SCOPE_* (and rename to IB_MC_SCOPE_*) from
osm_sa_mcmember_record.h to iba/ib_types.h. Use defined in iba/ib_types.h
MC membership constants (IB_MC_REC_STATE_*) instead of locally defined
in osm_sa_mcmember_record.h.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/iba/ib_types.h                  |   12 ++++++++++++
 opensm/include/opensm/osm_sa_mcmember_record.h |   13 +------------
 opensm/opensm/osm_prtn.c                       |    6 +++---
 opensm/opensm/osm_sa_mcmember_record.c         |    4 ++--
 opensm/opensm/osm_sa_path_record.c             |    2 +-
 5 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/opensm/include/iba/ib_types.h b/opensm/include/iba/ib_types.h
index d904d9c..672184b 100644
--- a/opensm/include/iba/ib_types.h
+++ b/opensm/include/iba/ib_types.h
@@ -255,6 +255,18 @@ BEGIN_C_DECLS
 */
 #define IB_HOPLIMIT_MAX					255
 /*********/
+/****d* IBA Base: Constants/IB_MC_SCOPE_*
+* NAME
+*	IB_MC_SCOPE_*
+*
+* DESCRIPTION
+*	Scope component definitions from IBA 1.2 (Table 3 p. 146)
+*/
+#define IB_MC_SCOPE_LINK_LOCAL		0x2
+#define IB_MC_SCOPE_SITE_LOCAL		0x5
+#define IB_MC_SCOPE_ORG_LOCAL		0x8
+#define IB_MC_SCOPE_GLOBAL		0xE
+/*********/
 /****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS
 * NAME
 *	IB_PKEY_MAX_BLOCKS
diff --git a/opensm/include/opensm/osm_sa_mcmember_record.h b/opensm/include/opensm/osm_sa_mcmember_record.h
index a7102ca..dfe423c 100644
--- a/opensm/include/opensm/osm_sa_mcmember_record.h
+++ b/opensm/include/opensm/osm_sa_mcmember_record.h
@@ -379,12 +379,6 @@ osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_mcmr_recv_t * const p_mcmr,
 #define OSM_DEFAULT_MGRP_RATE 0x03
 /***********/
 
-/* Scope component definitions from IBA 1.2 (Table 3 p. 146) */
-#define MC_SCOPE_LINK_LOCAL		0x2
-#define MC_SCOPE_SITE_LOCAL		0x5
-#define MC_SCOPE_ORG_LOCAL		0x8
-#define MC_SCOPE_GLOBAL			0xE
-
 /****d* OpenSM: MC Member Record Receiver/OSM_DEFAULT_MGRP_SCOPE
 * Name
 *	OSM_DEFAULT_MGRP_SCOPE
@@ -394,13 +388,8 @@ osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_mcmr_recv_t * const p_mcmr,
 *
 * SYNOPSIS
 */
-#define OSM_DEFAULT_MGRP_SCOPE MC_SCOPE_LINK_LOCAL
+#define OSM_DEFAULT_MGRP_SCOPE IB_MC_SCOPE_LINK_LOCAL
 /***********/
 
-/* JoinState definitions from IBA 1.2 */
-#define MC_FULL_MEMBER			0x1
-#define MC_NON_MEMBER			0x2
-#define MC_SENDONLY_NON_MEMBER		0x4
-
 END_C_DECLS
 #endif				/* _OSM_MCMR_H_ */
diff --git a/opensm/opensm/osm_prtn.c b/opensm/opensm/osm_prtn.c
index ec42da1..f0168fc 100644
--- a/opensm/opensm/osm_prtn.c
+++ b/opensm/opensm/osm_prtn.c
@@ -203,7 +203,7 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
 	pkey = p->pkey | cl_hton16(0x8000);
 	if (!scope)
 		scope = OSM_DEFAULT_MGRP_SCOPE;
-	hop_limit = (scope == MC_SCOPE_LINK_LOCAL) ? 0 : IB_HOPLIMIT_MAX;
+	hop_limit = (scope == IB_MC_SCOPE_LINK_LOCAL) ? 0 : IB_HOPLIMIT_MAX;
 
 	memset(&mc_rec, 0, sizeof(mc_rec));
 
@@ -218,7 +218,7 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
 	mc_rec.pkt_life = OSM_DEFAULT_SUBNET_TIMEOUT;
 	mc_rec.sl_flow_hop = ib_member_set_sl_flow_hop(p->sl, 0, hop_limit);
 	/* Scope in MCMemberRecord (if present) needs to be consistent with MGID */
-	mc_rec.scope_state = ib_member_set_scope_state(scope, MC_FULL_MEMBER);
+	mc_rec.scope_state = ib_member_set_scope_state(scope, IB_MC_REC_STATE_FULL_MEMBER);
 	ib_mgid_set_scope(&mc_rec.mgid, scope);
 
 	/* don't update rate, mtu */
@@ -240,7 +240,7 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log,
 	mc_rec.mgid = osm_ts_ipoib_mgid;
 	memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));
 	/* Scope in MCMemberRecord (if present) needs to be consistent with MGID */
-	mc_rec.scope_state = ib_member_set_scope_state(scope, MC_FULL_MEMBER);
+	mc_rec.scope_state = ib_member_set_scope_state(scope, IB_MC_REC_STATE_FULL_MEMBER);
 	ib_mgid_set_scope(&mc_rec.mgid, scope);
 
 	status =
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 4d4adfb..5d5fb8d 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -953,7 +953,7 @@ __validate_requested_mgid(IN osm_mcmr_recv_t * const p_rcv,
 	   the scope should not be link local */
 	if ((signature == 0xA01B) &&
 	    ((p_mcm_rec->mgid.multicast.header[1] & 0x0F) ==
-	     MC_SCOPE_LINK_LOCAL)) {
+	     IB_MC_SCOPE_LINK_LOCAL)) {
 		osm_log(p_rcv->p_log, OSM_LOG_ERROR,
 			"__validate_requested_mgid: ERR 1B24: "
 			"MGID uses 0xA01B signature but with link-local scope\n");
@@ -1180,7 +1180,7 @@ osm_mcmr_rcv_create_new_mgrp(IN osm_mcmr_recv_t * const p_rcv,
 						  scope_state, &scope, NULL);
 		} else {
 			/* to guarantee no collision with other subnets use local scope! */
-			scope = MC_SCOPE_LINK_LOCAL;
+			scope = IB_MC_SCOPE_LINK_LOCAL;
 		}
 
 		p_mgid = &(mcm_rec.mgid);
diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
index 2597046..f46a3be 100644
--- a/opensm/opensm/osm_sa_path_record.c
+++ b/opensm/opensm/osm_sa_path_record.c
@@ -2151,7 +2151,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 
 		/* HopLimit is not yet set in non link local MC groups */
 		/* If it were, this would not be needed */
-		if (ib_mgid_get_scope(&p_mgrp->mcmember_rec.mgid) != MC_SCOPE_LINK_LOCAL)
+		if (ib_mgid_get_scope(&p_mgrp->mcmember_rec.mgid) != IB_MC_SCOPE_LINK_LOCAL)
 			hop_limit = IB_HOPLIMIT_MAX;
 
 		p_pr_item->path_rec.hop_flow_raw =
-- 
1.5.3.4.206.g58ba4




More information about the general mailing list