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

Function __bbr_get_bw

freebsd/netinet/tcp_stacks/bbr.c:2925–3021  ·  view source on GitHub ↗

* Returns the bw from either the b/w filter * or from the lt_bw (if the connection is being * policed). */

Source from the content-addressed store, hash-verified

2923 * policed).
2924 */
2925static inline uint64_t
2926__bbr_get_bw(struct tcp_bbr *bbr)
2927{
2928 uint64_t bw, min_bw;
2929 uint64_t rtt;
2930 int gm_measure_cnt = 1;
2931
2932 /*
2933 * For startup we make, like google, a
2934 * minimum b/w. This is generated from the
2935 * IW and the rttProp. We do fall back to srtt
2936 * if for some reason (initial handshake) we don't
2937 * have a rttProp. We, in the worst case, fall back
2938 * to the configured min_bw (rc_initial_hptsi_bw).
2939 */
2940 if (bbr->rc_bbr_state == BBR_STATE_STARTUP) {
2941 /* Attempt first to use rttProp */
2942 rtt = (uint64_t)get_filter_value_small(&bbr->r_ctl.rc_rttprop);
2943 if (rtt && (rtt < 0xffffffff)) {
2944measure:
2945 min_bw = (uint64_t)(bbr_initial_cwnd(bbr, bbr->rc_tp)) *
2946 ((uint64_t)1000000);
2947 min_bw /= rtt;
2948 if (min_bw < bbr->r_ctl.rc_initial_hptsi_bw) {
2949 min_bw = bbr->r_ctl.rc_initial_hptsi_bw;
2950 }
2951
2952 } else if (bbr->rc_tp->t_srtt != 0) {
2953 /* No rttProp, use srtt? */
2954 rtt = bbr_get_rtt(bbr, BBR_SRTT);
2955 goto measure;
2956 } else {
2957 min_bw = bbr->r_ctl.rc_initial_hptsi_bw;
2958 }
2959 } else
2960 min_bw = 0;
2961
2962 if ((bbr->rc_past_init_win == 0) &&
2963 (bbr->r_ctl.rc_delivered > bbr_initial_cwnd(bbr, bbr->rc_tp)))
2964 bbr->rc_past_init_win = 1;
2965 if ((bbr->rc_use_google) && (bbr->r_ctl.r_measurement_count >= 1))
2966 gm_measure_cnt = 0;
2967 if (gm_measure_cnt &&
2968 ((bbr->r_ctl.r_measurement_count < bbr_min_measurements_req) ||
2969 (bbr->rc_past_init_win == 0))) {
2970 /* For google we use our guess rate until we get 1 measurement */
2971
2972use_initial_window:
2973 rtt = (uint64_t)get_filter_value_small(&bbr->r_ctl.rc_rttprop);
2974 if (rtt && (rtt < 0xffffffff)) {
2975 /*
2976 * We have an RTT measurment. Use that in
2977 * combination with our initial window to calculate
2978 * a b/w.
2979 */
2980 bw = (uint64_t)(bbr_initial_cwnd(bbr, bbr->rc_tp)) *
2981 ((uint64_t)1000000);
2982 bw /= rtt;

Callers 1

bbr_get_bwFunction · 0.85

Calls 5

get_filter_value_smallFunction · 0.85
bbr_initial_cwndFunction · 0.85
bbr_get_rttFunction · 0.85
get_filter_valueFunction · 0.85
uqminFunction · 0.85

Tested by

no test coverage detected