@@ -1100,6 +1100,37 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
return (*dev->completed_status)(dev, vchan, nb_cpls, last_idx, status);
}
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Check remaining capacity in descriptor ring for the current burst.
+ *
+ * @param dev_id
+ * The identifier of the device.
+ * @param vchan
+ * The identifier of virtual DMA channel.
+ *
+ * @return
+ * - Remaining space in the descriptor ring for the current burst.
+ * - 0 on error
+ */
+__rte_experimental
+static inline uint16_t
+rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan)
+{
+ const struct rte_dma_dev *dev = &rte_dma_devices[dev_id];
+
+#ifdef RTE_DMADEV_DEBUG
+ if (!rte_dma_is_valid(dev_id) || !dev->data->dev_started ||
+ vchan >= dev->data->dev_conf.nb_vchans ||
+ nb_cpls == 0 || status == NULL)
+ return 0;
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->burst_capacity, 0);
+#endif
+ return (*dev->burst_capacity)(dev, vchan);
+}
+
#ifdef __cplusplus
}
#endif
@@ -58,6 +58,9 @@ typedef int (*rte_dma_stats_get_t)(const struct rte_dma_dev *dev,
/** @internal Used to reset basic statistics. */
typedef int (*rte_dma_stats_reset_t)(struct rte_dma_dev *dev, uint16_t vchan);
+/** @internal Used to check the remaining space in descriptor ring. */
+typedef uint16_t (*rte_dma_burst_capacity_t)(const struct rte_dma_dev *dev, uint16_t vchan);
+
/** @internal Used to dump internal information. */
typedef int (*rte_dma_dump_t)(const struct rte_dma_dev *dev, FILE *f);
@@ -124,7 +127,6 @@ struct rte_dma_dev_ops {
rte_dma_dump_t dev_dump;
rte_dma_vchan_status_t vchan_status;
-
};
/**
@@ -171,7 +173,7 @@ struct rte_dma_dev {
rte_dma_submit_t submit;
rte_dma_completed_t completed;
rte_dma_completed_status_t completed_status;
- void *reserved_cl0;
+ rte_dma_burst_capacity_t burst_capacity;
/** Reserve space for future IO functions, while keeping data and
* dev_ops pointers on the second cacheline.
*/
@@ -1,6 +1,7 @@
EXPERIMENTAL {
global:
+ rte_dma_burst_capacity;
rte_dma_close;
rte_dma_completed;
rte_dma_completed_status;