Page MenuHomeFreeBSD

sctp: Use m_apply() to calcuate a checksum for an mbuf chain
ClosedPublic

Authored by markj on Nov 11 2021, 2:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 6, 6:21 PM
Unknown Object (File)
Mar 17 2024, 4:36 AM
Unknown Object (File)
Mar 17 2024, 4:32 AM
Unknown Object (File)
Mar 17 2024, 4:31 AM
Unknown Object (File)
Mar 14 2024, 11:11 AM
Unknown Object (File)
Jan 31 2024, 10:57 PM
Unknown Object (File)
Jan 5 2024, 1:30 PM
Unknown Object (File)
Jan 5 2024, 1:30 PM
Subscribers

Details

Summary

m_apply() works on unmapped mbufs, so this will let us elide
mb_unmapped_to_ext() calls preceding sctp_calculate_cksum() calls in
the network stack.

Modify sctp_calculate_cksum() to assume it's passed an mbuf header.
This assumption appears to be true in practice, and we need to know the
full length of the chain. If necessary, we could drop this assumption
by introducing an m_apply() variant which does not take a length
parameter and instead simply operates on the full chain.

No functional change intended.

Test Plan
# ifconfig lo0 -txcsum -rxcsum
# kldload sctp
# nc --sctp -l 127.0.0.1 8080
<make sure data gets passed>
# nc --sctp -l ::1 8080
<make sure data gets passed>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Nov 11 2021, 2:47 PM
This revision is now accepted and ready to land.Nov 11 2021, 5:50 PM

You could also perhaps use m_length() if you had to, or permit a length of -1 to mean "until the end of the chain".