FAILED: Patch "net: macb: Fix tx/rx malfunction after phy link down and up" failed to apply to 6.12-stable tree
Subsystems (4)
Sasha Levin
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From bf9cf80cab81e39701861a42877a28295ade266f Mon Sep 17 00:00:00 2001
From: Kevin Hao <[email protected]>
Date: Sun, 8 Feb 2026 16:45:52 +0800
Subject: [PATCH] net: macb: Fix tx/rx malfunction after phy link down and up
In commit 99537d5c476c ("net: macb: Relocate mog_init_rings() callback from macb_mac_link_up() to macb_open()"), the mog_init_rings() callback was moved from macb_mac_link_up() to macb_open() to resolve a deadlock issue. However, this change introduced a tx/rx malfunction following phy link down and up events. The issue arises from a mismatch between the software queue->tx_head, queue->tx_tail, queue->rx_prepared_head, and queue->rx_tail values and the hardware's internal tx/rx queue pointers.
According to the Zynq UltraScale TRM [1], when tx/rx is disabled, the internal tx queue pointer resets to the value in the tx queue base address register, while the internal rx queue pointer remains unchanged. The following is quoted from the Zynq UltraScale TRM:
When transmit is disabled, with bit [3] of the network control register set low, the transmit-buffer queue pointer resets to point to the address indicated by the transmit-buffer queue base address register. Disabling receive does not have the same effect on the receive-buffer queue pointer.
Additionally, there is no need to reset the RBQP and TBQP registers in a phy event callback. Therefore, move macb_init_buffers() to macb_open(). In a phy link up event, the only required action is to reset the tx software head and tail pointers to align with the hardware's behavior.
[1] https://docs.amd.com/v/u/en-US/ug1085-zynq-ultrascale-trm
--- drivers/net/ethernet/cadence/macb_main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +5 -6
@@ -705,14 +705,12 @@ static void macb_mac_link_up(struct phylink_config *config,if (rx_pause) ctrl |=MACB_BIT (PAE ); -/* Initialize rings & buffers as clearing MACB_BIT(TE) in link down -* cleared the pipeline and control registers. -*/ -macb_init_buffers (bp); - -for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) +for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) { + queue->tx_head =0 ; + queue->tx_tail =0 ;queue_writel (queue,IER , bp->rx_intr_mask |MACB_TX_INT_FLAGS |MACB_BIT (HRESP )); + } }macb_or_gem_writel (bp,NCFGR , ctrl);
@@ -2954,6 +2952,7 @@ static int macb_open(struct net_device *dev) } bp->macbgem_ops.mog_init_rings (bp); +macb_init_buffers (bp);for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) {napi_enable (&queue->napi_rx);
Signature · 1 line
2.51.0
Hello Sasha,
Am Sat, Feb 28, 2026 at 08:28:05PM -0500 schrieb Sasha Levin:
Quoted 4 lines
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
I tried cherry-pick the upstream commit bf9cf80cab81e39701861a42877a28295ade266f on top of v6.12.74 (current state of the linux-6.12.y branch) and it produced no conflicts. In fact the diff is very much the same as below, so I'm a little puzzled why it failed at your side?
I'd like to see this fix in 6.12 stable, because it fixes an actual problem for us (see msg ids below [1] [2]). How to proceed here? E-mail as suggested above?
Greets
Alex
[1] <[email protected]>
[2] <[email protected]>
Quoted 84 lines
Thanks,
Sasha------------------ original commit in Linus's tree ------------------
From
bf9cf80cab81e39701861a42877a28295ade266fMon Sep 17 00:00:00 2001
From: Kevin Hao <[email protected]>
Date: Sun, 8 Feb 2026 16:45:52 +0800
Subject: [PATCH] net: macb: Fix tx/rx malfunction after phy link down and upIn commit
99537d5c476c("net: macb: Relocatemog_init_rings()callback frommacb_mac_link_up()tomacb_open()"), themog_init_rings()callback was moved frommacb_mac_link_up()tomacb_open()to resolve a deadlock issue. However, this change introduced a tx/rx malfunction following phy link down and up events. The issue arises from a mismatch between the softwarequeue->tx_head,queue->tx_tail,queue->rx_prepared_head, andqueue->rx_tailvalues and the hardware's internal tx/rx queue pointers.According to the Zynq UltraScale TRM [1], when tx/rx is disabled, the internal tx queue pointer resets to the value in the tx queue base address register, while the internal rx queue pointer remains unchanged. The following is quoted from the Zynq UltraScale TRM:
When transmit is disabled, with bit [3] of the network control register set low, the transmit-buffer queue pointer resets to point to the address indicated by the transmit-buffer queue base address register. Disabling receive does not have the same effect on the receive-buffer queue pointer.Additionally, there is no need to reset the RBQP and TBQP registers in a phy event callback. Therefore, move
macb_init_buffers()tomacb_open(). In a phy link up event, the only required action is to reset the tx software head and tail pointers to align with the hardware's behavior.[1] https://docs.amd.com/v/u/en-US/ug1085-zynq-ultrascale-trm
Fixes 99537d5c476c ("net: macb: Relocate mog_init_rings() callback from macb_mac_link_up() to macb_open()")Signed-off-by Kevin Hao <[email protected]>Signed-off-by Paolo Abeni <[email protected]>--- drivers/net/ethernet/cadence/macb_main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)drivers/net/ethernet/cadence/macb_main.c +5
-6@@ -705,14 +705,12 @@ static void macb_mac_link_up(struct phylink_config *config,if (rx_pause) ctrl |=MACB_BIT (PAE ); -/* Initialize rings & buffers as clearing MACB_BIT(TE) in link down -* cleared the pipeline and control registers. -*/ -macb_init_buffers (bp); - -for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) +for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) { + queue->tx_head =0 ; + queue->tx_tail =0 ;queue_writel (queue,IER , bp->rx_intr_mask |MACB_TX_INT_FLAGS |MACB_BIT (HRESP )); + } }macb_or_gem_writel (bp,NCFGR , ctrl);@@ -2954,6 +2952,7 @@ static int macb_open(struct net_device *dev) } bp->macbgem_ops.mog_init_rings (bp); +macb_init_buffers (bp);for (q =0 , queue = bp->queues; q < bp->num_queues; ++q, ++queue) {napi_enable (&queue->napi_rx);Signature · 1 line
2.51.0