| 11159 | } |
| 11160 | |
| 11161 | static void |
| 11162 | bbr_state_change(struct tcp_bbr *bbr, uint32_t cts, int32_t epoch, int32_t pkt_epoch, uint32_t losses) |
| 11163 | { |
| 11164 | /* |
| 11165 | * A tick occured in the rtt epoch do we need to do anything? |
| 11166 | */ |
| 11167 | #ifdef BBR_INVARIANTS |
| 11168 | if ((bbr->rc_bbr_state != BBR_STATE_STARTUP) && |
| 11169 | (bbr->rc_bbr_state != BBR_STATE_DRAIN) && |
| 11170 | (bbr->rc_bbr_state != BBR_STATE_PROBE_RTT) && |
| 11171 | (bbr->rc_bbr_state != BBR_STATE_IDLE_EXIT) && |
| 11172 | (bbr->rc_bbr_state != BBR_STATE_PROBE_BW)) { |
| 11173 | /* Debug code? */ |
| 11174 | panic("Unknown BBR state %d?\n", bbr->rc_bbr_state); |
| 11175 | } |
| 11176 | #endif |
| 11177 | if (bbr->rc_bbr_state == BBR_STATE_STARTUP) { |
| 11178 | /* Do we exit the startup state? */ |
| 11179 | if (bbr_state_startup(bbr, cts, epoch, pkt_epoch)) { |
| 11180 | uint32_t time_in; |
| 11181 | |
| 11182 | bbr_log_startup_event(bbr, cts, bbr->r_ctl.rc_bbr_last_startup_epoch, |
| 11183 | bbr->r_ctl.rc_lost_at_startup, bbr_start_exit, 6); |
| 11184 | bbr->rc_filled_pipe = 1; |
| 11185 | bbr->r_ctl.bbr_lost_at_state = bbr->r_ctl.rc_lost; |
| 11186 | if (SEQ_GT(cts, bbr->r_ctl.rc_bbr_state_time)) { |
| 11187 | time_in = cts - bbr->r_ctl.rc_bbr_state_time; |
| 11188 | counter_u64_add(bbr_state_time[bbr->rc_bbr_state], time_in); |
| 11189 | } else |
| 11190 | time_in = 0; |
| 11191 | if (bbr->rc_no_pacing) |
| 11192 | bbr->rc_no_pacing = 0; |
| 11193 | bbr->r_ctl.rc_bbr_state_time = cts; |
| 11194 | bbr->r_ctl.rc_bbr_hptsi_gain = bbr->r_ctl.rc_drain_pg; |
| 11195 | bbr->rc_bbr_state = BBR_STATE_DRAIN; |
| 11196 | bbr_set_state_target(bbr, __LINE__); |
| 11197 | if ((bbr->rc_use_google == 0) && |
| 11198 | bbr_slam_cwnd_in_main_drain) { |
| 11199 | /* Here we don't have to worry about probe-rtt */ |
| 11200 | bbr->r_ctl.rc_saved_cwnd = bbr->rc_tp->snd_cwnd; |
| 11201 | bbr->rc_tp->snd_cwnd = bbr->r_ctl.rc_target_at_state; |
| 11202 | bbr_log_type_cwndupd(bbr, 0, 0, 0, 12, 0, 0, __LINE__); |
| 11203 | } |
| 11204 | bbr->r_ctl.rc_bbr_cwnd_gain = bbr_high_gain; |
| 11205 | bbr_log_type_statechange(bbr, cts, __LINE__); |
| 11206 | if (ctf_flight_size(bbr->rc_tp, |
| 11207 | (bbr->r_ctl.rc_sacked + bbr->r_ctl.rc_lost_bytes)) <= |
| 11208 | bbr->r_ctl.rc_target_at_state) { |
| 11209 | /* |
| 11210 | * Switch to probe_bw if we are already |
| 11211 | * there |
| 11212 | */ |
| 11213 | bbr->rc_bbr_substate = bbr_pick_probebw_substate(bbr, cts); |
| 11214 | bbr_substate_change(bbr, cts, __LINE__, 0); |
| 11215 | bbr->rc_bbr_state = BBR_STATE_PROBE_BW; |
| 11216 | bbr_log_type_statechange(bbr, cts, __LINE__); |
| 11217 | } |
| 11218 | } |
no test coverage detected