From nobody Mon Sep 29 19:42:34 2025 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 4cbBRZ4cMPz68kQX; Mon, 29 Sep 2025 19:42:34 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cbBRZ3tJzz3q4Y; Mon, 29 Sep 2025 19:42:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759174954; 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=ifgwRKdMpc94RIJ/fJipiuNq8+jUg6AOMRiwcy7+W68=; b=seTFBg+2Lrj2J1LPIYUtFQhi4kkbjcYHb5DmEzOW/MuH21Ml6bzgr43Xq4Y0WcqUrR190s N77wWTnMt0b8/vcBc17kcoJTEcmjNBt6JFf/3EPT2LYBz/yX8fD9QeuajX9ZdMFBBJuXos IGJuFAfXKo5SB9YMZmQNjSFFn8GybahqIOrF4KYQqIRPnBF9IctGCl+ms4exYHTkNsKCCX W7LLADJWw9TDvUS3cRGMJqhzMt7yIltTFKAuqtPJXf52tiJKnKj8NDbGVhZbntBXwhMWjn ZupSaTgyO7ptpGnzbhDIvVjjhliWH6lTNoZrsrwzZAqcMZtuhS+a1GkN8+B+Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759174954; 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=ifgwRKdMpc94RIJ/fJipiuNq8+jUg6AOMRiwcy7+W68=; b=Au1kxY5ZJnbxpFb5WHCv5lpi+XGbDOjUQFHqU6zDPSc2tQ/YJaCXIS7Er8fEbKXd6Ehvuf mNFak/vDJJ2wFRz7/bv3AzHad6YHgm/1FC0wqjig3fywWqZL28VdwxVQSC2OZfwLNxl9eg Y6s7OwAM3FhTxlcwAdYbTaq4NBj5J8QvYRUr4XXcYTimQQsJCxveDMqzgm+TzDUfJS/x37 //w1v/K4Uup2SQOgavKcBVj8eB0AO/jZ6MSsya3v/77w5LclRRKN6ZYKCfddBiRqM6s/sQ O22mStCnHT8OwD19C32Axb95WW8gGSp5SC/YSFMsMN44QBk6Ul/dWLglVWNCaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759174954; a=rsa-sha256; cv=none; b=KvIY0oJxwYpnZWlI1lV9FyP7uz5KQ4wXFkLu1Jjtous/gMCCJphkhpelIo6g3cK5Qwtvqb g4n31EskabmyH3zfttISNEHgPQzMTDeA4DRXaVS2g8IKkvD2yl31pRTTlclcaOOkzcWsGr vr6TIrX5CsQ2n3pGPb5XIIEyqrNtWl7XP0ijxlhUbzvtGbxSztyNxwTeecKPgFxSAWsjeF fDgi4bRQpLpH5Xn4ZP5FUBwxkGlcW+UKCuxvxqhBA8jz1kOJ1+mkdobMFKBy1/GuPl5StH UDQaGyqj5ctJwloyWJVL/orghs5LCqJEg3izjoNGekkYGN1LGjIYa9G4VLQjYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cbBRZ3QGKz1JQH; Mon, 29 Sep 2025 19:42:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58TJgYlW005789; Mon, 29 Sep 2025 19:42:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58TJgYD2005786; Mon, 29 Sep 2025 19:42:34 GMT (envelope-from git) Date: Mon, 29 Sep 2025 19:42:34 GMT Message-Id: <202509291942.58TJgYD2005786@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: c0598ba49d2c - stable/14 - vtnet: improve interface capability handling 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/14 X-Git-Reftype: branch X-Git-Commit: c0598ba49d2cc785a174e34e687b48298b95f8a0 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=c0598ba49d2cc785a174e34e687b48298b95f8a0 commit c0598ba49d2cc785a174e34e687b48298b95f8a0 Author: Michael Tuexen AuthorDate: 2025-09-26 09:45:12 +0000 Commit: Michael Tuexen CommitDate: 2025-09-29 19:42:07 +0000 vtnet: improve interface capability handling Enable the handling of the IFCAP_RXCSUM_IPV6 handling by handling IFCAP_RXCSUM and IFCAP_RXCSUM_IPV6 as a pair. Also make clear, that software and hardware LRO require receive checksum offload. Reviewed by: Timo Völker Differential Revision: https://reviews.freebsd.org/D52682 (cherry picked from commit eaf619fddcb21859311b895a0836da3171a01531) --- share/man/man4/vtnet.4 | 4 +++- sys/dev/virtio/network/if_vtnet.c | 31 +++++++++++-------------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/share/man/man4/vtnet.4 b/share/man/man4/vtnet.4 index 4a58822e7095..8b96445f0f04 100644 --- a/share/man/man4/vtnet.4 +++ b/share/man/man4/vtnet.4 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 16, 2025 +.Dd September 26, 2025 .Dt VTNET 4 .Os .Sh NAME @@ -54,6 +54,8 @@ TCP segmentation offload (TSO), TCP large receive offload (LRO), hardware VLAN tag stripping/insertion features, a multicast hash filter, as well as Jumbo Frames (up to 9216 bytes), which can be configured via the interface MTU setting. +TCP/UDP receive checksum offload cannot be configured independently for IPv4 +and IPv6. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 949b3ba0e5bb..c2f55bb37054 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -1151,11 +1151,9 @@ vtnet_setup_interface(struct vtnet_softc *sc) } if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) { - if_setcapabilitiesbit(ifp, IFCAP_RXCSUM, 0); -#ifdef notyet /* BMV: Rx checksums not distinguished between IPv4 and IPv6. */ + if_setcapabilitiesbit(ifp, IFCAP_RXCSUM, 0); if_setcapabilitiesbit(ifp, IFCAP_RXCSUM_IPV6, 0); -#endif if (vtnet_tunable_int(sc, "fixup_needs_csum", vtnet_fixup_needs_csum) != 0) @@ -1368,27 +1366,20 @@ vtnet_ioctl_ifcap(struct vtnet_softc *sc, struct ifreq *ifr) if ((mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO)) == IFCAP_LRO && vtnet_software_lro(sc)) reinit = update = 0; - - if (mask & IFCAP_RXCSUM) + /* + * VirtIO does not distinguish between receive checksum offload + * for IPv4 and IPv6 packets, so treat them as a pair. + */ + if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { if_togglecapenable(ifp, IFCAP_RXCSUM); - if (mask & IFCAP_RXCSUM_IPV6) if_togglecapenable(ifp, IFCAP_RXCSUM_IPV6); + } if (mask & IFCAP_LRO) if_togglecapenable(ifp, IFCAP_LRO); - - /* - * VirtIO does not distinguish between IPv4 and IPv6 checksums - * so treat them as a pair. Guest TSO (LRO) requires receive - * checksums. - */ - if (if_getcapenable(ifp) & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { - if_setcapenablebit(ifp, IFCAP_RXCSUM, 0); -#ifdef notyet - if_setcapenablebit(ifp, IFCAP_RXCSUM_IPV6, 0); -#endif - } else - if_setcapenablebit(ifp, 0, - (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO)); + /* Both SW and HW TCP LRO require receive checksum offload. */ + if ((if_getcapenable(ifp) & + (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) == 0) + if_setcapenablebit(ifp, 0, IFCAP_LRO); } if (mask & IFCAP_VLAN_HWFILTER) {