Skip to contentSkip to conversation

opensm/partition: keep multicast group pointer

PATCH New Sasha Khapyorsky 1 participant 4 messages Nov 11, 2009 – Nov 12, 2009 2 messages not in the archive InfiniBand

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 4AC2114E.3010303-hKgKHo2Ms0F+cjeuK/[email protected]

#2 lore raw

PATCH 1/1 opensm/partition: keep multicast group pointer

Instead of MLID value (which may refer to more than one MGIDs) keep pointer to related multicast group object in partition structure.

---
 opensm/include/opensm/osm_partition.h |   11 ++++++-----
 opensm/opensm/osm_prtn.c              |    6 +++---
 opensm/opensm/osm_qos_policy.c        |   21 +++++----------------
 3 files changed, 14 insertions(+), 24 deletions(-)
opensm/include/opensm/osm_partition.h +6 -5
index 3c8a5aa..fdb34b9 100644
@@ -48,6 +48,7 @@
 #include <complib/cl_map.h>
 #include <opensm/osm_log.h>
 #include <opensm/osm_subnet.h>
+#include <opensm/osm_multicast.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -92,8 +93,8 @@ BEGIN_C_DECLS
 typedef struct osm_prtn {
 	cl_map_item_t map_item;
 	ib_net16_t pkey;
-	ib_net16_t mlid;
 	uint8_t sl;
+	osm_mgrp_t *mgrp;
 	cl_map_t full_guid_tbl;
 	cl_map_t part_guid_tbl;
 	char name[32];
@@ -106,13 +107,13 @@ typedef struct osm_prtn {
 *	pkey
 *		The IBA defined P_KEY of this Partition.
 *
-*	mlid
-*		The network ordered LID of the well known Multicast Group
-*		that was created for this partition.
-*
 *	sl
 *		The Service Level (SL) associated with this Partiton.
 *
+*	mgrp
+*		The pointer to the well known Multicast Group
+*		that was created for this partition (when configured).
+*
 *	full_guid_tbl
 *		Container of pointers to all Port objects in the Partition
 *		with full membership, indexed by port GUID.
opensm/opensm/osm_prtn.c +3 -3
index 4f84a80..f1094e3 100644
@@ -225,7 +225,7 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn,
 			cl_ntoh16(pkey));
 	if (p_mgrp) {
 		p_mgrp->well_known = TRUE;
-		p->mlid = p_mgrp->mlid;
+		p->mgrp = p_mgrp;
 	}
 
 	/* workaround for TS */
@@ -240,8 +240,8 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn,
 						      &p_mgrp);
 	if (p_mgrp) {
 		p_mgrp->well_known = TRUE;
-		if (!p->mlid)
-			p->mlid = p_mgrp->mlid;
+		if (!p->mgrp)
+			p->mgrp = p_mgrp;
 	}
 
 	return status;
opensm/opensm/osm_qos_policy.c +5 -16
index fcb9935..ed631c9 100644
@@ -772,7 +772,6 @@ static void __qos_policy_validate_pkey(
 	uint8_t sl;
 	uint32_t flow;
 	uint8_t hop;
-	osm_mgrp_t * p_mgrp;
 
 	if (!p_qos_policy || !p_qos_match_rule || !p_prtn)
 		return;
@@ -792,31 +791,21 @@ static void __qos_policy_validate_pkey(
 
 	/* If this partition is an IPoIB partition, there should
 	   be a matching MCast group. Fix this group's SL too */
-
-	if (!p_prtn->mlid)
-		return;
-
-	p_mgrp = osm_get_mgrp_by_mlid(p_qos_policy->p_subn, p_prtn->mlid);
-	if (!p_mgrp) {
-		OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_ERROR,
-			"ERR AC16: MCast group for partition with "
-			"pkey 0x%04X not found\n",
-			cl_ntoh16(p_prtn->pkey));
+	if (!p_prtn->mgrp)
 		return;
-	}
 
-	CL_ASSERT((cl_ntoh16(p_mgrp->mcmember_rec.pkey) & 0x7fff) ==
+	CL_ASSERT((cl_ntoh16(p_prtn->mgrp->mcmember_rec.pkey) & 0x7fff) ==
 		  (cl_ntoh16(p_prtn->pkey) & 0x7fff));
 
-	ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,
+	ib_member_get_sl_flow_hop(p_prtn->mgrp->mcmember_rec.sl_flow_hop,
 				  &sl, &flow, &hop);
 	if (sl != p_prtn->sl) {
 		OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_DEBUG,
 			"Updating MCGroup (MLID 0x%04x) SL to "
 			"match partition SL (%u)\n",
-			cl_hton16(p_mgrp->mcmember_rec.mlid),
+			cl_hton16(p_prtn->mgrp->mcmember_rec.mlid),
 			p_prtn->sl);
-		p_mgrp->mcmember_rec.sl_flow_hop =
+		p_prtn->mgrp->mcmember_rec.sl_flow_hop =
 			ib_member_set_sl_flow_hop(p_prtn->sl, flow, hop);
 	}
 }
Signature · 6 lines
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

Re: [ofa-general] [PATCH 1/2 v4] opensm: Storage organization for multicast groups

In reply to a message not in the archive

Hi Slava,

This patch is outdated (it was outdated at date of posting to the list), in particular I cleaned up already a needs to resolve multicast group by mlid for SA PathRecord queries with multicast destination and some others.

Quoted 2 lines · Slava Strebkov

Main purpose is to prepare infrastructure for (many) mgids to one mlid compression.

When doing multicast cleanup, I've implemented this by myself too :). I didn't post it then due to lack of any testing and switched to something else. Basically it is very similar (even structure names), but with few differences:

Quoted 6 lines

Proposed the following changes:
1.Element in mlid array is now a multicast group box. 2.mgrp_box keeps a list of mgroups sharing same mlid. With introduction of compression, there will be many multicast groups per mlid. Current implementation keeps one mgid to one mlid ratio.

Quoted 8 lines

3.mgrp_box has a map of ports sharing same mlid. Ports sorted by port guid. Port map is necessary for building spanning tree per mgroup_box, not just for single mgroup. 4.Element in port map keeps a list of mgroups opened by this port. This allows quick deletion of mgroups when port changes state to DOWN.
5.Multicast processing functions use mgroup_box object instead of mgroup.

I don't have (3) and (4) - a port map per mbox is only useful when OpenSM calculates multicast routing, so I decided instead of bothering with updating such maps during at each MCM Record SA request to generate local map internally when it is needed (in mcast_mgr).

I will post the patch for your review shortly.

Quoted 1 line

Some comments are below anyway.

