Re: [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem
From: Loic Poulain
Date: Thu Dec 03 2026 - 14:22:34 EST
Hi Vishnu,
On Thu, Dec 3, 2026 at 5:11 PM Vishnu Santhosh
<vishnu.santhosh@xxxxxxxxxxxxxxxx> wrote:
>
> Newer modem firmware can use QMAP to carry several data connections over
> one BAM-DMUX channel, with the rmnet driver handling QMAP on top of the
> BAM-DMUX network interfaces. The modem only enables QMAP on a channel if
> bit 1 is set in the signal byte of the OPEN command it receives. The
> driver always sends 0, so QMAP stays disabled.
>
> The modem sets the same bit in its own OPEN command if it supports QMAP.
> Remember the bit for each channel and set it in the OPEN command sent to
> the modem. 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. Firmware that does not set the bit is not affected.
How the user side knows it has to use QMAP/RMNET vs using the
interface as raw IP.
>
> Co-developed-by: Deepak Kumar Singh <deepak.singh@xxxxxxxxxxxxxxxx>
> Signed-off-by: Deepak Kumar Singh <deepak.singh@xxxxxxxxxxxxxxxx>
> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@xxxxxxxxxxxxxxxx>
> ---
> drivers/net/wwan/qcom_bam_dmux.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c
> index a7d05b1b8b1230d1d54e9a7abcbc16a16681797e..9e82a30b16a68d786cd7523a8d6a8bb52dd9fe89 100644
> --- a/drivers/net/wwan/qcom_bam_dmux.c
> +++ b/drivers/net/wwan/qcom_bam_dmux.c
> @@ -32,6 +32,9 @@
> #define BAM_DMUX_HDR_MAGIC 0x33fc
> #define BAM_DMUX_LEN_FROM_DMA 0xffff
>
> +/* Signal bits in OPEN commands */
> +#define BAM_DMUX_OPEN_QMAP BIT(1)
It would be good to make the name reflect the field this bit belongs to.
Perhaps BAM_DMUX_OPEN_SIG_QMAP
> +
> #define BAM_DMUX_AUTOSUSPEND_DELAY 1000
> #define BAM_DMUX_REMOTE_TIMEOUT msecs_to_jiffies(2000)
>
> @@ -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);
> 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;
>
> skb_dma = bam_dmux_tx_queue(dmux, skb);
> if (!skb_dma) {
> @@ -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);
> +
> if (netdev) {
> netif_device_attach(netdev);
> } else {
>
> --
> 2.34.1
>