Page MenuHomeFreeBSD

tcp: improve stack switching
Needs ReviewPublic

Authored by tuexen on Sat, Oct 3, 6:50 PM.
Tags
None
Referenced Files
F174736282: D60281.id188562.diff
Mon, Oct 5, 2:57 PM
F174735626: D60281.diff
Mon, Oct 5, 2:51 PM
F174724110: D60281.id.diff
Mon, Oct 5, 12:31 PM
F174650560: D60281.id188562.diff
Sun, Oct 4, 11:06 PM
F174641080: D60281.diff
Sun, Oct 4, 9:21 PM
Unknown Object (File)
Sun, Oct 4, 4:14 PM
Unknown Object (File)
Sun, Oct 4, 4:11 PM
Unknown Object (File)
Sun, Oct 4, 3:16 PM
Subscribers

Details

Summary

The first step in doing a TCP stack switch is calling the tfb_tcp_handoff_ok() function. If a stack switch is not allowed, an error code is returned, which is then returned to the caller of tcp_ctloutput_set().
In case tcp_ctloutput_set() is called via the sysctl_setsockopt() code path (for example by using tcpsso) and the error code is EAGAIN or EWOULDBLOCK, this results in a loop in userland_sysctl() until the returned error code changes.
To avoid this, don't use EAGAIN or EWOULDBLOCK in the tfb_tcp_handoff_ok() function for the RACK and BBR stack. Also document this tfb_tcp_handoff_ok() should not return EAGAIN or EWOULDBLOCK in the tcp_functions.9 man-page.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

tuexen requested review of this revision.Sat, Oct 3, 6:50 PM

An alternative approach would be to change int (*tfb_tcp_handoff_ok)(struct tcpcb *) to bool (*tfb_tcp_handoff_ok)(struct tcpcb *) and let the caller map false to EINVAL. Would that be clearer? That would also allow the compiler to catch the change in TCP stacks other than BBR and RACK.