From nobody Fri Sep 26 10:35:57 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 4cY6SF5bWqz686NM; Fri, 26 Sep 2025 10:35:57 +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 4cY6SF4v04z3K4g; Fri, 26 Sep 2025 10:35:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758882957; 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=eZhYdd8LVVsbjuPDQReywqecn4cqxCWWIxea+KO6mn0=; b=TC5Zq0pHwBrhNaNwEs9BTOyHIPf3hYsvkDIL+Tqm08eEnhyS5+an8LQuNrfLfy72kbQz2K i3UavliNlM9tZsPY0+hwzskQC2TQyh/QiKOxAib0qmrNOtZbh49a8tflZgUbPjRkbQK6/H Ar7os4LsJiAPS8IusrnjBOkn895WItsSGW4Za6u/RvG623U3oq/qlH3VspDH1oHlDDYw/D mwxZovsljPNoMvJuzIvrPSWo94zrxoktd2rFZD7dCJ9uOkJcJIw/j/PD0z4BY5NyuqLVmu LJZed7eg+OXxxEqnGY6pp8dT4Zjz41UbXO9UmgXc5oD5X2GLqA5IFXdnw3ltMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758882957; 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=eZhYdd8LVVsbjuPDQReywqecn4cqxCWWIxea+KO6mn0=; b=BZp2JMujZhY1HerrDJvxwAcgT0IQUcTFSIRASr4TB0O/Z2WQ6Eca/kt0DVmKm9Es/fnh2v 9ooJQx3BW9tYH3ixf4rqMKVfXZlfFthIkZv8evqS9wVEBG/h/ja2ngQLCf72kICTTFf3yJ 1xa5nnz54B7gvXI1S84bW+bWLo7U1JUqzfvVl6SaNIM7uvoF0O1mI+T+dYspNZ/3l9iXBd iTIwimH9bqBCLKFlFuj554Imvu20mr60Pc5xRy6HJ+hwfmcJcdO6j2zovK7dx7hWdXypJY NC3IqfMITmxJLCkdWSev6E9mV8HxZ0JYV6j4e250Mff+lEzZUPf7SsJPykX8Pg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758882957; a=rsa-sha256; cv=none; b=C+gIu+BSav7WaBnbGdCgYYl5ie4ziYAVWtu3kIYIJKvb9MQ+zC4mJZkkwLCLhHAECTkeH7 MM58Bc7miIxE0q7ogqUQcFJrj0rleYWdse6S0QgF8qmZQ9ckGnrVo3/+plvdxC/oYgwTto YslucQH2XPDyeGou48xR8zWObR7118VibKp5CUlYQA0h36zFfV7F7paKo0BZMZB2B7ZjY5 cE/XtpKPKsWUHxgAeLosUe/uzVhLAgsc3JUZ5ytbetfrLEbgs2yPwONg5xTrCB9eXCsKbU E+Le75yRRWx+7ChwPr4F2TxJBxKXJSMQBsPrw/EqRQHqTPAy/Ra7sWC3KINVXA== 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 4cY6SF4JzVzkmH; Fri, 26 Sep 2025 10:35:57 +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 58QAZvLi053630; Fri, 26 Sep 2025 10:35:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58QAZvkX053627; Fri, 26 Sep 2025 10:35:57 GMT (envelope-from git) Date: Fri, 26 Sep 2025 10:35:57 GMT Message-Id: <202509261035.58QAZvkX053627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: eaf619fddcb2 - main - 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/main X-Git-Reftype: branch X-Git-Commit: eaf619fddcb21859311b895a0836da3171a01531 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=eaf619fddcb21859311b895a0836da3171a01531 commit eaf619fddcb21859311b895a0836da3171a01531 Author: Michael Tuexen AuthorDate: 2025-09-26 09:45:12 +0000 Commit: Michael Tuexen CommitDate: 2025-09-26 10:12:51 +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 MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52682 --- 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 0594ca70e99a..636ce4cc9b60 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 528ff3372097..a4bb57adc609 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -1153,11 +1153,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) @@ -1370,27 +1368,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) {