Skip to contentSkip to conversation

net: lan969x: fix DSM calendar for empty taxis

PATCH Applied Daniel Machon 2 participants 2 messages Oct 20 – Oct 22

Subsystems (4)
lore
Share & tools
lore

Daniel Machon

author maintainer
#0 lore raw

PATCH 1/1 net: lan969x: fix DSM calendar for empty taxis

lan969x_dsm_calendar_calc() computes the DSM calendar schedule of one taxi. sparx5_config_dsm_calendar() calls it for each taxi, reusing the same sparx5_calendar_data.

Before this patch, the schedule is only cleared after the n_devs == 0 early return. For a taxi with no active ports, the function writes SPX5_DSM_CAL_EMPTY only to schedule[0] and leaves the remaining slots at whatever they held before. For the first taxi that is zero from kzalloc(), so sparx5_dsm_cal_len() returns a bogus length and sparx5_dsm_calendar_check() fails, which fails the probe:

Port 0: distance 20 above limit 0

A later empty taxi inherits the previous taxi's schedule instead, which passes the check, so only an empty taxi 0 triggers the failure.

Clear the full schedule up front on every path, and on the empty path place a single idle marker (SPX5_DSM_CAL_MAX_DEVS_PER_TAXI) in slot 0, so the update step sees a calendar length of one and programs one idle slot into the hardware, matching what sparx5_dsm_calendar_calc() does.

Reported by a customer whose DT enables none of the ports in a taxi. Reproduced on lan969x by disabling all taxi 0 ports in the DT.

Fixes 5d2ba3941016 ("net: lan969x: add function for calculating the DSM calendar")
---
 drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_calendar.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_calendar.c +4 -4
index e857640df185..4442c0c1a957 100644
@@ -82,6 +82,9 @@ int lan969x_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
 	struct lan969x_dsm_cal_dev_speed *speed;
 	int err;
 
+	for (u32 i = 0; i < SPX5_DSM_CAL_LEN; i++)
+		data->schedule[i] = SPX5_DSM_CAL_EMPTY;
+
 	/* Maximum bandwidth for this taxi */
 	taxi_bw = (128 * 1000000) / sparx5_clk_period(sparx5->coreclock);
 
@@ -125,7 +128,7 @@ int lan969x_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
 	}
 
 	if (n_devs == 0) {
-		data->schedule[0] = SPX5_DSM_CAL_EMPTY;
+		data->schedule[0] = SPX5_DSM_CAL_MAX_DEVS_PER_TAXI;
 		return 0;
 	}
 
@@ -167,9 +170,6 @@ int lan969x_dsm_calendar_calc(struct sparx5 *sparx5, u32 taxi,
 		return -EINVAL;
 	}
 
-	for (u32 i = 0; i < SPX5_DSM_CAL_LEN; i++)
-		data->schedule[i] = SPX5_DSM_CAL_EMPTY;
-
 	/* Place the remaining devices */
 	for (u32 i = 0; i < DSM_CAL_DEV_MAX; i++) {
 		speed = &dev_speeds[i];

---
base-commit: 07bd391eb9572e74f073c49acef327611234f9bb
change-id: 20261019-lan969x-dsm-empty-taxi-0c07d0af77dc

Best regards,

Signature · 1 line
Daniel Machon <[email protected]>
#1 lore raw
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 4 lines · On Tue, 20 Oct 2026 10:58:35 +0200 you wrote:

lan969x_dsm_calendar_calc() computes the DSM calendar schedule of one taxi. sparx5_config_dsm_calendar() calls it for each taxi, reusing the same sparx5_calendar_data.

Quoted 8 lines

Before this patch, the schedule is only cleared after the n_devs == 0 early return. For a taxi with no active ports, the function writes SPX5_DSM_CAL_EMPTY only to schedule[0] and leaves the remaining slots at whatever they held before. For the first taxi that is zero from kzalloc(), so sparx5_dsm_cal_len() returns a bogus length and sparx5_dsm_calendar_check() fails, which fails the probe:

[...]

Here is the summary with links:
- [net] net: lan969x: fix DSM calendar for empty taxis

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

You are awesome, thank you!

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