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 <deep…@oss.qualcomm.com>
> Signed-off-by: Deepak Kumar Singh <deep…@oss.qualcomm.com>
> Signed-off-by: Vishnu Santhosh <vish…@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/2026…@mainlining.org/
Thanks,
Stephan