| 10394 | } |
| 10395 | |
| 10396 | static void |
| 10397 | bbr_substate_change(struct tcp_bbr *bbr, uint32_t cts, int32_t line, int dolog) |
| 10398 | { |
| 10399 | /* |
| 10400 | * Now what state are we going into now? Is there adjustments |
| 10401 | * needed? |
| 10402 | */ |
| 10403 | int32_t old_state, old_gain; |
| 10404 | |
| 10405 | old_state = bbr_state_val(bbr); |
| 10406 | old_gain = bbr->r_ctl.rc_bbr_hptsi_gain; |
| 10407 | if (bbr_state_val(bbr) == BBR_SUB_LEVEL1) { |
| 10408 | /* Save the lowest srtt we saw in our end of the sub-state */ |
| 10409 | bbr->rc_hit_state_1 = 0; |
| 10410 | if (bbr->r_ctl.bbr_smallest_srtt_this_state != 0xffffffff) |
| 10411 | bbr->r_ctl.bbr_smallest_srtt_state2 = bbr->r_ctl.bbr_smallest_srtt_this_state; |
| 10412 | } |
| 10413 | bbr->rc_bbr_substate++; |
| 10414 | if (bbr->rc_bbr_substate >= BBR_SUBSTATE_COUNT) { |
| 10415 | /* Cycle back to first state-> gain */ |
| 10416 | bbr->rc_bbr_substate = 0; |
| 10417 | } |
| 10418 | if (bbr_state_val(bbr) == BBR_SUB_GAIN) { |
| 10419 | /* |
| 10420 | * We enter the gain(5/4) cycle (possibly less if |
| 10421 | * shallow buffer detection is enabled) |
| 10422 | */ |
| 10423 | if (bbr->skip_gain) { |
| 10424 | /* |
| 10425 | * Hardware pacing has set our rate to |
| 10426 | * the max and limited our b/w just |
| 10427 | * do level i.e. no gain. |
| 10428 | */ |
| 10429 | bbr->r_ctl.rc_bbr_hptsi_gain = bbr_hptsi_gain[BBR_SUB_LEVEL1]; |
| 10430 | } else if (bbr->gain_is_limited && |
| 10431 | bbr->bbr_hdrw_pacing && |
| 10432 | bbr->r_ctl.crte) { |
| 10433 | /* |
| 10434 | * We can't gain above the hardware pacing |
| 10435 | * rate which is less than our rate + the gain |
| 10436 | * calculate the gain needed to reach the hardware |
| 10437 | * pacing rate.. |
| 10438 | */ |
| 10439 | uint64_t bw, rate, gain_calc; |
| 10440 | |
| 10441 | bw = bbr_get_bw(bbr); |
| 10442 | rate = bbr->r_ctl.crte->rate; |
| 10443 | if ((rate > bw) && |
| 10444 | (((bw * (uint64_t)bbr_hptsi_gain[BBR_SUB_GAIN]) / (uint64_t)BBR_UNIT) > rate)) { |
| 10445 | gain_calc = (rate * BBR_UNIT) / bw; |
| 10446 | if (gain_calc < BBR_UNIT) |
| 10447 | gain_calc = BBR_UNIT; |
| 10448 | bbr->r_ctl.rc_bbr_hptsi_gain = (uint16_t)gain_calc; |
| 10449 | } else { |
| 10450 | bbr->r_ctl.rc_bbr_hptsi_gain = bbr_hptsi_gain[BBR_SUB_GAIN]; |
| 10451 | } |
| 10452 | } else |
| 10453 | bbr->r_ctl.rc_bbr_hptsi_gain = bbr_hptsi_gain[BBR_SUB_GAIN]; |
no test coverage detected