[v3,1/8] dmadev: add channel status check for testing use
Checks
Commit Message
Add in a function to check if a device or vchan has completed all jobs
assigned to it, without gathering in the results. This is primarily for
use in testing, to allow the hardware to be in a known-state prior to
gathering completions.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/dmadev/rte_dmadev.c | 16 ++++++++++++++++
lib/dmadev/rte_dmadev.h | 33 +++++++++++++++++++++++++++++++++
lib/dmadev/rte_dmadev_core.h | 6 ++++++
lib/dmadev/version.map | 1 +
4 files changed, 56 insertions(+)
Comments
> Subject: [PATCH v3 1/8] dmadev: add channel status check for testing use
>
> Add in a function to check if a device or vchan has completed all jobs
> assigned to it, without gathering in the results. This is primarily for
> use in testing, to allow the hardware to be in a known-state prior to
> gathering completions.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
<snip>
On 07/09/2021 17:49, Bruce Richardson wrote:
> Add in a function to check if a device or vchan has completed all jobs
> assigned to it, without gathering in the results. This is primarily for
> use in testing, to allow the hardware to be in a known-state prior to
> gathering completions.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> lib/dmadev/rte_dmadev.c | 16 ++++++++++++++++
> lib/dmadev/rte_dmadev.h | 33 +++++++++++++++++++++++++++++++++
> lib/dmadev/rte_dmadev_core.h | 6 ++++++
> lib/dmadev/version.map | 1 +
> 4 files changed, 56 insertions(+)
>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
@@ -605,3 +605,19 @@ rte_dmadev_dump(uint16_t dev_id, FILE *f)
return 0;
}
+
+int
+rte_dmadev_vchan_status(uint16_t dev_id, uint16_t vchan, enum rte_dmadev_vchan_status *status)
+{
+ struct rte_dmadev *dev = &rte_dmadevices[dev_id];
+
+ RTE_DMADEV_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL);
+ if (vchan >= dev->data->dev_conf.nb_vchans) {
+ RTE_DMADEV_LOG(ERR,
+ "Device %u vchan %u out of range\n", dev_id, vchan);
+ return -EINVAL;
+ }
+
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vchan_status, -ENOTSUP);
+ return (*dev->dev_ops->vchan_status)(dev, vchan, status);
+}
@@ -640,6 +640,39 @@ __rte_experimental
int
rte_dmadev_stats_reset(uint16_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
+ */
+enum rte_dmadev_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_dmadev_vchan_status(uint16_t dev_id, uint16_t vchan, enum rte_dmadev_vchan_status *status);
+
/**
* @warning
* @b EXPERIMENTAL: this API may change without prior notice.
@@ -55,6 +55,10 @@ typedef int (*rte_dmadev_stats_reset_t)(struct rte_dmadev *dev, uint16_t vchan);
typedef int (*rte_dmadev_dump_t)(const struct rte_dmadev *dev, FILE *f);
/**< @internal Used to dump internal information. */
+typedef int (*rte_dmadev_vchan_status_t)(const struct rte_dmadev *dev, uint16_t vchan,
+ enum rte_dmadev_vchan_status *status);
+/**< @internal Used to check if a virtual channel has finished all jobs. */
+
typedef int (*rte_dmadev_copy_t)(struct rte_dmadev *dev, uint16_t vchan,
rte_iova_t src, rte_iova_t dst,
uint32_t length, uint64_t flags);
@@ -110,6 +114,8 @@ struct rte_dmadev_ops {
rte_dmadev_stats_get_t stats_get;
rte_dmadev_stats_reset_t stats_reset;
+ rte_dmadev_vchan_status_t vchan_status;
+
rte_dmadev_dump_t dev_dump;
};
@@ -19,6 +19,7 @@ EXPERIMENTAL {
rte_dmadev_stop;
rte_dmadev_submit;
rte_dmadev_vchan_setup;
+ rte_dmadev_vchan_status;
local: *;
};