[4/4] crypto/cnxk: add error interrupt event query handler

Message ID 20221221132142.2732040-4-schalla@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [1/4] common/cnxk: add CPT HW error callback register functions |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS

Commit Message

Srujana Challa Dec. 21, 2022, 1:21 p.m. UTC
  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(-)
  

Comments

Akhil Goyal Jan. 30, 2023, 7:18 p.m. UTC | #1
> 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.
  
Srujana Challa Jan. 31, 2023, 6:42 a.m. UTC | #2
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.
  
Akhil Goyal Jan. 31, 2023, 8:08 a.m. UTC | #3
> 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.
  

Patch

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)