common/cnxk: support ROC NPA init callback

Add support for registering callback for ROC NPA init.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Volodymyr Fialko 2021-10-29 00:14:45 +02:00 committed by Jerin Jacob
parent c52dd15813
commit 80e1239e77
3 changed files with 23 additions and 0 deletions

View File

@ -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;

View File

@ -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);

View File

@ -275,6 +275,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;