From: Nicolai Buchwitz <nb@tipi-net.de>
To: Chris Babroski <cbabroski@nvidia.com>
Cc: bryan.whitehead@microchip.com, UNGLinuxDriver@microchip.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, richardcochran@gmail.com,
linux@armlinux.org.uk, maxime.chevallier@bootlin.com,
Raju.Lakkaraju@microchip.com, davthompson@nvidia.com
Subject: Re: [PATCH net-next v1 4/5] net: lan743x: reset the device on TX timeout
Date: Mon, 19 Oct 2026 12:23:19 +0200 [thread overview]
Message-ID: <5cabe797885011ea204a793557d8639a@tipi-net.de> (raw)
In-Reply-To: <784a571839d5dd83c2c3e8ea38844159f353de77.1792008404.git.cbabroski@nvidia.com>
Hi Chris
On 15.10.2026 17:00, Chris Babroski wrote:
> The driver does not implement ndo_tx_timeout, so the core TX watchdog
> is
> never started. If a TX DMA channel stops completing descriptors, its
> queue stays stopped and the interface cannot transmit again until it is
> brought down and back up.
>
> Add an ndo_tx_timeout handler that schedules a work item to reset the
> device. Under rtnl_lock(), the work detaches the netdev, closes it,
> soft-resets the DMA controller, opens it again and reattaches it. This
> is the sequence suspend and resume already use, with the DMA controller
> reset taking the place of the full hardware init.
>
> Because everything is reopened, the RX path, PTP and the PHY link are
> restarted along with TX. For PTP, the reset has the same effect as
> bringing the interface down and up. As on suspend and resume, the PTP
> clock is unregistered and registered again, and its time is reset to
> the
> system time. The hardware timestamping state is also reset, so the RX
> filter returns to none and one-step sync insertion is disabled, while
> the driver keeps its TX timestamping flags. PTP applications have to
> set
> up timestamping again.
Is it ok to re-register the PTP clock on a reset the driver starts by
itself?
ptp_clock_unregister() makes the open /dev/ptpN return -ENODEV, and
since the old index stays taken while ptp4l holds it, the reopen comes
back as a different /dev/ptpN. So ptp4l has to be restarted, which is
more than "set up timestamping again"...
How about moving clock registration to probe instead, so it survives
the reset? Then only the hw timestamping config would need to be put
back.
>
> lan743x_dmac_init() did not check that the DMA controller soft reset
> completed, so the work could reopen a controller whose reset timed out.
> Return the error from the poll so the work can tell. Probe already
> fails
> when lan743x_dmac_init() returns an error, so a controller that does
> not
> come out of reset now also fails probe.
>
> If lan743x_dmac_init() or the reopen returns an error, the interface is
> taken down with dev_close() so it can be brought back up later. The
> hardware is already closed at that point, so route ndo_stop through a
> wrapper that skips the hardware close while the device is detached.
>
> ndo_stop is called with rtnl held and cannot wait for the work, so it
> only cancels a pending one. A work that is already waiting for rtnl
> returns if the device is still down when it gets the lock. If the
> device
> was opened again in the meantime, it is reset once more, which only
> costs an extra link flap. On remove, the work is cancelled
> synchronously
> after the netdev is unregistered.
>
> Assisted-by: LLM
> Signed-off-by: Chris Babroski <cbabroski@nvidia.com>
> ---
> drivers/net/ethernet/microchip/lan743x_main.c | 74 ++++++++++++++++++-
> drivers/net/ethernet/microchip/lan743x_main.h | 2 +
> 2 files changed, 73 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c
> b/drivers/net/ethernet/microchip/lan743x_main.c
> index 8d256a80dac6..2545a846478d 100644
> [...]
> +static void lan743x_reset_work(struct work_struct *work)
> +{
> + struct lan743x_adapter *adapter =
> + container_of(work, struct lan743x_adapter, reset_work);
> + struct net_device *netdev = adapter->netdev;
> + int ret;
> +
> + rtnl_lock();
> +
> + if (!netif_running(netdev) || !netif_device_present(netdev))
> + goto unlock;
> +
> + netdev_warn(netdev, "resetting after TX timeout\n");
> +
> + netif_device_detach(netdev);
> + lan743x_netdev_close(netdev);
> +
> + ret = lan743x_dmac_init(adapter);
> + if (ret) {
> + netdev_err(netdev, "DMA controller reset failed: %d\n", ret);
> + goto close;
> + }
> +
> + ret = lan743x_netdev_open(netdev);
> + if (ret) {
> + netdev_err(netdev, "failed to reopen after reset: %d\n", ret);
> + goto close;
> + }
Unrelated to this series, but lan743x_pm_resume() seems to ignore this
return value.
> [...]
Thanks,
Nicolai
next prev parent reply other threads:[~2026-10-19 10:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 15:00 [PATCH net-next v1 0/5] net: lan743x: automatically recover from TX hang Chris Babroski
2026-10-15 15:00 ` [PATCH net-next v1 1/5] net: lan743x: reset DMA channels that fail to stop Chris Babroski
2026-10-19 10:18 ` Nicolai Buchwitz
2026-10-15 15:00 ` [PATCH net-next v1 2/5] net: lan743x: start phylink last and stop it first Chris Babroski
2026-10-19 10:13 ` Nicolai Buchwitz
2026-10-15 15:00 ` [PATCH net-next v1 3/5] net: lan743x: quiesce TX before freeing the rings Chris Babroski
2026-10-19 10:14 ` Nicolai Buchwitz
2026-10-15 15:00 ` [PATCH net-next v1 4/5] net: lan743x: reset the device on TX timeout Chris Babroski
2026-10-19 10:23 ` Nicolai Buchwitz [this message]
2026-10-15 15:00 ` [PATCH net-next v1 5/5] net: lan743x: add byte queue limits support Chris Babroski
2026-10-19 10:14 ` Nicolai Buchwitz
2026-10-19 9:47 ` [PATCH net-next v1 0/5] net: lan743x: automatically recover from TX hang Nicolai Buchwitz
2026-10-19 19:49 ` Woojung.Huh
2026-10-19 16:34 [PATCH net-next v1 4/5] net: lan743x: reset the device on TX timeout netdev-bot+sashiko
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=5cabe797885011ea204a793557d8639a@tipi-net.de \
--to=nb@tipi-net.de \
--cc=Raju.Lakkaraju@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=bryan.whitehead@microchip.com \
--cc=cbabroski@nvidia.com \
--cc=davem@davemloft.net \
--cc=davthompson@nvidia.com \
--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=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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®