RE: [PATCH net-next v13 07/15] net: ethernet: oa_tc6: Support for hardware timestamp

From: Selvamani Rajagopal

Date: Thu Dec 03 2026 - 13:43:20 EST



> -----Original Message-----
> From: netdev-bot+sashiko@xxxxxxxxxx <netdev-bot+sashiko@xxxxxxxxxx>
> Sent: Thursday, December 3, 2026 9:47 AM
> To: Selvamani Rajagopal <Selvamani.Rajagopal@xxxxxxxxxx>
> Subject: Re: [PATCH net-next v13 07/15] net: ethernet: oa_tc6: Support for hardware
> timestamp
>
>
>
> > + 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]
> What frees a capture register if the MAC-PHY never reports the TTSCAx
> event for it?
>
> Only oa_tc6_events_handle() clears ttsc_held, and only when a PTP clock
> is registered and STATUS0 has the matching bit set. On ifdown,
> oa_tc6_netdev_event()->oa_tc6_cleanup_tx_tstamp_skbs(tc6, true) does:
>


Held bits prevent a late capture event from being attributed to the wrong skb.
We confirmed that this happened. That's why held bit mechanism was introduced.

Apart from SPI failures, which would have broader consequences, we have not seen
any driver issue that would cause a missing event. Technically hardware issue could
cause this, but we have no evidence of one. We would prefer to proceed with the current
implementation.


> if (hold)
> tc6->ttsc_held |= tc6->ttsc_pending;
> tc6->ttsc_pending = 0;
>
> A down/up cycle therefore turns the pending bit into a held bit instead
> of freeing the register. Until then, oa_tc6_queue_tx_tstamp_skb() keeps
> the skb on ttsc_skb_list with no expiry, and the skb keeps its socket's
> wmem charge.
>
> When the register at ttsc_current_id is busy, the check above returns
> without advancing ttsc_current_id. Does one stuck register then make
> every later TX timestamp request fail, even with the other two registers
> free?
>
> TX_OFF also seems affected. oa_tc6_hwtstamp_req_process() only claims a
> TX_OFF request when nothing is pending or held:
>
> if (tc6->ts_cfg_new.tx_type == HWTSTAMP_TX_ON ||
> !(tc6->ttsc_pending | tc6->ttsc_held)) {
>
> With a stuck bit, wouldn't every attempt to turn TX timestamping off get
> -ETIMEDOUT from oa_tc6_hwtstamp_post()? FTSE would stay set and the TTSC
> interrupts unmasked until unbind.
>
> One possible trigger in this series: s2500_stop()->s2500_shutdown()
> clears TXEN before NETDEV_DOWN, while a TSC-tagged frame may still be
> buffered in the MAC-PHY. A frame the MAC-PHY drops, for example after
> collisions, could leave its register stuck in the same way.
>
> The commit message and the oa_tc6_hwtstamp_set() kernel-doc mention the
> 100 ms -ETIMEDOUT and "may wait for outstanding TX timestamps". They do
> not say TX timestamping can stay unusable in this case. Do these
> registers need a timeout or some other way to be released?
>
> [ ... ]
>
> > +static int oa_tc6_update_ts_in_rx_skb(struct oa_tc6 *tc6)
> > +{
> > + unsigned int expected_len = ETH_HLEN;
> > + struct sk_buff *skb = tc6->rx_skb;
> > + struct oa_tc6_ts_info_rx *ski;
> > + __be32 ts_val[2];
> > + u32 ts[2];
> > +
> > + ski = oa_tc6_tsinfo_rx(skb);
> > + if (ski->rtsa)
> > + expected_len += OA_TC6_TSTAMP_SZ;
> > +
> > + if (skb->len < expected_len) {
> > + tc6->netdev->stats.rx_length_errors++;
> > + tc6->netdev->stats.rx_errors++;
> > + return -EINVAL;
> > + }
>
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-s2500-
> mac-phy-support-v13-0-a2908fad2693%40onsemi.com
> <https://url.usb.m.mimecastprotect.com/s/nLTfC7DqojhAgOBg1iWh3wuo-
> HIU?domain=netdev-ai.bots.linux.dev>