netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 00/11] net: stmmac: timestamping/ptp cleanups
@ 2025-09-09 16:47 Russell King (Oracle)
  2025-09-09 16:47 ` [PATCH net-next 01/11] net: stmmac: ptp: improve handling of aux_ts_lock lifetime Russell King (Oracle)
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Russell King (Oracle) @ 2025-09-09 16:47 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Alexei Starovoitov, Andrew Lunn, bpf,
	Daniel Borkmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Jesper Dangaard Brouer, John Fastabend, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, Paolo Abeni,
	Richard Cochran, Stanislav Fomichev

Hi,

This series cleans up the hardware timestamping / PTP initialisation
and cleanup code in the stmmac driver. Several key points in no
particular order:

1. Golden rule: unregister first, then release resources.
   stmmac_release_ptp didn't do this.

2. Avoid leaking resources - __stmmac_open() failure leaves the
   timestamping support initialised, but stops its clock. Also
   violates (1).

3. Avoid double-release of resources - stmmac_open() followed by
   stmmac_xdp_open() failing results in the PTP clock prepare and
   enable counts being released, and if the interface is then
   brought down, they are incorrectly released again. As XDP
   doesn't gain any additional prepare/enables on the PTP clock,
   remove this incorrect cleanup.

4. Changing the MTU of the interface is disruptive to PTP, and
   remains so as long as. This is not fixed by this series (too
   invasive at the moment.)

5. Avoid exporting functions that aren't used...

6. Avoid unnecessary runtime PM state manipulations (no point
   manipulating this when MTU changes).

7. Make the PTP/timestamping initialisation more readable - no
   point calling functions in the same file from one callsite
   that return error codes from one location in the called function,
   to only have the sole callee print messages depending on that
   return code. Also simplifying the mess in stmmac_hw_setup().
   Also placing support checks in a better location. Also getting
   rid of the "ptp_register" boolean through this restructuring.

Not tested beyond compile testing. (I don't have my Jetson Xavier NX
platform.) So anyone testing this and providing feedback would be
most welcome.

On that point... I hardly (never?) seem to get testing feedback from
anyone when touching stmmac. I suspect that's because of the structure
of the driver, where MAINTAINERS only lists people for their appropriate
dwmac-* files. Thus they don't get Cc'd for core stmmac changes. Not
sure what the solution is, but manually picking out all the entries
in MAINTAINERS every time doesn't scale.

Therefore, I suggest merging this into net-next so people get to test
it by way of it being in a tree they might be using.

 drivers/net/ethernet/stmicro/stmmac/stmmac.h      |   1 -
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 113 ++++++++++++----------
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c  |  10 +-
 3 files changed, 67 insertions(+), 57 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-09-10 23:02 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09 16:47 [PATCH net-next 00/11] net: stmmac: timestamping/ptp cleanups Russell King (Oracle)
2025-09-09 16:47 ` [PATCH net-next 01/11] net: stmmac: ptp: improve handling of aux_ts_lock lifetime Russell King (Oracle)
2025-09-09 16:47 ` [PATCH net-next 02/11] net: stmmac: disable PTP clock after unregistering PTP Russell King (Oracle)
2025-09-09 16:47 ` [PATCH net-next 03/11] net: stmmac: fix PTP error cleanup in __stmmac_open() Russell King (Oracle)
2025-09-09 16:47 ` [PATCH net-next 04/11] net: stmmac: fix stmmac_xdp_open() clk_ptp_ref error cleanup Russell King (Oracle)
2025-09-09 16:47 ` [PATCH net-next 05/11] net: stmmac: unexport stmmac_init_tstamp_counter() Russell King (Oracle)
2025-09-09 16:47 ` [PATCH net-next 06/11] net: stmmac: add __stmmac_release() to complement __stmmac_open() Russell King (Oracle)
2025-09-10 14:39   ` [Linux-stm32] " Gatien CHEVALLIER
2025-09-09 16:47 ` [PATCH net-next 07/11] net: stmmac: move stmmac_init_ptp() messages into function Russell King (Oracle)
2025-09-09 16:48 ` [PATCH net-next 08/11] net: stmmac: rename stmmac_init_ptp() Russell King (Oracle)
2025-09-10 14:42   ` [Linux-stm32] " Gatien CHEVALLIER
2025-09-10 23:01     ` Russell King (Oracle)
2025-09-09 16:48 ` [PATCH net-next 09/11] net: stmmac: add stmmac_setup_ptp() Russell King (Oracle)
2025-09-09 16:48 ` [PATCH net-next 10/11] net: stmmac: move PTP support check into stmmac_init_timestamping() Russell King (Oracle)
2025-09-09 16:48 ` [PATCH net-next 11/11] net: stmmac: move timestamping/ptp init to stmmac_hw_setup() caller Russell King (Oracle)
2025-09-09 18:46 ` [PATCH net-next 00/11] net: stmmac: timestamping/ptp cleanups Andrew Lunn
2025-09-10 15:10 ` [Linux-stm32] " Gatien CHEVALLIER

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).