From nobody Sun Aug 16 20:47:45 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 4hNShd71gfz6pb0d for ; Sun, 16 Aug 2026 20:47:45 +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 4hNShd3jL9z423B for ; Sun, 16 Aug 2026 20:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786913265; 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=xzoySiYQ+RTDTUkiBX4Spbe4p406UlYyX8LmpsrMux4=; b=tjJIaBhH0eyrKBstQdeOFPp0lKMoQ2caduN/OEKelwiJ35Gpv5nGiJ10S2rcTGZrbQw3PS B0XQW4gy6kximtMaexrEukRGmyFOTFBBa4HCVbFHQdtQEJvgqQnZ8VtfecKkYKNJeidz4R xLzLT9gwYeDE5zQYo7nHCHRPj8zEx5MOGNA9RK48F2fmtOlegd6KAS8BXz5od1RDwR1F/p xAiuywibgUNyYGdPeKOWp9N9pxjpYGgKGo0xjsA/AVgl5G130mBLAhTUgmlqaDkRJT9A53 LGoedKvCnJp7kvdNBO2AwAEbZd7Bx3n2x+lLpD0dI4gX5YcssbGUpO+5TpjSaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786913265; a=rsa-sha256; cv=none; b=haSCGu+ddAH37mv4OFSge1Y/0atDH4ZxoQJVgFc/s1HrezEtrZwYvD43Oxcluh38vG5t19 NcJoxwACG8DMIHtCv3emhLURV+Hr4aHjkUXX/SS7ZIS3m1RXE8l3XPemgBo+g5Paj03Lsm GYs04m6kzmNhwx52pQe1wvysYTYTYPZZxWnib0GKK/poOo1tbKRCyorw7LjfgQTnxFyyVn nm9JXMf9ZzxfgY5b6jebenGtZkmKI8YnN5l7dpxXtmbEh39uKLUrQI9m8ATdeiPEJ3C28h 29kkSSy+BACpoWS6MJNA9r8SXre8ZZyhqrqry9iWaEWVTNz1N45CBv58M1JRxw== 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=1786913265; 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=xzoySiYQ+RTDTUkiBX4Spbe4p406UlYyX8LmpsrMux4=; b=lrzn1Y90EuYAXjaj9hPic9/oEmL1GmoD3llU2JHDTwOD3dJ8OpURc9KgethjjxCmrLmRaQ /GRt8i23ZImZQHBV4w9xSHvuMU8jDwR/Cx5uq7Im20iH5kPIy2oLmpVaJU+aqfKRb6kIf/ eA98Qsaw2j6rx6H/ZPVhdxFIOnrLmHsHIsbUBppOnh6JOG6RmPYlVgiZgiEAQvzaV1qP3D UmlzQsp0fZ02Iwd8qRJOqXJigIXmSJ+UJTUrpwx3yFQLjn9+1YXtgVQG3LBqN7DQ0nwyox YO7AX/RNHjXgzkeN8rDuImEXSXJ4dYL0JT24Ja0dTNshf5bDdKfS0pZTcaRUHw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hNShd2543zkmN for ; Sun, 16 Aug 2026 20:47:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 47dc5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 16 Aug 2026 20:47:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 59bd5fc94c54 - stable/15 - 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/15 X-Git-Reftype: branch X-Git-Commit: 59bd5fc94c54f4f02e515627f556bd97dfa38bcf Auto-Submitted: auto-generated Date: Sun, 16 Aug 2026 20:47:45 +0000 Message-Id: <6a8221f1.47dc5.614fddd0@gitrepo.freebsd.org> The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=59bd5fc94c54f4f02e515627f556bd97dfa38bcf commit 59bd5fc94c54f4f02e515627f556bd97dfa38bcf Author: Kevin Bowling AuthorDate: 2026-07-31 12:34:36 +0000 Commit: Kevin Bowling CommitDate: 2026-08-16 20:44:47 +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))