sched: move grinder configuration
[dpdk.git] / lib / dmadev / rte_dmadev.h
index e46c001..ad9e7a0 100644 (file)
 #include <rte_bitops.h>
 #include <rte_common.h>
 #include <rte_compat.h>
-#include <rte_dev.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -220,6 +219,24 @@ bool rte_dma_is_valid(int16_t dev_id);
 __rte_experimental
 uint16_t rte_dma_count_avail(void);
 
+/**
+ * Iterates over valid dmadev instances.
+ *
+ * @param start_dev_id
+ *   The id of the next possible dmadev.
+ * @return
+ *   Next valid dmadev, UINT16_MAX if there is none.
+ */
+__rte_experimental
+int16_t rte_dma_next_dev(int16_t start_dev_id);
+
+/** Utility macro to iterate over all available dmadevs */
+#define RTE_DMA_FOREACH_DEV(p) \
+       for (p = rte_dma_next_dev(0); \
+            p != -1; \
+            p = rte_dma_next_dev(p + 1))
+
+
 /**@{@name DMA capability
  * @see struct rte_dma_info::dev_capa
  */
@@ -244,6 +261,14 @@ uint16_t rte_dma_count_avail(void);
  * @see struct rte_dma_conf::silent_mode
  */
 #define RTE_DMA_CAPA_SILENT             RTE_BIT64(5)
+/** Supports error handling
+ *
+ * With this bit set, invalid input addresses will be reported as operation failures
+ * to the user but other operations can continue.
+ * Without this bit set, invalid data is not handled by either HW or driver, so user
+ * must ensure that all memory addresses are valid and accessible by HW.
+ */
+#define RTE_DMA_CAPA_HANDLES_ERRORS    RTE_BIT64(6)
 /** Support copy operation.
  * This capability start with index of 32, so that it could leave gap between
  * normal capability and ops capability.
@@ -507,7 +532,7 @@ struct rte_dma_port_param {
                 * @note If some fields can not be supported by the
                 * hardware/driver, then the driver ignores those fields.
                 * Please check driver-specific documentation for limitations
-                * and capablites.
+                * and capabilities.
                 */
                __extension__
                struct {
@@ -645,6 +670,40 @@ int rte_dma_stats_get(int16_t dev_id, uint16_t vchan,
 __rte_experimental
 int rte_dma_stats_reset(int16_t dev_id, uint16_t vchan);
 
+/**
+ * device vchannel status
+ *
+ * Enum with the options for the channel status, either idle, active or halted due to error
+ * @see rte_dma_vchan_status
+ */
+enum rte_dma_vchan_status {
+       RTE_DMA_VCHAN_IDLE,          /**< not processing, awaiting ops */
+       RTE_DMA_VCHAN_ACTIVE,        /**< currently processing jobs */
+       RTE_DMA_VCHAN_HALTED_ERROR,  /**< not processing due to error, cannot accept new ops */
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Determine if all jobs have completed on a device channel.
+ * This function is primarily designed for testing use, as it allows a process to check if
+ * all jobs are completed, without actually gathering completions from those jobs.
+ *
+ * @param dev_id
+ *   The identifier of the device.
+ * @param vchan
+ *   The identifier of virtual DMA channel.
+ * @param[out] status
+ *   The vchan status
+ * @return
+ *   0 - call completed successfully
+ *   < 0 - error code indicating there was a problem calling the API
+ */
+__rte_experimental
+int
+rte_dma_vchan_status(int16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *status);
+
 /**
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice.
@@ -671,7 +730,7 @@ enum rte_dma_status_code {
        /** The operation completed successfully. */
        RTE_DMA_STATUS_SUCCESSFUL,
        /** The operation failed to complete due abort by user.
-        * This is mainly used when processing dev_stop, user could modidy the
+        * This is mainly used when processing dev_stop, user could modify the
         * descriptors (e.g. change one bit to tell hardware abort this job),
         * it allows outstanding requests to be complete as much as possible,
         * so reduce the time to stop the device.
@@ -1042,6 +1101,35 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan,
                                        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)
+{
+       struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id];
+
+#ifdef RTE_DMADEV_DEBUG
+       if (!rte_dma_is_valid(dev_id))
+               return 0;
+       RTE_FUNC_PTR_OR_ERR_RET(*obj->burst_capacity, 0);
+#endif
+       return (*obj->burst_capacity)(obj->dev_private, vchan);
+}
+
 #ifdef __cplusplus
 }
 #endif