Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_timer.c
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | #endif | ||||
if (! CPU_ABSENT(cpuid)) | if (! CPU_ABSENT(cpuid)) | ||||
return (cpuid); | return (cpuid); | ||||
return (curcpu); | return (curcpu); | ||||
} else { | } else { | ||||
return (0); | return (0); | ||||
} | } | ||||
} | } | ||||
/* | |||||
* Legacy TCP global callout routine called every 500 ms. | |||||
* Used to cleanup timewait states, which lack their own callouts. | |||||
*/ | |||||
static struct callout tcpslow_callout; | |||||
static void | |||||
tcp_slowtimo(void *arg __unused) | |||||
{ | |||||
struct epoch_tracker et; | |||||
VNET_ITERATOR_DECL(vnet_iter); | |||||
NET_EPOCH_ENTER(et); | |||||
VNET_LIST_RLOCK_NOSLEEP(); | |||||
VNET_FOREACH(vnet_iter) { | |||||
CURVNET_SET(vnet_iter); | |||||
(void) tcp_tw_2msl_scan(0); | |||||
CURVNET_RESTORE(); | |||||
} | |||||
VNET_LIST_RUNLOCK_NOSLEEP(); | |||||
NET_EPOCH_EXIT(et); | |||||
callout_reset_sbt(&tcpslow_callout, SBT_1MS * 500, SBT_1MS * 10, | |||||
tcp_slowtimo, NULL, 0); | |||||
} | |||||
static void | |||||
tcp_slowtimo_init(void *arg __unused) | |||||
{ | |||||
callout_init(&tcpslow_callout, 1); | |||||
callout_reset_sbt(&tcpslow_callout, SBT_1MS * 500, SBT_1MS * 10, | |||||
tcp_slowtimo, NULL, 0); | |||||
} | |||||
SYSINIT(tcp_timer, SI_SUB_VNET_DONE, SI_ORDER_ANY, tcp_slowtimo_init, NULL); | |||||
int tcp_backoff[TCP_MAXRXTSHIFT + 1] = | int tcp_backoff[TCP_MAXRXTSHIFT + 1] = | ||||
{ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512 }; | { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 512, 512, 512 }; | ||||
int tcp_totbackoff = 2559; /* sum of tcp_backoff[] */ | int tcp_totbackoff = 2559; /* sum of tcp_backoff[] */ | ||||
/* | /* | ||||
* TCP timer processing. | * TCP timer processing. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | #endif | ||||
* still waiting for peer to close and connection has been idle | * still waiting for peer to close and connection has been idle | ||||
* too long delete connection control block. Otherwise, check | * too long delete connection control block. Otherwise, check | ||||
* again in a bit. | * again in a bit. | ||||
* | * | ||||
* If fastrecycle of FIN_WAIT_2, in FIN_WAIT_2 and receiver has closed, | * If fastrecycle of FIN_WAIT_2, in FIN_WAIT_2 and receiver has closed, | ||||
* there's no point in hanging onto FIN_WAIT_2 socket. Just close it. | * there's no point in hanging onto FIN_WAIT_2 socket. Just close it. | ||||
* Ignore fact that there were recent incoming segments. | * Ignore fact that there were recent incoming segments. | ||||
*/ | */ | ||||
if (tcp_fast_finwait2_recycle && tp->t_state == TCPS_FIN_WAIT_2 && | if (tp->t_state == TCPS_TIME_WAIT) { | ||||
tp->t_inpcb && tp->t_inpcb->inp_socket && | tcp_timer_close(tp); | ||||
CURVNET_RESTORE(); | |||||
return; | |||||
} else if (tp->t_state == TCPS_FIN_WAIT_2 && | |||||
tcp_fast_finwait2_recycle && tp->t_inpcb->inp_socket && | |||||
(tp->t_inpcb->inp_socket->so_rcv.sb_state & SBS_CANTRCVMORE)) { | (tp->t_inpcb->inp_socket->so_rcv.sb_state & SBS_CANTRCVMORE)) { | ||||
TCPSTAT_INC(tcps_finwait2_drops); | TCPSTAT_INC(tcps_finwait2_drops); | ||||
tcp_timer_close(tp); | tcp_timer_close(tp); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
return; | return; | ||||
} else { | } else { | ||||
if (ticks - tp->t_rcvtime <= TP_MAXIDLE(tp)) { | if (ticks - tp->t_rcvtime <= TP_MAXIDLE(tp)) { | ||||
callout_reset(&tp->t_timers->tt_2msl, | callout_reset(&tp->t_timers->tt_2msl, | ||||
▲ Show 20 Lines • Show All 780 Lines • Show Last 20 Lines |