FreeBSD kernel IPv4 code
tcp_timer.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tcp_timer
 

Macros

#define TCPTV_MSL   ( 30*hz) /* max seg lifetime (hah!) */
 
#define TCPTV_SRTTBASE
 
#define TCPTV_RTOBASE   ( 1*hz) /* assumed RTO if no info */
 
#define TCPTV_PERSMIN   ( 5*hz) /* minimum persist interval */
 
#define TCPTV_PERSMAX   ( 60*hz) /* maximum persist interval */
 
#define TCPTV_KEEP_INIT   ( 75*hz) /* initial connect keepalive */
 
#define TCPTV_KEEP_IDLE   (120*60*hz) /* dflt time before probing */
 
#define TCPTV_KEEPINTVL   ( 75*hz) /* default probe interval */
 
#define TCPTV_KEEPCNT   8 /* max probes before drop */
 
#define TCPTV_FINWAIT2_TIMEOUT   (60*hz) /* FIN_WAIT_2 timeout if no receiver */
 
#define TCPTV_MIN   ( hz/33 ) /* minimum allowable value */
 
#define TCPTV_CPU_VAR   ( hz/5 ) /* cpu variance allowed (200ms) */
 
#define TCPTV_REXMTMAX   ( 64*hz) /* max allowable REXMT value */
 
#define TCPTV_TWTRUNC   8 /* RTO factor to truncate TW */
 
#define TCP_MAXRXTSHIFT   12 /* maximum retransmits */
 
#define TCPTV_DELACK   ( hz/25 ) /* 40ms timeout */
 
#define TCP_RTT_INVALIDATE   (TCP_MAXRXTSHIFT / 4)
 
#define TCPT_RANGESET(tv, value, tvmin, tvmax)
 
#define TT_DELACK   0x0001
 
#define TT_REXMT   0x0002
 
#define TT_PERSIST   0x0004
 
#define TT_KEEP   0x0008
 
#define TT_2MSL   0x0010
 
#define TT_MASK   (TT_DELACK|TT_REXMT|TT_PERSIST|TT_KEEP|TT_2MSL)
 
#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)
 
#define TP_KEEPIDLE(tp)   ((tp)->t_keepidle ? (tp)->t_keepidle : tcp_keepidle)
 
#define TP_KEEPINTVL(tp)   ((tp)->t_keepintvl ? (tp)->t_keepintvl : tcp_keepintvl)
 
#define TP_KEEPCNT(tp)   ((tp)->t_keepcnt ? (tp)->t_keepcnt : tcp_keepcnt)
 
#define TP_MAXIDLE(tp)   (TP_KEEPCNT(tp) * TP_KEEPINTVL(tp))
 
#define V_tcp_always_keepalive   VNET(tcp_always_keepalive)
 
#define V_tcp_pmtud_blackhole_detect   VNET(tcp_pmtud_blackhole_detect)
 
#define V_tcp_pmtud_blackhole_mss   VNET(tcp_pmtud_blackhole_mss)
 
#define V_tcp_v6pmtud_blackhole_mss   VNET(tcp_v6pmtud_blackhole_mss)
 
#define V_tcp_msl   VNET(tcp_msl)
 

Functions

 VNET_DECLARE (int, tcp_always_keepalive)
 
 VNET_DECLARE (int, tcp_pmtud_blackhole_detect)
 
 VNET_DECLARE (int, tcp_pmtud_blackhole_mss)
 
 VNET_DECLARE (int, tcp_v6pmtud_blackhole_mss)
 
 VNET_DECLARE (int, tcp_msl)
 
void tcp_inpinfo_lock_del (struct inpcb *inp, struct tcpcb *tp)
 
void tcp_timer_init (void)
 
void tcp_timer_2msl (void *xtp)
 
struct tcptwtcp_tw_2msl_scan (int reuse)
 
void tcp_timer_keep (void *xtp)
 
void tcp_timer_persist (void *xtp)
 
void tcp_timer_rexmt (void *xtp)
 
void tcp_timer_delack (void *xtp)
 

Variables

int tcp_persmin
 
int tcp_persmax
 
int tcp_keepinit
 
int tcp_keepidle
 
int tcp_keepintvl
 
int tcp_keepcnt
 
int tcp_delacktime
 
int tcp_maxpersistidle
 
int tcp_rexmit_initial
 
int tcp_rexmit_min
 
int tcp_rexmit_slop
 
int tcp_ttl
 
int tcp_backoff []
 
int tcp_totbackoff
 
int tcp_rexmit_drop_options
 
int tcp_finwait2_timeout
 
int tcp_fast_finwait2_recycle
 

Macro Definition Documentation

◆ TCP_MAXRXTSHIFT

#define TCP_MAXRXTSHIFT   12 /* maximum retransmits */

Definition at line 117 of file tcp_timer.h.

◆ TCP_RTT_INVALIDATE

#define TCP_RTT_INVALIDATE   (TCP_MAXRXTSHIFT / 4)

Definition at line 126 of file tcp_timer.h.

◆ TCPT_RANGESET

#define TCPT_RANGESET (   tv,
  value,
  tvmin,
  tvmax 
)
Value:
do { \
(tv) = (value) + tcp_rexmit_slop; \
if ((u_long)(tv) < (u_long)(tvmin)) \
(tv) = (tvmin); \
if ((u_long)(tv) > (u_long)(tvmax)) \
(tv) = (tvmax); \
} while(0)
int tcp_rexmit_slop
Definition: tcp_timer.c:138

Definition at line 136 of file tcp_timer.h.

◆ TCPTV_CPU_VAR

#define TCPTV_CPU_VAR   ( hz/5 ) /* cpu variance allowed (200ms) */

Definition at line 112 of file tcp_timer.h.

◆ TCPTV_DELACK

#define TCPTV_DELACK   ( hz/25 ) /* 40ms timeout */

Definition at line 119 of file tcp_timer.h.

◆ TCPTV_FINWAIT2_TIMEOUT

#define TCPTV_FINWAIT2_TIMEOUT   (60*hz) /* FIN_WAIT_2 timeout if no receiver */

Definition at line 89 of file tcp_timer.h.

◆ TCPTV_KEEP_IDLE

#define TCPTV_KEEP_IDLE   (120*60*hz) /* dflt time before probing */

Definition at line 85 of file tcp_timer.h.

◆ TCPTV_KEEP_INIT

#define TCPTV_KEEP_INIT   ( 75*hz) /* initial connect keepalive */

Definition at line 84 of file tcp_timer.h.

◆ TCPTV_KEEPCNT

#define TCPTV_KEEPCNT   8 /* max probes before drop */

Definition at line 87 of file tcp_timer.h.

◆ TCPTV_KEEPINTVL

#define TCPTV_KEEPINTVL   ( 75*hz) /* default probe interval */

Definition at line 86 of file tcp_timer.h.

◆ TCPTV_MIN

#define TCPTV_MIN   ( hz/33 ) /* minimum allowable value */

Definition at line 111 of file tcp_timer.h.

◆ TCPTV_MSL

#define TCPTV_MSL   ( 30*hz) /* max seg lifetime (hah!) */

Definition at line 77 of file tcp_timer.h.

◆ TCPTV_PERSMAX

#define TCPTV_PERSMAX   ( 60*hz) /* maximum persist interval */

Definition at line 82 of file tcp_timer.h.

◆ TCPTV_PERSMIN

#define TCPTV_PERSMIN   ( 5*hz) /* minimum persist interval */

Definition at line 81 of file tcp_timer.h.

◆ TCPTV_REXMTMAX

#define TCPTV_REXMTMAX   ( 64*hz) /* max allowable REXMT value */

Definition at line 113 of file tcp_timer.h.

◆ TCPTV_RTOBASE

