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 C9E1A43EA9; Fri, 19 Apr 2024 05:13:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18796406BA; Fri, 19 Apr 2024 05:13:04 +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 655A64067E for ; Fri, 19 Apr 2024 05:13:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ph9acroyYBtpFj0gUej81++F2AF2YYtDCbXhJIgL9yxLPIebhAV+YndOMv5ZGoBGkB0KZDmF7bbeBFn06In1b+Ccv6gJxzKF7HeE1vAx/O0laGvM4LvDm7G7nAF7gdECyG7oraoNpt7Lhtuj/iH6FhnOJWD7XgNQoZltvT+MCxJFOS7ge7srq9nfmW4aN+nNQLmF5x7hvntUiz22/wl8a6vdUZcGHNN2jfKtAH40q3Z8v2S64NfbuRx8r9SPaZMmOn4DNT8XeySZ/pqeTu4Pncc+6NIKugGfMgpJY1KBcumrG1rXx4LaEGxgNIghvgRRu2cGEZsk7gcLmwMKbotVuA== 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=6umlQCIyGYJ8c80kBSBBWdu6EELI0REgjh+jzujRZqQ=; b=dPfPMVcCgHrxfmUwQlCTbyPfPheOO2YU18Duofc4pt6/knPksr1VjE8cdnIuAOPzuM3CEsZk7uHixmqXJ98wUPxV1DljBt/rLsEGZ8ZXi88gUkAWOHTC2KjEO6lLRfFjLiElZaYrTlllQjZ5KuHNuTEFG9mbFNGjkayC1ZAFfnqPkMxQO5m0YTpJ1tplVxeZVMr3cv6XGdrPEcKmLulQ+OpggenpMeaaLZBNxtZwmP7dsbnWLyXNab02eG+lVleGcCqNYGyc3VLnTilmi8kvs2++nZ96J8t1uh7qgYwKowhraJlTVFNT/gYVU+MLr91DRfE0vLnoJMmCjoJHAGPSkw== 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=6umlQCIyGYJ8c80kBSBBWdu6EELI0REgjh+jzujRZqQ=; b=rz7W43na2sn4U3nScQSUPjcqbvD86ttrtsJPb9AyyAiAdYq11RnE4e5uKI6TmSf6vegmulTt0fPhvu8whuF0xjaVtbYxBuQsPa+Ttffc4aSGkb/ecBwt3vQt+f/b8SjzBFhJpXj1MMDs0Hu0aX5rsjM8FSly4oILa3niczoffn0= 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:00 +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:00 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH 5/8] net/nfp: move device info data field Date: Fri, 19 Apr 2024 11:12:23 +0800 Message-Id: <20240419031226.1191069-6-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: 4d51c469-a246-446a-d63c-08dc601e9e21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?dKrs7ga/GPAPuUmdQ5Vr3eBHj+0rJNPptjjxPjRTrmdyP7D0RGNtJ4osO4f9?= =?us-ascii?Q?lQM4hDvtc4gnErIdSxRiOA/XBfjg5UFEJAA4XKjME3OOrs7Ga1MwWwEWkpFf?= =?us-ascii?Q?iw6Y7ceKV4LX/r4NxKYmOg4TxqvOsAuIBioJst+qRZP4VtkeTX8Uqx37iK11?= =?us-ascii?Q?+H5HWr1fyJmsCUChUwfFCX3+jQY4vn0pE/UHXvGg6VEFYWRPDRsbUdZJSGUK?= =?us-ascii?Q?/n0MSf636bT34pDiT0UJpOw4FnHs8jqy/ZuU0iplWhD6AYLxWqRSPOWgjct3?= =?us-ascii?Q?6G7jdvFjjdAUgnSdV7Z47JzBkYZWh2zFUFWTCLrMXV6USXMG3jOVs2aPg55l?= =?us-ascii?Q?1p9eda2uGh8/X5kcrlr15qaaSR2aWPAZA4qdQUnQERTHCSvhW+TtGoZZGRU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mBblD6h53jldKaRf5Kv9eWVv0bw5ZU?= =?us-ascii?Q?f26eBgmTv9yOlQgd5JxkriLdhV76nJoNiJF1Rb9VsfoTGA=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?3wugR1DWJJzZWqeq22gmSFRsObsCJLyMnHL/NOofDedT+p4w9+8dX+wsCrBG?= =?us-ascii?Q?Zbz67iJ7QwHLTCl0qHUcNzm13r9/IN0NEX11S4Q01t+o6rTiraaA6mWp3xdQ?= =?us-ascii?Q?e1W/ZZShMc2tUfs3ynTLhurlvfcf7JDkNPTqUZlvttagLk72MJXxmfSwLGsG?= =?us-ascii?Q?Dz9lbTZ5Xow34gMJGuzroTZzI1+hXp0z+EpPY5lntb+5iGH/+0oBTu212YMu?= =?us-ascii?Q?MNCzkAJDagFMFYdu83YXe/a42YUhrWU6bUMf4IwdzSMpJWC7Ni/+RC8zHezJ?= =?us-ascii?Q?n7CL6Z1aIk2aeibaVq7OzQmGt50OmF6Ydo5h6iVzwjXHoiyyqpOwWOIJrNJ1?= =?us-ascii?Q?SHS6lLZKyOwFdlpmdg2/FAEZ2Qz+Lqk7veYppal1pn8rshDWOEFtOMJdzMbp?= =?us-ascii?Q?6ZlyGcVJkwSVzzhpvJz3ZMW4OlJN+Qu1Shanhryu3FobiCLiPTvVEpyuyVqw?= =?us-ascii?Q?W33uQorjxbTSe5Bn+3E/bCVyMRH4zqLjRL8b3NaoAzxgPlCtfjARyrU7aUlc?= =?us-ascii?Q?/3haZSOG8Av6BqLyd6fMzrlb9YV35nkr1uj3XYpZ1kv8PCs428PszwXh5ey3?= =?us-ascii?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lSX0j7fsMxPV9?= =?us-ascii?Q?DrF8CFeqh8SEaie7gkU2Sx3aerQ/uijqSVBRzA+Oy+VVR7+PRqdH+tGFe3lx?= =?us-ascii?Q?vQkJlBENM4Nu2dFZ4J8C4aBI8DiIMg1UCdhHQpv4FiuivlGMc/1fqzC5iepZ?= =?us-ascii?Q?4Q=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d51c469-a246-446a-d63c-08dc601e9e21 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:00.1032 (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: 2PuLXXdFaNRrBGsD5wkwEE/H5d7bmtEQ5o6iCA0zAhMGGqZHt/q1dR3vedbqELvRxVrsxd3Zj1ZByr8lLHMrP1rI1Om34DEeAdR8+Dpz/9U= 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 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 efa604fd58..41678c93b5 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