opnsense-src/sys/netinet
Gleb Smirnoff 446ccdd08e tcp: use single locked callout per tcpcb for the TCP timers
Use only one callout structure per tcpcb that is responsible for handling
all five TCP timeouts.  Use locked version of callout, of course. The
callout function tcp_timer_enter() chooses soonest timer and executes it
with lock held.  Unless the timer reports that the tcpcb has been freed,
the callout is rescheduled for next soonest timer, if there is any.

With single callout per tcpcb on connection teardown we should be able
to fully stop the callout and immediately free it, avoiding use of
callout_async_drain().  There is one gotcha here: callout_stop() can
actually touch our memory when a rare race condition happens.  See
comment above tcp_timer_stop().  Synchronous stop of the callout makes
tcp_discardcb() the single entry point for tcpcb destructor, merging the
tcp_freecb() to the end of the function.

While here, also remove lots of lingering checks in the beginning of
TCP timer functions.  With a locked callout they are unnecessary.

While here, clean unused parts of timer KPI for the pluggable TCP stacks.

While here, remove TCPDEBUG from tcp_timer.c, as this allows for more
simplification of TCP timers.  The TCPDEBUG is scheduled for removal.

Move the DTrace probes in timers to the beginning of a function, where
a tcpcb is always existing.

Discussed with:		rrs, tuexen, rscheff	(the TCP part of the diff)
Reviewed by:		hselasky, kib, mav	(the callout part)
Differential revision:	https://reviews.freebsd.org/D37321
2022-12-07 09:00:48 -08:00
..
cc tcp: embed inpcb into tcpcb 2022-12-07 09:00:48 -08:00
khelp tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
libalias libalias: improve handling of invalid SCTP packets 2022-11-15 21:05:02 +01:00
netdump netdump(4): Correct a typo in source code comment 2022-09-04 12:59:29 +02:00
tcp_stacks tcp: use single locked callout per tcpcb for the TCP timers 2022-12-07 09:00:48 -08:00
accf_data.c
accf_dns.c
accf_http.c
dccp.h
icmp6.h pf: apply the network stack's ICMP rate limiting to ICMP errors sent by pf 2022-10-14 10:36:16 +02:00
icmp_var.h
if_ether.c netinet6: Fix mbuf leak in NDP 2022-05-31 21:06:14 +00:00
if_ether.h
igmp.c inet: Simplify if_multiaddrs iteration. 2022-10-08 13:10:07 -04:00
igmp.h
igmp_var.h igmp: use callout(9) directly instead of pr_slowtimo, pr_fasttimo 2022-08-17 11:50:31 -07:00
in.c inet: Simplify if_multiaddrs iteration. 2022-10-08 13:10:07 -04:00
in.h netinet*: move ipproto_register() and co to ip_var.h and ip6_var.h 2022-10-03 20:53:04 -07:00
in_cksum.c netinet: Implement in_cksum_skip() using m_apply() 2021-11-24 13:31:16 -05:00
in_debug.c Use network epoch to protect local IPv4 addresses hash. 2021-10-22 14:40:53 -07:00
in_fib.c routing: refactor private KPI 2022-08-01 10:02:12 +00:00
in_fib.h
in_fib_algo.c
in_fib_dxr.c fib_algo: shift / mask by constants in dxr_lookup() 2022-01-17 00:13:47 +01:00
in_gif.c Use network epoch to protect local IPv4 addresses hash. 2021-10-22 14:40:53 -07:00
in_jail.c sysent: Get rid of bogus sys/sysent.h include. 2022-05-28 20:52:17 +03:00
in_kdtrace.c Fix dtrace SDT probe tcp:::debug-input 2021-12-20 17:15:43 -09:00
in_kdtrace.h
in_mcast.c inet: Simplify if_multiaddrs iteration. 2022-10-08 13:10:07 -04:00
in_pcb.c inpcb: allow to provide protocol specific pcb size 2022-12-02 14:10:55 -08:00
in_pcb.h inpcb: allow to provide protocol specific pcb size 2022-12-02 14:10:55 -08:00
in_pcb_var.h in_pcb: use jenkins hash over the entire IPv6 (or IPv4) address 2021-12-26 10:47:28 -08:00
in_prot.c
in_proto.c netinet*: add back necessary headers 2022-10-26 08:16:44 -07:00
in_rmx.c routing: add nhop(9) kpi. 2022-08-01 08:52:26 +00:00
in_rss.c in_rss: fix set but not used warning 2022-05-07 18:17:33 +02:00
in_rss.h
in_systm.h
in_var.h inet: Simplify if_multiaddrs iteration. 2022-10-08 13:10:07 -04:00
ip.h ip_reass: retire ipreass_slowtimo() in favor of per-slot callout 2022-09-08 13:49:58 -07:00
ip6.h
ip_carp.c protosw: separate pr_input and pr_ctlinput out of protosw 2022-08-17 11:50:31 -07:00
ip_carp.h protosw: separate pr_input and pr_ctlinput out of protosw 2022-08-17 11:50:31 -07:00
ip_divert.c divert(4): do not depend on ipfw(4) 2022-09-06 20:54:57 -07:00
ip_divert.h divert(4): provide statistics 2022-08-30 15:09:21 -07:00
ip_dummynet.h ipfw: use unsigned int for dummynet bandwidth 2021-08-19 10:48:53 +02:00
ip_ecn.c
ip_ecn.h
ip_encap.c
ip_encap.h
ip_fastfwd.c net: employ newly added pfil_mbuf_{in,out} where approriate 2022-09-08 16:21:08 +00:00
ip_fw.h ipfw: add support radix tables and table lookup for MAC addresses 2022-06-04 19:12:29 +03:00
ip_gre.c udp: allow udp_tun_func_t() to indicate it did not eat the packet 2022-04-12 10:04:59 +02:00
ip_icmp.c icmp: doesn't need tcp_var.h 2022-10-31 08:44:55 -07:00
ip_icmp.h netinet*: remove PRC_ constants and streamline ICMP processing 2022-10-03 20:53:04 -07:00
ip_id.c
ip_input.c Unbreak builds having SCTP support compiled in 2022-11-07 08:50:51 +01:00
ip_mroute.c raw ip: fix regression with multicast and RSVP 2022-09-02 12:17:09 -07:00
ip_mroute.h IPv4 multicast: fix netstat -g 2022-03-22 07:38:01 -05:00
ip_options.c
ip_options.h
ip_output.c ip_output: always increase "cantfrag" stat if ip_fragment() fails 2022-09-14 19:22:40 -07:00
ip_reass.c ip_reass: use correct comparison in ipreass_callout() 2022-09-14 08:32:07 -07:00
ip_var.h netinet*: remove PRC_ constants and streamline ICMP processing 2022-10-03 20:53:04 -07:00
pim.h
pim_var.h
raw_ip.c inpcb: allow to provide protocol specific pcb size 2022-12-02 14:10:55 -08:00
sctp.h
sctp_asconf.c sctp: improve consistency 2022-05-14 06:28:19 +02:00
sctp_asconf.h
sctp_auth.c
sctp_auth.h
sctp_bsd_addr.c sctp: Remove unused variable. 2022-04-12 14:58:59 -07:00
sctp_bsd_addr.h
sctp_cc_functions.c sctp: plug set-but-not-used vars 2022-04-19 12:45:57 +00:00
sctp_constants.h sctp: improve handling of sctp inpcb flags 2022-06-04 07:38:19 +02:00
sctp_crc32.c sctp: fix a signed/unsigned mismatch. 2022-02-17 22:45:57 +01:00
sctp_crc32.h sctp: fix a signed/unsigned mismatch. 2022-02-17 22:45:57 +01:00
sctp_header.h
sctp_indata.c sctp: tweak panic message 2022-08-03 17:28:15 +02:00
sctp_indata.h
sctp_input.c sctp: improve sending of ABORT packets in response to INIT-ACKs 2022-10-13 01:05:44 +02:00
sctp_input.h
sctp_kdtrace.c
sctp_kdtrace.h
sctp_lock_bsd.h sctp: get rid of stcb send lock 2022-03-29 01:50:17 +02:00
sctp_module.c protosw: refactor protosw and domain static declaration and load 2022-08-17 11:50:32 -07:00
sctp_os.h
sctp_os_bsd.h netinet6: retire ip6protosw.h 2022-10-03 20:53:04 -07:00
sctp_output.c sctp: improve handling of send() calls with no user data` 2022-08-08 12:53:42 +02:00
sctp_output.h sctp: cleanup the SCTP_MAXSEG socket option. 2021-12-27 23:40:31 +01:00
sctp_pcb.c sctp: minor changes due to upstreaming of Glebs recent changes 2022-11-06 23:06:40 +01:00
sctp_pcb.h protosw: retire pr_drain and use EVENTHANDLER(9) directly 2022-08-17 11:50:31 -07:00
sctp_peeloff.c sctp: Remove an unused sctp_inpcb field 2021-09-07 11:19:29 -04:00
sctp_peeloff.h
sctp_ss_functions.c sctp: fix typos 2022-03-29 21:09:51 +02:00
sctp_structs.h sctp: cleanup, no functional change 2022-06-08 22:35:14 +02:00
sctp_syscalls.c Fixup build after recent getsock changes 2022-09-10 20:40:43 +00:00
sctp_sysctl.c Adjust sctp_init_sysctls() definition to avoid clang 15 warning 2022-07-25 22:08:35 +02:00
sctp_sysctl.h sctp: fix typos 2022-03-29 21:09:51 +02:00
sctp_timer.c Fix unused variable warning in sctp_timer.c 2022-07-25 22:08:28 +02:00
sctp_timer.h
sctp_uio.h sctp: get rid of stcb send lock 2022-03-29 01:50:17 +02:00
sctp_usrreq.c sctp: minor changes due to upstreaming of Glebs recent changes 2022-11-06 23:06:40 +01:00
sctp_var.h sctp: minor changes due to upstreaming of Glebs recent changes 2022-11-06 23:06:40 +01:00
sctputil.c netinet*: remove PRC_ constants and streamline ICMP processing 2022-10-03 20:53:04 -07:00
sctputil.h sctp: more sb_cc related cleanups 2022-05-23 16:09:23 +02:00
siftr.c tcp: remove INP_TIMEWAIT flag 2022-10-06 19:24:37 -07:00
tcp.h ipfw: Have NAT steal the TH_RES1 bit, instead of the TH_AE bit 2022-11-09 11:19:19 +01:00
tcp_accounting.h This brings into sync FreeBSD with the netflix versions of rack and bbr. 2021-05-06 11:22:26 -04:00
tcp_debug.c tcp: embed inpcb into tcpcb 2022-12-07 09:00:48 -08:00
tcp_debug.h protosw: retire PRU_ flags and their char names 2022-08-17 11:50:32 -07:00
tcp_ecn.c tcp: account sent/received IP ECN markings independently 2022-11-10 11:35:35 +01:00
tcp_ecn.h tcp: add conservative d.cep accounting algorithm 2022-11-06 12:05:22 +01:00
tcp_fastopen.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_fastopen.h Use stub inline functions for no-op versions of tcp_fastopen*(). 2022-04-08 17:25:13 -07:00
tcp_fsm.h tcp: Remove unused v6 state definitions 2021-08-27 08:31:32 -04:00
tcp_hostcache.c tcp(4): Fix a typo in a sysctl description 2021-11-30 07:17:30 +01:00
tcp_hpts.c tcp: embed inpcb into tcpcb 2022-12-07 09:00:48 -08:00
tcp_hpts.h tcp_hpts: Correct some typos in source code comments 2022-09-04 12:47:49 +02:00
tcp_input.c tcp: embed inpcb into tcpcb 2022-12-07 09:00:48 -08:00
tcp_log_buf.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_log_buf.h tcp: forward declare struct tcpcb in the TCP logging header 2022-11-08 10:32:29 -08:00
tcp_lro.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_lro.h tcp: Avoid conditionally defined fields in union lro_address 2022-02-10 15:39:58 -05:00
tcp_offload.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_offload.h
tcp_output.c tcp: embed inpcb into tcpcb 2022-12-07 09:00:48 -08:00
tcp_pcap.c tcp: embed inpcb into tcpcb 2022-12-07 09:00:48 -08:00
tcp_pcap.h
tcp_ratelimit.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_ratelimit.h This takes Warners suggested approach to making it so that 2021-05-07 17:32:32 -04:00
tcp_reass.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_sack.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_seq.h tcp: Correctly compute the retransmit length for all 64-bit platforms. 2022-06-03 10:49:17 +02:00
tcp_stats.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_subr.c tcp: use single locked callout per tcpcb for the TCP timers 2022-12-07 09:00:48 -08:00
tcp_syncache.c tcp: update repeat <SYN,ACK> with latest IP ECN info 2022-10-07 01:51:19 +02:00
tcp_syncache.h tcp: Add/update AccECN related statistics and numbers 2022-02-10 00:21:31 +01:00
tcp_timer.c tcp: use single locked callout per tcpcb for the TCP timers 2022-12-07 09:00:48 -08:00
tcp_timer.h tcp: use single locked callout per tcpcb for the TCP timers 2022-12-07 09:00:48 -08:00
tcp_timewait.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
tcp_usrreq.c tcp: use single locked callout per tcpcb for the TCP timers 2022-12-07 09:00:48 -08:00
tcp_var.h tcp: use single locked callout per tcpcb for the TCP timers 2022-12-07 09:00:48 -08:00
tcpip.h
toecore.c tcp: provide macros to access inpcb and socket from a tcpcb 2022-11-08 10:24:40 -08:00
toecore.h
udp.h headers: make a few more headers self-contained 2022-01-03 10:12:30 +01:00
udp_usrreq.c inpcb: allow to provide protocol specific pcb size 2022-12-02 14:10:55 -08:00
udp_var.h netinet*: remove PRC_ constants and streamline ICMP processing 2022-10-03 20:53:04 -07:00
udplite.h