From patchwork Thu Oct 29 19:18:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 56503 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 n9TJFf7c002267 for ; Thu, 29 Oct 2009 19:16:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755805AbZJ2TQV (ORCPT ); Thu, 29 Oct 2009 15:16:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756421AbZJ2TQV (ORCPT ); Thu, 29 Oct 2009 15:16:21 -0400 Received: from gv-out-0910.google.com ([216.239.58.185]:15393 "EHLO gv-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755805AbZJ2TQU (ORCPT ); Thu, 29 Oct 2009 15:16:20 -0400 Received: by gv-out-0910.google.com with SMTP id r4so370913gve.37 for ; Thu, 29 Oct 2009 12:16:24 -0700 (PDT) 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=ocbB5BUkkMDXekp8j1JWFjIo5KV++4oCli8ap9wgeW0=; b=U4+WNFBBDJD20md0IX8tqFn4AYk/3fsQUlKs/VR5HXKv+f8uvnaU/vEBrD9B+qcBr8 bJBtvosM7raFSII45riSaCFIb1LX/BBHsh4QtM1zV4lNfz/DZ1xc4J46p74EpSJKTsXE 10CCTt9aScnw4MZTr5oDACaEJ4kSYjWPvdG4Q= 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=liVZJnB58FIGkv4SOnZsjx2hMH/z6pZ4L5P+QiByQaytk00b9Np+X7EWWwW+oAA4PQ T28jaggdLjpng41lRWJ4K/pFXF+Uw5IBWogZaN5TibpHEsHIKam9sIoMpK/rVSp3GKly kktAOUzf9d0psZ8FNBeaIjJhF1w//npWItDMI= Received: by 10.102.245.35 with SMTP id s35mr180826muh.124.1256843784503; Thu, 29 Oct 2009 12:16:24 -0700 (PDT) Received: from me.localdomain (85.64.35.106.dynamic.barak-online.net [85.64.35.106]) by mx.google.com with ESMTPS id u9sm5211685muf.31.2009.10.29.12.16.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 29 Oct 2009 12:16:24 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id 6726011E89; Thu, 29 Oct 2009 21:18:28 +0200 (IST) Date: Thu, 29 Oct 2009 21:18:28 +0200 From: Sasha Khapyorsky To: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Subject: [PATCH] opensm/osm_mcast_mgr: simplify alloc_mfts() Message-ID: <20091029191828.GC20136@me> References: <20091023234856.GA1482@comcast.net> <20091029191732.GB20136@me> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091029191732.GB20136@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_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c index a5e9758..faa0c4b 100644 --- a/opensm/opensm/osm_mcast_mgr.c +++ b/opensm/opensm/osm_mcast_mgr.c @@ -1048,17 +1048,12 @@ static int alloc_mfts(osm_sm_t * sm) int i; cl_map_item_t *item; osm_switch_t *p_sw; - int max_mlid = 0; for (i = sm->p_subn->max_mcast_lid_ho - IB_LID_MCAST_START_HO; i >= 0; - i--) { - if (sm->p_subn->mgroups[i]) { - max_mlid = i + IB_LID_MCAST_START_HO; + i--) + if (sm->p_subn->mgroups[i]) break; - } - } - - if (max_mlid == 0) + if (i < 0) return 0; /* Now, walk switches and (re)allocate multicast tables */ @@ -1066,8 +1061,7 @@ static int alloc_mfts(osm_sm_t * sm) item != cl_qmap_end(&sm->p_subn->sw_guid_tbl); item = cl_qmap_next(item)) { p_sw = (osm_switch_t *)item; - if (osm_mcast_tbl_realloc(&p_sw->mcast_tbl, - max_mlid - IB_LID_MCAST_START_HO)) + if (osm_mcast_tbl_realloc(&p_sw->mcast_tbl, i)) return -1; } return 0;