#define TCPTV_RTOBASE   ( 1*hz) /* assumed RTO if no info */

Definition at line 79 of file tcp_timer.h.

◆ TCPTV_SRTTBASE

#define TCPTV_SRTTBASE
Value:
0 /* base roundtrip time;
if 0, no idea yet */

Definition at line 78 of file tcp_timer.h.

◆ TCPTV_TWTRUNC

#define TCPTV_TWTRUNC   8 /* RTO factor to truncate TW */

Definition at line 115 of file tcp_timer.h.

◆ TP_KEEPCNT

#define TP_KEEPCNT (   tp)    ((tp)->t_keepcnt ? (tp)->t_keepcnt : tcp_keepcnt)

Definition at line 183 of file tcp_timer.h.

◆ TP_KEEPIDLE

#define TP_KEEPIDLE (   tp)    ((tp)->t_keepidle ? (tp)->t_keepidle : tcp_keepidle)

Definition at line 181 of file tcp_timer.h.

◆ TP_KEEPINIT

#define TP_KEEPINIT (   tp)    ((tp)->t_keepinit ? (tp)->t_keepinit : tcp_keepinit)

Definition at line 180 of file tcp_timer.h.

◆ TP_KEEPINTVL

#define TP_KEEPINTVL (   tp)    ((tp)->t_keepintvl ? (tp)->t_keepintvl : tcp_keepintvl)

Definition at line 182 of file tcp_timer.h.

◆ TP_MAXIDLE

#define TP_MAXIDLE (   tp)    (TP_KEEPCNT(tp) * TP_KEEPINTVL(tp))

Definition at line 184 of file tcp_timer.h.

◆ TT_2MSL

#define TT_2MSL   0x0010

Definition at line 165 of file tcp_timer.h.

◆ TT_2MSL_SUS

#define TT_2MSL_SUS   0x1000

Definition at line 176 of file tcp_timer.h.

◆ TT_DELACK

#define TT_DELACK   0x0001

Definition at line 161 of file tcp_timer.h.

◆ TT_DELACK_SUS

#define TT_DELACK_SUS   0x0100

Definition at line 172 of file tcp_timer.h.

◆ TT_KEEP

#define TT_KEEP   0x0008

Definition at line 164 of file tcp_timer.h.

◆ TT_KEEP_SUS

#define TT_KEEP_SUS   0x0800

Definition at line 175 of file tcp_timer.h.

◆ TT_MASK

#define TT_MASK   (TT_DELACK|TT_REXMT|TT_PERSIST|TT_KEEP|TT_2MSL)

Definition at line 166 of file tcp_timer.h.

◆ TT_PERSIST

#define TT_PERSIST   0x0004

Definition at line 163 of file tcp_timer.h.

◆ TT_PERSIST_SUS

#define TT_PERSIST_SUS   0x0400

Definition at line 174 of file tcp_timer.h.

◆ TT_REXMT

#define TT_REXMT   0x0002

Definition at line 162 of file tcp_timer.h.

◆ TT_REXMT_SUS

#define TT_REXMT_SUS   0x0200

Definition at line 173 of file tcp_timer.h.

◆ TT_STOPPED

#define TT_STOPPED   0x00010000

Definition at line 178 of file tcp_timer.h.

◆ V_tcp_always_keepalive

#define V_tcp_always_keepalive   VNET(tcp_always_keepalive)

Definition at line 206 of file tcp_timer.h.

◆ V_tcp_msl

#define V_tcp_msl   VNET(tcp_msl)

Definition at line 214 of file tcp_timer.h.

◆ V_tcp_pmtud_blackhole_detect

#define V_tcp_pmtud_blackhole_detect   VNET(tcp_pmtud_blackhole_detect)

Definition at line 208 of file tcp_timer.h.

◆ V_tcp_pmtud_blackhole_mss

#define V_tcp_pmtud_blackhole_mss   VNET(tcp_pmtud_blackhole_mss)

