From patchwork Thu Oct 29 19:19:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Khapyorsky X-Patchwork-Id: 56505 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 n9TJGkL9002558 for ; Thu, 29 Oct 2009 19:17:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756555AbZJ2TRA (ORCPT ); Thu, 29 Oct 2009 15:17:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756609AbZJ2TRA (ORCPT ); Thu, 29 Oct 2009 15:17:00 -0400 Received: from gv-out-0910.google.com ([216.239.58.188]:31835 "EHLO gv-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756555AbZJ2TQ7 (ORCPT ); Thu, 29 Oct 2009 15:16:59 -0400 Received: by gv-out-0910.google.com with SMTP id r4so371100gve.37 for ; Thu, 29 Oct 2009 12:17:03 -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=xyekxcG/cv37BZ/Bjztb0d1fRGdWjT4h2Ff3JNyHFkY=; b=MrGE+DLEg4Alv0JQ65aN70R5t9NkLA2x5BUFv6zyZtn4CYT2Z3qT2zlF2cJlP2ckVN pHq/JA9BmU72qmus9a0gpJ+JT6ljhY+H7BQ+P24AfW7naNurmRkE8FcHoJJtyusR4pK6 82XdEtCvHJYcQcEIB7GVAOKervkHjCcRIU418= 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=BjcZxr9sf6UTp9VRpOifQqdxeMm1P6Yxtqjxjkdyybw2+fy6P8zpfdwPspPqy24FJl Fe61WA5AvHEswM/xQLBH81b1G5bwZUy6F0rzilMMGfcf0jZk+HvZ3QVZLlRIgVQaQRLm zie9o5ZBFYbZX9R4LEixobWoT3t/RQuPkbg8g= Received: by 10.103.126.7 with SMTP id d7mr187649mun.115.1256843823314; Thu, 29 Oct 2009 12:17:03 -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 n10sm515920mue.17.2009.10.29.12.17.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 29 Oct 2009 12:17:02 -0700 (PDT) Received: by me.localdomain (Postfix, from userid 1000) id BF0DF11E89; Thu, 29 Oct 2009 21:19:06 +0200 (IST) Date: Thu, 29 Oct 2009 21:19:06 +0200 From: Sasha Khapyorsky To: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Subject: [PATCH] opensm/osm_mcast_tbl: remove redundant checks Message-ID: <20091029191906.GD20136@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_tbl.c b/opensm/opensm/osm_mcast_tbl.c index 6cc97b1..b5ae6f2 100644 --- a/opensm/opensm/osm_mcast_tbl.c +++ b/opensm/opensm/osm_mcast_tbl.c @@ -99,11 +99,9 @@ void osm_mcast_tbl_set(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho, uintn_t bit_mask; int16_t block_num; - CL_ASSERT(p_tbl); + CL_ASSERT(p_tbl && p_tbl->p_mask_tbl); CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO); CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho); - CL_ASSERT(mlid_ho - IB_LID_MCAST_START_HO < p_tbl->mft_depth); - CL_ASSERT(p_tbl->p_mask_tbl); mlid_offset = mlid_ho - IB_LID_MCAST_START_HO; mask_offset = port / IB_MCAST_MASK_SIZE; @@ -168,8 +166,6 @@ boolean_t osm_mcast_tbl_is_port(IN const osm_mcast_tbl_t * p_tbl, CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho); mlid_offset = mlid_ho - IB_LID_MCAST_START_HO; - if (mlid_offset >= p_tbl->mft_depth) - return FALSE; mask_offset = port_num / IB_MCAST_MASK_SIZE; bit_mask = cl_ntoh16((uint16_t) (1 << (port_num % IB_MCAST_MASK_SIZE))); @@ -197,8 +193,6 @@ boolean_t osm_mcast_tbl_is_any_port(IN const osm_mcast_tbl_t * p_tbl, CL_ASSERT(mlid_ho <= p_tbl->max_mlid_ho); mlid_offset = mlid_ho - IB_LID_MCAST_START_HO; - if (mlid_offset >= p_tbl->mft_depth) - return FALSE; for (position = 0; position <= p_tbl->max_position; position++) result |= (*p_tbl->p_mask_tbl)[mlid_offset][position]; @@ -250,10 +244,8 @@ void osm_mcast_tbl_clear_mlid(IN osm_mcast_tbl_t * p_tbl, IN uint16_t mlid_ho) CL_ASSERT(p_tbl); CL_ASSERT(mlid_ho >= IB_LID_MCAST_START_HO); - if (p_tbl->p_mask_tbl && (mlid_ho <= p_tbl->max_mlid_ho)) { + if (p_tbl->p_mask_tbl && mlid_ho <= p_tbl->max_mlid_ho) { mlid_offset = mlid_ho - IB_LID_MCAST_START_HO; - if (mlid_offset >= p_tbl->mft_depth) - return; for (i = 0; i <= p_tbl->max_position; i++) (*p_tbl->p_mask_tbl)[mlid_offset][i] = 0; }