| 11393 | } |
| 11394 | |
| 11395 | static int32_t |
| 11396 | pace_to_fill_cwnd(struct tcp_rack *rack, int32_t slot, uint32_t len, uint32_t segsiz) |
| 11397 | { |
| 11398 | uint64_t lentim, fill_bw; |
| 11399 | |
| 11400 | /* Lets first see if we are full, if so continue with normal rate */ |
| 11401 | if (ctf_flight_size(rack->rc_tp, rack->r_ctl.rc_sacked) > rack->r_ctl.cwnd_to_use) |
| 11402 | return (slot); |
| 11403 | if ((ctf_outstanding(rack->rc_tp) + (segsiz-1)) > rack->rc_tp->snd_wnd) |
| 11404 | return (slot); |
| 11405 | if (rack->r_ctl.rc_last_us_rtt == 0) |
| 11406 | return (slot); |
| 11407 | if (rack->rc_pace_fill_if_rttin_range && |
| 11408 | (rack->r_ctl.rc_last_us_rtt >= |
| 11409 | (get_filter_value_small(&rack->r_ctl.rc_gp_min_rtt) * rack->rtt_limit_mul))) { |
| 11410 | /* The rtt is huge, N * smallest, lets not fill */ |
| 11411 | return (slot); |
| 11412 | } |
| 11413 | /* |
| 11414 | * first lets calculate the b/w based on the last us-rtt |
| 11415 | * and the sndwnd. |
| 11416 | */ |
| 11417 | fill_bw = rack->r_ctl.cwnd_to_use; |
| 11418 | /* Take the rwnd if its smaller */ |
| 11419 | if (fill_bw > rack->rc_tp->snd_wnd) |
| 11420 | fill_bw = rack->rc_tp->snd_wnd; |
| 11421 | fill_bw *= (uint64_t)HPTS_USEC_IN_SEC; |
| 11422 | fill_bw /= (uint64_t)rack->r_ctl.rc_last_us_rtt; |
| 11423 | /* We are below the min b/w */ |
| 11424 | if (fill_bw < RACK_MIN_BW) |
| 11425 | return (slot); |
| 11426 | /* |
| 11427 | * Ok fill_bw holds our mythical b/w to fill the cwnd |
| 11428 | * in a rtt, what does that time wise equate too? |
| 11429 | */ |
| 11430 | lentim = (uint64_t)(len) * (uint64_t)HPTS_USEC_IN_SEC; |
| 11431 | lentim /= fill_bw; |
| 11432 | if (lentim < slot) { |
| 11433 | rack_log_pacing_delay_calc(rack, len, slot, fill_bw, |
| 11434 | 0, lentim, 12, __LINE__, NULL); |
| 11435 | return ((int32_t)lentim); |
| 11436 | } else |
| 11437 | return (slot); |
| 11438 | } |
| 11439 | |
| 11440 | static int32_t |
| 11441 | rack_get_pacing_delay(struct tcp_rack *rack, struct tcpcb *tp, uint32_t len, struct rack_sendmap *rsm, uint32_t segsiz) |
no test coverage detected