From: netdev-bot+sashiko@kernel.org
To: wei.fang@oss.nxp.com
Cc: xiaoning.wang@nxp.com, andrew@lunn.ch, olteanv@gmail.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
richardcochran@gmail.com, linusw@kernel.org,
linux@armlinux.org.uk, wei.fang@nxp.com, imx@lists.linux.dev,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v8 net-next 8/9] net: dsa: netc: add PTP two-step timestamping support
Date: Mon, 23 Nov 2026 05:05:38 +0000 [thread overview]
Message-ID: <179541033885.3135.10657211800089692875@kernel.org> (raw)
In-Reply-To: <20261119030534.1892935-9-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] netc_port_del_ptp_filter() (drivers/net/dsa/netc/netc_ptp.c)
handles every error from ntmp_ipft_delete_entry() as "the entry is…
--
net: dsa: netc: add PTP two-step timestamping support
This adds two-step TX timestamping and RX timestamping for the NETC
switch. For RX, IPFT rules trap PTP frames to the CPU port with an
ingress timestamp. For TX, the driver queues the skb clones and matches
them by request ID against hardware response frames delivered through a
new tagger callback.
> diff --git a/drivers/net/dsa/netc/netc_ptp.c b/drivers/net/dsa/netc/netc_ptp.c
> new file mode 100644
> index 0000000000000..bd4d0b70e7ee5
> --- /dev/null
> +++ b/drivers/net/dsa/netc/netc_ptp.c
> @@ -0,0 +1,502 @@
[ ... ]
> +static int netc_port_del_ptp_filter(struct netc_port *np)
> +{
> + struct netc_switch *priv = np->switch_priv;
> + int ret = 0;
> + int err;
> +
> + for (int i = 0; i < NETC_PTP_MAX; i++) {
> + if (np->ptp_ipft_eid[i] == NTMP_NULL_ENTRY_ID)
> + continue;
> +
> + /* No -ETIMEDOUT here: with the command BD ring enabled, the
> + * hardware execution time for a command is much less than
> + * 1ms, so no timeout error will occur. Any remaining error
> + * means the entry is still present in the table.
> + */
> + err = ntmp_ipft_delete_entry(&priv->ntmp,
> + np->ptp_ipft_eid[i]);
> + if (likely(!err)) {
> + np->ptp_ipft_eid[i] = NTMP_NULL_ENTRY_ID;
> + continue;
> + }
> +
> + ret = err;
> + dev_err(priv->dev,
> + "Delete PTP entry 0x%x (type %d) on port %d failed\n",
> + np->ptp_ipft_eid[i], i, np->dp->index);
> + }
[Severity: Low]
Is the claim in this comment guaranteed by the NTMP layer? The delete
goes through this path:
netc_port_hwtstamp_set()
netc_port_set_ptp_filter()
netc_port_del_ptp_filter()
ntmp_ipft_delete_entry()
ntmp_delete_entry_by_id()
netc_xmit_ntmp_cmd()
netc_xmit_ntmp_cmd() hands the BD to hardware and only then waits:
drivers/net/ethernet/freescale/enetc/ntmp.c:netc_xmit_ntmp_cmd() {
...
i = (i + 1) % cbdr->bd_num;
cbdr->next_to_use = i;
netc_write(cbdr->regs.pir, i);
err = read_poll_timeout(netc_read, val,
(val & NETC_CBDRCIR_INDEX) == i,
NETC_CBDR_DELAY_US, NETC_CBDR_TIMEOUT,
true, cbdr->regs.cir);
if (unlikely(err))
return err;
...
}
If the consumer index does not advance within NETC_CBDR_TIMEOUT, this
returns -ETIMEDOUT. The hardware may still run the DELETE after that.
In that case np->ptp_ipft_eid[i] is kept. netc_port_current_rx_filter()
would then report an rx_filter that is no longer installed. The commit
message says this design avoids exactly that:
"so a delete or rollback that fails partway does not leave software
reporting a filter that no longer matches the hardware."
Every later netc_port_set_ptp_filter() also starts by deleting the stale
entry ID. If the hardware rejects deleting a missing entry (the response
error status maps to -EIO), could every later hwtstamp_set on that port
fail until the switch is set up again?
This needs the hardware itself to stall, because read_poll_timeout()
reads once more after the deadline. The host-flood path added earlier in
the series by "net: dsa: netc: check return value of
ntmp_ipft_delete_entry()" makes the same assumption. This patch adds a
second user whose reported state depends on it.
Should -ETIMEDOUT be handled separately here, for example by treating
the entry state as unknown? Or should the comment say this is an
assumption about the hardware rather than a guarantee?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119030534.1892935-1-wei.fang%40oss.nxp.com
next prev parent reply other threads:[~2026-11-23 5:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 3:05 [PATCH v8 net-next 0/9] net: dsa: netc: add PTP support for NETC switch wei.fang
2026-11-19 3:05 ` [PATCH v8 net-next 1/9] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access wei.fang
2026-11-19 3:05 ` [PATCH v8 net-next 2/9] ptp: netc: remove unnecessary pcie_flr() call in probe wei.fang
2026-11-19 3:05 ` [PATCH v8 net-next 3/9] ptp: netc: export netc_timer_get_current_time() for cross-driver use wei.fang
2026-11-19 3:05 ` [PATCH v8 net-next 4/9] net: dsa: netc: tie setup resources and reset to DSA setup/teardown wei.fang
2026-11-23 5:05 ` netdev-bot+sashiko
2026-11-23 6:00 ` Wei Fang
2026-11-19 3:05 ` [PATCH v8 net-next 5/9] net: dsa: netc: use entry ID instead of pointer to track host flood rule wei.fang
2026-11-19 3:05 ` [PATCH v8 net-next 6/9] net: dsa: netc: check return value of ntmp_ipft_delete_entry() wei.fang
2026-11-23 5:05 ` netdev-bot+sashiko
2026-11-19 3:05 ` [PATCH v8 net-next 7/9] net: dsa: netc: enable ingress port filtering lookup by default wei.fang
2026-11-19 3:05 ` [PATCH v8 net-next 8/9] net: dsa: netc: add PTP two-step timestamping support wei.fang
2026-11-23 5:05 ` netdev-bot+sashiko [this message]
2026-11-19 3:05 ` [PATCH v8 net-next 9/9] net: dsa: netc: add PTP one-step " wei.fang
2026-11-23 5:05 ` netdev-bot+sashiko
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=179541033885.3135.10657211800089692875@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kuba@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=wei.fang@nxp.com \
--cc=wei.fang@oss.nxp.com \
--cc=xiaoning.wang@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
all inboxes | Powered by JetHome®