From: Linus Walleij <linusw@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, 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 v3 net-next 8/8] net: dsa: netc: add PTP one-step timestamping support
Date: Sat, 5 Sep 2026 08:16:19 +0200 [thread overview]
Message-ID: <CAD++jLk+DMHzHiJoX6LMY5wUGMOWm3DN_yAHUUSvFKLKgFwJZw@mail.gmail.com> (raw)
In-Reply-To: <20260831082335.1184605-9-wei.fang@oss.nxp.com>
Hi Wei,
thanks for your patch!
On Mon, Aug 31, 2026 at 10:24 AM <wei.fang@oss.nxp.com> wrote:
> From: Wei Fang <wei.fang@nxp.com>
>
> The NETC switch supports one-step TX timestamping for PTP Sync frames.
> When transmitting a Sync frame, the driver reads the current PTP time
> and writes it into the frame's originTimestamp field, and inserts a
> To_Port subtype 1 tag carrying the low 30 bits of that same PTP time.
> As the frame leaves the wire, the MAC captures the SFD transmit time
> and derives the residence time from the timestamp in the tag. It then
> reads the correction field at the offset given by
> PM_SINGLE_STEP[OFFSET], adds the residence time to it, and writes the
> result back.
>
> PM_SINGLE_STEP is a per-port register that can describe only one
> in-flight frame at a time, and programming it requires reading the
> current PTP time, which may sleep. Both constraints rule out handling
> one-step Sync on the xmit path.
>
> Instead, defer transmission to a per-port process-context work. The
> xmit path classifies the frame in netc_port_txtstamp(): a genuine
> one-step Sync (twoStepFlag cleared) has its PTP header offsets cached
> in the skb control block; frames that cannot be handled as one-step
> fall back to the two-step path or are sent as normal frames. netc_xmit()
> hands the classified frame to the switch driver via the
> onestep_sync_enqueue tagger callback, which queues it and kicks the work
> if no frame is currently in flight.
>
> The work dequeues one frame at a time, reads a fresh PTP time, programs
> PM_SINGLE_STEP, updates the originTimestamp field, and transmits the
> frame directly to the conduit via the onestep_sync_xmit tagger callback,
> bypassing dsa_user_xmit() to avoid double-counting TX stats. Only one
> frame is in flight at a time: the frame carries a TX-completion
> destructor that reschedules the work when the conduit frees the skb,
> keeping PM_SINGLE_STEP always matched to the frame being transmitted.
>
> The one-step context is reference-counted and its lifetime is decoupled
> from the devm-allocated netc_port. In-flight skbs hold a reference via
> their destructor, so the context outlives port disable until the conduit
> frees the last in-flight skb. Port disable clears onestep->active under
> work_lock; a work that runs afterwards observes active cleared will
> purge the onestep->queue and return without touching the freed port
> resources.
>
> Assisted-by: Wchat:claude-opus-4-8
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
You agent produces "dostoyevsky commits" with too much verbiage.
Tell you agent to "be terse and to the point" in your AGENTS.md.
> +
> + /* dsa_tree_teardown() calls dsa_tree_teardown_ports() before
> + * dsa_tree_teardown_switches(), so netc_port_disable() is
> + * executed before netc_teardown() and onestep->active is set
> + * to false. In-flight one-step skbs still hold references via
> + * the destructor; the context (and its work) is freed only
> + * after the conduit frees the last in-flight skb. By then np
> + * may be gone, but the work no longer dereferences np because
> + * onestep->active has been cleared. And onestep->queue will be
> + * cleared by netc_onestep_work()/netc_onestep_destroy_work().
> + */
> + netc_onestep_put(np->onestep);
> + np->onestep = NULL;
This type of stuff is over-commenting and is considered AI slop.
Tell you agent to be very restrictive with inserting comments, essentially
it should only do that when you explicitly tell it to, such as when you
yourself feel it is really necessary or you got a review comment that
this is needed.
Yours,
Linus Walleij
next prev parent reply other threads:[~2026-09-05 6:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 8:23 [PATCH v3 net-next 0/8] net: dsa: netc: add PTP support for NETC switch wei.fang
2026-08-31 8:23 ` [PATCH v3 net-next 1/8] ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access wei.fang
[not found] ` <20260901082024.E6F931F000E9@smtp.kernel.org>
2026-09-02 1:56 ` Wei Fang (OSS)
2026-08-31 8:23 ` [PATCH v3 net-next 2/8] ptp: netc: remove unnecessary pcie_flr() call in probe wei.fang
2026-08-31 8:23 ` [PATCH v3 net-next 3/8] ptp: netc: export netc_timer_get_current_time() for cross-driver use wei.fang
[not found] ` <20260901082025.AF94B1F00A3D@smtp.kernel.org>
2026-09-02 2:02 ` Wei Fang (OSS)
2026-09-04 22:25 ` netdev-bot+sashiko
2026-08-31 8:23 ` [PATCH v3 net-next 4/8] net: dsa: netc: use entry ID instead of pointer to track host flood rule wei.fang
2026-09-04 22:25 ` netdev-bot+sashiko
2026-08-31 8:23 ` [PATCH v3 net-next 5/8] net: dsa: netc: check return value of ntmp_ipft_delete_entry() wei.fang
2026-09-04 22:25 ` netdev-bot+sashiko
2026-08-31 8:23 ` [PATCH v3 net-next 6/8] net: dsa: netc: enable ingress port filtering lookup by default wei.fang
2026-08-31 8:23 ` [PATCH v3 net-next 7/8] net: dsa: netc: add PTP two-step timestamping support wei.fang
[not found] ` <20260901082026.7F3911F00A3E@smtp.kernel.org>
2026-09-02 2:12 ` Wei Fang (OSS)
2026-09-04 22:25 ` netdev-bot+sashiko
2026-08-31 8:23 ` [PATCH v3 net-next 8/8] net: dsa: netc: add PTP one-step " wei.fang
[not found] ` <20260901082027.461281F00A3F@smtp.kernel.org>
2026-09-02 3:00 ` Wei Fang (OSS)
2026-09-02 3:05 ` Wei Fang (OSS)
2026-09-04 22:25 ` netdev-bot+sashiko
2026-09-05 0:52 ` Jakub Kicinski
2026-09-05 6:16 ` Linus Walleij [this message]
2026-09-01 15:09 ` [PATCH v3 net-next 0/8] net: dsa: netc: add PTP support for NETC switch Jakub Kicinski
2026-09-02 1:43 ` Wei Fang
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=CAD++jLk+DMHzHiJoX6LMY5wUGMOWm3DN_yAHUUSvFKLKgFwJZw@mail.gmail.com \
--to=linusw@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=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--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