Article View: linux.kernel.netdev
Article #22571Re: [PATCH net-next v2 6/7] net: lan743x: reset the device on TX timeout
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 14:37
Date: Wed, 25 Nov 2026 14:37
137 lines
12831 bytes
12831 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] A single TX timeout can trigger two back-to-back device resets,
because lan743x_reset_work() does not wait for a dev_watchdog() callβ¦
--
net: lan743x: reset the device on TX timeout
This adds an ndo_tx_timeout handler to the lan743x driver. The handler
schedules a work item that, under rtnl, detaches the netdev, closes it,
soft-resets the DMA controller, reopens it and reattaches it. The patch
also makes lan743x_dmac_init() return an error when the DMAC soft reset
times out.
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index 228b6ab539a17..3f129a22921e1 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
[ ... ]
> @@ -3381,6 +3385,12 @@ static int lan743x_netdev_close(struct net_device *netdev)
> struct lan743x_adapter *adapter = netdev_priv(netdev);
> int index;
>
> + /* lan743x_reset_work() takes rtnl, so it cannot be waited for here.
> + * A running one returns if the device is still down when it gets
> + * rtnl, otherwise it resets the reopened device once more.
> + */
> + cancel_work(&adapter->reset_work);
> +
> lan743x_phylink_disconnect(adapter);
>
> synchronize_net();
[ ... ]
> @@ -3485,6 +3495,57 @@ static int lan743x_netdev_stop(struct net_device *netdev)
> return lan743x_netdev_close(netdev);
> }
>
> +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);
[Severity: Low]
Can one TX timeout cause two resets in a row here?
netif_device_detach() only clears __LINK_STATE_PRESENT. It does not take
dev->tx_global_lock. dev_watchdog() holds that lock while it checks
presence, scans the queues, prints a message and calls ndo_tx_timeout():
net/sched/sch_generic.c:dev_watchdog() {
spin_lock(&dev->tx_global_lock);
if (!qdisc_tx_is_noop(dev)) {
if (netif_device_present(dev) &&
netif_running(dev) &&
netif_carrier_ok(dev)) {
...
netdev_crit(dev, "NETDEV WATCHDOG: CPU: %d: transmit queue %u timed out %u ms\n",
...
netif_freeze_queues(dev);
dev->netdev_ops->ndo_tx_timeout(dev, i);
...
}
This interleaving looks possible:
CPU0 (dev_watchdog) CPU1 (lan743x_reset_work)
spin_lock(tx_global_lock)
netif_device_present() is true
netif_device_detach()
lan743x_netdev_close()
cancel_work() /* work is running,
not pending */
netdev_crit(...)
lan743x_netdev_tx_timeout()
schedule_work() /* requeues */
spin_unlock(tx_global_lock)
netif_tx_disable() /* waits on
tx_global_lock */
The netif_tx_disable() call in lan743x_netdev_close() is the first point
that serializes against dev_watchdog() through tx_global_lock. It runs
after cancel_work(), so nothing cancels the requeued work.
When the first reset calls netif_device_attach(), the requeued work sees
netif_running() and netif_device_present() both true. It then runs the
full detach/close/dmac_init/open/attach sequence a second time. That
means a second link flap and a second PTP clock unregister and register,
which can give the clock a new /dev/ptpN again.
The ndo_stop path does not have this window. There,
__dev_close_many()->dev_deactivate_many()->netdev_watchdog_down() stops
the watchdog before ndo_stop runs cancel_work(). The commit message only
accepts an extra reset for the ndo_stop/reopen race.
Would moving cancel_work() after netif_tx_disable() in
lan743x_netdev_close() close this window?
> +
> + ret = lan743x_dmac_init(adapter);
> + if (ret) {
[ ... ]
> +static void lan743x_netdev_tx_timeout(struct net_device *netdev,
> + unsigned int txqueue)
> +{
> + struct lan743x_adapter *adapter = netdev_priv(netdev);
> +
> + schedule_work(&adapter->reset_work);
> +}
[ ... ]
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795027003.git.cbabroski%40nvidia.com
Technical Details
Message-ID:
<179561742750.3135.10907427867283855252@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371412-linux-kernel-netdev=dewy.ruReferences:
<a6d08d5760ecabea5c77d6001a8281c820873512.1795027003.git.cbabroski@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371412-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 6/7] net: lan743x: reset the device on TX timeout Date: Wed, 25 Nov 2026 14:37:07 +0000 Organization: Usenet Network Message-ID: <179561742750.3135.10907427867283855252@kernel.org> References: <a6d08d5760ecabea5c77d6001a8281c820873512.1795027003.git.cbabroski@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="230216"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ieja1NdkWsesg2UEGPwDXTmyDS8= sha256:jmfcZyFtDCr+WcCdsuyxkHMo4IeOANm5rxevPtgDHyw= sha1:SQO1RlyS1Z/leJDE0MEQTNnw0KE= sha256:lX5gMzTPicIoLlK2XrVIkZb7XXGK5bp0yZkZQMRFUak= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2508D125E70; Wed, 25 Nov 2026 17:37:32 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i790BI2c-KSO; Wed, 25 Nov 2026 17:37:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371412-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 442BA125E69; Wed, 25 Nov 2026 17:37:18 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 07A86337C9; Wed, 25 Nov 2026 14:37:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795617430; b=QXDWx+oX3AXUpbnKYFMRmYlji9kXPoLMVKMu9em80OQv5NnMXIM+6eh77J4R8WrV2pLx OFW9lcGGKYCEIDZKNuhq3ivBs8LCCE+3awR/TKdOCBIrO3Lvsasies5qDLcxqiDCZy2qx Bpur86y17TBNROo3nG+vFkRntwJkHE9nRXeUh1lSi3JyN8UkPhiqYww0WSKPccpoLCPWo 3m4nqnsm/sRtaCMl8xTfDj5V/0/N12TYclQrVEuo5rqaI+xdYLh1IILLtSmITC959dl5o U9J8mhZZKKxqV8zMGDgJyXgpIM6gVT0dhTdY9zQqnuBpRjShswHm0LFW16Y8sEkzKXQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617430; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=XKlofb4mp2YjJH48h+x2W8bCswXbdvaAGXnOq1DoHEg=; b=HkfFhCBCu+BT+8VRWCqWSSjNEqqH2MFVhtRKudiHDoQLY47XjEwuXxm5fUpk5zcWCxUT w5wLDtDG3onJfZob/jxkqzi+XfpCEE5aDbv3kqZzLfni2GZJtYPS734bMhgzCMGTwsG+O Ty1TMquxbcfC5v7MLNcJi0Tvtj/8wNTHuXCsFYm+zwUbYmdZfP6ssUs+cqrWAWsyx2MO6 SWVQsOpoof/ySgMbDbLUriCKWyOp6tDFFD4FXZNCYDua1+fNuTDpDs+Hd2ABOADtMZBQD Wpk6zp3jUU1oGBi+ENdNRZvmXJBtdhT9XjjhrhUeTfNYlO8uoFBuBeoygQ13rl+6vvw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eC5wP0aZ; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3908F606A685; Wed, 25 Nov 2026 14:37:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eC5wP0aZ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795617429; b=J0eF+olCWjMpatRQo5g0mvgoW6QSMUWaUbxGt93buk9MHI5L2vDgVFCY3W96XXQQu3x/ t75o4wdmngrTSUgYjtOOTfjekpqS3KnBuHxMA40EShTbXpALPP3Bw9ZDx3NvJTCjXaIUN zu5uJtn4odFi9XgpCbALg7rcfMBVaZbWRDi2UWy9Eo/UHDu/vp2yGYKCnvSE/1JKm7je5 vHEZiBuwLfPQSTudeP6W8GNT3ulO9GXNFkkrZBpIM8lwWkd/CO+5T7nU72NW8vYQYCXkQ rpHXraKZOG+RVRrmyv6e1fHm8OF7gCNcyWYjEh9pjkVs+2N+lK8Y2tb1x316oK99qnA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617429; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=XKlofb4mp2YjJH48h+x2W8bCswXbdvaAGXnOq1DoHEg=; b=o/E1bDSSPxhWWr6IDS1rW/AJGZ1qh4yzqjstsndXkdlzdXU8Etplui/f1GiiSGDkEz26 xOnmo1XLpBslPbwQQXUZCdDW5Ej2iEnJdAP3fClzTXgocnbGl0KB2wJctyrhr4YAvoEUC opNqES/Oa7kQnaWFU6EBOL4MpqLODverRJTwWtpI2vo4dJ5jN2dO02HAGKFciuNHVzRUz aWtq6oQf6w+AUl3QUQA5CtxSFFCS0UDZR3Dql+ENfQuhA0fS3vTQsrSqq8VtQU4Wgr6Wb 8A1M9psEl3OhPGY6kA0Ocx/ukHZjsiGMLDi+1bC9ESM8U9+ay6OaOpZ0QdF5iBrki7w== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eC5wP0aZ; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A4F6606A333; Wed, 25 Nov 2026 14:37:09 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA4A01F000ED; Wed, 25 Nov 2026 14:37:07 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795617428; bh=XKlofb4mp2YjJH48h+x2W8bCswXbdvaAGXnOq1DoHEg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=eC5wP0aZ58R25sb7QsgyhBiRygWlYXuvOorQ3N99XVPqbooL6DBSXQKQyFt731i0I II/gl/U7Mz9wGzLuS8R1HE0EqgGgTaXCVXYllNdBtqNIq/cBuQcdVolYt5m/qDwPct uuZ7Ya91eJtKunr/FJ1lR+KQ2MBFcI4b0TpcuIQBauI0cgQDsjnB+4mMdBRz1J0aJQ S1dc5U8mpAYAC7CVg3JXSIrsb+HWNigEaTYaRMTLqsSAKUKEmjDgyMOWlITFlkEK6Z AazmlUZorEIGa+rGbQQkn5JqQheGIRWZf5LPujkSmEAeoy7pQfGQ8+R2hIdfjRi/x2 tih8Hwuk5grEQ== X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 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, nb@tipi-net.de, woojung.huh@microchip.com X-In-Reply-To: <a6d08d5760ecabea5c77d6001a8281c820873512.1795027003.git.cbabroski@nvidia.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list