Skip to content

Commit

Permalink
net: systemport: don't use bitmap_weight() in bcm_sysport_rule_set()
Browse files Browse the repository at this point in the history
Don't call bitmap_weight() if the following code can get by
without it.

Signed-off-by: Yury Norov <[email protected]>
Acked-by: Florian Fainelli <[email protected]>
  • Loading branch information
YuryNorov committed May 2, 2022
1 parent e18e5cb commit 1ef1b69
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/net/ethernet/broadcom/bcmsysport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ef1b69

Please sign in to comment.