From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04D65A0547; Fri, 29 Oct 2021 00:15:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8CF4410FE; Fri, 29 Oct 2021 00:15:55 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 2A0CD40395 for ; Fri, 29 Oct 2021 00:15:55 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19SIi5YE027066; Thu, 28 Oct 2021 15:15:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=hKZpQQlQ7UV2pMWJNMzkpGWgmA5DG0FwcfWFYTYVfJw=; b=F+WhqaOzB7hrPHkxdloEKs1Z9qyLcqXbbyDtp0dc1WyaXz7Pb/whI+NrGBcMkQwaKAZM FQH3po2Fv3o2qJ6do6bEmXAuvoppC3WO5hPeYw91UCmf59zLkpbgDLBjFAsMGKe4HJIZ tEiW8UMEV804EyjKpsEGFl36CsjfRZGU+P57IZmSNlS+X6bwqMg2Bd6sUspE5ZuSpK7S KNnf3jwOakL4qyDy2Y2CIXZH8X7ZMWHdiB7YY9E02ZLBU1ZJJlzcdjbHQXwh0puxnK7C yaFNcSFiTtBlk2fY7eXecNn6Xvs+tfbE/ShPnilcAIN+Q7HEvcZK44qUoPFARcbf6ZLW BQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3byrpg3e5k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 28 Oct 2021 15:15:51 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 28 Oct 2021 15:15:50 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 28 Oct 2021 15:15:50 -0700 Received: from localhost.localdomain (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 2BD353F70C0; Thu, 28 Oct 2021 15:15:47 -0700 (PDT) From: Volodymyr Fialko To: , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella CC: , Volodymyr Fialko Date: Fri, 29 Oct 2021 00:14:45 +0200 Message-ID: <20211028221446.2455303-3-vfialko@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211028221446.2455303-1-vfialko@marvell.com> References: <20211028221446.2455303-1-vfialko@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: P_51YTFhoiRlDrXus-svPBzkWZ8KnMyI X-Proofpoint-GUID: P_51YTFhoiRlDrXus-svPBzkWZ8KnMyI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-28_06,2021-10-26_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH 2/3] common/cnxk: add roc npa init callback support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add support for registering callback for roc npa init Signed-off-by: Volodymyr Fialko Reviewed-by: Jerin Jacob --- 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