🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27044

Re: [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem

#27044
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 17:06
175 lines
14817 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · 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] In drivers/net/wwan/qcom_bam_dmux.c, the patch turns on QMAP
  for every channel whose remote OPEN has signal bit 1 set.
- [Medium] The QMAP enable bit only reaches the modem in the host OPEN
  sent by bam_dmux_netdev_open(), the only caller of…
- [Low] The patch tracks QMAP per channel (dmux->remote_qmap), but
  bam_dmux_cmd_data() (drivers/net/wwan/qcom_bam_dmux.c:537-548) never…

--

net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem

The commit stores, per channel, the QMAP bit (bit 1 of the signal byte)
from the modem's OPEN command. It sets the same bit in the OPEN command
the host sends from ndo_open(), which asks the modem to enable QMAP on
that channel so rmnet can run on top of the BAM-DMUX netdev.

> diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c
> index a7d05b1b8b123..9e82a30b16a68 100644
> --- a/drivers/net/wwan/qcom_bam_dmux.c
> +++ b/drivers/net/wwan/qcom_bam_dmux.c

[ ... ]

> @@ -90,6 +93,7 @@ struct bam_dmux {
>  	struct work_struct tx_wakeup_work;
>  
>  	DECLARE_BITMAP(remote_channels, BAM_DMUX_NUM_CH);
> +	DECLARE_BITMAP(remote_qmap, BAM_DMUX_NUM_CH);

[Severity: Low]
Should bam_dmux_cmd_data() look at remote_qmap when it sets
skb->protocol? The RX path still guesses the protocol from the first
nibble of the payload:

	switch (skb->data[0] & 0xf0) {
	case 0x40:
		skb->protocol = htons(ETH_P_IP);
		break;
	case 0x60:
		skb->protocol = htons(ETH_P_IPV6);
		break;
	default:
		skb->protocol = htons(ETH_P_MAP);

include/linux/if_rmnet.h defines the first QMAP byte as MAP_CMD_FLAG
(BIT(7)), MAP_NEXT_HEADER_FLAG (BIT(6)) and MAP_PAD_LEN_MASK
(GENMASK(5, 0)). Take a QMAP data frame with the next-header flag set:

  - With pad length 0-15 it starts with 0x40-0x4f and is tagged
    ETH_P_IP.
  - With pad length 32-47 it starts with 0x60-0x6f and is tagged
    ETH_P_IPV6.

Before this patch QMAP was never requested, so these frames could not
arrive. rmnet_rx_handler() doesn't check skb->protocol. Other consumers
would see the wrong value: ptype_all taps, tc/BPF ingress, and the IP
input path when no rmnet link is attached.

On a channel with remote_qmap set, could skb->protocol just be set to
ETH_P_MAP?

>  	struct work_struct register_netdev_work;
>  	struct net_device *netdevs[BAM_DMUX_NUM_CH];
>  };
> @@ -247,6 +251,8 @@ static int bam_dmux_send_cmd(struct bam_dmux_netdev *bndev, u8 cmd)
>  	hdr->magic = BAM_DMUX_HDR_MAGIC;
>  	hdr->cmd = cmd;
>  	hdr->ch = bndev->ch;
> +	if (cmd == BAM_DMUX_CMD_OPEN && test_bit(bndev->ch, dmux->remote_qmap))
> +		hdr->signal = BAM_DMUX_OPEN_QMAP;

[Severity: Medium]
Could this break existing raw-IP users on firmware that already
advertises QMAP?

The original driver commit 21a0ffd9b38c said that "some newer firmware
versions support QMAP ... but this is not currently supported by this
driver". Users of that firmware have been running raw IP directly on
wwanN.

After this patch, a kernel upgrade alone makes the host request QMAP
whenever the modem advertises it. There is no module parameter, netlink
attribute or other opt-in, and nothing reports which mode is active.

bam_dmux_netdev_setup() still sets the netdev up as a raw-IP
point-to-point device:

	dev->type = ARPHRD_RAWIP;
	SET_NETDEV_DEVTYPE(dev, &wwan_type);
	dev->flags = IFF_POINTOPOINT | IFF_NOARP;

bam_dmux_tx_prepare_skb() also forwards any skb, including plain
IPv4/IPv6 from the stack, without checking for ETH_P_MAP. By contrast,
ipa_modem_start_xmit() drops such traffic when QMAP is configured:

	if (endpoint->config.qmap && skb->protocol != htons(ETH_P_MAP))
		goto err_drop_skb;

Suppose the modem switches the channel's framing to QMAP once this bit
is set. Would uplink IP packets then be parsed as MAP headers? Would
downlink QMAP frames be dropped when no rmnet link is attached?

The code doesn't show whether the bit alone switches the framing or
only allows QMAP to be selected later through QMI WDA. The commit
message says "Firmware that does not set the bit is not affected", but
it doesn't say what happens with firmware that does set it. Could that
be clarified?

[ ... ]

> @@ -548,13 +554,17 @@ static void bam_dmux_cmd_open(struct bam_dmux *dmux, struct bam_dmux_hdr *hdr)
>  {
>  	struct net_device *netdev = dmux->netdevs[hdr->ch];
>  
> -	dev_dbg(dmux->dev, "open channel: %u\n", hdr->ch);
> +	dev_dbg(dmux->dev, "open channel: %u (signal %#x)\n", hdr->ch,
> +		hdr->signal);
>  
>  	if (__test_and_set_bit(hdr->ch, dmux->remote_channels)) {
>  		dev_warn(dmux->dev, "Channel already open: %u\n", hdr->ch);
>  		return;
>  	}
>  
> +	/* Use QMAP on our side of the channel only if the remote supports it */
> +	assign_bit(hdr->ch, dmux->remote_qmap, hdr->signal & BAM_DMUX_OPEN_QMAP);

[Severity: Medium]
Is the QMAP request ever sent again if the modem closes and re-opens
the channel while wwanN stays up?

The only host OPEN comes from bam_dmux_netdev_open(), and
bam_dmux_cmd_close() only detaches the netdev:

	if (netdev)
		netif_device_detach(netdev);

The interface stays IFF_UP, so ndo_open() does not run again. The next
remote OPEN updates remote_qmap and calls netif_device_attach(), but no
host OPEN with BAM_DMUX_OPEN_QMAP is sent.

A modem restart without a CLOSE has a similar problem.
remote_channels is cleared only in bam_dmux_cmd_close(), not in
bam_dmux_power_off() or bam_dmux_pc_irq(). The restarted modem's OPEN
would take the "Channel already open" early return above, before the
assign_bit().

In both cases, if the modem resets its per-channel QMAP state, would
rmnet keep sending QMAP frames on a channel the modem no longer treats
as QMAP, until userspace takes the link down and up again?

The commit message says "The modem always opens a channel before its
network interface is created, so the bit is known by the time
ndo_open() sends the OPEN command". That only covers the first
bring-up.

The host OPEN not being sent again after a remote re-open predates
this patch. This patch is what makes the QMAP state depend on that
one-time handshake.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af%40oss.qualcomm.com
Technical Details
Message-ID: <179640397025.3146.150033065893799132@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377508-linux-kernel-netdev=dewy.ru
References: <20261203-qcom-bam-dmux-qmap-v1-3-abc2e80a03af@oss.qualcomm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377508-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if
 supported by the modem
Date: Fri, 04 Dec 2026 17:06:10 +0000
Organization: Usenet Network
Message-ID: <179640397025.3146.150033065893799132@kernel.org>
References: <20261203-qcom-bam-dmux-qmap-v1-3-abc2e80a03af@oss.qualcomm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2814084"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:DJodt9oodDO7s2NoMcpJbmOmIPQ= sha256:MmG8QbTpYfmIzWdw+6HCPF+WpvBbACWC43W7TJD4QJk=
	sha1:jX/OTCmxOfwEAj60O4Y9bEJH6rQ= sha256:ELlHzc2hUmQGUve9FbY4XfnFevZkMhUlqu2DGx6v8kI=
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 64898117C7E; Fri,  4 Dec 2026 20:06:36 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.641
X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.142, 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,
	URIBL_BLOCKED=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 CYks5dZ_gYHV;
	Fri,  4 Dec 2026 20:06:33 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-377508-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 81961117C0E; Fri,  4 Dec 2026 20:06:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id BDA6C608A59; Fri,  4 Dec 2026 17:06:22 +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=1796403978;
	b=jgeq5ZPagPg2jYdw75nIDtWfO60jL1yWY8GzWdAvEPo+ywB+ZFjV+rWv9DHgooRN5MGd
	 o+YR44+O2DyFX7PqqQBwC0kERZn4cXGcQg4nI+SABpmZbgOkzw4oitzw3vg2I0pMGQldL
	 Qll2t8o1bm5lnzXn7wL9sp0AarMJ8G4AYGdIr//pLMReAHBY6lyxRODpDgLo1C+7S0dyb
	 dX/pmPuj/oQGr4CLDAxhhl0mjhM7o3fThwxV6M88WJTlqfYdKwQfgc/iv3pWvLvCX/I9P
	 tSwlUXR8kHTFIzIoEQgmVNW4tq+2KYNyXKLa+6a0u5LPAiRHxVQLcfkYUR4m/W1Ja6A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796403978;
	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=PA/AnJOSAf06SvJF3Fu95n1f+fLKsSno9YXf+FhWUfs=;
	b=txc8pvxhw3LP0HA/qYDaoPn26ub9ulDZZGWEGKO4u1Q7cN1n0OH2aI0wpQiSF4/jPDNg
	 Ghao6xphKCY1NDfxKa5TLusxeYp5ilEza3EYGNlOwwUb1GV0cCzeepuDXyj13KEkK2E9x
	 hiApZXh8gef2sWK2hPH2G9zH+kdxZ+ugD3y7/auK94YxhePvylgwGc5zcTkYV67Y0FBnq
	 QdyPtdxC80kngDGZV6j6RlaMCPIxlEAOnQLVN+ECnjFswEllMttDXMXBh5nw+QRzV20XG
	 u6NjdPOzs1EuR0PRSYVT9wbINEZSB/I5sW3AOdOthM3uql9dDg9Tz9vnqKZ5MYD8NYg==
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="k/utHsax";
	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 E1494606A33D;
	Fri,  4 Dec 2026 17:06:17 +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=k/utHsax
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=1796403972;
	b=CMmQAckkjWKbkdT4RcE/5yfnBNNx7sOD35l5ECFFHzBeeLLTYdQwMnNk0DAxOYkEZfXD
	 Mmp4b2gZvoPp9zdugHj4FknOPSyqNlnc3L+NQ44FPXWWrjYeM2rPXlaT/K8muA1tXZhea
	 1p3Hygh5iiatgMtzS24AxJcSofL++Io0KLQpXXjhBVB15cVkEr2tuA2Ny+6hbuVYVcN5Q
	 qYIyHURxwMZgCOyVu9VPeq4UOo5yI1ZSgps4bO6KRNzA7Rhs8p6sK56GmXuCCXDn8TD2S
	 ewIP0tHesegMWl68w/UQ+YbBOg97ZlmXK5lU4R0j8RlSq5vtMozkRcZT5uASVjWvrOQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796403972;
	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=PA/AnJOSAf06SvJF3Fu95n1f+fLKsSno9YXf+FhWUfs=;
	b=Ezb7+APwQBB1Ssn+kuDTXXA0ZFpKI32Hv36Kvq8gm2FmhyaETk/DC8/xtpCKbWun7Kbk
	 vJhYHE+TA4XYCdARjYdiAJSV5TjUoZ2YMUjGwQppjpjPdCwVuTH6cE1RCsavr8EY08y4d
	 trjB0mQCdIk0RHE2fbX7Zi9PwAfkuuVNfCLFvNgNo5uxjEkSB9auAnd3WtJ/+AiPKGskr
	 gG7Lv6sjUq51QGdo24CRNyZVGdCszwnJF/I4xZlCMCCw26/9TtKhaCkuTIwIl80AnUqIg
	 eLLfRbqtVhdYTyuFUfv9EGKxnR9JT6w4F5gT/BqbIUUQJIY4nnc+TDm6tNVUlwSCv3Q==
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="k/utHsax";
	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 0BE1E606A685;
	Fri,  4 Dec 2026 17:06:11 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF8CC1F00A06;
	Fri,  4 Dec 2026 17:06:10 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796403971;
	bh=PA/AnJOSAf06SvJF3Fu95n1f+fLKsSno9YXf+FhWUfs=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=k/utHsaxh6++BLjBiOBgkLsgQ+rPkNT05cNPncGLbkwuwOXQkTy0cbori6V2tEtTM
	 bqiJYmJ7jtGQ1EpALhNdU4gkcOpfOmmc7j/39uPiSHiIQamtJ4oJzo7GKnKDxftzm4
	 bWB5qyXZFi+CspRPB63K8UNiDFw4isRUUusoB1Byx8FoC/gSipZ7EcJx9+/xXVndiR
	 +3Mh+gtIR2LuCQYFpMkXcJC330iXQ6gE1uwpR3y7t5vd2/jrlWpOFnVCW6FvuXDb0R
	 CFnSwtPO72IRkTn6gYZVAoAzTMacd67PbjZzWmH8ipc+DIb8zcAbU/M6yzdI9WZcrO
	 QgiKixmXO1lew==
X-Cc: vkoul@kernel.org, Frank.Li@kernel.org, stephan@gerhold.net,
 loic.poulain@oss.qualcomm.com, ryazanov.s.a@gmail.com,
 johannes@sipsolutions.net, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org,
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 deepak.singh@oss.qualcomm.com
X-In-Reply-To: <20261203-qcom-bam-dmux-qmap-v1-3-abc2e80a03af@oss.qualcomm.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