bbr.c (1a714ff204193b9eb810426048e03f5d76e9730e) bbr.c (5666643a95389e3ea7637b86cc556d411242f71e)
1/*-
2 * Copyright (c) 2016-2020 Netflix, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 3371 unchanged lines hidden (view full) ---

3380/*
3381 * Returns the BDP.
3382 */
3383static uint64_t
3384bbr_get_bw_delay_prod(uint64_t rtt, uint64_t bw) {
3385 /*
3386 * Calculate the bytes in flight needed given the bw (in bytes per
3387 * second) and the specifyed rtt in useconds. We need to put out the
1/*-
2 * Copyright (c) 2016-2020 Netflix, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 3371 unchanged lines hidden (view full) ---

3380/*
3381 * Returns the BDP.
3382 */
3383static uint64_t
3384bbr_get_bw_delay_prod(uint64_t rtt, uint64_t bw) {
3385 /*
3386 * Calculate the bytes in flight needed given the bw (in bytes per
3387 * second) and the specifyed rtt in useconds. We need to put out the
3388 * returned value per RTT to match that rate. Gain will normaly
3388 * returned value per RTT to match that rate. Gain will normally
3389 * raise it up from there.
3390 *
3391 * This should not overflow as long as the bandwidth is below 1
3392 * TByte per second (bw < 10**12 = 2**40) and the rtt is smaller
3393 * than 1000 seconds (rtt < 10**3 * 10**6 = 10**9 = 2**30).
3394 */
3395 uint64_t usec_per_sec;
3396

--- 7265 unchanged lines hidden (view full) ---

10662 ((ctf_outstanding(bbr->rc_tp) + bbr->rc_tp->t_maxseg - 1) >=
10663 bbr->rc_tp->snd_wnd)) {
10664 bbr->r_ctl.rc_bbr_state_atflight = max(cts, 1);
10665 bbr_log_exit_gain(bbr, cts, 2);
10666 }
10667 }
10668 /**
10669 * We fall through and return always one of two things has
3389 * raise it up from there.
3390 *
3391 * This should not overflow as long as the bandwidth is below 1
3392 * TByte per second (bw < 10**12 = 2**40) and the rtt is smaller
3393 * than 1000 seconds (rtt < 10**3 * 10**6 = 10**9 = 2**30).
3394 */
3395 uint64_t usec_per_sec;
3396

--- 7265 unchanged lines hidden (view full) ---

10662 ((ctf_outstanding(bbr->rc_tp) + bbr->rc_tp->t_maxseg - 1) >=
10663 bbr->rc_tp->snd_wnd)) {
10664 bbr->r_ctl.rc_bbr_state_atflight = max(cts, 1);
10665 bbr_log_exit_gain(bbr, cts, 2);
10666 }
10667 }
10668 /**
10669 * We fall through and return always one of two things has
10670 * occured.
10670 * occurred.
10671 * 1) We are still not at target
10672 * <or>
10673 * 2) We reached the target and set rc_bbr_state_atflight
10674 * which means we no longer hit this block
10675 * next time we are called.
10676 */
10677 return;
10678 }

--- 473 unchanged lines hidden (view full) ---

11152 bbr->r_ctl.rc_lost_at_startup, bbr_start_exit, 8);
11153 return (0);
11154}
11155
11156static void
11157bbr_state_change(struct tcp_bbr *bbr, uint32_t cts, int32_t epoch, int32_t pkt_epoch, uint32_t losses)
11158{
11159 /*
10671 * 1) We are still not at target
10672 * <or>
10673 * 2) We reached the target and set rc_bbr_state_atflight
10674 * which means we no longer hit this block
10675 * next time we are called.
10676 */
10677 return;
10678 }

--- 473 unchanged lines hidden (view full) ---

11152 bbr->r_ctl.rc_lost_at_startup, bbr_start_exit, 8);
11153 return (0);
11154}
11155
11156static void
11157bbr_state_change(struct tcp_bbr *bbr, uint32_t cts, int32_t epoch, int32_t pkt_epoch, uint32_t losses)
11158{
11159 /*
11160 * A tick occured in the rtt epoch do we need to do anything?
11160 * A tick occurred in the rtt epoch do we need to do anything?
11161 */
11162#ifdef BBR_INVARIANTS
11163 if ((bbr->rc_bbr_state != BBR_STATE_STARTUP) &&
11164 (bbr->rc_bbr_state != BBR_STATE_DRAIN) &&
11165 (bbr->rc_bbr_state != BBR_STATE_PROBE_RTT) &&
11166 (bbr->rc_bbr_state != BBR_STATE_IDLE_EXIT) &&
11167 (bbr->rc_bbr_state != BBR_STATE_PROBE_BW)) {
11168 /* Debug code? */

--- 131 unchanged lines hidden (view full) ---

11300 if (flight <= bbr->r_ctl.rc_target_at_state) {
11301 bbr_log_rtt_shrinks(bbr, cts, 0, 0, __LINE__, BBR_RTTS_REACHTAR, 0);
11302 bbr->r_ctl.rc_bbr_enters_probertt = cts;
11303 /* If time is exactly 0, be 1usec off */
11304 if (bbr->r_ctl.rc_bbr_enters_probertt == 0)
11305 bbr->r_ctl.rc_bbr_enters_probertt = 1;
11306 if (bbr->rc_use_google == 0) {
11307 /*
11161 */
11162#ifdef BBR_INVARIANTS
11163 if ((bbr->rc_bbr_state != BBR_STATE_STARTUP) &&
11164 (bbr->rc_bbr_state != BBR_STATE_DRAIN) &&
11165 (bbr->rc_bbr_state != BBR_STATE_PROBE_RTT) &&
11166 (bbr->rc_bbr_state != BBR_STATE_IDLE_EXIT) &&
11167 (bbr->rc_bbr_state != BBR_STATE_PROBE_BW)) {
11168 /* Debug code? */

--- 131 unchanged lines hidden (view full) ---

11300 if (flight <= bbr->r_ctl.rc_target_at_state) {
11301 bbr_log_rtt_shrinks(bbr, cts, 0, 0, __LINE__, BBR_RTTS_REACHTAR, 0);
11302 bbr->r_ctl.rc_bbr_enters_probertt = cts;
11303 /* If time is exactly 0, be 1usec off */
11304 if (bbr->r_ctl.rc_bbr_enters_probertt == 0)
11305 bbr->r_ctl.rc_bbr_enters_probertt = 1;
11306 if (bbr->rc_use_google == 0) {
11307 /*
11308 * Restore any lowering that as occured to
11308 * Restore any lowering that as occurred to
11309 * reach here
11310 */
11311 if (bbr->r_ctl.bbr_rttprobe_gain_val)
11312 bbr->r_ctl.rc_bbr_hptsi_gain = bbr->r_ctl.bbr_rttprobe_gain_val;
11313 else
11314 bbr->r_ctl.rc_bbr_hptsi_gain = BBR_UNIT;
11315 }
11316 }

--- 3664 unchanged lines hidden ---
11309 * reach here
11310 */
11311 if (bbr->r_ctl.bbr_rttprobe_gain_val)
11312 bbr->r_ctl.rc_bbr_hptsi_gain = bbr->r_ctl.bbr_rttprobe_gain_val;
11313 else
11314 bbr->r_ctl.rc_bbr_hptsi_gain = BBR_UNIT;
11315 }
11316 }

--- 3664 unchanged lines hidden ---