Skip to content

Commit

Permalink
bnxt_en: Retain user configured filters when closing
Browse files Browse the repository at this point in the history
Driver should not free user created filters from its memory
when closing since we are going to reconfigure them when
we open again.  If the "all" parameter is false, do not free
user configured filters in bnxt_free_ntp_fltrs() and
bnxt_free_l2_filters().

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-10-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 8336a97 commit 2504146
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4883,7 +4883,8 @@ static void bnxt_free_ntp_fltrs(struct bnxt *bp, bool all)
head = &bp->ntp_fltr_hash_tbl[i];
hlist_for_each_entry_safe(fltr, tmp, head, base.hash) {
bnxt_del_l2_filter(bp, fltr->l2_fltr);
if (!all && (fltr->base.flags & BNXT_ACT_FUNC_DST))
if (!all && ((fltr->base.flags & BNXT_ACT_FUNC_DST) ||
!list_empty(&fltr->base.list)))
continue;
bnxt_del_fltr(bp, &fltr->base);
}
Expand Down Expand Up @@ -4926,7 +4927,8 @@ static void bnxt_free_l2_filters(struct bnxt *bp, bool all)

head = &bp->l2_fltr_hash_tbl[i];
hlist_for_each_entry_safe(fltr, tmp, head, base.hash) {
if (!all && (fltr->base.flags & BNXT_ACT_FUNC_DST))
if (!all && ((fltr->base.flags & BNXT_ACT_FUNC_DST) ||
!list_empty(&fltr->base.list)))
continue;
bnxt_del_fltr(bp, &fltr->base);
}
Expand Down Expand Up @@ -5851,7 +5853,8 @@ static void bnxt_hwrm_clear_vnic_filter(struct bnxt *bp)
struct bnxt_l2_filter *fltr = vnic->l2_filters[j];

bnxt_hwrm_l2_filter_free(bp, fltr);
bnxt_del_l2_filter(bp, fltr);
if (list_empty(&fltr->base.list))
bnxt_del_l2_filter(bp, fltr);
}
vnic->uc_filter_count = 0;
}
Expand Down

0 comments on commit 2504146

Please sign in to comment.