DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/4] common/cnxk: add CPT HW error callback register functions
@ 2022-12-21 10:50 Srujana Challa
  2022-12-21 10:50 ` [PATCH 2/4] crypto/cnxk: add callback to report CPT HW error Srujana Challa
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Srujana Challa @ 2022-12-21 10:50 UTC (permalink / raw)
  To: gakhil, fanzhang.oss
  Cc: dev, ndabilpuram, kirankumark, skori, anoobj, ktejasree

Adds functions to register callback API to report CPT_MISC_INT
to the driver.

Signed-off-by: Srujana Challa <schalla@marvell.com>
---
 drivers/common/cnxk/roc_cpt.c   | 32 ++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_cpt.h   |  8 +++++++-
 drivers/common/cnxk/version.map |  2 ++
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index fb97ec89b2..553a5a2c80 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -25,6 +25,11 @@
 #define CPT_LF_DEFAULT_NB_DESC	1024
 #define CPT_LF_FC_MIN_THRESHOLD 32
 
+static struct cpt_int_cb {
+	roc_cpt_int_misc_cb_t cb;
+	void *cb_args;
+} int_cb;
+
 static void
 cpt_lf_misc_intr_enb_dis(struct roc_cpt_lf *lf, bool enb)
 {
@@ -57,6 +62,9 @@ cpt_lf_misc_irq(void *param)
 
 	/* Clear interrupt */
 	plt_write64(intr, lf->rbase + CPT_LF_MISC_INT);
+
+	if (int_cb.cb != NULL)
+		int_cb.cb(lf, int_cb.cb_args);
 }
 
 static int
@@ -1079,3 +1087,27 @@ roc_cpt_ctx_write(struct roc_cpt_lf *lf, void *sa_dptr, void *sa_cptr,
 
 	return 0;
 }
+
+void
+roc_cpt_int_misc_cb_register(roc_cpt_int_misc_cb_t cb, void *args)
+{
+	if (int_cb.cb != NULL)
+		return;
+
+	int_cb.cb = cb;
+	int_cb.cb_args = args;
+	return 0;
+}
+
+int
+roc_cpt_int_misc_cb_unregister(roc_cpt_int_misc_cb_t cb, void *args)
+{
+	if (int_cb.cb == NULL)
+		return 0;
+	if (int_cb.cb != cb || int_cb.cb_args != args)
+		return -EINVAL;
+
+	int_cb.cb = NULL;
+	int_cb.cb_args = NULL;
+	return 0;
+}
diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h
index bc9cc19edd..ac8be1b475 100644
--- a/drivers/common/cnxk/roc_cpt.h
+++ b/drivers/common/cnxk/roc_cpt.h
@@ -131,7 +131,7 @@ struct roc_cpt {
 	union cpt_eng_caps hw_caps[CPT_MAX_ENG_TYPES];
 	uint8_t eng_grp[CPT_MAX_ENG_TYPES];
 	uint8_t cpt_revision;
-
+	void *opaque;
 #define ROC_CPT_MEM_SZ (6 * 1024)
 	uint8_t reserved[ROC_CPT_MEM_SZ] __plt_cache_aligned;
 } __plt_cache_aligned;
@@ -144,6 +144,9 @@ struct roc_cpt_rxc_time_cfg {
 	uint16_t zombie_thres;
 };
 
+/* CPT MISC interrupt callback */
+typedef void (*roc_cpt_int_misc_cb_t)(struct roc_cpt_lf *lf, void *args);
+
 int __roc_api roc_cpt_rxc_time_cfg(struct roc_cpt *roc_cpt,
 				   struct roc_cpt_rxc_time_cfg *cfg);
 int __roc_api roc_cpt_dev_init(struct roc_cpt *roc_cpt);
@@ -174,4 +177,7 @@ int __roc_api roc_cpt_lmtline_init(struct roc_cpt *roc_cpt,
 void __roc_api roc_cpt_parse_hdr_dump(const struct cpt_parse_hdr_s *cpth);
 int __roc_api roc_cpt_ctx_write(struct roc_cpt_lf *lf, void *sa_dptr,
 				void *sa_cptr, uint16_t sa_len);
+
+void __roc_api roc_cpt_int_misc_cb_register(roc_cpt_int_misc_cb_t cb, void *args);
+int __roc_api roc_cpt_int_misc_cb_unregister(roc_cpt_int_misc_cb_t cb, void *args);
 #endif /* _ROC_CPT_H_ */
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index 17f0ec6b48..d6d96dd3eb 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -78,6 +78,8 @@ INTERNAL {
 	roc_cpt_parse_hdr_dump;
 	roc_cpt_rxc_time_cfg;
 	roc_cpt_ctx_write;
+	roc_cpt_int_misc_cb_register;
+	roc_cpt_int_misc_cb_unregister;
 	roc_dpi_configure;
 	roc_dpi_dev_fini;
 	roc_dpi_dev_init;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/4] crypto/cnxk: add callback to report CPT HW error
  2022-12-21 10:50 [PATCH 1/4] common/cnxk: add CPT HW error callback register functions Srujana Challa
@ 2022-12-21 10:50 ` Srujana Challa
  2022-12-21 10:50 ` [PATCH 3/4] cryptodev: introduce query API for error interrupt event Srujana Challa
  2022-12-21 10:50 ` [PATCH 4/4] crypto/cnxk: add error interrupt event query handler Srujana Challa
  2 siblings, 0 replies; 8+ messages in thread
From: Srujana Challa @ 2022-12-21 10:50 UTC (permalink / raw)
  To: gakhil, fanzhang.oss
  Cc: dev, ndabilpuram, kirankumark, skori, anoobj, ktejasree

Adds and register callback to report CPT MISC error interrupts to
the application using rte_cryptodev_pmd_callback_process.

Signed-off-by: Srujana Challa <schalla@marvell.com>
---
 drivers/crypto/cnxk/cnxk_cryptodev.c     | 12 ++++++++++++
 drivers/crypto/cnxk/cnxk_cryptodev.h     |  1 +
 drivers/crypto/cnxk/cnxk_cryptodev_ops.c |  8 ++++++++
 3 files changed, 21 insertions(+)

diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.c b/drivers/crypto/cnxk/cnxk_cryptodev.c
index 35635f7831..fee272d425 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev.c
@@ -2,6 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <cryptodev_pmd.h>
 #include <rte_cryptodev.h>
 
 #include "roc_cpt.h"
@@ -56,3 +57,14 @@ cnxk_cpt_eng_grp_add(struct roc_cpt *roc_cpt)
 
 	return 0;
 }
+
+void
+cnxk_cpt_int_misc_cb(struct roc_cpt_lf *lf, __rte_unused void *args)
+{
+	struct roc_cpt *roc_cpt = lf->roc_cpt;
+
+	if (roc_cpt == NULL)
+		return;
+
+	rte_cryptodev_pmd_callback_process(roc_cpt->opaque, RTE_CRYPTODEV_EVENT_ERROR);
+}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h
index 48bd6e144c..fcb1c48b5a 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev.h
@@ -31,5 +31,6 @@ struct cnxk_cpt_vf {
 uint64_t cnxk_cpt_default_ff_get(void);
 int cnxk_cpt_eng_grp_add(struct roc_cpt *roc_cpt);
 int cnxk_cpt_parse_devargs(struct rte_devargs *devargs, struct cnxk_cpt_vf *vf);
+void cnxk_cpt_int_misc_cb(struct roc_cpt_lf *lf, void *args);
 
 #endif /* _CNXK_CRYPTODEV_H_ */
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index a9c42205e6..91c7a686c2 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -91,6 +91,9 @@ cnxk_cpt_dev_config(struct rte_cryptodev *dev,
 			return ret;
 		}
 	}
+	roc_cpt->opaque = dev;
+	/* Register callback to handle CPT_MISC_INT */
+	roc_cpt_int_misc_cb_register(cnxk_cpt_int_misc_cb, NULL);
 
 	return 0;
 }
@@ -150,6 +153,11 @@ cnxk_cpt_dev_close(struct rte_cryptodev *dev)
 		roc_ae_ec_grp_put();
 	}
 
+	ret = roc_cpt_int_misc_cb_unregister(cnxk_cpt_int_misc_cb, NULL);
+	if (ret < 0) {
+		plt_err("Could not unregister CPT_MISC_INT cb");
+		return ret;
+	}
 	roc_cpt_dev_clear(&vf->cpt);
 
 	return 0;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/4] cryptodev: introduce query API for error interrupt event
  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
  2022-12-21 10:50 ` [PATCH 4/4] crypto/cnxk: add error interrupt event query handler Srujana Challa
  2 siblings, 0 replies; 8+ messages in thread
From: Srujana Challa @ 2022-12-21 10:50 UTC (permalink / raw)
  To: gakhil, fanzhang.oss
  Cc: dev, ndabilpuram, kirankumark, skori, anoobj, ktejasree

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/4] crypto/cnxk: add error interrupt event query handler
  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 ` [PATCH 3/4] cryptodev: introduce query API for error interrupt event Srujana Challa
@ 2022-12-21 10:50 ` Srujana Challa
  2 siblings, 0 replies; 8+ messages in thread
From: Srujana Challa @ 2022-12-21 10:50 UTC (permalink / raw)
  To: gakhil, fanzhang.oss
  Cc: dev, ndabilpuram, kirankumark, skori, anoobj, ktejasree

Adds RTE_CRYPTODEV_EVENT_ERROR query handler for cn9k/cn10k PMD.
The query handler finds the next queue pair ID with pending error
interrupt event if any, starting from the given queue pair index,
for the device.

Signed-off-by: Srujana Challa <schalla@marvell.com>
---
 drivers/common/cnxk/roc_cpt.c             |  4 +++-
 drivers/common/cnxk/roc_cpt.h             |  1 +
 drivers/crypto/cnxk/cn10k_cryptodev_ops.c |  1 +
 drivers/crypto/cnxk/cn9k_cryptodev_ops.c  |  1 +
 drivers/crypto/cnxk/cnxk_cryptodev_ops.c  | 15 +++++++++++++++
 drivers/crypto/cnxk/cnxk_cryptodev_ops.h  |  1 +
 6 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index 553a5a2c80..3d90260b96 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -63,8 +63,10 @@ cpt_lf_misc_irq(void *param)
 	/* Clear interrupt */
 	plt_write64(intr, lf->rbase + CPT_LF_MISC_INT);
 
-	if (int_cb.cb != NULL)
+	if (int_cb.cb != NULL) {
+		lf->error_event_pending = 1;
 		int_cb.cb(lf, int_cb.cb_args);
+	}
 }
 
 static int
diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h
index ac8be1b475..e9ce4cb831 100644
--- a/drivers/common/cnxk/roc_cpt.h
+++ b/drivers/common/cnxk/roc_cpt.h
@@ -119,6 +119,7 @@ struct roc_cpt_lf {
 	uint64_t io_addr;
 	uint8_t *iq_vaddr;
 	struct roc_nix *inl_outb_nix;
+	uint8_t error_event_pending;
 } __plt_cache_aligned;
 
 struct roc_cpt {
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 7dad370047..009d26d433 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -1082,4 +1082,5 @@ struct rte_cryptodev_ops cn10k_cpt_ops = {
 
 	/* Event crypto ops */
 	.session_ev_mdata_set = cn10k_cpt_crypto_adapter_ev_mdata_set,
+	.queue_pair_event_error_query = cnxk_cpt_queue_pair_event_error_query,
 };
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index 04c004bc7a..a86d45a40c 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -759,5 +759,6 @@ struct rte_cryptodev_ops cn9k_cpt_ops = {
 
 	/* Event crypto ops */
 	.session_ev_mdata_set = cn9k_cpt_crypto_adapter_ev_mdata_set,
+	.queue_pair_event_error_query = cnxk_cpt_queue_pair_event_error_query,
 
 };
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index 91c7a686c2..d8cbe5cd74 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -806,3 +806,18 @@ cnxk_cpt_dump_on_err(struct cnxk_cpt_qp *qp)
 	plt_print("");
 	roc_cpt_afs_print(qp->lf.roc_cpt);
 }
+
+int
+cnxk_cpt_queue_pair_event_error_query(struct rte_cryptodev *dev, uint16_t qp_id)
+{
+	struct cnxk_cpt_vf *vf = dev->data->dev_private;
+	struct roc_cpt *roc_cpt = &vf->cpt;
+	struct roc_cpt_lf *lf;
+
+	lf = roc_cpt->lf[qp_id];
+	if (lf && lf->error_event_pending) {
+		lf->error_event_pending = 0;
+		return 1;
+	}
+	return 0;
+}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index 13c90444d6..2b25cfe1c4 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -128,6 +128,7 @@ int cnxk_ae_session_cfg(struct rte_cryptodev *dev,
 			struct rte_crypto_asym_xform *xform,
 			struct rte_cryptodev_asym_session *sess);
 void cnxk_cpt_dump_on_err(struct cnxk_cpt_qp *qp);
+int cnxk_cpt_queue_pair_event_error_query(struct rte_cryptodev *dev, uint16_t qp_id);
 
 static __rte_always_inline void
 pending_queue_advance(uint64_t *index, const uint64_t mask)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 4/4] crypto/cnxk: add error interrupt event query handler
  2023-01-31  6:42     ` Srujana Challa
@ 2023-01-31  8:08       ` Akhil Goyal
  0 siblings, 0 replies; 8+ messages in thread
From: Akhil Goyal @ 2023-01-31  8:08 UTC (permalink / raw)
  To: Srujana Challa, fanzhang.oss
  Cc: dev, Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
	Sunil Kumar Kori, Anoob Joseph, Tejasree Kondoj

> Subject: RE: [PATCH 4/4] crypto/cnxk: add error interrupt event query handler
> 
> Hi Akhil,
> 
> Please find the correct description inline,
> 
> Thanks,
> Srujana.
> 
> > > Subject: [PATCH 4/4] crypto/cnxk: add error interrupt event query
> > > handler
> > >
> > > Adds RTE_CRYPTODEV_EVENT_ERROR query handler for cn9k/cn10k PMD.
> > > The query handler finds the next queue pair ID with pending error
> > > interrupt event if any, starting from the given queue pair index, for
> > > the device.
> > >
> > > Signed-off-by: Srujana Challa <schalla@marvell.com>
> > The patch description do not match with the API added.
> > Can you please update it?
> >
> Adds RTE_CRYPTODEV_EVENT_ERROR query handler for cn9k/cn10k PMD.
> The query handler returns pending error interrupt event status
> for the given queue pair ID.

Series Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto
Updated the description of this patch.

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 4/4] crypto/cnxk: add error interrupt event query handler
  2023-01-30 19:18   ` Akhil Goyal
@ 2023-01-31  6:42     ` Srujana Challa
  2023-01-31  8:08       ` Akhil Goyal
  0 siblings, 1 reply; 8+ messages in thread
From: Srujana Challa @ 2023-01-31  6:42 UTC (permalink / raw)
  To: Akhil Goyal, fanzhang.oss
  Cc: dev, Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
	Sunil Kumar Kori, Anoob Joseph, Tejasree Kondoj

Hi Akhil,

Please find the correct description inline,

Thanks,
Srujana.

