From: James Hilliard <james.hilliard1@gmail.com>
To: netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Richard Cochran <richardcochran@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Yangbo Lu <yangbo.lu@nxp.com>,
Miroslav Lichvar <mlichvar@redhat.com>
Cc: Eric Dumazet <edumazet@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
linux-kernel@vger.kernel.org,
James Hilliard <james.hilliard1@gmail.com>
Subject: [PATCH net v3 5/5] ptp: vclock: preserve missing hardware timestamps
Date: Tue, 13 Oct 2026 13:19:49 -0600 [thread overview]
Message-ID: <20261013-ptp-vclock-sampling-v3-5-d3ee4ea62fc6@gmail.com> (raw)
In-Reply-To: <20261013-ptp-vclock-sampling-v3-0-d3ee4ea62fc6@gmail.com>
Socket timestamp delivery converts hardware timestamps to a bound
virtual clock before checking whether a hardware timestamp is present.
A zero timestamp means that the packet has no hardware timestamp, but
timecounter_cyc2time() can turn that zero into a nonzero virtual time.
The socket then reports a hardware timestamp which was never supplied.
Return zero without conversion when the input timestamp is absent.
This also covers skb_get_tx_timestamp(), which checks for an absent
timestamp after the same conversion.
This was identified during review of virtual clock sampling changes.
Fixes: d7c088265588 ("net: socket: support hardware timestamp conversion to PHC bound")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/ptp/ptp_vclock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c
index 6675466bc307..4a62047f0ce0 100644
--- a/drivers/ptp/ptp_vclock.c
+++ b/drivers/ptp/ptp_vclock.c
@@ -307,6 +307,8 @@ ktime_t ptp_convert_timestamp(const ktime_t *hwtstamp, int vclock_index)
u64 ns;
ns = ktime_to_ns(*hwtstamp);
+ if (!ns)
+ return 0;
srcu_idx = srcu_read_lock(&vclock_srcu);
--
2.53.0
next prev parent reply other threads:[~2026-10-13 19:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 19:19 [PATCH net v3 0/5] ptp: make virtual clock sampling and teardown failure-safe James Hilliard
2026-10-13 19:19 ` [PATCH net v3 1/5] ptp: drain virtual clock sysfs operations before unregistering children James Hilliard
2026-10-13 19:46 ` Vadim Fedorenko
2026-10-13 19:19 ` [PATCH net v3 2/5] ptp: unwind partially completed virtual clock creation James Hilliard
2026-10-13 19:19 ` [PATCH net v3 3/5] ptp: vclock: propagate physical clock sampling errors James Hilliard
2026-10-13 19:19 ` [PATCH net v3 4/5] ptp: vclock: serialize extended samples with counter updates James Hilliard
2026-10-13 19:19 ` James Hilliard [this message]
2026-10-13 19:52 ` [PATCH net v3 5/5] ptp: vclock: preserve missing hardware timestamps Vadim Fedorenko
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=20261013-ptp-vclock-sampling-v3-5-d3ee4ea62fc6@gmail.com \
--to=james.hilliard1@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlichvar@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=yangbo.lu@nxp.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