From: Kohei Enju <kohei@enjuk.jp>
To: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
Willem de Bruijn <willemb@google.com>,
David Ahern <dsahern@kernel.org>,
Neal Cardwell <ncardwell@google.com>,
Gerhard Engleder <gerhard@engleder-embedded.com>,
Jonathan Lemon <jonathan.lemon@gmail.com>,
Richard Cochran <richardcochran@gmail.com>
Subject: Re: [PATCH net v1 3/3] tcp: use skb_get_hwtstamp() for hardware timestamps
Date: Thu, 30 Apr 2026 15:52:47 +0900 [thread overview]
Message-ID: <afL4RF8bqtCKCt95@x1> (raw)
In-Reply-To: <CANn89i+0iK-Ci+Gokq5VW+SCvQLyA4vjairsf422P6hjZErquw@mail.gmail.com>
On 04/29 23:09, Eric Dumazet wrote:
> On Wed, Apr 29, 2026 at 10:07 PM Kohei Enju <kohei@enjuk.jp> wrote:
> >
> > On 04/29 17:09, Willem de Bruijn wrote:
> > > Kohei Enju wrote:
> > > > Since commit 97dc7cd92ac6 ("ptp: Support late timestamp determination"),
> > > > skb_shared_hwtstamps may contain netdev_data instead of hwtstamp. TCP
> > > > receive timestamping can then interpret the stored value as a ktime_t
> > > > and report bogus hardware timestamps to userspace.
> > > >
> > > > Use skb_get_hwtstamp() instead of reading hwtstamp directly, so TCP
> > > > sockets follow the same hardware timestamp resolution path as the socket
> > > > layer. When coalescing SKBs, resolve late timestamps before copying them
> > > > to the merged skb.
> > >
> > > Why? Does this preclude supporting SOF_TIMESTAMPING_BIND_PHC for such
> > > sockets at a later time?
> >
> > You're right. If we want to keep the door open for
> > SOF_TIMESTAMPING_BIND_PHC on coalesced skbs, resolving the timestamp at
> > coalescing time is the wrong approach.
> >
> > >
> > > It is just as easy to coalesce the cookie as the htwtstamp.
> > >
> > > That also avoids the need to mask out SKBTX_HW_TSTAMP_NETDEV.
> >
> > Indeed. We should also carry the matching @napi_id, since
> > skb_get_hwtstamp() uses it for late resolution.
> >
> > I'll update this in v2.
>
> Do you plan adding a selftest ?
>
> I am confused by your series, a test would really help clarify the
> issue at hand.
Yes, I agree a selftest would help.
Since this issue is only triggered with drivers that use late RX
timestamp determination (SKBTX_HW_TSTAMP_NETDEV / ndo_get_tstamp), it
would likely need to live under tools/testing/selftests/drivers/net/hw/
rather than as a generic net selftest. I'm looking into whether I can
add such a test.
Either way, I'll expand the cover letter to explain the issue in more
detail. Sorry for the confusion.
prev parent reply other threads:[~2026-04-30 6:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 9:16 [PATCH net v1 0/3] af_packet/tcp: fix late hardware timestamp handling Kohei Enju
2026-04-29 9:16 ` [PATCH net v1 1/3] net: introduce helper to resolve hardware timestamps from skb Kohei Enju
2026-04-29 21:04 ` Willem de Bruijn
2026-04-30 4:50 ` Kohei Enju
2026-05-01 20:25 ` Gerhard Engleder
2026-04-29 9:16 ` [PATCH net v1 2/3] af_packet: use skb_get_hwtstamp() for hardware timestamps Kohei Enju
2026-04-29 9:16 ` [PATCH net v1 3/3] tcp: " Kohei Enju
2026-04-29 21:09 ` Willem de Bruijn
2026-04-30 5:07 ` Kohei Enju
2026-04-30 6:09 ` Eric Dumazet
2026-04-30 6:52 ` Kohei Enju [this message]
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=afL4RF8bqtCKCt95@x1 \
--to=kohei@enjuk.jp \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gerhard@engleder-embedded.com \
--cc=horms@kernel.org \
--cc=jonathan.lemon@gmail.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.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