Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3172942pxb; Mon, 24 Jan 2022 04:11:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuhEoKG4Jv9MNw+ceiFtUuQNVmr9/L18CqJ11Yb5+zZqQTd4udq0PrfaHeVse3nNTS7Zcf X-Received: by 2002:a17:902:c950:b0:14a:59cd:b0bf with SMTP id i16-20020a170902c95000b0014a59cdb0bfmr13940184pla.103.1643026281979; Mon, 24 Jan 2022 04:11:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643026281; cv=none; d=google.com; s=arc-20160816; b=LMv1X4Gjs4RWmG9MMF6Nf56A9QsLrfCYbAEPMPZpVQd988HxoPZLXSY512/qjGT4wQ kBjgVnJVEQpYsZQd1qstJRMDkfZp5XQPNi9nVCvarpOCv3PS2LCwNOo21wCRsxX+5yd8 GrQTUo0fldOhaHY/hPrCLcYQ8UvEt4o+A6tHT+v8f/j1fzc7yHg03C9Btb5gZ8Op5353 owMrntskDtGTn2HhhYxRjuyqdjCVvJEox7lzGYNqky1KBiboGZqQsAOyesu0JQJJi109 emOb2jWrUOyDrtk6m9mCeeMdk7e8lrYTFYyqUKWe+aHkF9TceTZgq6sMWvp9WezacJyT ZN2A== 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=JVlgIOfm3MirYG6wT3KmStCSBcBsfAc0KKMNuO1EDBQ=; b=Z58yk55/j3qkNPKt1b+gCD6T6+b/Ak5ai6FkXkpriRCo3tFbVHusYr9FzmBVhHj2OX enyst76/8mZC6vM7y6Mqs0maZFFmMzle9ZUpxKktZCO965CSp/wCctpskmoFNmX2EGG0 6TTJqA+lp7rZWPxe4dchf4w+pL126S0BfJDFyIrgd6KGKCoNr6QbPLvdfzho72/RSciI WHIOD6nbAqRvFpJwlr1qF8uwNQl8lelm79UIQtPoCNAw1C0wYFvieuFKNXRiZA/BGwuX hdTzqPM8rRBLm4ItH8q2R4wDu2T9s3LtHLNzQZxcg+BJVd5EdvgK7X1IQ/jQxtUcP65K YfkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IRJeAZll; 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 v12si11981146pjn.7.2022.01.24.04.11.09; Mon, 24 Jan 2022 04:11:21 -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=IRJeAZll; 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 S239615AbiAWSkA (ORCPT + 99 others); Sun, 23 Jan 2022 13:40:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239584AbiAWSjz (ORCPT ); Sun, 23 Jan 2022 13:39:55 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58292C06173B; Sun, 23 Jan 2022 10:39:55 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id l16so14124384pjl.4; Sun, 23 Jan 2022 10:39:55 -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=JVlgIOfm3MirYG6wT3KmStCSBcBsfAc0KKMNuO1EDBQ=; b=IRJeAZll5KWb5nZplfSeU6guRB4GiFVlmwRWN5THO4+nOHnkye//P3+ooMx1qU0Idu fFZVRqj/QyGAVXmatp5tgfaYpJXYAtpnjBBxRWu5Wvkmnwsx3g8Tjgh9oQwBR2wPW++P wLdOy3uqaoPu+EyqNkH5kZ+fUz4ohWrcIVJxTC3MCifIpKCWGz1qFS6FNHxpXxFe0PoC AT3uXJOngA4y0EhtxI53KfYaPrJAqJrWOBT1HOtR03NOY7P0vt4kZgHhC2coLJKo7Us3 W80ZyTrpVomG2skPaPmorlVBJwVUANQ70fcVX6xsG5vtQhhZlfbAeqKRjnknAq4cVDJ8 6T7Q== 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=JVlgIOfm3MirYG6wT3KmStCSBcBsfAc0KKMNuO1EDBQ=; b=LY27OMni/Ch9QPMSY9/fawSBd29VXXhViJjf7V5KOlyuU5a5Z0hVdoHGUVlkjOnoiJ 6E2TaawilckyX6XMpXTXUO9qcdgNGpgf/gLelj7ekTSZlP3e3wdCmwilKSMt/PVRwAwI H945s3KkQKZDuNSy2eid0mXDhohxrB5gIMHhs21TW9jLC0zQ1rghGes0NG3p0rlbF45I zOQ7DeKqs5JhhUIkEWAXmXcazyU0syqxqAsYtOirvlIUVxFhKSTY1TFIZw15ETsXk+4+ vqKMOV3v24tbaKbtm5euFuOs9DTbo5O5NgMog3NUWIHZ1F0g6GVQe7NxmHxRn/P/IQHE QXCw== X-Gm-Message-State: AOAM532vCQX9D/SVJ6A5fFxxob4yc7SlO/E4k+uvqZDn0pepd9vdvjN3 HaY7Gs9xANKkLwitvctgqkU= X-Received: by 2002:a17:90b:1e05:: with SMTP id pg5mr9787026pjb.188.1642963194829; Sun, 23 Jan 2022 10:39:54 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id h9sm2038248pfi.54.2022.01.23.10.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:39:54 -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, Florian Fainelli , "David S . Miller " , Jakub Kicinski , bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org Subject: [PATCH 02/54] net/ethernet: don't use bitmap_weight() in bcm_sysport_rule_set() Date: Sun, 23 Jan 2022 10:38:33 -0800 Message-Id: <20220123183925.1052919-3-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 Don't call bitmap_weight() if the following code can get by without it. Signed-off-by: Yury Norov --- drivers/net/ethernet/broadcom/bcmsysport.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 60dde29974bf..5284a5c961db 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -2180,13 +2180,9 @@ static int bcm_sysport_rule_set(struct bcm_sysport_priv *priv, if (nfc->fs.ring_cookie != RX_CLS_FLOW_WAKE) return -EOPNOTSUPP; - /* All filters are already in use, we cannot match more rules */ - if (bitmap_weight(priv->filters, RXCHK_BRCM_TAG_MAX) == - RXCHK_BRCM_TAG_MAX) - return -ENOSPC; - index = find_first_zero_bit(priv->filters, RXCHK_BRCM_TAG_MAX); if (index >= RXCHK_BRCM_TAG_MAX) + /* All filters are already in use, we cannot match more rules */ return -ENOSPC; /* Location is the classification ID, and index is the position -- 2.30.2