All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kelly Littlepage <kelly@klittlepage.com>
To: kuba@kernel.org
Cc: davem@davemloft.net, edumazet@google.com, iris@onechronos.com,
	kelly@onechronos.com, kuznet@ms2.inr.ac.ru, maloney@google.com,
	netdev@vger.kernel.org, soheil@google.com,
	willemdebruijn.kernel@gmail.com, yoshfuji@linux-ipv6.org,
	Kelly Littlepage <kelly@klittlepage.com>,
	Willem de Bruijn <willemb@google.com>
Subject: [PATCH v4] net: tcp: fix rx timestamp behavior for tcp_recvmsg
Date: Fri,  8 May 2020 19:58:46 +0000	[thread overview]
Message-ID: <MN2PR19MB36463B624F9DF2C29771E147B6A20@MN2PR19MB3646.namprd19.prod.outlook.com> (raw)
In-Reply-To: <20200508112920.141e722f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

From: Kelly Littlepage <kelly@onechronos.com>

The stated intent of the original commit is to is to "return the timestamp
corresponding to the highest sequence number data returned." The current
implementation returns the timestamp for the last byte of the last fully
read skb, which is not necessarily the last byte in the recv buffer. This
patch converts behavior to the original definition, and to the behavior of
the previous draft versions of commit 98aaa913b4ed ("tcp: Extend
SOF_TIMESTAMPING_RX_SOFTWARE to TCP recvmsg") which also match this
behavior.

Fixes: 98aaa913b4ed ("tcp: Extend SOF_TIMESTAMPING_RX_SOFTWARE to TCP recvmsg")
Co-developed-by: Iris Liu <iris@onechronos.com>
Signed-off-by: Iris Liu <iris@onechronos.com>
Signed-off-by: Kelly Littlepage <kelly@onechronos.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
---
Sending from an alternative email given the compliance footer that's
unavoidably attached to all emails from my primary account. The patch
itself is unchanged.

 net/ipv4/tcp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6d87de434377..e72bd651d21a 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2154,13 +2154,15 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
 			tp->urg_data = 0;
 			tcp_fast_path_check(sk);
 		}
-		if (used + offset < skb->len)
-			continue;
 
 		if (TCP_SKB_CB(skb)->has_rxtstamp) {
 			tcp_update_recv_tstamps(skb, &tss);
 			cmsg_flags |= 2;
 		}
+
+		if (used + offset < skb->len)
+			continue;
+
 		if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
 			goto found_fin_ok;
 		if (!(flags & MSG_PEEK))
-- 
2.26.2


  reply	other threads:[~2020-05-08 20:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04 16:29 [PATCH] net: tcp: fix rx timestamp behavior for tcp_recvmsg Kelly Littlepage
2020-05-05 20:23 ` Willem de Bruijn
2020-05-07 21:40   ` Willem de Bruijn
2020-05-08  0:50     ` [PATCH v2] net: tcp: fixes commit 98aaa913b4ed ("tcp: Extend SOF_TIMESTAMPING_RX_SOFTWARE to TCP recvmsg") Kelly Littlepage
2020-05-08 13:51       ` Willem de Bruijn
2020-05-08 14:23         ` [PATCH v3] net: tcp: fix rx timestamp behavior for tcp_recvmsg Kelly Littlepage
2020-05-08 14:45           ` Eric Dumazet
2020-05-08 14:56             ` Soheil Hassas Yeganeh
2020-05-08 15:31               ` Willem de Bruijn
2020-05-08 18:29           ` Jakub Kicinski
2020-05-08 19:58             ` Kelly Littlepage [this message]
2020-05-08 23:17               ` [PATCH v4] " Jakub Kicinski

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=MN2PR19MB36463B624F9DF2C29771E147B6A20@MN2PR19MB3646.namprd19.prod.outlook.com \
    --to=kelly@klittlepage.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=iris@onechronos.com \
    --cc=kelly@onechronos.com \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=maloney@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=soheil@google.com \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.