Definition at line 210 of file tcp_timer.h.

◆ V_tcp_v6pmtud_blackhole_mss

#define V_tcp_v6pmtud_blackhole_mss   VNET(tcp_v6pmtud_blackhole_mss)

Definition at line 212 of file tcp_timer.h.

Function Documentation

◆ tcp_inpinfo_lock_del()

void tcp_inpinfo_lock_del ( struct inpcb inp,
struct tcpcb tp 
)

Definition at line 295 of file tcp_timer.c.

References INP_WUNLOCK.

Referenced by tcp_timer_2msl(), tcp_timer_keep(), tcp_timer_persist(), and tcp_timer_rexmt().

Here is the caller graph for this function:

◆ tcp_timer_2msl()

◆ tcp_timer_delack()

void tcp_timer_delack ( void *  xtp)

Definition at line 264 of file tcp_timer.c.

References INP_DROPPED, inpcb::inp_flags, INP_WLOCK, INP_WUNLOCK, tcpcb::t_flags, tcpcb::t_inpcb, tcpcb::t_timers, tcpcb::t_vnet, TCPSTAT_INC, TF_ACKNOW, and tcp_timer::tt_delack.

Referenced by tcp_timer_activate().

Here is the caller graph for this function:

◆ tcp_timer_init()

void tcp_timer_init ( void  )

◆ tcp_timer_keep()

◆ tcp_timer_persist()

◆ tcp_timer_rexmt()

void tcp_timer_rexmt ( void *  xtp)

Definition at line 575 of file tcp_timer.c.

References CC_ALGO, cc_cong_signal(), CC_RTO, tcpcb::ccv, IN_CONGRECOVERY, IN_FASTRECOVERY, in_losing(), INP_DROPPED, inpcb::inp_flags, INP_IPV6, inpcb::inp_socket, INP_TIMEWAIT, inpcb::inp_vflag, INP_WLOCK, INP_WUNLOCK, tcpcb::snd_cwnd, tcpcb::snd_cwnd_prev, tcpcb::snd_max, tcpcb::snd_nxt, tcpcb::snd_recover, tcpcb::snd_recover_prev, tcpcb::snd_ssthresh, tcpcb::snd_ssthresh_prev, tcpcb::snd_una, tcpcb::t_badrxtwin, tcpcb::t_blackhole_enter, tcpcb::t_blackhole_exit, tcpcb::t_fb, tcpcb::t_flags, tcpcb::t_flags2, tcpcb::t_inpcb, tcpcb::t_maxseg, tcpcb::t_pmtud_saved_maxseg, tcpcb::t_rttmin, tcpcb::t_rtttime, tcpcb::t_rxtcur, tcpcb::t_rxtshift, tcpcb::t_srtt, tcpcb::t_state, tcpcb::t_timers, tcpcb::t_vnet, TA_USER, tcp_backoff, tcp_drop(), tcp_free_sackholes(), tcp_inpinfo_lock_del(), TCP_LOG_EVENT, TCP_LOG_RTO, TCP_MAXRXTSHIFT, TCP_PROBE2, tcp_rexmit_drop_options, tcp_rexmit_initial, TCP_REXMTVAL, TCP_RTT_INVALIDATE, TCP_RTT_SHIFT, tcp_trace(), TCPS_ESTABLISHED, TCPS_FIN_WAIT_1, TCPS_SYN_RECEIVED, TCPS_SYN_SENT, TCPSTAT_INC, TCPT_RANGESET, TCPTV_REXMTMAX, TF2_PLPMTU_BLACKHOLE, TF2_PLPMTU_MAXSEGSNT, TF2_PLPMTU_PMTUD, TF_ACKNOW, TF_PREVVALID, TF_RCVD_TSTMP, TF_REQ_SCALE, TF_REQ_TSTMP, TF_SACK_PERMIT, TF_WASCRECOVERY, TF_WASFRECOVERY, tcp_function_block::tfb_tcp_rexmit_tmr, tcp_timer::tt_flags, tcp_timer::tt_rexmt, TT_STOPPED, V_tcp_mssdflt, V_tcp_pmtud_blackhole_detect, V_tcp_pmtud_blackhole_mss, and V_tcp_v6pmtud_blackhole_mss.

