* [PATCH] opensm/osm_sa_mcmember_record.c: move mgid allocation code
@ 2009-11-13 6:19 Sasha Khapyorsky
2009-11-13 6:21 ` [PATCH] opensm/osm_sa_member_record.c: mlid independent MGID generator Sasha Khapyorsky
0 siblings, 1 reply; 12+ messages in thread
From: Sasha Khapyorsky @ 2009-11-13 6:19 UTC (permalink / raw)
To: linux-rdma
Move new MGID allocation code into separate function build_new_mgid().
Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
opensm/opensm/osm_sa_mcmember_record.c | 68 +++++++++++++++++++-------------
1 files changed, 40 insertions(+), 28 deletions(-)
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 357e6ab..f6a9ead 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -712,19 +712,45 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,
return TRUE;
}
+static unsigned build_new_mgid(osm_sa_t * sa, ib_net64_t comp_mask,
+ ib_member_rec_t * mcmr)
+{
+ ib_gid_t *mgid = &mcmr->mgid;
+ uint8_t scope;
+
+ /* use the given scope state only if requested! */
+ if (comp_mask & IB_MCR_COMPMASK_SCOPE)
+ ib_member_get_scope_state(mcmr->scope_state, &scope, NULL);
+ else
+ /* to guarantee no collision with other subnets use local scope! */
+ scope = IB_MC_SCOPE_LINK_LOCAL;
+
+ mgid->raw[0] = 0xff;
+ mgid->raw[1] = 0x10 | scope;
+ mgid->raw[2] = 0xa0;
+ mgid->raw[3] = 0x1b;
+
+ /* HACK: use the SA port gid to make it globally unique */
+ memcpy(&mgid->raw[4], &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t));
+
+ /* HACK: how do we get a unique number - use the mlid twice */
+ memcpy(&mgid->raw[10], &mcmr->mlid, sizeof(uint16_t));
+ memcpy(&mgid->raw[12], &mcmr->mlid, sizeof(uint16_t));
+
+ return 1;
+}
+
/**********************************************************************
Call this function to create a new mgrp.
**********************************************************************/
static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
IN ib_net64_t comp_mask,
IN const ib_member_rec_t *
- const p_recvd_mcmember_rec,
+ p_recvd_mcmember_rec,
IN const osm_physp_t * p_physp,
OUT osm_mgrp_t ** pp_mgrp)
{
ib_net16_t mlid;
- uint8_t scope;
- ib_gid_t *p_mgid;
ib_api_status_t status = IB_SUCCESS;
ib_member_rec_t mcm_rec = *p_recvd_mcmember_rec; /* copy for modifications */
@@ -743,37 +769,24 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
goto Exit;
}
- OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
- "Obtained new mlid 0x%X\n", cl_ntoh16(mlid));
+ OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Obtained new mlid 0x%X\n",
+ cl_ntoh16(mlid));
+ mcm_rec.mlid = mlid;
/* we need to create the new MGID if it was not defined */
if (!ib_gid_is_notzero(&p_recvd_mcmember_rec->mgid)) {
/* create a new MGID */
char gid_str[INET6_ADDRSTRLEN];
- /* use the given scope state only if requested! */
- if (comp_mask & IB_MCR_COMPMASK_SCOPE)
- ib_member_get_scope_state(p_recvd_mcmember_rec->
- scope_state, &scope, NULL);
- else
- /* to guarantee no collision with other subnets use local scope! */
- scope = IB_MC_SCOPE_LINK_LOCAL;
-
- p_mgid = &(mcm_rec.mgid);
- p_mgid->raw[0] = 0xFF;
- p_mgid->raw[1] = 0x10 | scope;
- p_mgid->raw[2] = 0xA0;
- p_mgid->raw[3] = 0x1B;
-
- /* HACK: use the SA port gid to make it globally unique */
- memcpy((&p_mgid->raw[4]),
- &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t));
-
- /* HACK: how do we get a unique number - use the mlid twice */
- memcpy(&p_mgid->raw[10], &mlid, sizeof(uint16_t));
- memcpy(&p_mgid->raw[12], &mlid, sizeof(uint16_t));
+ if (!build_new_mgid(sa, comp_mask, &mcm_rec)) {
+ OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B23: "
+ "cannot allocate unique MGID value\n");
+ free_mlid(sa, mlid);
+ status = IB_SA_MAD_STATUS_NO_RESOURCES;
+ goto Exit;
+ }
OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Allocated new MGID:%s\n",
- inet_ntop(AF_INET6, p_mgid->raw, gid_str,
+ inet_ntop(AF_INET6, mcm_rec.mgid.raw, gid_str,
sizeof gid_str));
} else if (!validate_requested_mgid(sa, &mcm_rec)) {
/* a specific MGID was requested so validate the resulting MGID */
@@ -795,7 +808,6 @@ 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(sa->p_subn, mlid, &mcm_rec);
if (*pp_mgrp == NULL) {
OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B08: "
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH] opensm/osm_sa_member_record.c: mlid independent MGID generator
2009-11-13 6:19 [PATCH] opensm/osm_sa_mcmember_record.c: move mgid allocation code Sasha Khapyorsky
@ 2009-11-13 6:21 ` Sasha Khapyorsky
2009-11-13 20:11 ` [PATCH] osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator Sasha Khapyorsky
0 siblings, 1 reply; 12+ messages in thread
From: Sasha Khapyorsky @ 2009-11-13 6:21 UTC (permalink / raw)
To: linux-rdma; +Cc: Eli Dorfman, Slava Strebkov
If we are going to do many MGID to single MLID compression we cannot use
MLID value for unique MGID generation.
Instead use static counter and also add querying for potentially existing
multicast group with same MGID value (with 1000 attempts limit).
Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
opensm/opensm/osm_sa_mcmember_record.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index f6a9ead..c6856fc 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -715,8 +715,10 @@ static boolean_t mgrp_request_is_realizable(IN osm_sa_t * sa,
static unsigned build_new_mgid(osm_sa_t * sa, ib_net64_t comp_mask,
ib_member_rec_t * mcmr)
{
+ static uint32_t uniq_count;
ib_gid_t *mgid = &mcmr->mgid;
uint8_t scope;
+ unsigned i;
/* use the given scope state only if requested! */
if (comp_mask & IB_MCR_COMPMASK_SCOPE)
@@ -733,11 +735,14 @@ static unsigned build_new_mgid(osm_sa_t * sa, ib_net64_t comp_mask,
/* HACK: use the SA port gid to make it globally unique */
memcpy(&mgid->raw[4], &sa->p_subn->opt.subnet_prefix, sizeof(uint64_t));
- /* HACK: how do we get a unique number - use the mlid twice */
- memcpy(&mgid->raw[10], &mcmr->mlid, sizeof(uint16_t));
- memcpy(&mgid->raw[12], &mcmr->mlid, sizeof(uint16_t));
+ for (i = 0; i < 1000; i++) {
+ memcpy(&mgid->raw[10], &uniq_count, 4);
+ uniq_count++;
+ if (!osm_get_mgrp_by_mgid(sa, mgid))
+ return 1;
+ }
- return 1;
+ return 0;
}
/**********************************************************************
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH] osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator
2009-11-13 6:21 ` [PATCH] opensm/osm_sa_member_record.c: mlid independent MGID generator Sasha Khapyorsky
@ 2009-11-13 20:11 ` Sasha Khapyorsky
2009-11-13 20:38 ` [PATCH] complib/cl_fleximap: add cl_fmap_match() function Sasha Khapyorsky
0 siblings, 1 reply; 12+ messages in thread
From: Sasha Khapyorsky @ 2009-11-13 20:11 UTC (permalink / raw)
To: linux-rdma; +Cc: Eli Dorfman, Slava Strebkov
Pass whole MCMember Record request data to get_new_mlid() function.
We need this for MGID compression implementation, so that for mlid
value selection all MCMember join request parameters (including MGID
value) could be used as mgid to mlid mapping trigger (signature checks
or so).
Respectively move mlid allocation call to be after a point where all
MCMember Record fields are already generated (MGID in particular) and
after request validation.
Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
opensm/opensm/osm_sa_mcmember_record.c | 36 +++++++++++++------------------
1 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 85f0ca2..27675b6 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -114,9 +114,10 @@ static void free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
/*********************************************************************
Get a new unused mlid by scanning all the used ones in the subnet.
**********************************************************************/
-static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_net16_t requested_mlid)
+static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_member_rec_t * mcmr)
{
osm_subn_t *p_subn = sa->p_subn;
+ ib_net16_t requested_mlid = mcmr->mlid;
unsigned i, max;
if (requested_mlid && cl_ntoh16(requested_mlid) >= IB_LID_MCAST_START_HO
@@ -761,23 +762,6 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
OSM_LOG_ENTER(sa->p_log);
- /*
- we allocate a new mlid number before we might use it
- for MGID ...
- */
- mlid = get_new_mlid(sa, mcm_rec.mlid);
- if (mlid == 0) {
- OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B19: "
- "get_new_mlid failed request mlid 0x%04x\n",
- cl_ntoh16(mcm_rec.mlid));
- status = IB_SA_MAD_STATUS_NO_RESOURCES;
- goto Exit;
- }
-
- OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Obtained new mlid 0x%X\n",
- cl_ntoh16(mlid));
-
- mcm_rec.mlid = mlid;
/* we need to create the new MGID if it was not defined */
if (!ib_gid_is_notzero(&p_recvd_mcmember_rec->mgid)) {
/* create a new MGID */
@@ -786,7 +770,6 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
if (!build_new_mgid(sa, comp_mask, &mcm_rec)) {
OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B23: "
"cannot allocate unique MGID value\n");
- free_mlid(sa, mlid);
status = IB_SA_MAD_STATUS_NO_RESOURCES;
goto Exit;
}
@@ -797,7 +780,6 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
/* a specific MGID was requested so validate the resulting MGID */
OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B22: "
"Invalid requested MGID\n");
- free_mlid(sa, mlid);
status = IB_SA_MAD_STATUS_REQ_INVALID;
goto Exit;
}
@@ -807,11 +789,23 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
FALSE) {
OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B26: "
"Requested MGRP parameters are not realizable\n");
- free_mlid(sa, mlid);
status = IB_SA_MAD_STATUS_REQ_INVALID;
goto Exit;
}
+ mlid = get_new_mlid(sa, &mcm_rec);
+ if (mlid == 0) {
+ OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B19: "
+ "get_new_mlid failed request mlid 0x%04x\n",
+ cl_ntoh16(mcm_rec.mlid));
+ status = IB_SA_MAD_STATUS_NO_RESOURCES;
+ goto Exit;
+ }
+
+ OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Obtained new mlid 0x%X\n",
+ cl_ntoh16(mlid));
+
+ mcm_rec.mlid = mlid;
/* create a new MC Group */
*pp_mgrp = osm_mgrp_new(sa->p_subn, mlid, &mcm_rec);
if (*pp_mgrp == NULL) {
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH] complib/cl_fleximap: add cl_fmap_match() function
2009-11-13 20:11 ` [PATCH] osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator Sasha Khapyorsky
@ 2009-11-13 20:38 ` Sasha Khapyorsky
2009-11-13 20:40 ` [PATCH RFC] opensm: compress IPV6 SNM groups to use a single MLID Sasha Khapyorsky
2009-11-16 15:30 ` [PATCH] complib/cl_fleximap: add cl_fmap_match() function Hal Rosenstock
0 siblings, 2 replies; 12+ messages in thread
From: Sasha Khapyorsky @ 2009-11-13 20:38 UTC (permalink / raw)
To: linux-rdma; +Cc: Eli Dorfman, Slava Strebkov, Ira Weiny, Hal Rosenstock
Add cl_fmap_match() function - it is similar for cl_fmap_get() (getting
fleximap item by key) with difference that instead of using the map's
default comparison routine custom compare function can be passed there
as a parameter.
This can be useful for matching map item by a key pattern.
Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
This function is used in IPv6 SNM MGID compression patch.
opensm/complib/cl_map.c | 14 ++++++++++--
opensm/complib/libosmcomp.map | 1 +
opensm/include/complib/cl_fleximap.h | 36 ++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/opensm/complib/cl_map.c b/opensm/complib/cl_map.c
index d851bf8..f5fb1f3 100644
--- a/opensm/complib/cl_map.c
+++ b/opensm/complib/cl_map.c
@@ -1144,8 +1144,9 @@ void cl_fmap_init(IN cl_fmap_t * const p_map, IN cl_pfn_fmap_cmp_t pfn_compare)
cl_fmap_remove_all(p_map);
}
-cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
- IN const void *const p_key)
+cl_fmap_item_t *cl_fmap_match(IN const cl_fmap_t * const p_map,
+ IN const void *const p_key,
+ IN cl_pfn_fmap_cmp_t pfn_compare)
{
cl_fmap_item_t *p_item;
int cmp;
@@ -1156,7 +1157,8 @@ cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
p_item = __cl_fmap_root(p_map);
while (p_item != &p_map->nil) {
- cmp = p_map->pfn_compare(p_key, p_item->p_key);
+ cmp = pfn_compare ? pfn_compare(p_key, p_item->p_key) :
+ p_map->pfn_compare(p_key, p_item->p_key);
if (!cmp)
break; /* just right */
@@ -1170,6 +1172,12 @@ cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
return (p_item);
}
+cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
+ IN const void *const p_key)
+{
+ return cl_fmap_match(p_map, p_key, p_map->pfn_compare);
+}
+
cl_fmap_item_t *cl_fmap_get_next(IN const cl_fmap_t * const p_map,
IN const void *const p_key)
{
diff --git a/opensm/complib/libosmcomp.map b/opensm/complib/libosmcomp.map
index 788eb2a..52410cc 100644
--- a/opensm/complib/libosmcomp.map
+++ b/opensm/complib/libosmcomp.map
@@ -66,6 +66,7 @@ OSMCOMP_2.3 {
cl_map_merge;
cl_map_delta;
cl_fmap_init;
+ cl_fmap_match;
cl_fmap_get;
cl_fmap_get_next;
cl_fmap_apply_func;
diff --git a/opensm/include/complib/cl_fleximap.h b/opensm/include/complib/cl_fleximap.h
index ec008cf..b74040f 100644
--- a/opensm/include/complib/cl_fleximap.h
+++ b/opensm/include/complib/cl_fleximap.h
@@ -619,6 +619,42 @@ cl_fmap_item_t *cl_fmap_insert(IN cl_fmap_t * const p_map,
* Flexi Map, cl_fmap_remove, cl_fmap_item_t
*********/
+/****f* Component Library: Flexi Map/cl_fmap_match
+* NAME
+* cl_fmap_get
+*
+* DESCRIPTION
+* The cl_fmap_match function returns the map item matching a key.
+*
+* SYNOPSIS
+*/
+cl_fmap_item_t *cl_fmap_match(IN const cl_fmap_t * const p_map,
+ IN const void *const p_key,
+ IN cl_pfn_fmap_cmp_t pfn_compare);
+/*
+* PARAMETERS
+* p_map
+* [in] Pointer to a cl_fmap_t structure from which to retrieve the
+* item with the specified key.
+*
+* p_key
+* [in] Pointer to a key value used to search for the desired map item.
+*
+* pfn_compare
+* [in] Pointer to a compare function to invoke to compare the
+* keys of items in the map. Passing NULL here makes such call
+* to be equivalent to using cl_fmap_get().
+*
+* RETURN VALUES
+* Pointer to the map item matching the desired key value.
+*
+* Pointer to the map end if there was no item matching the desired key
+* value stored in the flexi map.
+*
+* SEE ALSO
+* Flexi Map, cl_fmap_remove, cl_fmap_get
+*********/
+
/****f* Component Library: Flexi Map/cl_fmap_get
* NAME
* cl_fmap_get
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH RFC] opensm: compress IPV6 SNM groups to use a single MLID
2009-11-13 20:38 ` [PATCH] complib/cl_fleximap: add cl_fmap_match() function Sasha Khapyorsky
@ 2009-11-13 20:40 ` Sasha Khapyorsky
2009-11-16 15:35 ` Hal Rosenstock
2009-11-16 15:30 ` [PATCH] complib/cl_fleximap: add cl_fmap_match() function Hal Rosenstock
1 sibling, 1 reply; 12+ messages in thread
From: Sasha Khapyorsky @ 2009-11-13 20:40 UTC (permalink / raw)
To: linux-rdma; +Cc: Eli Dorfman, Slava Strebkov, Ira Weiny, Hal Rosenstock
This is rework of previously used IPv6 SNM groups compression workaround
using newly proposed "many MGID to single MLID" mapping infrastructure.
Unlike previous solution where all IPv6 Solicited node multicast (SNM)
requests were collapsed into a single multicast group in OpenSM, now
each IPv6 SNM group is represented as a separate multicast group and
all groups sharing same P_Key and scope values use a same MLID value.
The compression method itself should be faster now because MLID sharing
criteria (matching IPv6 SNM MGID signature) is performed only once when
multicast group is created (and not each time when get MC group by MGID
lookup was performed).
This solution should be fully IBA complaint.
As before this feature is switched on by using 'consolidate_ipv6_snm_req'
command line or/and configuration option.
Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
opensm/opensm/osm_sa_mcmember_record.c | 68 ++++++++++++++++++-------------
1 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
index 27675b6..58c5736 100644
--- a/opensm/opensm/osm_sa_mcmember_record.c
+++ b/opensm/opensm/osm_sa_mcmember_record.c
@@ -114,6 +114,35 @@ static void free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
/*********************************************************************
Get a new unused mlid by scanning all the used ones in the subnet.
**********************************************************************/
+/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */
+/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */
+/* Where Z is the scope, XXXX is the P_Key, and
+ * YYYYYY is the last 24 bits of the port guid */
+#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL)
+#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)
+#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL)
+#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL)
+
+static int compare_ipv6_snm_mgids(const void *m1, const void *m2)
+{
+ return memcmp(m1, m2, sizeof(ib_gid_t) - 6);
+}
+
+static ib_net16_t find_ipv6_snm_mlid(osm_subn_t *subn, ib_gid_t *mgid)
+{
+ osm_mgrp_t *m = (osm_mgrp_t *)cl_fmap_match(&subn->mgrp_mgid_tbl, mgid,
+ compare_ipv6_snm_mgids);
+ if (m != (osm_mgrp_t *)cl_fmap_end(&subn->mgrp_mgid_tbl))
+ return m->mlid;
+ return 0;
+}
+
+static unsigned match_ipv6_snm_mgid(ib_gid_t * mgid)
+{
+ return ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE &&
+ (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE);
+}
+
static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_member_rec_t * mcmr)
{
osm_subn_t *p_subn = sa->p_subn;
@@ -125,6 +154,16 @@ static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_member_rec_t * mcmr)
&& !osm_get_mbox_by_mlid(p_subn, requested_mlid))
return requested_mlid;
+ if (sa->p_subn->opt.consolidate_ipv6_snm_req
+ && match_ipv6_snm_mgid(&mcmr->mgid)
+ && (requested_mlid = find_ipv6_snm_mlid(sa->p_subn, &mcmr->mgid))) {
+ char str[INET6_ADDRSTRLEN];
+ OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+ "Special Case Solicited Node Mcast Join for MGID %s\n",
+ inet_ntop(AF_INET6, mcmr->mgid.raw, str, sizeof(str)));
+ 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->mboxes[i])
@@ -829,39 +868,10 @@ Exit:
return status;
}
-#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL)
-#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)
-#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL)
-#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL)
-
-/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */
-/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */
-/* Where Z is the scope, XXXX is the P_Key, and
- * YYYYYY is the last 24 bits of the port guid */
-static unsigned match_and_update_ipv6_snm_mgid(ib_gid_t * mgid)
-{
- if ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE &&
- (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE) {
- mgid->unicast.prefix &= PREFIX_MASK;
- mgid->unicast.interface_id &= INT_ID_MASK;
- return 1;
- }
- return 0;
-}
-
osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t * sa, IN ib_gid_t * p_mgid)
{
osm_mgrp_t *mg;
- if (sa->p_subn->opt.consolidate_ipv6_snm_req &&
- match_and_update_ipv6_snm_mgid(p_mgid)) {
- char gid_str[INET6_ADDRSTRLEN];
- OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
- "Special Case Solicited Node Mcast Join for MGID %s\n",
- inet_ntop(AF_INET6, p_mgid->raw, gid_str,
- sizeof gid_str));
- }
-
mg = (osm_mgrp_t *)cl_fmap_get(&sa->p_subn->mgrp_mgid_tbl, p_mgid);
if (mg != (osm_mgrp_t *)cl_fmap_end(&sa->p_subn->mgrp_mgid_tbl))
return mg;
--
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH RFC] opensm: compress IPV6 SNM groups to use a single MLID
2009-11-13 20:40 ` [PATCH RFC] opensm: compress IPV6 SNM groups to use a single MLID Sasha Khapyorsky
@ 2009-11-16 15:35 ` Hal Rosenstock
[not found] ` <f0e08f230911160735i69ad3671m9a2667900b933e13-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Hal Rosenstock @ 2009-11-16 15:35 UTC (permalink / raw)
To: Sasha Khapyorsky; +Cc: linux-rdma, Eli Dorfman, Slava Strebkov, Ira Weiny
On Fri, Nov 13, 2009 at 3:40 PM, Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org> wrote:
>
> This is rework of previously used IPv6 SNM groups compression workaround
> using newly proposed "many MGID to single MLID" mapping infrastructure.
>
> Unlike previous solution where all IPv6 Solicited node multicast (SNM)
> requests were collapsed into a single multicast group in OpenSM, now
> each IPv6 SNM group is represented as a separate multicast group and
> all groups sharing same P_Key and scope values use a same MLID value.
Shouldn't this also ensure groups sharing MLIDs have the same MTU,
rate, and packet lifetime ?
> The compression method itself should be faster now because MLID sharing
> criteria (matching IPv6 SNM MGID signature) is performed only once when
> multicast group is created (and not each time when get MC group by MGID
> lookup was performed).
>
> This solution should be fully IBA complaint.
Why the should qualification ?
Shouldn't the IBA compliant issues fixed be documented here ?
-- Hal
> As before this feature is switched on by using 'consolidate_ipv6_snm_req'
> command line or/and configuration option.
>
> Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
> ---
> opensm/opensm/osm_sa_mcmember_record.c | 68 ++++++++++++++++++-------------
> 1 files changed, 39 insertions(+), 29 deletions(-)
>
> diff --git a/opensm/opensm/osm_sa_mcmember_record.c b/opensm/opensm/osm_sa_mcmember_record.c
> index 27675b6..58c5736 100644
> --- a/opensm/opensm/osm_sa_mcmember_record.c
> +++ b/opensm/opensm/osm_sa_mcmember_record.c
> @@ -114,6 +114,35 @@ static void free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
> /*********************************************************************
> Get a new unused mlid by scanning all the used ones in the subnet.
> **********************************************************************/
> +/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */
> +/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */
> +/* Where Z is the scope, XXXX is the P_Key, and
> + * YYYYYY is the last 24 bits of the port guid */
> +#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL)
> +#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)
> +#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL)
> +#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL)
> +
> +static int compare_ipv6_snm_mgids(const void *m1, const void *m2)
> +{
> + return memcmp(m1, m2, sizeof(ib_gid_t) - 6);
> +}
> +
> +static ib_net16_t find_ipv6_snm_mlid(osm_subn_t *subn, ib_gid_t *mgid)
> +{
> + osm_mgrp_t *m = (osm_mgrp_t *)cl_fmap_match(&subn->mgrp_mgid_tbl, mgid,
> + compare_ipv6_snm_mgids);
> + if (m != (osm_mgrp_t *)cl_fmap_end(&subn->mgrp_mgid_tbl))
> + return m->mlid;
> + return 0;
> +}
> +
> +static unsigned match_ipv6_snm_mgid(ib_gid_t * mgid)
> +{
> + return ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE &&
> + (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE);
> +}
> +
> static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_member_rec_t * mcmr)
> {
> osm_subn_t *p_subn = sa->p_subn;
> @@ -125,6 +154,16 @@ static ib_net16_t get_new_mlid(osm_sa_t * sa, ib_member_rec_t * mcmr)
> && !osm_get_mbox_by_mlid(p_subn, requested_mlid))
> return requested_mlid;
>
> + if (sa->p_subn->opt.consolidate_ipv6_snm_req
> + && match_ipv6_snm_mgid(&mcmr->mgid)
> + && (requested_mlid = find_ipv6_snm_mlid(sa->p_subn, &mcmr->mgid))) {
> + char str[INET6_ADDRSTRLEN];
> + OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
> + "Special Case Solicited Node Mcast Join for MGID %s\n",
> + inet_ntop(AF_INET6, mcmr->mgid.raw, str, sizeof(str)));
> + 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->mboxes[i])
> @@ -829,39 +868,10 @@ Exit:
> return status;
> }
>
> -#define PREFIX_MASK CL_HTON64(0xff10ffff0000ffffULL)
> -#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)
> -#define INT_ID_MASK CL_HTON64(0xfffffff1ff000000ULL)
> -#define INT_ID_SIGNATURE CL_HTON64(0x00000001ff000000ULL)
> -
> -/* Special Case IPv6 Solicited Node Multicast (SNM) addresses */
> -/* 0xff1Z601bXXXX0000 : 0x00000001ffYYYYYY */
> -/* Where Z is the scope, XXXX is the P_Key, and
> - * YYYYYY is the last 24 bits of the port guid */
> -static unsigned match_and_update_ipv6_snm_mgid(ib_gid_t * mgid)
> -{
> - if ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE &&
> - (mgid->unicast.interface_id & INT_ID_MASK) == INT_ID_SIGNATURE) {
> - mgid->unicast.prefix &= PREFIX_MASK;
> - mgid->unicast.interface_id &= INT_ID_MASK;
> - return 1;
> - }
> - return 0;
> -}
> -
> osm_mgrp_t *osm_get_mgrp_by_mgid(IN osm_sa_t * sa, IN ib_gid_t * p_mgid)
> {
> osm_mgrp_t *mg;
>
> - if (sa->p_subn->opt.consolidate_ipv6_snm_req &&
> - match_and_update_ipv6_snm_mgid(p_mgid)) {
> - char gid_str[INET6_ADDRSTRLEN];
> - OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
> - "Special Case Solicited Node Mcast Join for MGID %s\n",
> - inet_ntop(AF_INET6, p_mgid->raw, gid_str,
> - sizeof gid_str));
> - }
> -
> mg = (osm_mgrp_t *)cl_fmap_get(&sa->p_subn->mgrp_mgid_tbl, p_mgid);
> if (mg != (osm_mgrp_t *)cl_fmap_end(&sa->p_subn->mgrp_mgid_tbl))
> return mg;
> --
> 1.6.5.2
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] complib/cl_fleximap: add cl_fmap_match() function
2009-11-13 20:38 ` [PATCH] complib/cl_fleximap: add cl_fmap_match() function Sasha Khapyorsky
2009-11-13 20:40 ` [PATCH RFC] opensm: compress IPV6 SNM groups to use a single MLID Sasha Khapyorsky
@ 2009-11-16 15:30 ` Hal Rosenstock
1 sibling, 0 replies; 12+ messages in thread
From: Hal Rosenstock @ 2009-11-16 15:30 UTC (permalink / raw)
To: Sasha Khapyorsky; +Cc: linux-rdma, Eli Dorfman, Slava Strebkov, Ira Weiny
On Fri, Nov 13, 2009 at 3:38 PM, Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org> wrote:
>
> Add cl_fmap_match() function - it is similar for cl_fmap_get() (getting
> fleximap item by key) with difference that instead of using the map's
> default comparison routine custom compare function can be passed there
> as a parameter.
>
> This can be useful for matching map item by a key pattern.
>
> Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
> ---
>
> This function is used in IPv6 SNM MGID compression patch.
>
> opensm/complib/cl_map.c | 14 ++++++++++--
> opensm/complib/libosmcomp.map | 1 +
> opensm/include/complib/cl_fleximap.h | 36 ++++++++++++++++++++++++++++++++++
> 3 files changed, 48 insertions(+), 3 deletions(-)
>
> diff --git a/opensm/complib/cl_map.c b/opensm/complib/cl_map.c
> index d851bf8..f5fb1f3 100644
> --- a/opensm/complib/cl_map.c
> +++ b/opensm/complib/cl_map.c
> @@ -1144,8 +1144,9 @@ void cl_fmap_init(IN cl_fmap_t * const p_map, IN cl_pfn_fmap_cmp_t pfn_compare)
> cl_fmap_remove_all(p_map);
> }
>
> -cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
> - IN const void *const p_key)
> +cl_fmap_item_t *cl_fmap_match(IN const cl_fmap_t * const p_map,
> + IN const void *const p_key,
> + IN cl_pfn_fmap_cmp_t pfn_compare)
> {
> cl_fmap_item_t *p_item;
> int cmp;
> @@ -1156,7 +1157,8 @@ cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
> p_item = __cl_fmap_root(p_map);
>
> while (p_item != &p_map->nil) {
> - cmp = p_map->pfn_compare(p_key, p_item->p_key);
> + cmp = pfn_compare ? pfn_compare(p_key, p_item->p_key) :
> + p_map->pfn_compare(p_key, p_item->p_key);
>
> if (!cmp)
> break; /* just right */
> @@ -1170,6 +1172,12 @@ cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
> return (p_item);
> }
>
> +cl_fmap_item_t *cl_fmap_get(IN const cl_fmap_t * const p_map,
> + IN const void *const p_key)
> +{
> + return cl_fmap_match(p_map, p_key, p_map->pfn_compare);
> +}
> +
> cl_fmap_item_t *cl_fmap_get_next(IN const cl_fmap_t * const p_map,
> IN const void *const p_key)
> {
> diff --git a/opensm/complib/libosmcomp.map b/opensm/complib/libosmcomp.map
> index 788eb2a..52410cc 100644
> --- a/opensm/complib/libosmcomp.map
> +++ b/opensm/complib/libosmcomp.map
> @@ -66,6 +66,7 @@ OSMCOMP_2.3 {
> cl_map_merge;
> cl_map_delta;
> cl_fmap_init;
> + cl_fmap_match;
> cl_fmap_get;
> cl_fmap_get_next;
> cl_fmap_apply_func;
> diff --git a/opensm/include/complib/cl_fleximap.h b/opensm/include/complib/cl_fleximap.h
> index ec008cf..b74040f 100644
> --- a/opensm/include/complib/cl_fleximap.h
> +++ b/opensm/include/complib/cl_fleximap.h
> @@ -619,6 +619,42 @@ cl_fmap_item_t *cl_fmap_insert(IN cl_fmap_t * const p_map,
> * Flexi Map, cl_fmap_remove, cl_fmap_item_t
> *********/
>
> +/****f* Component Library: Flexi Map/cl_fmap_match
> +* NAME
> +* cl_fmap_get
typo: cl_fmap_match
> +*
> +* DESCRIPTION
> +* The cl_fmap_match function returns the map item matching a key.
> +*
> +* SYNOPSIS
> +*/
> +cl_fmap_item_t *cl_fmap_match(IN const cl_fmap_t * const p_map,
> + IN const void *const p_key,
> + IN cl_pfn_fmap_cmp_t pfn_compare);
> +/*
> +* PARAMETERS
> +* p_map
> +* [in] Pointer to a cl_fmap_t structure from which to retrieve the
> +* item with the specified key.
> +*
> +* p_key
> +* [in] Pointer to a key value used to search for the desired map item.
> +*
> +* pfn_compare
> +* [in] Pointer to a compare function to invoke to compare the
> +* keys of items in the map. Passing NULL here makes such call
> +* to be equivalent to using cl_fmap_get().
> +*
> +* RETURN VALUES
> +* Pointer to the map item matching the desired key value.
> +*
> +* Pointer to the map end if there was no item matching the desired key
> +* value stored in the flexi map.
> +*
> +* SEE ALSO
> +* Flexi Map, cl_fmap_remove, cl_fmap_get
> +*********/
> +
> /****f* Component Library: Flexi Map/cl_fmap_get
> * NAME
> * cl_fmap_get
> --
> 1.6.5.2
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-12-01 16:00 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13 6:19 [PATCH] opensm/osm_sa_mcmember_record.c: move mgid allocation code Sasha Khapyorsky
2009-11-13 6:21 ` [PATCH] opensm/osm_sa_member_record.c: mlid independent MGID generator Sasha Khapyorsky
2009-11-13 20:11 ` [PATCH] osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator Sasha Khapyorsky
2009-11-13 20:38 ` [PATCH] complib/cl_fleximap: add cl_fmap_match() function Sasha Khapyorsky
2009-11-13 20:40 ` [PATCH RFC] opensm: compress IPV6 SNM groups to use a single MLID Sasha Khapyorsky
2009-11-16 15:35 ` Hal Rosenstock
[not found] ` <f0e08f230911160735i69ad3671m9a2667900b933e13-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-11-26 16:36 ` Sasha Khapyorsky
2009-11-26 16:37 ` [PATCH] opensm: IPv6 SNM update for man page and usage Sasha Khapyorsky
2009-11-30 19:48 ` [PATCH RFC] opensm: compress IPV6 SNM groups to use a single MLID Hal Rosenstock
[not found] ` <f0e08f230911301148t8d573c7lf1f67972b5438b72-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-01 14:58 ` Sasha Khapyorsky
2009-12-01 16:00 ` Hal Rosenstock
2009-11-16 15:30 ` [PATCH] complib/cl_fleximap: add cl_fmap_match() function Hal Rosenstock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox