mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
bnxt_en: Add separate function to delete the filter structure
Since we are going to do filter deletion at multiple places in the upcoming patches, add a function that does the deletion. Future patches add more code into this function. Since we are passing the address of the filter base to free the entire filter structure, add a comment to make sure that the base is always at the beginning of the structure. 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-8-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
7efd79c0e6
commit
be40b4e9ca
@@ -4841,6 +4841,16 @@ static void bnxt_clear_ring_indices(struct bnxt *bp)
|
||||
}
|
||||
}
|
||||
|
||||
static void bnxt_del_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr)
|
||||
{
|
||||
hlist_del(&fltr->hash);
|
||||
if (fltr->flags) {
|
||||
clear_bit(fltr->sw_id, bp->ntp_fltr_bmap);
|
||||
bp->ntp_fltr_count--;
|
||||
}
|
||||
kfree(fltr);
|
||||
}
|
||||
|
||||
static void bnxt_free_ntp_fltrs(struct bnxt *bp, bool all)
|
||||
{
|
||||
int i;
|
||||
@@ -4858,10 +4868,7 @@ static void bnxt_free_ntp_fltrs(struct bnxt *bp, bool all)
|
||||
bnxt_del_l2_filter(bp, fltr->l2_fltr);
|
||||
if (!all && (fltr->base.flags & BNXT_ACT_FUNC_DST))
|
||||
continue;
|
||||
hlist_del(&fltr->base.hash);
|
||||
clear_bit(fltr->base.sw_id, bp->ntp_fltr_bmap);
|
||||
bp->ntp_fltr_count--;
|
||||
kfree(fltr);
|
||||
bnxt_del_fltr(bp, &fltr->base);
|
||||
}
|
||||
}
|
||||
if (!all)
|
||||
@@ -4904,12 +4911,7 @@ static void bnxt_free_l2_filters(struct bnxt *bp, bool all)
|
||||
hlist_for_each_entry_safe(fltr, tmp, head, base.hash) {
|
||||
if (!all && (fltr->base.flags & BNXT_ACT_FUNC_DST))
|
||||
continue;
|
||||
hlist_del(&fltr->base.hash);
|
||||
if (fltr->base.flags) {
|
||||
clear_bit(fltr->base.sw_id, bp->ntp_fltr_bmap);
|
||||
bp->ntp_fltr_count--;
|
||||
}
|
||||
kfree(fltr);
|
||||
bnxt_del_fltr(bp, &fltr->base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1365,6 +1365,7 @@ extern const struct bnxt_flow_masks BNXT_FLOW_IPV6_MASK_ALL;
|
||||
extern const struct bnxt_flow_masks BNXT_FLOW_IPV4_MASK_ALL;
|
||||
|
||||
struct bnxt_ntuple_filter {
|
||||
/* base filter must be the first member */
|
||||
struct bnxt_filter_base base;
|
||||
struct flow_keys fkeys;
|
||||
struct bnxt_flow_masks fmasks;
|
||||
@@ -1395,6 +1396,7 @@ struct bnxt_ipv6_tuple {
|
||||
#define BNXT_L2_KEY_SIZE (sizeof(struct bnxt_l2_key) / 4)
|
||||
|
||||
struct bnxt_l2_filter {
|
||||
/* base filter must be the first member */
|
||||
struct bnxt_filter_base base;
|
||||
struct bnxt_l2_key l2_key;
|
||||
atomic_t refcnt;
|
||||
|
||||
Reference in New Issue
Block a user