Improve __cleanup_mgrp() function it is called from context where mgrp pointer is known and additional by mlid resolving is not needed.
Signed-off-by: Sasha Khapyorsky <[email protected]> --- opensm/opensm/osm_sa_mcmember_record.c | 26 ++++++++++---------------- 1 files changed, 10 insertions(+), 16 deletions(-) diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c index 99aee1b..4561808 100644 --- a/opensm/opensm/osm_sa_mcmember_record.c +++ b/opensm/opensm/osm_sa_mcmember_record.c @@ -142,16 +142,13 @@ static ib_net16_t __get_new_mlid(osm_sa_t *sa, ib_net16_t requested_mlid) we silently drop it. Since it was an intermediate group no need to re-route it. **********************************************************************/ -static void __cleanup_mgrp(IN osm_sa_t * sa, IN ib_net16_t const mlid) +static void __cleanup_mgrp(IN osm_sa_t * sa, osm_mgrp_t *mgrp) { - osm_mgrp_t *p_mgrp = osm_get_mgrp_by_mlid(sa->p_subn, mlid); - /* Remove MGRP only if osm_mcm_port_t count is 0 and not a well known group */ - if (p_mgrp && cl_is_qmap_empty(&p_mgrp->mcm_port_tbl) && - p_mgrp->well_known == FALSE) { - sa->p_subn->mgroups[cl_ntoh16(mlid) - IB_LID_MCAST_START_HO] = NULL; - osm_mgrp_delete(p_mgrp); + if (cl_is_qmap_empty(&mgrp->mcm_port_tbl) && !mgrp->well_known) { + sa->p_subn->mgroups[cl_ntoh16(mgrp->mlid) - IB_LID_MCAST_START_HO] = NULL; + osm_mgrp_delete(mgrp); } } @@ -1273,7 +1270,7 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw) || !__validate_port_caps(sa->p_log, p_mgrp, p_physp) || !(join_state != 0)) { /* since we might have created the new group we need to cleanup */ - __cleanup_mgrp(sa, mlid); + __cleanup_mgrp(sa, p_mgrp); CL_PLOCK_RELEASE(sa->p_lock); @@ -1312,7 +1309,7 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw) if (status != IB_SUCCESS) { /* we fail to add the port so we might need to delete the group */ - __cleanup_mgrp(sa, mlid); + __cleanup_mgrp(sa, p_mgrp); CL_PLOCK_RELEASE(sa->p_lock); @@ -1345,13 +1342,10 @@ __osm_mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * const p_madw) CL_PLOCK_EXCL_ACQUIRE(sa->p_lock); /* the request for routing failed so we need to remove the port */ - p_mgrp = osm_get_mgrp_by_mlid(sa->p_subn, mlid); - if (p_mgrp != NULL) { - osm_mgrp_delete_port(sa->p_subn, sa->p_log, p_mgrp, - p_recvd_mcmember_rec->port_gid. - unicast.interface_id); - __cleanup_mgrp(sa, mlid); - } + osm_mgrp_delete_port(sa->p_subn, sa->p_log, p_mgrp, + p_recvd_mcmember_rec->port_gid. + unicast.interface_id); + __cleanup_mgrp(sa, p_mgrp); CL_PLOCK_RELEASE(sa->p_lock); osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_NO_RESOURCES); goto Exit; -- 1.6.0.4.766.g6fc4a _______________________________________________ general mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
