From nobody Sun Apr 26 07:46:33 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 4g3Jg24Qsjz6bBNM for ; Sun, 26 Apr 2026 07:46:38 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g3Jg23vqfz40fT for ; Sun, 26 Apr 2026 07:46:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777189598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VQrHjOSAPNz4i6vGxbNiiKhBW2WKrX+6Jq3PmYgm3v4=; b=DXHQrCHYF26tHcDXonEd4cbPU6pZv8+nI4NbtcOqAOhc3BnCXgqVjy3mZhG4Rp15Z1RFAe AVYknVUHZ/kswoFP3DGAsBDTAwLlONOeRAerqmjnWvGDF2C91YJJW3kcFFGN2Z0zWXwZZ1 v/KYWu4T8oRZUtYaOn1NsqYlr/MqTu0GBhOcS9LLPXJ+QD8K4YU1xlioP1yPF76xO+1a5P 4w4Hl4xGIT0c8Dj2CmFkG04jqz9llehkdhJsNB+naDMIETDBgcgkakf1CD4GJmg7zJJ0Ig 7wDWmByTgGsDyBLjdvfFOCzXRmUrFdZ3yKx1z/NHUOhY2ZJjI836yW/7Qas9Gg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777189598; a=rsa-sha256; cv=none; b=LSnrHQ/ykyJ3uwnEmo9qUomIevp4Jw00ZqxoVXziNtyuhT5978OPWqrg4GJJDyOdy2K12l 6TAmqnccEnXl8maCKZ8pKd8U6WHE187E444XoacwUz64jQr//khSNcU0qZTDHQlZpF5M1U YxVLhCR5Ff3/dgF0J6Xb9HyKR3simiUvbyoyCuA7nricDqmlrIx0lIztu8hH47QMg+BRR0 PXHMu1o43QLk8k5EZcPs/pP5k/j+RY9UQJ6XyH2ipV0NpKZG1UeYq4eJ6nfdsQjv3omjiD bkNJEWMYxVFHjHBN9UuwC1QuD7pjh37BVUa0RELvzci8wlOsWlG1FK3BFfmBMw== 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=1777189598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VQrHjOSAPNz4i6vGxbNiiKhBW2WKrX+6Jq3PmYgm3v4=; b=oDHTChT/6f43Kcym3Py7B+5AFkhkcbfVRvo3Qy/zCeqxceqQFL8rKvPU5s6H80fY/4CX+s 2xkKHmy+bnIUlKp7YXdz4Qi5fV+qYbKk/UP89XeH1q0pzBuwF/xg0pZvL8Cp9o4D0u4ti1 NUdZIMUCs+jBMEM+pfZOtJ6EjFgJJhEXr2BeDzhTIqZHHwlKTYnVDgySQuRluyt2KZdZf0 nEq/P1Vfo3nL9+3tpR0dZcFH1Gl9MFcImqqUVNKWUOsWja3lgC++/rs9r2PkF6Jqq1fO27 tUj7sg2tmpUHYCOgGoXq9r4J6iHdoDbQc42Z+bE0Y3rICpyICLAGyrL/kr8GFQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g3Jg23THyz19WY for ; Sun, 26 Apr 2026 07:46:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 254cb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 26 Apr 2026 07:46:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Timo =?utf-8?Q?V=C3=B6lker?= From: Michael Tuexen Subject: git: b10d8b3b9134 - stable/15 - epair: add VLAN_HWTAGGING 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: b10d8b3b9134b97ebf0deb53cff790d9e5e9e3ed Auto-Submitted: auto-generated Date: Sun, 26 Apr 2026 07:46:33 +0000 Message-Id: <69edc2d9.254cb.59c44a85@gitrepo.freebsd.org> The branch stable/15 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b10d8b3b9134b97ebf0deb53cff790d9e5e9e3ed commit b10d8b3b9134b97ebf0deb53cff790d9e5e9e3ed Author: Timo Völker AuthorDate: 2026-01-30 10:54:33 +0000 Commit: Michael Tuexen CommitDate: 2026-04-26 07:45:05 +0000 epair: add VLAN_HWTAGGING Add capability VLAN_HWTAGGING to the epair interface and enable it by default. When sending a packet over a VLAN interface that uses an epair interface, the flag M_VLANTAG and the ether_vtag (which contains the VLAN ID and/or PCP) are set in the mbuf to inform the hardware that the VLAN header has to be added. The sending epair end does not need to actually add a VLAN header. It can just pass the mbuf with this setting to the other epair end, which receives the packet. The receiving epair end can just pass the mbuf with this setting to the upper layer. Due to this setting, the upper layer believes that there was a VLAN header that has been removed by the interface. If the packet later leaves the host, the outgoing physical interface can add the VLAN header in hardware if it supports VLAN_HWTAGGING. If not, the implementation of Ethernet or bridge adds the VLAN header in software. Reviewed by: zlei, tuexen Differential Revision: https://reviews.freebsd.org/D52465 Event: Wiesbaden Hackathon 2026 (cherry picked from commit 574d46b25ab6f42ad97017bb8b72520e9539e36f) --- share/man/man4/epair.4 | 20 +++++++++++++++++++- sys/net/if_epair.c | 28 ++++++++++++++++------------ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/share/man/man4/epair.4 b/share/man/man4/epair.4 index b406c423361b..ba42106d45f8 100644 --- a/share/man/man4/epair.4 +++ b/share/man/man4/epair.4 @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 4, 2025 +.Dd January 30, 2026 .Dt EPAIR 4 .Os .Sh NAME @@ -113,6 +113,7 @@ The .Nm has RXCSUM and RXCSUM6 enabled because it may receive a packet where the checksum has already been validated by a physical interface. +.Pp The .Nm supports TXCSUM and TXCSUM6 for TCP and UDP, but only by forwarding the order @@ -131,6 +132,23 @@ enables/disables it on the other end). In case one end is in a bridge and the bridge disabled TXCSUM or TXCSUM6, this avoids a sender to send packets with checksum offloading into the bridge by using the other end. +.Pp +The +.Nm +supports VLAN_HWTAGGING without actually adding a VLAN tag. +The sending +.Nm +end just forwards the offloading information to the other end. +The receiving +.Nm +end leaves the offloading information set to pretend that there was a VLAN tag +in the Ethernet header, which has been removed already. +To avoid a situation where the receiving +.Nm +end has VLAN_HWTAGGING disabled, this capability is synchronized between the +.Nm +interface pair (i.e., enabling/disabling the capability on one end +enables/disables it on the other end). .Sh SEE ALSO .Xr ioctl 2 , .Xr altq 4 , diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index fbffa8f359a0..60849ca1d4f2 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -150,10 +150,6 @@ epair_clear_mbuf(struct mbuf *m) m->m_pkthdr.csum_flags &= ~CSUM_SND_TAG; } - /* Clear vlan information. */ - m->m_flags &= ~M_VLANTAG; - m->m_pkthdr.ether_vtag = 0; - m_tag_delete_nonpersistent(m); } @@ -493,6 +489,7 @@ epair_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifp->if_capenable = ifr->ifr_reqcap | IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; epair_caps_changed(ifp); + VLAN_CAPABILITIES(ifp); /* * If IFCAP_TXCSUM(_IPV6) has been changed, change it on the * other epair interface as well. @@ -501,17 +498,23 @@ epair_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) * In that case this capability needs to be disabled on the * other epair interface to avoid sending packets in the bridge * that rely on this capability. + * Do the same for IFCAP_VLAN_HWTAGGING. If the sending epair + * end has this capability enabled, the other end has to have + * it enabled too. Otherwise, epair would have to add the VLAN + * tag in the Ethernet header. */ sc = ifp->if_softc; if ((ifp->if_capenable ^ sc->oifp->if_capenable) & - (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) { + (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6 | IFCAP_VLAN_HWTAGGING)) { sc->oifp->if_capenable &= - ~(IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6); + ~(IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6 | + IFCAP_VLAN_HWTAGGING); sc->oifp->if_capenable |= ifp->if_capenable & - (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6); + (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6 | + IFCAP_VLAN_HWTAGGING); epair_caps_changed(sc->oifp); + VLAN_CAPABILITIES(sc->oifp); } - VLAN_CAPABILITIES(ifp); error = 0; break; @@ -626,10 +629,11 @@ epair_setup_ifp(struct epair_softc *sc, char *name, int unit) ifp->if_dname = epairname; ifp->if_dunit = unit; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_TXCSUM | - IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; - ifp->if_capenable = IFCAP_VLAN_MTU | IFCAP_TXCSUM | - IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + ifp->if_capabilities = + IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | + IFCAP_TXCSUM | IFCAP_RXCSUM | + IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6; + ifp->if_capenable = ifp->if_capabilities; epair_caps_changed(ifp); ifp->if_transmit = epair_transmit; ifp->if_qflush = epair_qflush;