Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3518141pxb; Mon, 24 Jan 2022 11:14:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyw6wiUAWt2ktazx/TS1yfAqAPv+YswPyBWsoGbOWuOYfsdfQW7TariBom/kg9W20M48ASP X-Received: by 2002:a63:8f02:: with SMTP id n2mr13194948pgd.270.1643051646556; Mon, 24 Jan 2022 11:14:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643051646; cv=none; d=google.com; s=arc-20160816; b=iGd+qrhNv1NIBoblje4Nh3HFwfZz2aqlFbxmGQx0c2jSit1NfDPyCa6viicHFw13dS 7ZH5QxY6+mIcaXQx/tTqBnEufN4pp62U43kpJQQ9cyqh+Qv36s/0EatltU8Nks0XFwGp due/h3l47jz4V4bS5f1iWcBBYGgJnrGiWOEw0zVe4QStrrNsIv7YcAutkMiSOSONIumz XWn2q7CUTWHQk44S1mYB3iPOsXsBu/hh1GjEeIE2NcvFonfDZrnI4R+G+//xLez4CS3n EwHqymSkh+k1qTMtelfcpmZZSDzI0nqbIx2MduyRirXrEMwVnqBNyinMSnflg7H5AwPU MzCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=68iMF//OPyxWVvXy26CvRdBlAkVKdC5+FyU44THLkiI=; b=k73C0qQLgfa9bnJgoV/9pmC4jIyJrPa629kpa7qF8/qe9dZqxhXGpdnxJG51Ervw/E T7rY2hZZL45v0gMg8qYqpRAAvqDL1VkBqVUBrc9RmYSzEvtcIsX8m9duo7QB6TodDyt6 9v2q4ubSiv7MLNc696DL4uZ8XlTyyJlgdtLUhoTUtnQGVII06jAKlD3Z0bDekDjN8NH7 que85kxBqbWCIFRRjEa+skCY1bz6TshhpmJOftwqHDho44UAUddBwvrXXjcp6AiFQwHN AdVFCfVgJE/E2yJd7ZzUAS0fkVVDw5/7sn/j3c4m+OvxmRE7Z9oK7m6Ymvfy6hj7eR4Q Oxsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cWRe5CYL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x13si12797520pln.528.2022.01.24.11.13.54; Mon, 24 Jan 2022 11:14:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cWRe5CYL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241952AbiAXMt2 (ORCPT + 99 others); Mon, 24 Jan 2022 07:49:28 -0500 Received: from mga09.intel.com ([134.134.136.24]:14200 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242536AbiAXMt0 (ORCPT ); Mon, 24 Jan 2022 07:49:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643028566; x=1674564566; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=t5fxNB8z6pSku/t+EGOjDH0q4PUVYX8rnOSgZH4UVPU=; b=cWRe5CYLXk0Rjhw1QyNYaByNN2ZcxstHXPM2v1XhJpdC+xaJuT9Ny+LW E/H7/XMvhSwLb/fqijlU9dtDWbaW3xYESL+/VuMtrhCNVjHyDJNoesDWb KkW/fZ2MDLYIwXxIFIsZHER46ol+a0pwFXKa7X+gxH+gatQWRqDniEYrJ 1nN/+0Df6KfSR1DgGT0qhDVXTGE22OlFJnaADXze46ZXdzxVXjib5A4PF 116rwem/RKM/gRcm4odPp4qpp/paQ0AY+nqneAa4oZ6hUJUZuIRF/3aLr uJ0oThggWnu87MTG7EOMR4odQ/bJ7VZqwhh79S8tF1OuocgZ/QVTTyb8W A==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="245817550" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="245817550" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 04:49:26 -0800 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="494607640" Received: from smile.fi.intel.com ([10.237.72.61]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 04:49:21 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nBylZ-00DtIl-85; Mon, 24 Jan 2022 14:48:13 +0200 Date: Mon, 24 Jan 2022 14:48:12 +0200 From: Andy Shevchenko To: Yury Norov Cc: Rasmus Villemoes , Andrew Morton , =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Subject: Re: [PATCH 33/54] net: ethernet: replace bitmap_weight with bitmap_weight_{eq,gt,ge,lt,le} for mellanox Message-ID: References: <20220123183925.1052919-1-yury.norov@gmail.com> <20220123183925.1052919-34-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220123183925.1052919-34-yury.norov@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 23, 2022 at 10:39:04AM -0800, Yury Norov wrote: > Mellanox code uses bitmap_weight() to compare the weight of bitmap with > a given number. We can do it more efficiently with bitmap_weight_{eq, ...} > because conditional bitmap_weight may stop traversing the bitmap earlier, > as soon as condition is met. > - if (port <= 0 || port > m) > + if (port <= 0 || bitmap_weight_lt(actv_ports.ports, dev->caps.num_ports, port)) > return -EINVAL; Can we eliminate now the port <= 0 check? Or at least make it port == 0? -- With Best Regards, Andy Shevchenko