DPDK patches and discussions
 help / color / mirror / Atom feed
From: Volodymyr Fialko <vfialko@marvell.com>
To: <dev@dpdk.org>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>, Ray Kinsella <mdr@ashroe.eu>
Cc: <jerinj@marvell.com>, Volodymyr Fialko <vfialko@marvell.com>
Subject: [dpdk-dev] [PATCH 2/3] common/cnxk: add roc npa init callback support
Date: Fri, 29 Oct 2021 00:14:45 +0200	[thread overview]
Message-ID: <20211028221446.2455303-3-vfialko@marvell.com> (raw)
In-Reply-To: <20211028221446.2455303-1-vfialko@marvell.com>

Add support for registering callback for roc npa init

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
---
 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 a0d2cc8f19..f16950e611 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)
@@ -694,6 +706,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 d9ad940ce7..ffa030a41f 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -285,6 +285,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


  parent reply	other threads:[~2021-10-28 22:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 22:14 [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Volodymyr Fialko
2021-10-28 22:14 ` [dpdk-dev] [PATCH 1/3] mempool/cnxk: " Volodymyr Fialko
2021-10-28 22:14 ` Volodymyr Fialko [this message]
2021-10-28 22:14 ` [dpdk-dev] [PATCH 3/3] mempool/cnxk: parse max pools during npa initialization Volodymyr Fialko
2021-10-29 14:18 ` [dpdk-dev] [PATCH 0/3] fix max pools argument parsing Jerin Jacob

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=20211028221446.2455303-3-vfialko@marvell.com \
    --to=vfialko@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=mdr@ashroe.eu \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@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).