Netdev List
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan.gerhold@linaro.org>
To: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
Cc: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
	Stephan Gerhold <stephan@gerhold.net>,
	Loic Poulain <loic.poulain@oss.qualcomm.com>,
	Sergey Ryazanov <ryazanov.s.a@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
Subject: Re: [PATCH net-next 2/3] net: wwan: qcom_bam_dmux: use DMA transfer size for RX packets
Date: Fri, 4 Dec 2026 11:14:24 +0100	[thread overview]
Message-ID: <axKSgIkcbRwliRni@linaro.org> (raw)
In-Reply-To: <20261203-qcom-bam-dmux-qmap-v1-2-abc2e80a03af@oss.qualcomm.com>

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

  reply	other threads:[~2026-12-04 10:14 UTC|newest]

Thread overview: 8+ 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-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 [this message]
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

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=axKSgIkcbRwliRni@linaro.org \
    --to=stephan.gerhold@linaro.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