Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jackbb_wu@compal.com
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
Subject: Re: [PATCH net-next v14 3/6] net: wwan: t9xx: Add control DMA interface
Date: Thu, 03 Dec 2026 09:46:37 +0000	[thread overview]
Message-ID: <179629119791.3146.810711113974734318@kernel.org> (raw)
In-Reply-To: <20261202-t9xx_driver_v1-v14-3-08ebc870ea94@compal.com>

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


  reply	other threads:[~2026-12-03  9:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  8:58 [PATCH net-next v14 0/6] net: wwan: t9xx: Add MediaTek T9XX WWAN driver Jack Wu via B4 Relay
2026-12-02  8:59 ` [PATCH net-next v14 1/6] net: wwan: t9xx: Add PCIe core Jack Wu via B4 Relay
2026-12-03  9:46   ` netdev-bot+sashiko
2026-12-02  8:59 ` [PATCH net-next v14 2/6] net: wwan: t9xx: Add control plane transaction layer framework Jack Wu via B4 Relay
2026-12-02  8:59 ` [PATCH net-next v14 3/6] net: wwan: t9xx: Add control DMA interface Jack Wu via B4 Relay
2026-12-03  9:46   ` netdev-bot+sashiko [this message]
2026-12-02  8:59 ` [PATCH net-next v14 4/6] net: wwan: t9xx: Add control port Jack Wu via B4 Relay
2026-12-03  9:46   ` netdev-bot+sashiko
2026-12-02  8:59 ` [PATCH net-next v14 5/6] net: wwan: t9xx: Add FSM thread Jack Wu via B4 Relay
2026-12-03  9:46   ` netdev-bot+sashiko
2026-12-02  8:59 ` [PATCH net-next v14 6/6] net: wwan: t9xx: Add AT & MBIM WWAN ports Jack Wu via B4 Relay
2026-12-03  9:46   ` 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=179629119791.3146.810711113974734318@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Jeff_Chang@compal.com \
    --cc=Minano.tseng@mediatek.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jackbb_wu@compal.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robert_yu@compal.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=shi-wei.yeh@mediatek.com \
    --cc=skhan@linuxfoundation.org \
    --cc=wen-zhi.huang@mediatek.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