Skip to content

Commit

Permalink
bnxt_en: Invalidate user filters when needed
Browse files Browse the repository at this point in the history
The cached user filters slated to be reapplied need to
be cleared if configured MAC changes, RSS key changes,
number of rings changes, or ntuple is disabled.

Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20240205223202.25341-13-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Pavan Chebbi authored and Jakub Kicinski committed Feb 9, 2024
1 parent 5de1fce commit 1018319
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4871,6 +4871,17 @@ void bnxt_del_one_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr)
list_del_init(&fltr->list);
}

void bnxt_clear_usr_fltrs(struct bnxt *bp, bool all)
{
struct bnxt_filter_base *usr_fltr, *tmp;

list_for_each_entry_safe(usr_fltr, tmp, &bp->usr_fltr_list, list) {
if (!all && usr_fltr->type == BNXT_FLTR_TYPE_L2)
continue;
bnxt_del_one_usr_fltr(bp, usr_fltr);
}
}

static void bnxt_del_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr)
{
hlist_del(&fltr->hash);
Expand Down Expand Up @@ -12415,6 +12426,8 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features)

if (features & NETIF_F_NTUPLE)
flags |= BNXT_FLAG_RFS;
else
bnxt_clear_usr_fltrs(bp, true);

changes = flags ^ bp->flags;
if (changes & BNXT_FLAG_TPA) {
Expand Down Expand Up @@ -13912,6 +13925,7 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p)
return rc;

eth_hw_addr_set(dev, addr->sa_data);
bnxt_clear_usr_fltrs(bp, true);
if (netif_running(dev)) {
bnxt_close_nic(bp, false, false);
rc = bnxt_open_nic(bp, false, false);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.h
Original file line number Diff line number Diff line change
Expand Up @@ -2655,6 +2655,7 @@ void bnxt_set_ring_params(struct bnxt *);
int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode);
void bnxt_insert_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr);
void bnxt_del_one_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr);
void bnxt_clear_usr_fltrs(struct bnxt *bp, bool all);
int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp, unsigned long *bmap,
int bmap_size, bool async_only);
int bnxt_hwrm_func_drv_unrgtr(struct bnxt *bp);
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@ static int bnxt_set_channels(struct net_device *dev,
return -EINVAL;
}

bnxt_clear_usr_fltrs(bp, true);
if (netif_running(dev)) {
if (BNXT_PF(bp)) {
/* TODO CHIMP_FW: Send message to all VF's
Expand Down Expand Up @@ -1769,7 +1770,7 @@ static int bnxt_set_rxfh(struct net_device *dev,
if (pad)
memset(&bp->rss_indir_tbl[i], 0, pad * sizeof(u16));
}

bnxt_clear_usr_fltrs(bp, false);
if (netif_running(bp->dev)) {
bnxt_close_nic(bp, false, false);
rc = bnxt_open_nic(bp, false, false);
Expand Down

0 comments on commit 1018319

Please sign in to comment.