> > Subject: [PATCH 4/4] crypto/cnxk: add error interrupt event query
> > handler
> >
> > Adds RTE_CRYPTODEV_EVENT_ERROR query handler for cn9k/cn10k PMD.
> > The query handler finds the next queue pair ID with pending error
> > interrupt event if any, starting from the given queue pair index, for
> > the device.
> >
> > Signed-off-by: Srujana Challa <schalla@marvell.com>
> The patch description do not match with the API added.
> Can you please update it?
>
Adds RTE_CRYPTODEV_EVENT_ERROR query handler for cn9k/cn10k PMD.
The query handler returns pending error interrupt event status
for the given queue pair ID.
> Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH 4/4] crypto/cnxk: add error interrupt event query handler
  2022-12-21 13:21 ` [PATCH 4/4] crypto/cnxk: add error interrupt event query handler Srujana Challa
@ 2023-01-30 19:18   ` Akhil Goyal
  2023-01-31  6:42     ` Srujana Challa
  0 siblings, 1 reply; 8+ messages in thread
From: Akhil Goyal @ 2023-01-30 19:18 UTC (permalink / raw)
  To: Srujana Challa, fanzhang.oss
  Cc: dev, Nithin Kumar Dabilpuram, Kiran Kumar Kokkilagadda,
	Sunil Kumar Kori, Anoob Joseph, Tejasree Kondoj

> Subject: [PATCH 4/4] crypto/cnxk: add error interrupt event query handler
> 
> Adds RTE_CRYPTODEV_EVENT_ERROR query handler for cn9k/cn10k PMD.
> The query handler finds the next queue pair ID with pending error
> interrupt event if any, starting from the given queue pair index,
> for the device.
> 
> Signed-off-by: Srujana Challa <schalla@marvell.com>
The patch description do not match with the API added.
Can you please update it?

Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/4] crypto/cnxk: add error interrupt event query handler
  2022-12-21 13:21 [PATCH 1/4] common/cnxk: add CPT HW error callback register functions Srujana Challa
@ 2022-12-21 13:21 ` Srujana Challa
  2023-01-30 19:18   ` Akhil Goyal
  0 siblings, 1 reply; 8+ messages in thread
From: Srujana Challa @ 2022-12-21 13:21 UTC (permalink / raw)
  To: gakhil, fanzhang.oss
  Cc: dev, ndabilpuram, kirankumark, skori, anoobj, ktejasree

Adds RTE_CRYPTODEV_EVENT_ERROR query handler for cn9k/cn10k PMD.
The query handler finds the next queue pair ID with pending error
interrupt event if any, starting from the given queue pair index,
for the device.

Signed-off-by: Srujana Challa <schalla@marvell.com>
---
 drivers/common/cnxk/roc_cpt.c             |  4 +++-
 drivers/common/cnxk/roc_cpt.h             |  1 +
 drivers/crypto/cnxk/cn10k_cryptodev_ops.c |  1 +
 drivers/crypto/cnxk/cn9k_cryptodev_ops.c  |  1 +
 drivers/crypto/cnxk/cnxk_cryptodev_ops.c  | 15 +++++++++++++++
 drivers/crypto/cnxk/cnxk_cryptodev_ops.h  |  1 +
 6 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index bf0d1cff9c..fd7a40d6e4 100644
--- a/drivers/common/cnxk/roc_cpt.c
+++ b/drivers/common/cnxk/roc_cpt.c
@@ -63,8 +63,10 @@ cpt_lf_misc_irq(void *param)
 	/* Clear interrupt */
 	plt_write64(intr, lf->rbase + CPT_LF_MISC_INT);
 
-	if (int_cb.cb != NULL)
+	if (int_cb.cb != NULL) {
+		lf->error_event_pending = 1;
 		int_cb.cb(lf, int_cb.cb_args);
+	}
 }
 
 static int
diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h
index ac8be1b475..e9ce4cb831 100644
--- a/drivers/common/cnxk/roc_cpt.h
+++ b/drivers/common/cnxk/roc_cpt.h
@@ -119,6 +119,7 @@ struct roc_cpt_lf {
 	uint64_t io_addr;
 	uint8_t *iq_vaddr;
 	struct roc_nix *inl_outb_nix;
+	uint8_t error_event_pending;
 } __plt_cache_aligned;
 
 struct roc_cpt {
diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 7dad370047..009d26d433 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -1082,4 +1082,5 @@ struct rte_cryptodev_ops cn10k_cpt_ops = {
 
 	/* Event crypto ops */
 	.session_ev_mdata_set = cn10k_cpt_crypto_adapter_ev_mdata_set,
+	.queue_pair_event_error_query = cnxk_cpt_queue_pair_event_error_query,
 };
diff --git a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
index 04c004bc7a..a86d45a40c 100644
--- a/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn9k_cryptodev_ops.c
@@ -759,5 +759,6 @@ struct rte_cryptodev_ops cn9k_cpt_ops = {
 
 	/* Event crypto ops */
 	.session_ev_mdata_set = cn9k_cpt_crypto_adapter_ev_mdata_set,
+	.queue_pair_event_error_query = cnxk_cpt_queue_pair_event_error_query,
 
 };
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
index 91c7a686c2..d8cbe5cd74 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c
@@ -806,3 +806,18 @@ cnxk_cpt_dump_on_err(struct cnxk_cpt_qp *qp)
 	plt_print("");
 	roc_cpt_afs_print(qp->lf.roc_cpt);
 }
+
+int
+cnxk_cpt_queue_pair_event_error_query(struct rte_cryptodev *dev, uint16_t qp_id)
+{
+	struct cnxk_cpt_vf *vf = dev->data->dev_private;
+	struct roc_cpt *roc_cpt = &vf->cpt;
+	struct roc_cpt_lf *lf;
+
+	lf = roc_cpt->lf[qp_id];
+	if (lf && lf->error_event_pending) {
+		lf->error_event_pending = 0;
+		return 1;
+	}
+	return 0;
+}
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
index 13c90444d6..2b25cfe1c4 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.h
@@ -128,6 +128,7 @@ int cnxk_ae_session_cfg(struct rte_cryptodev *dev,
 			struct rte_crypto_asym_xform *xform,
 			struct rte_cryptodev_asym_session *sess);
 void cnxk_cpt_dump_on_err(struct cnxk_cpt_qp *qp);
+int cnxk_cpt_queue_pair_event_error_query(struct rte_cryptodev *dev, uint16_t qp_id);
 
 static __rte_always_inline void
 pending_queue_advance(uint64_t *index, const uint64_t mask)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-01-31  8:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 3/4] cryptodev: introduce query API for error interrupt event Srujana Challa
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 4/4] crypto/cnxk: add error interrupt event query handler Srujana Challa
2023-01-30 19:18   ` Akhil Goyal
2023-01-31  6:42     ` Srujana Challa
2023-01-31  8:08       ` Akhil Goyal

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).