Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_stacks/bbr.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 512 Lines • ▼ Show 20 Lines | static void | ||||
bbr_check_probe_rtt_limits(struct tcp_bbr *bbr, uint32_t cts); | bbr_check_probe_rtt_limits(struct tcp_bbr *bbr, uint32_t cts); | ||||
static void | static void | ||||
bbr_timer_cancel(struct tcp_bbr *bbr, int32_t line, uint32_t cts); | bbr_timer_cancel(struct tcp_bbr *bbr, int32_t line, uint32_t cts); | ||||
static void | static void | ||||
bbr_log_pacing_delay_calc(struct tcp_bbr *bbr, uint16_t gain, uint32_t len, | bbr_log_pacing_delay_calc(struct tcp_bbr *bbr, uint16_t gain, uint32_t len, | ||||
uint32_t cts, uint32_t usecs, uint64_t bw, uint32_t override, int mod); | uint32_t cts, uint32_t usecs, uint64_t bw, uint32_t override, int mod); | ||||
static int | |||||
bbr_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp, | |||||
struct tcpcb *tp); | |||||
static inline uint8_t | static inline uint8_t | ||||
bbr_state_val(struct tcp_bbr *bbr) | bbr_state_val(struct tcp_bbr *bbr) | ||||
{ | { | ||||
return(bbr->rc_bbr_substate); | return(bbr->rc_bbr_substate); | ||||
} | } | ||||
static inline uint32_t | static inline uint32_t | ||||
get_min_cwnd(struct tcp_bbr *bbr) | get_min_cwnd(struct tcp_bbr *bbr) | ||||
▲ Show 20 Lines • Show All 13,663 Lines • ▼ Show 20 Lines | if ((rsm->r_end - rsm->r_start) > maxseg) { | ||||
frsm = rsm; | frsm = rsm; | ||||
} | } | ||||
} | } | ||||
if (frsm) { | if (frsm) { | ||||
bbr->r_ctl.rc_resend = frsm; | bbr->r_ctl.rc_resend = frsm; | ||||
} | } | ||||
} | } | ||||
static int | |||||
bbr_pru_options(struct tcpcb *tp, int flags) | |||||
{ | |||||
if (flags & PRUS_OOB) | |||||
return (EOPNOTSUPP); | |||||
return (0); | |||||
} | |||||
struct tcp_function_block __tcp_bbr = { | |||||
.tfb_tcp_block_name = __XSTRING(STACKNAME), | |||||
.tfb_tcp_output = bbr_output, | |||||
.tfb_do_queued_segments = ctf_do_queued_segments, | |||||
.tfb_do_segment_nounlock = bbr_do_segment_nounlock, | |||||
.tfb_tcp_do_segment = bbr_do_segment, | |||||
.tfb_tcp_ctloutput = bbr_ctloutput, | |||||
.tfb_tcp_fb_init = bbr_init, | |||||
.tfb_tcp_fb_fini = bbr_fini, | |||||
.tfb_tcp_timer_stop_all = bbr_stopall, | |||||
.tfb_tcp_timer_activate = bbr_timer_activate, | |||||
.tfb_tcp_timer_active = bbr_timer_active, | |||||
.tfb_tcp_timer_stop = bbr_timer_stop, | |||||
.tfb_tcp_rexmit_tmr = bbr_remxt_tmr, | |||||
.tfb_tcp_handoff_ok = bbr_handoff_ok, | |||||
.tfb_tcp_mtu_chg = bbr_mtu_chg, | |||||
.tfb_pru_options = bbr_pru_options, | |||||
}; | |||||
/* | /* | ||||
* bbr_ctloutput() must drop the inpcb lock before performing copyin on | * bbr_ctloutput() must drop the inpcb lock before performing copyin on | ||||
* socket option arguments. When it re-acquires the lock after the copy, it | * socket option arguments. When it re-acquires the lock after the copy, it | ||||
* has to revalidate that the connection is still valid for the socket | * has to revalidate that the connection is still valid for the socket | ||||
* option. | * option. | ||||
*/ | */ | ||||
static int | static int | ||||
bbr_set_sockopt(struct socket *so, struct sockopt *sopt, | bbr_set_sockopt(struct socket *so, struct sockopt *sopt, | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | #endif | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
INP_WLOCK(inp); | INP_WLOCK(inp); | ||||
if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (ECONNRESET); | return (ECONNRESET); | ||||
} | } | ||||
tp = intotcpcb(inp); | tp = intotcpcb(inp); | ||||
if (tp->t_fb != &__tcp_bbr) { | |||||
INP_WUNLOCK(inp); | |||||
return (ENOPROTOOPT); | |||||
} | |||||
bbr = (struct tcp_bbr *)tp->t_fb_ptr; | bbr = (struct tcp_bbr *)tp->t_fb_ptr; | ||||
switch (sopt->sopt_name) { | switch (sopt->sopt_name) { | ||||
case TCP_BBR_PACE_PER_SEC: | case TCP_BBR_PACE_PER_SEC: | ||||
BBR_OPTS_INC(tcp_bbr_pace_per_sec); | BBR_OPTS_INC(tcp_bbr_pace_per_sec); | ||||
bbr->r_ctl.bbr_hptsi_per_second = optval; | bbr->r_ctl.bbr_hptsi_per_second = optval; | ||||
break; | break; | ||||
case TCP_BBR_PACE_DEL_TAR: | case TCP_BBR_PACE_DEL_TAR: | ||||
BBR_OPTS_INC(tcp_bbr_pace_del_tar); | BBR_OPTS_INC(tcp_bbr_pace_del_tar); | ||||
▲ Show 20 Lines • Show All 486 Lines • ▼ Show 20 Lines | if (sopt->sopt_dir == SOPT_SET) { | ||||
return (bbr_set_sockopt(so, sopt, inp, tp, bbr)); | return (bbr_set_sockopt(so, sopt, inp, tp, bbr)); | ||||
} else if (sopt->sopt_dir == SOPT_GET) { | } else if (sopt->sopt_dir == SOPT_GET) { | ||||
return (bbr_get_sockopt(so, sopt, inp, tp, bbr)); | return (bbr_get_sockopt(so, sopt, inp, tp, bbr)); | ||||
} | } | ||||
out: | out: | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | |||||
bbr_pru_options(struct tcpcb *tp, int flags) | |||||
{ | |||||
if (flags & PRUS_OOB) | |||||
return (EOPNOTSUPP); | |||||
return (0); | |||||
} | |||||
struct tcp_function_block __tcp_bbr = { | |||||
.tfb_tcp_block_name = __XSTRING(STACKNAME), | |||||
.tfb_tcp_output = bbr_output, | |||||
.tfb_do_queued_segments = ctf_do_queued_segments, | |||||
.tfb_do_segment_nounlock = bbr_do_segment_nounlock, | |||||
.tfb_tcp_do_segment = bbr_do_segment, | |||||
.tfb_tcp_ctloutput = bbr_ctloutput, | |||||
.tfb_tcp_fb_init = bbr_init, | |||||
.tfb_tcp_fb_fini = bbr_fini, | |||||
.tfb_tcp_timer_stop_all = bbr_stopall, | |||||
.tfb_tcp_timer_activate = bbr_timer_activate, | |||||
.tfb_tcp_timer_active = bbr_timer_active, | |||||
.tfb_tcp_timer_stop = bbr_timer_stop, | |||||
.tfb_tcp_rexmit_tmr = bbr_remxt_tmr, | |||||
.tfb_tcp_handoff_ok = bbr_handoff_ok, | |||||
.tfb_tcp_mtu_chg = bbr_mtu_chg, | |||||
.tfb_pru_options = bbr_pru_options, | |||||
}; | |||||
static const char *bbr_stack_names[] = { | static const char *bbr_stack_names[] = { | ||||
__XSTRING(STACKNAME), | __XSTRING(STACKNAME), | ||||
#ifdef STACKALIAS | #ifdef STACKALIAS | ||||
__XSTRING(STACKALIAS), | __XSTRING(STACKALIAS), | ||||
#endif | #endif | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |