Skip to content

Commit

Permalink
bnxt_en: Restore all the user created L2 and ntuple filters
Browse files Browse the repository at this point in the history
Walk the usr_fltr_list and call firmware to add these filters when
we open the NIC.  This will restore all user created filters after
reset.

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-11-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 2504146 commit 44af4b6
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -5853,8 +5853,7 @@ 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);
if (list_empty(&fltr->base.list))
bnxt_del_l2_filter(bp, fltr);
bnxt_del_l2_filter(bp, fltr);
}
vnic->uc_filter_count = 0;
}
Expand Down Expand Up @@ -11538,6 +11537,42 @@ static int bnxt_reinit_after_abort(struct bnxt *bp)
return rc;
}

static void bnxt_cfg_one_usr_fltr(struct bnxt *bp, struct bnxt_filter_base *fltr)
{
struct bnxt_ntuple_filter *ntp_fltr;
struct bnxt_l2_filter *l2_fltr;

if (list_empty(&fltr->list))
return;

if (fltr->type == BNXT_FLTR_TYPE_NTUPLE) {
ntp_fltr = container_of(fltr, struct bnxt_ntuple_filter, base);
l2_fltr = bp->vnic_info[0].l2_filters[0];
atomic_inc(&l2_fltr->refcnt);
ntp_fltr->l2_fltr = l2_fltr;
if (bnxt_hwrm_cfa_ntuple_filter_alloc(bp, ntp_fltr)) {
bnxt_del_ntp_filter(bp, ntp_fltr);
netdev_err(bp->dev, "restoring previously configured ntuple filter id %d failed\n",
fltr->sw_id);
}
} else if (fltr->type == BNXT_FLTR_TYPE_L2) {
l2_fltr = container_of(fltr, struct bnxt_l2_filter, base);
if (bnxt_hwrm_l2_filter_alloc(bp, l2_fltr)) {
bnxt_del_l2_filter(bp, l2_fltr);
netdev_err(bp->dev, "restoring previously configured l2 filter id %d failed\n",
fltr->sw_id);
}
}
}

static void bnxt_cfg_usr_fltrs(struct bnxt *bp)
{
struct bnxt_filter_base *usr_fltr, *tmp;

list_for_each_entry_safe(usr_fltr, tmp, &bp->usr_fltr_list, list)
bnxt_cfg_one_usr_fltr(bp, usr_fltr);
}

static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
{
int rc = 0;
Expand Down Expand Up @@ -11624,6 +11659,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
bnxt_vf_reps_open(bp);
bnxt_ptp_init_rtc(bp, true);
bnxt_ptp_cfg_tstamp_filters(bp);
bnxt_cfg_usr_fltrs(bp);
return 0;

open_err_irq:
Expand Down

0 comments on commit 44af4b6

Please sign in to comment.