🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26253

Re: [PATCH net-next v14 6/6] net: wwan: t9xx: Add AT & MBIM WWAN ports

#26253
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 09:46
165 lines
14269 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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 new .tx_blocking op mtk_port_wwan_write_blocking() is
  called by wwan_port_op_tx() (drivers/net/wwan/wwan_core.c:830-839)…
- [Low] The new READY hook mtk_port_enable_by_type()
  (drivers/net/wwan/t9xx/mtk_port.c) calls ->enable() on every…

--

net: wwan: t9xx: Add AT & MBIM WWAN ports

This adds AT and MBIM WWAN ports to the t9xx port infrastructure. The
WWAN ports are created from mtk_port_wwan_enable(), which runs on
FSM_STATE_READY through a new mtk_port_enable_by_type() hook. The patch
also adds start/stop/tx/tx_blocking WWAN ops, with TX back-pressure
reported through wwan_port_txon()/txoff().

> diff --git a/drivers/net/wwan/t9xx/mtk_port.c b/drivers/net/wwan/t9xx/mtk_port.c
> index 92fc791452851..b305ec9c8fcfc 100644
> --- a/drivers/net/wwan/t9xx/mtk_port.c
> +++ b/drivers/net/wwan/t9xx/mtk_port.c

[ ... ]

> @@ -605,6 +611,21 @@ int mtk_port_ch_disable(struct mtk_port *port)
>  	return ret;
>  }
>  
> +static void mtk_port_enable_by_type(struct mtk_port_mngr *port_mngr, int tbl_type)
> +{
> +	struct mtk_port *port;
> +	unsigned long index;
> +
> +	/* READY is reached at most once per bind and FSM_STATE_OFF is
> +	 * terminal, so port->peer_enabled never carries over from an
> +	 * earlier port enumeration.
> +	 */
> +	xa_for_each(&port_mngr->port_tbl[tbl_type], index, port) {
> +		if (port->peer_enabled)
> +			mtk_port_get_ops(port->info.type)->enable(port);
> +	}
> +}

[Severity: Low]
Is this comment accurate? Several MD port enumerations can run before
the single READY.

In mtk_fsm_startup_act(), a bare STARTUP that arrives in BOOTUP is
treated as a new boot, and the HS2 results are dropped:

drivers/net/wwan/t9xx/mtk_fsm.c:mtk_fsm_startup_act() {
    ...
		if (fsm->state != FSM_STATE_BOOTUP)
			mtk_fsm_switch_state(fsm, to_state, event);
		else
			fsm->fsm_flag &= ~FSM_HS2_DONE_MASK;
    ...
}

A repeated HS1 also clears that side's HS2 flag. The next HS2 then goes
through mtk_fsm_parse_hs2_msg() and calls mtk_port_status_update()
again. That function only writes peer_enabled for channels listed in
the current message:

drivers/net/wwan/t9xx/mtk_port.c:mtk_port_status_update() {
    ...
		port = mtk_port_search_by_id(port_mngr, ch_id);
		if (!port)
			continue;
		port->peer_enabled = FIELD_GET(MTK_INFO_FLD_EN, le16_to_cpu(port_info->channel));
    ...
}

Nothing resets peer_enabled when the new boot is detected. Suppose the
first enumeration marks a channel enabled and the rebooted firmware
omits it. That port then keeps peer_enabled == true.

When READY arrives, wouldn't mtk_port_enable_by_type() call
mtk_port_wwan_enable() on it? That would run mtk_port_ch_enable() and
wwan_create_port() for a channel the current firmware did not
advertise. The same stale state seems possible if a first HS2 sets some
peer_enabled values and then fails inside mtk_fsm_parse_hs2_msg()
before the device reboots.

Should peer_enabled be cleared on a new boot, or before the parse loop
in mtk_port_status_update()?

[ ... ]

> diff --git a/drivers/net/wwan/t9xx/mtk_port_io.c b/drivers/net/wwan/t9xx/mtk_port_io.c
> index 392d2ae54ef55..dd0a8ed4ed79a 100644
> --- a/drivers/net/wwan/t9xx/mtk_port_io.c
> +++ b/drivers/net/wwan/t9xx/mtk_port_io.c

[ ... ]

> +/* Called with the WWAN core's ops_lock held and sleeps interruptibly.  Port
> + * disable clears PORT_S_WR and wakes trb_wq before wwan_remove_port() takes
> + * that lock, so removal ends the wait.
> + */
> +static int mtk_port_wwan_write_blocking(struct wwan_port *w_port, struct sk_buff *skb)
> +{
> +	return mtk_port_wwan_tx(w_port, skb, true);
> +}

[Severity: Medium]
Can this hold the WWAN core's ops_lock for an unbounded time while the
modem stalls TX completion?

wwan_port_op_tx() calls this with port->ops_lock held:

drivers/net/wwan/wwan_core.c:wwan_port_op_tx() {
	mutex_lock(&port->ops_lock);
    ...
	else
		ret = port->ops->tx_blocking(port, skb);
    ...
}

Under that lock, mtk_port_common_write(blocking=true) sleeps twice with
no timeout. The first sleep is in mtk_port_wait_tx_space():

	wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);

The second is once per CCCI packet in mtk_port_send_data(), waiting for
the modem to complete that packet's TRB:

	/* no timeout in tx blocking mode */
	ret = wait_event_interruptible(port->trb_wq,
				       mtk_port_trb_done(trb) ||
				       test_bit(PORT_S_FLUSH, &port->status) ||
				       !test_bit(PORT_S_WR, &port->status));

Only a signal to the writer, a port disable or PORT_S_FLUSH ends these
waits. In the meantime, other ops_lock users of the same wwan_port block
in an uninterruptible mutex_lock(). These include wwan_port_fops_poll()
on every poll()/epoll call, open()/close() from another process through
wwan_port_op_start()/wwan_port_op_stop(), and other writers.

If the CLDMA queue or the firmware stops completing TRBs on the AT or
MBIM channel, won't those tasks stay in D state for as long as the stall
lasts, and possibly trigger hung-task warnings?

The commit message cites the t7xx .tx path as precedent. That path only
waits for queue budget. Waiting for per-packet modem completion under
ops_lock seems new here. The other in-tree tx_blocking user,
rpmsg_wwan_ctrl through rpmsg_send(), has a bounded wait.

