| 3460 | } |
| 3461 | |
| 3462 | static uint32_t |
| 3463 | bbr_get_target_cwnd(struct tcp_bbr *bbr, uint64_t bw, uint32_t gain) |
| 3464 | { |
| 3465 | uint32_t cwnd, mss; |
| 3466 | |
| 3467 | mss = min((bbr->rc_tp->t_maxseg - bbr->rc_last_options), bbr->r_ctl.rc_pace_max_segs); |
| 3468 | /* Get the base cwnd with gain rounded to a mss */ |
| 3469 | cwnd = roundup(bbr_get_raw_target_cwnd(bbr, bw, gain), mss); |
| 3470 | /* |
| 3471 | * Add in N (2 default since we do not have a |
| 3472 | * fq layer to trap packets in) quanta's per the I-D |
| 3473 | * section 4.2.3.2 quanta adjust. |
| 3474 | */ |
| 3475 | cwnd += (bbr_quanta * bbr->r_ctl.rc_pace_max_segs); |
| 3476 | if (bbr->rc_use_google) { |
| 3477 | if((bbr->rc_bbr_state == BBR_STATE_PROBE_BW) && |
| 3478 | (bbr_state_val(bbr) == BBR_SUB_GAIN)) { |
| 3479 | /* |
| 3480 | * The linux implementation adds |
| 3481 | * an extra 2 x mss in gain cycle which |
| 3482 | * is documented no-where except in the code. |
| 3483 | * so we add more for Neal undocumented feature |
| 3484 | */ |
| 3485 | cwnd += 2 * mss; |
| 3486 | } |
| 3487 | if ((cwnd / mss) & 0x1) { |
| 3488 | /* Round up for odd num mss */ |
| 3489 | cwnd += mss; |
| 3490 | } |
| 3491 | } |
| 3492 | /* Are we below the min cwnd? */ |
| 3493 | if (cwnd < get_min_cwnd(bbr)) |
| 3494 | return (get_min_cwnd(bbr)); |
| 3495 | return (cwnd); |
| 3496 | } |
| 3497 | |
| 3498 | static uint16_t |
| 3499 | bbr_gain_adjust(struct tcp_bbr *bbr, uint16_t gain) |
no test coverage detected