Article View: linux.kernel.netdev
Article #22569Re: [PATCH net-next v2 1/7] net: lan743x: check DMA channel stop and reset results
From: netdev-bot+sashiko
Date: Wed, 25 Nov 2026 14:37
Date: Wed, 25 Nov 2026 14:37
139 lines
13147 bytes
13147 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The fix does not finish its own error path.
- [Low] In lan743x_tx_close(), the return value of the new
lan743x_tx_fifo_disable() is discarded, and `if (stop_failed)…
--
net: lan743x: check DMA channel stop and reset results
This patch checks the DMA channel stop result in lan743x_tx_close() and
lan743x_rx_close(). If the channel is still stop-pending or started, it
issues a channel soft reset before the rings are freed. It also moves the
channel and TX FIFO reset sequences into helpers, and lan743x_tx_open()
and lan743x_rx_open() now fail when those resets time out.
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index 82d3ec20ba259..92cdc13495fe9 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
[ ... ]
> @@ -2218,14 +2248,63 @@ static int lan743x_tx_ring_init(struct lan743x_tx *tx)
[ ... ]
> static void lan743x_tx_close(struct lan743x_tx *tx)
> {
> struct lan743x_adapter *adapter = tx->adapter;
> + bool stop_failed = false;
> + int ret;
>
> lan743x_csr_write(adapter,
> DMAC_CMD,
> DMAC_CMD_STOP_T_(tx->channel_number));
> - lan743x_dmac_tx_wait_till_stopped(adapter, tx->channel_number);
> + ret = lan743x_dmac_tx_wait_till_stopped(adapter, tx->channel_number);
> + if (ret < 0 || ret == DMAC_CHANNEL_STATE_STARTED) {
> + stop_failed = true;
> + netdev_warn(adapter->netdev,
> + "TX channel %d failed to stop, resetting it\n",
> + tx->channel_number);
> + }
>
> lan743x_csr_write(adapter,
> DMAC_INT_EN_CLR,
> @@ -2235,11 +2314,9 @@ static void lan743x_tx_close(struct lan743x_tx *tx)
> napi_disable(&tx->napi);
> netif_napi_del(&tx->napi);
>
> - lan743x_csr_write(adapter, FCT_TX_CTL,
> - FCT_TX_CTL_DIS_(tx->channel_number));
> - lan743x_csr_wait_for_bit(adapter, FCT_TX_CTL,
> - FCT_TX_CTL_EN_(tx->channel_number),
> - 0, 1000, 20000, 100);
> + lan743x_tx_fifo_disable(tx);
> + if (stop_failed)
> + lan743x_dmac_tx_reset(adapter, tx->channel_number);
[Severity: Low]
The return value of lan743x_tx_fifo_disable() is dropped here. The channel
SWR is issued based on stop_failed alone, even if FCT_TX_CTL_EN_ never
cleared.
The commit message says:
the TX channel should only be reset once its FIFO is stopped.
This patch targets a wedged channel. On that path, the FIFO is probably
the part most likely to also miss the 100 ms disable poll. Should the FIFO
disable result be checked before DMAC_CMD_TX_SWR_ is written? Another
option is a FIFO reset with FCT_TX_CTL_RESET_ at that point.
>
> lan743x_tx_release_all_descriptors(tx);
>
[Severity: High]
What happens here if lan743x_dmac_tx_reset() also times out?
The helper returns -ETIMEDOUT and logs "TX channel %d reset timed out".
That return value is dropped, and lan743x_tx_close() continues into two
calls:
- lan743x_tx_release_all_descriptors(), which unmaps and frees the TX
skbs.
- lan743x_tx_ring_cleanup(), which calls dma_free_coherent() on the
descriptor ring and the head write-back buffer.
The commit message says the reset is issued "before anything is freed",
so that memory the channel "may still be fetching from or writing to" is
not released. If a wedged channel can ignore STOP_T, can it also ignore
SWR? The open path in this patch already treats an SWR timeout as a real
failure.
lan743x_rx_close() follows the same pattern:
ret = lan743x_dmac_rx_wait_till_stopped(adapter, rx->channel_number);
if (ret < 0 || ret == DMAC_CHANNEL_STATE_STARTED) {
...
lan743x_dmac_rx_reset(adapter, rx->channel_number);
}
...
lan743x_rx_ring_cleanup(rx);
On the RX side, an engine that is still running could write incoming
frame data, descriptor status and the head index into memory that has
already gone back to the allocator.
Older code makes this worse on the next open. The call chain
lan743x_rx_ring_init()->lan743x_rx_init_ring_element()->
lan743x_rx_update_tail() writes RX_TAIL before lan743x_rx_open() resets
the channel. At that point RX_BASE_ADDR still points at the ring that was
freed.
This also looks unchanged after the later patch in the series, "net:
lan743x: reset the device on TX timeout". That patch runs
lan743x_dmac_init() only after lan743x_netdev_close() has already freed
the rings.
Could the close paths check the reset result and, if it failed, leak the
DMA memory instead of freeing it? Escalating to a full DMAC or PCI reset
would be another option.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795027003.git.cbabroski%40nvidia.com
Technical Details
Message-ID:
<179561742163.3135.1760016027745827288@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder3.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371409-linux-kernel-netdev=dewy.ruReferences:
<b1dc6a8037ab596053cc60c065a9b447982118df.1795027003.git.cbabroski@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder3.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371409-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 1/7] net: lan743x: check DMA channel stop and reset results Date: Wed, 25 Nov 2026 14:37:01 +0000 Organization: Usenet Network Message-ID: <179561742163.3135.1760016027745827288@kernel.org> References: <b1dc6a8037ab596053cc60c065a9b447982118df.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="230117"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:tRBo/uiipHUi0IfVilXRsTiYMLI= sha256:uY5eyY/c73xzqhrM8vKE9qt+USO3q0enbxL17aCgHdA= sha1:FdEl2JPp16eYUeGEVIbsL8gGVko= sha256:fmaHRiEvSF1h2+TMr0NuDrnDYnti/eT9nXttKu9+1D0= 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 C36AE125E70; Wed, 25 Nov 2026 17:37:28 +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 BWxjgR_0rDMo; Wed, 25 Nov 2026 17:37:25 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371409-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 D113D125E71; Wed, 25 Nov 2026 17:37:15 +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 B8EB036BC7; Wed, 25 Nov 2026 14:37:10 +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=1795617429; b=clFmtgdUY+ou4nBIKKkOhkpenJg28cjTw5YDSsVql3RPI7lPelrB962T7QTbBiM0kce+ Lsnp//LLGePsK6jQHFDHr+Kb8X+r1fjrOzrldwIF4DBHoDeDluAgtnuiV9fxvD9nJLzZH +EoBgGhZic685nVhjS/URWbD9E+FurBR5ehffalCyfINedD7t2jx7Q/PDbGcHw1UYr8mP AfiuW1Kl89yY44mblHxEViMG1/kfc/U+WdF8u3Jn45p7EbGoaFWAIRQ2/+1NwAIlX6+eN j//IlEZTC7Gv3iGeYHndgb9uTH5LOJNwfK2pCE/8VblousE5G2R8r5ALEhr4tYxOwcg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617429; 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=Ntm+4YZ5zXeTUCr55OFzUjV2Ud773hYRmG/JzK3KOAM=; b=mvvxfOZd9ngeuT4JKymg5FIhfm31nFa9GXxZkSbq/sS+JTe1K7+aOriHNzthAhDXs1vc GB5fDEoaPaJvBJByNGurAIz8n9cRYgLPfWfF57zwHsiQlXTzAqPxMCd00PKFj/FxCaVrI zT0y10aAXMjyAcJD83hjvxnrHIe+chW03IP56ky9xNj/TRb6pPlyQMpfyUQZmfO/pSttF zzCp9tsZIm629t2m/2KxxBuCqdz5NUEfQeTkm2YqvjNiHsSHgootBXqnT39JjLgjfBX2D YoipDEFwV5E6zZJjsmVLElJsWabMw8XSVX77aTmxdt62UldbO5EbVSyukdOMkYjz+jQ== 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=KCVvNIOc; 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 CDF19606A33D; Wed, 25 Nov 2026 14:37:09 +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=KCVvNIOc 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=1795617424; b=BjqzcRgHhd4dsEXdHts50AGIJ6URnGzb7fnmvkb3cmXzj+QlrRReAXZHMWZrxjB5DnmI d2NxsqkA43VDEyLN+zY1bHwjCtpurqPv5T5lP2HMj6IxnSndGyLTyy+S+ejPCZkH0ci7P 9jLMr4pz2p9gC3zkct/vPa/6lqmcZFHYmSWNjN444JSAWCuSJNnrjnd7fUe0R0lLCQf9b xbtM2+teKvvDg860buY2kaERBQLrOVH141Uk9B2gaENbD6YzOUIQMdfvnojEtbmWmYxg0 MOzBG3mr5PSpGRWnbE/pnb0R9QeoEUfGBv7GqC76hXG2bi29bkVoI+4OLxSBQXrJB+w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795617424; 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=Ntm+4YZ5zXeTUCr55OFzUjV2Ud773hYRmG/JzK3KOAM=; b=ZikHkZ8s6Y3+NN+/9r31aNCuaUOTyMeDeVFUPAbHkaWEH5rTVPzk0p86o2H0cF4tELje vSxzS2Ad07RF1cJHcqmvc9fSDX7OUtfsodyCkr93fa3a0/N0Vzh5FChth1sQFwib33ThH fAW0viNAvAte+X5d/psnBrESmwchV3wcOLVdUcCVNvEvU7cotPWmYjGghNTVPBIsmQDjH DfEzEE8FfZze83JV3/pk7oCOgZ7Pce76ln3u2hz1P7jV377ExrgVA0+mYsV1qZ0wU+GUU 4zy4i33CuJrpV5raT3/LyOwLDcPDyZTvrpuvT6WEkc2u1rIVx+NW+mBJKIQkL27DP4Q== 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=KCVvNIOc; 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 EB802606A321; Wed, 25 Nov 2026 14:37:03 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 251B61F000CF; Wed, 25 Nov 2026 14:37:02 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795617423; bh=Ntm+4YZ5zXeTUCr55OFzUjV2Ud773hYRmG/JzK3KOAM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=KCVvNIOcJY8bDOI+cfTQF/97tClJmObBRjvrZI1GfohB3Zz4g6xhFZr9LN2R+IHtm JyMiKnd1uNzMlTigRLaZNc9vsvBn7A9+UZd8fOsMXA70HxOnLqKGpx5BXnB/8DYuXz lb+pA3f8jqgrIjRYGqxB1s6mdExCJfIqP0PKeRX4TrpBM420qqK+fBpHfdc6ofwNdQ CIQdSne8LD9Y/S7q36r5SygNv/rpH/fugQ3McS+xn2jCKataw8wLweoCesBSuPd3gq qKEb53zrUFJvWom/HNmQTCdp2IgB2Z5+VtuKs2UP93QPjpkl3YdxQY90gKJhFIVP2i 9Jpjx7TVwnSFw== 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: <b1dc6a8037ab596053cc60c065a9b447982118df.1795027003.git.cbabroski@nvidia.com> X-sashiko-severity: High 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