Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1842686pxb; Wed, 9 Feb 2022 05:46:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNRzxhdyBYPFfJgBhQn1Xf/+zw6I63mT7WBipyd49HDAuMcrjwXC9iWBhVWDVNuFHEGd0v X-Received: by 2002:a05:6a00:190a:: with SMTP id y10mr2400366pfi.52.1644414410580; Wed, 09 Feb 2022 05:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644414410; cv=none; d=google.com; s=arc-20160816; b=KnmlhZocPiwMBZh8GbWvPydDaxgGyMrn2yMorNJma7Eoqty65K3ihivSrsCkau/6SU Uk8N8S7oaiu+16ssMUBr/HPruChrOJtiNy/qKL0Jm6pyElU/9WIeUMTo4Mvrzu34E1AZ UErH10y7XECDwHbZrVIgImvUxaxaDIT3W4f/8K4nrub1wM2GUfgDbKpIW5h3ZOqR1fKX mbMtA5ZTOxRYNcGWgv+bbaGR5L28zNLCicsM/9NptASKAPy3s4/B2lJwvsisicQ5jKHa BhHgJzy3xGDzHdSN8omWMR1xKHKjvZyQo3wZiA9uVDUS6O83s6Y0BcFGNG/+37YWho+U Ul2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lAqaRsXwc1gC7GE6i8m+gUTSpQepPCDhRGq27De/nR4=; b=Gq11B9DG1V7noqmNjTgWIQOlO9UG1kNZ8qB6/tIxiXt3atDRMtzVp/q6RlAVQN+tDS Ndz843DepiAgmHLZKqwYZPl/bjdRMGN5l0iv24kMXDoMiB+d/xAYzqy928aDt0/wkATa pBpHrP6YQcMqtxHVr3YCqjPnzOSk4tXc1W+KUQ4P2FVOCJEIb/2GDcz36n4jXOd6+SIg Sb1fqdr4al8dUdGrW8DcH86uT2U/JvCXXqDL9oYWACdtmJpJkeW4KbWElVQEejTm0/nX jty+Ow32S9UUMUk2DA+kJ5J2M53Tjj2zV8T51X6r/BtZ9jGIlK9qQCQyPa+mESPs1t9v HnCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=c0XyOtHi; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y19si14268668plr.271.2022.02.09.05.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 05:46:50 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=c0XyOtHi; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A9B71E12F6AB; Wed, 9 Feb 2022 02:27:41 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234774AbiBIGs5 (ORCPT + 99 others); Wed, 9 Feb 2022 01:48:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbiBIGsz (ORCPT ); Wed, 9 Feb 2022 01:48:55 -0500 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19A3EC05CB82; Tue, 8 Feb 2022 22:48:58 -0800 (PST) Received: by mail-qt1-x834.google.com with SMTP id p14so1128562qtx.0; Tue, 08 Feb 2022 22:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lAqaRsXwc1gC7GE6i8m+gUTSpQepPCDhRGq27De/nR4=; b=c0XyOtHiSSfBQbMnR+HRZSb2cSonct9adQm13eUu8KxhJXJPcfkk5TS2By/aaT0O5Y TBSGT1oB9UvByZ7RJVghm5sreKSrRt59pWR1MD5LP8y3LOrfUMzsUreojm3Wr8VK7bXE i37pfRf6y2l+qe7Hb84RSH8SD2JeCOvCmnoDfLQO8bIka23E2uwQP6LiKNQftDuvYTPV Pps5jqP2cEOkSjgxHDqw23XeAyeowtMUm7TyPS4wJJ9NbBg9MOHZORpXxzP7ihYBBvwB nyMvPrw3EO+wyutH3hfqBuHFnmeNZhN4+eV0effOXS4RwKYv2liuTm4G04vd5K+9ZP3j LLfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lAqaRsXwc1gC7GE6i8m+gUTSpQepPCDhRGq27De/nR4=; b=eOxI4gkIRrrG2ywyXfYgQ0VQnquwvWKgXMVQPqjeAPbwIz2DL5EvsNG2uQgRediz+Y Uv8c9KNai5MGWgGT+78HJ97v0wfmDr6kMKgZYllECCjhL4C6gv4g9whvb2JVNXhTUMhU Z9bCUBFHJPuZDxgr/SAI19bGFpwhUbk5iyAF2/IvauaSc9WjFmuwiy7TErZh5x0oY7yp c61f68Rak55RGpfevT6RQVWChweTsQrzTIiuk11GWt+YC98K8274cFvRVe3/8O8IApyo /yVbAQLXMhwk/qRo1wg+TDpoL93vE0ThKqVUHyftoPyjEJ/fWv/KFA/Tg7hXUSy9T/3j TJNw== X-Gm-Message-State: AOAM530E6les5BnzGcBy2+v5HIDddWe8FPbjLLsdwVkMwBrgSf14RdLz Qo3gO6btXFsJj0V/TKVYnqk= X-Received: by 2002:ac8:5a54:: with SMTP id o20mr439830qta.670.1644389337016; Tue, 08 Feb 2022 22:48:57 -0800 (PST) Received: from localhost ([12.28.44.171]) by smtp.gmail.com with ESMTPSA id e9sm9036736qtx.37.2022.02.08.22.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 22:48:56 -0800 (PST) Date: Tue, 8 Feb 2022 22:46:43 -0800 From: Yury Norov To: Andy Shevchenko 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: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 02:48:12PM +0200, Andy Shevchenko wrote: > 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? The port is a parameter of exported function. I'd rather not take this risk. Even if it makes sense, it should be a separate patch anyways.