tcp_bbr.c (bba73071b6f71be0a101658d7c13866e30b264a6) tcp_bbr.c (dcb8c9b4373a583451b1b8a3e916d33de273633d)
1/* Bottleneck Bandwidth and RTT (BBR) congestion control
2 *
3 * BBR congestion control computes the sending rate based on the delivery
4 * rate (throughput) estimated from ACKs. In a nutshell:
5 *
6 * On each ACK, update our model of the network path:
7 * bottleneck_bandwidth = windowed_max(delivered / elapsed, 10 round trips)
8 * min_rtt = windowed_min(rtt, 10 seconds)

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

256 u32 rate = bbr_bw_to_pacing_rate(sk, bw, gain);
257
258 if (unlikely(!bbr->has_seen_rtt && tp->srtt_us))
259 bbr_init_pacing_rate_from_rtt(sk);
260 if (bbr_full_bw_reached(sk) || rate > sk->sk_pacing_rate)
261 sk->sk_pacing_rate = rate;
262}
263
1/* Bottleneck Bandwidth and RTT (BBR) congestion control
2 *
3 * BBR congestion control computes the sending rate based on the delivery
4 * rate (throughput) estimated from ACKs. In a nutshell:
5 *
6 * On each ACK, update our model of the network path:
7 * bottleneck_bandwidth = windowed_max(delivered / elapsed, 10 round trips)
8 * min_rtt = windowed_min(rtt, 10 seconds)

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

256 u32 rate = bbr_bw_to_pacing_rate(sk, bw, gain);
257
258 if (unlikely(!bbr->has_seen_rtt && tp->srtt_us))
259 bbr_init_pacing_rate_from_rtt(sk);
260 if (bbr_full_bw_reached(sk) || rate > sk->sk_pacing_rate)
261 sk->sk_pacing_rate = rate;
262}
263
264/* Return count of segments we want in the skbs we send, or 0 for default. */
265static u32 bbr_tso_segs_goal(struct sock *sk)
264/* override sysctl_tcp_min_tso_segs */
265static u32 bbr_min_tso_segs(struct sock *sk)
266{
266{
267 struct bbr *bbr = inet_csk_ca(sk);
268
269 return bbr->tso_segs_goal;
267 return sk->sk_pacing_rate < (bbr_min_tso_rate >> 3) ? 1 : 2;
270}
271
272static void bbr_set_tso_segs_goal(struct sock *sk)
273{
274 struct tcp_sock *tp = tcp_sk(sk);
275 struct bbr *bbr = inet_csk_ca(sk);
268}
269
270static void bbr_set_tso_segs_goal(struct sock *sk)
271{
272 struct tcp_sock *tp = tcp_sk(sk);
273 struct bbr *bbr = inet_csk_ca(sk);
276 u32 min_segs;
274 u32 segs, bytes;
277
275
278 min_segs = sk->sk_pacing_rate < (bbr_min_tso_rate >> 3) ? 1 : 2;
279 bbr->tso_segs_goal = min(tcp_tso_autosize(sk, tp->mss_cache, min_segs),
280 0x7FU);
276 /* Sort of tcp_tso_autosize() but ignoring
277 * driver provided sk_gso_max_size.
278 */
279 bytes = min_t(u32, sk->sk_pacing_rate >> sk->sk_pacing_shift,
280 GSO_MAX_SIZE - 1 - MAX_TCP_HEADER);
281 segs = max_t(u32, bytes / tp->mss_cache, bbr_min_tso_segs(sk));
282
283 bbr->tso_segs_goal = min(segs, 0x7FU);
281}
282
283/* Save "last known good" cwnd so we can restore it after losses or PROBE_RTT */
284static void bbr_save_cwnd(struct sock *sk)
285{
286 struct tcp_sock *tp = tcp_sk(sk);
287 struct bbr *bbr = inet_csk_ca(sk);
288

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

931 .name = "bbr",
932 .owner = THIS_MODULE,
933 .init = bbr_init,
934 .cong_control = bbr_main,
935 .sndbuf_expand = bbr_sndbuf_expand,
936 .undo_cwnd = bbr_undo_cwnd,
937 .cwnd_event = bbr_cwnd_event,
938 .ssthresh = bbr_ssthresh,
284}
285
286/* Save "last known good" cwnd so we can restore it after losses or PROBE_RTT */
287static void bbr_save_cwnd(struct sock *sk)
288{
289 struct tcp_sock *tp = tcp_sk(sk);
290 struct bbr *bbr = inet_csk_ca(sk);
291

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

934 .name = "bbr",
935 .owner = THIS_MODULE,
936 .init = bbr_init,
937 .cong_control = bbr_main,
938 .sndbuf_expand = bbr_sndbuf_expand,
939 .undo_cwnd = bbr_undo_cwnd,
940 .cwnd_event = bbr_cwnd_event,
941 .ssthresh = bbr_ssthresh,
939 .tso_segs_goal = bbr_tso_segs_goal,
942 .min_tso_segs = bbr_min_tso_segs,
940 .get_info = bbr_get_info,
941 .set_state = bbr_set_state,
942};
943
944static int __init bbr_register(void)
945{
946 BUILD_BUG_ON(sizeof(struct bbr) > ICSK_CA_PRIV_SIZE);
947 return tcp_register_congestion_control(&tcp_bbr_cong_ops);

--- 16 unchanged lines hidden ---
943 .get_info = bbr_get_info,
944 .set_state = bbr_set_state,
945};
946
947static int __init bbr_register(void)
948{
949 BUILD_BUG_ON(sizeof(struct bbr) > ICSK_CA_PRIV_SIZE);
950 return tcp_register_congestion_control(&tcp_bbr_cong_ops);

--- 16 unchanged lines hidden ---