From dfd3aa17295296d6d3cdaab4128099d3dee16abc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 22 Nov 2022 11:09:16 +0000 Subject: [PATCH] ANDROID: rename struct tcm_sock.cwnd_usage_seq to fix ABI In commit 49d429760df7 ("tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited"), the field max_packets_seq in struct tcm_sock was renamed to cwnd_usage_seq, which broke the ABI. Keep the same logic in the bugfix, but rename the field back to preserve the ABI. Bug: 161946584 Fixes: 49d429760df7 ("tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited") Signed-off-by: Greg Kroah-Hartman Change-Id: I9ffb10be63a22c36d5864feea794dde390ef69a1 --- include/linux/tcp.h | 7 ++++++- net/ipv4/tcp_output.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/linux/tcp.h b/include/linux/tcp.h index c54be4467977..2caa911f4b54 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -266,7 +266,12 @@ struct tcp_sock { u32 packets_out; /* Packets which are "in flight" */ u32 retrans_out; /* Retransmitted packets out */ u32 max_packets_out; /* max packets_out in last window */ - u32 cwnd_usage_seq; /* right edge of cwnd usage tracking flight */ + /* ANDROID: + * max_packets_seq is really cwnd_usage_seq upstream, old name kept + * to preserve ABI due to changes in commit 49d429760df7 ("tcp: fix + * tcp_cwnd_validate() to not forget is_cwnd_limited") + */ + u32 max_packets_seq; /* right edge of cwnd usage tracking flight */ u16 urg_data; /* Saved octet of OOB data and control flags */ u8 ecn_flags; /* ECN status bits. */ diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 33ba1268a111..0ac9b85d2b24 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1885,13 +1885,13 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited) * chose to not update tp->max_packets_out to avoid an extra else * clause with no functional impact.) */ - if (!before(tp->snd_una, tp->cwnd_usage_seq) || + if (!before(tp->snd_una, tp->max_packets_seq) || is_cwnd_limited || (!tp->is_cwnd_limited && tp->packets_out > tp->max_packets_out)) { tp->is_cwnd_limited = is_cwnd_limited; tp->max_packets_out = tp->packets_out; - tp->cwnd_usage_seq = tp->snd_nxt; + tp->max_packets_seq= tp->snd_nxt; } if (tcp_is_cwnd_limited(sk)) {