Re: [PATCH net-next v14 3/6] net: wwan: t9xx: Add control DMA interface
From: netdev-bot+sashiko
Date: Thu Dec 03 2026 - 04:46:44 EST
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