* [PATCH net-next 0/3] net: wwan: qcom_bam_dmux: Add QMAP support
@ 2026-12-03 16:10 Vishnu Santhosh
2026-12-03 16:10 ` [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers Vishnu Santhosh
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Vishnu Santhosh @ 2026-12-03 16:10 UTC (permalink / raw)
To: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain,
Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: linux-arm-msm, dmaengine, netdev, linux-kernel, Vishnu Santhosh,
Deepak Kumar Singh
Newer modem firmware supports QMAP as an additional multiplexing layer
on top of BAM-DMUX. QMAP is handled by the rmnet driver on top of the
BAM-DMUX network interfaces, and allows multiple data connections over
a single BAM-DMUX channel.
Two changes are needed in BAM-DMUX for this:
- With QMAP, the modem sets the length in the header of DATA packets to
0xffff, which means the payload covers the rest of the DMA transfer.
The BAM DMA driver does not report the size of completed RX transfers
today. Patch 1 reports it as residue through callback_result, and
patch 2 uses it in BAM-DMUX.
- The modem only uses QMAP on a channel if the OPEN command it receives
has the QMAP signal bit set. Patch 3 sets the bit if the modem set it
in its own OPEN command.
Patch 2 depends on patch 1. Vinod, if you are fine with patch 1, could
you ack it so that the series can go through net-next?
Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
---
Vishnu Santhosh (3):
dmaengine: qcom: bam_dma: report residue for completed RX transfers
net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets
net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem
drivers/dma/qcom/bam_dma.c | 53 ++++++++++++++++++++++++++++++++++++++++
drivers/net/wwan/qcom_bam_dmux.c | 50 ++++++++++++++++++++++++++++++-------
2 files changed, 94 insertions(+), 9 deletions(-)
---
base-commit: 34d30f9e1f2d8cb25c12ae48572143411a6d278b
change-id: 20261201-qcom-bam-dmux-qmap-6879f7f485ff
Best regards,
--
Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 16+ messages in thread* [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers 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 ` Vishnu Santhosh 2026-12-03 16:19 ` Frank Li ` (3 more replies) 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-03 16:10 ` [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem Vishnu Santhosh 2 siblings, 4 replies; 16+ messages in thread From: Vishnu Santhosh @ 2026-12-03 16:10 UTC (permalink / raw) To: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: linux-arm-msm, dmaengine, netdev, linux-kernel, Vishnu Santhosh, Deepak Kumar Singh For device-to-memory transfers, the BAM writes the number of bytes it transferred back into the size field of each completed descriptor in the FIFO. The driver ignores this and always reports a residue of zero, so clients cannot tell how much data was received. BAM-DMUX needs this, because the modem can send packets whose length is only given by the size of the transfer. Read the written-back sizes when a transfer completes, and report the unused part of the buffers as residue through callback_result. If the BAM reports more bytes than were queued, mark the transfer as DMA_TRANS_WRITE_FAILED. If a descriptor other than the last one is short, the received data is not contiguous and cannot be described by a residue, so mark the transfer as DMA_TRANS_ABORTED. All existing users set the plain callback, which does not receive the result, so they are not affected. Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> --- drivers/dma/qcom/bam_dma.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index e62e411dc8f8b24ecb9443b0c7eafb73ecfe8f01..b5d661b9af3df05ebd1ef909dea66a98ba938915 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -834,6 +834,57 @@ static int bam_resume(struct dma_chan *chan) return 0; } +/** + * bam_update_rx_result - account for bytes received by completed descriptors + * @bchan: bam channel + * @async_desc: descriptor whose hardware descriptors have completed + * + * On a producer pipe the BAM writes the number of bytes it transferred back + * into the size field of each completed descriptor in the FIFO. Report the + * unused part of the buffers as residue, so that clients using + * callback_result know how much data was received. Only the last descriptor + * of a transfer may be short, otherwise the transfer is marked as aborted. + * Clients that rely on the residue should therefore use a single buffer of + * at most BAM_FIFO_SIZE bytes per transfer. The residue is undefined if the + * result is not DMA_TRANS_NOERROR. + */ +static void bam_update_rx_result(struct bam_chan *bchan, + struct bam_async_desc *async_desc) +{ + struct bam_desc_hw *fifo = PTR_ALIGN(bchan->fifo_virt, + sizeof(struct bam_desc_hw)); + u32 i; + + if (async_desc->dir != DMA_DEV_TO_MEM) + return; + + /* Read the written back sizes only after reading BAM_P_SW_OFSTS */ + dma_rmb(); + + for (i = 0; i < async_desc->xfer_len; i++) { + u16 expected = le16_to_cpu(async_desc->curr_desc[i].size); + u16 received = le16_to_cpu(fifo[(bchan->head + i) % + MAX_DESCRIPTORS].size); + + if (received > expected) { + async_desc->vd.tx_result.result = DMA_TRANS_WRITE_FAILED; + async_desc->vd.tx_result.residue += expected; + continue; + } + + /* + * The next descriptor writes from its own address, so a short + * write before the last one leaves a hole in the buffer that + * cannot be described by the residue. + */ + if (received < expected && i != async_desc->num_desc - 1 && + async_desc->vd.tx_result.result == DMA_TRANS_NOERROR) + async_desc->vd.tx_result.result = DMA_TRANS_ABORTED; + + async_desc->vd.tx_result.residue += expected - received; + } +} + /** * process_channel_irqs - processes the channel interrupts * @bdev: bam controller @@ -881,6 +932,8 @@ static u32 process_channel_irqs(struct bam_device *bdev) if (avail < async_desc->xfer_len) break; + bam_update_rx_result(bchan, async_desc); + /* manage FIFO */ bchan->head += async_desc->xfer_len; bchan->head %= MAX_DESCRIPTORS; -- 2.34.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers 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 ` (2 subsequent siblings) 3 siblings, 0 replies; 16+ messages in thread From: Frank Li @ 2026-12-03 16:19 UTC (permalink / raw) To: Vishnu Santhosh Cc: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, dmaengine, netdev, linux-kernel, Deepak Kumar Singh On Thu, Dec 03, 2026 at 09:40:52PM +0530, Vishnu Santhosh wrote: > For device-to-memory transfers, the BAM writes the number of bytes it > transferred back into the size field of each completed descriptor in the > FIFO. The driver ignores this and always reports a residue of zero, so > clients cannot tell how much data was received. > > BAM-DMUX needs this, because the modem can send packets whose length is > only given by the size of the transfer. > > Read the written-back sizes when a transfer completes, and report the > unused part of the buffers as residue through callback_result. If the > BAM reports more bytes than were queued, mark the transfer as > DMA_TRANS_WRITE_FAILED. If a descriptor other than the last one is > short, the received data is not contiguous and cannot be described by a > residue, so mark the transfer as DMA_TRANS_ABORTED. > > All existing users set the plain callback, which does not receive the > result, so they are not affected. > > Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> > --- > drivers/dma/qcom/bam_dma.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 53 insertions(+) > > diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c > index e62e411dc8f8b24ecb9443b0c7eafb73ecfe8f01..b5d661b9af3df05ebd1ef909dea66a98ba938915 100644 > --- a/drivers/dma/qcom/bam_dma.c > +++ b/drivers/dma/qcom/bam_dma.c > @@ -834,6 +834,57 @@ static int bam_resume(struct dma_chan *chan) > return 0; > } > > +/** > + * bam_update_rx_result - account for bytes received by completed descriptors > + * @bchan: bam channel > + * @async_desc: descriptor whose hardware descriptors have completed > + * > + * On a producer pipe the BAM writes the number of bytes it transferred back > + * into the size field of each completed descriptor in the FIFO. Report the > + * unused part of the buffers as residue, so that clients using > + * callback_result know how much data was received. Only the last descriptor > + * of a transfer may be short, otherwise the transfer is marked as aborted. > + * Clients that rely on the residue should therefore use a single buffer of > + * at most BAM_FIFO_SIZE bytes per transfer. The residue is undefined if the > + * result is not DMA_TRANS_NOERROR. > + */ > +static void bam_update_rx_result(struct bam_chan *bchan, > + struct bam_async_desc *async_desc) > +{ > + struct bam_desc_hw *fifo = PTR_ALIGN(bchan->fifo_virt, > + sizeof(struct bam_desc_hw)); > + u32 i; > + > + if (async_desc->dir != DMA_DEV_TO_MEM) > + return; > + > + /* Read the written back sizes only after reading BAM_P_SW_OFSTS */ > + dma_rmb(); > + > + for (i = 0; i < async_desc->xfer_len; i++) { > + u16 expected = le16_to_cpu(async_desc->curr_desc[i].size); > + u16 received = le16_to_cpu(fifo[(bchan->head + i) % > + MAX_DESCRIPTORS].size); > + > + if (received > expected) { > + async_desc->vd.tx_result.result = DMA_TRANS_WRITE_FAILED; > + async_desc->vd.tx_result.residue += expected; > + continue; > + } > + > + /* > + * The next descriptor writes from its own address, so a short > + * write before the last one leaves a hole in the buffer that > + * cannot be described by the residue. > + */ > + if (received < expected && i != async_desc->num_desc - 1 && > + async_desc->vd.tx_result.result == DMA_TRANS_NOERROR) > + async_desc->vd.tx_result.result = DMA_TRANS_ABORTED; Suppose need break loop here. Need check following desc. Frank > + > + async_desc->vd.tx_result.residue += expected - received; > + } > +} > + > /** > * process_channel_irqs - processes the channel interrupts > * @bdev: bam controller > @@ -881,6 +932,8 @@ static u32 process_channel_irqs(struct bam_device *bdev) > if (avail < async_desc->xfer_len) > break; > > + bam_update_rx_result(bchan, async_desc); > + > /* manage FIFO */ > bchan->head += async_desc->xfer_len; > bchan->head %= MAX_DESCRIPTORS; > > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers 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 3 siblings, 2 replies; 16+ messages in thread From: Stephan Gerhold @ 2026-12-04 10:10 UTC (permalink / raw) To: Vishnu Santhosh, Nickolay Goppen Cc: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, dmaengine, netdev, linux-kernel, Deepak Kumar Singh On Thu, Dec 03, 2026 at 09:40:52PM +0530, Vishnu Santhosh wrote: > For device-to-memory transfers, the BAM writes the number of bytes it > transferred back into the size field of each completed descriptor in the > FIFO. The driver ignores this and always reports a residue of zero, so > clients cannot tell how much data was received. > > BAM-DMUX needs this, because the modem can send packets whose length is > only given by the size of the transfer. > > Read the written-back sizes when a transfer completes, and report the > unused part of the buffers as residue through callback_result. If the > BAM reports more bytes than were queued, mark the transfer as > DMA_TRANS_WRITE_FAILED. If a descriptor other than the last one is > short, the received data is not contiguous and cannot be described by a > residue, so mark the transfer as DMA_TRANS_ABORTED. > > All existing users set the plain callback, which does not receive the > result, so they are not affected. > > Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> I think you should coordinate this patch with Nickolay, there is a similar patch already on the list. (I haven't checked if any of the patches is preferable, I suggest you both cross-review/test and pick your favorite for Vinod to apply). :-) https://lore.kernel.org/r/20261116-qcom-bam-dma-metadata-v2-1-aade3a42fcb4@mainlining.org/ Thanks, Stephan ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers 2026-12-04 10:10 ` Stephan Gerhold @ 2026-12-04 11:18 ` Nickolay Goppen 2026-12-04 11:31 ` Nickolay Goppen 1 sibling, 0 replies; 16+ messages in thread From: Nickolay Goppen @ 2026-12-04 11:18 UTC (permalink / raw) To: Stephan Gerhold, Vishnu Santhosh Cc: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, dmaengine, netdev, linux-kernel, Deepak Kumar Singh 04.12.2026 13:10, Stephan Gerhold пишет: > On Thu, Dec 03, 2026 at 09:40:52PM +0530, Vishnu Santhosh wrote: >> For device-to-memory transfers, the BAM writes the number of bytes it >> transferred back into the size field of each completed descriptor in the >> FIFO. The driver ignores this and always reports a residue of zero, so >> clients cannot tell how much data was received. >> >> BAM-DMUX needs this, because the modem can send packets whose length is >> only given by the size of the transfer. >> >> Read the written-back sizes when a transfer completes, and report the >> unused part of the buffers as residue through callback_result. If the >> BAM reports more bytes than were queued, mark the transfer as >> DMA_TRANS_WRITE_FAILED. If a descriptor other than the last one is >> short, the received data is not contiguous and cannot be described by a >> residue, so mark the transfer as DMA_TRANS_ABORTED. >> >> All existing users set the plain callback, which does not receive the >> result, so they are not affected. >> >> Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> >> Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> >> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> > I think you should coordinate this patch with Nickolay, there is a > similar patch already on the list. (I haven't checked if any of the > patches is preferable, I suggest you both cross-review/test and pick > your favorite for Vinod to apply). :-) My patch is a preparation for upcoming ipa2 support in the ipa driver, but I can rebase it onto this patch https://github.com/sdm660-mainline/linux/commits/setotau/sdm660-7.3-ipa2/ > https://lore.kernel.org/r/20261116-qcom-bam-dma-metadata-v2-1-aade3a42fcb4@mainlining.org/ > > Thanks, > Stephan -- Best regards, Nickolay ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers 2026-12-04 10:10 ` Stephan Gerhold 2026-12-04 11:18 ` Nickolay Goppen @ 2026-12-04 11:31 ` Nickolay Goppen 1 sibling, 0 replies; 16+ messages in thread From: Nickolay Goppen @ 2026-12-04 11:31 UTC (permalink / raw) To: Stephan Gerhold, Vishnu Santhosh Cc: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, dmaengine, netdev, linux-kernel, Deepak Kumar Singh 04.12.2026 13:10, Stephan Gerhold пишет: > On Thu, Dec 03, 2026 at 09:40:52PM +0530, Vishnu Santhosh wrote: >> For device-to-memory transfers, the BAM writes the number of bytes it >> transferred back into the size field of each completed descriptor in the >> FIFO. The driver ignores this and always reports a residue of zero, so >> clients cannot tell how much data was received. >> >> BAM-DMUX needs this, because the modem can send packets whose length is >> only given by the size of the transfer. >> >> Read the written-back sizes when a transfer completes, and report the >> unused part of the buffers as residue through callback_result. If the >> BAM reports more bytes than were queued, mark the transfer as >> DMA_TRANS_WRITE_FAILED. If a descriptor other than the last one is >> short, the received data is not contiguous and cannot be described by a >> residue, so mark the transfer as DMA_TRANS_ABORTED. >> >> All existing users set the plain callback, which does not receive the >> result, so they are not affected. >> >> Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> >> Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> >> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> > I think you should coordinate this patch with Nickolay, there is a > similar patch already on the list. (I haven't checked if any of the > patches is preferable, I suggest you both cross-review/test and pick > your favorite for Vinod to apply). :-) I need to test a patch from here > https://lore.kernel.org/r/20261116-qcom-bam-dma-metadata-v2-1-aade3a42fcb4@mainlining.org/ > > Thanks, > Stephan -- Best regards, Nickolay ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers 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 16:11 ` sashiko-bot 2026-12-04 17:06 ` netdev-bot+sashiko 3 siblings, 0 replies; 16+ messages in thread From: sashiko-bot @ 2026-12-04 16:11 UTC (permalink / raw) To: Vishnu Santhosh; +Cc: dmaengine, vkoul, Frank.Li Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] dmaengine: qcom: bam_dma: uncached RX FIFO reads when callback_result is NULL - [Medium] dmaengine: qcom: bam_dma: dma_rmb() does not order MMIO readl_relaxed() -- commit cd588835da7396c54277f73b33e53000bbc1fb9a Author: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> dmaengine: qcom: bam_dma: report residue for completed RX transfers This commit adds bam_update_rx_result() to read hardware-written descriptor sizes from the RX FIFO on transfer completion and report the unused bytes as residue via callback_result. > diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c > index e62e411dc8f8b..b5d661b9af3df 100644 > --- a/drivers/dma/qcom/bam_dma.c > +++ b/drivers/dma/qcom/bam_dma.c > @@ -834,6 +834,57 @@ static int bam_resume(struct dma_chan *chan) [ ... ] > +static void bam_update_rx_result(struct bam_chan *bchan, > + struct bam_async_desc *async_desc) > +{ > + struct bam_desc_hw *fifo = PTR_ALIGN(bchan->fifo_virt, > + sizeof(struct bam_desc_hw)); > + u32 i; > + > + if (async_desc->dir != DMA_DEV_TO_MEM) > + return; > + > + /* Read the written back sizes only after reading BAM_P_SW_OFSTS */ > + dma_rmb(); [Severity: Medium] Is dma_rmb() sufficient to order FIFO reads after the readl_relaxed() of BAM_P_SW_OFSTS in process_channel_irqs()? As Documentation/memory-barriers.txt notes, dma_*() barriers do not order MMIO accesses. On 32-bit ARMv7, dma_rmb() emits dmb(osh) instead of the dsb() used by readl(), allowing bchan->fifo_virt reads to see stale sizes and report a wrong residue to clients like BAM-DMUX. Also, because process_channel_irqs() calls bam_update_rx_result() inside the desc_list loop, the barrier runs once per completed descriptor instead of once per channel interrupt. Using readl() for BAM_P_SW_OFSTS in process_channel_irqs() and removing dma_rmb() here addresses both. > + > + for (i = 0; i < async_desc->xfer_len; i++) { > + u16 expected = le16_to_cpu(async_desc->curr_desc[i].size); > + u16 received = le16_to_cpu(fifo[(bchan->head + i) % > + MAX_DESCRIPTORS].size); [Severity: Medium] Should bam_update_rx_result() return early when !async_desc->vd.tx.callback_result? bchan->fifo_virt is allocated with dma_alloc_wc(), so this loop does up to async_desc->xfer_len uncached reads in hardirq under bchan->vc.lock. Existing clients such as QCE crypto set only a plain callback, so vd->tx_result is discarded and every RX completion pays this latency hit. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af@oss.qualcomm.com?part=1 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers 2026-12-03 16:10 ` [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers Vishnu Santhosh ` (2 preceding siblings ...) 2026-12-04 16:11 ` sashiko-bot @ 2026-12-04 17:06 ` netdev-bot+sashiko 3 siblings, 0 replies; 16+ messages in thread From: netdev-bot+sashiko @ 2026-12-04 17:06 UTC (permalink / raw) To: vishnu.santhosh Cc: vkoul, Frank.Li, stephan, loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem, edumazet, kuba, pabeni, linux-arm-msm, dmaengine, netdev, linux-kernel, deepak.singh Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 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] dmaengine: qcom: bam_dma: dma_rmb() does not order MMIO readl_relaxed() -- > diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c > --- a/drivers/dma/qcom/bam_dma.c > +++ b/drivers/dma/qcom/bam_dma.c > @@ -834,6 +834,57 @@ static int bam_resume(struct dma_chan *chan) > return 0; > } > > +/** > + * bam_update_rx_result - account for bytes received by completed descriptors > + * @bchan: bam channel > + * @async_desc: descriptor whose hardware descriptors have completed > + * > + * On a producer pipe the BAM writes the number of bytes it transferred back > + * into the size field of each completed descriptor in the FIFO. Report the > + * unused part of the buffers as residue, so that clients using > + * callback_result know how much data was received. Only the last descriptor > + * of a transfer may be short, otherwise the transfer is marked as aborted. > + * Clients that rely on the residue should therefore use a single buffer of > + * at most BAM_FIFO_SIZE bytes per transfer. The residue is undefined if the > + * result is not DMA_TRANS_NOERROR. > + */ > +static void bam_update_rx_result(struct bam_chan *bchan, > + struct bam_async_desc *async_desc) > +{ > + struct bam_desc_hw *fifo = PTR_ALIGN(bchan->fifo_virt, > + sizeof(struct bam_desc_hw)); > + u32 i; > + > + if (async_desc->dir != DMA_DEV_TO_MEM) > + return; > + > + /* Read the written back sizes only after reading BAM_P_SW_OFSTS */ > + dma_rmb(); > + > + for (i = 0; i < async_desc->xfer_len; i++) { > + u16 expected = le16_to_cpu(async_desc->curr_desc[i].size); > + u16 received = le16_to_cpu(fifo[(bchan->head + i) % > + MAX_DESCRIPTORS].size); > + > + if (received > expected) { > + async_desc->vd.tx_result.result = DMA_TRANS_WRITE_FAILED; > + async_desc->vd.tx_result.residue += expected; > + continue; > + } > + > + /* > + * The next descriptor writes from its own address, so a short > + * write before the last one leaves a hole in the buffer that > + * cannot be described by the residue. > + */ > + if (received < expected && i != async_desc->num_desc - 1 && > + async_desc->vd.tx_result.result == DMA_TRANS_NOERROR) > + async_desc->vd.tx_result.result = DMA_TRANS_ABORTED; > + > + async_desc->vd.tx_result.residue += expected - received; > + } > +} > + > /** > * process_channel_irqs - processes the channel interrupts > * @bdev: bam controller [Severity: Medium] The comment says the FIFO size fields must be read only after the BAM_P_SW_OFSTS read. That read in process_channel_irqs() is a readl_relaxed(), and dma_rmb() is not specified to order MMIO accesses against normal memory. Documentation/memory-barriers.txt says the dma_*() barriers give no ordering guarantees for MMIO. It also says readX() is what you need when a device status read must complete before you look at a buffer the device has written. This matters on the platforms that use bam-dmux. On 32-bit ARMv7 (msm8974, msm8226 and friends) readl() ends in rmb(), which is a dsb. dma_rmb() is only dmb(osh). So nothing guarantees the CPU won't see a stale pre-transfer size in fifo_virt. It would then compute a wrong residue, which for qcom_bam_dmux means a wrong packet length. arm64 happens to be fine because its __io_ar() is dma_rmb() anyway. As a side effect, placing the barrier in bam_update_rx_result() issues it once per completed async_desc rather than once per interrupt. Would it be simpler to switch the BAM_P_SW_OFSTS read in process_channel_irqs() to readl() and drop the dma_rmb() here? That gives the right ordering on both arm and arm64 and costs only one barrier per channel per IRQ. An rmb() right after the readl_relaxed() would also work, if you prefer to keep the relaxed accessor. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af%40oss.qualcomm.com ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets 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:10 ` 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 2 siblings, 2 replies; 16+ messages in thread From: Vishnu Santhosh @ 2026-12-03 16:10 UTC (permalink / raw) To: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: linux-arm-msm, dmaengine, netdev, linux-kernel, Vishnu Santhosh, Deepak Kumar Singh With QMAP, the multiplexing protocol handled by the rmnet driver, the modem sets the length in the header of DATA packets to 0xffff. This means that the payload fills the rest of the DMA transfer, which can hold several QMAP packets. The driver treats 0xffff as a real length and drops every such packet: Data larger than buffer? (65535 > 2040) Get the number of received bytes from the DMA result, and: - drop the buffer if the transfer failed or is shorter than a header - take the payload length from the received size if the header says 0xffff - drop packets that claim more data than was received, replacing the check against the buffer size, since a transfer cannot be larger than the buffer Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> --- drivers/net/wwan/qcom_bam_dmux.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c index e1cc3038a724ee2a3eba4a9d97715f1f5966452d..a7d05b1b8b1230d1d54e9a7abcbc16a16681797e 100644 --- a/drivers/net/wwan/qcom_bam_dmux.c +++ b/drivers/net/wwan/qcom_bam_dmux.c @@ -30,6 +30,7 @@ #define BAM_DMUX_NUM_SKB 32 #define BAM_DMUX_HDR_MAGIC 0x33fc +#define BAM_DMUX_LEN_FROM_DMA 0xffff #define BAM_DMUX_AUTOSUSPEND_DELAY 1000 #define BAM_DMUX_REMOTE_TIMEOUT msecs_to_jiffies(2000) @@ -467,7 +468,8 @@ static void bam_dmux_register_netdev_work(struct work_struct *work) } } -static void bam_dmux_rx_callback(void *data); +static void bam_dmux_rx_callback(void *data, + const struct dmaengine_result *result); static bool bam_dmux_skb_dma_submit_rx(struct bam_dmux_skb_dma *skb_dma) { @@ -482,7 +484,7 @@ static bool bam_dmux_skb_dma_submit_rx(struct bam_dmux_skb_dma *skb_dma) return false; } - dmaengine_desc_set_callback(desc, bam_dmux_rx_callback, NULL, skb_dma); + dmaengine_desc_set_callback(desc, NULL, bam_dmux_rx_callback, skb_dma); dmaengine_submit(desc); return true; } @@ -500,21 +502,23 @@ static bool bam_dmux_skb_dma_queue_rx(struct bam_dmux_skb_dma *skb_dma, gfp_t gf bam_dmux_skb_dma_submit_rx(skb_dma); } -static void bam_dmux_cmd_data(struct bam_dmux_skb_dma *skb_dma) +static void bam_dmux_cmd_data(struct bam_dmux_skb_dma *skb_dma, + unsigned int rx_len) { struct bam_dmux *dmux = skb_dma->dmux; struct sk_buff *skb = skb_dma->skb; struct bam_dmux_hdr *hdr = (struct bam_dmux_hdr *)skb->data; struct net_device *netdev = dmux->netdevs[hdr->ch]; + unsigned int avail = rx_len - sizeof(*hdr); if (!netdev || !netif_running(netdev)) { dev_warn(dmux->dev, "Data for inactive channel %u\n", hdr->ch); return; } - if (hdr->len > BAM_DMUX_MAX_DATA_SIZE) { - dev_err(dmux->dev, "Data larger than buffer? (%u > %u)\n", - hdr->len, (u16)BAM_DMUX_MAX_DATA_SIZE); + if (hdr->len > avail) { + dev_err(dmux->dev, "Data larger than received? (%u > %u)\n", + hdr->len, avail); return; } @@ -574,15 +578,29 @@ static void bam_dmux_cmd_close(struct bam_dmux *dmux, struct bam_dmux_hdr *hdr) netif_device_detach(netdev); } -static void bam_dmux_rx_callback(void *data) +static void bam_dmux_rx_callback(void *data, + const struct dmaengine_result *result) { struct bam_dmux_skb_dma *skb_dma = data; struct bam_dmux *dmux = skb_dma->dmux; struct sk_buff *skb = skb_dma->skb; struct bam_dmux_hdr *hdr = (struct bam_dmux_hdr *)skb->data; + unsigned int rx_len; bam_dmux_skb_dma_unmap(skb_dma, DMA_FROM_DEVICE); + if (result->result != DMA_TRANS_NOERROR || result->residue > skb->len) { + dev_err(dmux->dev, "RX DMA failed: %d (residue %u)\n", + result->result, result->residue); + goto out; + } + + rx_len = skb->len - result->residue; + if (rx_len < sizeof(*hdr)) { + dev_err(dmux->dev, "RX shorter than header: %u\n", rx_len); + goto out; + } + if (hdr->magic != BAM_DMUX_HDR_MAGIC) { dev_err(dmux->dev, "Invalid magic in header: %#x\n", hdr->magic); goto out; @@ -593,9 +611,13 @@ static void bam_dmux_rx_callback(void *data) goto out; } + /* The remote side may leave it to us to use the DMA transfer size */ + if (hdr->cmd == BAM_DMUX_CMD_DATA && hdr->len == BAM_DMUX_LEN_FROM_DMA) + hdr->len = rx_len - sizeof(*hdr); + switch (hdr->cmd) { case BAM_DMUX_CMD_DATA: - bam_dmux_cmd_data(skb_dma); + bam_dmux_cmd_data(skb_dma, rx_len); break; case BAM_DMUX_CMD_OPEN: bam_dmux_cmd_open(dmux, hdr); -- 2.34.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets 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 1 sibling, 0 replies; 16+ messages in thread From: Stephan Gerhold @ 2026-12-04 10:14 UTC (permalink / raw) To: Vishnu Santhosh Cc: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, dmaengine, netdev, linux-kernel, Deepak Kumar Singh On Thu, Dec 03, 2026 at 09:40:53PM +0530, Vishnu Santhosh wrote: > With QMAP, the multiplexing protocol handled by the rmnet driver, the > modem sets the length in the header of DATA packets to 0xffff. This > means that the payload fills the rest of the DMA transfer, which can > hold several QMAP packets. The driver treats 0xffff as a real length > and drops every such packet: > > Data larger than buffer? (65535 > 2040) > > Get the number of received bytes from the DMA result, and: > > - drop the buffer if the transfer failed or is shorter than a header > - take the payload length from the received size if the header says > 0xffff > - drop packets that claim more data than was received, replacing the > check against the buffer size, since a transfer cannot be larger > than the buffer > > Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> > --- > drivers/net/wwan/qcom_bam_dmux.c | 38 ++++++++++++++++++++++++++++++-------- > 1 file changed, 30 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c > index e1cc3038a724ee2a3eba4a9d97715f1f5966452d..a7d05b1b8b1230d1d54e9a7abcbc16a16681797e 100644 > --- a/drivers/net/wwan/qcom_bam_dmux.c > +++ b/drivers/net/wwan/qcom_bam_dmux.c > [...] > @@ -593,9 +611,13 @@ static void bam_dmux_rx_callback(void *data) > goto out; > } > > + /* The remote side may leave it to us to use the DMA transfer size */ > + if (hdr->cmd == BAM_DMUX_CMD_DATA && hdr->len == BAM_DMUX_LEN_FROM_DMA) > + hdr->len = rx_len - sizeof(*hdr); > + > switch (hdr->cmd) { > case BAM_DMUX_CMD_DATA: > - bam_dmux_cmd_data(skb_dma); > + bam_dmux_cmd_data(skb_dma, rx_len); > break; We already check for if (hdr->cmd == BAM_DMUX_CMD_DATA ...) in the switch statement here, so I think the code would be easier to read if you move the if statement above directly into bam_dmux_cmd_data(). I'm also not sure if we need to modify the hdr->len at all, since this is kind of a header/struct owned" by BAM-DMUX and not us. bam_dmux_cmd_data() could just read it into a variable and override it with your calculation from the BAM if it's BAM_DMUX_LEN_FROM_DMA. Thanks, Stephan ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets 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 1 sibling, 0 replies; 16+ messages in thread From: netdev-bot+sashiko @ 2026-12-04 17:06 UTC (permalink / raw) To: vishnu.santhosh Cc: vkoul, Frank.Li, stephan, loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem, edumazet, kuba, pabeni, linux-arm-msm, dmaengine, netdev, linux-kernel, deepak.singh Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] Undisclosed hard dependency on the bam_dma residue patch, plus a requested Fixes: tag. - [Low] The 0xffff length derivation ignores hdr->pad. Pre-existing issues: - [Low] Zero-length DATA packet handling in bam_dmux_cmd_data(). -- net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets The RX DMA callback now uses the dmaengine result variant, so the driver knows how many bytes were received. It drops failed or too-short transfers. For DATA frames whose header length is 0xffff, it takes the payload length from the DMA transfer size. The old check against the buffer size is replaced with a check against the received size. > diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c > index e1cc3038a724e..a7d05b1b8b123 100644 > --- a/drivers/net/wwan/qcom_bam_dmux.c > +++ b/drivers/net/wwan/qcom_bam_dmux.c [ ... ] > @@ -500,21 +502,23 @@ static bool bam_dmux_skb_dma_queue_rx(struct bam_dmux_skb_dma *skb_dma, gfp_t gf > bam_dmux_skb_dma_submit_rx(skb_dma); > } > > -static void bam_dmux_cmd_data(struct bam_dmux_skb_dma *skb_dma) > +static void bam_dmux_cmd_data(struct bam_dmux_skb_dma *skb_dma, > + unsigned int rx_len) > { > struct bam_dmux *dmux = skb_dma->dmux; > struct sk_buff *skb = skb_dma->skb; > struct bam_dmux_hdr *hdr = (struct bam_dmux_hdr *)skb->data; > struct net_device *netdev = dmux->netdevs[hdr->ch]; > + unsigned int avail = rx_len - sizeof(*hdr); [ ... ] > - if (hdr->len > BAM_DMUX_MAX_DATA_SIZE) { > - dev_err(dmux->dev, "Data larger than buffer? (%u > %u)\n", > - hdr->len, (u16)BAM_DMUX_MAX_DATA_SIZE); > + if (hdr->len > avail) { > + dev_err(dmux->dev, "Data larger than received? (%u > %u)\n", > + hdr->len, avail); > return; > } [Severity: Low] This issue is pre-existing and was not introduced by this patch. Now that this check is being changed, though, what happens when hdr->len is 0? The check passes because 0 > avail is false. The rest of bam_dmux_cmd_data() then does: skb_pull(skb, sizeof(*hdr)); skb_trim(skb, hdr->len); skb->dev = netdev; /* Only Raw-IP/QMAP is supported by this driver */ switch (skb->data[0] & 0xf0) { After skb_trim(skb, 0), skb->len is 0. So skb->data[0] is a byte that was not received in this transfer. It is either stale data from a recycled RX buffer or uninitialised memory from __netdev_alloc_skb(). The zero-length skb is then passed to netif_receive_skb(). On the baseline the modem could already send len 0 directly. This patch adds a second route to the same state. A 0xffff DATA frame whose transfer is exactly sizeof(struct bam_dmux_hdr) bytes passes the new check in bam_dmux_rx_callback(), which only rejects rx_len < sizeof(*hdr). The rewrite then computes hdr->len = 0. Downstream consumers appear to drop such packets: rmnet_map_validate_packet_len() rejects short skbs, and ip_rcv()/ipv6_rcv() fail pskb_may_pull(). The effect is therefore limited to reading one stale byte, which KMSAN could flag. Would it make sense to reject hdr->len == 0 here as well? [ ... ] > @@ -574,15 +578,29 @@ static void bam_dmux_cmd_close(struct bam_dmux *dmux, struct bam_dmux_hdr *hdr) > netif_device_detach(netdev); > } > > -static void bam_dmux_rx_callback(void *data) > +static void bam_dmux_rx_callback(void *data, > + const struct dmaengine_result *result) > { > struct bam_dmux_skb_dma *skb_dma = data; > struct bam_dmux *dmux = skb_dma->dmux; > struct sk_buff *skb = skb_dma->skb; > struct bam_dmux_hdr *hdr = (struct bam_dmux_hdr *)skb->data; > + unsigned int rx_len; > > bam_dmux_skb_dma_unmap(skb_dma, DMA_FROM_DEVICE); > > + if (result->result != DMA_TRANS_NOERROR || result->residue > skb->len) { > + dev_err(dmux->dev, "RX DMA failed: %d (residue %u)\n", > + result->result, result->residue); > + goto out; > + } > + > + rx_len = skb->len - result->residue; [Severity: Low] This calculation is only correct if bam_dma fills in residue. That comes from the earlier patch in the series, "dmaengine: qcom: bam_dma: report residue for completed RX transfers", which adds bam_update_rx_result(). Without that patch, dmaengine_desc_callback_invoke() passes its dummy result to the callback: struct dmaengine_result dummy_result = { .result = DMA_TRANS_NOERROR, .residue = 0 }; Every RX buffer would then look like a full 2048-byte transfer. A 0xffff DATA frame would be delivered as 2040 bytes, including bytes the modem never wrote in that transfer. The client has no way to tell that the provider did not report a residue. Within the series the order is correct. 0xffff frames are also only expected after the QMAP-enable patch, so a Fixes: tag does not seem needed. Could the commit message state the dependency on the bam_dma patch, so the dmaengine and net patches land together or in the right order? > + if (rx_len < sizeof(*hdr)) { > + dev_err(dmux->dev, "RX shorter than header: %u\n", rx_len); > + goto out; > + } > + > if (hdr->magic != BAM_DMUX_HDR_MAGIC) { > dev_err(dmux->dev, "Invalid magic in header: %#x\n", hdr->magic); > goto out; > @@ -593,9 +611,13 @@ static void bam_dmux_rx_callback(void *data) > goto out; > } > > + /* The remote side may leave it to us to use the DMA transfer size */ > + if (hdr->cmd == BAM_DMUX_CMD_DATA && hdr->len == BAM_DMUX_LEN_FROM_DMA) > + hdr->len = rx_len - sizeof(*hdr); [Severity: Low] Should hdr->pad be accounted for here? The driver's own TX path in bam_dmux_tx_prepare_skb() defines the wire format as header + payload + pad. There, hdr->len excludes the padding: hdr->pad = pad; hdr->ch = bndev->ch; hdr->len = skb->len - sizeof(*hdr); if (pad) skb_put_zero(skb, pad); If the modem sets a non-zero hdr->pad on 0xffff frames, the pad bytes end up in the payload. bam_dmux_cmd_data() keeps them through skb_trim(skb, hdr->len), so skb->len can be up to 4 bytes too long when it reaches netif_receive_skb(). The visible impact looks small. rmnet_map_validate_packet_len() stops cleanly on short trailing data, and ip_rcv()/ipv6_rcv() trim to the IP total length. It is also not clear from the tree whether the firmware sets pad in 0xffff mode. If pad is subtracted, hdr->pad comes from the remote side. It would need to be checked against rx_len - sizeof(*hdr) to avoid an unsigned underflow. > switch (hdr->cmd) { > case BAM_DMUX_CMD_DATA: > - bam_dmux_cmd_data(skb_dma); > + bam_dmux_cmd_data(skb_dma, rx_len); > break; [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af%40oss.qualcomm.com ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem 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:10 ` [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets Vishnu Santhosh @ 2026-12-03 16:10 ` Vishnu Santhosh 2026-12-03 19:22 ` Loic Poulain ` (3 more replies) 2 siblings, 4 replies; 16+ messages in thread From: Vishnu Santhosh @ 2026-12-03 16:10 UTC (permalink / raw) To: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni Cc: linux-arm-msm, dmaengine, netdev, linux-kernel, Vishnu Santhosh, Deepak Kumar Singh 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. Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> --- 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) + #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 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem 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 ` (2 subsequent siblings) 3 siblings, 0 replies; 16+ messages in thread From: Loic Poulain @ 2026-12-03 19:22 UTC (permalink / raw) To: Vishnu Santhosh Cc: Vinod Koul, Frank Li, Stephan Gerhold, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, dmaengine, netdev, linux-kernel, Deepak Kumar Singh Hi Vishnu, On Thu, Dec 3, 2026 at 5:11 PM Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> 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@oss.qualcomm.com> > Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> > --- > 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 > ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem 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 3 siblings, 0 replies; 16+ messages in thread From: Stephan Gerhold @ 2026-12-04 10:42 UTC (permalink / raw) To: Vishnu Santhosh Cc: Vinod Koul, Frank Li, Stephan Gerhold, Loic Poulain, Sergey Ryazanov, Johannes Berg, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-arm-msm, dmaengine, netdev, linux-kernel, Deepak Kumar Singh On Thu, Dec 03, 2026 at 09:40:54PM +0530, Vishnu Santhosh 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. Nitpick: "Newer" is a quite ambiguous term here. Most MSM8916 from 2015 (11 years ago) already support QMAP. I think I only had a single device with an old modem firmware from 2014 that did not support that yet. The reason I never added support for QMAP is that BAM-DMUX itself already supports multiple data connections through its channels, so that alone is not a reason to use the more complex QMAP approach. What you might gain is support for aggregation/flow control that are also implemented in the rmnet driver, although I don't remember if I was able to determine back then if this is actually functional on BAM-DMUX platforms (it's been 6 years since I tried). Please add a motivation to the commit message to explain what we really gain in practice from enabling this feature. > 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. > > Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com> > Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> > --- > 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) > + The downstream bam_dmux driver calls this bit "DYNAMIC_MTU_MASK" and it's a bit more involved than just a simple "QMAP" signal [1]. It's used for some kind of dynamic MTU negotiation feature where both sides dynamically negotiate the MTU/buffer sizes, once statically during OPEN and technically also dynamically later on new DATA packets. I recall that signaling this bit is required for QMAP to work, but is only indirectly related to it. Based on your patch, it's not clear to me if this feature was simplified for Shikra or you have intentionally implemented it only partially with no reference to the dynamic MTU feature. Please explain the impact/applicability for older platforms in the commit message. Thanks, Stephan [1]: https://git.codelinaro.org/clo/la/kernel/msm-4.9/-/blob/dd6b65e15999156292e8108ec45062a419bbe98a/drivers/soc/qcom/bam_dmux.c#L1006-L1062 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem 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 3 siblings, 0 replies; 16+ messages in thread From: sashiko-bot @ 2026-12-04 16:11 UTC (permalink / raw) To: Vishnu Santhosh; +Cc: dmaengine, vkoul, Frank.Li Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] wwan: qcom_bam_dmux: remote_channels published before remote_qmap - [Medium] wwan: qcom_bam_dmux: unconditional QMAP OPEN may break Raw-IP userspace -- commit 062c491a01057c87d44c5e0253e74c1080c4ce69 Author: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem This commit records whether the modem sets BAM_DMUX_OPEN_QMAP in each channel's OPEN command and sets that bit in outgoing OPEN commands for those channels. > 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 [ ... ] > @@ -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] Can unconditionally setting BAM_DMUX_OPEN_QMAP break existing userspace that uses plain Raw-IP directly on wwanX without attaching rmnet? If QMAP-capable firmware starts QMAP framing as soon as it receives BAM_DMUX_OPEN_QMAP rather than waiting for QMI WDA configuration, bam_dmux_cmd_data() will tag incoming frames as ETH_P_MAP and drop them without an rmnet rx_handler, while TX still sends unframed Raw-IP. If firmware keeps Raw-IP active until QMI WDA enables QMAP, documenting that in the commit message would clarify compatibility; otherwise this may need to be gated on rmnet attachment or an opt-in control. [ ... ] > @@ -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] Can bam_dmux_send_cmd() miss BAM_DMUX_OPEN_QMAP because remote_channels is published before remote_qmap is updated? When the modem opens multiple channels at startup, an already-running bam_dmux_register_netdev_work() scans dmux->remote_channels with for_each_set_bit() without locking or acquire ordering: CPU0 (RX DMA callback) CPU1 (kworker) bam_dmux_cmd_open() bam_dmux_register_netdev_work() __test_and_set_bit(ch, dmux->remote_channels) for_each_set_bit(ch, dmux->remote_channels, ...) register_netdev(netdev) ... bam_dmux_netdev_open() bam_dmux_send_cmd() test_bit(ch, remote_qmap) == 0 <-- omits BAM_DMUX_OPEN_QMAP assign_bit(ch, dmux->remote_qmap, ...) The same reorder can happen on weakly ordered ARM/ARM64 systems because neither bitmap update nor for_each_set_bit() provides release/acquire ordering. This leaves QMAP disabled on the channel despite modem support. Testing remote_channels first, updating remote_qmap before setting remote_channels, and pairing smp_mb__before_atomic() with smp_rmb() in bam_dmux_register_netdev_work() would ensure remote_qmap is visible before netdev registration. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261203-qcom-bam-dmux-qmap-v1-0-abc2e80a03af@oss.qualcomm.com?part=3 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem 2026-12-03 16:10 ` [PATCH net-next 3/3] net: wwan: qcom_bam_dmux: enable QMAP if supported by the modem Vishnu Santhosh ` (2 preceding siblings ...) 2026-12-04 16:11 ` sashiko-bot @ 2026-12-04 17:06 ` netdev-bot+sashiko 3 siblings, 0 replies; 16+ messages in thread From: netdev-bot+sashiko @ 2026-12-04 17:06 UTC (permalink / raw) To: vishnu.santhosh Cc: vkoul, Frank.Li, stephan, loic.poulain, ryazanov.s.a, johannes, andrew+netdev, davem, edumazet, kuba, pabeni, linux-arm-msm, dmaengine, netdev, linux-kernel, deepak.singh 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2026-12-04 17:06 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox