From: Simon Horman <horms@kernel.org>
To: Kevin Hao <haokexin@gmail.com>
Cc: netdev@vger.kernel.org,
Quanyang Wang <quanyang.wang@windriver.com>,
stable@vger.kernel.org,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>
Subject: Re: [PATCH net v2] net: macb: Shuffle the tx ring before enabling tx
Date: Tue, 10 Mar 2026 16:34:56 +0000 [thread overview]
Message-ID: <20260310163456.GK461701@kernel.org> (raw)
In-Reply-To: <20260307-zynqmp-v2-1-6ef98a70e1d0@gmail.com>
On Sat, Mar 07, 2026 at 03:08:54PM +0800, Kevin Hao wrote:
> Quanyang observed that when using an NFS rootfs on an AMD ZynqMp board,
> the rootfs may take an extended time to recover after a suspend.
> Upon investigation, it was determined that the issue originates from a
> problem in the macb driver.
>
> According to the Zynq UltraScale TRM [1], when transmit is disabled,
> the transmit buffer queue pointer resets to point to the address
> specified by the transmit buffer queue base address register.
>
> In the current implementation, the code merely resets `queue->tx_head`
> and `queue->tx_tail` to '0'. This approach presents several issues:
>
> - Packets already queued in the tx ring are silently lost,
> leading to memory leaks since the associated skbs cannot be released.
>
> - Concurrent write access to `queue->tx_head` and `queue->tx_tail` may
> occur from `macb_tx_poll()` or `macb_start_xmit()` when these values
> are reset to '0'.
>
> - The transmission may become stuck on a packet that has already been sent
> out, with its 'TX_USED' bit set, but has not yet been processed. However,
> due to the manipulation of 'queue->tx_head' and 'queue->tx_tail',
> `macb_tx_poll()` incorrectly assumes there are no packets to handle
> because `queue->tx_head == queue->tx_tail`. This issue is only resolved
> when a new packet is placed at this position. This is the root cause of
> the prolonged recovery time observed for the NFS root filesystem.
>
> To resolve this issue, shuffle the tx ring and tx skb array so that
> the first unsent packet is positioned at the start of the tx ring.
> Additionally, ensure that updates to `queue->tx_head` and
> `queue->tx_tail` are properly protected with the appropriate lock.
>
> [1] https://docs.amd.com/v/u/en-US/ug1085-zynq-ultrascale-trm
>
> 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>
> Cc: stable@vger.kernel.org
> ---
> Changes in v2:
> - Resolves the issue of incomplete copying of the tx descriptor, as identified by the AI [1].
>
> - Resolves warnings for lines exceeding 80 columns.
>
> - Link to v1: https://lore.kernel.org/r/20260305-zynqmp-v1-1-5de72254d56b@gmail.com
>
> [1] https://netdev-ai.bots.linux.dev/ai-review.html?id=44318d8b-d8c3-42c8-8884-238421f708c5
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-03-10 16:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-07 7:08 [PATCH net v2] net: macb: Shuffle the tx ring before enabling tx Kevin Hao
2026-03-10 16:34 ` Simon Horman [this message]
2026-03-11 1:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260310163456.GK461701@kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.beznea@tuxon.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=haokexin@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=quanyang.wang@windriver.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox