From nobody Sun Aug 16 20:55:17 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hNSsL48Xmz6pbJl for ; Sun, 16 Aug 2026 20:55:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hNSsK55v5z46T6 for ; Sun, 16 Aug 2026 20:55:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786913717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fpBxJhR78OuqQ+LGqgqeTniwsjnGkeC5HtGRl0hgYNA=; b=dz+hCnzuoklYXWw5CX/6PA+YQ1thyclDiFroYi+mZfti6zFPIPN4Jgp/vyUFa9Od2Lexl5 6J2j8mLlg3f3m8QXigVsrYsQ4QAcNnp8GuywaT3lwjQQYR1jOuxzVO7Vo27Yc0MxNdUBSh kZFSzhFIdXxiX1r6lm4rshfFxlVrw+bFdIe/mP9qAI6zpj00mpIrMz5G92l50XRy4sXbGD cIPNNe7tC/Sn1/VEpefImU02iM+7XlUOnfa/7mV6pcg2q7JfoGL/q/9uVKTbOuJg7cRAHC eue++HH9qGSnGQmeqlOD6rFcUthveFrDtx51Qe9oL1M73Pfp06XCKGbQBqWV8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786913717; a=rsa-sha256; cv=none; b=hb6VWpJsfwYu+/JEzlTpladoev3EZSZKgzrSOFUhWXvZzNPy4VbZqgH9V1B/jx2R1amQW7 8EQIBvyChIx+sbD32cnStOGwGRBxPyFgvWhyavD/xdzC5FSjxx6yQjZ8T+DZ7rdoiEqR35 kIDZk1npEbQoOHrFPtvKvcG5/TGO9nBqZy66+eNPeSlJm0cmIQTC0v2S2Lo0KFCnVOkn6j sHTw+6IgvN/qwab2qohYm7z08cPGeGQo6CvJxhJjLjEetAtC6y7jADjv1N/j9cVaqzkNtP tG1gw5xEWX9hN3MZd7yX6Y8l6Sh7bvp7XvHLYk8xIz15CpgCXsCq3X60O93aVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786913717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fpBxJhR78OuqQ+LGqgqeTniwsjnGkeC5HtGRl0hgYNA=; b=ffp52wsfSkvKdftILF7KT4diMVzKYvl38Fuibch03EUxrd66yCkDeuaSVggo46XTFwdIUm o4BEGEGhi3riG4PzHZPFZyD+1Cs1DV5ZFIBZ3vwgySomegoQumOK09fojH4OFPvafogINC YxtSijl86H3YUZhJNu+z5l1WRCfQgYPlwkI1zG/Ljp1CcZaZ+SRhuTeCU6uyfGYG4T/0Ds rAh4/nHpgs+/vwg3aisgBYQgPZJJp/E7EaKLHMnMqejAAI85z0/rfJWcKDBWC5W16DJqvx fVjv1zqz0z45aDHZNTskGogfYf+BIaKCYuznaibk3GGJOFmFcmYfDqCaIC2vuQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hNSsK42NYzkMH for ; Sun, 16 Aug 2026 20:55:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 198da by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 16 Aug 2026 20:55:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: fc2fcb0c437e - stable/14 - ixgbe: enforce configured VF anti-spoofing List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fc2fcb0c437e1da1a459f366d84dfa3007a6782b Auto-Submitted: auto-generated Date: Sun, 16 Aug 2026 20:55:17 +0000 Message-Id: <6a8223b5.198da.65c0a5ff@gitrepo.freebsd.org> The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=fc2fcb0c437e1da1a459f366d84dfa3007a6782b commit fc2fcb0c437e1da1a459f366d84dfa3007a6782b Author: Kevin Bowling AuthorDate: 2026-07-31 12:34:36 +0000 Commit: Kevin Bowling CommitDate: 2026-08-16 20:50:43 +0000 ixgbe: enforce configured VF anti-spoofing The SR-IOV schema advertises MAC anti-spoofing and enables it by default, but the VF configuration was never consumed and the hardware policy remained disabled. Record the configured policy and apply MAC and VLAN anti-spoofing throughout VF initialization and reset. On X550-family devices, also protect the LLDP and flow-control Ethertypes and enable per-VF spoof-event accounting. Remove the driver-owned state during SR-IOV teardown. Adapt the anti-spoof configuration lifecycle used by igb(4) in a2ed165f0049 to the ixgbe hardware controls. Relnotes: yes (cherry picked from commit 7d3d6309398ebeb4d60e35535160c722cd25f9bb) --- sys/dev/ixgbe/if_sriov.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ sys/dev/ixgbe/ixgbe_sriov.h | 1 + 2 files changed, 51 insertions(+) diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index dd67680d9c7d..963f4392b2fd 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -124,6 +124,40 @@ ixgbe_process_vf_ack(struct ixgbe_softc *sc, struct ixgbe_vf *vf) ixgbe_send_vf_failure(sc, vf, 0); } +static void +ixgbe_vf_set_anti_spoof(struct ixgbe_softc *sc, struct ixgbe_vf *vf) +{ + struct ixgbe_hw *hw; + uint32_t reg; + bool enable; + + hw = &sc->hw; + enable = (vf->flags & IXGBE_VF_ANTI_SPOOF) != 0; + if (hw->mac.ops.set_mac_anti_spoofing != NULL) + hw->mac.ops.set_mac_anti_spoofing(hw, enable, vf->pool); + if (hw->mac.ops.set_vlan_anti_spoofing != NULL) + hw->mac.ops.set_vlan_anti_spoofing(hw, enable, vf->pool); + if (hw->mac.ops.set_ethertype_anti_spoofing != NULL) { + if (enable) { + IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_LLDP), + IXGBE_ETQF_FILTER_EN | IXGBE_ETQF_TX_ANTISPOOF | + ETHERTYPE_LLDP); + IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_FC), + IXGBE_ETQF_FILTER_EN | IXGBE_ETQF_TX_ANTISPOOF | + ETHERTYPE_FLOWCONTROL); + } + hw->mac.ops.set_ethertype_anti_spoofing(hw, enable, + vf->pool); + } + + reg = IXGBE_READ_REG(hw, IXGBE_VMECM(IXGBE_VF_INDEX(vf->pool))); + if (enable) + reg |= IXGBE_VF_BIT(vf->pool); + else + reg &= ~IXGBE_VF_BIT(vf->pool); + IXGBE_WRITE_REG(hw, IXGBE_VMECM(IXGBE_VF_INDEX(vf->pool)), reg); +} + static inline boolean_t ixgbe_vf_mac_changed(struct ixgbe_vf *vf, const uint8_t *mac) { @@ -314,6 +348,7 @@ ixgbe_process_vf_reset(struct ixgbe_softc *sc, struct ixgbe_vf *vf) ixgbe_iov_rebuild_mta(sc); ixgbe_clear_rar(&sc->hw, vf->rar_index); + ixgbe_vf_set_anti_spoof(sc, vf); ixgbe_toggle_txdctl(&sc->hw, vf->pool); vf->api_ver = IXGBE_API_VER_UNKNOWN; @@ -741,6 +776,7 @@ ixgbe_if_iov_uninit(if_ctx_t ctx) struct ixgbe_hw *hw; struct ixgbe_softc *sc; uint32_t pf_reg, vf_reg; + int i; sc = iflib_get_softc(ctx); hw = &sc->hw; @@ -757,6 +793,17 @@ ixgbe_if_iov_uninit(if_ctx_t ctx) IXGBE_WRITE_REG(hw, IXGBE_VFRE(vf_reg), 0); IXGBE_WRITE_REG(hw, IXGBE_VFTE(vf_reg), 0); + for (i = 0; i < sc->num_vfs; i++) { + if (!(sc->vfs[i].flags & IXGBE_VF_ACTIVE)) + continue; + sc->vfs[i].flags &= ~IXGBE_VF_ANTI_SPOOF; + ixgbe_vf_set_anti_spoof(sc, &sc->vfs[i]); + } + if (hw->mac.ops.set_ethertype_anti_spoofing != NULL) { + IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_LLDP), 0); + IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_FC), 0); + } + IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, 0); sc->num_vfs = 0; @@ -790,6 +837,7 @@ ixgbe_init_vf(struct ixgbe_softc *sc, struct ixgbe_vf *vf) ixgbe_set_rar(&sc->hw, vf->rar_index, vf->ether_addr, vf->pool, true); } + ixgbe_vf_set_anti_spoof(sc, vf); ixgbe_vf_enable_transmit(sc, vf); ixgbe_vf_enable_receive(sc, vf); @@ -890,6 +938,8 @@ ixgbe_if_iov_vf_add(if_ctx_t ctx, u16 vfnum, const nvlist_t *config) vf->default_vlan = 0; vf->maximum_frame_size = ETHER_MAX_LEN; ixgbe_update_max_frame(sc, vf->maximum_frame_size); + if (nvlist_get_bool(config, "mac-anti-spoof")) + vf->flags |= IXGBE_VF_ANTI_SPOOF; if (nvlist_exists_binary(config, "mac-addr")) { mac = nvlist_get_binary(config, "mac-addr", NULL); diff --git a/sys/dev/ixgbe/ixgbe_sriov.h b/sys/dev/ixgbe/ixgbe_sriov.h index c3a988bda886..bae3f25f7d71 100644 --- a/sys/dev/ixgbe/ixgbe_sriov.h +++ b/sys/dev/ixgbe/ixgbe_sriov.h @@ -47,6 +47,7 @@ #define IXGBE_VF_CAP_MAC (1 << 1) /* VF is permitted to change MAC. */ #define IXGBE_VF_CAP_VLAN (1 << 2) /* VF is permitted to join vlans. */ #define IXGBE_VF_ACTIVE (1 << 3) /* VF is active. */ +#define IXGBE_VF_ANTI_SPOOF (1 << 4) /* Enforce source identity. */ #define IXGBE_VF_INDEX(vmdq) ((vmdq) / 32) #define IXGBE_VF_BIT(vmdq) (1 << ((vmdq) % 32))