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 AF04743220; Sat, 28 Oct 2023 08:17:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 473B940A72; Sat, 28 Oct 2023 08:16:41 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2109.outbound.protection.outlook.com [40.107.92.109]) by mails.dpdk.org (Postfix) with ESMTP id 7A68A40272 for ; Sat, 28 Oct 2023 08:16:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bUuVX3ryGfYGV2/iyRgfgNTVrCItkfMITWIUsTbJOcH9fbsdnzWwarh85FWHQaCBX3wyCL8iGYetO4smq5T+o4EQLx3ng9HADreUo/UiT/8sQZuVyEOV3QS8lyelnSOtD8mob3LxDROaxbUqMtvxJ35RdMHQp4jSj0FIgyjrgir3kzx0HDIjQH/hc7mHAcMkhePiHj31AEJZLExezVbVbjA+pBbko92mcw+TnEdopYzV6Jfg16QPd04swNUOBHF+3wnxAbR+O+n34q2dYm79dgrcXeMj/GL7dJjBgtMP/DgC3inmIFOlNdExD6Z2q308qLC9RpGeW4mjoT5X6WyeSg== 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=Pn/RUNL7lb4adnuUlJRwjLrMsr8eF8KCBN+kVGo97D8=; b=JzT7sAf0T9rnfcPS3ecsirH01YMUQiRNY0/Lp41I0ydMwvLNyH2t+UGL6xaZeK5qex2a+4lvKkiMQzFt7S3jUTQRXueb3NaDYvHfBdEdMTzmeGX/6mrO52bha3gu2o2fp9ty6Sm5wglWiWxAFXtkNjFyT++e02kH7kA3avzanSOu0nKP7mm/9xi4L5gp7C92JZxDBevUXCdPaPB4TBv5VGDos/LA/tUwmRph6VhU18n5szIeavXyVGKN3656QZXYWVUgi6qWG/oCZQmvqob8Pb44Bc9PyGOkVwDxcd+8OcL/TzA++5RpuzT0vgc5BDwcv7o8C3lV+bkcTC34UdlDLw== 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=Pn/RUNL7lb4adnuUlJRwjLrMsr8eF8KCBN+kVGo97D8=; b=i0AkK2wrltYZTZZIwbR35l/JAWXaEA/aTpFnXxr6mJFTWFmSOYcQ73kl9x7kRLJcndXytPt5eV8K8Od7eiVXdj09WG6IueBHUjv45e700xj+wQ+0xPHZrH6NZVkkOdKJ6+ybCRerUn0GMb3rX2HnC0DkiNW3QszOvtKFxEZ5XKE= 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 PH7PR13MB6268.namprd13.prod.outlook.com (2603:10b6:510:24f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.22; Sat, 28 Oct 2023 06:16:35 +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:35 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Peng Zhang Subject: [PATCH 05/11] net/nfp: remove the redundancy macro Date: Sat, 28 Oct 2023 14:15:52 +0800 Message-Id: <20231028061558.1842855-6-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_|PH7PR13MB6268:EE_ X-MS-Office365-Filtering-Correlation-Id: dd5f20c7-2b87-4cd0-6f1d-08dbd77d6fdb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bx8gpJ5ohzUmJhoLuUAp+qwa1Dibhvf9VAMTof+nNTjsu7umNbg0QuchXK603hBD7Y/RBk7j2yxSpvNQCNxhFOzv0899Nk+LsN5pVXsMnltzrhlTIs3Fou/LgKMRARQGuDDlztO9xrlEh6MBaxiHK0RzBjd75sV9pL8fceI7E0J+LA15IODgkp4GMGDwZ0o664CxG2mn9XxS/wKqaQiqhtL00GjBm+84QJe760bX3CfzwgAl1WUO+sRPCwSO/h1QglxLI9fQ/d9UZx0Yt3QFbhagPsnOKGRMOuLms8f6vyH1bXIDXgaVjGFMh0DFvg3AGC0w0jBucPma07U/iRPTVnagtN4HL4XpaNc3jFq/cqtI35D3J3jF5KgmuYwOmGuQuH3P3/u+hOfcpldgFnTgow0w4Lqt0z8gFWxCIfkXrpnIA3XS2JlYVUMG8BDHb/WjJcRsx7N0KQwkKGYoILJAg7/ggV9sYcS1fmuY7uSx5xpLcGjGxVVLTYZERphVWut5cN3pBadQSoQWFz0rctOxutEAtdixMeLlBlk8iXRIwclHbIh4dvi6ee/wdio6yztyDc0gCMIhYp7Exo1F5N0LoxBxQS1kPHggJ56L0RBO2EDKKrHv6QMZzHr9xBwTcWyy8BN10Uv52dUdtQwVu+yWvb4Jxgt7Va69tyL1WHKGImQ= 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)(396003)(39830400003)(366004)(346002)(376002)(136003)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(2906002)(38100700002)(83380400001)(1076003)(107886003)(5660300002)(2616005)(86362001)(6512007)(41300700001)(44832011)(36756003)(38350700005)(66476007)(316002)(6916009)(66946007)(54906003)(66556008)(52116002)(6666004)(6506007)(6486002)(8676002)(26005)(478600001)(4326008)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5I5BLqLIIiKEIk4sw5Llbvr7DYCc6WTZyfIVyI5dMXuiTCb7I1so2hqCvlEr?= =?us-ascii?Q?q+hIzZtKnqs3Sqq++rFc+fMRTXVkD+45bSbapVFm9g4Tr9k5AfMnmLpVVR22?= =?us-ascii?Q?LCgLg/QfkzsFG+5AAeWXCoemhgbw6SttiQeOCvmgNOKjm+kU5HT4u87bNNA/?= =?us-ascii?Q?I3na4mmekxCOx9NzbqCPstOuxf5lyzZDeWfWIUIwKuH+YcYw+a5M1JgxYRMV?= =?us-ascii?Q?vQ/zZmUb0IC2u5JarVlrZlbkUTbRa159ZYYY7f7zY9oD2mKR79S1gInWVfwF?= =?us-ascii?Q?1WwUfY03elg/XRDAXUWF1tAsKbja8zp3eqsqcIcYuR0F52u1kj3CaKxFH+RU?= =?us-ascii?Q?iIPzbpskAqofLY9EZCXJbTXD5F2cOdk8UMTGEQLgmwoFWtPIGY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BgldW6VMmEENWzvPPX6v+g0DzgMM7YwLU0n?= =?us-ascii?Q?3XMddSo4uDZD5exHw6m/Rv0uriS92gDGn/7LRWi6oMIl50u0TbyltPyuN63Z?= =?us-ascii?Q?Xv/gymcyK40Fo693NoyPQ+hIWmT7POEt6Lz7mlN6fMAE3yZvZ5oyjvPbA885?= =?us-ascii?Q?ryDRSdew4rroVEBm3cb+lUCfY6NJ7qpnuLsOGNpKlSb6Cia/Gt/CppH9iKV4?= =?us-ascii?Q?t1RJegjVQdqrQwvYzyPttgI3B+a79wXVHJyT/FXOfTGnyG0wrF8b1zdoVz8U?= =?us-ascii?Q?Z6MP9mPYqYdB6Zl7ipJ26OHJitsK+LO5E1eLbQwaizzEzosL9QbalmV0wxrS?= =?us-ascii?Q?JA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd5f20c7-2b87-4cd0-6f1d-08dbd77d6fdb 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:35.3399 (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: 2+jQq2uG0xbCZJyDi6qQOrRkKm1LevKkTtAsPZy9pI6gROTPlk5oz3UZievmu/MiSQy5DuahO+pbUcu2lWMmGkA5e4IRhS5UvHW2H7th554= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB6268 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 1260b9a3b1..e3c3fa9985 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