tcp: remove tcp_timer_suspend()
It was a temporary code added together with RACK to fight against TCP timer races.
This commit is contained in:
parent
e68b379244
commit
918fa4227d
@ -9919,10 +9919,6 @@ bbr_stop_all_timers(struct tcpcb *tp)
|
||||
bbr = (struct tcp_bbr *)tp->t_fb_ptr;
|
||||
bbr->rc_in_persist = 1;
|
||||
}
|
||||
tcp_timer_suspend(tp, TT_PERSIST);
|
||||
tcp_timer_suspend(tp, TT_REXMT);
|
||||
tcp_timer_suspend(tp, TT_KEEP);
|
||||
tcp_timer_suspend(tp, TT_DELACK);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -7100,10 +7100,6 @@ rack_stop_all_timers(struct tcpcb *tp)
|
||||
rack = (struct tcp_rack *)tp->t_fb_ptr;
|
||||
rack->rc_in_persist = 1;
|
||||
}
|
||||
tcp_timer_suspend(tp, TT_PERSIST);
|
||||
tcp_timer_suspend(tp, TT_REXMT);
|
||||
tcp_timer_suspend(tp, TT_KEEP);
|
||||
tcp_timer_suspend(tp, TT_DELACK);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -976,114 +976,6 @@ tcp_timer_active(struct tcpcb *tp, uint32_t timer_type)
|
||||
return callout_active(t_callout);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop the timer from running, and apply a flag
|
||||
* against the timer_flags that will force the
|
||||
* timer never to run. The flag is needed to assure
|
||||
* a race does not leave it running and cause
|
||||
* the timer to possibly restart itself (keep and persist
|
||||
* especially do this).
|
||||
*/
|
||||
int
|
||||
tcp_timer_suspend(struct tcpcb *tp, uint32_t timer_type)
|
||||
{
|
||||
struct callout *t_callout;
|
||||
uint32_t t_flags;
|
||||
|
||||
switch (timer_type) {
|
||||
case TT_DELACK:
|
||||
t_flags = TT_DELACK_SUS;
|
||||
t_callout = &tp->tt_delack;
|
||||
break;
|
||||
case TT_REXMT:
|
||||
t_flags = TT_REXMT_SUS;
|
||||
t_callout = &tp->tt_rexmt;
|
||||
break;
|
||||
case TT_PERSIST:
|
||||
t_flags = TT_PERSIST_SUS;
|
||||
t_callout = &tp->tt_persist;
|
||||
break;
|
||||
case TT_KEEP:
|
||||
t_flags = TT_KEEP_SUS;
|
||||
t_callout = &tp->tt_keep;
|
||||
break;
|
||||
case TT_2MSL:
|
||||
t_flags = TT_2MSL_SUS;
|
||||
t_callout = &tp->tt_2msl;
|
||||
break;
|
||||
default:
|
||||
panic("tp:%p bad timer_type 0x%x", tp, timer_type);
|
||||
}
|
||||
tp->tt_flags |= t_flags;
|
||||
return (callout_stop(t_callout));
|
||||
}
|
||||
|
||||
void
|
||||
tcp_timers_unsuspend(struct tcpcb *tp, uint32_t timer_type)
|
||||
{
|
||||
|
||||
switch (timer_type) {
|
||||
case TT_DELACK:
|
||||
if (tp->tt_flags & TT_DELACK_SUS) {
|
||||
tp->tt_flags &= ~TT_DELACK_SUS;
|
||||
if (tp->t_flags & TF_DELACK) {
|
||||
/* Delayed ack timer should be up activate a timer */
|
||||
tp->t_flags &= ~TF_DELACK;
|
||||
tcp_timer_activate(tp, TT_DELACK,
|
||||
tcp_delacktime);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TT_REXMT:
|
||||
if (tp->tt_flags & TT_REXMT_SUS) {
|
||||
tp->tt_flags &= ~TT_REXMT_SUS;
|
||||
if (SEQ_GT(tp->snd_max, tp->snd_una) &&
|
||||
(tcp_timer_active((tp), TT_PERSIST) == 0) &&
|
||||
tp->snd_wnd) {
|
||||
/* We have outstanding data activate a timer */
|
||||
tcp_timer_activate(tp, TT_REXMT,
|
||||
tp->t_rxtcur);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TT_PERSIST:
|
||||
if (tp->tt_flags & TT_PERSIST_SUS) {
|
||||
tp->tt_flags &= ~TT_PERSIST_SUS;
|
||||
if (tp->snd_wnd == 0) {
|
||||
/* Activate the persists timer */
|
||||
tp->t_rxtshift = 0;
|
||||
tcp_setpersist(tp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TT_KEEP:
|
||||
if (tp->tt_flags & TT_KEEP_SUS) {
|
||||
tp->tt_flags &= ~TT_KEEP_SUS;
|
||||
tcp_timer_activate(tp, TT_KEEP,
|
||||
TCPS_HAVEESTABLISHED(tp->t_state) ?
|
||||
TP_KEEPIDLE(tp) : TP_KEEPINIT(tp));
|
||||
}
|
||||
break;
|
||||
case TT_2MSL:
|
||||
if (tp->tt_flags &= TT_2MSL_SUS) {
|
||||
struct socket *so = tptosocket(tp);
|
||||
|
||||
tp->tt_flags &= ~TT_2MSL_SUS;
|
||||
if ((tp->t_state == TCPS_FIN_WAIT_2) &&
|
||||
(so == NULL || /* XXXGL: needed? */
|
||||
(so->so_rcv.sb_state & SBS_CANTRCVMORE))) {
|
||||
/* Star the 2MSL timer */
|
||||
tcp_timer_activate(tp, TT_2MSL,
|
||||
(tcp_fast_finwait2_recycle) ?
|
||||
tcp_finwait2_timeout : TP_MAXIDLE(tp));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
panic("tp:%p bad timer_type 0x%x", tp, timer_type);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tcp_timer_discard(void *ptp)
|
||||
{
|
||||
|
@ -155,16 +155,6 @@ static const char *tcptimers[] =
|
||||
#define TT_2MSL 0x0010
|
||||
#define TT_MASK (TT_DELACK|TT_REXMT|TT_PERSIST|TT_KEEP|TT_2MSL)
|
||||
|
||||
/*
|
||||
* Suspend flags - used when suspending a timer
|
||||
* from ever running again.
|
||||
*/
|
||||
#define TT_DELACK_SUS 0x0100
|
||||
#define TT_REXMT_SUS 0x0200
|
||||
#define TT_PERSIST_SUS 0x0400
|
||||
#define TT_KEEP_SUS 0x0800
|
||||
#define TT_2MSL_SUS 0x1000
|
||||
|
||||
#define TT_STOPPED 0x00010000
|
||||
|
||||
#define TP_KEEPINIT(tp) ((tp)->t_keepinit ? (tp)->t_keepinit : tcp_keepinit)
|
||||
|
@ -1187,8 +1187,6 @@ struct tcptemp *
|
||||
tcpip_maketemplate(struct inpcb *);
|
||||
void tcpip_fillheaders(struct inpcb *, uint16_t, void *, void *);
|
||||
void tcp_timer_activate(struct tcpcb *, uint32_t, u_int);
|
||||
int tcp_timer_suspend(struct tcpcb *, uint32_t);
|
||||
void tcp_timers_unsuspend(struct tcpcb *, uint32_t);
|
||||
int tcp_timer_active(struct tcpcb *, uint32_t);
|
||||
void tcp_timer_stop(struct tcpcb *, uint32_t);
|
||||
void tcp_trace(short, short, struct tcpcb *, void *, struct tcphdr *, int);
|
||||
|
Loading…
Reference in New Issue
Block a user