Quoted 56 lines
opensm/opensm/osm_qos_policy.c +14 -16
index 9b72293..6c0a1e6 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 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) 2008 Xsigo Systems Inc.  All rights reserved.
@@ -773,6 +773,8 @@ static void __qos_policy_validate_pkey(
 	uint32_t flow;
 	uint8_t hop;
 	osm_mgrp_t * p_mgrp;
+	osm_mgrp_box_t * p_mgrp_box;
+	cl_list_item_t *p_item;
 
 	if (!p_qos_policy || !p_qos_match_rule || !p_prtn)
 		return;
@@ -796,28 +798,33 @@ static void __qos_policy_validate_pkey(
 	if (!p_prtn->mlid)
 		return;
 
-	p_mgrp = osm_get_mgrp_by_mlid(p_qos_policy->p_subn, p_prtn->mlid);
-	if (!p_mgrp) {
+	p_mgrp_box = osm_get_mgrp_box_by_mlid(p_qos_policy->p_subn, p_prtn->mlid);
+	if (!p_mgrp_box) {
 		OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_ERROR,
-			"ERR AC16: MCast group for partition with "
+			"ERR AC16: MCast group box for partition with "
 			"pkey 0x%04X not found\n",
 			cl_ntoh16(p_prtn->pkey));
 		return;
 	}
 
-	CL_ASSERT((cl_ntoh16(p_mgrp->mcmember_rec.pkey) & 0x7fff) ==
-		  (cl_ntoh16(p_prtn->pkey) & 0x7fff));
-
-	ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,
-				  &sl, &flow, &hop);
-	if (sl != p_prtn->sl) {
-		OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_DEBUG,
-			"Updating MCGroup (MLID 0x%04x) SL to "
-			"match partition SL (%u)\n",
-			cl_hton16(p_mgrp->mcmember_rec.mlid),
-			p_prtn->sl);
-		p_mgrp->mcmember_rec.sl_flow_hop =
+	p_item = cl_qlist_head(&p_mgrp_box->mgrp_list);
+	while (p_item != cl_qlist_end(&p_mgrp_box->mgrp_list)) {
+		p_mgrp = (osm_mgrp_t *) PARENT_STRUCT(p_item, osm_mgrp_t,
+			box_item);
+		p_item = cl_qlist_next(p_item);
+		CL_ASSERT((cl_ntoh16(p_mgrp->mcmember_rec.pkey) & 0x7fff) ==
+			(cl_ntoh16(p_prtn->pkey) & 0x7fff));
+		ib_member_get_sl_flow_hop(p_mgrp->mcmember_rec.sl_flow_hop,

opensm/opensm/osm_qos_policy.c static void __qos_policy_validate_pkey( · line 827

Quoted 10 lines
opensm/opensm/osm_qos_policy.c +9 -0
+			&sl, &flow, &hop);
+		if (sl != p_prtn->sl) {
+			OSM_LOG(&p_qos_policy->p_subn->p_osm->log, OSM_LOG_DEBUG,
+				"Updating MCGroup (MLID 0x%04x) SL to "
+				"match partition SL (%u)\n",
+				cl_hton16(p_mgrp->mcmember_rec.mlid),
+				p_prtn->sl);
+			p_mgrp->mcmember_rec.sl_flow_hop =
 			ib_member_set_sl_flow_hop(p_prtn->sl, flow, hop);
+		}

Seems that when QoS requests using certain SL value on some partition you instead of altering SL value for only multicast group associated with given partition are going to change SL for all multicast groups which have a same mlid. It doesn't seem correct to me.

I think that in proper implementation partition object instead of keeping mlid (which can be shared by many multicast groups) should keep pointer to its own group. I posted such patch to the list recently.

Quoted 55 lines
opensm/opensm/osm_qos_policy.c +0 -0
 	}
 }
 
opensm/opensm/osm_sa.c +8 -15
index 02737c2..a5d8945 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2009 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) 2008 Xsigo Systems Inc.  All rights reserved.
@@ -706,18 +706,17 @@ static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)
 {
 	struct opensm_dump_context dump_context;
 	osm_mgrp_t *p_mgrp;
-	int i;
 
 	dump_context.p_osm = p_osm;
 	dump_context.file = file;
 	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump multicast\n");
 	cl_plock_acquire(&p_osm->lock);
-	for (i = 0; i <= p_osm->subn.max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++) {
-		p_mgrp = p_osm->subn.mgroups[i];
-		if (p_mgrp)
-			sa_dump_one_mgrp(p_mgrp, &dump_context);
+	p_mgrp = (osm_mgrp_t*)cl_fmap_head(&p_osm->subn.mgrp_mgid_tbl);
+	while (p_mgrp != (osm_mgrp_t*)cl_fmap_end(&p_osm->subn.mgrp_mgid_tbl)) {
+		sa_dump_one_mgrp(p_mgrp, &dump_context);
+		p_mgrp = (osm_mgrp_t*) cl_fmap_next(&p_mgrp->map_item);
 	}
+
 	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump inform\n");
 	cl_qlist_apply_func(&p_osm->subn.sa_infr_list,
 			    sa_dump_one_inform, &dump_context);
@@ -740,22 +739,15 @@ static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
 				unsigned well_known)
 {
 	ib_net64_t comp_mask;
-	osm_mgrp_t *p_mgrp;
+	osm_mgrp_t *p_mgrp = NULL;
+	cl_fmap_item_t *p_fitem;
 
 	cl_plock_excl_acquire(&p_osm->lock);
 
-	p_mgrp = osm_get_mgrp_by_mlid(&p_osm->subn, mlid);
-	if (p_mgrp) {
-		if (!memcmp(&p_mgrp->mcmember_rec.mgid, &p_mcm_rec->mgid,
-			    sizeof(ib_gid_t))) {
-			OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,
-				"mgrp %04x is already here.", cl_ntoh16(mlid));
-			goto _out;

opensm/opensm/osm_sa.c static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid, · line 751

Quoted 10 lines
opensm/opensm/osm_sa.c +4 -5
-		}
-		OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,
-			"mlid %04x is already used by another MC group. Will "
-			"request clients reregistration.\n", cl_ntoh16(mlid));
-		p_mgrp = NULL;
+	p_fitem = cl_fmap_get(&p_osm->subn.mgrp_mgid_tbl, &p_mcm_rec->mgid);
+	if (p_fitem != cl_fmap_end(&p_osm->subn.mgrp_mgid_tbl)) {
+		OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,
+			"mgrp %04x is already here.", cl_ntoh16(mlid));
 		goto _out;

Finally you are skipping mlid/mgid consistency check. Maybe it is not a fatal in general, but likely may confuse a multicast group members where MLID value was changes over SA DB reload.

Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH 1/1 opensm/osm_mgrp_new(): add subnet db insertion

Add insertion of mgrp into subnet DB in osm_mgrp_new() function code. This consolidation makes a code cleaner and will help us to add MGID to MLID compression model where mgrp will not be mapped directly to mlids but using additional structure.

---
 opensm/include/opensm/osm_multicast.h  |    5 ++++-
 opensm/opensm/osm_multicast.c          |    7 ++++++-
 opensm/opensm/osm_sa_mcmember_record.c |    7 +------
 3 files changed, 11 insertions(+), 8 deletions(-)
opensm/include/opensm/osm_multicast.h +4 -1
index f0897f4..59e4d0d 100644
@@ -142,9 +142,12 @@ typedef struct osm_mgrp {
 *
 * SYNOPSIS
 */
-osm_mgrp_t *osm_mgrp_new(IN ib_net16_t mlid, IN ib_member_rec_t * mcmr);
+osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid,
+			 IN ib_member_rec_t * mcmr);
 /*
 * PARAMETERS
+*	subn
+*		[in] Pointer to osm_subn_t object.
 *	mlid
 *		[in] Multicast LID for this multicast group.
 *
opensm/opensm/osm_multicast.c +6 -1
index 8ccab8e..ff607e1 100644
@@ -73,7 +73,8 @@ void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp)
 	free(p_mgrp);
 }
 
-osm_mgrp_t *osm_mgrp_new(IN ib_net16_t mlid, IN ib_member_rec_t * mcmr)
+osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid,
+			 IN ib_member_rec_t * mcmr)
 {
 	osm_mgrp_t *p_mgrp;
 
@@ -86,6 +87,10 @@ osm_mgrp_t *osm_mgrp_new(IN ib_net16_t mlid, IN ib_member_rec_t * mcmr)
 	p_mgrp->mlid = mlid;
 	p_mgrp->mcmember_rec = *mcmr;
 
+	cl_fmap_insert(&subn->mgrp_mgid_tbl, &p_mgrp->mcmember_rec.mgid,
+		       &p_mgrp->map_item);
+	subn->mgroups[cl_ntoh16(p_mgrp->mlid) - IB_LID_MCAST_START_HO] = p_mgrp;
+
 	return p_mgrp;
 }
 
opensm/opensm/osm_sa_mcmember_record.c +1 -6
index 95c41e4..357e6ab 100644
@@ -796,7 +796,7 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 
 	/* create a new MC Group */
 	mcm_rec.mlid = mlid;
-	*pp_mgrp = osm_mgrp_new(mlid, &mcm_rec);
+	*pp_mgrp = osm_mgrp_new(sa->p_subn, mlid, &mcm_rec);
 	if (*pp_mgrp == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B08: "
 			"osm_mgrp_new failed\n");
@@ -813,11 +813,6 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 	(*pp_mgrp)->mcmember_rec.pkt_life &= 0x3f;
 	(*pp_mgrp)->mcmember_rec.pkt_life |= 2 << 6;	/* exactly */
 
-	/* Insert the new group in the data base */
-	cl_fmap_insert(&sa->p_subn->mgrp_mgid_tbl,
-		       &(*pp_mgrp)->mcmember_rec.mgid, &(*pp_mgrp)->map_item);
-	sa->p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = *pp_mgrp;
-
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
 	return status;
Signature · 6 lines
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH 1/1 osm_mlid_box: infrastructure for mgid compression

Now each MLID value is represented by collection of multicast groups
- osm_mgrp_box object. All multicast routing calculation and setup operations are performed using those MLID indexed objects. Multicast groups are kept as linked list in osm_mgrp_box and as before are globally indexed by its MGIDs in SM DB, so SA operations are unchanged.

This model let us to implement an actual MGID to MLID compression by just having multiple multicast groups placed in the list under same osm_mgrp_box object.

All current functionality is preserved.

---
 opensm/include/opensm/osm_multicast.h  |   66 ++++++-----
 opensm/include/opensm/osm_subnet.h     |   17 ++--
 opensm/opensm/osm_mcast_mgr.c          |  210 ++++++++++++++++----------------
 opensm/opensm/osm_multicast.c          |   57 ++++++++--
 opensm/opensm/osm_sa.c                 |   16 +--
 opensm/opensm/osm_sa_mcmember_record.c |   17 +--
 opensm/opensm/osm_subnet.c             |   10 +-
 7 files changed, 215 insertions(+), 178 deletions(-)
opensm/include/opensm/osm_multicast.h +36 -30
index 59e4d0d..1da575d 100644
@@ -97,8 +97,8 @@ BEGIN_C_DECLS
 */
 typedef struct osm_mgrp {
 	cl_fmap_item_t map_item;
+	cl_list_item_t list_item;
 	ib_net16_t mlid;
-	osm_mtree_node_t *p_root;
 	cl_qmap_t mcm_port_tbl;
 	ib_member_rec_t mcmember_rec;
 	boolean_t well_known;
@@ -109,15 +109,13 @@ typedef struct osm_mgrp {
 *	map_item
 *		Map Item for fmap linkage.  Must be first element!!
 *
+*	list_item
+*		List item for linkage in osm_mgrp_box's mgrp_list qlist.
+*
 *	mlid
 *		The network ordered LID of this Multicast Group (must be
 *		>= 0xC000).
 *
-*	p_root
-*		Pointer to the root "tree node" in the single spanning tree
-*		for this multicast group.  The nodes of the tree represent
-*		switches.  Member ports are not represented in the tree.
-*
 *	mcm_port_tbl
 *		Table (sorted by port GUID) of osm_mcm_port_t objects
 *		representing the member ports of this multicast group.
@@ -133,6 +131,37 @@ typedef struct osm_mgrp {
 * SEE ALSO
 *********/
 
+/****s* OpenSM: Multicast Group/osm_mgrp_box_t
+* NAME
+*	osm_mgrp_box_t
+*
+* DESCRIPTION
+*	Multicast structure which holds all multicast groups with same MLID.
+*
+* SYNOPSIS
+*/
+typedef struct osm_mgrp_box {
+	uint16_t mlid;
+	cl_qlist_t mgrp_list;
+	osm_mtree_node_t *root;
+} osm_mgrp_box_t;
+/*
+* FIELDS
+*	mlid
+*		The host ordered LID of this Multicast Group (must be
+*		>= 0xC000).
+*
+*	p_root
+*		Pointer to the root "tree node" in the single spanning tree
+*		for this multicast group.  The nodes of the tree represent
+*		switches.  Member ports are not represented in the tree.
+*
+*	mgrp_list
+*		List of multicast groups (mpgr object) having same MLID value.
+*
+* SEE ALSO
+*********/
+
 /****f* OpenSM: Multicast Group/osm_mgrp_new
 * NAME
 *	osm_mgrp_new
@@ -164,30 +193,6 @@ osm_mgrp_t *osm_mgrp_new(IN osm_subn_t * subn, IN ib_net16_t mlid,
 *	Multicast Group, osm_mgrp_delete
 *********/
 
-/****f* OpenSM: Multicast Group/osm_mgrp_delete
-* NAME
-*	osm_mgrp_delete
-*
-* DESCRIPTION
-*	Destroys and deallocates a Multicast Group.
-*
-* SYNOPSIS
-*/
-void osm_mgrp_delete(IN osm_mgrp_t * p_mgrp);
-/*
-* PARAMETERS
-*	p_mgrp
-*		[in] Pointer to an osm_mgrp_t object.
-*
-* RETURN VALUES
-*	None.
-*
-* NOTES
-*
-* SEE ALSO
-*	Multicast Group, osm_mgrp_new
-*********/
-
 /****f* OpenSM: Multicast Group/osm_mgrp_is_guid
 * NAME
 *	osm_mgrp_is_guid
@@ -378,6 +383,7 @@ void osm_mgrp_delete_port(IN osm_subn_t * subn, IN osm_log_t * log,
 void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
 			  osm_mcm_port_t * mcm_port, ib_member_rec_t * mcmr);
 void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mpgr);
+void osm_mgrp_box_delete(osm_mgrp_box_t *mbox);
 
 END_C_DECLS
 #endif				/* _OSM_MULTICAST_H_ */
opensm/include/opensm/osm_subnet.h +8 -9
index 0302f91..fc60ced 100644
@@ -518,7 +518,7 @@ typedef struct osm_subn {
 	boolean_t coming_out_of_standby;
 	unsigned need_update;
 	cl_fmap_t mgrp_mgid_tbl;
-	void *mgroups[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];
+	void *mboxes[IB_LID_MCAST_END_HO - IB_LID_MCAST_START_HO + 1];
 } osm_subn_t;
 /*
 * FIELDS
@@ -643,9 +643,9 @@ typedef struct osm_subn {
 *		Container of pointers to all Multicast group objects in
 *		the subnet. Indexed by MGID.
 *
-*	mgroups
-*		Array of pointers to all Multicast Group objects in the subnet.
-*		Indexed by MLID offset from base MLID.
+*	mboxes
+*		Array of pointers to all Multicast MLID box objects in the
+*		subnet. Indexed by MLID offset from base MLID.
 *
 * SEE ALSO
 *	Subnet object
@@ -967,9 +967,9 @@ struct osm_port *osm_get_port_by_lid(const osm_subn_t * subn, ib_net16_t lid);
 *       Subnet object, osm_port_t
 *********/
 
-/****f* OpenSM: Subnet/osm_get_mgrp_by_mlid
+/****f* OpenSM: Subnet/osm_get_mbox_by_mlid
 * NAME
-*	osm_get_mgrp_by_mlid
+*	osm_get_mbox_by_mlid
 *
 * DESCRIPTION
 *	The looks for the given multicast group in the subnet table by mlid.
@@ -978,10 +978,9 @@ struct osm_port *osm_get_port_by_lid(const osm_subn_t * subn, ib_net16_t lid);
 *
 * SYNOPSIS
 */
-static inline
-struct osm_mgrp *osm_get_mgrp_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)
+static inline struct osm_mgrp_box *osm_get_mbox_by_mlid(osm_subn_t const *p_subn, ib_net16_t mlid)
 {
-	return p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];
+	return p_subn->mboxes[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO];
 }
 /*
 * PARAMETERS
opensm/opensm/osm_mcast_mgr.c +106 -104

413 lines not on this page · raw message

opensm/opensm/osm_multicast.c +49 -8

102 lines not on this page · raw message

opensm/opensm/osm_sa.c +6 -10
index 2db8ba2..c4d86c7 100644
@@ -684,18 +684,15 @@ static void sa_dump_all_sa(osm_opensm_t * p_osm, FILE * file)
 {
 	struct opensm_dump_context dump_context;
 	osm_mgrp_t *p_mgrp;
-	int i;
 
 	dump_context.p_osm = p_osm;
 	dump_context.file = file;
 	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump multicast\n");
 	cl_plock_acquire(&p_osm->lock);
-	for (i = 0; i <= p_osm->subn.max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++) {
-		p_mgrp = p_osm->subn.mgroups[i];
-		if (p_mgrp)
-			sa_dump_one_mgrp(p_mgrp, &dump_context);
-	}
+	for (p_mgrp = (osm_mgrp_t *) cl_fmap_head(&p_osm->subn.mgrp_mgid_tbl);
+	     p_mgrp != (osm_mgrp_t *) cl_fmap_end(&p_osm->subn.mgrp_mgid_tbl);
+	     p_mgrp = (osm_mgrp_t *) cl_fmap_next(&p_mgrp->map_item))
+		sa_dump_one_mgrp(p_mgrp, &dump_context);
 	OSM_LOG(&p_osm->log, OSM_LOG_DEBUG, "Dump inform\n");
 	cl_qlist_apply_func(&p_osm->subn.sa_infr_list,
 			    sa_dump_one_inform, &dump_context);
@@ -722,10 +719,9 @@ static osm_mgrp_t *load_mcgroup(osm_opensm_t * p_osm, ib_net16_t mlid,
 
 	cl_plock_excl_acquire(&p_osm->lock);
 
-	p_mgrp = osm_get_mgrp_by_mlid(&p_osm->subn, mlid);
+	p_mgrp = osm_get_mgrp_by_mgid(&p_osm->sa, &p_mcm_rec->mgid);
 	if (p_mgrp) {
-		if (!memcmp(&p_mgrp->mcmember_rec.mgid, &p_mcm_rec->mgid,
-			    sizeof(ib_gid_t))) {
+		if (p_mgrp->mlid == mlid) {
 			OSM_LOG(&p_osm->log, OSM_LOG_DEBUG,
 				"mgrp %04x is already here.", cl_ntoh16(mlid));
 			goto _out;
opensm/opensm/osm_sa_mcmember_record.c +7 -10
index 357e6ab..477483f 100644
@@ -121,12 +121,12 @@ static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_net16_t requested_mlid)
 
 	if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO
 	    && cl_ntoh16(requested_mlid) <= p_subn->max_mcast_lid_ho
-	    && !osm_get_mgrp_by_mlid(p_subn, requested_mlid))
+	    && !osm_get_mbox_by_mlid(p_subn, requested_mlid))
 		return requested_mlid;
 
 	max = p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO + 1;
 	for (i = 0; i < max; i++)
-		if (!sa->p_subn->mgroups[i])
+		if (!sa->p_subn->mboxes[i])
 			return cl_hton16(i + IB_LID_MCAST_START_HO);
 
 	return 0;
@@ -1356,7 +1356,6 @@ static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 	osm_physp_t *p_req_physp;
 	boolean_t trusted_req;
 	osm_mgrp_t *p_mgrp;
-	int i;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -1385,13 +1384,11 @@ static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 	CL_PLOCK_ACQUIRE(sa->p_lock);
 
 	/* simply go over all MCGs and match */
-	for (i = 0; i <= sa->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++) {
-		p_mgrp = sa->p_subn->mgroups[i];
-		if (p_mgrp)
-			mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp,
-					  p_req_physp, trusted_req, &rec_list);
-	}
+	for (p_mgrp = (osm_mgrp_t *) cl_fmap_head(&sa->p_subn->mgrp_mgid_tbl);
+	     p_mgrp != (osm_mgrp_t *) cl_fmap_end(&sa->p_subn->mgrp_mgid_tbl);
+	     p_mgrp = (osm_mgrp_t *) cl_fmap_next(&p_mgrp->map_item))
+		mcmr_by_comp_mask(sa, p_rcvd_rec, comp_mask, p_mgrp,
+				  p_req_physp, trusted_req, &rec_list);
 
 	CL_PLOCK_RELEASE(sa->p_lock);
 
opensm/opensm/osm_subnet.c +3 -7
index cac5e94..53347ca 100644
@@ -426,7 +426,6 @@ void osm_subn_destroy(IN osm_subn_t * p_subn)
 	osm_switch_t *p_sw, *p_next_sw;
 	osm_remote_sm_t *p_rsm, *p_next_rsm;
 	osm_prtn_t *p_prtn, *p_next_prtn;
-	osm_mgrp_t *p_mgrp;
 	osm_infr_t *p_infr, *p_next_infr;
 
 	/* it might be a good idea to de-allocate all known objects */
@@ -472,12 +471,9 @@ void osm_subn_destroy(IN osm_subn_t * p_subn)
 	cl_fmap_remove_all(&p_subn->mgrp_mgid_tbl);
 
 	for (i = 0; i <= p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO;
-	     i++) {
-		p_mgrp = p_subn->mgroups[i];
-		p_subn->mgroups[i] = NULL;
-		if (p_mgrp)
-			osm_mgrp_delete(p_mgrp);
-	}
+	     i++)
+		if (p_subn->mboxes[i])
+			osm_mgrp_box_delete(p_subn->mboxes[i]);
 
 	p_next_infr = (osm_infr_t *) cl_qlist_head(&p_subn->sa_infr_list);
 	while (p_next_infr !=
Signature · 6 lines
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html