| 5591 | } |
| 5592 | |
| 5593 | static void |
| 5594 | bbr_adjust_for_hw_pacing(struct tcp_bbr *bbr, uint32_t cts) |
| 5595 | { |
| 5596 | /* |
| 5597 | * If we have hardware pacing support |
| 5598 | * we need to factor that in for our |
| 5599 | * TSO size. |
| 5600 | */ |
| 5601 | const struct tcp_hwrate_limit_table *rlp; |
| 5602 | uint32_t cur_delay, seg_sz, maxseg, new_tso, delta, hdwr_delay; |
| 5603 | |
| 5604 | if ((bbr->bbr_hdrw_pacing == 0) || |
| 5605 | (IN_RECOVERY(bbr->rc_tp->t_flags)) || |
| 5606 | (bbr->r_ctl.crte == NULL)) |
| 5607 | return; |
| 5608 | if (bbr->hw_pacing_set == 0) { |
| 5609 | /* Not yet by the hdwr pacing count delay */ |
| 5610 | return; |
| 5611 | } |
| 5612 | if (bbr_hdwr_pace_adjust == 0) { |
| 5613 | /* No adjustment */ |
| 5614 | return; |
| 5615 | } |
| 5616 | rlp = bbr->r_ctl.crte; |
| 5617 | if (bbr->rc_tp->t_maxseg > bbr->rc_last_options) |
| 5618 | maxseg = bbr->rc_tp->t_maxseg - bbr->rc_last_options; |
| 5619 | else |
| 5620 | maxseg = BBR_MIN_SEG - bbr->rc_last_options; |
| 5621 | /* |
| 5622 | * So lets first get the |
| 5623 | * time we will take between |
| 5624 | * TSO sized sends currently without |
| 5625 | * hardware help. |
| 5626 | */ |
| 5627 | cur_delay = bbr_get_pacing_delay(bbr, BBR_UNIT, |
| 5628 | bbr->r_ctl.rc_pace_max_segs, cts, 1); |
| 5629 | hdwr_delay = bbr->r_ctl.rc_pace_max_segs / maxseg; |
| 5630 | hdwr_delay *= rlp->time_between; |
| 5631 | if (cur_delay > hdwr_delay) |
| 5632 | delta = cur_delay - hdwr_delay; |
| 5633 | else |
| 5634 | delta = 0; |
| 5635 | bbr_log_type_tsosize(bbr, cts, delta, cur_delay, hdwr_delay, |
| 5636 | (bbr->r_ctl.rc_pace_max_segs / maxseg), |
| 5637 | 1); |
| 5638 | if (delta && |
| 5639 | (delta < (max(rlp->time_between, |
| 5640 | bbr->r_ctl.bbr_hptsi_segments_delay_tar)))) { |
| 5641 | /* |
| 5642 | * Now lets divide by the pacing |
| 5643 | * time between each segment the |
| 5644 | * hardware sends rounding up and |
| 5645 | * derive a bytes from that. We multiply |
| 5646 | * that by bbr_hdwr_pace_adjust to get |
| 5647 | * more bang for our buck. |
| 5648 | * |
| 5649 | * The goal is to have the software pacer |
| 5650 | * waiting no more than an additional |
no test coverage detected