Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_timer.c
Show First 20 Lines • Show All 321 Lines • ▼ Show 20 Lines | |||||
#ifdef TCPDEBUG | #ifdef TCPDEBUG | ||||
int ostate; | int ostate; | ||||
ostate = tp->t_state; | ostate = tp->t_state; | ||||
#endif | #endif | ||||
inp = tp->t_inpcb; | inp = tp->t_inpcb; | ||||
KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp)); | KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp)); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
tcp_log_end_status(tp, TCP_EI_STATUS_2MSL); | |||||
tcp_free_sackholes(tp); | tcp_free_sackholes(tp); | ||||
if (callout_pending(&tp->t_timers->tt_2msl) || | if (callout_pending(&tp->t_timers->tt_2msl) || | ||||
!callout_active(&tp->t_timers->tt_2msl)) { | !callout_active(&tp->t_timers->tt_2msl)) { | ||||
INP_WUNLOCK(tp->t_inpcb); | INP_WUNLOCK(tp->t_inpcb); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
return; | return; | ||||
} | } | ||||
callout_deactivate(&tp->t_timers->tt_2msl); | callout_deactivate(&tp->t_timers->tt_2msl); | ||||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | #endif | ||||
TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); | TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
return; | return; | ||||
dropit: | dropit: | ||||
TCPSTAT_INC(tcps_keepdrops); | TCPSTAT_INC(tcps_keepdrops); | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
tcp_log_end_status(tp, TCP_EI_STATUS_KEEP_MAX); | |||||
tp = tcp_drop(tp, ETIMEDOUT); | tp = tcp_drop(tp, ETIMEDOUT); | ||||
#ifdef TCPDEBUG | #ifdef TCPDEBUG | ||||
if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) | if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) | ||||
tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0, | tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0, | ||||
PRU_SLOWTIMO); | PRU_SLOWTIMO); | ||||
#endif | #endif | ||||
TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); | TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | #endif | ||||
* (no responses to probes) reaches the maximum | * (no responses to probes) reaches the maximum | ||||
* backoff that we would use if retransmitting. | * backoff that we would use if retransmitting. | ||||
*/ | */ | ||||
if (tp->t_rxtshift == TCP_MAXRXTSHIFT && | if (tp->t_rxtshift == TCP_MAXRXTSHIFT && | ||||
(ticks - tp->t_rcvtime >= tcp_maxpersistidle || | (ticks - tp->t_rcvtime >= tcp_maxpersistidle || | ||||
ticks - tp->t_rcvtime >= TCP_REXMTVAL(tp) * tcp_totbackoff)) { | ticks - tp->t_rcvtime >= TCP_REXMTVAL(tp) * tcp_totbackoff)) { | ||||
TCPSTAT_INC(tcps_persistdrop); | TCPSTAT_INC(tcps_persistdrop); | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); | |||||
tp = tcp_drop(tp, ETIMEDOUT); | tp = tcp_drop(tp, ETIMEDOUT); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
tcp_inpinfo_lock_del(inp, tp); | tcp_inpinfo_lock_del(inp, tp); | ||||
goto out; | goto out; | ||||
} | } | ||||
/* | /* | ||||
* If the user has closed the socket then drop a persisting | * If the user has closed the socket then drop a persisting | ||||
* connection after a much reduced timeout. | * connection after a much reduced timeout. | ||||
*/ | */ | ||||
if (tp->t_state > TCPS_CLOSE_WAIT && | if (tp->t_state > TCPS_CLOSE_WAIT && | ||||
(ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) { | (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) { | ||||
TCPSTAT_INC(tcps_persistdrop); | TCPSTAT_INC(tcps_persistdrop); | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); | |||||
tp = tcp_drop(tp, ETIMEDOUT); | tp = tcp_drop(tp, ETIMEDOUT); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
tcp_inpinfo_lock_del(inp, tp); | tcp_inpinfo_lock_del(inp, tp); | ||||
goto out; | goto out; | ||||
} | } | ||||
tcp_setpersist(tp); | tcp_setpersist(tp); | ||||
tp->t_flags |= TF_FORCEDATA; | tp->t_flags |= TF_FORCEDATA; | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | #endif | ||||
* Retransmission timer went off. Message has not | * Retransmission timer went off. Message has not | ||||
* been acked within retransmit interval. Back off | * been acked within retransmit interval. Back off | ||||
* to a longer retransmit interval and retransmit one segment. | * to a longer retransmit interval and retransmit one segment. | ||||
*/ | */ | ||||
if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) { | if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) { | ||||
tp->t_rxtshift = TCP_MAXRXTSHIFT; | tp->t_rxtshift = TCP_MAXRXTSHIFT; | ||||
TCPSTAT_INC(tcps_timeoutdrop); | TCPSTAT_INC(tcps_timeoutdrop); | ||||
NET_EPOCH_ENTER(et); | NET_EPOCH_ENTER(et); | ||||
tcp_log_end_status(tp, TCP_EI_STATUS_RETRAN); | |||||
tp = tcp_drop(tp, ETIMEDOUT); | tp = tcp_drop(tp, ETIMEDOUT); | ||||
NET_EPOCH_EXIT(et); | NET_EPOCH_EXIT(et); | ||||
tcp_inpinfo_lock_del(inp, tp); | tcp_inpinfo_lock_del(inp, tp); | ||||
goto out; | goto out; | ||||
} | } | ||||
if (tp->t_state == TCPS_SYN_SENT) { | if (tp->t_state == TCPS_SYN_SENT) { | ||||
/* | /* | ||||
* If the SYN was retransmitted, indicate CWND to be | * If the SYN was retransmitted, indicate CWND to be | ||||
▲ Show 20 Lines • Show All 477 Lines • Show Last 20 Lines |