Skip to contentSkip to conversation

net: sparx5: start the TOD counters on non-PTP lan969x variants

PATCH Applied Quentin Freimanis 3 participants 3 messages Oct 5 – Oct 7

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: sparx5: start the TOD counters on non-PTP lan969x variants

Currently the base non-PTP-capable lan969x variants don't forward any Ethernet frames:

  $ ip link set eth10 up
  $ ip addr add 10.0.0.54/24 dev eth10
  $ ping 10.0.0.1
  PING 10.0.0.1 (10.0.0.1): 56 data bytes

--- 10.0.0.1 ping statistics ---
7 packets transmitted, 0 packets received, 100% packet loss

  $ cat /proc/interrupts | grep fdma
    20:          0  GIC-0  120 Level     sparx5-fdma
  $ ip -s link show dev eth10
      RX:  bytes packets errors dropped  missed   mcast
           20828     102      0       0       0      72
      TX:  bytes packets errors dropped carrier collsns
               0       0      0       0       0       0

Testing showed that starting the domain 0 TOD counter gets networking working again, but start all three for consistency with the PTP variants.

Fixes 207966787b71 ("net: sparx5: add feature support")

---
Changes in v2:
- Drop the TOD start helper and start all three counters (Daniel)
- Fix capitalization in comment explaining why non-PTP parts need the TOD counters running (Daniel)
- Add test log showing user impact

v1: https://lore.kernel.org/netdev/[email protected]/

 .../ethernet/microchip/sparx5/sparx5_ptp.c    | 28 +++++++++++--------
 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c +16 -12
index 5953e04ef14e..2826e48af103 100644
@@ -622,18 +622,9 @@ int sparx5_ptp_init(struct sparx5 *sparx5)
 		sparx5->ptp = 1;
 	}
 
-	if (!sparx5->ptp)
-		return 0;
-
-	for (i = 0; i < SPARX5_PHC_COUNT; ++i) {
-		err = sparx5_ptp_phc_init(sparx5, i, &sparx5_ptp_clock_info);
-		if (err)
-			return err;
-	}
-
-	spin_lock_init(&sparx5->ptp_clock_lock);
-	spin_lock_init(&sparx5->ptp_ts_id_lock);
-	mutex_init(&sparx5->ptp_lock);
+	/* The base, non-PTP-capable lan969x variants need the
+	 * first TOD counter running to forward frames.
+	 */
 
 	/* Disable master counters */
 	spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0), sparx5, PTP_PTP_DOM_CFG);
@@ -657,6 +648,19 @@ int sparx5_ptp_init(struct sparx5 *sparx5)
 	/* Enable master counters */
 	spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0x7), sparx5, PTP_PTP_DOM_CFG);
 
+	if (!sparx5->ptp)
+		return 0;
+
+	for (i = 0; i < SPARX5_PHC_COUNT; ++i) {
+		err = sparx5_ptp_phc_init(sparx5, i, &sparx5_ptp_clock_info);
+		if (err)
+			return err;
+	}
+
+	spin_lock_init(&sparx5->ptp_clock_lock);
+	spin_lock_init(&sparx5->ptp_ts_id_lock);
+	mutex_init(&sparx5->ptp_lock);
+
 	for (i = 0; i < sparx5->data->consts->n_ports; i++) {
 		port = sparx5->ports[i];
 		if (!port)
Signature · 1 line
2.55.0
maintainer Tested-by Reviewed-by on v2 1/1
#1 lore raw
Quoted 16 lines

Currently the base non-PTP-capable lan969x variants don't forward any Ethernet frames:

  $ ip link set eth10 up
  $ ip addr add 10.0.0.54/24 dev eth10
  $ ping 10.0.0.1
  PING 10.0.0.1 (10.0.0.1): 56 data bytes

--- 10.0.0.1 ping statistics ---
7 packets transmitted, 0 packets received, 100% packet loss

  $ cat /proc/interrupts | grep fdma
    20:          0  GIC-0  120 Level     sparx5-fdma
Quoted 8 lines
  $ ip -s link show dev eth10
      RX:  bytes packets errors dropped  missed   mcast
           20828     102      0       0       0      72
      TX:  bytes packets errors dropped carrier collsns
               0       0      0       0       0       0

Testing showed that starting the domain 0 TOD counter gets networking working again, but start all three for consistency with the PTP variants.

Thank you for the patch! :-)

#2 lore raw
In reply to Quentin Freimanis
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sun, 4 Oct 2026 22:28:26 -0700 you wrote:

Currently the base non-PTP-capable lan969x variants don't forward any Ethernet frames:

  $ ip link set eth10 up
  $ ip addr add 10.0.0.54/24 dev eth10

[...]

Here is the summary with links:
- [net,v2] net: sparx5: start the TOD counters on non-PTP lan969x variants

    https://git.kernel.org/netdev/net/c/ca5012757bf0

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html