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 D2B5945492; Wed, 19 Jun 2024 11:59:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B0BE342D97; Wed, 19 Jun 2024 11:59:03 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2135.outbound.protection.outlook.com [40.107.236.135]) by mails.dpdk.org (Postfix) with ESMTP id C5B6E42DCD for ; Wed, 19 Jun 2024 11:59:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DArfPwfV5esDAjDz6ujzdfkeMUz8rc0j2ZKgKVZlqGiAyxpmdrvEnuVCJmTEtvSgh1G7w0BZHGS2JZ6yDVKoaKsHPm52j8t0lB3XDGGRA+ku8Z+6Dmqfgy2xPWwARir/pndZIJrM4WaXQVGXXMl9X7igkI/vmhND2GviuwoF531h44JIV0905zXcHKMSMm8y3peULQDm/002s3bR9UdsirdhopiEPr+f0hEUOSlAPrKwjTsQYZIuYIW7qIczWmY28i3cGMeaESJibSSm7YrAX+ije9gJaNYMaoh8WvDKZkDeZeXelJDJYwD6fygzrlCONEJjA6Fxr+M/qwGKJqndkQ== 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=EvwlNR7TcXnyyS4Ztr98NCe1ChnfAc/mwGXYlyHLOV4=; b=M1pJtRmL1/fJwRhHM0YiJCwPXgyjR127DeiN8kuUBRVDe6Geo4guil/4Vi4aIRN2vWCKisUIQ19AdIZg3iPXJy5tvzmkgNEC+DlyuGdIO8XaCIH0AX+etuLO8Mamsy8mO7e6EBGnNNSQCBkusVWOvHHioESBc2dxpb2cbjcw0oEq6wHjJW7yGGtteN6C1PuT5AEfBA1J96VS11i+YIxDcBpYW8MjgZZKNoC65YpUHdrv6yKS7GamWe9uLgKGAC9h+wnaYNrTF61NyQRiVsnzsXRAoBX6+EKWqnfB46MRIdXjpIlkSiMtRZ+gRd8SNahe/OI0UAu9XuwvuUwmdN0Itw== 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=EvwlNR7TcXnyyS4Ztr98NCe1ChnfAc/mwGXYlyHLOV4=; b=Xkjs0wkp8ddS3VJZcZ1ZFcnIzrt9vrzEPfpCMAfFFPcMqjHipY7OpYcus4caxnbsO0TUr5wV8oj53fCP8/J8HXqshiOaN9pDMEl2sW/cNG/M2g8UHYb4hpVoGX9eZNwTpS4C+DfWIrV8QzuAMfYCQicWAIKyFVfYazwTZ49/V4M= 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 CO3PR13MB5782.namprd13.prod.outlook.com (2603:10b6:303:171::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.20; Wed, 19 Jun 2024 09:59:00 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7677.030; Wed, 19 Jun 2024 09:59:00 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Peng Zhang , Chaoyong He , Long Wu Subject: [PATCH 06/23] net/nfp: make the logic simpler by adding local variable Date: Wed, 19 Jun 2024 17:58:13 +0800 Message-Id: <20240619095830.3479757-7-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240619095830.3479757-1-chaoyong.he@corigine.com> References: <20240619095830.3479757-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR13CA0057.namprd13.prod.outlook.com (2603:10b6:a03:2c2::32) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO3PR13MB5782:EE_ X-MS-Office365-Filtering-Correlation-Id: 20c81f97-682b-4f9e-d933-08dc90467156 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|366013|52116011|376011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1R0dMRtS5/BQSvDcnMJ/UYCMh/4+dGDB9ruYzv5Y6OKFvwxwi6TIGpHY20+B?= =?us-ascii?Q?zEdY7KZnIuSseoN3JxagX1kzXHbE3fISs6T/SSN9q26yZHbrDnLAoNyk6Vn9?= =?us-ascii?Q?ftBypaGbEqMjDymCuBB00bKUDF+eMblW8ShUIC0ZI9J5uohPXrMyJBcJcS2s?= =?us-ascii?Q?Bu1e9LpDQXEKG0y50fnzVsMBPLH31Qny+bxTJubRmzqod40pYOaIVeswpLJI?= =?us-ascii?Q?EV92hilYkeXzEE5JpUtD2lUqHlgBa//XITg+xr+EVoPNJnksA55SSVBUeUdF?= =?us-ascii?Q?7AzIhAuW3d5xw8o5WfVnGPv3M7BFR5tr5vF6/fRk6EzQuLaduqq7MSUudEzj?= =?us-ascii?Q?+b7waKO8KBX6RBhgUsBg4XJF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nvL0J76uu7jH/A69W0A7swlt+q5aUgpGUi0WUnrVT7hPPa0GEv9V/N2l?= =?us-ascii?Q?X8CFuCPgJtk8NAJeijRa/Tp/nrs7yqe+uoTiM1r3aaRDo0F9/WHTFjHgkesE?= =?us-ascii?Q?S5MYMXo=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(366013)(52116011)(376011)(1800799021)(38350700011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0OpxtexxeueUh0D9Dp4GkVBZOhUmeA0+w97U1AuKclMdS+6/45bxjXYpkWfQ?= =?us-ascii?Q?kGEmBHrT5/6lsfS4PG0e/I0MO4uJKCh0xxmFvS18y1ITEYn9UkwmtSk70O3L?= =?us-ascii?Q?SP/TJqsSOWDgww123V6BD4bdPQNUU04OvDcOl2O71Qt5QhB1qNN6fhOMpWEm?= =?us-ascii?Q?12e8nzqbIXfh2bOrcf8Fu4qLK/qpLxcjGT/IJY+BsxyqmC2B5qBZTnQGzryK?= =?us-ascii?Q?eZMiDvXZ+LGY4WM7zTV1Wf2vOIlojg2SgXDUsCOVETCs4FOD6JVyqlYoU+y6?= =?us-ascii?Q?LpTtoRKGgG1ik7MPrJMUkE4355SNpE4r61dKqhQv9u2xUnSryhRZgSorqHMu?= =?us-ascii?Q?vTSXOkAQS2LZqC2tvXFpw4HXerAP9A2RJG0qRZEhToXXsCHFesm4xqHReHnG?= =?us-ascii?Q?wu5vBciJiIlo+ObDIXqnDaGZy9lskqLDzEkudKB5TLmktEDScOJcot+4srrD?= =?us-ascii?Q?Q2FhKfa9qN0q+gdZ3seoW0U2kLPvbLyMpi/ZzLk9nkquZ7wyy4a1nfPpv5XR?= =?us-ascii?Q?+eQA0PQsYY46v48ptPA0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1INN?= =?us-ascii?Q?L09ESw2Q2qDG+/NL0xZkGiCg0jxu+Fgprc0QGsBKm1DElsaMuOjF9mUHlaHk?= =?us-ascii?Q?fL+9TiqmdD6/9ZYd47q9eH173vHQMfAUpp91qR83mMafNFT4EfBT4FisO6C2?= =?us-ascii?Q?ZyJQLTUT1e8qg89aoN3VcJTkdv9aMeQD0DV8qrLZJAwaJcyKZFnN0APvEft7?= =?us-ascii?Q?8A=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20c81f97-682b-4f9e-d933-08dc90467156 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 09:59:00.6143 (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: iJ3+niXzlhI5FpAFbrvc5O2dDs4i4lYuDlAOlxZpcxqZx5Qr58Hbh0sY+lsFYUGFm/vRFWXu3cD3X5KCDpeYxwIG1aFjxeVJ1XKVxLBeHA8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR13MB5782 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 From: Peng Zhang The original function has long chain of pointer deference statements, make the logic simpler by adding a local variable 'pf_dev'. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/flower/nfp_flower_representor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 7f12a9dcaa..633e5d9eb6 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -791,6 +791,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, int i; int ret; const char *pci_name; + struct nfp_pf_dev *pf_dev; struct rte_pci_device *pci_dev; struct nfp_repr_init repr_init; struct nfp_eth_table *nfp_eth_table; @@ -800,7 +801,8 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, .app_fw_flower = app_fw_flower, }; - nfp_eth_table = hw_priv->pf_dev->nfp_eth_table; + pf_dev = hw_priv->pf_dev; + nfp_eth_table = pf_dev->nfp_eth_table; repr_init.hw_priv = hw_priv; /* Send a NFP_FLOWER_CMSG_TYPE_MAC_REPR cmsg to hardware */ @@ -816,7 +818,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, /* PF vNIC reprs get a random MAC address */ rte_eth_random_addr(flower_repr.mac_addr.addr_bytes); - pci_dev = hw_priv->pf_dev->pci_dev; + pci_dev = pf_dev->pci_dev; pci_name = strchr(pci_dev->name, ':') + 1; @@ -868,7 +870,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, */ for (i = 0; i < app_fw_flower->num_vf_reprs; i++) { flower_repr.repr_type = NFP_REPR_TYPE_VF; - flower_repr.port_id = nfp_get_pcie_port_id(hw_priv->pf_dev->cpp, + flower_repr.port_id = nfp_get_pcie_port_id(pf_dev->cpp, NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF, i, 0); flower_repr.nfp_idx = 0; flower_repr.vf_id = i; -- 2.39.1