mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
tcp/hpts: make stacks responsible for clearing themselves out HPTS
There already is the tfb_tcp_timer_stop_all method that is supposed to stop all time events associated with a given tcpcb by given stack. Some time ago it was doing actual callout_stop(). Today bbr/rack just mark their internal state as inactive in their tfb_tcp_timer_stop_all methods, but tcpcb stays in HPTS wheel and potentially called in from HPTS. Change the methods to also call tcp_hpts_remove(). Note: I'm not sure if internal flag is still relevant once we are out of HPTS wheel. Call the method when connection goes into TCP_CLOSED state, instead of calling it later when tcpcb is freed. Also call it when we switch between stacks. Reviewed by: tuexen, rrs Differential Revision: https://reviews.freebsd.org/D42857
This commit is contained in:
parent
2b3a77467d
commit
d2ef52ef3d
4 changed files with 11 additions and 10 deletions
|
|
@ -5278,6 +5278,9 @@ bbr_stopall(struct tcpcb *tp)
|
||||||
|
|
||||||
bbr = (struct tcp_bbr *)tp->t_fb_ptr;
|
bbr = (struct tcp_bbr *)tp->t_fb_ptr;
|
||||||
bbr->rc_all_timers_stopped = 1;
|
bbr->rc_all_timers_stopped = 1;
|
||||||
|
|
||||||
|
tcp_hpts_remove(tp);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8213,8 +8213,12 @@ static int
|
||||||
rack_stopall(struct tcpcb *tp)
|
rack_stopall(struct tcpcb *tp)
|
||||||
{
|
{
|
||||||
struct tcp_rack *rack;
|
struct tcp_rack *rack;
|
||||||
|
|
||||||
rack = (struct tcp_rack *)tp->t_fb_ptr;
|
rack = (struct tcp_rack *)tp->t_fb_ptr;
|
||||||
rack->t_timers_stopped = 1;
|
rack->t_timers_stopped = 1;
|
||||||
|
|
||||||
|
tcp_hpts_remove(tp);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2379,9 +2379,6 @@ tcp_discardcb(struct tcpcb *tp)
|
||||||
INP_WLOCK_ASSERT(inp);
|
INP_WLOCK_ASSERT(inp);
|
||||||
|
|
||||||
tcp_timer_stop(tp);
|
tcp_timer_stop(tp);
|
||||||
if (tp->t_fb->tfb_tcp_timer_stop_all) {
|
|
||||||
tp->t_fb->tfb_tcp_timer_stop_all(tp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* free the reassembly queue, if any */
|
/* free the reassembly queue, if any */
|
||||||
tcp_reass_flush(tp);
|
tcp_reass_flush(tp);
|
||||||
|
|
@ -2521,9 +2518,8 @@ tcp_close(struct tcpcb *tp)
|
||||||
tcp_fastopen_decrement_counter(tp->t_tfo_pending);
|
tcp_fastopen_decrement_counter(tp->t_tfo_pending);
|
||||||
tp->t_tfo_pending = NULL;
|
tp->t_tfo_pending = NULL;
|
||||||
}
|
}
|
||||||
#ifdef TCPHPTS
|
if (tp->t_fb->tfb_tcp_timer_stop_all != NULL)
|
||||||
tcp_hpts_remove(tp);
|
tp->t_fb->tfb_tcp_timer_stop_all(tp);
|
||||||
#endif
|
|
||||||
in_pcbdrop(inp);
|
in_pcbdrop(inp);
|
||||||
TCPSTAT_INC(tcps_closed);
|
TCPSTAT_INC(tcps_closed);
|
||||||
if (tp->t_state != TCPS_CLOSED)
|
if (tp->t_state != TCPS_CLOSED)
|
||||||
|
|
|
||||||
|
|
@ -1743,10 +1743,8 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt)
|
||||||
* Ensure the new stack takes ownership with a
|
* Ensure the new stack takes ownership with a
|
||||||
* clean slate on peak rate threshold.
|
* clean slate on peak rate threshold.
|
||||||
*/
|
*/
|
||||||
#ifdef TCPHPTS
|
if (tp->t_fb->tfb_tcp_timer_stop_all != NULL)
|
||||||
/* Assure that we are not on any hpts */
|
tp->t_fb->tfb_tcp_timer_stop_all(tp);
|
||||||
tcp_hpts_remove(tp);
|
|
||||||
#endif
|
|
||||||
if (blk->tfb_tcp_fb_init) {
|
if (blk->tfb_tcp_fb_init) {
|
||||||
error = (*blk->tfb_tcp_fb_init)(tp, &ptr);
|
error = (*blk->tfb_tcp_fb_init)(tp, &ptr);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue