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)
Thu, Nov 7, 6:45 AM
Unknown Object (File)
Tue, Nov 5, 8:40 AM
Unknown Object (File)
Mon, Nov 4, 7:52 PM
Unknown Object (File)
Sep 28 2024, 4:25 PM
Unknown Object (File)
Sep 28 2024, 5:38 AM
Unknown Object (File)
Sep 25 2024, 6:10 AM
Unknown Object (File)
Sep 24 2024, 11:28 PM
Unknown Object (File)
Sep 24 2024, 6:44 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".