Page MenuHomeFreeBSD

iflib: support for transmit side nic KTLS offload
Needs ReviewPublic

Authored by gallatin on Wed, Dec 17, 7:55 PM.

Details

Summary

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

  • 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

  • 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).

Note: I realize poking a hole in the iflib abstraction to pass an mbuf down to thedriver may be controversial. But it is limited in scope and eliminates the need to add complexity to iflib itself in the near term. In the long term, if we gain multiple drivers that support ktls offload, we may want to move some of this functionality into iflib..

Note2: I did this in a way that I think can be MFC'ed. The only change to the driver ABI is the expansion of the pktinfo field, but my thought is that it should be ABI compatible to pass a larger pktinfo down to drivers.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

gallatin retitled this revision from iflib: support fo transmit side nic KTLS offload to iflib: support for transmit side nic KTLS offload.