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 1/4] common/cnxk: add CPT HW error callback register functions
Date: Wed, 21 Dec 2022 18:51:39 +0530	[thread overview]
Message-ID: <20221221132142.2732040-1-schalla@marvell.com> (raw)

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   | 31 +++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_cpt.h   |  8 +++++++-
 drivers/common/cnxk/version.map |  2 ++
 3 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c
index fb97ec89b2..bf0d1cff9c 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,26 @@ 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;
+}
+
+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


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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 13:21 Srujana Challa [this message]
2022-12-21 13:21 ` [PATCH 2/4] crypto/cnxk: add callback to report CPT HW error 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
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
  -- strict thread matches above, loose matches on Subject: below --
2022-12-21 10:50 [PATCH 1/4] common/cnxk: add CPT HW error callback register functions 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=20221221132142.2732040-1-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).