Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Wu. JackBB (GSM)" <JackBB_Wu@compal.com>
To: "Jagielski, Jedrzej" <jedrzej.jagielski@intel.com>,
	Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Sergey Ryazanov <ryazanov.s.a@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Wen-Zhi Huang <wen-zhi.huang@mediatek.com>,
	Shi-Wei Yeh <shi-wei.yeh@mediatek.com>,
	Minano Tseng <Minano.tseng@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>
Subject: RE: [PATCH 03/11] net: wwan: t9xx: Add control DMA interface
Date: Wed, 10 Jun 2026 10:40:55 +0000	[thread overview]
Message-ID: <336375db52e64e9c9b38882e5ed7a3ea@compal.com> (raw)
In-Reply-To: <PH0PR11MB590283906E1724DEFC0985E6F0152@PH0PR11MB5902.namprd11.prod.outlook.com>

Hi Jagielski,

Thank you for the review. Below are the changes and responses for v2.

> > +int i, hif_id;
> > +struct trb *trb;
> > +u32 txqno;
>
> please stick to RCT

Reordered variable declarations to follow reverse Christmas tree
style.

> > +again:
> > +for (i = 0; i < txq->nr_gpds; i++) {
> > ...
> > +state = drv_ops->cldma_check_intr_status(drv_info, DIR_TX, txqno, QUEUE_XFER_DONE);
> > +if (state) {
> > ...
> > +goto again;
>
> are we sure we won't be locked here?

The loop is bounded: each iteration of the for loop processes at
most nr_gpds descriptors, and the goto again path only triggers
when a new XFER_DONE interrupt arrives while processing. Since the
TX ring has a fixed number of slots, forward progress is guaranteed
— once all completed descriptors are consumed, the for loop breaks
at the HWO check. cond_resched() prevents soft lockup. This pattern
is consistent with the RX work handler in the same file.

> > +err = mtk_cldma_check_rx_req(drv_info, rxq);
> > +if (!err)
> > +goto again;
>
> unclear for me
> repeat when 0 is returned
> do not repeat when -EAGAIN is returned by mtk_cldma_check_rx_req?

mtk_cldma_check_rx_req() returns 0 when there are more RX
descriptors ready for processing (HW current address differs from
the software free index and HWO bit is cleared), so the loop
continues. Non-zero means either no more data is available or an
error occurred:
- -EAGAIN: HW is still working on the current descriptor, or HWO
  bit didn't clear in time — no more data to process.
- -ENXIO: HW current address read back as 0, indicating a link
  error.

We agree the semantics could be clearer. Would you prefer we
rename/restructure this — for example, returning a bool (true =
more work) and handling errors separately, or using a different
error code instead of -EAGAIN? Open to suggestions on what would
be most intuitive here.

> so how EAGAIN is actually used here?

-EAGAIN is returned by mtk_cldma_submit_tx() when req_budget == 0
(TX descriptor ring full). In mtk_ctrl_trb_handler, this triggers
flow control: if packets were already batched (tx_burst_cnt > 0),
flush them; otherwise return immediately and leave the skb in the
queue for retry after TX completion frees budget.

We agree the semantics could be clearer. Could you suggest which
error code would be more appropriate for this case?

> > +static int mtk_cldma_rxq_free(struct cldma_drv_info *drv_info, u32 rxqno)
>
> please make it void

Changed to void return type.

> > +int ret = 0;
> > ...
> > +return ret;
>
> just return 0, no need to zeroinit ret

Removed zeroinit and return 0 directly in mtk_cldma_start_xfer().

> > +int mtk_cldma_exit(struct mtk_ctrl_trans *trans)
>
> void?

Changed to void return type.

> > +int err = 0;
>
> please be consistent within the series
> either you name 'ret'  either 'err'

Renamed all 'err' to 'ret' consistently throughout the patch.

> > +int err = 0;
>
> no need to zeroinit

Removed unnecessary zero-initialization in mtk_cldma_tx().

> > +if (unlikely(!drv_info)) {
> > +ret = -EINVAL;
> > +goto out;
> > +}
>
> why cannot return directly?

Changed to return directly instead of goto out in
mtk_cldma_submit_tx() error paths.

> > +if (unlikely(!drv_info)) {
>
> what's te benefit of using unlikely here?

Removed unlikely() from validation paths in
mtk_cldma_check_ch_cfg().

> > +u32 addr;
> > +u32 val;
> > +u32 sta;
>
> please squash

Squashed into a single declaration line.

Thanks.

Jack Wu


================================================================================================================================================================
This message may contain information which is private, privileged or confidential of Compal Electronics, Inc. If you are not the intended recipient of this message, please notify the sender and destroy/delete the message. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information, by persons or entities other than the intended recipient is prohibited.
================================================================================================================================================================

  parent reply	other threads:[~2026-06-10 10:41 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 10:31 [PATCH 00/11] net: wwan: t9xx: Add MediaTek T9XX WWAN driver Jack Wu via B4 Relay
2026-05-29 10:31 ` [PATCH 01/11] net: wwan: t9xx: Add PCIe core Jack Wu via B4 Relay
2026-06-01 11:18   ` Jagielski, Jedrzej
2026-06-04  6:42     ` Wu. JackBB (GSM)
2026-06-08  7:40       ` Jagielski, Jedrzej
     [not found]         ` <bfecf94780ad458b91a26d18d832cdd1@compal.com>
2026-06-08  8:16           ` Wu. JackBB (GSM)
2026-06-10 10:40     ` Wu. JackBB (GSM)
2026-05-29 10:31 ` [PATCH 02/11] net: wwan: t9xx: Add control plane transaction layer Jack Wu via B4 Relay
2026-06-01 11:24   ` Jagielski, Jedrzej
2026-06-10 10:40     ` Wu. JackBB (GSM)
2026-05-29 10:31 ` [PATCH 03/11] net: wwan: t9xx: Add control DMA interface Jack Wu via B4 Relay
     [not found]   ` <PH0PR11MB590283906E1724DEFC0985E6F0152@PH0PR11MB5902.namprd11.prod.outlook.com>
2026-06-10 10:40     ` Wu. JackBB (GSM) [this message]
2026-05-29 10:31 ` [PATCH 04/11] net: wwan: t9xx: Add control port Jack Wu via B4 Relay
2026-05-29 10:31 ` [PATCH 05/11] net: wwan: t9xx: Add FSM thread Jack Wu via B4 Relay
2026-05-29 10:31 ` [PATCH 06/11] net: wwan: t9xx: Add AT & MBIM WWAN ports Jack Wu via B4 Relay
2026-06-01 12:09   ` Jagielski, Jedrzej
2026-06-10 10:40     ` Wu. JackBB (GSM)
2026-05-29 10:31 ` [PATCH 08/11] net: wwan: t9xx: Add data plane transaction layer Jack Wu via B4 Relay
2026-05-29 10:31 ` [PATCH 09/11] net: wwan: t9xx: Introduce WWAN interface Jack Wu via B4 Relay
2026-06-01 12:19   ` Jagielski, Jedrzej
2026-05-29 10:31 ` [PATCH 10/11] net: wwan: t9xx: Add power management support Jack Wu via B4 Relay
2026-06-01 12:26   ` Jagielski, Jedrzej
2026-05-29 10:31 ` [PATCH 11/11] net: wwan: t9xx: Add maintainers and documentation Jack Wu via B4 Relay
2026-05-29 11:43 ` [PATCH 00/11] net: wwan: t9xx: Add MediaTek T9XX WWAN driver Loic Poulain
2026-06-02  9:28   ` [External Mail] " Wu. JackBB (GSM)
2026-06-02  0:34 ` Jakub Kicinski
2026-06-02 10:58   ` [External Mail] " Wu. JackBB (GSM)
2026-06-02 20:46     ` Sergey Ryazanov
2026-06-04  8:22       ` [External Mail] " Wu. JackBB (GSM)
2026-06-10 10:56         ` Wu. JackBB (GSM)

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=336375db52e64e9c9b38882e5ed7a3ea@compal.com \
    --to=jackbb_wu@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@google.com \
    --cc=horms@kernel.org \
    --cc=jedrzej.jagielski@intel.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=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