From nobody Tue Jul 29 06:54:40 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 4brmL867ndz61q6T; Tue, 29 Jul 2025 06:54:40 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brmL859lcz3CDY; Tue, 29 Jul 2025 06:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753772080; 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=QwxrHnLPLBEjB36gzrezSpDvrzC27MrdM+4J8mibHWQ=; b=P5IDSJ7RXaQ4V3UNVjJgd9LVKLnhjW63hoeMPjG0nJ0ycq17xqiZar8p+HbJPeWimK1m+U N1BqhoM148yvA2QzZAI9rRZqnOWTr07Y6gm5raY0o6vNprVgs4/sW5GZwcnIOnqbu4rwaK s/tPAZyl2xSx3ZzIVfrDibU/Wgkoq8Bfn6kgsIiAwADzPyJ6lk8E1J4qwxWHVpDzLjBHFB x/LAq7QvPDxpymP9yA9ZV8im8/PeFGMiijuR2XYTmCFJ890q/SSPI40Jnn1oe8fF/rGy/K pt37nMtvHA94BfLDRF13ZTqCdn6B62TMjtrk+wE0oQTtEeyjcs1Q0vKG2uMbTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753772080; 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=QwxrHnLPLBEjB36gzrezSpDvrzC27MrdM+4J8mibHWQ=; b=HcwVxiwjFAIJOzRygX/QBIj6ecMrQcjbS42DEtXAz9RVR2YIjaGvBl9kUZG/Q/cFMo0CoY +ZTPbPoNmpAhrD9ZaDM7XlAt8ytJjRIr7sNxEQdM7L1ClG/1Y4LuNHd+mB5nNfykdYWWP3 mq4xE1gl2s2wU3MzPAw9kPUGqWLpcjcBXiymqfE5z4sBOMBUd352VsKGEMZp2dYtKn7141 553MiHhJwnMPohr/nROl8iUJcM2QHkptUp/dDMXzpc1RO99DAcLrclpHBch4XRVMhabAB5 0e53MGbAxQIEREJC5DhinyytkMY3hBp7Lc5BSXpGn3dESAtxaLRgIn+g00xaXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753772080; a=rsa-sha256; cv=none; b=MtP183ozb6enkMwLtL19UDfz4G1f78pIgG4hyEZfERXehxUUwT96gfZuXm2qhjNtnE8LJN dHxGBP5eNoTBkrNvHojhUjQEoxaHCc5+hUdsZ/HmWo9pGlvcJGdC1pFCqOAD0wUg+at87e U0BRW73ztaEZ52ws3B+I9gvoiTuNST27fzowDSw1+h/GE4nUpTcvQIUuR6Ly7N0VZcLVUS kOJSYnjQu7/q+qhcWHxJ//aQrrNvn3pmH+bvDopg5ShaScDRZ5NlU1TvR4Lml8yPalMrc1 qS+NTDjUytlG2eLQfNraUjsPFW2RImMpfubX/apWzaLh15qAC5UZquVs99XHyA== 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 4brmL84nJpz4ks; Tue, 29 Jul 2025 06:54:40 +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 56T6sebo068617; Tue, 29 Jul 2025 06:54:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56T6seur068614; Tue, 29 Jul 2025 06:54:40 GMT (envelope-from git) Date: Tue, 29 Jul 2025 06:54:40 GMT Message-Id: <202507290654.56T6seur068614@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: fe35f275ab02 - main - mbuf.9: describe checksum offloading for SCTP 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: fe35f275ab0240cb5ed05484c943293a71aadb5f Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=fe35f275ab0240cb5ed05484c943293a71aadb5f commit fe35f275ab0240cb5ed05484c943293a71aadb5f Author: Michael Tuexen AuthorDate: 2025-07-29 06:52:06 +0000 Commit: Michael Tuexen CommitDate: 2025-07-29 06:52:06 +0000 mbuf.9: describe checksum offloading for SCTP This describes the current status of the implementation. While there, be a bit more precise on how long the checksum computation is delayed. Reviewed by: Timo Völker, bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51590 --- share/man/man9/mbuf.9 | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 index 0262c598ed18..c05505716a30 100644 --- a/share/man/man9/mbuf.9 +++ b/share/man/man9/mbuf.9 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 28, 2023 +.Dd July 29, 2025 .Dt MBUF 9 .Os .\" @@ -1091,7 +1091,7 @@ network code, when data must be encrypted or otherwise altered prior to transmission. .El .Sh HARDWARE-ASSISTED CHECKSUM CALCULATION -This section currently applies to TCP/IP only. +This section currently applies to SCTP, TCP, and UDP over IP only. In order to save the host CPU resources, computing checksums is offloaded to the network interface hardware if possible. The @@ -1117,7 +1117,7 @@ in the .Vt mbuf chain containing the packet. .Pp -On output, checksum offloading is attempted after the outgoing +On output, the computation of the checksum is delayed until the outgoing interface has been determined for a packet. The interface-specific field .Va ifnet.if_data.ifi_hwassist @@ -1135,12 +1135,15 @@ such actions will never be requested through .Va csum_flags . .Pp The flags demanding a particular action from an interface are as follows: -.Bl -tag -width ".Dv CSUM_TCP" -offset indent +.Bl -tag -width ".Dv CSUM_SCTP" -offset indent .It Dv CSUM_IP The IP header checksum is to be computed and stored in the corresponding field of the packet. The hardware is expected to know the format of an IP header to determine the offset of the IP checksum field. +.It Dv CSUM_SCTP +The SCTP checksum is to be computed. +(See below.) .It Dv CSUM_TCP The TCP checksum is to be computed. (See below.) @@ -1149,14 +1152,16 @@ The UDP checksum is to be computed. (See below.) .El .Pp -Should a TCP or UDP checksum be offloaded to the hardware, +Should a SCTP, TCP, or UDP checksum be offloaded to the hardware, the field .Va csum_data will contain the byte offset of the checksum field relative to the end of the IP header. -In this case, the checksum field will be initially -set by the TCP/IP module to the checksum of the pseudo header +In the case of TCP or UDP, the checksum field will be initially +set by the TCP or UDP implementation to the checksum of the pseudo header defined by the TCP and UDP specifications. +In the case of SCTP, the checksum field will be initially +set by the SCTP implementation to 0. .Pp On input, an interface indicates the actions it has performed on a packet by setting one or more of the following flags in @@ -1187,13 +1192,13 @@ to obtain the final checksum to be used for TCP or UDP validation purposes. .El .Pp If a particular network interface just indicates success or -failure of TCP or UDP checksum validation without returning +failure of SCTP, TCP, or UDP checksum validation without returning the exact value of the checksum to the host CPU, its driver can mark .Dv CSUM_DATA_VALID -and -.Dv CSUM_PSEUDO_HDR in -.Va csum_flags , +.Va csum_flags +as well as, for TCP and UDP, +.Dv CSUM_PSEUDO_HDR and set .Va csum_data to @@ -1203,6 +1208,13 @@ It is a peculiarity of the algorithm used that the Internet checksum calculated over any valid packet will be .Li 0xFFFF as long as the original checksum field is included. +Note that for SCTP the value of +.Va csum_data +is not relevant and +.Dv CSUM_PSEUDO_HDR +in +.Va csum_flags +is not set, since SCTP does not use a pseudo header checksum. .Sh STRESS TESTING When running a kernel compiled with the option .Dv MBUF_STRESS_TEST ,