diff mbox series

[v1,1/1] dmaengine: idma64: Update bytes_transferred field

Message ID 20230203121702.15725-1-aman.kumar@intel.com (mailing list archive)
State Accepted
Commit 1f6484614d740c237c3a204c07be7e97bc419410
Headers show
Series [v1,1/1] dmaengine: idma64: Update bytes_transferred field | expand

Commit Message

aman.kumar@intel.com Feb. 3, 2023, 12:17 p.m. UTC
From: Aman Kumar <aman.kumar@intel.com>

Currently when 8250 data transfer is done, bytes_tranferred always returns
0 at /sys/devices/pci0000\:\:**.*/dma/dma*chan*/bytes_transferred.
In many cases it gives false impression that data is not being
trasferred via DMA.

So, updating the bytes_transferred field to count the bytes
whenever there is data transfer using idma64.

Co-developed-by: Srikanth Thokala <srikanth.thokala@intel.com>
Signed-off-by: Srikanth Thokala <srikanth.thokala@intel.com>
Signed-off-by: Aman Kumar <aman.kumar@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/idma64.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Vinod Koul Feb. 10, 2023, 9:02 a.m. UTC | #1
On 03-02-23, 17:47, aman.kumar@intel.com wrote:
> From: Aman Kumar <aman.kumar@intel.com>
> 
> Currently when 8250 data transfer is done, bytes_tranferred always returns
> 0 at /sys/devices/pci0000\:\:**.*/dma/dma*chan*/bytes_transferred.
> In many cases it gives false impression that data is not being
> trasferred via DMA.
> 
> So, updating the bytes_transferred field to count the bytes
> whenever there is data transfer using idma64.

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
index c33087c5cd02..8880d2b91bf5 100644
--- a/drivers/dma/idma64.c
+++ b/drivers/dma/idma64.c
@@ -137,8 +137,11 @@  static void idma64_chan_irq(struct idma64 *idma64, unsigned short c,
 		u32 status_err, u32 status_xfer)
 {
 	struct idma64_chan *idma64c = &idma64->chan[c];
+	struct dma_chan_percpu *stat;
 	struct idma64_desc *desc;
 
+	stat = this_cpu_ptr(idma64c->vchan.chan.local);
+
 	spin_lock(&idma64c->vchan.lock);
 	desc = idma64c->desc;
 	if (desc) {
@@ -149,6 +152,7 @@  static void idma64_chan_irq(struct idma64 *idma64, unsigned short c,
 			dma_writel(idma64, CLEAR(XFER), idma64c->mask);
 			desc->status = DMA_COMPLETE;
 			vchan_cookie_complete(&desc->vdesc);
+			stat->bytes_transferred += desc->length;
 			idma64_start_transfer(idma64c);
 		}