From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795912613; b=u/Ez6TJWUizgzkDTtE2wQd9uYQ+AD8B8L7ZomNhX/ZiG2jD9jdwyK+BlbrpSytb1jOQu uuTBHzE22/EEyVuGFsMT53pB9R2380prgaPXQ1WhgDZ2+Lh747XYd5PNLbhojGuoDqVNQ TiEsAZp+1UtokS9SLm+KsWvRN6DzUja9wKWCee1Z3BBBPhTVeyochhDRmITPpt+S5LaDr yprC+hn+OjdfjgJZ5xVz861USRcx0EfQmqmA+1dsh2SvdtanavH0Zx7XF8JRI+wkUFqd1 UqfVFnIEI8GY0b31YrIESwyKH49FTuE4RgVc0drzyA6B3I1wjtxYjjx3FWTJg4OoKVQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795912613; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=H52iNRoqhgamkNbyQqKoShGqVqQYsU4aNPM3x3rL59U=; b=0bTtCQsvetCAYbfALsOZXJQ221oCs71uQoUM3WfYhuRxkc5sGs/caaOgwgRiY7t5q085 MZRqXdbqqhlqEZef9u+EFcM02li2Q8YyJs0gy4S297kqs7jBaeTf6/bfRaVDTydHmZc5z nsIT0MfjWq4nWSmc3treOkoQVvhXZ0XyRieNI+6j2Z8dwYffAAwYcw2BzgI3Swqqj0Ecu qRppXISjUV86SY0QZGh7DGjt6Hiw/4JC6Nubahf9U8L4cLjjDgA5TZ2kkXlC7VjunQxKt W1Fak87SAAUyiqgCFpSBSDMQAxAEGF98Jago6uLNjF7Z/fouO4acESmaAVXW/B212Bg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IBia4UsG; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69027606A31C; Sun, 29 Nov 2026 00:36:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=IBia4UsG Received: by smtp.kernel.org (Postfix) with ESMTPSA id 552FD1F00897; Sun, 29 Nov 2026 00:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795912612; bh=H52iNRoqhgamkNbyQqKoShGqVqQYsU4aNPM3x3rL59U=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=IBia4UsGegLQZuDizBhvwbeR+xM40Zkv2PgxN2cgs+hBVSprRBkXOx6E4BMgM/ks3 jx0Vv/orH750Iywzo+f0Jflygcr4lSJGpN/IAI1cvPULcbQAL3N0JOtdRX5l/Gkcrz w1vv+jd7V2AgLmpX0wLtkSL29EBzoHCv4blqVzQrHczQ6NCZjItsrorpiNCo10JNlv 3Q2QNdxEPyswFABixQND9R8pRMIdEIX77+CtJI/mqcZNZWtPpw6rGeNi0MfG5a3DfQ LqwWGxXO5l6/3A32g67EEvVhYvhKIx37DDcz2/BsdMrslV4cWC2iKoS2oekBbOKHp9 9CYktqtphRlbw== Subject: Re: [PATCH net-next v12 07/15] net: ethernet: oa_tc6: Support for hardware timestamp From: netdev-bot+sashiko@kernel.org To: Selvamani.Rajagopal@onsemi.com Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, parthiban.veerasooran@microchip.com, richardcochran@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, edumazet@kernel.org, piergiorgio.beruto@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, jerry.ray@microchip.com, ciprian.regus@analog.com Date: Sun, 29 Nov 2026 00:36:50 +0000 Message-ID: <179591261088.3135.11468838555901711637@kernel.org> In-Reply-To: <20261124-s2500-mac-phy-support-v12-7-3575855d99f9@onsemi.com> References: <20261124-s2500-mac-phy-support-v12-7-3575855d99f9@onsemi.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 3 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] A TX timestamp capture register is never released if its TTSC capture event never arrives. - [Medium] net: oa_tc6: unrestored INT_MASK0 on error in oa_tc6_set_hwtstamp_settings() - [Medium] net: oa_tc6: waiting_tx_skb queued for TX timestamp after NETDEV_DOWN - [Low] oa_tc6_hwtstamp_post() does not return -EIO for every request after traffic handling has stopped, although the documentation says it… -- net: ethernet: oa_tc6: Support for hardware timestamp This commit adds hardware timestamping support to the OPEN Alliance TC6 framework. It adds PTP clock registration helpers and exports helpers for ndo_hwtstamp_set/get and ethtool get_ts_info/get_ts_stats. TX timestamps use the three TTSC capture registers signalled through STATUS0. RX timestamps are parsed from the 8 bytes the MAC-PHY prepends to received frames. > diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c > index 341d13c97f91f..22aaecd814ecd 100644 > --- a/drivers/net/ethernet/oa_tc6/oa_tc6_main.c > +++ b/drivers/net/ethernet/oa_tc6/oa_tc6_main.c [ ... ] > @@ -49,6 +62,236 @@ static int oa_tc6_get_parity(u32 p) [ ... ] > +/* Pause new timestamp requests while an off request is pending. */ > +static void oa_tc6_req_tx_hwtstamp(struct oa_tc6 *tc6, struct sk_buff *skb) > +{ > + u8 tsc; > + > + lockdep_assert_held(&tc6->tx_skb_lock); > + > + if (!skb || !(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) > + return; > + > + if (tc6->ts_cfg.tx_type != HWTSTAMP_TX_ON || > + (tc6->ts_cfg_req && > + tc6->ts_cfg_new.tx_type != HWTSTAMP_TX_ON)) > + return; > + > + tsc = tc6->ttsc_current_id; > + if ((tc6->ttsc_pending | tc6->ttsc_held) & > + BIT(tsc - OA_TC6_TTSCA_REG_ID)) { > + tc6->tx_hwtstamp_err++; > + return; > + } [Severity: Medium] Can a frame that was sitting in waiting_tx_skb when the interface went down still claim a capture register here? On dev_close, ndo_stop() runs before NETDEV_DOWN. The vendor stop callbacks stop the TX queue, stop the PHY and clear the MAC TXEN. Nothing drops tc6->waiting_tx_skb. oa_tc6_netdev_event() then calls oa_tc6_cleanup_tx_tstamp_skbs(tc6, true). That empties ttsc_skb_list, moves ttsc_pending into ttsc_held and clears ttsc_pending, but it also leaves waiting_tx_skb alone. When the threaded IRQ handler runs after that, oa_tc6_prepare_spi_tx_buf_for_tx_skbs() promotes waiting_tx_skb to ongoing_tx_skb and calls oa_tc6_req_tx_hwtstamp(). That function checks ts_cfg and ts_cfg_req but not netif_running(). So it sets a fresh bit in ttsc_pending and marks SKBTX_IN_PROGRESS. When the last chunk is written, oa_tc6_queue_tx_tstamp_skb() finds that bit set and adds the skb to ttsc_skb_list. The NETDEV_DOWN cleanup has already finished by then. With the MAC transmitter disabled, no TTSC capture should arrive for this frame while the interface is down, or ever if the MAC-PHY discards it. Doesn't the skb then stay on ttsc_skb_list, keeping its socket and wmem charge pinned? The stale ttsc_pending bit also has side effects. oa_tc6_hwtstamp_req_process() won't apply a HWTSTAMP_TX_OFF request while it is set, so those requests end in -ETIMEDOUT from oa_tc6_hwtstamp_post(). And oa_tc6_req_tx_hwtstamp() stops handing out registers once ttsc_current_id reaches it. Should the NETDEV_DOWN handling also drop waiting_tx_skb? Or should oa_tc6_req_tx_hwtstamp() refuse new requests when the interface is not running? [Severity: Medium] What happens if the capture event for a claimed register never arrives? If the bit for ttsc_current_id stays set in ttsc_pending or ttsc_held, this returns without advancing ttsc_current_id and without trying the other two registers. Once the rotation reaches the stuck register, won't every later SKBTX_HW_TSTAMP frame go out without a timestamp request, even when TTSCB and TTSCC are free? As far as I can tell, ttsc_held is only cleared in oa_tc6_events_handle(), and only when STATUS0 reports TTSCAx for that register: tc6->ttsc_held &= ~ttsc_held; The NETDEV_DOWN notifier also moves pending bits into held: oa_tc6_netdev_event() oa_tc6_cleanup_tx_tstamp_skbs(tc6, true) tc6->ttsc_held |= tc6->ttsc_pending; So an ifdown/ifup cycle doesn't seem to recover a stuck register either. The s2500 driver later in the series calls s2500_stop()->s2500_shutdown(), which clears TXEN and stops the PHY before the NETDEV_DOWN notifier runs. If a timestamp-requesting frame is still buffered in the MAC-PHY at that point, could it never be transmitted? Its register would then stay held until the driver is unbound. A stuck bit also seems to block turning TX timestamping off. oa_tc6_hwtstamp_req_process() only applies a config that is not TX_ON when: !(tc6->ttsc_pending | tc6->ttsc_held) Wouldn't every HWTSTAMP_TX_OFF request then end in -ETIMEDOUT from oa_tc6_hwtstamp_post()? CONFIG0.FTSE and the TTSC interrupt unmask would stay programmed. While the interface stays up, the skb on ttsc_skb_list for a lost capture never expires. The skb, its socket and its wmem charge stay pinned until ifdown. oa_tc6_process_extended_status() already reads STATUS1 in the same burst (regs[1]) but doesn't use it. If STATUS1 reports missed captures per register, could it be used to release a stuck register? Alternatively, could a timeout release it? The commit message says: If the next timestamp capture register is still in use, the frame is sent without a timestamp request and the TX timestamp error counter is incremented. ... three timestamp capture registers are plenty Once a single capture is lost, doesn't TX hardware timestamping stop for good, rather than affecting only one frame? > + > + tc6->ttsc_pending |= BIT(tsc - OA_TC6_TTSCA_REG_ID); > + tc6->ttsc_current_id = oa_tc6_next_tsc(tsc); > + oa_tc6_tsinfo_tx(skb)->tsc = tsc; > + skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; > +} [ ... ] > diff --git a/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c b/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c > new file mode 100644 > index 0000000000000..aaffa18c4128e > --- /dev/null > +++ b/drivers/net/ethernet/oa_tc6/oa_tc6_tstamp.c > @@ -0,0 +1,304 @@ [ ... ] > +static int oa_tc6_hwtstamp_post(struct oa_tc6 *tc6, > + const struct hwtstamp_config *ts_cfg) > +{ > + unsigned long wait = msecs_to_jiffies(OA_TC6_TS_CFG_WAIT_MS); > + > + spin_lock_bh(&tc6->tx_skb_lock); > + if (tc6->ts_cfg.flags == ts_cfg->flags && > + tc6->ts_cfg.tx_type == ts_cfg->tx_type && > + tc6->ts_cfg.rx_filter == ts_cfg->rx_filter) { > + spin_unlock_bh(&tc6->tx_skb_lock); > + return 0; > + } > + > + if (tc6->disable_traffic) { > + spin_unlock_bh(&tc6->tx_skb_lock); > + return -EIO; > + } [Severity: Medium] What state is left behind if this CONFIG0 write fails? By then INT_MASK0 has already been written, but tc6->ts_cfg still holds the old config. Consider turning TX timestamping off. oa_tc6_hwtstamp_req_process() has already cleared ts_cfg_req. This function then sets OA_TC6_INT_MASK0_TTSCA_MASK in INT_MASK0, and the CONFIG0 write fails. The hardware is left with FTSE still enabled but the TTSC capture interrupts masked. In software, ts_cfg.tx_type is still HWTSTAMP_TX_ON. With ts_cfg_req clear and ts_cfg still TX_ON, oa_tc6_req_tx_hwtstamp() keeps claiming capture registers, and oa_tc6_queue_tx_tstamp_skb() keeps adding skbs to ttsc_skb_list. With the TTSCAx bits masked, would oa_tc6_events_handle() only see these captures when some other unmasked STATUS0 event triggers the read? If so, do the skbs and their ttsc_pending bits just pile up? Retrying with HWTSTAMP_TX_ON doesn't recover the mask either. oa_tc6_hwtstamp_post() compares the request against the stale tc6->ts_cfg, finds it equal, and returns 0 without reprogramming INT_MASK0. The STATUS0 write-one-to-clear above may also have acknowledged a capture by then. Should INT_MASK0 be restored on this error path? Alternatively, could the writes be arranged so a partial failure leaves the hardware consistent with tc6->ts_cfg? [Severity: Low] The kernel-doc for oa_tc6_hwtstamp_set() and Documentation/networking/oa-tc6-framework.rst both say -EIO is returned once traffic handling has stopped. The equality check above runs before the disable_traffic check. After oa_tc6_disable_traffic() has run, does a request that repeats the current config return 0 instead of -EIO? oa_tc6_disable_traffic() sets disable_traffic, but it neither resets ts_cfg nor brings the interface down. The netif_running() check in oa_tc6_hwtstamp_set() therefore still passes. Should the disable_traffic check come before the equality check? > + tc6->ts_cfg_new = *ts_cfg; > + tc6->ts_cfg_req = true; > + spin_unlock_bh(&tc6->tx_skb_lock); > + irq_wake_thread(tc6->spi->irq, tc6); [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124-s2500-mac-phy-support-v12-0-3575855d99f9%40onsemi.com