DMA Engine development
 help / color / mirror / Atom feed
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
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	[thread overview]
Message-ID: <179640397025.3146.150033065893799132@kernel.org> (raw)
In-Reply-To: <20261203-qcom-bam-dmux-qmap-v1-3-abc2e80a03af@oss.qualcomm.com>

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

      parent reply	other threads:[~2026-12-04 17:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 16:10 [PATCH net-next 0/3] net: wwan: qcom_bam_dmux: Add QMAP support Vishnu Santhosh
2026-12-03 16:10 ` [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers Vishnu Santhosh
2026-12-03 16:19   ` Frank Li
2026-12-04 10:10   ` Stephan Gerhold
2026-12-04 11:18     ` Nickolay Goppen
2026-12-04 11:31     ` Nickolay Goppen
2026-12-04 16:11   ` sashiko-bot
2026-12-04 17:06   ` netdev-bot+sashiko
2026-12-03 16:10 ` [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets Vishnu Santhosh
2026-12-04 10:14   ` Stephan Gerhold
2026-12-04 17:06   ` netdev-bot+sashiko
2026-12-03 16:10 ` [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem Vishnu Santhosh
2026-12-03 19:22   ` Loic Poulain
2026-12-04 10:42   ` Stephan Gerhold
2026-12-04 16:11   ` sashiko-bot
2026-12-04 17:06   ` netdev-bot+sashiko [this message]

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=179640397025.3146.150033065893799132@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=deepak.singh@oss.qualcomm.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=stephan@gerhold.net \
    --cc=vishnu.santhosh@oss.qualcomm.com \
    --cc=vkoul@kernel.org \
    /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