Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Aug 2025 11:00:23 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        Michael Tuexen <tuexen@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: bcb298fa9e23 - main - sctp, tcp, udp: improve deferred computation of checksums
Message-ID:  <EF756882-0CAB-4024-8355-FC80587C20B7@FreeBSD.org>
In-Reply-To: <aJPYuayT8xkdjkjA@cell.glebi.us>
References:  <202508010817.5718HZM6067171@gitrepo.freebsd.org> <aJPYuayT8xkdjkjA@cell.glebi.us>

next in thread | previous in thread | raw e-mail | index | archive | help


> On Aug 7, 2025, at 6:35 AM, Gleb Smirnoff <glebius@freebsd.org> wrote:
>=20
>  Michael,
>=20
> On Fri, Aug 01, 2025 at 08:17:35AM +0000, Michael Tuexen wrote:
> M>     When the SCTP, TCP, or UDP implementation send a packet, it =
does not
> M>     compute the corresponding checksum but defers that. The network =
layer
> M>     will determine whether the network interface selected for the =
packet
> M>     has the requested capability and computes the checksum in =
software,
> M>     if the selected network interface doesn't have the requested
> M>     capability.
> M>     Do this not only for packets being sent by the local SCTP, TCP,
> M>     and UDP stack, but also when forwarding packets. Furthermore, =
when
> M>     such packets are delivered to a local SCTP, TCP, or UDP stack, =
do not
> M>     compute or validate the checksum, since such packets never have =
been on
> M>     the wire.
> M>     This allows to support checksum offloading also in the case of =
local
> M>     virtual machines or jails.
> M>     Support for epair, vtnet, and tap interfaces will be added in
> M>     separate commits.
>=20
> Not a request for any action, but a general comment on the topic.
>=20
> Imagine we are developing an IP stack from scratch for modern =
computers.  Most
> NICs do hardware checksumming, large fraction of installations run in
> containers/VMs and communicate via virtual interfaces.  With modern =
reality we
> would probably do not do any checksumming in the stack at all, just =
completely
> ignore the checksum field.  It would always be obligation of the NIC =
driver to
> care about the checksums.  The existing software checksumming code =
would be
> just a library that drivers for legacy hardware call. Local traffic =
won't set
> and won't check checksums neither any related flags.

I have ever had the same idea, but that requires lots of modification to =
in-tree
drivers and I finally abort.

Think it twice, maybe a new driver flag say `IFF_CSUM_OFFLOAD` is needed =
to
indicate the driver is capable to delay calculating the checksums, and =
eventually
all drivers are converted and tested.

>=20
> --=20
> Gleb Smirnoff

Best regards,
Zhenlei




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EF756882-0CAB-4024-8355-FC80587C20B7>