Commit 1018319f authored by Pavan Chebbi's avatar Pavan Chebbi Committed by Jakub Kicinski

bnxt_en: Invalidate user filters when needed

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: default avatarAndy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20240205223202.25341-13-michael.chan@broadcom.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5de1fce3
...@@ -4871,6 +4871,17 @@ void bnxt_del_one_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr) ...@@ -4871,6 +4871,17 @@ void bnxt_del_one_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr)
list_del_init(&fltr->list); 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) static void bnxt_del_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr)
{ {
hlist_del(&fltr->hash); hlist_del(&fltr->hash);
...@@ -12415,6 +12426,8 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features) ...@@ -12415,6 +12426,8 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features)
if (features & NETIF_F_NTUPLE) if (features & NETIF_F_NTUPLE)
flags |= BNXT_FLAG_RFS; flags |= BNXT_FLAG_RFS;
else
bnxt_clear_usr_fltrs(bp, true);
changes = flags ^ bp->flags; changes = flags ^ bp->flags;
if (changes & BNXT_FLAG_TPA) { if (changes & BNXT_FLAG_TPA) {
...@@ -13912,6 +13925,7 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p) ...@@ -13912,6 +13925,7 @@ static int bnxt_change_mac_addr(struct net_device *dev, void *p)
return rc; return rc;
eth_hw_addr_set(dev, addr->sa_data); eth_hw_addr_set(dev, addr->sa_data);
bnxt_clear_usr_fltrs(bp, true);
if (netif_running(dev)) { if (netif_running(dev)) {
bnxt_close_nic(bp, false, false); bnxt_close_nic(bp, false, false);
rc = bnxt_open_nic(bp, false, false); rc = bnxt_open_nic(bp, false, false);
......
...@@ -2655,6 +2655,7 @@ void bnxt_set_ring_params(struct bnxt *); ...@@ -2655,6 +2655,7 @@ void bnxt_set_ring_params(struct bnxt *);
int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode); 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_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_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 bnxt_hwrm_func_drv_rgtr(struct bnxt *bp, unsigned long *bmap,
int bmap_size, bool async_only); int bmap_size, bool async_only);
int bnxt_hwrm_func_drv_unrgtr(struct bnxt *bp); int bnxt_hwrm_func_drv_unrgtr(struct bnxt *bp);
......
...@@ -968,6 +968,7 @@ static int bnxt_set_channels(struct net_device *dev, ...@@ -968,6 +968,7 @@ static int bnxt_set_channels(struct net_device *dev,
return -EINVAL; return -EINVAL;
} }
bnxt_clear_usr_fltrs(bp, true);
if (netif_running(dev)) { if (netif_running(dev)) {
if (BNXT_PF(bp)) { if (BNXT_PF(bp)) {
/* TODO CHIMP_FW: Send message to all VF's /* TODO CHIMP_FW: Send message to all VF's
...@@ -1769,7 +1770,7 @@ static int bnxt_set_rxfh(struct net_device *dev, ...@@ -1769,7 +1770,7 @@ static int bnxt_set_rxfh(struct net_device *dev,
if (pad) if (pad)
memset(&bp->rss_indir_tbl[i], 0, pad * sizeof(u16)); memset(&bp->rss_indir_tbl[i], 0, pad * sizeof(u16));
} }
bnxt_clear_usr_fltrs(bp, false);
if (netif_running(bp->dev)) { if (netif_running(bp->dev)) {
bnxt_close_nic(bp, false, false); bnxt_close_nic(bp, false, false);
rc = bnxt_open_nic(bp, false, false); rc = bnxt_open_nic(bp, false, false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment