From patchwork Fri Nov 13 06:21:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 59726 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 nAD6HJvY002313 for ; Fri, 13 Nov 2009 06:18:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751765AbZKMGSn (ORCPT ); Fri, 13 Nov 2009 01:18:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752238AbZKMGSn (ORCPT ); Fri, 13 Nov 2009 01:18:43 -0500 Received: from ey-out-2122.google.com ([74.125.78.26]:36538 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751765AbZKMGSm (ORCPT ); Fri, 13 Nov 2009 01:18:42 -0500 Received: by ey-out-2122.google.com with SMTP id 9so829937eyd.19 for ; Thu, 12 Nov 2009 22:18:47 -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=6RiDaiik1b4vZuwcLQp4t1DHBF8zy4riN2sxfa8nSmY=; b=RsI4iEVGaorAUxbDrFKflgXQ0OGWIldSSPNr6FqB718PfzH/p1l37NDZ+8nLefWKEB zxrccDSGWHus9NDq5Phq9JYOnay7IjSxNSPDPF9HpEfCAyAnTgsBY8eOkR1Zplo3qGMO x6/9hWAo+TkmghT1+fF9WnqcxGZLMUtbYMU4M= 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=K/cvgR/9if5Ya5xCL4NI5Kg3U7djEryBIUiCalbY19he3GE7GRYws+BNh+9zspMPRA k6jD5wQQCuKCQoIZwj9rr4g0kjNNJy4efKWyy7z37vO00wCZo/GB8yTA5X+tBPrK4ReK uzWHqfAMP27VLxwlkI2WMUMVJWitZtmqyfFeI= Received: by 10.213.0.216 with SMTP id 24mr2891536ebc.55.1258093127644; Thu, 12 Nov 2009 22:18:47 -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 5sm402326eyh.18.2009.11.12.22.18.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 12 Nov 2009 22:18:47 -0800 (PST) Received: by me.localdomain (Postfix, from userid 1000) id 3EE3C1209B; Fri, 13 Nov 2009 08:21:04 +0200 (IST) Date: Fri, 13 Nov 2009 08:21:04 +0200 From: Sasha Khapyorsky To: linux-rdma Cc: Eli Dorfman , Slava Strebkov Subject: [PATCH] opensm/osm_sa_member_record.c: mlid independent MGID generator Message-ID: <20091113062104.GK7192@me> References: <20091113061948.GJ7192@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091113061948.GJ7192@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 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; } /**********************************************************************