From: Pengcheng Yang <yangpc@wangsu.com>
To: Eric Dumazet <edumazet@google.com>,
Yuchung Cheng <ycheng@google.com>,
Neal Cardwell <ncardwell@google.com>,
netdev@vger.kernel.org
Cc: Pengcheng Yang <yangpc@wangsu.com>
Subject: [PATCH net-next] tcp: ensure to use the most recently sent skb when filling the rate sample
Date: Wed, 13 Apr 2022 18:54:04 +0800 [thread overview]
Message-ID: <1649847244-5738-1-git-send-email-yangpc@wangsu.com> (raw)
If an ACK (s)acks multiple skbs, we favor the information
from the most recently sent skb by choosing the skb with
the highest prior_delivered count.
But prior_delivered may be equal, because tp->delivered only
changes when receiving, which requires further comparison of
skb timestamp.
Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
---
net/ipv4/tcp_rate.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_rate.c b/net/ipv4/tcp_rate.c
index 617b818..ad893ad 100644
--- a/net/ipv4/tcp_rate.c
+++ b/net/ipv4/tcp_rate.c
@@ -86,7 +86,9 @@ void tcp_rate_skb_delivered(struct sock *sk, struct sk_buff *skb,
return;
if (!rs->prior_delivered ||
- after(scb->tx.delivered, rs->prior_delivered)) {
+ after(scb->tx.delivered, rs->prior_delivered) ||
+ (scb->tx.delivered == rs->prior_delivered &&
+ tcp_skb_timestamp_us(skb) > tp->first_tx_mstamp)) {
rs->prior_delivered_ce = scb->tx.delivered_ce;
rs->prior_delivered = scb->tx.delivered;
rs->prior_mstamp = scb->tx.delivered_mstamp;
--
1.8.3.1
next reply other threads:[~2022-04-13 10:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 10:54 Pengcheng Yang [this message]
2022-04-14 16:11 ` [PATCH net-next] tcp: ensure to use the most recently sent skb when filling the rate sample Neal Cardwell
2022-04-15 16:44 ` Pengcheng Yang
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=1649847244-5738-1-git-send-email-yangpc@wangsu.com \
--to=yangpc@wangsu.com \
--cc=edumazet@google.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=ycheng@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).