From: Chris Babroski <cbabroski@nvidia.com>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <bryan.whitehead@microchip.com>, <UNGLinuxDriver@microchip.com>,
<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@kernel.org>, <kuba@kernel.org>, <pabeni@redhat.com>,
<richardcochran@gmail.com>, <linux@armlinux.org.uk>,
<Raju.Lakkaraju@microchip.com>, <maxime.chevallier@bootlin.com>,
<yuiko.oshino@microchip.com>, <cbabroski@nvidia.com>,
<nb@tipi-net.de>, <woojung.huh@microchip.com>
Subject: [PATCH net-next v2 2/7] net: lan743x: quiesce TX before freeing the rings
Date: Tue, 24 Nov 2026 09:33:17 -0500 [thread overview]
Message-ID: <ed26c8911890c12bdcb76e153ba44e882bc5ff9e.1795027003.git.cbabroski@nvidia.com> (raw)
In-Reply-To: <cover.1795027003.git.cbabroski@nvidia.com>
lan743x_pcidev_shutdown(), which suspend also uses, calls
netif_device_detach() and then lan743x_netdev_close() with the qdisc
still attached. Detaching only sets the queue stop bits. It does not wait
for an ndo_start_xmit() that is already running, and the TX NAPI poll
still wakes a stopped queue as soon as it has reclaimed descriptors. The
TX NAPI of a channel that has not been closed yet can therefore restart
its queue, and the stack then transmits on a ring that
lan743x_tx_close() is freeing.
Only wake a queue from TX NAPI while the device is present. In
lan743x_netdev_close(), wait for any NAPI poll that may have missed the
detach with synchronize_net(), then stop all queues with
netif_tx_disable(), which also waits for transmits in progress, before
closing the channels. For ndo_stop the qdisc is already deactivated, so
this only adds a grace period there.
Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver")
Signed-off-by: Chris Babroski <cbabroski@nvidia.com>
---
drivers/net/ethernet/microchip/lan743x_main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 92cdc13495fe..57d52930f89b 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -2137,7 +2137,8 @@ static int lan743x_tx_napi_poll(struct napi_struct *napi, int weight)
/* clean up tx ring */
lan743x_tx_release_completed_descriptors(tx);
txq = netdev_get_tx_queue(adapter->netdev, tx->channel_number);
- if (netif_tx_queue_stopped(txq)) {
+ if (netif_tx_queue_stopped(txq) &&
+ netif_device_present(adapter->netdev)) {
if (tx->rqd_descriptors) {
if (tx->rqd_descriptors <=
lan743x_tx_get_avail_desc(tx)) {
@@ -3374,6 +3375,9 @@ static int lan743x_netdev_close(struct net_device *netdev)
struct lan743x_adapter *adapter = netdev_priv(netdev);
int index;
+ synchronize_net();
+ netif_tx_disable(netdev);
+
for (index = 0; index < adapter->used_tx_channels; index++)
lan743x_tx_close(&adapter->tx[index]);
--
2.34.1
next prev parent reply other threads:[~2026-11-24 14:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 14:33 [PATCH net-next v2 0/7] net: lan743x: automatically recover from TX hang Chris Babroski
2026-11-24 14:33 ` [PATCH net-next v2 1/7] net: lan743x: check DMA channel stop and reset results Chris Babroski
2026-11-24 14:33 ` Chris Babroski [this message]
2026-11-24 14:33 ` [PATCH net-next v2 3/7] net: lan743x: start phylink last and stop it first Chris Babroski
2026-11-24 14:33 ` [PATCH net-next v2 4/7] net: lan743x: keep the fixed link across reopen Chris Babroski
2026-11-24 14:33 ` [PATCH net-next v2 5/7] net: lan743x: handle a failed reopen on resume Chris Babroski
2026-11-24 14:33 ` [PATCH net-next v2 6/7] net: lan743x: reset the device on TX timeout Chris Babroski
2026-11-24 14:33 ` [PATCH net-next v2 7/7] net: lan743x: add byte queue limits support Chris Babroski
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=ed26c8911890c12bdcb76e153ba44e882bc5ff9e.1795027003.git.cbabroski@nvidia.com \
--to=cbabroski@nvidia.com \
--cc=Raju.Lakkaraju@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=woojung.huh@microchip.com \
--cc=yuiko.oshino@microchip.com \
/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
all inboxes | Powered by JetHome®