From patchwork Fri Nov 13 20:40:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 59951 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nADKcS3C032173 for ; Fri, 13 Nov 2009 20:38:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757495AbZKMUiW (ORCPT ); Fri, 13 Nov 2009 15:38:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757498AbZKMUiW (ORCPT ); Fri, 13 Nov 2009 15:38:22 -0500 Received: from ey-out-2122.google.com ([74.125.78.24]:37890 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757495AbZKMUiV (ORCPT ); Fri, 13 Nov 2009 15:38:21 -0500 Received: by ey-out-2122.google.com with SMTP id 9so1058045eyd.19 for ; Fri, 13 Nov 2009 12:38:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=z0OuMR8mZZjJHJues0/6lv9SdeQe+fjix/SSdN5xalY=; b=T/jL00GzRxXN/as29xt+yJZwmv7cI3c/oUM1rt5c5A0iHT+ONS/DmDV2Xi1qmeuDo4 CFBo1U8T+iBLHmzI78r44qvMyXEAUSQMEv1hDQ7JNeFjIa2FK4m3PPVxdkk39tcfbQrx o9vtVS6/uvvuttdSWj0ZoY9dVPi1wbqY6rn98= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=HSfJwhzsmD2tuijmR21SY4xG0F/qm2QzivZczM15snBsc0BaTUZhYRzXyTW745S4eD 90/9B43uK386jQWYQ65S3P0QXkPYYr7LmJnuzI4d2uid5hm40ATUh+ixi/KYSIz4asdC +Lx2TcYpXpim4z7O31CIiXq7cyISWMEKPEd6Y= Received: by 10.213.100.167 with SMTP id y39mr417959ebn.51.1258144705836; Fri, 13 Nov 2009 12:38:25 -0800 (PST) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id 28sm1275679eyg.30.2009.11.13.12.38.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 13 Nov 2009 12:38:25 -0800 (PST) Received: by me.localdomain (Postfix, from userid 1000) id B79151209B; Fri, 13 Nov 2009 22:40:41 +0200 (IST) Date: Fri, 13 Nov 2009 22:40:41 +0200 From: Sasha Khapyorsky To: linux-rdma Cc: Eli Dorfman , Slava Strebkov , Ira Weiny , Hal Rosenstock Subject: [PATCH RFC] opensm: compress IPV6 SNM groups to use a single MLID Message-ID: <20091113204041.GU7192@me> References: <20091113061948.GJ7192@me> <20091113062104.GK7192@me> <20091113201144.GS7192@me> <20091113203856.GT7192@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091113203856.GT7192@me> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org 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;