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 2/4] crypto/cnxk: add callback to report CPT HW error
Date: Wed, 21 Dec 2022 16:20:05 +0530	[thread overview]
Message-ID: <20221221105007.2667292-2-schalla@marvell.com> (raw)
In-Reply-To: <20221221105007.2667292-1-schalla@marvell.com>

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


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

Thread overview: 5+ 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 ` Srujana Challa [this message]
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 2/4] crypto/cnxk: add callback to report CPT HW error Srujana Challa

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