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 739A84588C; Tue, 3 Sep 2024 03:42:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1DF940E36; Tue, 3 Sep 2024 03:42:17 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2099.outbound.protection.outlook.com [40.107.100.99]) by mails.dpdk.org (Postfix) with ESMTP id 53F10402C0 for ; Tue, 3 Sep 2024 03:42:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fla5mFX7ywC2yVsWHFKnkejTrlXeAQY1ggxP5cv/KDFDlMf5kPBx6DKOm7/5ROXrZHMl56yCXhbpgKk63DgpdDMUmAvjs1pGEgt4/oFFlp7y09wU3/8PdNV8wz/E43VI5mmF413Tboj67i0K5HhrqU/L8OsGQlCX+Jt94iyUx7DgJrQ1/JeHshwTC0ALHqCRfbO61saKaLqWmQSaF/5QywDhnF8/IMn5JQeg6lvhYsSOmwZF7GITDxn2XCJKQBgWfbI6Qa4idUaugbUkQ/F0ai3Ki1W4yhyIPHEedAiRdCwUj2jps65DbjlIYeqp3Tc4nkddVgaodR3Pxvetzx9b7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rzxrQ1zu8IoxE+kkztlv7JSPrXZQD18C/En0KDXKYhw=; b=CKuYEAYLQkTmTWzHWF5vazXlMM6Lncob3sEjSAgmPaxovTATrRZ995GYoYo4NLrbgazOYbuZo8s7PRcIgM8d1Pst1H2QQZWi8uZeY9FiyJOg4pHWQNj9Lx/v3Ul6caUtaXg9CtXR9HTgFrBfju4Ag6RsSr+SNdb2F04gPutBb0liVewT8jQBcSS6l0ZjWRcpDvSmAcTPR9Ta47K3iFkNQkaGhPhttcWgtpeI+Gqz52pJccJFalJ31N4eZv/NXq0i/5J5VGOKPRZ6X3ktviX3IwtgrfckmbfJvWaD7mW9ckeYSaf+FPtC5Tm5ykCrcwWAAAiugNmQAHK7tjaj4EsDcw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rzxrQ1zu8IoxE+kkztlv7JSPrXZQD18C/En0KDXKYhw=; b=FjyHXH0QtwXWAVW6L4BarBVmDC/PnjFDOuigs42FajJkl6iikpi/2KhyWdbp7GqlHzvlHrrhsK9eRcoAwjlA8phrt5FEX+n0+AJyyrG3FPjR5yeyRGGO1L19mdmuPUgkHXFE04KKH4udPh6YuI6pWJBsK2tsYud11fD7UL4TU/Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by DM8PR13MB5093.namprd13.prod.outlook.com (2603:10b6:8:20::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 01:42:11 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7918.020; Tue, 3 Sep 2024 01:42:11 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu Subject: [PATCH 3/4] net/nfp: support different configuration BAR size Date: Tue, 3 Sep 2024 09:41:44 +0800 Message-Id: <20240903014145.2635710-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240903014145.2635710-1-chaoyong.he@corigine.com> References: <20240903014145.2635710-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR05CA0176.namprd05.prod.outlook.com (2603:10b6:a03:339::31) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM8PR13MB5093:EE_ X-MS-Office365-Filtering-Correlation-Id: 646d41b4-323d-4886-5d19-08dccbb9a143 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?9BLzOHpHUKK4WsPvt6E8SxS2kCuLKd8o6LjNvjt97A9rAWTYZbJwpXWgBd1u?= =?us-ascii?Q?hPY975XRRoY4rmq1iwPEJdTw7Vg+79i2jMmyCgyehY+1PqV+oNvHC1n4sXUN?= =?us-ascii?Q?TqOJU5E6YSORVp8kxlDrjJlgPC/RUvVwFn+tSu3saOR1UmVJHtKU6TvZPQsz?= =?us-ascii?Q?lyi6efKQChFW/cvYYx1UAEQ6xoFwoTinA2m3SIohE4ndQSIo5mxSMZjY1MXv?= =?us-ascii?Q?dFm906ve5vUxpL/LWaumna/hfqZ117VSUwlZ9HZGwZ6K7a9SvjPiPXLi811Y?= =?us-ascii?Q?PFhlAyWeAHTjYsOZIdF8nM+yZydJEGNCbp4lK79LUrbsE1uzDlFHUlvlGuzW?= =?us-ascii?Q?1XwL1Ig///chS4HiVuTz0KqYEiNfYg7CfbX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eWYjCijtWA7KnlUkW0J5aCy7nIKeJgF7mCoW9MxUPwClfY453MhQ?= =?us-ascii?Q?/1TMEpZMP20VjC5S/umkaoCDxSHAN7SAboTN7kLIKTXV+Rbj0Zh6c48sFcRR?= =?us-ascii?Q?TWUu38oZRcf2awa97D47taQq8OjjEC713Y9ueQdpok8zl13t0A=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NzKpIExIur8AKDEbygwzdu3dB/238vyHg5aZMFtlPezZ2LqvcSU2EYsNximt?= =?us-ascii?Q?+eBy4SHdKuoIhnRcR3DBOvxh+w1doukEvL9dvTkryKhZW+SsWKmK3nO+zO8D?= =?us-ascii?Q?/PYVE10F5gbNFMo6QH+VV6qHA28MJaZaLKzZeSJLlSbaeLWL/hWS7qdtLI9c?= =?us-ascii?Q?GrVlUBaN2Hcy/uLl+HDyH/GSAJjhip+p9TR5StH/WfM48XLXn6HdJ+5aPZnF?= =?us-ascii?Q?j30YHaQfcTR+S2T1tRhGUtlDJG+6ko4/NtLoCQmu0FW6+GGlYOCNm/V5K8EN?= =?us-ascii?Q?UqwskUTHAF+2KKh8tYbJ4FioIfhWCVwx5/pd3Z5nboNoD98hEe+zmnnn1OWP?= =?us-ascii?Q?I0h53Oak2wDqt8xMsJ6kICN4xULDZqPpQzDaWPtKgmGg28WH9hpXRk307kTD?= =?us-ascii?Q?S6Kp1j4NP9WASjmK3inzCA0ptHImO+y3ohFzg2vMEiDVnvanx4hK8m7avjtL?= =?us-ascii?Q?AKdnpfSOFLXJsYNFWSfK8NolbemyP63K19EPCDT1HCa+rdLsAgdFm/s1V+zw?=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3pPnikTx2oDoH7Av209/rXE+mnciUDq?= =?us-ascii?Q?loMqvEa+wBNJp4V3noH9BVtzsTz1KJcIPvdbbMFA1xrLqu9Fle7A/Hud1T5t?= =?us-ascii?Q?DA4lfuiYED4CmMYxRT1RvHbeo+lu/lZwDKDDQuq5n+ELKXm6RANoFzDB5Wtr?= =?us-ascii?Q?DWlRJjraNZF6mA6emI1sabNaiaS9abbEmq9IOqRSrfIBukTYgJ62OV0JOIvv?= =?us-ascii?Q?3w=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 646d41b4-323d-4886-5d19-08dccbb9a143 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 01:42:11.7608 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QB/MhElgbcRgc8WgvSjd0R39pI9A+WRjo8XjjIQknzu2b404c4N1yR30SUV4l/Z2GvhRR+E+z3z5IDEOMplUvublg0/VPu9jVmXE3HafEoA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR13MB5093 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 A new NIC is introduced with different configuration BAR size other than 32K, and this is distinguished by the application firmware's class version ABI. Signed-off-by: Chaoyong He Reviewed-by: Long Wu --- drivers/common/nfp/nfp_common_ctrl.h | 10 +++++++++- drivers/net/nfp/flower/nfp_flower.c | 4 ++-- drivers/net/nfp/nfp_ethdev.c | 24 ++++++++++++++---------- drivers/net/nfp/nfp_ethdev_vf.c | 3 +++ drivers/net/nfp/nfp_net_common.c | 25 +++++++++++++++++++++++++ drivers/net/nfp/nfp_net_common.h | 3 +++ drivers/net/nfp/nfp_net_ctrl.c | 4 +++- 7 files changed, 59 insertions(+), 14 deletions(-) diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h index 69596dd6f5..711577dc76 100644 --- a/drivers/common/nfp/nfp_common_ctrl.h +++ b/drivers/common/nfp/nfp_common_ctrl.h @@ -11,7 +11,9 @@ * * On the NFP6000, due to THB-350, the configuration BAR is 32K in size. */ -#define NFP_NET_CFG_BAR_SZ (32 * 1024) +#define NFP_NET_CFG_BAR_SZ_32K (32 * 1024) +#define NFP_NET_CFG_BAR_SZ_8K (8 * 1024) +#define NFP_NET_CFG_BAR_SZ_MIN NFP_NET_CFG_BAR_SZ_8K /* * Configuration sriov VF. @@ -121,6 +123,10 @@ struct nfp_net_fw_ver { uint8_t minor; uint8_t major; + /** + * BIT0: class, refer NFP_NET_CFG_VERSION_CLASS_* + * BIT[7:1]: reserved + */ uint8_t class; /** * This byte can be extended for more use. @@ -147,6 +153,8 @@ struct nfp_net_fw_ver { #define NFP_NET_CFG_VERSION 0x0030 #define NFP_NET_CFG_VERSION_DP_NFD3 0 #define NFP_NET_CFG_VERSION_DP_NFDK 1 +#define NFP_NET_CFG_VERSION_CLASS_GENERIC 0 +#define NFP_NET_CFG_VERSION_CLASS_NO_EMEM 1 #define NFP_NET_CFG_STS 0x0034 #define NFP_NET_CFG_STS_LINK (0x1 << 0) /* Link up or down */ /* Link rate */ diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 4d91d548f7..c1a3532c11 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -692,7 +692,7 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) /* Map the PF ctrl bar */ snprintf(bar_name, sizeof(bar_name), "_pf%u_net_bar0", id); pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, bar_name, - NFP_NET_CFG_BAR_SZ, &pf_dev->ctrl_area); + pf_dev->ctrl_bar_size, &pf_dev->ctrl_area); if (pf_dev->ctrl_bar == NULL) { PMD_INIT_LOG(ERR, "Cloud not map the PF vNIC ctrl bar"); ret = -ENODEV; @@ -737,7 +737,7 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) /* Map the ctrl vNIC ctrl bar */ snprintf(ctrl_name, sizeof(ctrl_name), "_pf%u_net_ctrl_bar", id); ctrl_hw->super.ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, ctrl_name, - NFP_NET_CFG_BAR_SZ, &ctrl_hw->ctrl_area); + pf_dev->ctrl_bar_size, &ctrl_hw->ctrl_area); if (ctrl_hw->super.ctrl_bar == NULL) { PMD_INIT_LOG(ERR, "Cloud not map the ctrl vNIC ctrl bar"); ret = -ENODEV; diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index d85993f70c..a09bbe52ca 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1022,7 +1022,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev, if (pf_dev->multi_pf.enabled) hw->ctrl_bar = pf_dev->ctrl_bar; else - hw->ctrl_bar = pf_dev->ctrl_bar + (port * NFP_NET_CFG_BAR_SZ); + hw->ctrl_bar = pf_dev->ctrl_bar + (port * pf_dev->ctrl_bar_size); net_hw->mac_stats = pf_dev->mac_stats_bar + (net_hw->nfp_idx * NFP_MAC_STATS_SIZE); @@ -1555,9 +1555,10 @@ nfp_enable_multi_pf(struct nfp_pf_dev *pf_dev) memset(&net_hw, 0, sizeof(struct nfp_net_hw)); /* Map the symbol table */ + pf_dev->ctrl_bar_size = NFP_NET_CFG_BAR_SZ_MIN; snprintf(name, sizeof(name), "_pf%u_net_bar0", pf_dev->multi_pf.function_id); - ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, name, NFP_NET_CFG_BAR_SZ, + ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, name, pf_dev->ctrl_bar_size, &area); if (ctrl_bar == NULL) { PMD_INIT_LOG(ERR, "Failed to find data vNIC memory symbol"); @@ -1574,6 +1575,9 @@ nfp_enable_multi_pf(struct nfp_pf_dev *pf_dev) goto end; } + /* Set the ctrl bar size */ + nfp_net_ctrl_bar_size_set(pf_dev); + if (!pf_dev->multi_pf.enabled) goto end; @@ -1670,7 +1674,7 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) /* Map the symbol table */ snprintf(bar_name, sizeof(bar_name), "_pf%u_net_bar0", id); pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, bar_name, - pf_dev->total_phyports * NFP_NET_CFG_BAR_SZ, + pf_dev->total_phyports * pf_dev->ctrl_bar_size, &pf_dev->ctrl_area); if (pf_dev->ctrl_bar == NULL) { PMD_INIT_LOG(ERR, "nfp_rtsym_map fails for %s", bar_name); @@ -2065,11 +2069,11 @@ nfp_net_vf_config_init(struct nfp_pf_dev *pf_dev) if (pf_dev->sriov_vf == 0) return 0; - min_size = NFP_NET_CFG_BAR_SZ * pf_dev->sriov_vf; + min_size = pf_dev->ctrl_bar_size * pf_dev->sriov_vf; snprintf(vf_bar_name, sizeof(vf_bar_name), "_pf%d_net_vf_bar", pf_dev->multi_pf.function_id); pf_dev->vf_bar = nfp_rtsym_map_offset(pf_dev->sym_tbl, vf_bar_name, - NFP_NET_CFG_BAR_SZ * pf_dev->vf_base_id, + pf_dev->ctrl_bar_size * pf_dev->vf_base_id, min_size, &pf_dev->vf_area); if (pf_dev->vf_bar == NULL) { PMD_INIT_LOG(ERR, "Failed to get vf cfg."); @@ -2295,15 +2299,15 @@ nfp_pf_init(struct rte_pci_device *pci_dev) goto hwqueues_cleanup; } + ret = nfp_enable_multi_pf(pf_dev); + if (ret != 0) + goto mac_stats_cleanup; + ret = nfp_net_vf_config_init(pf_dev); if (ret != 0) { PMD_INIT_LOG(ERR, "Failed to init VF config."); - goto mac_stats_cleanup; - } - - ret = nfp_enable_multi_pf(pf_dev); - if (ret != 0) goto vf_cfg_tbl_cleanup; + } hw_priv->is_pf = true; hw_priv->pf_dev = pf_dev; diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 2e581c7e45..ab413a2c5a 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -295,6 +295,9 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) goto pf_dev_free; } + /* Set the ctrl bar size */ + nfp_net_ctrl_bar_size_set(pf_dev); + PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar); err = nfp_net_common_init(pf_dev, net_hw); diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index e4e01d8c79..5f92c2c31d 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -2184,6 +2184,9 @@ nfp_net_version_check(struct nfp_hw *hw, if (!nfp_net_is_valid_nfd_version(pf_dev->ver)) return false; + if (!nfp_net_is_valid_version_class(pf_dev->ver)) + return false; + return true; } @@ -2325,6 +2328,28 @@ nfp_net_is_valid_nfd_version(struct nfp_net_fw_ver version) return false; } +bool +nfp_net_is_valid_version_class(struct nfp_net_fw_ver version) +{ + switch (version.class) { + case NFP_NET_CFG_VERSION_CLASS_GENERIC: + return true; + case NFP_NET_CFG_VERSION_CLASS_NO_EMEM: + return true; + default: + return false; + } +} + +void +nfp_net_ctrl_bar_size_set(struct nfp_pf_dev *pf_dev) +{ + if (pf_dev->ver.class == NFP_NET_CFG_VERSION_CLASS_GENERIC) + pf_dev->ctrl_bar_size = NFP_NET_CFG_BAR_SZ_32K; + else + pf_dev->ctrl_bar_size = NFP_NET_CFG_BAR_SZ_8K; +} + /* Disable rx and tx functions to allow for reconfiguring. */ int nfp_net_stop(struct rte_eth_dev *dev) diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 8d0922d48c..2c54815fc9 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -117,6 +117,7 @@ struct nfp_pf_dev { struct nfp_eth_table *nfp_eth_table; uint8_t *ctrl_bar; + uint32_t ctrl_bar_size; struct nfp_cpp *cpp; struct nfp_cpp_area *ctrl_area; @@ -353,6 +354,7 @@ void nfp_net_tx_desc_limits(struct nfp_net_hw_priv *hw_priv, int nfp_net_check_dma_mask(struct nfp_pf_dev *pf_dev, char *name); int nfp_net_firmware_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size); bool nfp_net_is_valid_nfd_version(struct nfp_net_fw_ver version); +bool nfp_net_is_valid_version_class(struct nfp_net_fw_ver version); struct nfp_net_hw *nfp_net_get_hw(const struct rte_eth_dev *dev); int nfp_net_stop(struct rte_eth_dev *dev); int nfp_net_flow_ctrl_get(struct rte_eth_dev *dev, @@ -379,6 +381,7 @@ int nfp_net_vf_config_app_init(struct nfp_net_hw *net_hw, struct nfp_pf_dev *pf_dev); bool nfp_net_version_check(struct nfp_hw *hw, struct nfp_pf_dev *pf_dev); +void nfp_net_ctrl_bar_size_set(struct nfp_pf_dev *pf_dev); #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\ ((struct nfp_app_fw_nic *)app_fw_priv) diff --git a/drivers/net/nfp/nfp_net_ctrl.c b/drivers/net/nfp/nfp_net_ctrl.c index ea14b98924..b34d8f140f 100644 --- a/drivers/net/nfp/nfp_net_ctrl.c +++ b/drivers/net/nfp/nfp_net_ctrl.c @@ -30,13 +30,15 @@ nfp_net_tlv_caps_parse(struct rte_eth_dev *dev) uint32_t tlv_type; struct nfp_net_hw *net_hw; struct nfp_net_tlv_caps *caps; + struct nfp_net_hw_priv *hw_priv; net_hw = dev->data->dev_private; + hw_priv = dev->process_private; caps = &net_hw->tlv_caps; nfp_net_tlv_caps_reset(caps); data = net_hw->super.ctrl_bar + NFP_NET_CFG_TLV_BASE; - end = net_hw->super.ctrl_bar + NFP_NET_CFG_BAR_SZ; + end = net_hw->super.ctrl_bar + hw_priv->pf_dev->ctrl_bar_size; hdr = rte_read32(data); if (hdr == 0) { -- 2.39.1