Skip to contentSkip to conversation

tcp: fix rate_app_limited to default to 1

PATCH Applied David Morley 3 participants 3 messages Jan 19, 2023 – Jan 20, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp: fix rate_app_limited to default to 1

From: David Morley <[email protected]>

The initial default value of 0 for tp->rate_app_limited was incorrect, since a flow is indeed application-limited until it first sends data. Fixing the default to be 1 is generally correct but also specifically will help user-space applications avoid using the initial tcpi_delivery_rate value of 0 that persists until the connection has some non-zero bandwidth sample.

Fixes eb8329e0a04d ("tcp: export data delivery rate")
---
 net/ipv4/tcp.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/tcp.c +2 -0
index c567d5e8053e..33f559f491c8 100644
@@ -435,6 +435,7 @@ void tcp_init_sock(struct sock *sk)
 
 	/* There's a bubble in the pipe until at least the first ACK. */
 	tp->app_limited = ~0U;
+	tp->rate_app_limited = 1;
 
 	/* See draft-stevens-tcpca-spec-01 for discussion of the
 	 * initialization of these values.
@@ -3178,6 +3179,7 @@ int tcp_disconnect(struct sock *sk, int flags)
 	tp->plb_rehash = 0;
 	/* There's a bubble in the pipe until at least the first ACK. */
 	tp->app_limited = ~0U;
+	tp->rate_app_limited = 1;
 	tp->rack.mstamp = 0;
 	tp->rack.advanced = 0;
 	tp->rack.reo_wnd_steps = 1;
Signature · 1 line
2.39.0.246.g2a6d74b583-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · David Morley

From: David Morley <[email protected]>

The initial default value of 0 for tp->rate_app_limited was incorrect, since a flow is indeed application-limited until it first sends data. Fixing the default to be 1 is generally correct but also specifically will help user-space applications avoid using the initial tcpi_delivery_rate value of 0 that persists until the connection has some non-zero bandwidth sample.

Quoted 5 lines
Fixes eb8329e0a04d ("tcp: export data delivery rate")

Thanks.

#2 lore raw
In reply to David Morley
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 10 lines · On Thu, 19 Jan 2023 19:00:28 +0000 you wrote:

From: David Morley <[email protected]>

The initial default value of 0 for tp->rate_app_limited was incorrect, since a flow is indeed application-limited until it first sends data. Fixing the default to be 1 is generally correct but also specifically will help user-space applications avoid using the initial tcpi_delivery_rate value of 0 that persists until the connection has some non-zero bandwidth sample.

[...]

Here is the summary with links:
- [net] tcp: fix rate_app_limited to default to 1

    https://git.kernel.org/netdev/net/c/300b655db1b5

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html