Skip to content

Commit

Permalink
net: atlantic: Use the bitmap API instead of hand-writing it
Browse files Browse the repository at this point in the history
Simplify code by using bitmap_weight() and bitmap_zero() instead of
hand-writing these functions.

Signed-off-by: Christophe JAILLET <[email protected]>
Reviewed-by: Igor Russkikh <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tititiou36 authored and davem330 committed Jan 24, 2022
1 parent 2afc3b5 commit ebe0582
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/ethernet/aquantia/atlantic/aq_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)
struct aq_hw_s *aq_hw = aq_nic->aq_hw;
int hweight = 0;
int err = 0;
int i;

if (unlikely(!aq_hw_ops->hw_filter_vlan_set))
return -EOPNOTSUPP;
Expand All @@ -837,8 +836,7 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic)
aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans);

if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) {
for (i = 0; i < BITS_TO_LONGS(VLAN_N_VID); i++)
hweight += hweight_long(aq_nic->active_vlans[i]);
hweight = bitmap_weight(aq_nic->active_vlans, VLAN_N_VID);

err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false);
if (err)
Expand Down Expand Up @@ -871,7 +869,7 @@ int aq_filters_vlan_offload_off(struct aq_nic_s *aq_nic)
struct aq_hw_s *aq_hw = aq_nic->aq_hw;
int err = 0;

memset(aq_nic->active_vlans, 0, sizeof(aq_nic->active_vlans));
bitmap_zero(aq_nic->active_vlans, VLAN_N_VID);
aq_fvlan_rebuild(aq_nic, aq_nic->active_vlans,
aq_nic->aq_hw_rx_fltrs.fl2.aq_vlans);

Expand Down

0 comments on commit ebe0582

Please sign in to comment.