MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bbr_init

Function bbr_init

freebsd/netinet/tcp_stacks/bbr.c:10058–10266  ·  view source on GitHub ↗

* Return 0 on success, non-zero on failure * which indicates the error (usually no memory). */

Source from the content-addressed store, hash-verified

10056 * which indicates the error (usually no memory).
10057 */
10058static int
10059bbr_init(struct tcpcb *tp)
10060{
10061 struct tcp_bbr *bbr = NULL;
10062 struct inpcb *inp;
10063 uint32_t cts;
10064
10065 tp->t_fb_ptr = uma_zalloc(bbr_pcb_zone, (M_NOWAIT | M_ZERO));
10066 if (tp->t_fb_ptr == NULL) {
10067 /*
10068 * We need to allocate memory but cant. The INP and INP_INFO
10069 * locks and they are recusive (happens during setup. So a
10070 * scheme to drop the locks fails :(
10071 *
10072 */
10073 return (ENOMEM);
10074 }
10075 bbr = (struct tcp_bbr *)tp->t_fb_ptr;
10076 bbr->rtt_valid = 0;
10077 inp = tp->t_inpcb;
10078 inp->inp_flags2 |= INP_CANNOT_DO_ECN;
10079 inp->inp_flags2 |= INP_SUPPORTS_MBUFQ;
10080 TAILQ_INIT(&bbr->r_ctl.rc_map);
10081 TAILQ_INIT(&bbr->r_ctl.rc_free);
10082 TAILQ_INIT(&bbr->r_ctl.rc_tmap);
10083 bbr->rc_tp = tp;
10084 if (tp->t_inpcb) {
10085 bbr->rc_inp = tp->t_inpcb;
10086 }
10087 cts = tcp_get_usecs(&bbr->rc_tv);
10088 tp->t_acktime = 0;
10089 bbr->rc_allow_data_af_clo = bbr_ignore_data_after_close;
10090 bbr->r_ctl.rc_reorder_fade = bbr_reorder_fade;
10091 bbr->rc_tlp_threshold = bbr_tlp_thresh;
10092 bbr->r_ctl.rc_reorder_shift = bbr_reorder_thresh;
10093 bbr->r_ctl.rc_pkt_delay = bbr_pkt_delay;
10094 bbr->r_ctl.rc_min_to = bbr_min_to;
10095 bbr->rc_bbr_state = BBR_STATE_STARTUP;
10096 bbr->r_ctl.bbr_lost_at_state = 0;
10097 bbr->r_ctl.rc_lost_at_startup = 0;
10098 bbr->rc_all_timers_stopped = 0;
10099 bbr->r_ctl.rc_bbr_lastbtlbw = 0;
10100 bbr->r_ctl.rc_pkt_epoch_del = 0;
10101 bbr->r_ctl.rc_pkt_epoch = 0;
10102 bbr->r_ctl.rc_lowest_rtt = 0xffffffff;
10103 bbr->r_ctl.rc_bbr_hptsi_gain = bbr_high_gain;
10104 bbr->r_ctl.rc_bbr_cwnd_gain = bbr_high_gain;
10105 bbr->r_ctl.rc_went_idle_time = cts;
10106 bbr->rc_pacer_started = cts;
10107 bbr->r_ctl.rc_pkt_epoch_time = cts;
10108 bbr->r_ctl.rc_rcvtime = cts;
10109 bbr->r_ctl.rc_bbr_state_time = cts;
10110 bbr->r_ctl.rc_del_time = cts;
10111 bbr->r_ctl.rc_tlp_rxt_last_time = cts;
10112 bbr->r_ctl.last_in_probertt = cts;
10113 bbr->skip_gain = 0;
10114 bbr->gain_is_limited = 0;
10115 bbr->no_pacing_until = bbr_no_pacing_until;

Callers

nothing calls this directly

Calls 15

tcp_get_usecsFunction · 0.85
setup_time_filterFunction · 0.85
setup_time_filter_smallFunction · 0.85
bbr_log_rtt_shrinksFunction · 0.85
bbr_allocFunction · 0.85
bbr_state_valFunction · 0.85
bbr_log_type_statechangeFunction · 0.85
apply_filter_min_smallFunction · 0.85
bbr_log_settings_changeFunction · 0.85
tcp_bbr_tso_size_checkFunction · 0.85
bbr_stop_all_timersFunction · 0.85
bbr_start_hpts_timerFunction · 0.85

Tested by

no test coverage detected