DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srujana Challa <schalla@marvell.com>
To: <gakhil@marvell.com>, <fanzhang.oss@gmail.com>
Cc: <dev@dpdk.org>, <ndabilpuram@marvell.com>,
	<kirankumark@marvell.com>, <skori@marvell.com>,
	<anoobj@marvell.com>, <ktejasree@marvell.com>
Subject: [PATCH 3/4] cryptodev: introduce query API for error interrupt event
Date: Wed, 21 Dec 2022 16:20:06 +0530	[thread overview]
Message-ID: <20221221105007.2667292-3-schalla@marvell.com> (raw)
In-Reply-To: <20221221105007.2667292-1-schalla@marvell.com>

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(+)

diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 0020102eb7..0dfad9e24f 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -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 */
 };
 
 
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 2165a0688c..89ff66d2ba 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -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,
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 86d792e2e7..5f11a538fb 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -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 */
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index 00c99fb45c..214c91a06f 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -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 {
-- 
2.25.1


  parent reply	other threads:[~2022-12-21 10:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 10:50 [PATCH 1/4] common/cnxk: add CPT HW error callback register functions Srujana Challa
2022-12-21 10:50 ` [PATCH 2/4] crypto/cnxk: add callback to report CPT HW error Srujana Challa
2022-12-21 10:50 ` Srujana Challa [this message]
2022-12-21 10:50 ` [PATCH 4/4] crypto/cnxk: add error interrupt event query handler Srujana Challa
2022-12-21 13:21 [PATCH 1/4] common/cnxk: add CPT HW error callback register functions Srujana Challa
2022-12-21 13:21 ` [PATCH 3/4] cryptodev: introduce query API for error interrupt event Srujana Challa
2023-01-30 19:17   ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221221105007.2667292-3-schalla@marvell.com \
    --to=schalla@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=gakhil@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ktejasree@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).