Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3175737pxb; Mon, 24 Jan 2022 04:15:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJys1rh+D2THLKGECO22TWpGwpkBDJrpJMNL+NmehKx3XTJt2syti+Ivvr7e76XR8zVADAaE X-Received: by 2002:a63:7144:: with SMTP id b4mr11560848pgn.217.1643026513367; Mon, 24 Jan 2022 04:15:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643026513; cv=none; d=google.com; s=arc-20160816; b=kWnS9BlmwrUdwhctrPUe39xNIXosZQtNHpkDRvb7Pfb7OBX8xJFxSvg0Hpe/UaplIY R7+O7decfvXRvYIdJ8L75IQC8GeaVtPRKTy9PB/8kxV5D2sE5KvbYUvWTKbtvaWV3vPN DV7pwT18Jrtt/yjsuaOhQ3WPflSGKSaW7t2qdAeqBQA5YF26TGFdvWXKf7Jg1JWTkmzp 7/u82FKtSy8xVWjp8LtdTfjbI0zSjpKTNMMncDt4E+w+3mRHCnHoCk3SMzkj7w15+AZo 40hBYOIS1oRXriGc8Bm+9X4Bi5ny/oO+5M2Q4KyrNyAxdGDNmg56j5pvUZIhScPlc1aq Wsig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0F414qr4KcwROxp4P4//QuZXhV1PvM+EIvGUM77ZnYw=; b=TGuEXX2BCb4V0IyUClNIaHfh8vB53okj+AVHS4uouzMaRWgfYQ78eQEY/5XUsnL50I fsGngY3+LtxhcVI4vxtbDN3dLqrpf+daMEHrtOB0w0WyiNxQV95iVH3Yt2QtOttGZXSE QR1Z75qDOSSTGhYZGsQIUUTCYbSb9Gw662EDpBnUfiTAFm8oB9460BtSmV21jqfBNOJq Za3FrR2zT1R5mDdyfutPUKhe7Zkq+LC0F3v+LNwjwmBrTa2/u7UHSPJjRAq7tI9T6tCG rZHRWTmK3eehrn4KpJKtHFGoEa0VEErO0xs2shxnrZrzhP4TsDyvvnFVsspuqejrale0 RhTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qPUDOzVr; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si18011523pjq.111.2022.01.24.04.15.01; Mon, 24 Jan 2022 04:15:13 -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=@gmail.com header.s=20210112 header.b=qPUDOzVr; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239817AbiAWSmW (ORCPT + 99 others); Sun, 23 Jan 2022 13:42:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239623AbiAWSl0 (ORCPT ); Sun, 23 Jan 2022 13:41:26 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A17F2C06173D; Sun, 23 Jan 2022 10:41:25 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id x11so7707399plg.6; Sun, 23 Jan 2022 10:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0F414qr4KcwROxp4P4//QuZXhV1PvM+EIvGUM77ZnYw=; b=qPUDOzVrFgRR0ZojdlGaeaiqiXmK1Fu7gnq6Kpjzn0e7w+PMTD2rzLEY8hZ14TTY23 4uLU94junvHCzOpoqV1nqyFTW7bW5WJ8MgQ3l0T7cIVcpjhLRMaQMwidSTAEeMc7wt5B mVdwcYCTxWItcClOk4Zb1ar8U1kfFa/IA6Lr/AXWP3N7L2IA2kJFPnunibOS9tsFcpmc MChfOb+HBpNfCcx0obaVEgTnIWGgoow/wT1sQcndztEU/Zs4BKOT2XPqAkVgErnwmNNG 5eSnp6wZHkDMC25WBNoSmDV9Yy0bcHKDPTZE5N2I/Wy5EjHfW+m/LVbYton0nC1MmJP6 rWwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0F414qr4KcwROxp4P4//QuZXhV1PvM+EIvGUM77ZnYw=; b=UcfbjXFrYEC5VJzBPi2LJeH7qTGq+16AIndxwXz/OkUtXdeBYD6h38tj0Dh3C1TjJi FbkpkfTVrRf4JFUyYG/IbbHTaQHV4UJ93K1Te0gY1MH6M6e1valCZCRZ+fVXwAGCzj/s EG3YTi+ZIxHk0QVOONVho0Cn8Xcfn6a7C7ZsPzB0Wltnp6Msh3XKbadPAX2Z8VHY2Avm q/990nUgjGAbsjjgzWoAY4HyhvVrr1BfqmvS91EEmEXo0B5Uzh8ePkYGvdH6MbgKmni4 uYgUIMgzGuVNWk1PtdUIveqvkNcpnS4uWgpMVMaRSwOtfXkuuVtSw8OjFf8+Yw0Xh1ex Q/kA== X-Gm-Message-State: AOAM531rRSaWpF1ln5BK5pEZL3HzA0AEzM5G40Bu5SgvAN5V9YpNxyHQ SSsxygJ8FUXfcX6+HxWxx9A= X-Received: by 2002:a17:90b:1b0d:: with SMTP id nu13mr7887564pjb.24.1642963285131; Sun, 23 Jan 2022 10:41:25 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id s13sm13234564pfu.0.2022.01.23.10.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:41:24 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , 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, Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Jakub Kicinski , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH 31/54] net: ethernet: replace bitmap_weight with bitmap_weight_eq for intel Date: Sun, 23 Jan 2022 10:39:02 -0800 Message-Id: <20220123183925.1052919-32-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ixgbe_disable_sriov calls 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. Signed-off-by: Yury Norov --- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c index 214a38de3f41..35297d8a488b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c @@ -246,7 +246,7 @@ int ixgbe_disable_sriov(struct ixgbe_adapter *adapter) #endif /* Disable VMDq flag so device will be set in VM mode */ - if (bitmap_weight(adapter->fwd_bitmask, adapter->num_rx_pools) == 1) { + if (bitmap_weight_eq(adapter->fwd_bitmask, adapter->num_rx_pools, 1)) { adapter->flags &= ~IXGBE_FLAG_VMDQ_ENABLED; adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED; rss = min_t(int, ixgbe_max_rss_indices(adapter), -- 2.30.2