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 6EEE443EAA; Fri, 19 Apr 2024 07:24:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DABEF406A2; Fri, 19 Apr 2024 07:24:28 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2136.outbound.protection.outlook.com [40.107.237.136]) by mails.dpdk.org (Postfix) with ESMTP id D895F40697 for ; Fri, 19 Apr 2024 07:24:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jIdwjsTxl5jGNJvRBnbVORf2g2+9yCpE37hOsgSxzOUzcAo1HQ3sSs8Ba9GZZOTEuRSjvHW3xRdZIJ5xFRoF+DbpjsI+8e1DbsCKWtWHbaT74BRu3v0yffOiyzXszcyVhbDvqovQzRvIRYN46NdO68h3BoPSGFHHmqvFEGJZJ5stFa3Qsc5R6QXHbD5RIuDpMB+e88smY6KWrpV9DhuQFqcafJ1HS7NxssziQmi5xI/lkU6rLxpzlKzM1OnUeb74istqfYg6bP8eVpqtE8k8lC1gs9iGEZY4Ze9VmWPykSrD9f+DiJFTLbX31nkOmxWRhLRdZTgkNbbudJ7b9ai93g== 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=ophcMQbguoqAGJ52WniBCOaFAuLHiPiGBqNoYI+eD4A=; b=MD5qdzc4UHlKj05HPJhLULiW74jSJJFgTfzWI6fs8C13KL07mybBTzlumIQJCc7j1oK8sjLvIT++CqsPFcjX+9DBTZ6ettlto7XOkSuv8bYefDI8zgfeaF49hBBrdWuoBd1+a7ViFitjQuqaQGsrHIXqEFGkDeGgqIoEAV40wkRwnfLlV1yaYjVXJC6MnQx5TUC57fepNbdda/bRAvINYQEMiY6CxWUgcb/mWs/UXyhm+CjC/g1WL5lh3xBmTbVgQfc6CpcfIUWNU7jaEu6r3cank5Zjotov7lYyXZBI/jz483TEiAP0eVL3wnEvWQEVAZQgcQz2y/wSRhNWqHh8Bw== 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=ophcMQbguoqAGJ52WniBCOaFAuLHiPiGBqNoYI+eD4A=; b=Kgg7QKP+5olgLHivVQLUTqNvgNYA1wrhKdxYs2J2W3TZjV8Gjaidca/wDNq92nWpXhzxfJSdSbzMpvt8lRmos99jGWppOBJiLUyFL20/HX/AXg8eYO2a4ynE1yT7ObAUOonBdGGGoPxRermjlkT4TLQ26Oa7k7KVVRnAywn2vxM= 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:25 +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:25 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v2 5/8] net/nfp: move device info data field Date: Fri, 19 Apr 2024 13:23:46 +0800 Message-Id: <20240419052349.1294696-6-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: 1915d7e1-2bc2-4f13-2c05-08dc6030f9bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?hCv/S19xhHzDgMTmV0shiysDHPLsjPHV3Fct60UcJGz+KVZxpz6O25BtnmfR?= =?us-ascii?Q?GukfaounK2Q/Enc8DHow6+9E48Et1X7cpfBAx0YEFclhriruI56Ps4YvOYxZ?= =?us-ascii?Q?O4MTeYp29gx4FwxlqeOdBIJ7XD2e4BrilAw2XkB/wGIaY0Y9VxxJCUUp5qa9?= =?us-ascii?Q?CICNoKW55kFwNFKWHe33VDpoix0XjUCVCrFKD2sftEMapoJCkwMmYSjJEltr?= =?us-ascii?Q?EJsJ9Z38SO4B7YOCcfFW+EQha9FvsSY1Q5E4ZVTFerJfAHT7UCC5mUyixXLn?= =?us-ascii?Q?IwhiwijnO8IVqtq5CBMvvHC/+SLN3q2k3oytrYCDylRahSre2CjjfmViZc9P?= =?us-ascii?Q?PGniJLV5Tu+4ECnI4q2faRZTgEROB1XNmaMOquPYQ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q?zo5XtLrS0pc5nTlcfaWQXRTs1IroeYG97QYc5XmOMvwtAxjVc/r+ik9eeDsk?= =?us-ascii?Q?wpfTd1d8dBcDf9Kkimdr8Df09HtZEGE2Qy2AYjmTOSSLJA=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?dW9LXv5eFW/vWi0irxKwS9EBwSbQMScNRTIhcECqIV8Res494THgglikBmcU?= =?us-ascii?Q?4eqSf0QBBIyfRIQzFu4TUOygd59rkN2Y+DHhC+4i7FzfUYIYuZbOEa0VrJdc?= =?us-ascii?Q?zmv69mpcWkpEdq+CFsGYTAoRk9aqtB+jbjAOx2rkRuVPN21yO3D6ZV3WYHFl?= =?us-ascii?Q?a3lE0ckim0weh6y2G9PPklgc6aOlYskxtz+QFO+7Qie/RCQIFh0qjvuc6PAC?= =?us-ascii?Q?m8ypmPu9Zn1D3ex31XAM27ooQvrLLVtsfvStdTt4E79k5zzE1U7+R8dNvToz?= =?us-ascii?Q?G9nWIhOuyr+3dfkZB5bvLn2Tp2BjPmRqYic5Pi5PBGmXZFudMa3ut+d3BpEI?= =?us-ascii?Q?L6+Dhg9j3p/AAkFSUoh7i6ZKKV9tfX9z+fwZOoCzD1MTc1geFlvoN0cjGYmk?= =?us-ascii?Q?chkCj6Z5sSZjKJPzAAlmp/FeVojb5KX9rw9KXlncQ0R4e1SiN8MAJFd+xKNH?= =?us-ascii?Q?wgE2a9PrgSULX+DqJv1GQcH6Z4lkMFIu40eUCuA6/ro3Yrs9hmHBaGIy1oVb?= =?us-ascii?Q?U/BzMqVNtuSeaioU1ek19I36M70cI6dqsVPpTpV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= =?us-ascii?Q?rNV0ubEwq/RtBGTszimlRJreIBqQ2JRJWeUaRaSRrzkg89GbzA5LOt25fhbd?= =?us-ascii?Q?KekTSenYxD9bUtmyFRCrYZAPIHQTK9cNfKf/SnYHrR8SvsvCk7EfKWBFh8hG?= =?us-ascii?Q?kODeelwaa+VfDhv8UReZTBBfoCTpZw+5uuVBR/H0idScHUvtQjqaYAE9XNOL?= =?us-ascii?Q?FQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1915d7e1-2bc2-4f13-2c05-08dc6030f9bd 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:25.4539 (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: QdEb3dPNx3EtCdQ1NBhieJWAgkYtLYL2E2MS/dpxJMNq29EPWUBzvFLaXxF7qHxZFSP1kSQ3shvYp+ehg0fdfDfLYi5DAJDdEsHteUg4Gf8= 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 Move 'dev_info' data field from process shared data structure into process private data structure. Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower.c | 9 +++------ drivers/net/nfp/flower/nfp_flower.h | 3 +-- drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 4 +++- drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 4 +++- drivers/net/nfp/nfp_ethdev.c | 10 +++++----- drivers/net/nfp/nfp_ethdev_vf.c | 18 +++++++++++++++++- drivers/net/nfp/nfp_net_common.c | 15 ++++++++------- drivers/net/nfp/nfp_net_common.h | 9 +++++---- drivers/net/nfp/nfp_rxtx.c | 4 +++- 9 files changed, 48 insertions(+), 28 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 8dd9e23c78..80874e23de 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -372,7 +372,7 @@ nfp_flower_init_ctrl_vnic(struct nfp_app_fw_flower *app_fw_flower, */ tz = rte_eth_dma_zone_reserve(eth_dev, ctrl_rxring_name, i, sizeof(struct nfp_net_rx_desc) * - hw->dev_info->max_qc_size, + hw_priv->dev_info->max_qc_size, NFP_MEMZONE_ALIGN, numa_node); if (tz == NULL) { PMD_DRV_LOG(ERR, "Error allocating rx dma"); @@ -430,7 +430,7 @@ nfp_flower_init_ctrl_vnic(struct nfp_app_fw_flower *app_fw_flower, */ tz = rte_eth_dma_zone_reserve(eth_dev, ctrl_txring_name, i, sizeof(struct nfp_net_nfd3_tx_desc) * - hw->dev_info->max_qc_size, + hw_priv->dev_info->max_qc_size, NFP_MEMZONE_ALIGN, numa_node); if (tz == NULL) { PMD_DRV_LOG(ERR, "Error allocating tx dma"); @@ -639,8 +639,7 @@ nfp_flower_nfd_func_register(struct nfp_app_fw_flower *app_fw_flower) } int -nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv, - const struct nfp_dev_info *dev_info) +nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) { int ret; int err; @@ -709,7 +708,6 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv, app_fw_flower->pf_hw = pf_hw; pf_hw->super.ctrl_bar = pf_dev->ctrl_bar; pf_hw->cpp = pf_dev->cpp; - pf_hw->dev_info = dev_info; ret = nfp_flower_init_vnic_common(hw_priv, pf_hw, "pf_vnic"); if (ret != 0) { @@ -734,7 +732,6 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv, /* Now populate the ctrl vNIC */ ctrl_hw->cpp = pf_dev->cpp; - ctrl_hw->dev_info = dev_info; ret = nfp_flower_init_ctrl_vnic(app_fw_flower, hw_priv); if (ret != 0) { diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h index 5cc29dcc87..5c2f338a20 100644 --- a/drivers/net/nfp/flower/nfp_flower.h +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -104,8 +104,7 @@ nfp_flower_support_decap_v2(const struct nfp_app_fw_flower *app_fw_flower) return app_fw_flower->ext_features & NFP_FL_FEATS_DECAP_V2; } -int nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv, - const struct nfp_dev_info *dev_info); +int nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv); void nfp_uninit_app_fw_flower(struct nfp_net_hw_priv *hw_priv); int nfp_secondary_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv); bool nfp_flower_pf_dispatch_pkts(struct nfp_net_hw_priv *hw_priv, diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c index 681a63eacd..ee96cd8e46 100644 --- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c +++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c @@ -385,10 +385,12 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, struct nfp_net_txq *txq; uint16_t tx_free_thresh; const struct rte_memzone *tz; + struct nfp_net_hw_priv *hw_priv; hw = nfp_net_get_hw(dev); + hw_priv = dev->process_private; - nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc); + nfp_net_tx_desc_limits(hw, hw_priv, &min_tx_desc, &max_tx_desc); /* Validating number of descriptors */ tx_desc_sz = nb_desc * sizeof(struct nfp_net_nfd3_tx_desc); diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index 83eaec9c24..3ba97e23a9 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -464,10 +464,12 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_free_thresh; struct nfp_net_txq *txq; const struct rte_memzone *tz; + struct nfp_net_hw_priv *hw_priv; hw = nfp_net_get_hw(dev); + hw_priv = dev->process_private; - nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc); + nfp_net_tx_desc_limits(hw, hw_priv, &min_tx_desc, &max_tx_desc); /* Validating number of descriptors */ tx_desc_sz = nb_desc * sizeof(struct nfp_net_nfdk_tx_desc); diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 58e155e92b..38fe153ab4 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -1494,8 +1494,7 @@ nfp_enable_multi_pf(struct nfp_pf_dev *pf_dev) } static int -nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv, - const struct nfp_dev_info *dev_info) +nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) { uint8_t i; uint8_t id; @@ -1601,7 +1600,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->dev_info = dev_info; hw->cpp = pf_dev->cpp; hw->eth_dev = eth_dev; hw->idx = id; @@ -1968,6 +1966,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) PMD_INIT_LOG(DEBUG, "qc_bar address: %p", pf_dev->qc_bar); hw_priv->pf_dev = pf_dev; + hw_priv->dev_info = dev_info; /* * PF initialization has been done at this point. Call app specific @@ -1982,7 +1981,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) } PMD_INIT_LOG(INFO, "Initializing coreNIC"); - ret = nfp_init_app_fw_nic(hw_priv, dev_info); + ret = nfp_init_app_fw_nic(hw_priv); if (ret != 0) { PMD_INIT_LOG(ERR, "Could not initialize coreNIC!"); goto hwqueues_cleanup; @@ -1990,7 +1989,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) break; case NFP_APP_FW_FLOWER_NIC: PMD_INIT_LOG(INFO, "Initializing Flower"); - ret = nfp_init_app_fw_flower(hw_priv, dev_info); + ret = nfp_init_app_fw_flower(hw_priv); if (ret != 0) { PMD_INIT_LOG(ERR, "Could not initialize Flower!"); goto hwqueues_cleanup; @@ -2187,6 +2186,7 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev) pf_dev->sync = sync; hw_priv->pf_dev = pf_dev; + hw_priv->dev_info = dev_info; /* Call app specific init code now */ switch (app_fw_id) { diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 88da593190..bd3745a5c5 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -162,14 +162,17 @@ nfp_netvf_close(struct rte_eth_dev *dev) { struct nfp_net_hw *net_hw; struct rte_pci_device *pci_dev; + struct nfp_net_hw_priv *hw_priv; if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; net_hw = dev->data->dev_private; pci_dev = RTE_ETH_DEV_TO_PCI(dev); + hw_priv = dev->process_private; rte_free(net_hw->eth_xstats_base); + rte_free(hw_priv); /* * We assume that the DPDK application is stopping all the @@ -255,6 +258,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) uint64_t tx_bar_off = 0; uint64_t rx_bar_off = 0; struct rte_pci_device *pci_dev; + struct nfp_net_hw_priv *hw_priv; const struct nfp_dev_info *dev_info; port = eth_dev->data->port_id; @@ -267,7 +271,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) } net_hw = eth_dev->data->dev_private; - net_hw->dev_info = dev_info; hw = &net_hw->super; hw->ctrl_bar = pci_dev->mem_resource[0].addr; @@ -284,6 +287,17 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) nfp_netvf_ethdev_ops_mount(net_hw, eth_dev); + hw_priv = rte_zmalloc(NULL, sizeof(*hw_priv), 0); + if (hw_priv == NULL) { + PMD_INIT_LOG(ERR, "Can not alloc memory for hw priv data"); + err = -ENOMEM; + goto hw_priv_free; + } + + hw_priv->dev_info = dev_info; + + eth_dev->process_private = hw_priv; + /* For secondary processes, the primary has done all the work */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; @@ -366,6 +380,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) free_xstats: rte_free(net_hw->eth_xstats_base); +hw_priv_free: + rte_free(hw_priv); return err; } diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 60d77b6178..8cc8b77318 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -1144,16 +1144,17 @@ nfp_net_xstats_reset(struct rte_eth_dev *dev) } void -nfp_net_rx_desc_limits(struct nfp_net_hw *hw, +nfp_net_rx_desc_limits(struct nfp_net_hw_priv *hw_priv, uint16_t *min_rx_desc, uint16_t *max_rx_desc) { - *max_rx_desc = hw->dev_info->max_qc_size; - *min_rx_desc = hw->dev_info->min_qc_size; + *max_rx_desc = hw_priv->dev_info->max_qc_size; + *min_rx_desc = hw_priv->dev_info->min_qc_size; } void nfp_net_tx_desc_limits(struct nfp_net_hw *hw, + struct nfp_net_hw_priv *hw_priv, uint16_t *min_tx_desc, uint16_t *max_tx_desc) { @@ -1164,8 +1165,8 @@ nfp_net_tx_desc_limits(struct nfp_net_hw *hw, else tx_dpp = NFDK_TX_DESC_PER_SIMPLE_PKT; - *max_tx_desc = hw->dev_info->max_qc_size / tx_dpp; - *min_tx_desc = hw->dev_info->min_qc_size / tx_dpp; + *max_tx_desc = hw_priv->dev_info->max_qc_size / tx_dpp; + *min_tx_desc = hw_priv->dev_info->min_qc_size / tx_dpp; } int @@ -1183,8 +1184,8 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) hw = nfp_net_get_hw(dev); hw_priv = dev->process_private; - nfp_net_rx_desc_limits(hw, &min_rx_desc, &max_rx_desc); - nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc); + nfp_net_rx_desc_limits(hw_priv, &min_rx_desc, &max_rx_desc); + nfp_net_tx_desc_limits(hw, hw_priv, &min_tx_desc, &max_tx_desc); dev_info->max_rx_queues = (uint16_t)hw->max_rx_queues; dev_info->max_tx_queues = (uint16_t)hw->max_tx_queues; diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 8dbe2fb973..31deeb43ce 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -158,6 +158,9 @@ struct nfp_app_fw_nic { struct nfp_net_hw_priv { struct nfp_pf_dev *pf_dev; + + /** NFP ASIC params */ + const struct nfp_dev_info *dev_info; }; struct nfp_net_hw { @@ -177,9 +180,6 @@ struct nfp_net_hw { uint32_t rx_offset; enum nfp_net_meta_format meta_format; - /** NFP ASIC params */ - const struct nfp_dev_info *dev_info; - uint8_t *tx_bar; uint8_t *rx_bar; @@ -297,10 +297,11 @@ void nfp_net_close_rx_queue(struct rte_eth_dev *dev); void nfp_net_stop_tx_queue(struct rte_eth_dev *dev); void nfp_net_close_tx_queue(struct rte_eth_dev *dev); int nfp_net_set_vxlan_port(struct nfp_net_hw *hw, size_t idx, uint16_t port); -void nfp_net_rx_desc_limits(struct nfp_net_hw *hw, +void nfp_net_rx_desc_limits(struct nfp_net_hw_priv *hw_priv, uint16_t *min_rx_desc, uint16_t *max_rx_desc); void nfp_net_tx_desc_limits(struct nfp_net_hw *hw, + struct nfp_net_hw_priv *hw_priv, uint16_t *min_tx_desc, uint16_t *max_tx_desc); int nfp_net_check_dma_mask(struct nfp_net_hw *hw, char *name); diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 12f362a4f4..8697c5d711 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -606,10 +606,12 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, struct nfp_net_hw *hw; struct nfp_net_rxq *rxq; const struct rte_memzone *tz; + struct nfp_net_hw_priv *hw_priv; hw = nfp_net_get_hw(dev); + hw_priv = dev->process_private; - nfp_net_rx_desc_limits(hw, &min_rx_desc, &max_rx_desc); + nfp_net_rx_desc_limits(hw_priv, &min_rx_desc, &max_rx_desc); /* Validating number of descriptors */ rx_desc_sz = nb_desc * sizeof(struct nfp_net_rx_desc); -- 2.39.1