🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26250

Re: [PATCH net-next v14 3/6] net: wwan: t9xx: Add control DMA interface

#26250
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 09:46
85 lines
11445 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] mtk_cldma_get_rx_curr_addr()
  (drivers/net/wwan/t9xx/pcie/mtk_cldma_drv.c) re-reads the RX cursor…

--

net: wwan: t9xx: Add control DMA interface

This commit adds the CLDMA (Cross Layer DMA) driver, which handles the
control plane's GPD-ring based TX and RX hardware queues. It also adds
the transaction control layer with its TRB service thread. Probe and
remove now call new mtk_pci_dev_init()/mtk_pci_dev_exit() hooks, which
attach the transaction context to the control plane.

> diff --git a/drivers/net/wwan/t9xx/pcie/mtk_cldma_drv.c b/drivers/net/wwan/t9xx/pcie/mtk_cldma_drv.c
> new file mode 100644
> index 0000000000000..72c821c4a3cd6
> --- /dev/null
> +++ b/drivers/net/wwan/t9xx/pcie/mtk_cldma_drv.c

[ ... ]

> +u64 mtk_cldma_get_rx_curr_addr(struct cldma_drv_info *drv_info, u32 qno)
> +{
> +	const struct cldma_hw_regs *hw_regs;
> +	u32 curr_addr_h, curr_addr_l;
> +	struct mtk_md_dev *mdev;
> +	u64 addr_h, addr_l;
> +	int base;
> +
> +	hw_regs = drv_info->hw_regs;
> +	base = drv_info->base_addr;
> +	mdev = drv_info->mdev;
> +
> +	addr_h = base + hw_regs->reg_cldma_so_current_addrh_0 + (u64)qno * ADDR_STRIDE;
> +	addr_l = base + hw_regs->reg_cldma_so_current_addrl_0 + (u64)qno * ADDR_STRIDE;
> +	/* the cursor may have moved to a GPD with another high word in between */
> +	do {
> +		curr_addr_h = mtk_pci_read32(mdev, addr_h);
> +		curr_addr_l = mtk_pci_read32(mdev, addr_l);
> +	} while (mtk_pci_read32(mdev, addr_h) != curr_addr_h);

[Severity: Low]
Can this loop run forever? It has no retry bound and no cond_resched().
Only the values the device returns decide when it ends.

A dead link does end it, because every read returns 0xFFFFFFFF. A
device that keeps changing SO_CUR_ADDRH between the two reads would
keep it going, though. Faulty modem firmware, or a partly failed link
that returns inconsistent values that are not all-ones, could do that.

The caller runs on the CLDMA workqueue:

mtk_cldma_rx_done_work()
  mtk_cldma_check_rx_req()
    mtk_cldma_get_rx_curr_addr()

In that case the kworker would spin on MMIO reads with no way out, and
RX processing for the instance would stop.

The other device-dependent waits in this patch are bounded: the
WAIT_HWO_ROUND loop in mtk_cldma_check_rx_req(), and read_poll_timeout()
in mtk_cldma_stop_queue().

Would it make sense to cap the retries and then return 0? The caller
would then take its existing -ENXIO path:

	curr_addr = mtk_cldma_get_rx_curr_addr(drv_info, rxq->rxqno);
	if (unlikely(!curr_addr))
		return -ENXIO;

> +	/* no GPD address has an all-ones half, so either one means link loss */
> +	if (curr_addr_h == LINK_ERROR_VAL || curr_addr_l == LINK_ERROR_VAL)
> +		return 0;
> +	return ((u64)curr_addr_h << 32) | curr_addr_l;
> +}

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-t9xx_driver_v1-v14-0-08ebc870ea94%40compal.com
Technical Details
Message-ID: <179629119791.3146.810711113974734318@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376451-linux-kernel-netdev=dewy.ru
References: <20261202-t9xx_driver_v1-v14-3-08ebc870ea94@compal.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376451-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v14 3/6] net: wwan: t9xx: Add control DMA interface
Date: Thu, 03 Dec 2026 09:46:37 +0000
Organization: Usenet Network
Message-ID: <179629119791.3146.810711113974734318@kernel.org>
References: <20261202-t9xx_driver_v1-v14-3-08ebc870ea94@compal.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="2451502"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:J+9hJ9Mocij16+UiLurikUszVOY= sha256:F31w1FI2pEW5gU7OpjZrfUaj9gd+Weq6WWPiqq4fJrU= sha1:RdHxVQ2FNGWaJ23nycp5/hVBTE0= sha256:+BnEzulR4CX//KmeZGDsTSKQgdurdiPTQjI+ough1Ig=
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 76DF21178B0; Thu,  3 Dec 2026 12:46:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[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] 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 gA74ltC43L5w; Thu,  3 Dec 2026 12:46:56 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376451-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id C719E117880; Thu,  3 Dec 2026 12:46:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id A088E26C47; Thu,  3 Dec 2026 09:46:41 +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=1796291201; b=k9aRBBd0WHxZmTwopAWoZe6cscbN2x970F8SVzygCFX7Yajrez6ZOYv+9unfQa/8+Zj5 wAqvslu6Hq6Z0OOEnSycjDsXL7VLUx487XBFUnGlWdYpmNY6/q0fINMVz4CTRW4SIwbuH 5wJMGrnTbavc2+v93xGWEqVTBdcfSPdV3cTUJ2AOHw1o9GxJsKg049DMv1bdppBaZqD76 Rd6uEYxAz974OAIv+vPmjPLWtJ8eoFqija2U7FNFAsTitmYSIuivtjNzGI3+ErXEuVS/B ciHwjEoC7Bf9AtcFctafHsd+5S12an+96AXp10+lC/NrkgiV9GzTvltQ6bsSGepuU9Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796291201; 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=our0FkRC/jaHCQaQjYhE9nxV3TomDlWuSAu+vbX7894=; b=To0WtKN2Ei/AigJfM3qDgCzsYj79oVs092HjZwzgr9N4Q/XEHxvghgrORVLrdkRJAdL2 E2F7fq/9T2fHzndpudnSXK0oGFKFe7kXDyS5erWJmfKehe1ZYzYA7ZjpMAqynfuRtT3BK 2D8Ky1rmBeQLfrqQAv5ywp8i9ivla3G0OTJG5A/jex3P2KrDwzwe2qt8d/10MaCiP6/Si 6YePikie+Go1Vi18+u+MP3vdEjAkf37CFv/lPEstuz+mdi9ANY7BeC09pU+4FlTLpYesx dJL2XBabVkZiD+S75g06hi55ca/XMWwG+frCqoViNyD12vf+jGe9gdg5Mpaf/ZARR6Q==
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=jFeGKiSw; 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 DF5FE606A33E; Thu,  3 Dec 2026 09:46:40 +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=jFeGKiSw
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=1796291200; b=bNu58srqBfFvusozcGsUt7KMOVqkfbG3XZEwCoonK5nzg735V9jMpvWJp3jZo3BlmbWL zwKypGhFYFxeDESPHuu1ytP1HGcqeF3sTGd0y+EqCOvEHGufTV7KJ1a1+qsf5M+sTlg0V Aa/qQ3DtkIAiLTdQ2lNF/wzX4Oe++tCuXAAZaosX26zrQh0cYa7b4C2zZKnB/bu9cAqmM VHa7CuGxA3B1GuJRjodSi9g90FnyH5BC5JxUEY4Mvo4HYCzf9xwSuDmZ7USjPrKW+Jf28 1JYAgbruKifgclwqd23xf1V4Pif4LhN2POHW5D9UOktudzSHylsl0mSHb01gLvxYxYA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796291200; 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=our0FkRC/jaHCQaQjYhE9nxV3TomDlWuSAu+vbX7894=; b=OEBiU1M/9y/l3jwkbz0CpApRAvESsS2SYbGob8fL61XK9jC+w0IMbXHHOJ9vDHcGqFbz HtJqZNH/my9eSEzho2e49FJEOVyvDmqduq3aRXAddLeCOVed8Ydn7kTcQOERBbNKj/Nfn DwJnxagkXTtvsltYpkE7gtNRhnzUaVGheQGcFjFtICP5inBxqDhcOcZ6Ugh24NydEFrT4 SsFIKVe9UOiTHlZNkNws1Mf71uD9Nc+5DdEA5nVkm/IFS1AvoqSbs3lUA+tk7j4LtMN+I q3hsDiV7UHcPFkXhzjsef/sZ7wH1yAja59io5YJ3hxlDyJ/e8rRFz5itvtq0jBM0ogw==
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=jFeGKiSw; 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 0B58E606A338; Thu,  3 Dec 2026 09:46:39 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6354C1F00899; Thu,  3 Dec 2026 09:46:38 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796291199; bh=our0FkRC/jaHCQaQjYhE9nxV3TomDlWuSAu+vbX7894=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=jFeGKiSwwKFW3YooGSl5zHrE0o1ei6WJk5R5gcjaEh1ihmC/oNomhIiRISKTCm+CV CM3RPMatBKI9gJPkl6BdQ9QMJ94DHCIP9SFVgVwctZ0LW1EQDQfdvV/RqlWe5yGU7Q Y1Pug4OwUBfHTODxLb851+mV064Zlt4hDciM+bHzO350EjI3A1EnSRDWDH0eWP1eEx 2oXdQs60kDcS0bvnZtfT38znJHCY6H6Eh2+PDdmB4/ZKju9pzVW84pPhygsybDOEZX nGx/fsJjlgBkBa14yncgbPCkFcZUeliS1Zbl3dlpZm6TjabHchN2pKukGnuc2vxvyj Pqdw1u6e/vbTg==
X-Cc: loic.poulain@oss.qualcomm.com, ryazanov.s.a@gmail.com, johannes@sipsolutions.net, andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, wen-zhi.huang@mediatek.com, shi-wei.yeh@mediatek.com, Minano.tseng@mediatek.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, robert_yu@compal.com, Jeff_Chang@compal.com, edumazet@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-doc@vger.kernel.org
X-In-Reply-To: <20261202-t9xx_driver_v1-v14-3-08ebc870ea94@compal.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
X-Received-Bytes: 11044