From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v2 net-next 1/7] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access
Date: Sun, 09 Aug 2026 03:19:05 +0000 [thread overview]
Message-ID: <20260809031906.1439B1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260808032146.2335723-3-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The external timestamp event handler loop drains the hardware registers but only publishes the last event, silently dropping all preceding valid hardware timestamps. This problem wasn't introduced by this patch, but it remains a significant logic error.
--
--- Patch [1]: [PATCH v2 net-next 1/7] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access ---
commit 20c67a6850880b0f14f8d15d3feff060e9651e26
Author: Wei Fang <wei.fang@nxp.com>
ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access
This patch refactors the 64-bit register accesses in the ptp_netc driver by
using the standard ioread64_lo_hi and iowrite64_lo_hi helpers. It introduces
netc_timer_rd64 and netc_timer_wr64 macros to reduce boilerplate and replace
open-coded register sequences.
> diff --git a/drivers/ptp/ptp_netc.c b/drivers/ptp/ptp_netc.c
> index 1c20d7efab929..0e0972596d880 100644
> --- a/drivers/ptp/ptp_netc.c
> +++ b/drivers/ptp/ptp_netc.c
[ ... ]
> @@ -497,22 +470,19 @@ static void netc_timer_handle_etts_event(struct netc_timer *priv, int index,
> bool update_event)
> {
> struct ptp_clock_event event;
> - u32 etts_l = 0, etts_h = 0;
> + u64 etts = 0;
>
> - while (netc_timer_rd(priv, NETC_TMR_STAT) & TMR_STAT_ETS_VLD(index)) {
> - etts_l = netc_timer_rd(priv, NETC_TMR_ETTS_L(index));
> - etts_h = netc_timer_rd(priv, NETC_TMR_ETTS_H(index));
> - }
> + while (netc_timer_rd(priv, NETC_TMR_STAT) & TMR_STAT_ETS_VLD(index))
> + etts = netc_timer_rd64(priv, NETC_TMR_ETTS_L(index));
[Severity: High]
This isn't a bug introduced by this patch, but does this loop
unintentionally drop valid hardware timestamps?
In drivers/ptp/ptp_netc.c:netc_timer_handle_etts_event(), when multiple
timestamp events are latched in the hardware before the interrupt is fully
serviced, the while loop drains all pending events from the hardware
registers but only saves the final read into the local etts variable.
Since ptp_clock_event() is called outside the while loop, all preceding
timestamps appear to be silently discarded. Should ptp_clock_event() be
called from inside the loop to ensure every captured timestamp is reported
to the PTP subsystem?
>
> /* Invalid time stamp */
> - if (!etts_l && !etts_h)
> + if (!etts)
> return;
>
> if (update_event) {
> event.type = PTP_CLOCK_EXTTS;
> event.index = index;
> - event.timestamp = (u64)etts_h << 32;
> - event.timestamp |= etts_l;
> + event.timestamp = etts;
> ptp_clock_event(priv->clock, &event);
> }
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260808032146.2335723-1-wei.fang@oss.nxp.com?part=1
next prev parent reply other threads:[~2026-08-09 3:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 3:21 [PATCH v2 net-next 0/7] net: dsa: netc: add PTP support for NETC switch wei.fang
2026-08-08 3:21 ` [PATCH] net: dsa: netc: add PTP one-step timestamping support wei.fang
2026-08-08 3:26 ` Wei Fang
2026-08-08 3:21 ` [PATCH v2 net-next 1/7] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access wei.fang
2026-08-09 3:19 ` sashiko-bot [this message]
2026-08-08 3:21 ` [PATCH v2 net-next 2/7] ptp: netc: remove unnecessary pcie_flr() call in probe wei.fang
2026-08-09 3:19 ` sashiko-bot
2026-08-08 3:21 ` [PATCH v2 net-next 3/7] ptp: netc: export netc_timer_get_current_time() for cross-driver use wei.fang
2026-08-09 3:19 ` sashiko-bot
2026-08-10 1:30 ` Wei Fang (OSS)
2026-08-08 3:21 ` [PATCH v2 net-next 4/7] net: dsa: netc: use entry ID instead of pointer to track host flood rule wei.fang
2026-08-08 3:21 ` [PATCH v2 net-next 5/7] net: dsa: netc: enable ingress port filtering lookup by default wei.fang
2026-08-09 3:19 ` sashiko-bot
2026-08-10 2:40 ` Wei Fang (OSS)
2026-08-08 3:21 ` [PATCH v2 net-next 6/7] net: dsa: netc: add PTP two-step timestamping support wei.fang
2026-08-09 3:19 ` sashiko-bot
2026-08-10 3:33 ` Wei Fang (OSS)
2026-08-08 3:21 ` [PATCH v2 net-next 7/7] net: dsa: netc: add PTP one-step " wei.fang
2026-08-09 3:19 ` sashiko-bot
2026-08-10 7:31 ` Wei Fang (OSS)
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=20260809031906.1439B1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.fang@oss.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