git: caa08ed331da - main - ixgbe: Preserve priority-tagged traffic with SR-IOV

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a753940.3be9f.1dc4de25__25060.6521077984$1786067294$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by kbowling:

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

commit caa08ed331da02a91f95472193e25e573c0ae1e3
Author:     Kevin Bowling <[email protected]>
AuthorDate: 2026-08-06 08:21:16 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-07 01:39:29 +0000

    ixgbe: Preserve priority-tagged traffic with SR-IOV
    
    VID 0 carries only 802.1p priority and does not identify VLAN
    membership. Keep VFTA bit zero in the persistent PF shadow table so
    reset and SR-IOV replay admit priority-tagged frames while VLAN
    filtering is enabled.
    
    In virtualization mode, also reserve VLVF slot zero and restore PF and
    eligible VF pool memberships. A VFTA hit alone admits the tag globally
    but does not deliver it to the correct pools.
    
    This matches the priority-tag treatment in em/igb.
    
    MFC after:      1 week
---
 sys/dev/ixgbe/if_ix.c    | 11 ++++++++++-
 sys/dev/ixgbe/if_sriov.c |  6 ++++--
 sys/dev/ixgbe/ix_txrx.c  |  5 +++--
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index e8aa81df229c..fe9d14fde2f9 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -2396,6 +2396,10 @@ ixgbe_iov_vlan_rebuild(struct ixgbe_softc *sc, bool promisc)
 		vf = &sc->vfs[i];
 		if ((vf->flags & IXGBE_VF_ACTIVE) == 0)
 			continue;
+		if (vf->default_vlan == 0 &&
+		    ixgbe_set_vfta(hw, 0, vf->pool, true, false) !=
+		    IXGBE_SUCCESS)
+			failures++;
 		for (word = 0; word < IXGBE_VFTA_SIZE; word++) {
 			bits = vf->vlans[word];
 			while (bits != 0) {
@@ -2410,6 +2414,8 @@ ixgbe_iov_vlan_rebuild(struct ixgbe_softc *sc, bool promisc)
 			}
 		}
 	}
+	if (ixgbe_set_vfta(hw, 0, sc->pool, true, false) != IXGBE_SUCCESS)
+		failures++;
 
 	/* Add the PF to shared entries, or every entry in promiscuous mode. */
 	for (i = 1; i < IXGBE_VLVF_ENTRIES; i++) {
@@ -2428,7 +2434,7 @@ ixgbe_iov_vlan_rebuild(struct ixgbe_softc *sc, bool promisc)
 		IXGBE_WRITE_REG(hw, IXGBE_VFTA(i), vfta[i]);
 	if (failures != 0)
 		device_printf(sc->dev,
-		    "VF VLAN restore failed for %d memberships\n", failures);
+		    "VLAN pool restore failed for %d memberships\n", failures);
 }
 
 static void
@@ -2481,6 +2487,9 @@ ixgbe_setup_vlan_hw_support(if_ctx_t ctx)
 			ctrl &= ~IXGBE_VLNCTRL_VME;
 	}
 
+	/* Always admit priority-tagged frames. */
+	sc->shadow_vfta[0] |= 1U;
+
 #ifdef PCI_IOV
 	if ((sc->feat_en & IXGBE_FEATURE_SRIOV) != 0) {
 		/*
diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c
index 318e0fe70759..2a5fd6a864ee 100644
--- a/sys/dev/ixgbe/if_sriov.c
+++ b/sys/dev/ixgbe/if_sriov.c
@@ -408,8 +408,10 @@ ixgbe_vf_reset_vlan(struct ixgbe_softc *sc, struct ixgbe_vf *vf,
 	s32 error;
 
 	ixgbe_vf_clear_vlans(sc, vf, clear_hw);
-	error = IXGBE_SUCCESS;
-	if (vf->default_vlan != 0) {
+	if (vf->default_vlan == 0) {
+		/* VLAN 0 membership is implicit and not VF-removable. */
+		error = ixgbe_vf_vlan_hw_update(sc, vf, 0, true);
+	} else {
 		error = ixgbe_vf_vlan_hw_update(sc, vf, vf->default_vlan, true);
 		if (error == IXGBE_SUCCESS)
 			ixgbe_vf_vlan_record(vf, vf->default_vlan, true);
diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c
index c95c3fc903ef..33203f28dd00 100644
--- a/sys/dev/ixgbe/ix_txrx.c
+++ b/sys/dev/ixgbe/ix_txrx.c
@@ -469,9 +469,10 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri)
 		 * A PF-assigned port VLAN is stripped before a VF receives the
 		 * frame, but it is not one of the VLANs registered by the VF.
 		 * Do not expose that administrative tag to the VF's network
-		 * stack.  Locally registered trunk VLANs retain M_VLANTAG.
+		 * stack.  Priority tags and locally registered trunk VLANs retain
+		 * M_VLANTAG.
 		 */
-		if ((sc->feat_en & IXGBE_FEATURE_VF) == 0 ||
+		if ((sc->feat_en & IXGBE_FEATURE_VF) == 0 || vid == 0 ||
 		    (sc->shadow_vfta[vid >> 5] &
 		    (1U << (vid & 0x1f))) != 0) {
 			ri->iri_vtag = vtag;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.