mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mengensun88@gmail.com
To: edumazet@google.com
Cc: dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, yuehongwu@tencent.com,
	MengEn Sun <mengensun@tencent.com>
Subject: [PATCH] tcp: replace head->tstamp with head->skb_mstamp_ns in tcp_tso_should_defer()
Date: Wed,  4 Dec 2024 10:36:13 +0800	[thread overview]
Message-ID: <1733279773-32536-1-git-send-email-mengensun@tencent.com> (raw)

From: MengEn Sun <mengensun@tencent.com>

The tstamp field of sk_buff is intended to implement SO_TIMESTAMP*.
However, the skb in the RTX queue does not have this field set.
Using this field in tcp_tso_should_defer() can confuse readers of
the code.

Therefore, in this function, we replace tstamp with skb_mstamp_ns
to obtain the timestamp of when a packet is sent.

Reviewed-by: YueHong Wu <yuehongwu@tencent.com>
Signed-off-by: MengEn Sun <mengensun@tencent.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 68804fd01daf..d1d167c93a4f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2274,7 +2274,7 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb,
 	head = tcp_rtx_queue_head(sk);
 	if (!head)
 		goto send_now;
-	delta = tp->tcp_clock_cache - head->tstamp;
+	delta = tp->tcp_clock_cache - head->skb_mstamp_ns;
 	/* If next ACK is likely to come too late (half srtt), do not defer */
 	if ((s64)(delta - (u64)NSEC_PER_USEC * (tp->srtt_us >> 4)) < 0)
 		goto send_now;
-- 
2.43.5


             reply	other threads:[~2024-12-04  2:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04  2:36 mengensun88 [this message]
2024-12-04  7:21 ` Eric Dumazet
2024-12-04 11:00   ` MengEn Sun
2024-12-04 12: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=1733279773-32536-1-git-send-email-mengensun@tencent.com \
    --to=mengensun88@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mengensun@tencent.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yuehongwu@tencent.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

all inboxes | Powered by JetHome®