Article View: linux.kernel.netdev
Article #8443Re: [PATCH net v6 4/4] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
From: netdev-bot+sashiko
Date: Thu, 29 Oct 2026 00:59
Date: Thu, 29 Oct 2026 00:59
103 lines
12097 bytes
12097 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0
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).
- [Medium] The patch adds two early returns to mtk_wed_start() in
drivers/net/ethernet/mediatek/mtk_wed.c.
--
net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986
On v2 WED hardware where rx_ring[0] is not allocated (non-DBDC MT7986),
this patch makes mtk_wed_start() program WDMA_RING_TX(0), because WED RX
still sends through that ring. It also adds error messages and early
returns for when the WDMA RX or TX ring setup fails.
> diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
> index 3044a7a8ea03e..f40ac5794341c 100644
> --- a/drivers/net/ethernet/mediatek/mtk_wed.c
> +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
> @@ -2345,7 +2345,20 @@ mtk_wed_start(struct mtk_wed_device *dev, u32 irq_mask)
>
> for (i = 0; i < ARRAY_SIZE(dev->rx_wdma); i++)
> if (!dev->rx_wdma[i].desc)
> - mtk_wed_wdma_rx_ring_setup(dev, i, 16, false);
> + if (mtk_wed_wdma_rx_ring_setup(dev, i, 16, false)) {
> + dev_err(dev->hw->dev, "wdma rx ring %d setup failed\n", i);
> + return;
> + }
> +
> + /*
> + * non-DBDC MT7986 allocates only rx_ring[1] and tx_wdma[1] during setup
> + * but tx_wdma[0] is also needed for WED to function.
> + */
> + if (mtk_wed_is_v2(dev->hw) && !dev->rx_ring[0].desc)
> + if (mtk_wed_wdma_tx_ring_setup(dev, 0, MTK_WED_WDMA_RING_SIZE, !!dev->tx_wdma[0].desc)) {
> + dev_err(dev->hw->dev, "wdma tx ring 0 setup failed\n");
> + return;
> + }
[Severity: Medium]
Can these early returns leave WED half-configured without the caller
noticing?
mtk_wed_start() is static void, and the ops callback is
void (*start)(struct mtk_wed_device *dev, u32 irq_mask), so the error
goes no further than this function.
Both returns happen after mtk_wed_rx_buffer_alloc() has succeeded, and
maybe after some WDMA_RING_RX(i) and MTK_WED_WDMA_RING_RX(i) registers
have been written. They then skip mtk_wed_hw_init(),
mtk_wed_configure_irq(), mtk_wed_set_ext_int(), mtk_wed_dma_enable() and
dev->running = true.
In mt76, mt7915_dma_start() has already written the WED IRQ mask to
MT_INT_MASK_CSR or MT_INT_WED_MASK_CSR. It then continues as if WED were
running:
drivers/net/wireless/mediatek/mt76/mt7915/dma.c:mt7915_dma_start() {
...
mtk_wed_device_start(&dev->mt76.mmio.wed, wed_irq_mask);
}
irq_mask = reset ? MT_INT_MCU_CMD : irq_mask;
mt7915_irq_enable(dev, irq_mask);
mt7915_irq_disable(dev, 0);
return 0;
}
mtk_wed_device_active() is just !!(_dev)->ops. So the WLAN driver keeps
sending traffic and IRQ handling through a WED whose DMA was never
enabled, and the only sign is the dev_err in the log. mt7996 calls
mtk_wed_device_start() the same way.
The rx_wdma change also alters behavior that is unrelated to the
WDMA_RING_TX(0) fix. Before this patch, a failed rx_wdma allocation left
only that one WDMA RX ring unprogrammed, and WED still started. Now one
dma_alloc_coherent() failure in mtk_wed_ring_alloc() stops the whole WED
datapath from being enabled.
This can only happen on the first start under allocation failure. SER
restarts reuse the rings that were already allocated.
The commit message says "add error messages and bail when mtk_wed_start
fails". It does not mention that callers cannot see the bail, or that no
state is rolled back.
Would it be better to propagate the error? For example, the start op
could return int and the mt7915/mt7996 dma_start paths could handle the
failure. Another option is to fall back to non-WED operation.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261026-wedfix-v6-0-a52f6b15d2fc%40gmail.com
Technical Details
Message-ID:
<179323559733.3134.3679438988787780948@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353110-linux-kernel-netdev=dewy.ruReferences:
<20261026-wedfix-v6-4-a52f6b15d2fc@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353110-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v6 4/4] net: ethernet: mtk_wed: setup WDMA_RING_TX(0) for non-DBDC MT7986 Date: Thu, 29 Oct 2026 00:59:57 +0000 Organization: Usenet Network Message-ID: <179323559733.3134.3679438988787780948@kernel.org> References: <20261026-wedfix-v6-4-a52f6b15d2fc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1905727"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Ntma+MgavITqEk83Mvp4MZHepBE= sha256:oGuP76o3pPkaX1zfPi/AgQxPHtEOYRIehEQTdBvdh9A= sha1:rZUlpwkpG9hAdNWKRIZ9s9B3ZfQ= sha256:oTI+/hIfsEAEbiKDGASPbsuojEc2XO+JM5wCQj+6EUc= 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 B68FA125C51; Thu, 29 Oct 2026 04:01:24 +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 92C4qqYuVx2s; Thu, 29 Oct 2026 04:01:21 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-353110-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 6686F125C4D; Thu, 29 Oct 2026 04:01:13 +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 79CFD29E8E; Thu, 29 Oct 2026 01:00:15 +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=1793235615; b=34ZZIWj7pLZxePvx08aW9GdkHzA3QdBieiksAoRtj0Jhe9QYW8jJpjyktOUwWUCAanMa bQ2Wyt/HuxMDyLXF4y3zhs947zKW/t8FpVtkHD3HnjaD/Tz7rNO07Pyc93UcPd03YMpiD JQ0IksrmuniJpC6xb9JolBR8wS7gD37NkJbhC8oQ5sxJcdU0CBosvb2XNqqR1NhjPKuuH yNGeCsekuX6x3SDMfi5xu3b6GSswjRilV5WbNwurhWydIsfGL9Fynm2DcjkfRM+SccUQ0 irAz51nkfACEHdQLV3/CZ1ajUZtHt2i7zB2YXCsuAEOKiog6dMapa8RHQHrdkS8dErA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793235615; 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=C+g/wT11APppTzz0f7SFqiBVevvCXND/eQhkE+RuOIo=; b=ZTdQzC16gXASYVW9+x+YVRiQSzBAs7HJynutGho0SVEVdIj0HPyXerzIiq6dPoMz3Gsp uImhGKvGtsn//Y1bb5mLYeWTqAlvviORY3YCbKLjq5GURmYZJxc7VnM0QEwhXY8i0rWv2 D43SdVnnjoJI3rae5I4LxwFFv2Gzis+BBTn3ua3aM8pXvmM+t0VrOcRP09kudbBlu5xOu 780T0suukDkopb0hRo2LrUO+yjtAmqlchzktq19P7hAjETeQwbS88/bIbpR6DPeIj5BmH ewNpcX3Yw5tUVrAnDO4MDN/BO8g1Va0DQz4TH76KXG6iPFnFeC8H0LNz3cAzeKQw0VA== 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=NZkxNseB; 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 529EA606A31D; Thu, 29 Oct 2026 01:00:15 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NZkxNseB 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=1793235599; b=hmNsUaukBGNrgwvXaMVdFbABP6e0hZXaYMDlp/l+V2UP1wbBNa4Z2NDDPFw/w/qKEj7s 0NNWaMzJzCYYYSTJIfsjtw8anspfbzQkY+Li1+nqTSGJMugnnKYW0sB4j7/0oWnfnvCfx ypznDig/5TS+7DURDYg1gZoeHjB3WZCYx2T+Bdb4HHCU6ysFDiHwlIlokiArQEKVLNPWZ VzKQ5UwkSDCHg9/Z8GUlAKa8vGrGGzEMMS7A6f/KDfVPG5REIhVBrU49o+n6ZEgvzkdPj s0AUBfRDq2rkjuEJARaVdvzTUuCSYjNqsmEuItvuDz60Ca3hDmxTid3Y/iBF0i69aug== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793235599; 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=C+g/wT11APppTzz0f7SFqiBVevvCXND/eQhkE+RuOIo=; b=XblEx0vUlAOUz34Eny8yuXuQZQf5SHK8E3RLp8tzmv9Npi1XsH+cXh+KUXEOLCXWUs0B Jm5ZpVVFUlWfzP8TtG2ga2JkQSk1toGmftrTBPtv6NYA5JtspmPJXSrqIIMN2gkDDc7GZ LT1hKnwyzmsdr1YnjWDQ8ViZnRrUnyaFRP9NjSnhdhU24ySd/R7XCpgVUb9BDj7xhM7BZ C3mwMj2kf/cn8kwt2x2og/GZwF8cwMFpyT3IiRUk9RWCcag9f1s665pRz0VXm9N1HvYWM 1ogkKkkUemkXRjhNXdmijcv2x7mrRQVeqnk4CnVIND6NdS0EjuBrBg+m/kqqUtqWBtg== 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=NZkxNseB; 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 2BC9E606A31E; Thu, 29 Oct 2026 00:59:58 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B74541F01828; Thu, 29 Oct 2026 00:59:57 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793235598; bh=C+g/wT11APppTzz0f7SFqiBVevvCXND/eQhkE+RuOIo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=NZkxNseBY1JtqdNRyiCxvgJOKzAdzUQps9jKcTtsa5I4Jcj4yuT3pQfhNdlhC2ixm nIAFV5mo+vgiwCY3PQsswiQBrMkx9ZbTl2SGXKBmVQuJrJ1q+4s+bAwU57mn+WlZqt sv8HPHXNnUSEHu8m8EfTFeaoErFs84t5kuk8fSK6VMVNpFpaQdrzZC0Xt5zJX2b+kZ i0AlPqCAnJDSvpswOh4+qvgifbN4rLAuj/5IQwYb+nPwKhd/mDMunOO90oJe3lb8M5 Dm/whZeDZrll2dvgakA7iO/yefFtJ7/AiEsd635wyp95WU3TndXVW0e+GTwY0rRUpi h6bNH5Wf1EP/Q== X-Cc: nbd@nbd.name, lorenzo@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, sujuan.chen@mediatek.com, rex.lu@mediatek.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, sashiko-bot@kernel.org X-In-Reply-To: <20261026-wedfix-v6-4-a52f6b15d2fc@gmail.com> X-sashiko-severity: Medium 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