[SRU][noble:linux-gcp][PATCH v2 1/2] tcp: derive delack_max with tcp_rto_min helper

Vinicius Peixoto vinicius.peixoto at canonical.com
Wed Aug 14 15:09:15 UTC 2024


From: Kevin Yang <yyd at google.com>

BugLink: https://bugs.launchpad.net/bugs/2076950

Rto_min now has multiple sources, ordered by preprecedence high to
low: ip route option rto_min, icsk->icsk_rto_min.

When derive delack_max from rto_min, we should not only use ip
route option, but should use tcp_rto_min helper to get the correct
rto_min.

Signed-off-by: Kevin Yang <yyd at google.com>
Reviewed-by: Neal Cardwell <ncardwell at google.com>
Reviewed-by: Yuchung Cheng <ycheng at google.com>
Reviewed-by: Eric Dumazet <edumazet at google.com>
Reviewed-by: Tony Lu <tonylu at linux.alibaba.com>
Reviewed-by: Jakub Kicinski <kuba at kernel.org>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry-picked from commit 512bd0f9f926a05c724a9fd72bc4e14213845e01)
Signed-off-by: Vinicius Peixoto <vinicius.peixoto at canonical.com>
---
 net/ipv4/tcp_output.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 02caeb7bcf63..4ea34079acfe 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -4124,16 +4124,9 @@ EXPORT_SYMBOL(tcp_connect);
 
 u32 tcp_delack_max(const struct sock *sk)
 {
-	const struct dst_entry *dst = __sk_dst_get(sk);
-	u32 delack_max = inet_csk(sk)->icsk_delack_max;
-
-	if (dst && dst_metric_locked(dst, RTAX_RTO_MIN)) {
-		u32 rto_min = dst_metric_rtt(dst, RTAX_RTO_MIN);
-		u32 delack_from_rto_min = max_t(int, 1, rto_min - 1);
+	u32 delack_from_rto_min = max(tcp_rto_min(sk), 2) - 1;
 
-		delack_max = min_t(u32, delack_max, delack_from_rto_min);
-	}
-	return delack_max;
+	return min(inet_csk(sk)->icsk_delack_max, delack_from_rto_min);
 }
 
 /* Send out a delayed ack, the caller does the policy checking
-- 
2.43.0




More information about the kernel-team mailing list