From b9a1af8a3b03a5e8575d87c3593a5931cd0e7a8c Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 6 May 2015 05:46:01 +0200 Subject: Add fields reporting consumed buffers and space to the dma_engine_status and provide better ipedma benchmarking --- dma/nwl_engine_buffers.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'dma/nwl_engine_buffers.h') diff --git a/dma/nwl_engine_buffers.h b/dma/nwl_engine_buffers.h index d3af079..ef1c74f 100644 --- a/dma/nwl_engine_buffers.h +++ b/dma/nwl_engine_buffers.h @@ -374,6 +374,8 @@ int dma_nwl_get_status(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, pcil status->ring_size = ectx->ring_size; status->buffer_size = ectx->page_size; status->ring_tail = ectx->tail; + status->written_buffers = 0; + status->written_bytes = 0; if (ectx->desc->direction == PCILIB_DMA_FROM_DEVICE) { size_t pos = 0; @@ -402,7 +404,16 @@ int dma_nwl_get_status(pcilib_dma_context_t *vctx, pcilib_dma_engine_t dma, pcil ring += PCILIB_NWL_DMA_DESCRIPTOR_SIZE; } + } + + for (i = 0; (i < ectx->ring_size)&&(i < n_buffers); i++) { + bstatus = NWL_RING_GET(ring, DMA_BD_BUFL_STATUS_OFFSET); + if (bstatus & DMA_BD_COMP_MASK) { + status->written_buffers++; + if ((bstatus & (DMA_BD_ERROR_MASK)) == 0) + status->written_bytes += bstatus & DMA_BD_BUFL_MASK; + } } - + return 0; } -- cgit v1.2.3