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 9A79E43EAA; Fri, 19 Apr 2024 07:25:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 797B340A6C; Fri, 19 Apr 2024 07:24:35 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2111.outbound.protection.outlook.com [40.107.237.111]) by mails.dpdk.org (Postfix) with ESMTP id D8CD4406B7 for ; Fri, 19 Apr 2024 07:24:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L1pxkYoGamXTjnXt3rCkiUcx95On4zGpavTepfJpBc1r0c4OmqKlBEKTpyJ+PN1AFHlmFAbzyXstw7PvUU30AclJ3IttCWIAKZKdO7zGtYC5O4VsKCX2R61cZzwyRf24TC+oqTZxGdWXz8E78oJWsRMWvkApCWAwbPOQXHCZetCosJcGksheFluixuopmNy0us2E9QfVsZ1tNjtUNSJ3s/H5HjdPivmfDeZ5hyyVbBiU5g89kcwTfNDIaiTI+qqXu9DMJbE9hVsCfFr2xXdjGGPMNyWSrjHoKhuv/7uTQLJYnpYDDBIHLBGLLoCP4g959XwwHj3wPZ9fC/vGFOhq7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=i+jehXNxCdv3Dj+dqEDZ2lob5TqR0HJaQX27VH6ioLg=; b=RSsauX12WLLcUz9rYtArf+SeFmG0nlrwbvETpp/8aTHlVDbc3IPSTre+0OvF3Fw/PCkBAucKWB7FoWTkIGDyeOkFupfN72yxmh7Cvon91hd/MnU3xqMeIDy/BzwMeo9Z9Nu17mIM9luzTnunsU0tR1gmmmo9VKfZYRR9LsfqVv+WJ/sKeMO/jzY1VvVrmlBAH8IX+7+uRgFnrha/A5qsmBVDSf7UVaGyQE14cNO+atHOT1mGNxB3+jkr+LAMcg46OCJ5kXi254R6vhKKkc8XuF+6HJ279eQYZx7i5RceXEexi92kfppBez/uwZWYtLvng6uWuE3YrAXMLiceNxDDXQ== 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=i+jehXNxCdv3Dj+dqEDZ2lob5TqR0HJaQX27VH6ioLg=; b=WCXFR1npLXrQJ1BBspxhLCbIfrHXWBdoS33uZY9n9T2bs9zZs+2N9zc77Mbc2e1HqFYQt6vQczfEuYpvqYg5DDFZvTEmH3M1CHgCWmsrkwulPepJin04bDva7l3ULjGjazArh8pWSscSf6YwlcU9p33J7Vel7BqgrA5kJQOjxhQ= 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 MW3PR13MB3961.namprd13.prod.outlook.com (2603:10b6:303:2c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.42; Fri, 19 Apr 2024 05:24:29 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7472.042; Fri, 19 Apr 2024 05:24:29 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v2 6/8] net/nfp: unify CPP acquire method Date: Fri, 19 Apr 2024 13:23:47 +0800 Message-Id: <20240419052349.1294696-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240419052349.1294696-1-chaoyong.he@corigine.com> References: <20240419031226.1191069-1-chaoyong.he@corigine.com> <20240419052349.1294696-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0087.apcprd03.prod.outlook.com (2603:1096:4:7c::15) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW3PR13MB3961:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e17b39c-687c-4e78-d5db-08dc6030fc43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?CLrz2YVfv9OWHIG61lLfBMWw6UYmXHw1m5vswsMTyGK/e0NBNIPaVgzhNx+U?= =?us-ascii?Q?VQNirBX1SWwHOXWbpMVGWSRaUK1wX0+6jMIB378Wc4xUY65sraEDyGTeyo9Y?= =?us-ascii?Q?xbPkuBA9AfguUMSCMHBPoI4AUjUbQSUKn+xLHdS4kb3ZYDLgWOTKGarNwJyF?= =?us-ascii?Q?NfiL/Vt8oO+ULGS8p6wvjXCFqu17EqH9BgHPHlfTEYArNkCUyXb2cEXwA39p?= =?us-ascii?Q?tdhsAKD4vYy/MhA28xMrtwYTXPoSSeXy1ShZGcUnjRsoqFS9nJpcJy7PTQJk?= =?us-ascii?Q?60FnUnNUS1j0Mr0Tib/GRdnSIIsftCiGS4VVhSh466qumuKM9NbHB17JBdQ1?= =?us-ascii?Q?K51wNqkSleYWerC6nAy4xvKU+/p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I63vGpFWmDoNXEeFG/IuMnOV0rj4u5TCwRY+c6zM2KA7xRfJyvWAXVRI9TX?= =?us-ascii?Q?v7Y2Go7McjTApKrkygKvA1ZM32TNohGzbVxpfR/D+JZpqA=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:(13230031)(52116005)(1800799015)(366007)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?W9YZD+aZGYEyC27hQDV6vZ0Ls0BPehp6nlzUQgBBsHK6dNeQU+tSpPtDSzBt?= =?us-ascii?Q?oRiL1f1GTdUo6ZXm1REndQzLjXVGbBkromTcUyjt9WFMs+l9PnQPM2D3C2mI?= =?us-ascii?Q?nDwukeX9SrOT9FZOLDkNfPqiHtjTp8uOaTKSTwLdL8jHSObzDPFt4+hd7MYE?= =?us-ascii?Q?8m2zVtXAWB/UnZLMtLA2uuLbpChlfl4bCN39PMgkT1/nBdMNgyEkokTVaPGj?= =?us-ascii?Q?wY7gMiCg+4v69sMf7NIN2xmJQy1NqX+oGrzZY2rZkvENYesoyaBZOMj7EKyX?= =?us-ascii?Q?5xtXDNh+I6/YRvJI5yWpZPQqiCATsxDroU2TAJryhMCLEUoWoweMustLJW0r?= =?us-ascii?Q?ImOv/+sE5dmQNizjUeNoG4wKBhrPg8HmqDSInUzJmOS8SdeNX9oUVrc3vyjo?= =?us-ascii?Q?8vwHoIR3yI3s/MaapmmYQDcQM6Lshpe8PRS0QFBV9XTjb7tT6Bw1QD1E/N5o?= =?us-ascii?Q?NMvRNe2F5yWeSDeYWx33RaqA6IHgL+IIvLcdknItL9VBq3utg/bK8M4qKfyf?= =?us-ascii?Q?20KfGldizd6ce1WXUIUDunSZOV/CCzy9X6H6MFaEoSiHiJ+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AK8l9lO3rylwN++5GEQhxCsMpZECYuYZeNaeNI00KOZXqdAqBLGk/QWs14v?= =?us-ascii?Q?BfYGQbo91+AxIgbPI/4jmYxXw1CCoJhAc0xO9Xp0SSv4zCLyng5SWyd9sBgV?= =?us-ascii?Q?rfxEwLMxObQUh/+GJk3pM23bIMtK/kCciuZiFpgwuQ8PLA05ESWOD47nT5Kq?= =?us-ascii?Q?Pw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e17b39c-687c-4e78-d5db-08dc6030fc43 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2024 05:24:29.4386 (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: ld8D+6gU913FuYPbPZQVimhqD7hqkUj0CnfpEsxcu6zJIs0i3uNHWIb2fgXoc3WfCwwVjeg0X1+oFKFnwlNNPD/xyD5FXntFSPYCenl5i/k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR13MB3961 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 Getting CPP from 'struct nfp_net_hw' is not right in multiple process user case. Modify the data structure and related logic to get it from process private data structure. Signed-off-by: Chaoyong He Signed-off-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower.c | 4 --- .../net/nfp/flower/nfp_flower_representor.c | 2 +- drivers/net/nfp/nfp_ethdev.c | 31 +++------------- drivers/net/nfp/nfp_net_common.c | 36 ++++++++----------- drivers/net/nfp/nfp_net_common.h | 3 +- 5 files changed, 22 insertions(+), 54 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 80874e23de..83249feedb 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -707,7 +707,6 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) /* Fill in the PF vNIC and populate app struct */ app_fw_flower->pf_hw = pf_hw; pf_hw->super.ctrl_bar = pf_dev->ctrl_bar; - pf_hw->cpp = pf_dev->cpp; ret = nfp_flower_init_vnic_common(hw_priv, pf_hw, "pf_vnic"); if (ret != 0) { @@ -730,9 +729,6 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) goto pf_cpp_area_cleanup; } - /* Now populate the ctrl vNIC */ - ctrl_hw->cpp = pf_dev->cpp; - ret = nfp_flower_init_ctrl_vnic(app_fw_flower, hw_priv); if (ret != 0) { PMD_INIT_LOG(ERR, "Could not initialize flower ctrl vNIC"); diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 934f078dca..0e19723f57 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -826,7 +826,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, */ for (i = 0; i < app_fw_flower->num_vf_reprs; i++) { flower_repr.repr_type = NFP_REPR_TYPE_VF; - flower_repr.port_id = nfp_get_pcie_port_id(app_fw_flower->pf_hw->cpp, + flower_repr.port_id = nfp_get_pcie_port_id(hw_priv->pf_dev->cpp, NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF, i, 0); flower_repr.nfp_idx = 0; flower_repr.vf_id = i; diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 38fe153ab4..258b617eb2 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -224,7 +224,7 @@ nfp_net_speed_configure(struct rte_eth_dev *dev) } } - nsp = nfp_eth_config_start(net_hw->cpp, eth_port->index); + nsp = nfp_eth_config_start(hw_priv->pf_dev->cpp, eth_port->index); if (nsp == NULL) { PMD_DRV_LOG(ERR, "Couldn't get NSP."); return -EIO; @@ -267,7 +267,6 @@ nfp_net_start(struct rte_eth_dev *dev) uint16_t i; struct nfp_hw *hw; uint32_t new_ctrl; - struct nfp_cpp *cpp; uint32_t update = 0; uint32_t cap_extend; uint32_t intr_vector; @@ -402,13 +401,8 @@ nfp_net_start(struct rte_eth_dev *dev) goto error; } - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - cpp = net_hw->cpp; - else - cpp = pf_dev->cpp; - /* Configure the physical port up */ - nfp_eth_set_configured(cpp, net_hw->nfp_idx, 1); + nfp_eth_set_configured(pf_dev->cpp, net_hw->nfp_idx, 1); for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; @@ -440,38 +434,26 @@ nfp_net_start(struct rte_eth_dev *dev) static int nfp_net_set_link_up(struct rte_eth_dev *dev) { - struct nfp_cpp *cpp; struct nfp_net_hw *hw; struct nfp_net_hw_priv *hw_priv; hw = dev->data->dev_private; hw_priv = dev->process_private; - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - cpp = hw->cpp; - else - cpp = hw_priv->pf_dev->cpp; - - return nfp_eth_set_configured(cpp, hw->nfp_idx, 1); + return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 1); } /* Set the link down. */ static int nfp_net_set_link_down(struct rte_eth_dev *dev) { - struct nfp_cpp *cpp; struct nfp_net_hw *hw; struct nfp_net_hw_priv *hw_priv; hw = dev->data->dev_private; hw_priv = dev->process_private; - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - cpp = hw->cpp; - else - cpp = hw_priv->pf_dev->cpp; - - return nfp_eth_set_configured(cpp, hw->nfp_idx, 0); + return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0); } static uint8_t @@ -1178,7 +1160,6 @@ nfp_fw_check_change(struct nfp_cpp *cpp, bool *fw_changed) { int ret; - struct nfp_net_hw hw; uint32_t new_version = 0; uint32_t old_version = 0; @@ -1186,8 +1167,7 @@ nfp_fw_check_change(struct nfp_cpp *cpp, if (ret != 0) return ret; - hw.cpp = cpp; - nfp_net_get_fw_version(&hw, &old_version); + nfp_net_get_fw_version(cpp, &old_version); if (new_version != old_version) { PMD_DRV_LOG(INFO, "FW version is changed, new %u, old %u", @@ -1600,7 +1580,6 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) /* Add this device to the PF's array of physical ports */ app_fw_nic->ports[id] = hw; - hw->cpp = pf_dev->cpp; hw->eth_dev = eth_dev; hw->idx = id; hw->nfp_idx = nfp_eth_table->ports[id].index; diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 8cc8b77318..7541afa235 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -695,7 +695,7 @@ nfp_net_speed_aneg_update(struct rte_eth_dev *dev, /* Compare whether the current status has changed. */ if (dev->data->dev_link.link_status != link->link_status) { - nfp_eth_table = nfp_eth_read_ports(hw->cpp); + nfp_eth_table = nfp_eth_read_ports(hw_priv->pf_dev->cpp); if (nfp_eth_table == NULL) { PMD_DRV_LOG(DEBUG, "Error reading NFP ethernet table."); return -EIO; @@ -2094,12 +2094,12 @@ nfp_net_cfg_read_version(struct nfp_net_hw *hw) } static void -nfp_net_get_nsp_info(struct nfp_net_hw *hw, +nfp_net_get_nsp_info(struct nfp_net_hw_priv *hw_priv, char *nsp_version) { struct nfp_nsp *nsp; - nsp = nfp_nsp_open(hw->cpp); + nsp = nfp_nsp_open(hw_priv->pf_dev->cpp); if (nsp == NULL) return; @@ -2111,12 +2111,12 @@ nfp_net_get_nsp_info(struct nfp_net_hw *hw, } void -nfp_net_get_fw_version(struct nfp_net_hw *hw, +nfp_net_get_fw_version(struct nfp_cpp *cpp, uint32_t *mip_version) { struct nfp_mip *mip; - mip = nfp_mip_open(hw->cpp); + mip = nfp_mip_open(cpp); if (mip == NULL) { *mip_version = 0; return; @@ -2128,12 +2128,12 @@ nfp_net_get_fw_version(struct nfp_net_hw *hw, } static void -nfp_net_get_mip_name(struct nfp_net_hw *hw, +nfp_net_get_mip_name(struct nfp_net_hw_priv *hw_priv, char *mip_name) { struct nfp_mip *mip; - mip = nfp_mip_open(hw->cpp); + mip = nfp_mip_open(hw_priv->pf_dev->cpp); if (mip == NULL) return; @@ -2185,8 +2185,8 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev, snprintf(vnic_version, FW_VER_LEN, "*"); } - nfp_net_get_nsp_info(hw, nsp_version); - nfp_net_get_mip_name(hw, mip_name); + nfp_net_get_nsp_info(hw_priv, nsp_version); + nfp_net_get_mip_name(hw_priv, mip_name); nfp_net_get_app_name(hw_priv, app_name); snprintf(fw_version, FW_VER_LEN, "%s %s %s %s", @@ -2220,7 +2220,6 @@ nfp_net_is_valid_nfd_version(struct nfp_net_fw_ver version) int nfp_net_stop(struct rte_eth_dev *dev) { - struct nfp_cpp *cpp; struct nfp_net_hw *hw; struct nfp_net_hw_priv *hw_priv; @@ -2233,12 +2232,7 @@ nfp_net_stop(struct rte_eth_dev *dev) nfp_net_stop_tx_queue(dev); nfp_net_stop_rx_queue(dev); - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - cpp = hw->cpp; - else - cpp = hw_priv->pf_dev->cpp; - - nfp_eth_set_configured(cpp, hw->nfp_idx, 0); + nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0); return 0; } @@ -2285,7 +2279,7 @@ nfp_net_flow_ctrl_get(struct rte_eth_dev *dev, } static int -nfp_net_pause_frame_set(struct nfp_net_hw *net_hw, +nfp_net_pause_frame_set(struct nfp_net_hw_priv *hw_priv, struct nfp_eth_table_port *eth_port, enum rte_eth_fc_mode mode) { @@ -2293,7 +2287,7 @@ nfp_net_pause_frame_set(struct nfp_net_hw *net_hw, bool flag; struct nfp_nsp *nsp; - nsp = nfp_eth_config_start(net_hw->cpp, eth_port->index); + nsp = nfp_eth_config_start(hw_priv->pf_dev->cpp, eth_port->index); if (nsp == NULL) { PMD_DRV_LOG(ERR, "NFP error when obtaining NSP handle."); return -EIO; @@ -2350,7 +2344,7 @@ nfp_net_flow_ctrl_set(struct rte_eth_dev *dev, if (set_mode == original_mode) return 0; - ret = nfp_net_pause_frame_set(net_hw, eth_port, set_mode); + ret = nfp_net_pause_frame_set(hw_priv, eth_port, set_mode); if (ret != 0) return ret; @@ -2438,7 +2432,7 @@ nfp_net_fec_get(struct rte_eth_dev *dev, return -EINVAL; if (dev->data->dev_link.link_status == RTE_ETH_LINK_DOWN) { - nfp_eth_table = nfp_eth_read_ports(hw->cpp); + nfp_eth_table = nfp_eth_read_ports(hw_priv->pf_dev->cpp); hw_priv->pf_dev->nfp_eth_table->ports[hw->idx] = nfp_eth_table->ports[hw->idx]; free(nfp_eth_table); } @@ -2520,5 +2514,5 @@ nfp_net_fec_set(struct rte_eth_dev *dev, return -EIO; } - return nfp_eth_set_fec(hw->cpp, eth_port->index, fec); + return nfp_eth_set_fec(hw_priv->pf_dev->cpp, eth_port->index, fec); } diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 31deeb43ce..40f314af0a 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -201,7 +201,6 @@ struct nfp_net_hw { struct rte_eth_stats eth_stats_base; struct rte_eth_xstat *eth_xstats_base; - struct nfp_cpp *cpp; struct nfp_cpp_area *ctrl_area; struct nfp_cpp_area *mac_stats_area; uint8_t *mac_stats_bar; @@ -322,7 +321,7 @@ int nfp_net_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa); int nfp_net_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa); -void nfp_net_get_fw_version(struct nfp_net_hw *hw, +void nfp_net_get_fw_version(struct nfp_cpp *cpp, uint32_t *fw_version); int nfp_net_txrwb_alloc(struct rte_eth_dev *eth_dev); void nfp_net_txrwb_free(struct rte_eth_dev *eth_dev); -- 2.39.1