From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF8CC1F00A06; Fri, 4 Dec 2026 17:06:10 +0000 (UTC) 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== Subject: Re: [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem From: netdev-bot+sashiko@kernel.org To: vishnu.santhosh@oss.qualcomm.com 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 Date: Fri, 04 Dec 2026 17:06:10 +0000 Message-ID: <179640397025.3146.150033065893799132@kernel.org> In-Reply-To: <20261203-qcom-bam-dmux-qmap-v1-3-abc2e80a03af@oss.qualcomm.com> References: <20261203-qcom-bam-dmux-qmap-v1-3-abc2e80a03af@oss.qualcomm.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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