netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	Neal Cardwell <ncardwell@google.com>
Cc: Simon Horman <horms@kernel.org>,
	Kuniyuki Iwashima <kuniyu@amazon.com>,
	 Rick Jones <jonesrick@google.com>, Wei Wang <weiwan@google.com>,
	netdev@vger.kernel.org,  eric.dumazet@gmail.com,
	Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 06/11] tcp: fix initial tp->rcvq_space.space value for passive TS enabled flows
Date: Tue, 13 May 2025 19:39:14 +0000	[thread overview]
Message-ID: <20250513193919.1089692-7-edumazet@google.com> (raw)
In-Reply-To: <20250513193919.1089692-1-edumazet@google.com>

tcp_rcv_state_process() must tweak tp->advmss for TS enabled flows
before the call to tcp_init_transfer() / tcp_init_buffer_space().

Otherwise tp->rcvq_space.space is off by 120 bytes
(TCP_INIT_CWND * TCPOLEN_TSTAMP_ALIGNED).

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Wei Wang <weiwan@google.com>
---
 net/ipv4/tcp_input.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index f3eae8f5ad2b6c5602542a1083328f71ec8cbded..32b8b332c7d82e8c6a0716b26f2e048d68667864 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6872,6 +6872,9 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 		if (!tp->srtt_us)
 			tcp_synack_rtt_meas(sk, req);
 
+		if (tp->rx_opt.tstamp_ok)
+			tp->advmss -= TCPOLEN_TSTAMP_ALIGNED;
+
 		if (req) {
 			tcp_rcv_synrecv_state_fastopen(sk);
 		} else {
@@ -6897,9 +6900,6 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 		tp->snd_wnd = ntohs(th->window) << tp->rx_opt.snd_wscale;
 		tcp_init_wl(tp, TCP_SKB_CB(skb)->seq);
 
-		if (tp->rx_opt.tstamp_ok)
-			tp->advmss -= TCPOLEN_TSTAMP_ALIGNED;
-
 		if (!inet_csk(sk)->icsk_ca_ops->cong_control)
 			tcp_update_pacing_rate(sk);
 
-- 
2.49.0.1045.g170613ef41-goog


  parent reply	other threads:[~2025-05-13 19:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 19:39 [PATCH net-next 00/11] tcp: receive side improvements Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 01/11] tcp: add tcp_rcvbuf_grow() tracepoint Eric Dumazet
2025-05-14 15:30   ` David Ahern
2025-05-14 15:38     ` Eric Dumazet
2025-05-14 15:46       ` David Ahern
2025-05-14 16:33         ` Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 02/11] tcp: fix sk_rcvbuf overshoot Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 03/11] tcp: adjust rcvbuf in presence of reorders Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 04/11] tcp: add receive queue awareness in tcp_rcv_space_adjust() Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 05/11] tcp: remove zero TCP TS samples for autotuning Eric Dumazet
2025-05-13 19:39 ` Eric Dumazet [this message]
2025-05-13 19:39 ` [PATCH net-next 07/11] tcp: always seek for minimal rtt in tcp_rcv_rtt_update() Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 08/11] tcp: skip big rtt sample if receive queue is not empty Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 09/11] tcp: increase tcp_limit_output_bytes default value to 4MB Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 10/11] tcp: always use tcp_limit_output_bytes limitation Eric Dumazet
2025-05-13 19:39 ` [PATCH net-next 11/11] tcp: increase tcp_rmem[2] to 32 MB Eric Dumazet
2025-05-14 20:24   ` Jakub Kicinski
2025-05-14 20:53     ` Kuniyuki Iwashima
2025-05-14 21:20       ` Kuniyuki Iwashima
2025-05-14 21:26         ` Jakub Kicinski
2025-05-14 21:28           ` Kuniyuki Iwashima
2025-05-14 20:26 ` [PATCH net-next 00/11] tcp: receive side improvements Jakub Kicinski
2025-05-15 18:50 ` patchwork-bot+netdevbpf
2025-05-22 14:03 ` Daniel Borkmann
2025-05-22 14:11   ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250513193919.1089692-7-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --cc=jonesrick@google.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=weiwan@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).