[3/4] cryptodev: introduce query API for error interrupt event
Checks
Commit Message
An event RTE_CRYPTODEV_EVENT_ERROR gets fired when crypto PMD receives
an error interrupt. This patch adds query function for the application,
to get more info about the event.
Signed-off-by: Srujana Challa <schalla@marvell.com>
---
lib/cryptodev/cryptodev_pmd.h | 9 +++++++++
lib/cryptodev/rte_cryptodev.c | 19 +++++++++++++++++++
lib/cryptodev/rte_cryptodev.h | 19 +++++++++++++++++++
lib/cryptodev/version.map | 3 +++
4 files changed, 50 insertions(+)
@@ -451,6 +451,13 @@ typedef int (*cryptodev_session_event_mdata_set_t)(
enum rte_crypto_op_sess_type sess_type,
void *ev_mdata);
+/**
+ * @internal Query queue pair error interrupt event.
+ * @see rte_cryptodev_queue_pair_event_error_query()
+ */
+typedef int (*cryptodev_queue_pair_event_error_query_t)(struct rte_cryptodev *dev,
+ uint16_t qp_id);
+
/** Crypto device operations function pointer table */
struct rte_cryptodev_ops {
cryptodev_configure_t dev_configure; /**< Configure device. */
@@ -497,6 +504,8 @@ struct rte_cryptodev_ops {
};
cryptodev_session_event_mdata_set_t session_ev_mdata_set;
/**< Set a Crypto or Security session even meta data. */
+ cryptodev_queue_pair_event_error_query_t queue_pair_event_error_query;
+ /**< Query queue error interrupt event */
};
@@ -1863,6 +1863,25 @@ rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev,
rte_spinlock_unlock(&rte_cryptodev_cb_lock);
}
+int
+rte_cryptodev_queue_pair_event_error_query(uint8_t dev_id, uint16_t qp_id)
+{
+ struct rte_cryptodev *dev;
+
+ if (!rte_cryptodev_is_valid_dev(dev_id)) {
+ CDEV_LOG_ERR("Invalid dev_id=%" PRIu8, dev_id);
+ return -EINVAL;
+ }
+ dev = &rte_crypto_devices[dev_id];
+
+ if (qp_id >= dev->data->nb_queue_pairs)
+ return -EINVAL;
+ if (*dev->dev_ops->queue_pair_event_error_query == NULL)
+ return -ENOTSUP;
+
+ return dev->dev_ops->queue_pair_event_error_query(dev, qp_id);
+}
+
struct rte_mempool *
rte_cryptodev_sym_session_pool_create(const char *name, uint32_t nb_elts,
uint32_t elt_size, uint32_t cache_size, uint16_t user_data_size,
@@ -871,6 +871,25 @@ rte_cryptodev_callback_unregister(uint8_t dev_id,
enum rte_cryptodev_event_type event,
rte_cryptodev_cb_fn cb_fn, void *cb_arg);
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Query a cryptodev queue pair if there are pending RTE_CRYPTODEV_EVENT_ERROR
+ * events.
+ *
+ * @param dev_id The device identifier.
+ * @param qp_id Queue pair index to be queried.
+ *
+ * @return
+ * - 1 if requested queue has a pending event.
+ * - 0 if no pending event is found.
+ * - a negative value on failure
+ */
+__rte_experimental
+int
+rte_cryptodev_queue_pair_event_error_query(uint8_t dev_id, uint16_t qp_id);
+
struct rte_cryptodev_callback;
/** Structure to keep track of registered callbacks */
@@ -150,6 +150,9 @@ EXPERIMENTAL {
__rte_cryptodev_trace_sym_session_get_user_data;
__rte_cryptodev_trace_sym_session_set_user_data;
__rte_cryptodev_trace_count;
+
+ # added in 23.03
+ rte_cryptodev_queue_pair_event_error_query;
};
INTERNAL {