net: macb: configure ENST registers for all queues
Subsystems (3)
PATCH RESEND v2 1/1 net: macb: configure ENST registers for all queues
When a taprio config only covered a subset of queues, the driver programmed the ENST registers only for the queues named in the config and left the remaining queues holding stale register values. This produced an inconsistent hardware setup that affected the scheduling of the configured queues.
This was observed on a GEM instance with four hardware queues, all enabled:
Initial configuration:
- All four queues are enabled.
- enst_on_time_qX registers are left at their reset value (0x0001FFFF).
- Only q0 and q1 are configured with valid, non-overlapping ENST schedules (T0 and T1 respectively).
- Traffic streams p0 and p1 are bound to q0 and q1.
- ENST is enabled only on q0 and q1.
Observed behavior:
- During T0 on-time, both p0 and p1 packets are transmitted.
- During T1 on-time, both p0 and p1 packets are transmitted.
With the unused queues (q2 and q3) explicitly programmed with enst_on_time = 0x0:
- During T0 on-time, only p0 packets are transmitted.
- During T1 on-time, only p1 packets are transmitted.
Leaving the ENST on-time registers of unused queues at their reset value (0x0001FFFF) disrupts the scheduling of the configured queues, whereas programming them with 0x0 yields the expected ENST operation.
Program the ENST registers for every queue unconditionally. The per-queue configuration array is now allocated for bp->num_queues and indexed directly by queue_id; unconfigured queues are left zero-initialized by kzalloc_objs(), so their registers are cleared. Indexing the array by queue_id also makes the queue_id field in struct macb_queue_enst_config redundant, so drop it.
---
Changes in v2:
- Rebased on latest net.
- Updated the allocation to use the kzalloc_objs() API.
Previous submission:
https://lore.kernel.org/netdev/[email protected]/
drivers/net/ethernet/cadence/macb.h | 2 -- drivers/net/ethernet/cadence/macb_main.c | 20 +++++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-)
drivers/net/ethernet/cadence/macb.h +0 -2
@@ -1493,7 +1493,6 @@ struct macb_platform_data {* @start_time_mask: Bitmask representing the start time for the queue * @on_time_bytes: "on" time nsec expressed in bytes * @off_time_bytes: "off" time nsec expressed in bytes -* @queue_id: Identifier for the queue * * This structure holds the configuration parameters for an ENST queue, * used to control time-based transmission scheduling in the MACB driver.
@@ -1502,7 +1501,6 @@ struct macb_queue_enst_config {u32 start_time_mask;u32 on_time_bytes; u32 off_time_bytes; - u8 queue_id; };#endif /* _MACB_H */
drivers/net/ethernet/cadence/macb_main.c +9 -11
@@ -4318,7 +4318,7 @@ static int macb_taprio_setup_replace(struct net_device *netdev,struct macb_queue *queue;u32 queue_mask;u8 queue_id; -size_t i; +size_t i, q;int err;if (conf->num_entries > bp->num_queues) {
@@ -4346,7 +4346,7 @@ static int macb_taprio_setup_replace(struct net_device *netdev,return -EINVAL ; } - enst_queue =kzalloc_objs (*enst_queue, conf->num_entries); + enst_queue =kzalloc_objs (*enst_queue, bp->num_queues);if (unlikely (!enst_queue))return -ENOMEM ;
@@ -4405,13 +4405,12 @@ static int macb_taprio_setup_replace(struct net_device *netdev, goto cleanup; } - enst_queue[i].queue_id = queue_id; - enst_queue[i].start_time_mask = + enst_queue[queue_id].start_time_mask = (start_time_sec <<GEM_START_TIME_SEC_OFFSET ) | start_time_nsec; - enst_queue[i].on_time_bytes = + enst_queue[queue_id].on_time_bytes =enst_ns_to_hw_units (entry->interval, speed); - enst_queue[i].off_time_bytes = + enst_queue[queue_id].off_time_bytes =enst_ns_to_hw_units (conf->cycle_time - entry->interval, speed); configured_queues |= entry->gate_mask;
@@ -4437,15 +4436,14 @@ static int macb_taprio_setup_replace(struct net_device *netdev,gem_writel (bp,ENST_CONTROL , queue_mask <<GEM_ENST_DISABLE_QUEUE_OFFSET ); -for (i =0 ; i < conf->num_entries; i++) { - queue = &bp->queues[enst_queue[i].queue_id]; +for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) {/* Configure queue timing registers */ queue_writel (queue,ENST_START_TIME , - enst_queue[i].start_time_mask); + enst_queue[q].start_time_mask);queue_writel (queue,ENST_ON_TIME , - enst_queue[i].on_time_bytes); + enst_queue[q].on_time_bytes);queue_writel (queue,ENST_OFF_TIME , - enst_queue[i].off_time_bytes); + enst_queue[q].off_time_bytes); }/* Enable ENST for all configured queues in one write */
Signature · 1 line
2.43.0
Quoted 37 lines · Vineeth Karumanchi
When a taprio config only covered a subset of queues, the driver programmed the ENST registers only for the queues named in the config and left the remaining queues holding stale register values. This produced an inconsistent hardware setup that affected the scheduling of the configured queues.
This was observed on a GEM instance with four hardware queues, all enabled:
Initial configuration:
- All four queues are enabled.
-enst_on_time_qXregisters are left at their reset value (0x0001FFFF).
- Only q0 and q1 are configured with valid, non-overlapping ENST schedules (T0 and T1 respectively).
- Traffic streams p0 and p1 are bound to q0 and q1.
- ENST is enabled only on q0 and q1.Observed behavior:
- During T0 on-time, both p0 and p1 packets are transmitted.
- During T1 on-time, both p0 and p1 packets are transmitted.With the unused queues (q2 and q3) explicitly programmed with
enst_on_time=0x0:
- During T0 on-time, only p0 packets are transmitted.
- During T1 on-time, only p1 packets are transmitted.Leaving the ENST on-time registers of unused queues at their reset value (
0x0001FFFF) disrupts the scheduling of the configured queues, whereas programming them with0x0yields the expected ENST operation.Program the ENST registers for every queue unconditionally. The per-queue configuration array is now allocated for
bp->num_queuesand indexed directly byqueue_id; unconfigured queues are left zero-initialized bykzalloc_objs(), so their registers are cleared. Indexing the array byqueue_idalso makes thequeue_idfield in structmacb_queue_enst_configredundant, so drop it.
Quoted 4 lines
Fixes 89934dbf169e ("net: macb: Add TAPRIO traffic scheduling support")Reviewed-by Théo Lebrun <[email protected]>Signed-off-by Vineeth Karumanchi <[email protected]>---
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 5 Oct 2026 16:38:55 +0530 you wrote:
When a taprio config only covered a subset of queues, the driver programmed the ENST registers only for the queues named in the config and left the remaining queues holding stale register values. This produced an inconsistent hardware setup that affected the scheduling of the configured queues.
This was observed on a GEM instance with four hardware queues, all enabled:
[...]
Here is the summary with links:
- [net,RESEND,v2] net: macb: configure ENST registers for all queues
https://git.kernel.org/netdev/net-next/c/04a943067baa
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html