Octeontx2-af: use bitmap_empty() where appropriate
PATCH 1/1 Octeontx2-af: use bitmap_empty() where appropriate
bitmap_empty() is more verbose and efficient, as it stops traversing bitmap as soon as the 1st set bit found.
Switch the driver from bitmap_weight() to bitmap_empty() where appropriate.
--- 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(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +3 -3
@@ -672,7 +672,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);
@@ -970,13 +970,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 ;
drivers/net/ethernet/marvell/octeontx2/af/rpm.c +1 -1
@@ -178,7 +178,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) {
Signature · 1 line
2.43.0
Paolo Abeni
maintainerQuoted 7 lines · Yury Norov (NVIDIA)
bitmap_empty()is more verbose and efficient, as it stops traversing bitmap as soon as the 1st set bit found.Switch the driver from
bitmap_weight()tobitmap_empty()where appropriate.Signed-off-by Yury Norov (NVIDIA) <[email protected]>
## Form letter - net-next-closed
The net-next tree is closed for new drivers, features, code refactoring and optimizations due to the merge window and the winter break. We are currently accepting bug fixes only.
Please repost when net-next reopens after Jan 2nd.
RFC patches sent for review only are obviously welcome at any time.