DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] common/cnxk: add roc npa init callback support
@ 2021-10-28 21:20 Volodymyr Fialko
  0 siblings, 0 replies; only message in thread
From: Volodymyr Fialko @ 2021-10-28 21:20 UTC (permalink / raw)
  To: dev, Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Rao, Ray Kinsella
  Cc: jerinj, Volodymyr Fialko

Add support for registering callback for roc npa init

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
Depends-on: series-20004 ("mempool/cnxk: fix max pools argument parsing")
 drivers/common/cnxk/roc_npa.c   | 18 ++++++++++++++++++
 drivers/common/cnxk/roc_npa.h   |  4 ++++
 drivers/common/cnxk/version.map |  1 +
 3 files changed, 23 insertions(+)

diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c
index cb32ee177f..eb24057bc6 100644
--- a/drivers/common/cnxk/roc_npa.c
+++ b/drivers/common/cnxk/roc_npa.c
@@ -5,6 +5,18 @@
 #include "roc_api.h"
 #include "roc_priv.h"
 
+static roc_npa_lf_init_cb_t lf_init_cb;
+
+int
+roc_npa_lf_init_cb_register(roc_npa_lf_init_cb_t cb)
+{
+	if (lf_init_cb != NULL)
+		return -EEXIST;
+
+	lf_init_cb = cb;
+	return 0;
+}
+
 void
 roc_npa_aura_op_range_set(uint64_t aura_handle, uint64_t start_iova,
 			  uint64_t end_iova)
@@ -695,6 +707,12 @@ npa_lf_init(struct dev *dev, struct plt_pci_device *pci_dev)
 	if (__atomic_fetch_add(&idev->npa_refcnt, 1, __ATOMIC_SEQ_CST) != 0)
 		return 0;
 
+	if (lf_init_cb) {
+		rc = (*lf_init_cb)(pci_dev);
+		if (rc)
+			goto fail;
+	}
+
 	rc = npa_attach(dev->mbox);
 	if (rc)
 		goto fail;
diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h
index 1cf50e5c4e..46350fdb48 100644
--- a/drivers/common/cnxk/roc_npa.h
+++ b/drivers/common/cnxk/roc_npa.h
@@ -648,6 +648,10 @@ void __roc_api roc_npa_aura_op_range_set(uint64_t aura_handle,
 					 uint64_t start_iova,
 					 uint64_t end_iova);
 
+/* Init callbacks */
+typedef int (*roc_npa_lf_init_cb_t)(struct plt_pci_device *pci_dev);
+int __roc_api roc_npa_lf_init_cb_register(roc_npa_lf_init_cb_t cb);
+
 /* Debug */
 int __roc_api roc_npa_ctx_dump(void);
 int __roc_api roc_npa_dump(void);
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index d1ab342ba7..7348e772cb 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -287,6 +287,7 @@ INTERNAL {
 	roc_npa_dev_fini;
 	roc_npa_dev_init;
 	roc_npa_dump;
+	roc_npa_lf_init_cb_register;
 	roc_npa_pool_create;
 	roc_npa_pool_destroy;
 	roc_npa_pool_op_pc_reset;
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-28 21:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 21:20 [dpdk-dev] [PATCH] common/cnxk: add roc npa init callback support Volodymyr Fialko

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