Page MenuHomeFreeBSD

tcp: improve layout of struct tcpcb
ClosedPublic

Authored by tuexen on Jul 17 2023, 6:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 17, 7:25 PM
Unknown Object (File)
Fri, Dec 12, 3:26 PM
Unknown Object (File)
Mon, Dec 1, 6:18 PM
Unknown Object (File)
Nov 30 2025, 9:35 AM
Unknown Object (File)
Nov 25 2025, 6:45 AM
Unknown Object (File)
Nov 23 2025, 9:14 AM
Unknown Object (File)
Nov 20 2025, 11:32 AM
Unknown Object (File)
Nov 19 2025, 3:50 PM
Subscribers

Details

Summary

Move the conditional stuff to the end. I hope we can remove TCPPCAP in FreeBSD 15.

Not using #ifdef for TCP_ACCOUNTING and TCP_REQUEST_TRK would increase the size of the struct. I am open to it, but based on a discussion with rrs@, the compromise was to move them to the end.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

tuexen added a reviewer: gallatin.

Moving to the end is certainly sensible. Have you checked for any padding holes on at least LP64 with ptype /o in GDB?

sys/netinet/tcp_var.h
473

You're creating a 7 byte alignment hole.. I'd try to keep the uint8_t's together. Eg, put TCP_ACCOUNTING in a different place, and put the tcp_hybrid* after tcp_sendfile_track.

sys/netinet/tcp_var.h
473

When moving TCP_ACCOUNTING around, it is not at the end anymore... That is the only intention here...

Avoid holes on 64-bit systems when all options are defined.

sys/netinet/tcp_var.h
473

Moved things around, now avoiding any holes on 64-bit platforms when TCP_ACCOUNTING and TCP_REQUEST_TRK is defined.

I think this will work much better. Thanks

About t_osd. It seems to be used only by alternative cc modules. Can we move it into their software context structures?

This revision was not accepted when it landed; it landed in state Needs Review.Jul 19 2023, 12:51 PM
This revision was automatically updated to reflect the committed changes.