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 2B92DA0547; Fri, 5 Mar 2021 14:42:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F8AB22A3AC; Fri, 5 Mar 2021 14:40:21 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E115F22A3AB for ; Fri, 5 Mar 2021 14:40:19 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 125DV4uR018501 for ; Fri, 5 Mar 2021 05:40:19 -0800 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-type; s=pfpt0220; bh=xpMzuja2cY7KxEkgUMSBp3hD8FY5jqRS/4MWecB5E0o=; b=cYEigj+jjrMpwQD7yPs326slC+uDI4GgwpRwmE91fKsHmvC/jt9wLAZVfAetWxUBFOUL WFsWiPSFeur0d2+rNq0yy7aDLD+zElWeH5gjC0sJHSw8o3BimsYyJU8tUXNjWb4RF7NG kwyx0V1rDSAXYiSYwvP48sx9JX+cw1wEd9ZR5uyzIMrHU5KANf5soTL1NGnVIjtMXjoe vzqFLfko8vJ8MlNzcb/Vt/gBdis+DmDcaIGNn91owoMla5Hnl041K61liwhV5vw7q7xa cs8LtAR5Pf/wVacQ4sVLgcjFEtSEzp/3fr4rIPlbgN0XBJ5KRAwP+G+EgEGTbg++HdE6 iA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 372s2umrmx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 05 Mar 2021 05:40:19 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Mar 2021 05:40:17 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Mar 2021 05:40:17 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 5 Mar 2021 05:40:17 -0800 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id A3E183F7043; Fri, 5 Mar 2021 05:40:14 -0800 (PST) From: Nithin Dabilpuram To: CC: , , , , , , Date: Fri, 5 Mar 2021 19:08:42 +0530 Message-ID: <20210305133918.8005-17-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210305133918.8005-1-ndabilpuram@marvell.com> References: <20210305133918.8005-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-05_08:2021-03-03, 2021-03-05 signatures=0 Subject: [dpdk-dev] [PATCH 16/52] common/cnxk: add npa lf init/fini 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" From: Ashwin Sekhar T K Add support for npa lf init/fini callbacks. Signed-off-by: Ashwin Sekhar T K --- drivers/common/cnxk/roc_npa.c | 27 +++++++++++++++++++++++++++ drivers/common/cnxk/roc_npa.h | 8 ++++++++ drivers/common/cnxk/version.map | 2 ++ 3 files changed, 37 insertions(+) diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c index c4bcad7..4c45eef 100644 --- a/drivers/common/cnxk/roc_npa.c +++ b/drivers/common/cnxk/roc_npa.c @@ -5,6 +5,21 @@ #include "roc_api.h" #include "roc_priv.h" +static roc_npa_lf_init_cb_t npa_lf_init_cb; +static roc_npa_lf_fini_cb_t npa_lf_fini_cb; + +void +roc_npa_lf_init_cb_register(roc_npa_lf_init_cb_t cb) +{ + npa_lf_init_cb = cb; +} + +void +roc_npa_lf_fini_cb_register(roc_npa_lf_fini_cb_t cb) +{ + npa_lf_fini_cb = cb; +} + void roc_npa_aura_op_range_set(uint64_t aura_handle, uint64_t start_iova, uint64_t end_iova) @@ -717,11 +732,20 @@ npa_lf_init(struct dev *dev, struct plt_pci_device *pci_dev) if (rc) goto npa_fini; + if (npa_lf_init_cb) { + rc = npa_lf_init_cb(); + if (rc) + goto npa_irq_unregister; + } + plt_npa_dbg("npa=%p max_pools=%d pf_func=0x%x msix=0x%x", lf, roc_idev_npa_maxpools_get(), lf->pf_func, npa_msixoff); return 0; +npa_irq_unregister: + npa_unregister_irqs(idev->npa); + npa_fini: npa_dev_fini(idev->npa); npa_detach: @@ -750,6 +774,9 @@ npa_lf_fini(void) rc |= npa_detach(idev->npa->mbox); idev_set_defaults(idev); + if (npa_lf_fini_cb) + npa_lf_fini_cb(); + return rc; } diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h index ab0b135..4288708 100644 --- a/drivers/common/cnxk/roc_npa.h +++ b/drivers/common/cnxk/roc_npa.h @@ -16,6 +16,10 @@ */ #define ROC_CN9K_NPA_BULK_ALLOC_MAX_PTRS 30 +/* Callbacks that are called after NPA lf init/fini respectively */ +typedef int (*roc_npa_lf_init_cb_t)(void); +typedef void (*roc_npa_lf_fini_cb_t)(void); + /* * Generate 64bit handle to have optimized alloc and free aura operation. * 0 - ROC_AURA_ID_MASK for storing the aura_id. @@ -650,4 +654,8 @@ int __roc_api roc_npa_dump(void); /* Reset operation performance counter. */ int __roc_api roc_npa_pool_op_pc_reset(uint64_t aura_handle); +/* Callback registration */ +void __roc_api roc_npa_lf_init_cb_register(roc_npa_lf_init_cb_t cb); +void __roc_api roc_npa_lf_fini_cb_register(roc_npa_lf_fini_cb_t cb); + #endif /* _ROC_NPA_H_ */ diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 02dc3df..c5724d6 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -18,6 +18,8 @@ INTERNAL { roc_npa_dev_fini; roc_npa_dev_init; roc_npa_dump; + roc_npa_lf_fini_cb_register; + roc_npa_lf_init_cb_register; roc_npa_pool_create; roc_npa_pool_destroy; roc_npa_pool_op_pc_reset; -- 2.8.4