From nobody Fri Sep 5 18:36:47 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 4cJQ6l5QBsz65y3Y; Fri, 05 Sep 2025 18:36:47 +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 4cJQ6l4Hp6z4N62; Fri, 05 Sep 2025 18:36:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757097407; 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=gYx4jFV+uQ3RAwUITk/fcgKoaQLuJkm6apucuJ2+A54=; b=XK762NFwtjs3nTK5FQi3/g/UIfpV0GLLCF7GCfDm2STvzDhoEvpFfzASNWIJyNXzPBc+tA FU0GhHMFXruBe7nveI1woSo50Y1uBoFoWixVik1CQF/npY8IHTWOg73GK9lGa6JGv/YQc4 ajWBzufdEB4nV5Zcb8xc8wWc/llgpMOipTpZxpi7dSza10Oi1m+q6q6UMBMXAwPc+uIwYi HDA0LBLfxuPf6Zw+xnZFUjo9Z1RZpLkhOMank2MpFDkGi+4+fWkcrg75rJCSn8+/+tvA6J aPYODJVPH5iyTogfmzswMgbRruL+Q0Raq0F6hNReWGvN9n9RIJ1VX0FMHUFX0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757097407; 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=gYx4jFV+uQ3RAwUITk/fcgKoaQLuJkm6apucuJ2+A54=; b=NwH2iHSTv8j8aion8GZwVmpnwMrem3vGOjCg3axth1rsvY4SwJzYnYIum49BBTOWB1FjlU epWzPYxeCvzAHHkK/r3gSPHA4Azn5kbH+MGAD0jXSGyz/Td2/7taJjw+Ke88t2LKzI5mBW dq9BjB8hwZkFTRVrjSY4uaHsZQibtdks6vJNszsI8nIWG9GnC59k57wO2IBQiwhO1Rz5I/ hIlKp9z/z6E6MsRjHi4HElzzbyfFgnjzqOFuocBeMF8A7jHOKlczhAGVD4HguKtqPMK6nA P/qMqz7hahsMqyG5gbYPI+niMJHgGo5YcXAup7AhfG8vWeyf8wGqh7egUGEixQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757097407; a=rsa-sha256; cv=none; b=AKUNULASveNezUYthlRdAsPdwuZFttvkAj+vq21DFIR57bXwafD7m2plUt1HA8Rob+lkmi ipsoUaYHfV+Uj45wXnga1Xr3SEQM6P1I3EOvhr0LuakOJgHENB9zflG7VOj69MYaZzC8WL rgmhxhjBfXYhfU7NtZbYhXcpBs2BkLd23AF96lQ5iBIH2hhQk88n9ysHDJ8jDKe7bA3WwZ 8B3UwywHod7hlhrjUvIbZwmuXIDqsU2bb/Mf5Gox6SXPW0YFhPLEAAcNtjnsrbf69I6Jln FUpmj2a7jkLF23zZPY1xKMzyfaqd3NOLSNtnBwVKDHybrVrBvxJjhI4Qtadeww== 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 4cJQ6l3TmYz10tb; Fri, 05 Sep 2025 18:36:47 +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 585Ial0D078977; Fri, 5 Sep 2025 18:36:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 585Ial6v078974; Fri, 5 Sep 2025 18:36:47 GMT (envelope-from git) Date: Fri, 5 Sep 2025 18:36:47 GMT Message-Id: <202509051836.585Ial6v078974@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: be83b57b6acc - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: be83b57b6acc1087357994b844fc013ead53a409 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=be83b57b6acc1087357994b844fc013ead53a409 commit be83b57b6acc1087357994b844fc013ead53a409 Author: Michael Tuexen AuthorDate: 2025-07-29 06:52:06 +0000 Commit: Michael Tuexen CommitDate: 2025-09-05 18:36:14 +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 Differential Revision: https://reviews.freebsd.org/D51590 (cherry picked from commit fe35f275ab0240cb5ed05484c943293a71aadb5f) --- 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 ,