From patchwork Fri Nov 13 20:11:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 59945 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 nADK9U74027421 for ; Fri, 13 Nov 2009 20:09:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753147AbZKMUJX (ORCPT ); Fri, 13 Nov 2009 15:09:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756929AbZKMUJX (ORCPT ); Fri, 13 Nov 2009 15:09:23 -0500 Received: from mail-fx0-f221.google.com ([209.85.220.221]:56140 "EHLO mail-fx0-f221.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753147AbZKMUJW (ORCPT ); Fri, 13 Nov 2009 15:09:22 -0500 Received: by fxm21 with SMTP id 21so879831fxm.21 for ; Fri, 13 Nov 2009 12:09:27 -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=iAjXBGMA9chRLgxo/doOYV+Td9WEw1Xhs/jwoy0U4iU=; b=tFVCE8oh6HdlT35toVbUYXHlYZdZyii9p8fXM2FP3nyMw0hHWHMClObken9hM5XjKz /0r7Mq3vk2RwgG5G3nHIxgnOc8d1Nf6hbdUj4eM81uAoalF5yYdGy5sojX9vZS+qd89P RcWH8SulmbswRLRcqGcada5KgjdRwvVUB4cq0= 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=Jl4IanTGuO6MZansl07ClNZuWTejOxdho5JhrydHhK38IRaIkKl5n7658jJbLd6w9I WtEXiVuzzp4jT3Fltb1Rh9Cwqf58AvtslWknBJQWjXEJ1WxZz+yl07UUG9B88LUkXwlt y4TPsN4/EIXw9LRwFFRXzNMvzVuFvngujYWDk= Received: by 10.102.249.20 with SMTP id w20mr2154981muh.62.1258142967436; Fri, 13 Nov 2009 12:09:27 -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 n10sm6384740mue.47.2009.11.13.12.09.26 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 13 Nov 2009 12:09:26 -0800 (PST) Received: by me.localdomain (Postfix, from userid 1000) id DBCB21209B; Fri, 13 Nov 2009 22:11:44 +0200 (IST) Date: Fri, 13 Nov 2009 22:11:44 +0200 From: Sasha Khapyorsky To: linux-rdma Cc: Eli Dorfman , Slava Strebkov Subject: [PATCH] osm_sa_mcmember_record.c: pass MCM Record data to mlid allocator Message-ID: <20091113201144.GS7192@me> References: <20091113061948.GJ7192@me> <20091113062104.GK7192@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091113062104.GK7192@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 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) {