diff mbox

opensm/osm_mgrp_new(): add subnet db insertion

Message ID 20091112000224.GZ7192@me (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Sasha Khapyorsky Nov. 12, 2009, 12:02 a.m. UTC
None
diff mbox

Patch

diff --git a/opensm/include/opensm/osm_multicast.h b/opensm/include/opensm/osm_multicast.h
index f0897f4..59e4d0d 100644
--- a/opensm/include/opensm/osm_multicast.h
+++ b/opensm/include/opensm/osm_multicast.h
@@ -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.
 *
diff --git a/opensm/opensm/osm_multicast.c b/opensm/opensm/osm_multicast.c
index 8ccab8e..ff607e1 100644
--- a/opensm/opensm/osm_multicast.c
+++ b/opensm/opensm/osm_multicast.c
@@ -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;
 }
 
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 95c41e4..357e6ab 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -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;