]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: macb: Reinitialize tx/rx queue pointer registers and rx ring during resume
authorKevin Hao <haokexin@gmail.com>
Fri, 20 Mar 2026 14:14:01 +0000 (10:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:48 +0000 (11:08 +0100)
[ Upstream commit 718d0766ce4c7634ce62fa78b526ea7263487edd ]

On certain platforms, such as AMD Versal boards, the tx/rx queue pointer
registers are cleared after suspend, and the rx queue pointer register
is also disabled during suspend if WOL is enabled. Previously, we assumed
that these registers would be restored by macb_mac_link_up(). However,
in commit bf9cf80cab81, macb_init_buffers() was moved from
macb_mac_link_up() to macb_open(). Therefore, we should call
macb_init_buffers() to reinitialize the tx/rx queue pointer registers
during resume.

Due to the reset of these two registers, we also need to adjust the
tx/rx rings accordingly. The tx ring will be handled by
gem_shuffle_tx_rings() in macb_mac_link_up(), so we only need to
initialize the rx ring here.

Fixes: bf9cf80cab81 ("net: macb: Fix tx/rx malfunction after phy link down and up")
Reported-by: Quanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Tested-by: Quanyang Wang <quanyang.wang@windriver.com>
Cc: stable@vger.kernel.org
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260312-macb-versal-v1-2-467647173fa4@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/cadence/macb_main.c

index 6ee3fc7357a464d0bc4e56e0097ae18fbc0da557..533bd66fb485c92c9639ea53d0e7cc2540e7c8c5 100644 (file)
@@ -5527,8 +5527,18 @@ static int __maybe_unused macb_resume(struct device *dev)
                rtnl_unlock();
        }
 
+       if (!(bp->caps & MACB_CAPS_MACB_IS_EMAC))
+               macb_init_buffers(bp);
+
        for (q = 0, queue = bp->queues; q < bp->num_queues;
             ++q, ++queue) {
+               if (!(bp->caps & MACB_CAPS_MACB_IS_EMAC)) {
+                       if (macb_is_gem(bp))
+                               gem_init_rx_ring(queue);
+                       else
+                               macb_init_rx_ring(queue);
+               }
+
                napi_enable(&queue->napi_rx);
                napi_enable(&queue->napi_tx);
        }