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 4F77943220; Sat, 28 Oct 2023 08:17:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0FAF4064C; Sat, 28 Oct 2023 08:16:38 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2090.outbound.protection.outlook.com [40.107.220.90]) by mails.dpdk.org (Postfix) with ESMTP id 72104402F1 for ; Sat, 28 Oct 2023 08:16:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mFn7kB6NLru8PWuYAbTGDKWEYJoZs0hRUSr1SJwDSbJ0KNkcQV+PrVOLFz0r2/ec2KWkhuryTUJIS/c5tilW7OtZFMXU1lPN1jhovKhqLyZaOeoq58+/UzQ0ywlml+0uMeXBcwCkoEa3tIh0Xnx+lBOKqG8nPyRoyQYch5vKKJfKP3r5T2sO8ke9+Qh0DLsywX/bUOh3vLFesBBej94FylcvGuOeUlRTJj8VhonTfUskXTKWL6PPfMEXw0lzB5Md9QX6lAwxxcyL+gGp4Tt9T9mR24FHC1WfWOsnCQAOeNNpTa3bKHqQB/jTDvhOLm8aKfpZRx80omiu+gN0Qzqp9A== 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=bmiCLlC6a5ilRc/crGtpsqo2qosj5CyVkTJiPAnfy/M=; b=YZcEDD1lVbhahiwz20dQch/Dkvf6rnL15UCMDX9Uz/aR6JuagQ8Vkv1z6Yz7Fgte1nEHkIN/qHwsX+7nfhSS8c0pbR+6qlYoU3WF4YqDeT/1VA7OZCtVbQqxAiRlDFOtwpXgYyzZNp5Qu18aZYKjyU/P37Nq0QQV6yh2I2fAtHtIfrC953+jd1oGBUTGT1GxB6ZM+Ha1u+vcowwZBIW6QZRDlXrgS+BVRKS7xTmsCxBmSj9Tkec7FaGWwDMTk1kBAGzPGU+3fqj//1/ds1dIq1QN2xbjXSwxURwTfZzh0ASCJRthsc0in1wZl4V6LLF1ekYDBpEo74mXKERbg7T3WA== 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=bmiCLlC6a5ilRc/crGtpsqo2qosj5CyVkTJiPAnfy/M=; b=j4WgeSm2d9w7GRLKq819ZeqtH1xIJCIRFUOsSx1IcUKTi/8ORg3JewUnTg36CiR4nIs8rG3/3pU0yHQkBX5DsGamC4ZPObapba+fels4sZklGHK1Xm33l3rhiV/LUHNnjykxt7bmN6wgnrcO4+SErZvIoOde3FY8Bn/Lr+EIk3w= 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 PH7PR13MB5551.namprd13.prod.outlook.com (2603:10b6:510:139::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.29; Sat, 28 Oct 2023 06:16:33 +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:16:33 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Peng Zhang Subject: [PATCH 04/11] net/nfp: remove the unneeded data abstraction Date: Sat, 28 Oct 2023 14:15:51 +0800 Message-Id: <20231028061558.1842855-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231028061558.1842855-1-chaoyong.he@corigine.com> References: <20231028061558.1842855-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0246.namprd03.prod.outlook.com (2603:10b6:a03:3a0::11) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB5551:EE_ X-MS-Office365-Filtering-Correlation-Id: 0858cd9e-0850-4b0f-a5cf-08dbd77d6ecb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ADym11w51hARrw2uu95AxeLhVSOfomw1HmBtTK2vwgP8iMySX0SaKwnZHQMo5Ln0tgFhGRpLd6LzlgnkSUVISWTGd7VJTX3M9EUuDfsiKSd4OdU4iD+ZDOnQ+NV1ku2YjR7hi4oEpkov3ClMQ5MEZG6VG78yoSjkg5dh8cLWi/SRsl9tf5HHmbHKTyqObKDOkXyKeo81Jza8gtzpE64ibjycIrHnOia0W+L7Gj5vKR7+H8vj0yKiimfOShazdsfsmgrOyN47//VNRl9+ogRvCi2Yue7KpkCHQuVsz5hcXxdPkSZ0ko1yBxzlQYUuLXDKuDVPU5lcODsiDNp3VNBtOYqqJAhDZbPDMF7nM94V/jb6+1FPBhNDw9Gh1KS5FV+TWrjPvVJe4d7L81TSOh/hCnYW/grztwFEXgraddzv00olY87bGF7SV+VhSNQ48najbH6YvcUPLAKibE4DS8VKAidznSFNqrS9J6H+CY483vUyK8d6TkqaRZQcGr4WTG7Uukn38wVD3BbDbUUjN/KDuTgJEXWwk/UCjkXYGq3dh/eMqEiTvAlECNpWFKg6Bf0raNQ/AbtcuHImnVF7EODhEvVkHtVi+h4y+ax9LFhBu3cAycu73AJX+gtWMKJhuLXATqDOU7mXtoHyefBP66a9dEOQ38FhQxnpzQYptJkGE0E= 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)(376002)(39830400003)(346002)(136003)(366004)(396003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(6512007)(54906003)(107886003)(6506007)(26005)(6666004)(52116002)(83380400001)(2906002)(44832011)(5660300002)(4326008)(8676002)(2616005)(6486002)(41300700001)(478600001)(30864003)(8936002)(66476007)(38100700002)(6916009)(316002)(66946007)(86362001)(66556008)(36756003)(1076003)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ijtp596mS7+bEYDgRY5hW+BGNR7gzQEGvUNJPwmxRsIQ0U2ueBJn37wVhRbb?= =?us-ascii?Q?Hz274bIQybd7hk7FVeSNZYq5oac5SWYNQor0cq/DEomWI1DlGq3FaRYYNlCD?= =?us-ascii?Q?gmziSQomGqJNDHbo2S9b8RElGKAuRtRtZ7Jf5xMrxvqGsnFoZZt/nEY10L6U?= =?us-ascii?Q?Xq37us3DoK6YJxU7gJFajVpvYX4sV70YPmljy89DH8by1MZA2GX+0TFRWcDg?= =?us-ascii?Q?pkVL0eCm5UArMiYgJBcs/D5DfqvxXtYjgNgam0RoPNRHJuRYr7oCzAch/mNG?= =?us-ascii?Q?E7022Hiscs7xJ73QU2jiNpFe9/12myEXcmWfQJ1qiGSQdsaGMFEEl0g0KcNm?= =?us-ascii?Q?idPgKTfESkYtCjjtTBIB/NI8DTTSjkGUTOX0/GoSyb586gkbc/ztN2p2JOCI?= =?us-ascii?Q?X5cT6WO7TErhNtPbuh1lVY54G1vkoCIQ/EDfntUOv7MvRnTPEN6nuHOWMjun?= =?us-ascii?Q?izW+6hmhVi/6/R4OxWn8KI6FMXbHMVc7bbNMFGrZ2AsreH6FlLI68CsGUVoQ?= =?us-ascii?Q?ATtbCNjdQzP40fJNpNTkqkJ9BOPqKsQB6c1H+HW995QGq2HrfJr42Zv279Jb?= =?us-ascii?Q?Yns2vvPg2wkel29PvvN1RFoK+91+QMd28qHhazbnAPMHc1vUMd5k3F/De8rU?= =?us-ascii?Q?tYI37yc/ESgqcp8tkVQd3yEvfbjXkndl8zHkOTyN6/aWznOgyuJ4xm/ngTDC?= =?us-ascii?Q?K+e7lbDHkv+QLt76n5sKlQsDT//mhoEY5NhI9mNYqzFuuKr/98/jARdDcJLJ?= =?us-ascii?Q?xnVc+buRHh43Sqk+TWP6MvMHQryzKY/i7mtnTJC+RiLneMwHkeWeTRU8fXRm?= =?us-ascii?Q?jVidNF5pSNE/obRK/lyq62IiTZVoR4sSmz46KsXMiW1zxaLhPcEWpxx7Bk4r?= =?us-ascii?Q?96G+nxd7KIRcJQoHgAxb8LVMzAHExQA7lCblmCym7hqaZwgXmvlHR9DwYarQ?= =?us-ascii?Q?satKJJzkj2kls5CjCAKt26j8RuPz2BC56idiw1PDnv3K6oesnoEN2HV+uhtf?= =?us-ascii?Q?G8Ts1QcwpzG8yyGHFOljuHIbJ6XCkHoITKXET9+vsoli3VGwvrz0tjD0uaCZ?= =?us-ascii?Q?geipyfziq7m8VIL26mwIrbbs/M05lQP1UEwMIheK5eVD5bW/J3bcj/o5UF5g?= =?us-ascii?Q?x8JhFQPRNpMlva0DO21Sno9SYHLOogAi+3jSwymdUYLPXCUeRPyNrnFwMd5J?= =?us-ascii?Q?9u5mQZv59q2fEk4IHwE3eNe2lRKqDRLuekCeWNkutWvFtVCFRculeB94eRjf?= =?us-ascii?Q?ganWsWS511DPCerUO0P1BKrEdJmvKHpntT9lH+xyzyDbg6SjvVTwwq8KTmLp?= =?us-ascii?Q?z3Jj9flJLyjY3LTfpZkktw9lmdvwGw2J2t7hgOoOi3VtEK5hSrLjMu4VOUNb?= =?us-ascii?Q?AlO/42o8JzwrLYi2hmIJAtfd5/B/Y0/UH/QQ8Hw/134mN4ARJIhFlBjqb4qY?= =?us-ascii?Q?1MtUTv9jyACQyw3ThBsugV0T6i9jVxbckmoC4F5LSuL/X7Qhrsf2zqSP9evg?= =?us-ascii?Q?ByVnqu3+Ihvui/Crvn2CcpGPVgXKDi7+1SLt+dUSLq+B+1R2vZXOQRzSSyG8?= =?us-ascii?Q?Wd5YKMxlfnrBpsi4tykzQUzxj8CyCgZTI/gGp2kncG4PdejngLwVTAg0JY9u?= =?us-ascii?Q?5Q=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0858cd9e-0850-4b0f-a5cf-08dbd77d6ecb 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:16:33.6014 (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: yRHAfe5rlDc3OA8tXZ1i4N0s2i35sKGHnY4IjAcGaNq46YxWxUF7tZJ3uiG/xYUEOTDm46ZWmiKuz0NrTMyJJN7TczTJlgouSMgNmLtrEtU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB5551 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 | 55 ++++++++++++++--------------- 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, 54 insertions(+), 58 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..1260b9a3b1 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); @@ -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