git: 3e286f0ce1e7 - main - bnxt: reset VLAN filter IDs in bnxt_clear_ids()

From: Bojan Novković <bnovkov_at_FreeBSD.org>
Date: Wed, 25 Nov 2026 15:49:51 UTC
The branch main has been updated by bnovkov:

URL: https://cgit.FreeBSD.org/src/commit/?id=3e286f0ce1e7829afe544e355e7358c0851ae6d8

commit 3e286f0ce1e7829afe544e355e7358c0851ae6d8
Author:     Greg Becker <becker.greg@att.net>
AuthorDate: 2026-11-25 15:39:32 +0000
Commit:     Bojan Novković <bnovkov@FreeBSD.org>
CommitDate: 2026-11-25 15:48:32 +0000

    bnxt: reset VLAN filter IDs in bnxt_clear_ids()
    
    bnxt_clear_ids() resets the firmware IDs the driver caches, including
    vnic_info.filter_id, but not the per-VLAN filter IDs added in
    91fcacc35597.  On pre-P5 chips, bnxt_init_hw() and bnxt_stop() free
    the filters in firmware with HWRM_FUNC_RESET and leave tag->filter_id
    set.  Once the VLAN filters have been allocated, the next init (for
    example from ifconfig down/up or an MTU change) fails in
    bnxt_hwrm_set_filter() with "Attempt to re-allocate l2 ctx filter",
    and the port stays down until its VLANs are removed.
    
    Reset tag->filter_id along with vnic_info.filter_id.
    
    Fixes:          91fcacc35597 ("if_bnxt: Add support for VLAN on Thor")
    MFC after:      2 weeks
    Sponsored by:   Klara, Inc.
    Sponsored by:   E-CARD LTD.
    
    Reviewed by:    sef
    Differential Revision:  https://reviews.freebsd.org/D61945
---
 sys/dev/bnxt/bnxt_en/if_bnxt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c
index c0d271a99924..032d3a4368ee 100644
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -5784,6 +5784,7 @@ bnxt_handle_def_cp(void *arg)
 static void
 bnxt_clear_ids(struct bnxt_softc *softc)
 {
+	struct bnxt_vlan_tag *tag;
 	int i;
 
 	softc->def_cp_ring.stats_ctx_id = HWRM_NA_SIGNATURE;
@@ -5811,6 +5812,8 @@ bnxt_clear_ids(struct bnxt_softc *softc)
 	}
 	bnxt_clear_mpc_rings_ids(softc);
 	softc->vnic_info.filter_id = -1;
+	SLIST_FOREACH(tag, &softc->vnic_info.vlan_tags, next)
+		tag->filter_id = -1;
 	softc->vnic_info.id = (uint16_t)HWRM_NA_SIGNATURE;
 	softc->vnic_info.rss_id = (uint16_t)HWRM_NA_SIGNATURE;
 	memset(softc->vnic_info.rss_grp_tbl.idi_vaddr, 0xff,