diff mbox series

[net] tcp: fix rate_app_limited to default to 1

Message ID 20230119190028.1098755-1-morleyd.kernel@gmail.com (mailing list archive)
State Accepted
Commit 300b655db1b5152d6101bcb6801d50899b20c2d6
Delegated to: Netdev Maintainers
Headers show
Series [net] tcp: fix rate_app_limited to default to 1 | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 24 this patch: 24
netdev/cc_maintainers fail 2 blamed authors not CCed: soheil@google.com nanditad@google.com; 5 maintainers not CCed: yoshfuji@linux-ipv6.org soheil@google.com dsahern@kernel.org pabeni@redhat.com nanditad@google.com
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 22 this patch: 22
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

David Morley Jan. 19, 2023, 7 p.m. UTC
From: David Morley <morleyd@google.com>

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")
Suggested-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David Morley <morleyd@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Tested-by: David Morley <morleyd@google.com>
---
 net/ipv4/tcp.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Eric Dumazet Jan. 19, 2023, 7:28 p.m. UTC | #1
On Thu, Jan 19, 2023 at 8:00 PM David Morley <morleyd.kernel@gmail.com> wrote:
>
> From: David Morley <morleyd@google.com>
>
> 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")
> Suggested-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: David Morley <morleyd@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Tested-by: David Morley <morleyd@google.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>

Thanks.
patchwork-bot+netdevbpf@kernel.org Jan. 20, 2023, 1:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 19 Jan 2023 19:00:28 +0000 you wrote:
> From: David Morley <morleyd@google.com>
> 
> 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!
diff mbox series

Patch

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index c567d5e8053e..33f559f491c8 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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;