Re: [PATCH net-next 1/3] dmaengine: qcom: bam_dma: report residue for completed RX transfers

From: Nickolay Goppen

Date: Fri Dec 04 2026 - 06:19:19 EST



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@xxxxxxxxxxxxxxxx>
Signed-off-by: Deepak Kumar Singh <deepak.singh@xxxxxxxxxxxxxxxx>
Signed-off-by: Vishnu Santhosh <vishnu.santhosh@xxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxx/

Thanks,
Stephan

--
Best regards,
Nickolay