git: be83b57b6acc - stable/14 - mbuf.9: describe checksum offloading for SCTP
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Sep 2025 18:36:47 UTC
The branch stable/14 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=be83b57b6acc1087357994b844fc013ead53a409
commit be83b57b6acc1087357994b844fc013ead53a409
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-07-29 06:52:06 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
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 ,