MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bbr_update_hardware_pacing_rate

Function bbr_update_hardware_pacing_rate

freebsd/netinet/tcp_stacks/bbr.c:5531–5591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5529}
5530
5531static void
5532bbr_update_hardware_pacing_rate(struct tcp_bbr *bbr, uint32_t cts)
5533{
5534 const struct tcp_hwrate_limit_table *nrte;
5535 int error, rate = -1;
5536
5537 if (bbr->r_ctl.crte == NULL)
5538 return;
5539 if ((bbr->rc_inp->inp_route.ro_nh == NULL) ||
5540 (bbr->rc_inp->inp_route.ro_nh->nh_ifp == NULL)) {
5541 /* Lost our routes? */
5542 /* Clear the way for a re-attempt */
5543 bbr->bbr_attempt_hdwr_pace = 0;
5544lost_rate:
5545 bbr->gain_is_limited = 0;
5546 bbr->skip_gain = 0;
5547 bbr->bbr_hdrw_pacing = 0;
5548 counter_u64_add(bbr_flows_whdwr_pacing, -1);
5549 counter_u64_add(bbr_flows_nohdwr_pacing, 1);
5550 tcp_bbr_tso_size_check(bbr, cts);
5551 return;
5552 }
5553 rate = bbr_get_hardware_rate(bbr);
5554 nrte = tcp_chg_pacing_rate(bbr->r_ctl.crte,
5555 bbr->rc_tp,
5556 bbr->rc_inp->inp_route.ro_nh->nh_ifp,
5557 rate,
5558 (RS_PACING_GEQ|RS_PACING_SUB_OK),
5559 &error);
5560 if (nrte == NULL) {
5561 goto lost_rate;
5562 }
5563 if (nrte != bbr->r_ctl.crte) {
5564 bbr->r_ctl.crte = nrte;
5565 if (error == 0) {
5566 BBR_STAT_INC(bbr_hdwr_rl_mod_ok);
5567 if (bbr->r_ctl.crte->rate < rate) {
5568 /* We have a problem */
5569 bbr_setup_less_of_rate(bbr, cts,
5570 bbr->r_ctl.crte->rate, rate);
5571 } else {
5572 /* We are good */
5573 bbr->gain_is_limited = 0;
5574 bbr->skip_gain = 0;
5575 }
5576 } else {
5577 /* A failure should release the tag */
5578 BBR_STAT_INC(bbr_hdwr_rl_mod_fail);
5579 bbr->gain_is_limited = 0;
5580 bbr->skip_gain = 0;
5581 bbr->bbr_hdrw_pacing = 0;
5582 }
5583 bbr_type_log_hdwr_pacing(bbr,
5584 bbr->r_ctl.crte->ptbl->rs_ifp,
5585 rate,
5586 ((bbr->r_ctl.crte == NULL) ? 0 : bbr->r_ctl.crte->rate),
5587 __LINE__,
5588 cts,

Callers 1

tcp_bbr_commit_bwFunction · 0.85

Calls 6

tcp_bbr_tso_size_checkFunction · 0.85
bbr_get_hardware_rateFunction · 0.85
bbr_setup_less_of_rateFunction · 0.85
bbr_type_log_hdwr_pacingFunction · 0.85
counter_u64_addFunction · 0.50
tcp_chg_pacing_rateFunction · 0.50

Tested by

no test coverage detected