Skip to content

Commit 2490155

Browse files
edumazetdavem330
authored andcommitted
tcp: remove in_flight parameter from cong_avoid() methods
Commit e114a71 ("tcp: fix cwnd limited checking to improve congestion control") obsoleted in_flight parameter from tcp_is_cwnd_limited() and its callers. This patch does the removal as promised. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e114a71 commit 2490155

15 files changed

Lines changed: 36 additions & 48 deletions

‎include/net/tcp.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ struct tcp_congestion_ops {
796796
/* return slow start threshold (required) */
797797
u32 (*ssthresh)(struct sock *sk);
798798
/* do new cwnd calculation (required) */
799-
void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
799+
void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked);
800800
/* call before changing ca_state (optional) */
801801
void (*set_state)(struct sock *sk, u8 new_state);
802802
/* call when cwnd event occurs (optional) */
@@ -828,7 +828,7 @@ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
828828

829829
extern struct tcp_congestion_ops tcp_init_congestion_ops;
830830
u32 tcp_reno_ssthresh(struct sock *sk);
831-
void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
831+
void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked);
832832
extern struct tcp_congestion_ops tcp_reno;
833833

834834
static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -986,10 +986,8 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp)
986986
* risks 100% overshoot. The advantage is that we discourage application to
987987
* either send more filler packets or data to artificially blow up the cwnd
988988
* usage, and allow application-limited process to probe bw more aggressively.
989-
*
990-
* TODO: remove in_flight once we can fix all callers, and their callers...
991989
*/
992-
static inline bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
990+
static inline bool tcp_is_cwnd_limited(const struct sock *sk)
993991
{
994992
const struct tcp_sock *tp = tcp_sk(sk);
995993

‎net/ipv4/tcp_bic.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,12 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
140140
ca->cnt = 1;
141141
}
142142

143-
static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked,
144-
u32 in_flight)
143+
static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
145144
{
146145
struct tcp_sock *tp = tcp_sk(sk);
147146
struct bictcp *ca = inet_csk_ca(sk);
148147

149-
if (!tcp_is_cwnd_limited(sk, in_flight))
148+
if (!tcp_is_cwnd_limited(sk))
150149
return;
151150

152151
if (tp->snd_cwnd <= tp->snd_ssthresh)

‎net/ipv4/tcp_cong.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,11 @@ EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai);
317317
/* This is Jacobson's slow start and congestion avoidance.
318318
* SIGCOMM '88, p. 328.
319319
*/
320-
void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight)
320+
void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked)
321321
{
322322
struct tcp_sock *tp = tcp_sk(sk);
323323

324-
if (!tcp_is_cwnd_limited(sk, in_flight))
324+
if (!tcp_is_cwnd_limited(sk))
325325
return;
326326

327327
/* In "safe" area, increase. */

‎net/ipv4/tcp_cubic.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,12 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
304304
ca->cnt = 1;
305305
}
306306

307-
static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked,
308-
u32 in_flight)
307+
static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
309308
{
310309
struct tcp_sock *tp = tcp_sk(sk);
311310
struct bictcp *ca = inet_csk_ca(sk);
312311

313-
if (!tcp_is_cwnd_limited(sk, in_flight))
312+
if (!tcp_is_cwnd_limited(sk))
314313
return;
315314

316315
if (tp->snd_cwnd <= tp->snd_ssthresh) {

‎net/ipv4/tcp_highspeed.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ static void hstcp_init(struct sock *sk)
109109
tp->snd_cwnd_clamp = min_t(u32, tp->snd_cwnd_clamp, 0xffffffff/128);
110110
}
111111

112-
static void hstcp_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight)
112+
static void hstcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
113113
{
114114
struct tcp_sock *tp = tcp_sk(sk);
115115
struct hstcp *ca = inet_csk_ca(sk);
116116

117-
if (!tcp_is_cwnd_limited(sk, in_flight))
117+
if (!tcp_is_cwnd_limited(sk))
118118
return;
119119

120120
if (tp->snd_cwnd <= tp->snd_ssthresh)

‎net/ipv4/tcp_htcp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ static u32 htcp_recalc_ssthresh(struct sock *sk)
227227
return max((tp->snd_cwnd * ca->beta) >> 7, 2U);
228228
}
229229

