HomeFreeBSD

iflib: support for transmit side nic KTLS offload

Description

iflib: support for transmit side nic KTLS offload

This change adds support to iflib for drivers that want to do
transmit-side NIC ktls offload. This change does 2 things:

  1. Extends the pkt info to include an optional mbuf pointer.

This gives drivers the ability to find the start of a TLS record if
they need to re-DMA part of the record to re-construct TLS state on
the NIC. This mbuf pointer is only passed when CSUM_SND_TAG is
present on the pkthdr. Note that I don't bother to inspect the send
tag on purpose; this will only be present for TLS offloaded or paced
connections

  1. Allows the driver to specify how much ring padding is needed before the ring is considered to be full using the new isc_tx_pad field in if_softc_ctx.

This re-uses a field that was marked spare in 2019 via d49e83eac3baf.
Iflib initializes this to the previous value of 2 slots and allows the
driver to override it. The TXQ_AVAIL() macro has been adjusted to
subtract this padding, and uses of the macro have removed +2 from the
other side of the comparison. To avoid potential cache misses from
looking at the ifc_softc_ctx in TXQ_AVAIL(), the value is mirrored in
the txq (in an alignment hole).

Reviewed by: kbowling, kgalazka, sumit.saxena_broadcom.com, shurd
Sponsored by: Netflix
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D54274

Details

Provenance
gallatinAuthored on Dec 19 2025, 8:48 PM
Reviewer
kbowling
Differential Revision
D54274: iflib: support for transmit side nic KTLS offload
Parents
rG117306dc606b: in6_ifattach: include sys/eventhandler.h to unbreak NOVIMAGE builds
Branches
Unknown
Tags
Unknown