Presently, I believe we incur a function call, indirect lookup, and comparison for each incoming TCP frame. We incur an indirect lookup and comparison for each outgoing TCP frame.
(And, as soon as an alternate stack creates its own tcp_output() equivalent, we will probably also incur the overhead of a function call for outgoing packets. Of course, compilers may optimize away the function call, but the rest of the overhead still remains.)
This change adds a new compile-time option (TCP_HHOOK) to determine whether to support the hhook(9) framework for TCP. To retain backwards compatibility, I added it to every configuration file that already defined "options INET". (Therefore, this patch introduces no functional change. In order to see a functional difference, you need to compile a custom kernel without the TCP_HHOOK option.) However, I suspect that some of the platforms that have excluded INET6 support due to resource limitations may want to consider removing this option from the default kernel.
In the TCP stack, the hhook(9) framework provides hooks for kernel modules to add actions that run when a TCP frame is sent or received on a TCP session in the ESTABLISHED state. In the base tree, this functionality is only used for the h_ertt module, which is used by the cc_cdg, cc_chd, cc_hd, and cc_vegas congestion control modules.
Note that any user who uses those congestion control modules and uses a custom kernel configuration will need to add the TCP_HHOOK option to their kernel configuration.