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 C94A843220; Sat, 28 Oct 2023 08:54:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 875CD40A89; Sat, 28 Oct 2023 08:53:54 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2108.outbound.protection.outlook.com [40.107.101.108]) by mails.dpdk.org (Postfix) with ESMTP id 9898840A80 for ; Sat, 28 Oct 2023 08:53:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDkE7Sr41Ldp7GJ9nNp8xtWeTbTxGzPi3atOhVXolH2t+WQo+/oiqzDbyXbWtxGGVnauQJYRoGIEJIV1bk5BUq8LUjoy3bMQWWbWHGtoup2Y2C5+OOFdx/OzTHqD6pA+NOORnTnlXnvtym7bVEUmjtch8vTdUD3EkaLZtpUR6ObHqYxL945CuL7/Xn0b55gxB6gMBAPTssF2mD0MhtRSdu/NsK294/KxixsaILgbCEGRxhrtrikOeCuLuDqgz/Dh014UR+nHS7TvLRaDXAup771bw1/2vCpHmzv+gO0naZvoDudBpGYxZ7BUResB/KMq80Xj+GuEvCoK4S3O7yN3Gg== 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=l285+JTZtVMNbZ8+MYNvSt7IBq2CGiuTBd1qd9o2QUI=; b=VCOzB2C15gTCxdLJrEuZP/hgoIFYRwuDJgaF+Q0tcPRjH78UWkLvh9hvH438rcHybpBZxRGXzBV6RQok8+NpFcN82Kioc62urRMPEueieQG9w7lzlFqjJFYzaxvfTcjMUsWp4EJ/X1UoFwdlfUAQJERfD0h/rG7YtgG1sO+5QgcH0U98UBIrtjp9ZvFVca/TfUgniDwR6D1glmou/Ka41kdF60lc7HIcrK9h/TyFE0LZslf+7lP4uOom61es1PCcw+UzPccLXBKqyHv5ReMLaehu2Btr3wmdI7GWJ/r8yy/hQShdLJa6XBySu8pW3TTvgXeTGOqI8j6zanIZ7F+3og== 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=l285+JTZtVMNbZ8+MYNvSt7IBq2CGiuTBd1qd9o2QUI=; b=B2nf1CHmOkLRoTihv+zutHzmCxBqqJQj+wzdp3ylvL6YSaIddMmUJxoigfukYZJSIcP/KTZj5oFbbPzfmDPtIROHMkMte1LnQK6UQerPGp0iHMyziFv02x57T4K1TDvHb570v7i4EQ/etxwdBNvEcKET2xDIccTvk2Kh7zUQqhk= 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 SA1PR13MB6055.namprd13.prod.outlook.com (2603:10b6:806:338::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Sat, 28 Oct 2023 06:53:50 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::45b3:d83c:cff2:4a1b%6]) with mapi id 15.20.6933.022; Sat, 28 Oct 2023 06:53:50 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Peng Zhang Subject: [PATCH v2 04/11] net/nfp: remove the unneeded data abstraction Date: Sat, 28 Oct 2023 14:53:08 +0800 Message-Id: <20231028065315.1937188-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231028065315.1937188-1-chaoyong.he@corigine.com> References: <20231028061558.1842855-1-chaoyong.he@corigine.com> <20231028065315.1937188-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SA0PR11CA0020.namprd11.prod.outlook.com (2603:10b6:806:d3::25) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SA1PR13MB6055:EE_ X-MS-Office365-Filtering-Correlation-Id: ef35df98-6313-4f81-7fb7-08dbd782a3ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: weeFygDIP+FHMfwmm0pDmYMfoOJbscZTQwElJt1m1eQMuj3HdrtzedmWdi3kNoDGYYjzo4e9wHBZaVywOGlGFx7OIonHOJ86/wFtQiFZKHGNcyo4AeZ0CR0iuTU58dy82vJ+y6bYC4yqpluEipODhbY54gisrckA206dM+1I7gYZMRgjf8uZVoJ6EKWDyTTVsMkUwpkHPQqw484LjJ5tVBsfr0YtEWek9z/qz5EJM2G+mD6naZaqeh5UyBLtQxrwN8vXOrGMRyFHE9W+QSanDe0dICX60TXyrbOJV+sRo6Y6jMhI9+JIML6j2CYEjimYUSczW5YD6eaU68VInWKrUCBo/UBv4S8rrvtzamk8laq1JEVh6OzWGvK7+4Y8C1sAc3e1ov0uk5sk2RvnCvu5c2k2zjEmYOvkHVSUBpRUEEPSAuTzg5H8xamXcD1thPomPTPc+56Wbu+NI4gF1x709IjoqH+LrAsHN9F1Arsidxb8sXCgF4ew23lMHFckekVmRWVky9Vpyez+cfbmhgD9eD0hrz8D+rW76g13kDTOOdo3bAsAJngXW9LWsG3D+QlbHxvJSEe8ck/wi1vf5XbTplfaDj/FDenUzmwZ9Y9tHdCf1kPz/XNBz+oSmWWhramH+uLLVHeEnT46l6DtJ+w0/SYd7/aNHBZb13f9N/0BnaU= 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)(346002)(136003)(396003)(366004)(39830400003)(376002)(230922051799003)(451199024)(1800799009)(64100799003)(186009)(6486002)(8676002)(30864003)(8936002)(478600001)(6666004)(54906003)(66476007)(66946007)(66556008)(86362001)(4326008)(41300700001)(5660300002)(6916009)(2906002)(44832011)(316002)(6506007)(52116002)(38100700002)(36756003)(2616005)(1076003)(107886003)(6512007)(26005)(38350700005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?pV9xbrfKdSN59pRabpprlPI7eb4pkaNGScnfZtWU4wrSITFt4O52H5rCx5XI?= =?us-ascii?Q?5RKIbQXoryz70lSasCd+NC+YGOuDboLGR9wBJkvCpDXarHH3XVwRRHp/N4TJ?= =?us-ascii?Q?9+TqGHpKhjMzSuNTMBois/JQSItvS37HXGHmGuZCO/n8PC0NDPn1xtm/ebQ4?= =?us-ascii?Q?1+tAvQ8PmTq5ToouPtOZCSeZRqwH5X1tJA/OUYFnC2gpvWR6KWzPiP7j5RB5?= =?us-ascii?Q?fG/hd1HvkJXTk1PMhT+lbLf0nWZu8NM2FPigYf8XheXis1QUVGgfnZeUiWHp?= =?us-ascii?Q?3V61KV+ebJXTGLTvIPKIy92WPBgG6Ran6CjwET3lPeYGGMUb8q5NeWvXqJXm?= =?us-ascii?Q?3Of/5jzxL1ZseFZQN7KNk7CllZapZtlA8Va9bYSofoMffJUg/BA7bQx8JwI1?= =?us-ascii?Q?TG40s/7B1AdL1T5MYzE0/6Vm0NyRRKMYyTGJmRVimGNr8+ZTMS+3BLJsQLxJ?= =?us-ascii?Q?SYR6HfQNef1tIcx7kSvINvhTJFHQqfnTZCQ92eJNL3ShwryodP2zQe7krqMJ?= =?us-ascii?Q?UbHlWPvzzlY351A4RAu+C/bp/7ncvnOyH0nxawcWhjYDytx8J73yhoiyMgG5?= =?us-ascii?Q?/hSYSSl5+/q1ugzfHsjMe94ybfx306+aYdWip1Ciizx41Wn9mZKRqyiyEDP1?= =?us-ascii?Q?IU/v6xRDL4mLkcmOBIafnIboRBpNKIG19JSfzrbURaDgK70HpulhH9wMTpoR?= =?us-ascii?Q?js6FZouFSKVtUzaDAjoEGLJ1o7OEpf3k7TJE0oTBgSk5oOBVTueNpsQISZ2j?= =?us-ascii?Q?LgnkDF4UIqCK6mSCc3yRvDxTRKzmo15J3ZvQ9yB1a3k2YCMvMi9OTcRakRZc?= =?us-ascii?Q?Kx6xPsDVLKuITH5fwvsMkCPeTOueQ/Uy70gogXuSrD9zAduF0FrDoiiDXOYV?= =?us-ascii?Q?yxDz/z+RfpZAwsIn+7y8EJBjuje1rWZyqeESQs1K1pVCLL1ENKeZzwDYbp5Z?= =?us-ascii?Q?fBN11R/SwimDsgUujr0fu4nFemh8d7hhABqWhrVcDVwAsfVNf7IRgsbruelg?= =?us-ascii?Q?Is3QVndZrzFW7wdgJTvcBi6UqJF1M26jR62jVxUKSh56pjcrf/MGLs7NJF+L?= =?us-ascii?Q?FgxjeYpYY4eeX2xi3r03sRxBCgNOwBA7L9nJDPHrCtuitDoGxx5Z4iV5cX6i?= =?us-ascii?Q?M1BET/FGDqxxVvC1DNhM3VDHvM/bQlb+JEK3QGz13W3kQKty/zz01pO+RPTJ?= =?us-ascii?Q?/0ZSHmoZGw77ONQvBl8EzVzCETcMAjiyd8xCHCAdqlyxNGZNw4FXhTYEpiSO?= =?us-ascii?Q?G19kQ43NBsulYe6I75DWVsOsfK+OV8+GUn3CkJaMIpeqDTRYEkSnyWJE9DQQ?= =?us-ascii?Q?1Q6YjG07HryEIdmGUKmt8P5caeC+eLrru92nIeWDNEEadL1x2ie6dWeLlpmE?= =?us-ascii?Q?2P4Wvv+RVIXuFnX8oOiltnGMwFSGtbt+TQzDLGbHqQhwYwaqw0EUQJSuYdGC?= =?us-ascii?Q?I1yaCS/nhIeQym6bbdeGnjEgbrxJ4VcU6DxILsJL09YEB5l5WvM4kdJfjmkY?= =?us-ascii?Q?NLX8cBgu8vk25k0P01I6aZJkyQJ9fkxYFxcPE1Fi+/Xl9+ONVN85QdWxedo4?= =?us-ascii?Q?HD4Rqq7OtnmHDKlgD1bn4v6jxnzgB1SaYF8AnTPZ9otXMFZgq2QxSLdYjJ//?= =?us-ascii?Q?nw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef35df98-6313-4f81-7fb7-08dbd782a3ee X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2023 06:53:50.2158 (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: 6K1KB37XLIVbuujNkNPkGy9GxUsYL3Onci0xOUTKv/9CLccHz9kuGqvz8fwME7dBO49BUiTtrieJoNdfn+++9FSq3njfD54CyRgfI4Jwa1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR13MB6055 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 The data structure 'struct nfp_net_adapter' has only one data field and we won't extend it in the future, which makes this abstraction unneeded, so remove this data structure and the related macro 'NFP_NET_DEV_PRIVATE_TO_HW'. Signed-off-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower.c | 2 +- drivers/net/nfp/nfd3/nfp_nfd3_dp.c | 2 +- drivers/net/nfp/nfdk/nfp_nfdk_dp.c | 2 +- drivers/net/nfp/nfp_ethdev.c | 18 ++++----- drivers/net/nfp/nfp_ethdev_vf.c | 6 +-- drivers/net/nfp/nfp_ipsec.c | 18 ++++----- drivers/net/nfp/nfp_net_common.c | 57 ++++++++++++++--------------- drivers/net/nfp/nfp_net_common.h | 3 -- drivers/net/nfp/nfp_net_ctrl.c | 2 +- drivers/net/nfp/nfp_rxtx.c | 4 +- 10 files changed, 55 insertions(+), 59 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index f3fedbf7e5..246dd2d454 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -848,7 +848,7 @@ nfp_init_app_fw_flower(struct nfp_pf_dev *pf_dev, } /* Allocate memory for the PF AND ctrl vNIC here (hence the * 2) */ - pf_hw = rte_zmalloc_socket("nfp_pf_vnic", 2 * sizeof(struct nfp_net_adapter), + pf_hw = rte_zmalloc_socket("nfp_pf_vnic", 2 * sizeof(struct nfp_net_hw), RTE_CACHE_LINE_SIZE, numa_node); if (pf_hw == NULL) { PMD_INIT_LOG(ERR, "Could not malloc nfp pf vnic"); diff --git a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c index c85fadc80d..3f9909c6e0 100644 --- a/drivers/net/nfp/nfd3/nfp_nfd3_dp.c +++ b/drivers/net/nfp/nfd3/nfp_nfd3_dp.c @@ -377,7 +377,7 @@ nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_free_thresh; const struct rte_memzone *tz; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc); diff --git a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c index 10e6982c95..fe87ea3e25 100644 --- a/drivers/net/nfp/nfdk/nfp_nfdk_dp.c +++ b/drivers/net/nfp/nfdk/nfp_nfdk_dp.c @@ -454,7 +454,7 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, struct nfp_net_txq *txq; const struct rte_memzone *tz; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; nfp_net_tx_desc_limits(hw, &min_tx_desc, &max_tx_desc); diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 0fed0ef72d..8e69fa67b2 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -55,7 +55,7 @@ nfp_net_start(struct rte_eth_dev *dev) struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_intr_handle *intr_handle = pci_dev->intr_handle; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private); app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv); hw = &net_hw->super; @@ -201,7 +201,7 @@ nfp_net_stop(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; nfp_net_disable_queues(dev); @@ -224,7 +224,7 @@ nfp_net_set_link_up(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; if (rte_eal_process_type() == RTE_PROC_PRIMARY) /* Configure the physical port down */ @@ -239,7 +239,7 @@ nfp_net_set_link_down(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; if (rte_eal_process_type() == RTE_PROC_PRIMARY) /* Configure the physical port down */ @@ -262,7 +262,7 @@ nfp_net_close(struct rte_eth_dev *dev) return 0; pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private); - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; pci_dev = RTE_ETH_DEV_TO_PCI(dev); app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv); @@ -350,7 +350,7 @@ nfp_udp_tunnel_port_add(struct rte_eth_dev *dev, struct nfp_net_hw *hw; enum rte_eth_tunnel_type tnl_type; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; vxlan_port = tunnel_udp->udp_port; tnl_type = tunnel_udp->prot_type; @@ -388,7 +388,7 @@ nfp_udp_tunnel_port_del(struct rte_eth_dev *dev, struct nfp_net_hw *hw; enum rte_eth_tunnel_type tnl_type; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; vxlan_port = tunnel_udp->udp_port; tnl_type = tunnel_udp->prot_type; @@ -828,7 +828,7 @@ nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev, goto port_cleanup; } - hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + hw = eth_dev->data->dev_private; /* Add this device to the PF's array of physical ports */ app_fw_nic->ports[i] = hw; @@ -1067,7 +1067,7 @@ nfp_secondary_init_app_fw_nic(struct rte_pci_device *pci_dev, } eth_dev->process_private = cpp; - hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + hw = eth_dev->data->dev_private; nfp_net_ethdev_ops_mount(hw, eth_dev); rte_eth_dev_probing_finish(eth_dev); diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index e24fec861d..cb8a37bce7 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -66,7 +66,7 @@ nfp_netvf_start(struct rte_eth_dev *dev) new_ctrl = nfp_check_offloads(dev); /* Writing configuration parameters in the device */ - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; nfp_net_params_setup(net_hw); @@ -258,7 +258,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) return -ENODEV; } - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + net_hw = eth_dev->data->dev_private; net_hw->dev_info = dev_info; hw = &net_hw->super; @@ -393,7 +393,7 @@ static int nfp_vf_pci_probe(struct rte_pci_device *pci_dev) { return rte_eth_dev_pci_generic_probe(pci_dev, - sizeof(struct nfp_net_adapter), nfp_netvf_init); + sizeof(struct nfp_net_hw), nfp_netvf_init); } static int diff --git a/drivers/net/nfp/nfp_ipsec.c b/drivers/net/nfp/nfp_ipsec.c index 7e26977dc1..9a0ae89af3 100644 --- a/drivers/net/nfp/nfp_ipsec.c +++ b/drivers/net/nfp/nfp_ipsec.c @@ -579,7 +579,7 @@ nfp_aead_map(struct rte_eth_dev *eth_dev, const uint32_t *key; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + net_hw = eth_dev->data->dev_private; device_id = net_hw->device_id; offset = 0; @@ -667,7 +667,7 @@ nfp_cipher_map(struct rte_eth_dev *eth_dev, const uint32_t *key; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + net_hw = eth_dev->data->dev_private; device_id = net_hw->device_id; switch (cipher->algo) { @@ -808,7 +808,7 @@ nfp_auth_map(struct rte_eth_dev *eth_dev, return -EINVAL; } - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + net_hw = eth_dev->data->dev_private; device_id = net_hw->device_id; digest_length = digest_length << 3; @@ -1082,7 +1082,7 @@ nfp_crypto_create_session(void *device, sa_idx = -1; eth_dev = device; priv_session = SECURITY_GET_SESS_PRIV(session); - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + net_hw = eth_dev->data->dev_private; if (net_hw->ipsec_data->sa_free_cnt == 0) { PMD_DRV_LOG(ERR, "No space in SA table, spi: %d", conf->ipsec.spi); @@ -1163,7 +1163,7 @@ nfp_security_set_pkt_metadata(void *device, sqn = params; eth_dev = device; priv_session = SECURITY_GET_SESS_PRIV(session); - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + net_hw = eth_dev->data->dev_private; if (priv_session->ipsec.direction == RTE_SECURITY_IPSEC_SA_DIR_EGRESS) { struct nfp_tx_ipsec_desc_msg *desc_md; @@ -1236,7 +1236,7 @@ nfp_security_session_get_stats(void *device, memset(&msg, 0, sizeof(msg)); msg.cmd = NFP_IPSEC_CFG_MSG_GET_SA_STATS; msg.sa_idx = priv_session->sa_index; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + net_hw = eth_dev->data->dev_private; ret = nfp_ipsec_cfg_cmd_issue(net_hw, &msg); if (ret < 0) { @@ -1288,7 +1288,7 @@ nfp_crypto_remove_sa(struct rte_eth_dev *eth_dev, struct nfp_ipsec_msg cfg; sa_index = priv_session->sa_index; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + net_hw = eth_dev->data->dev_private; cfg.cmd = NFP_IPSEC_CFG_MSG_INV_SA; cfg.sa_idx = sa_index; @@ -1380,7 +1380,7 @@ nfp_ipsec_init(struct rte_eth_dev *dev) struct nfp_net_hw *net_hw; struct nfp_net_ipsec_data *data; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; cap_extend = net_hw->super.cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) == 0) { @@ -1427,7 +1427,7 @@ nfp_ipsec_uninit(struct rte_eth_dev *dev) struct nfp_net_hw *net_hw; struct nfp_ipsec_session *priv_session; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; cap_extend = net_hw->super.cap_ext; if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) == 0) { diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index ac97e3bed5..10f6298f74 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -252,7 +252,7 @@ nfp_net_configure(struct rte_eth_dev *dev) struct rte_eth_rxmode *rxmode; struct rte_eth_txmode *txmode; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; dev_conf = &dev->data->dev_conf; rxmode = &dev_conf->rxmode; txmode = &dev_conf->txmode; @@ -329,7 +329,7 @@ nfp_net_enable_queues(struct rte_eth_dev *dev) { struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; nfp_enable_queues(&hw->super, dev->data->nb_rx_queues, dev->data->nb_tx_queues); @@ -340,7 +340,7 @@ nfp_net_disable_queues(struct rte_eth_dev *dev) { struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; nfp_disable_queues(&net_hw->super); } @@ -367,7 +367,7 @@ nfp_net_set_mac_addr(struct rte_eth_dev *dev, struct nfp_hw *hw; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; if ((hw->ctrl & NFP_NET_CFG_CTRL_ENABLE) != 0 && (hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) == 0) { @@ -407,7 +407,7 @@ nfp_configure_rx_interrupt(struct rte_eth_dev *dev, return -ENOMEM; } - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; if (rte_intr_type_get(intr_handle) == RTE_INTR_HANDLE_UIO) { PMD_DRV_LOG(INFO, "VF: enabling RX interrupt with UIO"); @@ -443,7 +443,7 @@ nfp_check_offloads(struct rte_eth_dev *dev) struct nfp_net_hw *hw; struct rte_eth_conf *dev_conf; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; cap = hw->super.cap; dev_conf = &dev->data->dev_conf; @@ -516,7 +516,7 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev) repr = dev->data->dev_private; net_hw = repr->app_fw_flower->pf_hw; } else { - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; } hw = &net_hw->super; @@ -551,7 +551,7 @@ nfp_net_promisc_disable(struct rte_eth_dev *dev) struct nfp_hw *hw; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; if ((hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) == 0) { @@ -588,7 +588,7 @@ nfp_net_link_update(struct rte_eth_dev *dev, struct rte_eth_link link; struct nfp_eth_table *nfp_eth_table; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; memset(&link, 0, sizeof(struct rte_eth_link)); @@ -654,7 +654,7 @@ nfp_net_stats_get(struct rte_eth_dev *dev, if (stats == NULL) return -EINVAL; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; memset(&nfp_dev_stats, 0, sizeof(nfp_dev_stats)); @@ -732,7 +732,7 @@ nfp_net_stats_reset(struct rte_eth_dev *dev) uint16_t i; struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; /* Reading per RX ring stats */ for (i = 0; i < dev->data->nb_rx_queues; i++) { @@ -794,7 +794,7 @@ nfp_net_xstats_size(const struct rte_eth_dev *dev) const uint32_t size = RTE_DIM(nfp_net_xstats); /* If the device is a VF, then there will be no MAC stats */ - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; if (hw->mac_stats == NULL) { for (count = 0; count < size; count++) { if (nfp_net_xstats[count].group == NFP_XSTAT_GROUP_MAC) @@ -828,7 +828,7 @@ nfp_net_xstats_value(const struct rte_eth_dev *dev, struct nfp_net_hw *hw; struct nfp_xstat xstat; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; xstat = nfp_net_xstats[index]; if (xstat.group == NFP_XSTAT_GROUP_MAC) @@ -967,7 +967,7 @@ nfp_net_xstats_reset(struct rte_eth_dev *dev) uint32_t read_size; struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; read_size = nfp_net_xstats_size(dev); for (id = 0; id < read_size; id++) { @@ -1015,7 +1015,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) uint16_t max_tx_desc; struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_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); @@ -1220,7 +1220,7 @@ nfp_net_supported_ptypes_get(struct rte_eth_dev *dev) if (dev->rx_pkt_burst != nfp_net_recv_pkts) return NULL; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; if ((net_hw->super.cap_ext & NFP_NET_CFG_CTRL_PKT_TYPE) == 0) return NULL; @@ -1242,7 +1242,7 @@ nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, /* Make sure all updates are written before un-masking */ rte_wmb(); - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; nn_cfg_writeb(&hw->super, NFP_NET_CFG_ICR(base + queue_id), NFP_NET_CFG_ICR_UNMASKED); return 0; @@ -1263,7 +1263,7 @@ nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, /* Make sure all updates are written before un-masking */ rte_wmb(); - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; nn_cfg_writeb(&hw->super, NFP_NET_CFG_ICR(base + queue_id), NFP_NET_CFG_ICR_RXTX); return 0; @@ -1301,7 +1301,7 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev) struct nfp_net_hw *hw; struct rte_pci_device *pci_dev; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; pci_dev = RTE_ETH_DEV_TO_PCI(dev); /* Make sure all updates are written before un-masking */ @@ -1376,7 +1376,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, { struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; /* MTU setting is forbidden if port is started */ if (dev->data->dev_started) { @@ -1412,9 +1412,8 @@ nfp_net_vlan_offload_set(struct rte_eth_dev *dev, struct nfp_net_hw *net_hw; uint32_t rxvlan_ctrl = 0; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; - rx_offload = dev->data->dev_conf.rxmode.offloads; new_ctrl = hw->ctrl; @@ -1463,7 +1462,7 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev, struct nfp_hw *hw; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) { @@ -1519,7 +1518,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev, struct nfp_hw *hw; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) @@ -1552,7 +1551,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev, struct nfp_hw *hw; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) @@ -1602,7 +1601,7 @@ nfp_net_rss_hash_write(struct rte_eth_dev *dev, struct nfp_net_hw *net_hw; uint32_t cfg_rss_ctrl = 0; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; /* Writing the key byte by byte */ @@ -1658,7 +1657,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev, struct nfp_hw *hw; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; rss_hf = rss_conf->rss_hf; @@ -1699,7 +1698,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, uint32_t cfg_rss_ctrl; struct nfp_net_hw *net_hw; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; hw = &net_hw->super; if ((hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY) == 0) @@ -1987,7 +1986,7 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev, if (fw_size < FW_VER_LEN) return FW_VER_LEN; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; snprintf(vnic_version, FW_VER_LEN, "%d.%d.%d.%d", hw->ver.extend, hw->ver.class, diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 6607175460..a23b5be968 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -238,9 +238,6 @@ int nfp_net_firmware_version_get(struct rte_eth_dev *dev, char *fw_version, size int nfp_repr_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); -#define NFP_NET_DEV_PRIVATE_TO_HW(adapter)\ - (&((struct nfp_net_adapter *)adapter)->hw) - #define NFP_NET_DEV_PRIVATE_TO_PF(dev_priv)\ (((struct nfp_net_hw *)dev_priv)->pf_dev) diff --git a/drivers/net/nfp/nfp_net_ctrl.c b/drivers/net/nfp/nfp_net_ctrl.c index 5135a1ad27..ea14b98924 100644 --- a/drivers/net/nfp/nfp_net_ctrl.c +++ b/drivers/net/nfp/nfp_net_ctrl.c @@ -31,7 +31,7 @@ nfp_net_tlv_caps_parse(struct rte_eth_dev *dev) struct nfp_net_hw *net_hw; struct nfp_net_tlv_caps *caps; - net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + net_hw = dev->data->dev_private; caps = &net_hw->tlv_caps; nfp_net_tlv_caps_reset(caps); diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 644be2700e..38ce83aa46 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -840,7 +840,7 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, struct nfp_net_rxq *rxq; const struct rte_memzone *tz; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; nfp_net_rx_desc_limits(hw, &min_rx_desc, &max_rx_desc); @@ -1067,7 +1067,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, { struct nfp_net_hw *hw; - hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + hw = dev->data->dev_private; if (hw->ver.extend == NFP_NET_CFG_VERSION_DP_NFD3) return nfp_net_nfd3_tx_queue_setup(dev, queue_idx, -- 2.39.1