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 4A84243220; Sat, 28 Oct 2023 08:54:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 069A140A6C; Sat, 28 Oct 2023 08:53:57 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2111.outbound.protection.outlook.com [40.107.101.111]) by mails.dpdk.org (Postfix) with ESMTP id 151E140A80 for ; Sat, 28 Oct 2023 08:53:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vwg/yQ4CgVyW8ufzrOAFmi9D2OSRW6+tSZifrSVGuoHCsSDYPLMORiwZjp2Lpj99D72S7YzVLp3fD7ooC9WlTAKku68eeAMjoDESk56vwUQ6vF+sih8eGdUhJ5bpHus+gQmhn278FbYY+j2ewbvBKmL2zjRQjCHQuWMLxkYZZeKEdRxf6F2wm0uOodNKrKBUzReOfgOV0tbQh7p+XIQ0shkooKkEFI+Gb7Ds6HT5JRafIz0CoFJMvLcvVU27HlmNqJm0Imnlha7DRLQ3wmUA/TRl4wUHU/5NnWEpBAvx2KCanQcOcKVQqYjkft4b8ZVs+SJaKvhC151OKvzrfCMiog== 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=KJpjF7bfYGXtbib0Z+5st78XzovLgPHBjHhvlpPssak=; b=C0eR0OQn8ZORpVKKgU9nafX0R9hqHDPCMI0E0bU4Rn70Jf1uUD23MV5XkNhwCkO29OdAJv3oFmsk1VVfwzEeIvwWsgZo6P0v4jjI7m1/6L8gac30dhZg17jUs+V+dTquqWIXMg72OO9f1MZyBIyv/Myr5zr/AlQj/KYmBOyHhnoQ9isUnddzvu2x/WgWu61zee6MNOQLE1OHHOc8fr+MNUmCvRd3QYxjQB3i9cbjx+PTFrgI7lAK9CZ+gkL5sREVj87bdHvYzynNLAmAXxKQRGG80C7Idsewr2mdRxYe4CpfX11JYMIXJ8VNnum/aq+DCzZALxhiXeC1YRm8bp29Fg== 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=KJpjF7bfYGXtbib0Z+5st78XzovLgPHBjHhvlpPssak=; b=D2AaeM+lE6IUE+yfck0hhOH2LhIzst1N9RyZdcXyz5CQaQIbnYFVcDZCpBzu6rEQXTmj5YxrkMkEp/QEiIMIKTc0K1GyuTBn6agI6wmSrOjiyAU/vXRCDYW7A3oRBNUioqeRrxJsWPT/gSjSjdHzhwv+MBQje+w37fhp+3CegzM= 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:52 +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:52 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Peng Zhang Subject: [PATCH v2 05/11] net/nfp: remove the redundancy macro Date: Sat, 28 Oct 2023 14:53:09 +0800 Message-Id: <20231028065315.1937188-6-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: 2217b066-3636-4955-242e-08dbd782a535 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SDIslHMF9SXvAEgN3Gsh0A7xG2xArq1aWvYLb0q8A2CxqcbvYS3822WqTY/hqXNK8skwzSXHNHqPBH1M3Bey3coLW1vsiq2tsQo5VCVwlqHMNsaTNfujQ22SeY9ZN7hGcUTD43CmB1s82m6bKqIxPityKNUQhwlhUNPB0GiLaV5f85Ot0ASZ9YFEvzOI/vEgi2kbP8A6cdz5HCGiOzULXEZyItIoJIeey5U9q5dLuv+hidxN5UJl833MA5pk1LD5r670FwOKlMzG1rT7edniArI7F7VqhA4DG3iFbdImBXFuH9uf2EL9RaGQ7zz6hTMgonKKozlqDmlHYZ09ezfAn9eaOueMhzY18WhYTUBt1+mNOIBacDBJU4P1F0ecl0GIMB/Ld3DjyweskintihljX5P5BI/AI11YD4DksRz31/lBd8vAkzGaeBbFhmg6bZSLn/lrrU5Cgr9wdNQKcjlXrlMxyFZCwZz/o7Sv13u2u84rLQenKP33Q89z1HXXcukPmsTxCeYBJ43zAw6QhgWpyRWXtbZKfL5F1hTCsH5X3Azxl0XA5FTmuVar8Q7qwBDnwIesOJEhWUYpOmZqvwCBykvMT0Zumo8JVcVrdPNPtb8hdt3PNNi5dQGUMz71/UO+BevHSR6sG2YyuO/5OX/V1Hf25ouEFrYcCue4xK3IWYY= 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)(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?Qixz6Ndp+PD+PNP9ReAHGd03QV6WO3vJTvztzLHnYsLYJ2xKsMKelzVSZ5KQ?= =?us-ascii?Q?mFV7YXMlSSQpdC30MX3zKS/nSt1K5nAJh7W6FthiPeZTMSHXGTH2/FTMf1RC?= =?us-ascii?Q?IfvkumCcuiaAy9dRjDq1zn7LbizTN6Drnte0yl15kgI2RFgd8lAUY/GY1PXD?= =?us-ascii?Q?8lyPv1KRp1vxbMvBiMEy1LB3NcZdUbjn0cd+k9BwWorfOyHSIE2/ijAGbLBB?= =?us-ascii?Q?SLGBWvxS8XV1S8gOWvLeayTBGKu748zjL0/kultrytytQXEFhq/Q5znYVCXW?= =?us-ascii?Q?iy51KuT138+tGzWtO86uFXzLRSIP+KyUjhr5wmGC3RrV47O7IU1UpzHKnGr0?= =?us-ascii?Q?U3ep5QbSzSXOEcxL2/KeovvtBTfMH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Xh9?= =?us-ascii?Q?S8EQcxeYxqJ3pPkAHz9LggzLUkg/BWlk7SfVC3aqoVvKFSzfft+2nK4a3vxV?= =?us-ascii?Q?wxfGjNEwxMxAUJqU0NexeXMeEOmoESQ5srqGit4aDImAN4GK+pSHtuEtKRqu?= =?us-ascii?Q?fiCTHEaAWUHh1DyJJU13tRPTd5n056VptLvBKKzlzPABAqRr4tmwPem6yDY4?= =?us-ascii?Q?dEf0CzGS4fSK1l5R4Lfd5kAw+++7PQBn0UubnaeaXN+hk4fX2jdcmCSQDLJp?= =?us-ascii?Q?gMFgTFHgO4xbH7nI+w5Mpo5AZ0tMZDc37AcdUMGkqvUV3oYI11iG8i1R7C3y?= =?us-ascii?Q?VPvYLCq0Btth3rEwC1SS7aJgRce2CAlnlR9Px8YuNZQfIk2f9wj4SgkKsH6h?= =?us-ascii?Q?YQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2217b066-3636-4955-242e-08dbd782a535 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:52.3461 (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: 4p6GEmCP15YjT1KuXBP3Z3LbqXiKRltDWOaieSkBH2P2vhx4vOrEY72NKGq/t+wfL/mGpO4vVoaHHuWtN5pJHa5dwA5jGVJ2q/otWEwqnE4= 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 Macro 'NFP_HASH_OFFSET' and 'NFP_HASH_TYPE_OFFSET' are unused, so remove them. Macro 'NFP_MAX_PHYPORTS' and 'MAX_FLOWER_PHYPORTS' are redundancy, so just keep the first one. Macro 'NFP_NET_CFG_SPARE_ADDR', 'NFP_NET_CFG_RX_OFFSET_ADDR' and 'NFP_NET_CFG_RX_OFFSET' are redundancy, we just keep the final one. Remove the unneeded macro 'NFP_NET_DEV_PRIVATE_TO_PF', and adjust the related logic, to make it easier to read. Signed-off-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/common/nfp/nfp_common_ctrl.h | 17 ----------------- drivers/net/nfp/flower/nfp_flower.h | 3 +-- drivers/net/nfp/nfp_ethdev.c | 12 ++++-------- drivers/net/nfp/nfp_net_common.c | 2 +- drivers/net/nfp/nfp_net_common.h | 3 --- drivers/net/nfp/nfp_rxtx.h | 3 --- 6 files changed, 6 insertions(+), 34 deletions(-) diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h index f92ce50fc0..7033c8ea00 100644 --- a/drivers/common/nfp/nfp_common_ctrl.h +++ b/drivers/common/nfp/nfp_common_ctrl.h @@ -196,11 +196,6 @@ struct nfp_net_fw_ver { #define NFP_NET_CFG_START_TXQ 0x0048 #define NFP_NET_CFG_START_RXQ 0x004c -/* - * NFP-3200 workaround (0x0050 - 0x0058) - * @NFP_NET_CFG_SPARE_ADDR: DMA address for ME code to use (e.g. YDS-155 fix) - */ -#define NFP_NET_CFG_SPARE_ADDR 0x0050 /* * NFP6000/NFP4000 - Prepend configuration */ @@ -210,18 +205,6 @@ struct nfp_net_fw_ver { /* Start anchor of the TLV area */ #define NFP_NET_CFG_TLV_BASE 0x0058 -/** - * Reuse spare address to contain the offset from the start of - * the host buffer where the first byte of the received frame - * will land. Any metadata will come prior to that offset. If the - * value in this field is 0, it means that the metadata will - * always land starting at the first byte of the host buffer and - * packet data will immediately follow the metadata. As always, - * the RX descriptor indicates the presence or absence of metadata - * along with the length thereof. - */ -#define NFP_NET_CFG_RX_OFFSET_ADDR 0x0050 - #define NFP_NET_CFG_VXLAN_PORT 0x0060 #define NFP_NET_CFG_VXLAN_SZ 0x0008 diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h index 7d442e3cb2..a989c4a8b8 100644 --- a/drivers/net/nfp/flower/nfp_flower.h +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -31,7 +31,6 @@ */ #define FLOWER_PKT_DATA_OFFSET (NFP_NET_META_HEADER_SIZE + NFP_NET_META_FIELD_SIZE) -#define MAX_FLOWER_PHYPORTS 8 #define MAX_FLOWER_VFS 64 /* Forward declaration */ @@ -78,7 +77,7 @@ struct nfp_app_fw_flower { uint64_t ctrl_vnic_tx_count; /** Array of phyport representors */ - struct nfp_flower_representor *phy_reprs[MAX_FLOWER_PHYPORTS]; + struct nfp_flower_representor *phy_reprs[NFP_MAX_PHYPORTS]; /** Array of VF representors */ struct nfp_flower_representor *vf_reprs[MAX_FLOWER_VFS]; diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 8e69fa67b2..7c5b780e82 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -56,7 +56,7 @@ nfp_net_start(struct rte_eth_dev *dev) struct rte_intr_handle *intr_handle = pci_dev->intr_handle; net_hw = dev->data->dev_private; - pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private); + pf_dev = net_hw->pf_dev; app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv); hw = &net_hw->super; @@ -261,8 +261,8 @@ nfp_net_close(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(dev->data->dev_private); hw = dev->data->dev_private; + pf_dev = hw->pf_dev; pci_dev = RTE_ETH_DEV_TO_PCI(dev); app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv); @@ -482,9 +482,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev) struct nfp_app_fw_nic *app_fw_nic; pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + net_hw = eth_dev->data->dev_private; /* Use backpointer here to the PF of this eth_dev */ - pf_dev = NFP_NET_DEV_PRIVATE_TO_PF(eth_dev->data->dev_private); + pf_dev = net_hw->pf_dev; /* Use backpointer to the CoreNIC app struct */ app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv); @@ -495,11 +496,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) return -ENODEV; } - /* - * Use PF array of physical ports to get pointer to - * this specific port. - */ - net_hw = app_fw_nic->ports[port]; hw = &net_hw->super; PMD_INIT_LOG(DEBUG, "Working with physical port number: %hu, " diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 10f6298f74..d43a071a42 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -1172,7 +1172,7 @@ nfp_net_common_init(struct rte_pci_device *pci_dev, if (hw->ver.major < 2) hw->rx_offset = NFP_NET_RX_OFFSET; else - hw->rx_offset = nn_cfg_readl(&hw->super, NFP_NET_CFG_RX_OFFSET_ADDR); + hw->rx_offset = nn_cfg_readl(&hw->super, NFP_NET_CFG_RX_OFFSET); hw->super.ctrl = 0; hw->stride_rx = stride; diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index a23b5be968..829e9c5333 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_PF(dev_priv)\ - (((struct nfp_net_hw *)dev_priv)->pf_dev) - #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\ ((struct nfp_app_fw_nic *)app_fw_priv) diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h index 956cc7a0d2..ff1019b690 100644 --- a/drivers/net/nfp/nfp_rxtx.h +++ b/drivers/net/nfp/nfp_rxtx.h @@ -10,9 +10,6 @@ #define NFP_DESC_META_LEN(d) ((d)->rxd.meta_len_dd & PCIE_DESC_RX_META_LEN_MASK) -#define NFP_HASH_OFFSET ((uint8_t *)mbuf->buf_addr + mbuf->data_off - 4) -#define NFP_HASH_TYPE_OFFSET ((uint8_t *)mbuf->buf_addr + mbuf->data_off - 8) - #define RTE_MBUF_DMA_ADDR_DEFAULT(mb) \ ((uint64_t)((mb)->buf_iova + RTE_PKTMBUF_HEADROOM)) -- 2.39.1