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

From: Stephan Gerhold

Date: Fri Dec 04 2026 - 05:10:51 EST


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). :-)

https://lore.kernel.org/r/20261116-qcom-bam-dma-metadata-v2-1-aade3a42fcb4@xxxxxxxxxxxxxx/

Thanks,
Stephan