In order to avoid timing errors with the unit tests, we need to ensure
we have the vchan_status function to report when a channel is idle.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/dma/skeleton/skeleton_dmadev.c | 18 +++++++++++++++++-
drivers/dma/skeleton/skeleton_dmadev.h | 2 +-
2 files changed, 18 insertions(+), 2 deletions(-)
@@ -79,7 +79,7 @@ cpucopy_thread(void *param)
hw->zero_req_count = 0;
rte_memcpy(desc->dst, desc->src, desc->len);
- hw->completed_count++;
+ __atomic_add_fetch(&hw->completed_count, 1, __ATOMIC_RELEASE);
(void)rte_ring_enqueue(hw->desc_completed, (void *)desc);
}
@@ -257,6 +257,21 @@ skeldma_vchan_setup(struct rte_dma_dev *dev, uint16_t vchan,
return vchan_setup(hw, conf->nb_desc);
}
+static int
+skeldma_vchan_status(const struct rte_dma_dev *dev,
+ uint16_t vchan, enum rte_dma_vchan_status *status)
+{
+ struct skeldma_hw *hw = dev->data->dev_private;
+
+ RTE_SET_USED(vchan);
+
+ *status = RTE_DMA_VCHAN_IDLE;
+ if (hw->submitted_count != __atomic_load_n(&hw->completed_count, __ATOMIC_ACQUIRE)
+ || hw->zero_req_count == 0)
+ *status = RTE_DMA_VCHAN_ACTIVE;
+ return 0;
+}
+
static int
skeldma_stats_get(const struct rte_dma_dev *dev, uint16_t vchan,
struct rte_dma_stats *stats, uint32_t stats_sz)
@@ -424,6 +439,7 @@ static const struct rte_dma_dev_ops skeldma_ops = {
.dev_close = skeldma_close,
.vchan_setup = skeldma_vchan_setup,
+ .vchan_status = skeldma_vchan_status,
.stats_get = skeldma_stats_get,
.stats_reset = skeldma_stats_reset,
@@ -54,7 +54,7 @@ struct skeldma_hw {
/* Cache delimiter for cpucopy thread's operation data */
char cache2 __rte_cache_aligned;
- uint32_t zero_req_count;
+ volatile uint32_t zero_req_count;
uint64_t completed_count;
};