[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220510154750.212913-7-yury.norov@gmail.com>
Date: Tue, 10 May 2022 08:47:34 -0700
From: Yury Norov <yury.norov@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
David Laight <David.Laight@...LAB.COM>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Joe Perches <joe@...ches.com>,
Julia Lawall <Julia.Lawall@...ia.fr>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Nicholas Piggin <npiggin@...il.com>,
Nicolas Palix <nicolas.palix@...g.fr>,
Peter Zijlstra <peterz@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Matti Vaittinen <Matti.Vaittinen@...rohmeurope.com>,
linux-kernel@...r.kernel.org
Cc: Yury Norov <yury.norov@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Geetha sowjanya <gakula@...vell.com>,
Jakub Kicinski <kuba@...nel.org>,
Jerin Jacob <jerinj@...vell.com>,
Linu Cherian <lcherian@...vell.com>,
Paolo Abeni <pabeni@...hat.com>,
Subbaraya Sundeep <sbhatta@...vell.com>,
Sunil Goutham <sgoutham@...vell.com>,
hariprasad <hkelam@...vell.com>, netdev@...r.kernel.org
Subject: [PATCH 06/22] octeontx2: use bitmap_empty() instead of bitmap_weight()
bitmap_empty() is better than bitmap_weight() because it may return
earlier, and improves on readability.
CC: David S. Miller <davem@...emloft.net>
CC: Eric Dumazet <edumazet@...gle.com>
CC: Geetha sowjanya <gakula@...vell.com>
CC: Jakub Kicinski <kuba@...nel.org>
CC: Jerin Jacob <jerinj@...vell.com>
CC: Linu Cherian <lcherian@...vell.com>
CC: Paolo Abeni <pabeni@...hat.com>
CC: Subbaraya Sundeep <sbhatta@...vell.com>
CC: Sunil Goutham <sgoutham@...vell.com>
CC: hariprasad <hkelam@...vell.com>
CC: netdev@...r.kernel.org
CC: linux-kernel@...r.kernel.org
Signed-off-by: Yury Norov <yury.norov@...il.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
Powered by blists - more mailing lists