Referenced by tcp_timer_activate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_tw_2msl_scan()

struct tcptw * tcp_tw_2msl_scan ( int  reuse)

Definition at line 803 of file tcp_timewait.c.

References in_pcbref(), in_pcbrele_wlocked(), INP_WLOCK, INP_WUNLOCK, intotw, tcp_twclose(), tcptw::tw_inpcb, TW_RLOCK, TW_RUNLOCK, tcptw::tw_time, V_tw_lock, and V_twq_2msl.

Referenced by tcp_slowtimo(), and tcp_twstart().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VNET_DECLARE() [1/5]

VNET_DECLARE ( int  ,
tcp_always_keepalive   
)

◆ VNET_DECLARE() [2/5]

VNET_DECLARE ( int  ,
tcp_msl   
)

◆ VNET_DECLARE() [3/5]

VNET_DECLARE ( int  ,
tcp_pmtud_blackhole_detect   
)

◆ VNET_DECLARE() [4/5]

VNET_DECLARE ( int  ,
tcp_pmtud_blackhole_mss   
)

◆ VNET_DECLARE() [5/5]

VNET_DECLARE ( int  ,
tcp_v6pmtud_blackhole_mss   
)

Variable Documentation

◆ tcp_backoff

◆ tcp_delacktime

int tcp_delacktime
extern

◆ tcp_fast_finwait2_recycle

◆ tcp_finwait2_timeout

◆ tcp_keepcnt

int tcp_keepcnt
extern

Definition at line 160 of file tcp_timer.c.

◆ tcp_keepidle

int tcp_keepidle
extern

Definition at line 102 of file tcp_timer.c.

Referenced by tcp_init().

◆ tcp_keepinit

int tcp_keepinit
extern

Definition at line 96 of file tcp_timer.c.

Referenced by tcp_init().

◆ tcp_keepintvl

int tcp_keepintvl
extern

Definition at line 108 of file tcp_timer.c.

Referenced by tcp_init().

◆ tcp_maxpersistidle

int tcp_maxpersistidle
extern

◆ tcp_persmax

int tcp_persmax
extern

Definition at line 90 of file tcp_timer.c.

Referenced by tcp_init(), and tcp_setpersist().

◆ tcp_persmin

int tcp_persmin
extern

Definition at line 84 of file tcp_timer.c.

Referenced by tcp_init(), and tcp_setpersist().

◆ tcp_rexmit_drop_options

int tcp_rexmit_drop_options
extern

Definition at line 167 of file tcp_timer.c.

Referenced by bbr_timeout_rxt(), rack_timeout_rxt(), and tcp_timer_rexmt().

◆ tcp_rexmit_initial

int tcp_rexmit_initial
extern

Definition at line 126 of file tcp_timer.c.

Referenced by syncache_timeout(), tcp_init(), tcp_newtcpcb(), and tcp_timer_rexmt().

◆ tcp_rexmit_min

int tcp_rexmit_min
extern

Definition at line 132 of file tcp_timer.c.

Referenced by syncache_timeout(), tcp_init(), and tcp_newtcpcb().

◆ tcp_rexmit_slop

int tcp_rexmit_slop
extern

Definition at line 138 of file tcp_timer.c.

Referenced by rack_convert_rtts(), rack_init(), rack_log_rtt_sample(), and tcp_init().

◆ tcp_totbackoff

int tcp_totbackoff
extern

Definition at line 257 of file tcp_timer.c.

Referenced by bbr_timeout_persist(), rack_timeout_persist(), and tcp_timer_persist().

◆ tcp_ttl

int tcp_ttl
extern