230-
static void htcp_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight)
230+
static void htcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
231231
{
232232
struct tcp_sock *tp = tcp_sk(sk);
233233
struct htcp *ca = inet_csk_ca(sk);
234234

235-
if (!tcp_is_cwnd_limited(sk, in_flight))
235+
if (!tcp_is_cwnd_limited(sk))
236236
return;
237237

238238
if (tp->snd_cwnd <= tp->snd_ssthresh)

‎net/ipv4/tcp_hybla.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ static inline u32 hybla_fraction(u32 odds)
8787
* o Give cwnd a new value based on the model proposed
8888
* o remember increments <1
8989
*/
90-
static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 acked,
91-
u32 in_flight)
90+
static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 acked)
9291
{
9392
struct tcp_sock *tp = tcp_sk(sk);
9493
struct hybla *ca = inet_csk_ca(sk);
@@ -101,11 +100,11 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 acked,
101100
ca->minrtt_us = tp->srtt_us;
102101
}
103102

104-
if (!tcp_is_cwnd_limited(sk, in_flight))
103+
if (!tcp_is_cwnd_limited(sk))
105104
return;
106105

107106
if (!ca->hybla_en) {
108-
tcp_reno_cong_avoid(sk, ack, acked, in_flight);
107+
tcp_reno_cong_avoid(sk, ack, acked);
109108
return;
110109
}
111110

‎net/ipv4/tcp_illinois.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ static void tcp_illinois_state(struct sock *sk, u8 new_state)
255255
/*
256256
* Increase window in response to successful acknowledgment.
257257
*/
258-
static void tcp_illinois_cong_avoid(struct sock *sk, u32 ack, u32 acked,
259-
u32 in_flight)
258+
static void tcp_illinois_cong_avoid(struct sock *sk, u32 ack, u32 acked)
260259
{
261260
struct tcp_sock *tp = tcp_sk(sk);
262261
struct illinois *ca = inet_csk_ca(sk);
@@ -265,7 +264,7 @@ static void tcp_illinois_cong_avoid(struct sock *sk, u32 ack, u32 acked,
265264
update_params(sk);
266265

267266
/* RFC2861 only increase cwnd if fully utilized */
268-
if (!tcp_is_cwnd_limited(sk, in_flight))
267+
if (!tcp_is_cwnd_limited(sk))
269268
return;
270269

271270
/* In slow start */

‎net/ipv4/tcp_input.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2938,10 +2938,11 @@ static void tcp_synack_rtt_meas(struct sock *sk, const u32 synack_stamp)
29382938
tcp_ack_update_rtt(sk, FLAG_SYN_ACKED, seq_rtt_us, -1L);
29392939
}
29402940

2941-
static void tcp_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight)
2941+
static void tcp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
29422942
{
29432943
const struct inet_connection_sock *icsk = inet_csk(sk);
2944-
icsk->icsk_ca_ops->cong_avoid(sk, ack, acked, in_flight);
2944+
2945+
icsk->icsk_ca_ops->cong_avoid(sk, ack, acked);
29452946
tcp_sk(sk)->snd_cwnd_stamp = tcp_time_stamp;
29462947
}
29472948

@@ -3364,7 +3365,6 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
33643365
u32 ack_seq = TCP_SKB_CB(skb)->seq;
33653366
u32 ack = TCP_SKB_CB(skb)->ack_seq;
33663367
bool is_dupack = false;
3367-
u32 prior_in_flight;
33683368
u32 prior_fackets;
33693369
int prior_packets = tp->packets_out;
33703370
const int prior_unsacked = tp->packets_out - tp->sacked_out;
@@ -3397,7 +3397,6 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
33973397
flag |= FLAG_SND_UNA_ADVANCED;
33983398

33993399
prior_fackets = tp->fackets_out;
3400-
prior_in_flight = tcp_packets_in_flight(tp);
34013400

34023401
/* ts_recent update must be made after we are sure that the packet
34033402
* is in window.
@@ -3452,7 +3451,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
34523451

34533452
/* Advance cwnd if state allows */
34543453
if (tcp_may_raise_cwnd(sk, flag))
3455-
tcp_cong_avoid(sk, ack, acked, prior_in_flight);
3454+
tcp_cong_avoid(sk, ack, acked);
34563455

34573456
if (tcp_ack_is_dubious(sk, flag)) {
34583457
is_dupack = !(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP));

‎net/ipv4/tcp_lp.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,12 @@ static void tcp_lp_init(struct sock *sk)
115115
* Will only call newReno CA when away from inference.
116116
* From TCP-LP's paper, this will be handled in additive increasement.
117117
*/
118-
static void tcp_lp_cong_avoid(struct sock *sk, u32 ack, u32 acked,
119-
u32 in_flight)
118+
static void tcp_lp_cong_avoid(struct sock *sk, u32 ack, u32 acked)
120119
{
121120
struct lp *lp = inet_csk_ca(sk);
122121

123122
if (!(lp->flag & LP_WITHIN_INF))
124-
tcp_reno_cong_avoid(sk, ack, acked, in_flight);
123+
tcp_reno_cong_avoid(sk, ack, acked);
125124
}
126125

127126
/**

0 commit comments

Comments
 (0)