public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend
@ 2026-03-12  8:13 Kevin Hao
  2026-03-12  8:13 ` [PATCH net 1/2] net: macb: Introduce gem_init_rx_ring() Kevin Hao
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kevin Hao @ 2026-03-12  8:13 UTC (permalink / raw)
  To: netdev
  Cc: Nicolas Ferre, Claudiu Beznea, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Kevin Hao,
	Quanyang Wang, stable

Hi,

On Versal boards, the tx/rx queue pointer registers are cleared after suspend,
which causes Ethernet malfunction. This patch series addresses this issue by
reinitializing the tx/rx queue pointer registers and the rx ring.

---
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>

---
Kevin Hao (2):
      net: macb: Introduce gem_init_rx_ring()
      net: macb: Reinitialize tx/rx queue pointer registers and rx ring during resume

 drivers/net/ethernet/cadence/macb_main.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
---
base-commit: f90aadf1c67c8b4969d1e5e6d4fd7227adb6e4d7
change-id: 20260311-macb-versal-e5493bbac09f

Best regards,
-- 
Kevin Hao <haokexin@gmail.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net 1/2] net: macb: Introduce gem_init_rx_ring()
  2026-03-12  8:13 [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend Kevin Hao
@ 2026-03-12  8:13 ` Kevin Hao
  2026-03-12  8:13 ` [PATCH net 2/2] net: macb: Reinitialize tx/rx queue pointer registers and rx ring during resume Kevin Hao
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hao @ 2026-03-12  8:13 UTC (permalink / raw)
  To: netdev
  Cc: Nicolas Ferre, Claudiu Beznea, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Kevin Hao

Extract the initialization code for the GEM RX ring into a new function.
This change will be utilized in a subsequent patch. No functional changes
are introduced.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 952aaf84757c20e94f3bbc98162a18330aa4cf73..67f7ecb05a7d6b8a5f49da588faafe1aa70d0d2b 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2805,6 +2805,14 @@ static void macb_init_tieoff(struct macb *bp)
 	desc->ctrl = 0;
 }
 
+static void gem_init_rx_ring(struct macb_queue *queue)
+{
+	queue->rx_tail = 0;
+	queue->rx_prepared_head = 0;
+
+	gem_rx_refill(queue);
+}
+
 static void gem_init_rings(struct macb *bp)
 {
 	struct macb_queue *queue;
@@ -2822,10 +2830,7 @@ static void gem_init_rings(struct macb *bp)
 		queue->tx_head = 0;
 		queue->tx_tail = 0;
 
-		queue->rx_tail = 0;
-		queue->rx_prepared_head = 0;
-
-		gem_rx_refill(queue);
+		gem_init_rx_ring(queue);
 	}
 
 	macb_init_tieoff(bp);

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net 2/2] net: macb: Reinitialize tx/rx queue pointer registers and rx ring during resume
  2026-03-12  8:13 [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend Kevin Hao
  2026-03-12  8:13 ` [PATCH net 1/2] net: macb: Introduce gem_init_rx_ring() Kevin Hao
@ 2026-03-12  8:13 ` Kevin Hao
  2026-03-13 14:12 ` [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend Simon Horman
  2026-03-14 19:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Kevin Hao @ 2026-03-12  8:13 UTC (permalink / raw)
  To: netdev
  Cc: Nicolas Ferre, Claudiu Beznea, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Kevin Hao,
	Quanyang Wang, stable

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
---
 drivers/net/ethernet/cadence/macb_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 67f7ecb05a7d6b8a5f49da588faafe1aa70d0d2b..100f478c0d30e4a91021a7da83f8f08606eca66e 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -6106,8 +6106,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);
 	}

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend
  2026-03-12  8:13 [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend Kevin Hao
  2026-03-12  8:13 ` [PATCH net 1/2] net: macb: Introduce gem_init_rx_ring() Kevin Hao
  2026-03-12  8:13 ` [PATCH net 2/2] net: macb: Reinitialize tx/rx queue pointer registers and rx ring during resume Kevin Hao
@ 2026-03-13 14:12 ` Simon Horman
  2026-03-14 19:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2026-03-13 14:12 UTC (permalink / raw)
  To: Kevin Hao
  Cc: netdev, Nicolas Ferre, Claudiu Beznea, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Quanyang Wang, stable

On Thu, Mar 12, 2026 at 04:13:57PM +0800, Kevin Hao wrote:
> Hi,
> 
> On Versal boards, the tx/rx queue pointer registers are cleared after suspend,
> which causes Ethernet malfunction. This patch series addresses this issue by
> reinitializing the tx/rx queue pointer registers and the rx ring.
> 
> ---
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
> Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Cc: Andrew Lunn <andrew+netdev@lunn.ch>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Paolo Abeni <pabeni@redhat.com>
> 
> ---
> Kevin Hao (2):
>       net: macb: Introduce gem_init_rx_ring()
>       net: macb: Reinitialize tx/rx queue pointer registers and rx ring during resume
> 
>  drivers/net/ethernet/cadence/macb_main.c | 23 +++++++++++++++++++----
>  1 file changed, 19 insertions(+), 4 deletions(-)

For the series,

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend
  2026-03-12  8:13 [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend Kevin Hao
                   ` (2 preceding siblings ...)
  2026-03-13 14:12 ` [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend Simon Horman
@ 2026-03-14 19:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-14 19:30 UTC (permalink / raw)
  To: Kevin Hao
  Cc: netdev, nicolas.ferre, claudiu.beznea, andrew+netdev, davem,
	edumazet, kuba, pabeni, quanyang.wang, stable

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 12 Mar 2026 16:13:57 +0800 you wrote:
> Hi,
> 
> On Versal boards, the tx/rx queue pointer registers are cleared after suspend,
> which causes Ethernet malfunction. This patch series addresses this issue by
> reinitializing the tx/rx queue pointer registers and the rx ring.
> 
> 
> [...]

Here is the summary with links:
  - [net,1/2] net: macb: Introduce gem_init_rx_ring()
    https://git.kernel.org/netdev/net/c/1a7124ecd655
  - [net,2/2] net: macb: Reinitialize tx/rx queue pointer registers and rx ring during resume
    https://git.kernel.org/netdev/net/c/718d0766ce4c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-14 19:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12  8:13 [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend Kevin Hao
2026-03-12  8:13 ` [PATCH net 1/2] net: macb: Introduce gem_init_rx_ring() Kevin Hao
2026-03-12  8:13 ` [PATCH net 2/2] net: macb: Reinitialize tx/rx queue pointer registers and rx ring during resume Kevin Hao
2026-03-13 14:12 ` [PATCH net 0/2] net: macb: Fix Ethernet malfunction on AMD Versal board after suspend Simon Horman
2026-03-14 19:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox