Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_stacks/rack.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 483 Lines • ▼ Show 20 Lines | |||||
rack_proc_sack_blk(struct tcpcb *tp, struct tcp_rack *rack, | rack_proc_sack_blk(struct tcpcb *tp, struct tcp_rack *rack, | ||||
struct sackblk *sack, struct tcpopt *to, struct rack_sendmap **prsm, | struct sackblk *sack, struct tcpopt *to, struct rack_sendmap **prsm, | ||||
uint32_t cts, int *moved_two); | uint32_t cts, int *moved_two); | ||||
static void rack_post_recovery(struct tcpcb *tp, uint32_t th_seq); | static void rack_post_recovery(struct tcpcb *tp, uint32_t th_seq); | ||||
static void rack_remxt_tmr(struct tcpcb *tp); | static void rack_remxt_tmr(struct tcpcb *tp); | ||||
static int rack_set_sockopt(struct inpcb *inp, struct sockopt *sopt); | static int rack_set_sockopt(struct inpcb *inp, struct sockopt *sopt); | ||||
static void rack_set_state(struct tcpcb *tp, struct tcp_rack *rack); | static void rack_set_state(struct tcpcb *tp, struct tcp_rack *rack); | ||||
static int32_t rack_stopall(struct tcpcb *tp); | static int32_t rack_stopall(struct tcpcb *tp); | ||||
static void | |||||
rack_timer_activate(struct tcpcb *tp, uint32_t timer_type, | |||||
uint32_t delta); | |||||
static int32_t rack_timer_active(struct tcpcb *tp, uint32_t timer_type); | |||||
static void rack_timer_cancel(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, int line); | static void rack_timer_cancel(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, int line); | ||||
static void rack_timer_stop(struct tcpcb *tp, uint32_t timer_type); | static void rack_timer_stop(struct tcpcb *tp, uint32_t timer_type); | ||||
static uint32_t | static uint32_t | ||||
rack_update_entry(struct tcpcb *tp, struct tcp_rack *rack, | rack_update_entry(struct tcpcb *tp, struct tcp_rack *rack, | ||||
struct rack_sendmap *rsm, uint64_t ts, int32_t * lenp, uint16_t add_flag); | struct rack_sendmap *rsm, uint64_t ts, int32_t * lenp, uint16_t add_flag); | ||||
static void | static void | ||||
rack_update_rsm(struct tcpcb *tp, struct tcp_rack *rack, | rack_update_rsm(struct tcpcb *tp, struct tcp_rack *rack, | ||||
struct rack_sendmap *rsm, uint64_t ts, uint16_t add_flag); | struct rack_sendmap *rsm, uint64_t ts, uint16_t add_flag); | ||||
▲ Show 20 Lines • Show All 5,401 Lines • ▼ Show 20 Lines | rack_timeout_rack(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | ||||
* This timer simply provides an internal trigger to send out data. | * This timer simply provides an internal trigger to send out data. | ||||
* The check_recovery_mode call will see if there are needed | * The check_recovery_mode call will see if there are needed | ||||
* retransmissions, if so we will enter fast-recovery. The output | * retransmissions, if so we will enter fast-recovery. The output | ||||
* call may or may not do the same thing depending on sysctl | * call may or may not do the same thing depending on sysctl | ||||
* settings. | * settings. | ||||
*/ | */ | ||||
struct rack_sendmap *rsm; | struct rack_sendmap *rsm; | ||||
if (tp->tt_flags & TT_STOPPED) { | |||||
return (1); | |||||
} | |||||
counter_u64_add(rack_to_tot, 1); | counter_u64_add(rack_to_tot, 1); | ||||
if (rack->r_state && (rack->r_state != tp->t_state)) | if (rack->r_state && (rack->r_state != tp->t_state)) | ||||
rack_set_state(tp, rack); | rack_set_state(tp, rack); | ||||
rack->rc_on_min_to = 0; | rack->rc_on_min_to = 0; | ||||
rsm = rack_check_recovery_mode(tp, cts); | rsm = rack_check_recovery_mode(tp, cts); | ||||
rack_log_to_event(rack, RACK_TO_FRM_RACK, rsm); | rack_log_to_event(rack, RACK_TO_FRM_RACK, rsm); | ||||
if (rsm) { | if (rsm) { | ||||
rack->r_ctl.rc_resend = rsm; | rack->r_ctl.rc_resend = rsm; | ||||
▲ Show 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | |||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
struct rack_sendmap *insret; | struct rack_sendmap *insret; | ||||
#endif | #endif | ||||
struct socket *so = tptosocket(tp); | struct socket *so = tptosocket(tp); | ||||
uint32_t amm; | uint32_t amm; | ||||
uint32_t out, avail; | uint32_t out, avail; | ||||
int collapsed_win = 0; | int collapsed_win = 0; | ||||
if (tp->tt_flags & TT_STOPPED) { | |||||
return (1); | |||||
} | |||||
if (TSTMP_LT(cts, rack->r_ctl.rc_timer_exp)) { | if (TSTMP_LT(cts, rack->r_ctl.rc_timer_exp)) { | ||||
/* Its not time yet */ | /* Its not time yet */ | ||||
return (0); | return (0); | ||||
} | } | ||||
if (ctf_progress_timeout_check(tp, true)) { | if (ctf_progress_timeout_check(tp, true)) { | ||||
rack_log_progress_event(rack, tp, tick, PROGRESS_DROP, __LINE__); | rack_log_progress_event(rack, tp, tick, PROGRESS_DROP, __LINE__); | ||||
return (-ETIMEDOUT); /* tcp_drop() */ | return (-ETIMEDOUT); /* tcp_drop() */ | ||||
} | } | ||||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | |||||
* the output routine will send the ack out. | * the output routine will send the ack out. | ||||
* | * | ||||
* We only return 1, saying don't proceed, if all timers | * We only return 1, saying don't proceed, if all timers | ||||
* are stopped (destroyed PCB?). | * are stopped (destroyed PCB?). | ||||
*/ | */ | ||||
static int | static int | ||||
rack_timeout_delack(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | rack_timeout_delack(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | ||||
{ | { | ||||
if (tp->tt_flags & TT_STOPPED) { | |||||
return (1); | |||||
} | |||||
rack_log_to_event(rack, RACK_TO_FRM_DELACK, NULL); | rack_log_to_event(rack, RACK_TO_FRM_DELACK, NULL); | ||||
tp->t_flags &= ~TF_DELACK; | tp->t_flags &= ~TF_DELACK; | ||||
tp->t_flags |= TF_ACKNOW; | tp->t_flags |= TF_ACKNOW; | ||||
KMOD_TCPSTAT_INC(tcps_delack); | KMOD_TCPSTAT_INC(tcps_delack); | ||||
rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_DELACK; | rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_DELACK; | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Persists timer, here we simply send the | * Persists timer, here we simply send the | ||||
* same thing as a keepalive will. | * same thing as a keepalive will. | ||||
* the one byte send. | * the one byte send. | ||||
* | * | ||||
* We only return 1, saying don't proceed, if all timers | * We only return 1, saying don't proceed, if all timers | ||||
* are stopped (destroyed PCB?). | * are stopped (destroyed PCB?). | ||||
*/ | */ | ||||
static int | static int | ||||
rack_timeout_persist(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | rack_timeout_persist(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | ||||
{ | { | ||||
struct tcptemp *t_template; | struct tcptemp *t_template; | ||||
int32_t retval = 1; | int32_t retval = 1; | ||||
if (tp->tt_flags & TT_STOPPED) { | |||||
return (1); | |||||
} | |||||
if (rack->rc_in_persist == 0) | if (rack->rc_in_persist == 0) | ||||
return (0); | return (0); | ||||
if (ctf_progress_timeout_check(tp, false)) { | if (ctf_progress_timeout_check(tp, false)) { | ||||
tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); | tcp_log_end_status(tp, TCP_EI_STATUS_PERSIST_MAX); | ||||
rack_log_progress_event(rack, tp, tick, PROGRESS_DROP, __LINE__); | rack_log_progress_event(rack, tp, tick, PROGRESS_DROP, __LINE__); | ||||
counter_u64_add(rack_persists_lost_ends, rack->r_ctl.persist_lost_ends); | counter_u64_add(rack_persists_lost_ends, rack->r_ctl.persist_lost_ends); | ||||
return (-ETIMEDOUT); /* tcp_drop() */ | return (-ETIMEDOUT); /* tcp_drop() */ | ||||
} | } | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
* out a segment with respond. | * out a segment with respond. | ||||
*/ | */ | ||||
static int | static int | ||||
rack_timeout_keepalive(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | rack_timeout_keepalive(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | ||||
{ | { | ||||
struct tcptemp *t_template; | struct tcptemp *t_template; | ||||
struct inpcb *inp = tptoinpcb(tp); | struct inpcb *inp = tptoinpcb(tp); | ||||
if (tp->tt_flags & TT_STOPPED) { | |||||
return (1); | |||||
} | |||||
rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_KEEP; | rack->r_ctl.rc_hpts_flags &= ~PACE_TMR_KEEP; | ||||
rack_log_to_event(rack, RACK_TO_FRM_KEEP, NULL); | rack_log_to_event(rack, RACK_TO_FRM_KEEP, NULL); | ||||
/* | /* | ||||
* Keep-alive timer went off; send something or drop connection if | * Keep-alive timer went off; send something or drop connection if | ||||
* idle for too long. | * idle for too long. | ||||
*/ | */ | ||||
KMOD_TCPSTAT_INC(tcps_keeptimeo); | KMOD_TCPSTAT_INC(tcps_keeptimeo); | ||||
if (tp->t_state < TCPS_ESTABLISHED) | if (tp->t_state < TCPS_ESTABLISHED) | ||||
▲ Show 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
rack_timeout_rxt(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | rack_timeout_rxt(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts) | ||||
{ | { | ||||
struct inpcb *inp = tptoinpcb(tp); | struct inpcb *inp = tptoinpcb(tp); | ||||
int32_t rexmt; | int32_t rexmt; | ||||
int32_t retval = 0; | int32_t retval = 0; | ||||
bool isipv6; | bool isipv6; | ||||
if (tp->tt_flags & TT_STOPPED) { | |||||
return (1); | |||||
} | |||||
if ((tp->t_flags & TF_GPUTINPROG) && | if ((tp->t_flags & TF_GPUTINPROG) && | ||||
(tp->t_rxtshift)) { | (tp->t_rxtshift)) { | ||||
/* | /* | ||||
* We have had a second timeout | * We have had a second timeout | ||||
* measurements on successive rxt's are not profitable. | * measurements on successive rxt's are not profitable. | ||||
* It is unlikely to be of any use (the network is | * It is unlikely to be of any use (the network is | ||||
* broken or the client went away). | * broken or the client went away). | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 387 Lines • ▼ Show 20 Lines | if (tcp_in_hpts(rack->rc_inp) && | ||||
hpts_removed = 1; | hpts_removed = 1; | ||||
} | } | ||||
rack->r_ctl.rc_hpts_flags &= ~(PACE_TMR_MASK); | rack->r_ctl.rc_hpts_flags &= ~(PACE_TMR_MASK); | ||||
} | } | ||||
if (hpts_removed == 0) | if (hpts_removed == 0) | ||||
rack_log_to_cancel(rack, hpts_removed, line, us_cts, &tv, flags_on_entry); | rack_log_to_cancel(rack, hpts_removed, line, us_cts, &tv, flags_on_entry); | ||||
} | } | ||||
static void | |||||
rack_timer_stop(struct tcpcb *tp, uint32_t timer_type) | |||||
{ | |||||
return; | |||||
} | |||||
static int | 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; | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
rack_timer_activate(struct tcpcb *tp, uint32_t timer_type, uint32_t delta) | |||||
{ | |||||
return; | |||||
} | |||||
static int | |||||
rack_timer_active(struct tcpcb *tp, uint32_t timer_type) | |||||
{ | |||||
return (0); | |||||
} | |||||
static void | |||||
rack_stop_all_timers(struct tcpcb *tp) | rack_stop_all_timers(struct tcpcb *tp) | ||||
{ | { | ||||
struct tcp_rack *rack; | struct tcp_rack *rack; | ||||
/* | /* | ||||
* Assure no timers are running. | * Assure no timers are running. | ||||
*/ | */ | ||||
if (tcp_timer_active(tp, TT_PERSIST)) { | if (tcp_timer_active(tp, TT_PERSIST)) { | ||||
▲ Show 20 Lines • Show All 13,203 Lines • ▼ Show 20 Lines | static struct tcp_function_block __tcp_rack = { | ||||
.tfb_tcp_output = rack_output, | .tfb_tcp_output = rack_output, | ||||
.tfb_do_queued_segments = ctf_do_queued_segments, | .tfb_do_queued_segments = ctf_do_queued_segments, | ||||
.tfb_do_segment_nounlock = rack_do_segment_nounlock, | .tfb_do_segment_nounlock = rack_do_segment_nounlock, | ||||
.tfb_tcp_do_segment = rack_do_segment, | .tfb_tcp_do_segment = rack_do_segment, | ||||
.tfb_tcp_ctloutput = rack_ctloutput, | .tfb_tcp_ctloutput = rack_ctloutput, | ||||
.tfb_tcp_fb_init = rack_init, | .tfb_tcp_fb_init = rack_init, | ||||
.tfb_tcp_fb_fini = rack_fini, | .tfb_tcp_fb_fini = rack_fini, | ||||
.tfb_tcp_timer_stop_all = rack_stopall, | .tfb_tcp_timer_stop_all = rack_stopall, | ||||
.tfb_tcp_timer_activate = rack_timer_activate, | |||||
.tfb_tcp_timer_active = rack_timer_active, | |||||
.tfb_tcp_timer_stop = rack_timer_stop, | |||||
.tfb_tcp_rexmit_tmr = rack_remxt_tmr, | .tfb_tcp_rexmit_tmr = rack_remxt_tmr, | ||||
.tfb_tcp_handoff_ok = rack_handoff_ok, | .tfb_tcp_handoff_ok = rack_handoff_ok, | ||||
.tfb_tcp_mtu_chg = rack_mtu_change, | .tfb_tcp_mtu_chg = rack_mtu_change, | ||||
.tfb_pru_options = rack_pru_options, | .tfb_pru_options = rack_pru_options, | ||||
.tfb_hwtls_change = rack_hw_tls_change, | .tfb_hwtls_change = rack_hw_tls_change, | ||||
.tfb_compute_pipe = rack_compute_pipe, | .tfb_compute_pipe = rack_compute_pipe, | ||||
.tfb_flags = TCP_FUNC_OUTPUT_CANDROP, | .tfb_flags = TCP_FUNC_OUTPUT_CANDROP, | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 621 Lines • Show Last 20 Lines |