From: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
To: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Eli Dorfman <elid-smomgflXvOZWk0Htik3J/w@public.gmane.org>,
Slava Strebkov <slavas-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Subject: [PATCH] opensm/osm_sa_member_record.c: mlid independent MGID generator
Date: Fri, 13 Nov 2009 08:21:04 +0200 [thread overview]
Message-ID: <20091113062104.GK7192@me> (raw)
In-Reply-To: <20091113061948.GJ7192@me>
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
next prev parent reply other threads:[~2009-11-13 6:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091113062104.GK7192@me \
--to=sashak-smomgflxvozwk0htik3j/w@public.gmane.org \
--cc=elid-smomgflXvOZWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=slavas-smomgflXvOZWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox