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 737D743EA9; Fri, 19 Apr 2024 05:13:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7AFBD409FA; Fri, 19 Apr 2024 05:13:05 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2108.outbound.protection.outlook.com [40.107.237.108]) by mails.dpdk.org (Postfix) with ESMTP id EBB9E406B7 for ; Fri, 19 Apr 2024 05:13:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EkVsnfqhMBexg1Gl32RTOTWO28N+fkA5VltEPcYrT6KAe8ZZaa07NzuuW47E9O2Dull66lEFgirURXz6ttZva9aIdtlXSn3xpmSdyQ8jT1D5BtztbqzHboeqMKTrCzM+pPjAwOVN9IMLyukFepuE9IVg8ctuZLfSr3dth24f51yjN9SE4Zdvy5An2vOp47ZirRadZtOKfE2ZDsoPZWQlhu4c5rrKNsZ2RiBrSdc5pBeukGHMrmPRZMpkCmv5YwMKIihWndSe/XFbu3SqQiW57wLHqPjTcZSfczkABzLiVfc2/5AoqBli4USqjDkymMoOtxW8QwcUaH8Ylho57PLHSg== 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=9NVoX1e63mjnSOAbUSblBCC/Qvc6mNbIxAgojDYAa2M=; b=nIagI9gZfK9bu+VBQWNHtein2m8AahaORrxNFBmR7XuYbexiEci9i/PTEaf5Vu04ToLkTvj78l8cTKIUmFHV6Iz0yiTy3sXAWlGJIq/KNB+dNV/XcjSLzMNUwG1XuXxQi/7R3FC8xZ3abrM7pX6NepXo7DczZxz4tYm+G5Em5D+QbdCmPkpu8WX54oJsvJ69LBrEkNzQ3Geh4j6BXjU8e2BcFcAR3GSf73S/sjKh+TiBRnaGZqcQ6qjhdrBloc9Zik4YAf/RxiVVmBRqBJQ07QN2KBYSUYp6IlW5pZEds3ZiOZdhK+aRBRJ57dGak32Rwodi3QPQV8DFQ+17650jvw== 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=9NVoX1e63mjnSOAbUSblBCC/Qvc6mNbIxAgojDYAa2M=; b=OSerQCdrWX/u1uXUqi7J7tZf68RsSncX2hYN/LriGIwtnjOt+VH8v1Kz1GeDD7n+bk+TedDHPdoZhkdu0GR9VqhrOp6ngW/o5NLjm+Ru1aS2Bk/AsrTIzJlH579b4+xzJ4DQfdK1MpmoaKuIp9FZGCKuSGAUvQnIfiRMuqt16u4= 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 BY1PR13MB6310.namprd13.prod.outlook.com (2603:10b6:a03:52e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.38; Fri, 19 Apr 2024 03:13:02 +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 03:13:02 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH 6/8] net/nfp: unify CPP acquire method Date: Fri, 19 Apr 2024 11:12:24 +0800 Message-Id: <20240419031226.1191069-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240419031226.1191069-1-chaoyong.he@corigine.com> References: <20240419031226.1191069-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0044.apcprd01.prod.exchangelabs.com (2603:1096:4:193::8) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BY1PR13MB6310:EE_ X-MS-Office365-Filtering-Correlation-Id: d8fa3dae-d2d9-488a-9b57-08dc601e9f78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Wb3bP69zmIn7vx4q8ZrBjTuR45iFgFUzwaESgdTQAHL3wvQ97uK0ohlb5/cC?= =?us-ascii?Q?pHYLpc+xKC/G+7TWRs6eVH06Lq9MTOGtPfDUZTJ+p9BlbD2RKboJWrsc8PEp?= =?us-ascii?Q?ySL5cpp9SFuBs9gG/TEZMaXUzp1y0Tlaqf5JcrdPEJi1clcxxgSmfE30qcsx?= =?us-ascii?Q?mmpOQCxZQUa2o4R97J6T1stg1oSvPaZ91yZm5vLSI7rWP6zI8DjmJRwnU8oc?= =?us-ascii?Q?RyQXaZ7RNXcGZ0C3WjmMghc0kTl1deCVRtyNHuf9U7yiXFNeBkJ938Cja6AR?= =?us-ascii?Q?23VfTxz1H8m75C6MiJIvXft9kysPAe4l7sshCnngbRC5OPmJD0APKOae9sKn?= =?us-ascii?Q?/sWJylvL+Se4XROUbtlLi/1S0ahXLiP26F8e7mmMCXdZdBf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SS5nvx5h0n/hLO7Q1i/MKYNduSvLSEcSCBzj92HWJU?= =?us-ascii?Q?K286ETIDfx2bq5nS2HsM0Ew2l6FtllfgQefn573ufi+BVg=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)(366007)(52116005)(376005)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LeIXzIzGxRZjHxCRDTl4Uwao+pcJmdKl+IyOYfZAjFtPiWCr6Ux0nyrkHyMS?= =?us-ascii?Q?ea+LXiEptDajjvH/mbQ3h232IEcwhnvfqEGB+0VaxATOBubgdI6ut9GaFP7d?= =?us-ascii?Q?AQVpSJ/G8TyPzR+AujC2pU1NewgeZXwa54bwCdv3O138AVOSoQLgyqwdY2oQ?= =?us-ascii?Q?L2dR6HFQzR3qqSXrPqVX+wu0LZLSxKKocnGYGcDspllAd29yLM3BbBHsJXPn?= =?us-ascii?Q?VGwJ/qkAXWKSxpDa1hYXc52MZCS8pqZTVsxLQ+1Xyxmov7MEqd+PBggMiSmE?= =?us-ascii?Q?Lpr1xGH00FGo78tf3SBqJwKei/vPNV96gkDGsUthpikumqGdrpC/yjUb63Wp?= =?us-ascii?Q?DdUnAvI/P7pfXveBuSPRWhoJDTwAgOuPITf1F4ulk9j8eBEONEFGENs63ZNa?= =?us-ascii?Q?u61jcXY8R7XXGl5jTMznYo/WWnLSYzRUeh4NQH3yZK6gSmFGMBGkR1wzKZDR?= =?us-ascii?Q?OKCMyXz6N3vtFWIDY+fW802XkmGG6FPh+flCLMX9Qow091RZKEp5mu3So8cm?= =?us-ascii?Q?zlDs7FEYthbwULGwHORhuSfY7nk9eO2hHgA5XXucdkp/n75JyB2vASCMgGod?= =?us-ascii?Q?t16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?= =?us-ascii?Q?b8iu4qp6sDR0b9FEMPVux7XGpAVQwMmPClFOlG7zl5esog53RVGzrU0pt64C?= =?us-ascii?Q?5GCEMhh7vlOen+KpK1TRsZ9XkqJW6pRyMrk6YepJUsuEwoC7MjNC+7b9CvAW?= =?us-ascii?Q?Jw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8fa3dae-d2d9-488a-9b57-08dc601e9f78 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2024 03:13:02.3249 (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: Zh6otjr9vLhSvsqS+EzWnDoSjVuLQnn/fYTIMqW04RA/X0eBEAqxmcgF4BoYh5N8vOyjp8zcKuvoSdrllWmPiXTIsmJG7wE40h8sWw9rFBI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR13MB6310 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 41678c93b5..e472daa5a5 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