netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: menglong8.dong@gmail.com
To: edumazet@google.com
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	dsahern@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Menglong Dong <imagedong@tencent.com>
Subject: [PATCH net-next 2/3] net: tcp: allow zero-window ACK update the window
Date: Thu, 27 Jul 2023 20:51:24 +0800	[thread overview]
Message-ID: <20230727125125.1194376-3-imagedong@tencent.com> (raw)
In-Reply-To: <20230727125125.1194376-1-imagedong@tencent.com>

From: Menglong Dong <imagedong@tencent.com>

Fow now, an ACK can update the window in following case, according to
the tcp_may_update_window():

1. the ACK acknowledged new data
2. the ACK has new data
3. the ACK expand the window and the seq of it is valid

Now, we allow the ACK update the window if the window is 0, and the
seq/ack of it is valid. This is for the case that the receiver replies
an zero-window ACK when it is under memory stress and can't queue the new
data.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
 net/ipv4/tcp_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 03111af6115d..d13b89370f76 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3526,7 +3526,7 @@ static inline bool tcp_may_update_window(const struct tcp_sock *tp,
 {
 	return	after(ack, tp->snd_una) ||
 		after(ack_seq, tp->snd_wl1) ||
-		(ack_seq == tp->snd_wl1 && nwin > tp->snd_wnd);
+		(ack_seq == tp->snd_wl1 && (nwin > tp->snd_wnd || !nwin));
 }
 
 /* If we update tp->snd_una, also update tp->bytes_acked */
-- 
2.40.1


  parent reply	other threads:[~2023-07-27 12:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 12:51 [PATCH net-next 0/3] net: tcp: support probing OOM menglong8.dong
2023-07-27 12:51 ` [PATCH net-next 1/3] net: tcp: send zero-window ACK when no memory menglong8.dong
2023-07-27 19:17   ` Eric Dumazet
2023-07-28  2:37     ` Menglong Dong
2023-07-27 12:51 ` menglong8.dong [this message]
2023-07-27 12:51 ` [PATCH net-next 3/3] net: tcp: check timeout by icsk->icsk_timeout in tcp_retransmit_timer() menglong8.dong
2023-07-27 19:31   ` Eric Dumazet
2023-07-28  2:57     ` Menglong Dong
2023-07-28  4:44       ` Neal Cardwell
2023-07-28  6:25         ` Menglong Dong
2023-07-28  8:50           ` Eric Dumazet
2023-07-28 14:25             ` Neal Cardwell
2023-07-28 17:15               ` Neal Cardwell
2023-07-31  3:41                 ` Menglong Dong
2023-07-31  9:49                 ` Menglong Dong
2023-07-31  3:28               ` Menglong Dong
2023-07-31  8:24               ` Menglong Dong

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=20230727125125.1194376-3-imagedong@tencent.com \
    --to=menglong8.dong@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=imagedong@tencent.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).