* Return 0 on success, non-zero on failure * which indicates the error (usually no memory). */
| 10056 | * which indicates the error (usually no memory). |
| 10057 | */ |
| 10058 | static int |
| 10059 | bbr_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; |
nothing calls this directly
no test coverage detected