Port needs to access multicast groups where it is joined to. Now it is implemented by keeping list of list of mcm_info elements where MLID of each multicast group is stored. Obviously this assumes single MGID to MLID mapping model.
This patch changes this so that instead of MLID mcm_info stores pointer to multicast group object (mgrp). Such model makes it possible to have MGIDs to MLID compression. Signed-off-by: Sasha Khapyorsky <[email protected]> --- opensm/include/opensm/osm_mcm_info.h | 13 +++++++------ opensm/include/opensm/osm_port.h | 13 +++++++------ opensm/opensm/osm_drop_mgr.c | 10 +++------- opensm/opensm/osm_mcm_info.c | 8 ++++---- opensm/opensm/osm_port.c | 10 +++++----- opensm/opensm/osm_sm.c | 6 +++--- 6 files changed, 29 insertions(+), 31 deletions(-) diff --git a/opensm/include/opensm/osm_mcm_info.h b/opensm/include/opensm/osm_mcm_info.h index dec607f..62ae326 100644 --- a/opensm/include/opensm/osm_mcm_info.h +++ b/opensm/include/opensm/osm_mcm_info.h @@ -47,6 +47,7 @@ #include <iba/ib_types.h> #include <complib/cl_qlist.h> #include <opensm/osm_base.h> +#include <opensm/osm_multicast.h> #ifdef __cplusplus # define BEGIN_C_DECLS extern "C" { @@ -73,15 +74,15 @@ BEGIN_C_DECLS */ typedef struct osm_mcm_info { cl_list_item_t list_item; - ib_net16_t mlid; + osm_mgrp_t *mgrp; } osm_mcm_info_t; /* * FIELDS * list_item * Linkage structure for cl_qlist. MUST BE FIRST MEMBER! * -* mlid -* MLID of this multicast group. +* mgrp +* The pointer to multicast group where this port is member of * * SEE ALSO *********/ @@ -95,11 +96,11 @@ typedef struct osm_mcm_info { * * SYNOPSIS */ -osm_mcm_info_t *osm_mcm_info_new(IN const ib_net16_t mlid); +osm_mcm_info_t *osm_mcm_info_new(IN osm_mgrp_t *mgrp); /* * PARAMETERS -* mlid -* [in] MLID value for this multicast group. +* mgrp +* [in] the pointer to multicast group. * * RETURN VALUES * Pointer to an initialized tree node. diff --git a/opensm/include/opensm/osm_port.h b/opensm/include/opensm/osm_port.h index 7079e74..0e0d3d2 100644 --- a/opensm/include/opensm/osm_port.h +++ b/opensm/include/opensm/osm_port.h @@ -65,6 +65,7 @@ BEGIN_C_DECLS */ struct osm_port; struct osm_node; +struct osm_mgrp; /****h* OpenSM/Physical Port * NAME @@ -1420,14 +1421,14 @@ osm_get_port_by_base_lid(IN const osm_subn_t * const p_subn, * SYNOPSIS */ ib_api_status_t -osm_port_add_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid); +osm_port_add_mgrp(IN osm_port_t * const p_port, IN struct osm_mgrp *mgrp); /* * PARAMETERS * p_port * [in] Pointer to an osm_port_t object. * -* mlid -* [in] MLID of the multicast group. +* mgrp +* [in] Pointer to the multicast group. * * RETURN VALUES * IB_SUCCESS @@ -1449,14 +1450,14 @@ osm_port_add_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid); * SYNOPSIS */ void -osm_port_remove_mgrp(IN osm_port_t * const p_port, IN const ib_net16_t mlid); +osm_port_remove_mgrp(IN osm_port_t * const p_port, IN struct osm_mgrp *mgrp); /* * PARAMETERS * p_port * [in] Pointer to an osm_port_t object. * -* mlid -* [in] MLID of the multicast group. +* mgrp +* [in] Pointer to the multicast group. * * RETURN VALUES * None. diff --git a/opensm/opensm/osm_drop_mgr.c b/opensm/opensm/osm_drop_mgr.c index c9a4f33..4891bb8 100644 --- a/opensm/opensm/osm_drop_mgr.c +++ b/opensm/opensm/osm_drop_mgr.c @@ -158,7 +158,6 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port) osm_port_t *p_port_check; cl_qmap_t *p_sm_guid_tbl; osm_mcm_info_t *p_mcm; - osm_mgrp_t *p_mgrp; cl_ptr_vector_t *p_port_lid_tbl; uint16_t min_lid_ho; uint16_t max_lid_ho; @@ -212,12 +211,9 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port) p_mcm = (osm_mcm_info_t *) cl_qlist_remove_head(&p_port->mcm_list); while (p_mcm != (osm_mcm_info_t *) cl_qlist_end(&p_port->mcm_list)) { - p_mgrp = osm_get_mgrp_by_mlid(sm->p_subn, p_mcm->mlid); - if (p_mgrp) { - osm_mgrp_delete_port(sm->p_subn, sm->p_log, - p_mgrp, p_port->guid); - osm_mcm_info_delete((osm_mcm_info_t *) p_mcm); - } + osm_mgrp_delete_port(sm->p_subn, sm->p_log, p_mcm->mgrp, + p_port->guid); + osm_mcm_info_delete(p_mcm); p_mcm = (osm_mcm_info_t *) cl_qlist_remove_head(&p_port->mcm_list); } diff --git a/opensm/opensm/osm_mcm_info.c b/opensm/opensm/osm_mcm_info.c index 0325a34..c07c70b 100644 --- a/opensm/opensm/osm_mcm_info.c +++ b/opensm/opensm/osm_mcm_info.c @@ -49,17 +49,17 @@ /********************************************************************** **********************************************************************/ -osm_mcm_info_t *osm_mcm_info_new(IN const ib_net16_t mlid) +osm_mcm_info_t *osm_mcm_info_new(IN osm_mgrp_t *mgrp) { osm_mcm_info_t *p_mcm; - p_mcm = (osm_mcm_info_t *) malloc(sizeof(*p_mcm)); + p_mcm = malloc(sizeof(*p_mcm)); if (p_mcm) { memset(p_mcm, 0, sizeof(*p_mcm)); - p_mcm->mlid = mlid; + p_mcm->mgrp = mgrp; } - return (p_mcm); + return p_mcm; } /********************************************************************** diff --git a/opensm/opensm/osm_port.c b/opensm/opensm/osm_port.c index 751c0f0..3470381 100644 --- a/opensm/opensm/osm_port.c +++ b/opensm/opensm/osm_port.c @@ -223,12 +223,12 @@ Found: /********************************************************************** **********************************************************************/ -ib_api_status_t osm_port_add_mgrp(IN osm_port_t * p_port, IN ib_net16_t mlid) +ib_api_status_t osm_port_add_mgrp(IN osm_port_t * p_port, IN osm_mgrp_t *mgrp) { ib_api_status_t status = IB_SUCCESS; osm_mcm_info_t *p_mcm; - p_mcm = osm_mcm_info_new(mlid); + p_mcm = osm_mcm_info_new(mgrp); if (p_mcm) cl_qlist_insert_tail(&p_port->mcm_list, (cl_list_item_t *) p_mcm); @@ -243,7 +243,7 @@ ib_api_status_t osm_port_add_mgrp(IN osm_port_t * p_port, IN ib_net16_t mlid) static cl_status_t port_mgrp_find_func(IN const cl_list_item_t * p_list_item, IN void *context) { - if (*((ib_net16_t *) context) == ((osm_mcm_info_t *) p_list_item)->mlid) + if (context == ((osm_mcm_info_t *) p_list_item)->mgrp) return CL_SUCCESS; else return CL_NOT_FOUND; @@ -251,12 +251,12 @@ static cl_status_t port_mgrp_find_func(IN const cl_list_item_t * p_list_item, /********************************************************************** **********************************************************************/ -void osm_port_remove_mgrp(IN osm_port_t * p_port, IN const ib_net16_t mlid) +void osm_port_remove_mgrp(IN osm_port_t * p_port, IN osm_mgrp_t *mgrp) { cl_list_item_t *p_mcm; p_mcm = cl_qlist_find_from_head(&p_port->mcm_list, port_mgrp_find_func, - &mlid); + mgrp); if (p_mcm != cl_qlist_end(&p_port->mcm_list)) { cl_qlist_remove_item(&p_port->mcm_list, p_mcm); diff --git a/opensm/opensm/osm_sm.c b/opensm/opensm/osm_sm.c index b3ce69a..2794775 100644 --- a/opensm/opensm/osm_sm.c +++ b/opensm/opensm/osm_sm.c @@ -520,7 +520,7 @@ ib_api_status_t osm_sm_mcgrp_join(IN osm_sm_t * p_sm, IN const ib_net16_t mlid, */ p_mcm = (osm_mcm_info_t *) cl_qlist_head(&p_port->mcm_list); while (p_mcm != (osm_mcm_info_t *) cl_qlist_end(&p_port->mcm_list)) { - if (p_mcm->mlid == mlid) { + if (p_mcm->mgrp->mlid == mlid) { OSM_LOG(p_sm->p_log, OSM_LOG_DEBUG, "Found mlid object for Port:" "0x%016" PRIx64 " lid:0x%X\n", @@ -530,7 +530,7 @@ ib_api_status_t osm_sm_mcgrp_join(IN osm_sm_t * p_sm, IN const ib_net16_t mlid, p_mcm = (osm_mcm_info_t *) cl_qlist_next(&p_mcm->list_item); } - status = osm_port_add_mgrp(p_port, mlid); + status = osm_port_add_mgrp(p_port, p_mgrp); if (status != IB_SUCCESS) { OSM_LOG(p_sm->p_log, OSM_LOG_ERROR, "ERR 2E03: " "Unable to associate port 0x%" PRIx64 " to mlid 0x%X\n", @@ -590,7 +590,7 @@ ib_api_status_t osm_sm_mcgrp_leave(IN osm_sm_t * p_sm, IN const ib_net16_t mlid, /* * Walk the list of ports in the group, and remove the appropriate one. */ - osm_port_remove_mgrp(p_port, mlid); + osm_port_remove_mgrp(p_port, p_mgrp); status = sm_mgrp_process(p_sm, p_mgrp); Exit: -- 1.6.4.2 _______________________________________________ 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