Would a timeout on the per-packet completion wait, or not waiting for
completion under ops_lock, avoid this?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-t9xx_driver_v1-v14-0-08ebc870ea94%40compal.com
Technical Details
Message-ID: <179629120355.3146.3262911149272753703@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376454-linux-kernel-netdev=dewy.ru
References: <20261202-t9xx_driver_v1-v14-6-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!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376454-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v14 6/6] net: wwan: t9xx: Add AT & MBIM WWAN ports
Date: Thu, 03 Dec 2026 09:46:43 +0000
Organization: Usenet Network
Message-ID: <179629120355.3146.3262911149272753703@kernel.org>
References: <20261202-t9xx_driver_v1-v14-6-08ebc870ea94@compal.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2451748"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:D+QwQxfEBzWe/cQ3a24RyV5Y1NQ= sha256:sJg549ObFCXnOgx6d4iW9HA0GloHHkjNHUqUykSKSI0=
	sha1:k7iq2dkTrXbE8gHV8st4863hvkw= sha256:nC2SfULLPJcTYwoT2Xgr/LS3h68aqwF4W0gI0p7Xinc=
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 1C2C41178B0; Thu,  3 Dec 2026 12:47:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 7VqkDUlbuPuw;
	Thu,  3 Dec 2026 12:47:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376454-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 533C8117880; Thu,  3 Dec 2026 12:47:18 +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 0504832C47; Thu,  3 Dec 2026 09:46:53 +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=1796291206;
	b=i2dag7P6NGe/ZN3wdigHjPaG2riQgJDyvfa4yh8z0CXcgnbWWs3c3rIh1AIRnmJRKMN5
	 4eAeTD3mO/h2/tU6/FcTUWcWFE3aqYB31PVCQ7n0igCZt0O5SPNA3/UniT9QKdu9Z/oWR
	 PAUGQljTCZe2erPV5EqDTvducnhavV7hwdQuCHq/Iiwgabbwf2DWqizZ3x62xTv4N3z5t
	 oFtpNhL4MW94tPuVX0Fopc6KRmd4fyC50yGH6NCL0Fo9/rLdSsE2kIXNSev0UMlaU+MkP
	 P4L1AveKOtjdxwnmNg9RQjJKLNtZLVF0GEkBkOW1e9S0GgTcyL1AwSGkMhLGEDZjVWQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796291206;
	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=OOn7/eqh3KxtpBwWVeK0W09M0kLW3PnrkOFEM/caKHM=;
	b=XnO98JS6TQi4gMAGnjzqE/FTgD3jlQcuYX3pNoy7X/mM5AOPOPw9dkt0tcZJUydE+jwC
	 z0ESCs1CQN3nBLKIMkCVLTbZdage1vpYX4VW4ARIZXwHyHHgPhNi7bE2SlU6z/SMguvJp
	 HWqKvxKrMSXA//n6OOzep7Cq5oX5cDrK3M0cK0hTpilkKIzevCaNZl7sN9Ze6EEYqbO75
	 uSJ9leMTufBgiTwEoVHAKH/2ozFwGEm36K0gdhEmEdGpLsvfK2F3PK9olH4nN+dh65HQU
	 aYycXFEIQbxttVxRQdA+gFMNwuvhcoRHH0/jy5ooZsMz1FPvmFRQ03MsTbGpp5IGyZg==
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=XqyJ036f;
	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 6F29860A260E;
	Thu,  3 Dec 2026 09:46:46 +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=XqyJ036f
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=1796291205;
	b=AzmwtyKyrA9jtJQFnd9XpFqXS3OmkHXX18BZmchUb/HCkOAKeDepYmGFN1vpgEk+SpX8
	 8XMHWRZfUMUbBo8pA+PTtqkeoN/a+nebrQ2IMEzSc2Uuo2zFHHXMDbhilXRVY6wQOUhef
	 6Yjq8uObK8WMW35sde2VjbB+VYV4F+XQ1qLzjwrmJ2l7gq8HVOPiizRUY0bh8KG2Ksw/o
	 ry5ub5nWG+CItsvQ7WwgxfW33OXjIKQg6t3oacDOt+GwmSUqLwM6Ke5K9UmhAhCRKanRM
	 MxLymEeLjwFmMR3YF4bMPj8wQxSAKWM53tOtb/81N7ee+Ib8vaerl6HnwG7FRhNw22A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796291205;
	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=OOn7/eqh3KxtpBwWVeK0W09M0kLW3PnrkOFEM/caKHM=;
	b=O9GZnIONJqNfYlpXbid5HRoWqg4hKWrbr2jBdzqdM43ma6UKQ1h57PujPiwmRIU0nqPi
	 rIPGxaPLF3kuJcr/FjSTo98y9BzouREh9Xup9+WambqBKuaY6GJoB9hPbxF4owkTaZjuY
	 e3BQ3CRTQSfD06+08d0J2YkZPNIUPm6eweN5KnCxqpUSEO41Gd8lceXyJknmXFkKcVqiY
	 AJwoDLkuGad2kQ+OekI6bJZ+J2QZ9lECWPRdnO3eOkFrzGCty+xbH5EHYKw3ukjdorY+F
	 AmVTONmkO7n2DVH6L/3svvlvlwawWTYf5p/5OVA7aUDnEvuMst5np4f26KeX9grdpXA==
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=XqyJ036f;
	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 9142360A2600;
	Thu,  3 Dec 2026 09:46:45 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F21EB1F0092C;
	Thu,  3 Dec 2026 09:46:43 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796291205;
	bh=OOn7/eqh3KxtpBwWVeK0W09M0kLW3PnrkOFEM/caKHM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=XqyJ036fxOzEz8OGPduw6lawJ47eKa1CcflLhO9B3tisGYdx7Au0tmlTwYgihh/sZ
	 JpX6zKhaNEAUNpJH9JJkofGewGJO0+sO8qpnbjka2MZwOF11hG2Zn7RLIlBvIAGdVO
	 kDvHtFsw0sQ2uoKwZ80WWVweMcRIlRPeFpftEPsaG/2wvFWV5kUJCSQS/wlj8/Gl0g
	 bzB+8Ir+Oj/qCFMfmr2JS5u29kwU1U7oZLLnzJ3fR8Z1YHLKx6dxz+N5ZzBBaRpxsM
	 5ma4k0Kh3K0A2/e4yYeeQgybvfhJSU+7dwuyALsGNBDI+MLKRkzdESR13fgV5w1HEx
	 6W6eUIrrsV0gQ==
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-6-08ebc870ea94@compal.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