From: Yury Norov <yury.norov@gmail.com>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"David Laight" <David.Laight@ACULAB.COM>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Joe Perches" <joe@perches.com>,
"Julia Lawall" <Julia.Lawall@inria.fr>,
"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Nicolas Palix" <nicolas.palix@imag.fr>,
"Peter Zijlstra" <peterz@infradead.org>,
"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
"Matti Vaittinen" <Matti.Vaittinen@fi.rohmeurope.com>,
linux-kernel@vger.kernel.org
Cc: Yury Norov <yury.norov@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Geetha sowjanya <gakula@marvell.com>,
Jakub Kicinski <kuba@kernel.org>,
Jerin Jacob <jerinj@marvell.com>,
Linu Cherian <lcherian@marvell.com>,
Paolo Abeni <pabeni@redhat.com>,
Subbaraya Sundeep <sbhatta@marvell.com>,
Sunil Goutham <sgoutham@marvell.com>,
hariprasad <hkelam@marvell.com>,
netdev@vger.kernel.org
Subject: [PATCH 06/22] octeontx2: use bitmap_empty() instead of bitmap_weight()
Date: Tue, 10 May 2022 08:47:34 -0700 [thread overview]
Message-ID: <20220510154750.212913-7-yury.norov@gmail.com> (raw)
In-Reply-To: <20220510154750.212913-1-yury.norov@gmail.com>
bitmap_empty() is better than bitmap_weight() because it may return
earlier, and improves on readability.
CC: David S. Miller <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Geetha sowjanya <gakula@marvell.com>
CC: Jakub Kicinski <kuba@kernel.org>
CC: Jerin Jacob <jerinj@marvell.com>
CC: Linu Cherian <lcherian@marvell.com>
CC: Paolo Abeni <pabeni@redhat.com>
CC: Subbaraya Sundeep <sbhatta@marvell.com>
CC: Sunil Goutham <sgoutham@marvell.com>
CC: hariprasad <hkelam@marvell.com>
CC: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 6 +++---
drivers/net/ethernet/marvell/octeontx2/af/rpm.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index 25491edc35ce..921bf9cb707b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -615,7 +615,7 @@ void cgx_lmac_enadis_rx_pause_fwding(void *cgxd, int lmac_id, bool enable)
return;
/* Pause frames are not enabled just return */
- if (!bitmap_weight(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max))
+ if (bitmap_empty(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max))
return;
cgx_lmac_get_pause_frm_status(cgx, lmac_id, &rx_pause, &tx_pause);
@@ -870,13 +870,13 @@ int verify_lmac_fc_cfg(void *cgxd, int lmac_id, u8 tx_pause, u8 rx_pause,
set_bit(pfvf_idx, lmac->tx_fc_pfvf_bmap.bmap);
/* check if other pfvfs are using flow control */
- if (!rx_pause && bitmap_weight(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) {
+ if (!rx_pause && !bitmap_empty(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) {
dev_warn(&cgx->pdev->dev,
"Receive Flow control disable not permitted as its used by other PFVFs\n");
return -EPERM;
}
- if (!tx_pause && bitmap_weight(lmac->tx_fc_pfvf_bmap.bmap, lmac->tx_fc_pfvf_bmap.max)) {
+ if (!tx_pause && !bitmap_empty(lmac->tx_fc_pfvf_bmap.bmap, lmac->tx_fc_pfvf_bmap.max)) {
dev_warn(&cgx->pdev->dev,
"Transmit Flow control disable not permitted as its used by other PFVFs\n");
return -EPERM;
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
index 47e83d7a5804..f2c866825c81 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rpm.c
@@ -109,7 +109,7 @@ void rpm_lmac_enadis_rx_pause_fwding(void *rpmd, int lmac_id, bool enable)
return;
/* Pause frames are not enabled just return */
- if (!bitmap_weight(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max))
+ if (bitmap_empty(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max))
return;
if (enable) {
--
2.32.0
next prev parent reply other threads:[~2022-05-10 15:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220510154750.212913-1-yury.norov@gmail.com>
2022-05-10 15:47 ` [PATCH 04/22] ice: use bitmap_empty() in ice_vf_has_no_qs_ena() Yury Norov
2022-05-10 15:47 ` Yury Norov [this message]
2022-05-10 21:31 ` [PATCH 06/22] octeontx2: use bitmap_empty() instead of bitmap_weight() Jakub Kicinski
2022-05-10 15:47 ` [PATCH 09/22] qed: replace bitmap_weight() with MANY_BITS() Yury Norov
2022-05-10 15:47 ` [PATCH 10/22] net/mlx5e: simplify mlx5e_set_fecparam() Yury Norov
2022-05-10 15:47 ` [PATCH 15/22] net/mlx5: use cpumask_weight_gt() in irq_pool_request_irq() Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220510154750.212913-7-yury.norov@gmail.com \
--to=yury.norov@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=Julia.Lawall@inria.fr \
--cc=Matti.Vaittinen@fi.rohmeurope.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=gregkh@linuxfoundation.org \
--cc=hkelam@marvell.com \
--cc=jerinj@marvell.com \
--cc=joe@perches.com \
--cc=kuba@kernel.org \
--cc=lcherian@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
--cc=nicolas.palix@imag.fr \
--cc=npiggin@gmail.com \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).