mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Selvamani Rajagopal <Selvamani.Rajagopal@onsemi.com>
To: "netdev-bot+sashiko@kernel.org" <netdev-bot+sashiko@kernel.org>
Cc: "andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"robh@kernel.org" <robh@kernel.org>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"parthiban.veerasooran@microchip.com"
	<parthiban.veerasooran@microchip.com>,
	"horms@kernel.org" <horms@kernel.org>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
	"rdunlap@infradead.org" <rdunlap@infradead.org>,
	"richardcochran@gmail.com" <richardcochran@gmail.com>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"hkallweit1@gmail.com" <hkallweit1@gmail.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"edumazet@kernel.org" <edumazet@kernel.org>,
	"piergiorgio.beruto@gmail.com" <piergiorgio.beruto@gmail.com>,
	"willemb@google.com" <willemb@google.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"jerry.ray@microchip.com" <jerry.ray@microchip.com>,
	"ciprian.regus@analog.com" <ciprian.regus@analog.com>
Subject: RE: [PATCH net-next v13 07/15] net: ethernet: oa_tc6: Support for hardware timestamp
Date: Thu, 3 Dec 2026 18:42:05 +0000	[thread overview]
Message-ID: <CH0PR02MB7867190646137BC9441D9B40834B2@CH0PR02MB7867.namprd02.prod.outlook.com> (raw)
In-Reply-To: <179631999173.3146.3476539071105534145@kernel.org>


> -----Original Message-----
> From: netdev-bot+sashiko@kernel.org <netdev-bot+sashiko@kernel.org>
> Sent: Thursday, December 3, 2026 9:47 AM
> To: Selvamani Rajagopal <Selvamani.Rajagopal@onsemi.com>
> 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>


  reply	other threads:[~2026-12-03 18:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 17:37 [PATCH net-next v13 00/15] Support for onsemi's S2500 10BASE-T1S MAC-PHY Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 01/15] dt-bindings: net: add onsemi's S2500 Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 02/15] Documentation: networking: Add timestamp related APIs to OA TC6 framework Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 03/15] net: ethernet: oa_tc6: Move oa_tc6.c to its own directory Selvamani Rajagopal via B4 Relay
2026-12-03 17:46   ` netdev-bot+sashiko
2026-12-02 17:37 ` [PATCH net-next v13 04/15] net: ethernet: oa_tc6: Move constant definitions to header file Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 05/15] net: ethernet: microchip: lan865x: Depends on PTP_1588_CLOCK_OPTIONAL Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 06/15] net: ethernet: adi: adin1140: " Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 07/15] net: ethernet: oa_tc6: Support for hardware timestamp Selvamani Rajagopal via B4 Relay
2026-12-03 17:46   ` netdev-bot+sashiko
2026-12-03 18:42     ` Selvamani Rajagopal [this message]
2026-12-02 17:37 ` [PATCH net-next v13 08/15] net: ethernet: oa_tc6: Drop frames if footer has FD bit set Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 09/15] net: ethernet: oa_tc6: Support for vendor specific MMS Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 10/15] net: ethernet: oa_tc6: APIs to customize CONFIG0 settings Selvamani Rajagopal via B4 Relay
2026-12-03 17:46   ` netdev-bot+sashiko
2026-12-02 17:37 ` [PATCH net-next v13 11/15] net: phy: ncn26000: Enable enhanced noise immunity Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 12/15] net: phy: Add helper to modify only the PHY loopback bit Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 13/15] net: phy: ncn26000: Support for onsemi's S2500 internal phy Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 14/15] net: phy: dp83867: Use genphy_loopback_no_speed() Selvamani Rajagopal via B4 Relay
2026-12-02 17:37 ` [PATCH net-next v13 15/15] net: ethernet: onsemi: s2500: Add driver support for S2500 Selvamani Rajagopal via B4 Relay
2026-12-03 17:46   ` netdev-bot+sashiko
2026-12-03 18:38     ` Selvamani Rajagopal

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=CH0PR02MB7867190646137BC9441D9B40834B2@CH0PR02MB7867.namprd02.prod.outlook.com \
    --to=selvamani.rajagopal@onsemi.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=ciprian.regus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=jerry.ray@microchip.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=piergiorgio.beruto@gmail.com \
    --cc=rdunlap@infradead.org \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=willemb@google.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®