netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: fix condition for increasing pingpong count
@ 2022-07-19 13:01 LemmyHuang
  2022-07-20  0:49 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: LemmyHuang @ 2022-07-19 13:01 UTC (permalink / raw)
  To: edumazet, davem, dsahern, kuba, pabeni; +Cc: netdev, linux-kernel, LemmyHuang

When CONFIG_HZ defaults to 1000Hz and the network transmission time is
less than 1ms, lsndtime and lrcvtime are likely to be equal, which will
lead to hundreds of interactions before entering pingpong mode.

Signed-off-by: LemmyHuang <hlm3280@163.com>
---
 net/ipv4/tcp_output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 858a15cc2..35ed65f80 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -172,7 +172,7 @@ static void tcp_event_data_sent(struct tcp_sock *tp,
 	 * and it is a reply for ato after last received packet,
 	 * increase pingpong count.
 	 */
-	if (before(tp->lsndtime, icsk->icsk_ack.lrcvtime) &&
+	if ((tp->lsndtime <= icsk->icsk_ack.lrcvtime) &&
 	    (u32)(now - icsk->icsk_ack.lrcvtime) < icsk->icsk_ack.ato)
 		inet_csk_inc_pingpong_cnt(sk);
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] tcp: fix condition for increasing pingpong count
  2022-07-19 13:01 [PATCH net-next] tcp: fix condition for increasing pingpong count LemmyHuang
@ 2022-07-20  0:49 ` Jakub Kicinski
  2022-07-20  6:47   ` LemmyHuang
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-07-20  0:49 UTC (permalink / raw)
  To: LemmyHuang; +Cc: edumazet, davem, dsahern, pabeni, netdev, linux-kernel

On Tue, 19 Jul 2022 21:01:37 +0800 LemmyHuang wrote:
> -	if (before(tp->lsndtime, icsk->icsk_ack.lrcvtime) &&
> +	if ((tp->lsndtime <= icsk->icsk_ack.lrcvtime) &&

Are you sure you don't need to take care of the values wrapping?
before() does that. You may want !after() if you want to allow equal.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] tcp: fix condition for increasing pingpong count
  2022-07-20  0:49 ` Jakub Kicinski
@ 2022-07-20  6:47   ` LemmyHuang
  0 siblings, 0 replies; 3+ messages in thread
From: LemmyHuang @ 2022-07-20  6:47 UTC (permalink / raw)
  To: kuba; +Cc: davem, dsahern, edumazet, hlm3280, linux-kernel, netdev, pabeni

At 2022-07-20 08:49:15, "Jakub Kicinski" <kuba@kernel.org> wrote:
> On Tue, 19 Jul 2022 21:01:37 +0800 LemmyHuang wrote:
>> -	if (before(tp->lsndtime, icsk->icsk_ack.lrcvtime) &&
>> +	if ((tp->lsndtime <= icsk->icsk_ack.lrcvtime) &&
>
> Are you sure you don't need to take care of the values wrapping?
> before() does that. You may want !after() if you want to allow equal.

Yeap, I will switch to that in v2.
Thank you!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-20  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-19 13:01 [PATCH net-next] tcp: fix condition for increasing pingpong count LemmyHuang
2022-07-20  0:49 ` Jakub Kicinski
2022-07-20  6:47   ` LemmyHuang

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).