hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/net/ipv4/tcp_yeah.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 *
34 * YeAH TCP
....@@ -35,8 +36,6 @@
3536
3637 u32 reno_count;
3738 u32 fast_count;
38
-
39
- u32 pkts_acked;
4039 };
4140
4241 static void tcp_yeah_init(struct sock *sk)
....@@ -56,18 +55,6 @@
5655 tp->snd_cwnd_clamp = min_t(u32, tp->snd_cwnd_clamp, 0xffffffff/128);
5756 }
5857
59
-static void tcp_yeah_pkts_acked(struct sock *sk,
60
- const struct ack_sample *sample)
61
-{
62
- const struct inet_connection_sock *icsk = inet_csk(sk);
63
- struct yeah *yeah = inet_csk_ca(sk);
64
-
65
- if (icsk->icsk_ca_state == TCP_CA_Open)
66
- yeah->pkts_acked = sample->pkts_acked;
67
-
68
- tcp_vegas_pkts_acked(sk, sample);
69
-}
70
-
7158 static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked)
7259 {
7360 struct tcp_sock *tp = tcp_sk(sk);
....@@ -76,24 +63,19 @@
7663 if (!tcp_is_cwnd_limited(sk))
7764 return;
7865
79
- if (tcp_in_slow_start(tp))
80
- tcp_slow_start(tp, acked);
66
+ if (tcp_in_slow_start(tp)) {
67
+ acked = tcp_slow_start(tp, acked);
68
+ if (!acked)
69
+ goto do_vegas;
70
+ }
8171
82
- else if (!yeah->doing_reno_now) {
72
+ if (!yeah->doing_reno_now) {
8373 /* Scalable */
84
-
85
- tp->snd_cwnd_cnt += yeah->pkts_acked;
86
- if (tp->snd_cwnd_cnt > min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT)) {
87
- if (tp->snd_cwnd < tp->snd_cwnd_clamp)
88
- tp->snd_cwnd++;
89
- tp->snd_cwnd_cnt = 0;
90
- }
91
-
92
- yeah->pkts_acked = 1;
93
-
74
+ tcp_cong_avoid_ai(tp, min(tp->snd_cwnd, TCP_SCALABLE_AI_CNT),
75
+ acked);
9476 } else {
9577 /* Reno */
96
- tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1);
78
+ tcp_cong_avoid_ai(tp, tp->snd_cwnd, acked);
9779 }
9880
9981 /* The key players are v_vegas.beg_snd_una and v_beg_snd_nxt.
....@@ -117,7 +99,7 @@
11799 * of bytes we send in an RTT is often less than our cwnd will allow.
118100 * So we keep track of our cwnd separately, in v_beg_snd_cwnd.
119101 */
120
-
102
+do_vegas:
121103 if (after(ack, yeah->vegas.beg_snd_nxt)) {
122104 /* We do the Vegas calculations only if we got enough RTT
123105 * samples that we can be reasonably sure that we got
....@@ -231,7 +213,7 @@
231213 .set_state = tcp_vegas_state,
232214 .cwnd_event = tcp_vegas_cwnd_event,
233215 .get_info = tcp_vegas_get_info,
234
- .pkts_acked = tcp_yeah_pkts_acked,
216
+ .pkts_acked = tcp_vegas_pkts_acked,
235217
236218 .owner = THIS_MODULE,
237219 .name = "yeah",