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] common/cnxk: add roc npa init callback support
Date: Thu, 28 Oct 2021 23:20:46 +0200 [thread overview]
Message-ID: <20211028212046.2452092-1-vfialko@marvell.com> (raw)
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
reply other threads:[~2021-10-28 21:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20211028212046.2452092-1-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).