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 554E045546; Tue, 2 Jul 2024 04:20:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A7C440669; Tue, 2 Jul 2024 04:20:10 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2101.outbound.protection.outlook.com [40.107.243.101]) by mails.dpdk.org (Postfix) with ESMTP id F2E234029F for ; Tue, 2 Jul 2024 04:20:07 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KCuBFODS9757eZooS38dA7fFzjxI2k2w4pMhri24jxQ2K+n+quUVKJxLpDTn7Iqv2rMn7PTTTj8oso+yegPvB+YTg6ToVfBjpzkZBX3TQzAZI7Q8KtpNF1bavvEhI1EVdIl1XLwxIaiuXomxhEim/LGFCxxbLayE5SkiHq4MLiGhZ/6nZ+92adhFoSK1dC2gxXnyrYxF4oZY+WvQtlrS4CO2+4mbQ+lbKNXQb4WSiha7mEH5XvjcrdWunjszV/oQlq1/gZcLe1MdSwgBZa4LrcIgFuUrtkssYN5Zr1oJm2Q3xhtakOi8f2W49tEGTySQOBcHULzSnZpWkN/zDpH/Xg== 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=FmwM2Nde7Fk8odcCduTKw2iIgX5FhWYP3hJvjizbIPg=; b=XML/0RTJqpi8uOcHtGnb7YymcUrFLxQ7riBql5RyR0haGpXwKAJlZr+5sLemFVG/XMoe5vmv74wH8223Skf36pzkYIYev3QuEvvcYOnQS8m93WXaOE+8Yxr9J/gysRV4IiiP7jlB45kXvj1MRdEAeCXHIV8NydGVlq9DKzR2Kx6q8dipqINR8JePzRpChuhrwNf4CIPo8QoY2T3coPiMTI1uA1w/nnEpYinVKd4ARxcR09N7WlM+fawM4eHR2cdLe3PVojYHDvI22AT5pMhdhmrkNVQK++kvdBJN9OYQhjBfPWE6W22Tp4dkdTw2BVu0RTdFu3k3oRt+vHfy/sAvmQ== 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=FmwM2Nde7Fk8odcCduTKw2iIgX5FhWYP3hJvjizbIPg=; b=wDqePi6EyJHGv2Ahn0WjEZ6oLgHJOg+oh6JtBge2pA6QbfPr/DT86Xqy8Pg66YHrBzvIiZwE4VbimdjmN3WCKfKl6AL2njPeGIIKw7oLFy130yXGeQp5OVq8eJZsIzP5F5HIn3lvPnGy0FLU7WNCkg1kfQIbTHiPSYBvgH6UYUw= 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 IA3PR13MB6950.namprd13.prod.outlook.com (2603:10b6:208:532::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.29; Tue, 2 Jul 2024 02:20:06 +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.7719.028; Tue, 2 Jul 2024 02:20:06 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Zerun Fu , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v5 1/3] bus/pci: rename the variable in UIO secondary map logic Date: Tue, 2 Jul 2024 10:19:44 +0800 Message-Id: <20240702021946.4194102-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240702021946.4194102-1-chaoyong.he@corigine.com> References: <20240628073624.4122899-1-chaoyong.he@corigine.com> <20240702021946.4194102-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0040.namprd03.prod.outlook.com (2603:10b6:a03:33e::15) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|IA3PR13MB6950:EE_ X-MS-Office365-Filtering-Correlation-Id: e7d775d8-d61e-4941-d072-08dc9a3d7cff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fkXaUW+TA57ZT/FCF6WBPtbR85XEAtMXqyPnEpYsJj7zoAD4z9qe/EiiFLW/?= =?us-ascii?Q?1qy4TBD3GimilYC2opD8uYoNPROSZ3Z4mH2RWKwIxfkA5EBVyPaW4h1bHV7v?= =?us-ascii?Q?6HPFfu4AmQujxE2cFcmcqmJGXRYg76tvCdyPnWUjW975PXNQ2/qnYTVmBwar?= =?us-ascii?Q?xKrdexOH3I6RbvQfTvgZ7tAZOJ07CS1/9uUk67qr4n4VcS/XbZi50HsFLzsX?= =?us-ascii?Q?EYwzApNmFRj4HO+YvWJJnGmYjvm+ls8D4QVYU+gBzeMdegwJ1zHyMfhpwWbp?= =?us-ascii?Q?XMHiO8yellhEywqo/gWGq0HhTJrIkYixsU8ruhMp4Jhix7QfJVL6XjX1Ks1a?= =?us-ascii?Q?syp3n0Y+Qi4hoiof3RP5bBrvXqrTygoHwac23H3YJD4H++lKJLaF4KWdqVSY?= =?us-ascii?Q?+tn1YYV2Odme4lZP6+wb8xMwYqjgssmzA7UUGllQOiNeIqXbLYHpOBMNMcQE?= =?us-ascii?Q?6qD3MjGmjt8k6rlcYFVGVKORQnKymWsiQUGiYsbIk+aU8+aVqJLHA227PiHD?= =?us-ascii?Q?Cq886R7J3W1J+1NZoZz9yelqsE5j6BJHRXQTulfY+/7FJC4+wV8FfwTI8wBR?= =?us-ascii?Q?j95X8AlbkbQvC+PlTNuH2SD1rQEgoLsAXEYqfap+xKJhSaPRT0Tf7O3auvy6?= =?us-ascii?Q?3ZIOBvU3TG4VcLzQF6btpQCNinl5UY7N2HquaZD9hiTFI9QdcnO8n4a6lAgD?= =?us-ascii?Q?CqYz7VirW6SaZopFDj2twe1gSHmmTxR/h32VBapN0/avEdYnDEenx6ufcVWu?= =?us-ascii?Q?lpyLC/jgeZTsfb5mmBXIgRwouRrfvObv795/+K14Q8b88/LYM4CJ1jPAGgw9?= =?us-ascii?Q?13xX4AVvUjZKrCTdI8itCIIMgHvurDboN5oT3dms2kvi1OoqpEVZph9RpsZq?= =?us-ascii?Q?klNPnft5dcvzX/dGVjMyLUzBEW/ngve4o0948JEHD6XnTj2HU1uZsO19C6ce?= =?us-ascii?Q?whjmmrfCy0xpQvG6wGyRKcXIU87SYBn30JMqeCLSV5oWIbH1F9F0UJowicWN?= =?us-ascii?Q?Vt9uGisx36s64MZ/9OXN8iWDXOa/vDZgOcfTWlfs0e2CydLmzQ4x9/UalHEp?= =?us-ascii?Q?WcaVltBNNds6QmlU2CzI2gLvzmqQYPFx3REz8i8apIdyUMEuimjSrzHYrYPV?= =?us-ascii?Q?Ui7hinXTdbrRCW2819QlLIpzcef62im/ZyJu2tjf1woLFwudnvuofDuWJEH3?= =?us-ascii?Q?UZw7dzzDswos483Z4NAhfxjov3x5EWsa7u/WbW0ilQ3RZqXleyILQyjMk1zj?= =?us-ascii?Q?zD2RTJPrWHFVUUoIHuTeJuzm6qj7agbbmsGVSdMq/RQV+uEAMO7HFr2ow9N/?= =?us-ascii?Q?2EVZ2xz6nDPOshrIoCfpfFGzS8H8ur7q5sS6LudCuxPMWdzkqzlxAj49J7RZ?= =?us-ascii?Q?4zOdwcsp9JvrYWOrdvJO9EipFSCSekWcDq1g0r8dlZV327KOkw=3D=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:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ITztKTtdur84KL1l6bEi1qsp831fHd0evSFeu5FIBIp+Ne84Dn6qTrj4+dio?= =?us-ascii?Q?oF9SpPw5oRG59h65z8d+m6y55nx18IMLS4BD/n35ODOMC9QNQVOY4fHsycqk?= =?us-ascii?Q?wK9AOj8MNr3fIY+wLC6Sp0tPvrdsnX7J/1jH5iwnEtGIZ3Zdcy01mTuN+/01?= =?us-ascii?Q?LtOIY6WHucaBPFNSSoqarhqGquLsnzXS6JrClIm2xxWhAEvoE+EPmvL4A6sL?= =?us-ascii?Q?/hM7o25cHCkMR8+rqWk5WZShaZzKzjXiAWYsf6oeQzu47vtNsqlznsEdYigq?= =?us-ascii?Q?nq4xDZGyR0eZWywPzJlWOzC4nNDHfriS+EzTA0SVloaP098ILoF28fJOd1/A?= =?us-ascii?Q?ZIHRmJTZRMUvPJ4X3ALyPJp8X90SLacbQ6m5AAj3dsAEZab15EFO8SdvXRed?= =?us-ascii?Q?dpqXx0mTAsKREOxv2LAHrz9WfExNw1gJgMsbyegQcpct+U1EMlM2pBbAaqBs?= =?us-ascii?Q?1e/F5ogBifXT2qeCgW6RtVCWlKNCbb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?JzGFVlAOLFu4ysgA9DgGUP0C+ox7gcuNd08BRfsbjSlb1G5Z0EGM3XUdFzKg?= =?us-ascii?Q?UE8m2HJlGFWN1iO+vuXV7gS5u3xgK8eqlWgZKpbQgIFiuotI6nqyZYNWIW+l?= =?us-ascii?Q?/dD80Wx7wCwMtrRxNEXXT6j3W4NGe/y9yRzo4XtH8dKqs3XvjwlTpZf7B2mz?= =?us-ascii?Q?gmm068YYYS8QvI2fFjJBkq+mACfvljm8ylLFvPHKQ9pKRD1CX67Jgxpar84l?= =?us-ascii?Q?yQ=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7d775d8-d61e-4941-d072-08dc9a3d7cff X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2024 02:20:06.3118 (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: weTl9o+WmZIB6195b92k9AY2AZgJi1WyqwFcHUE3bz+XUYpaURofngCAVQ5CqTIrTO1C6oVeRbdM43iMXVWOJRj6Uq/V3AYWZWfi4+uNHIg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR13MB6950 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: Zerun Fu To makes the logic clearer, rename the variable 'i' into 'map_idx' and the variable 'j' into 'i'. Signed-off-by: Zerun Fu Reviewed-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/bus/pci/pci_common_uio.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c index 76c661f054..caacbb69d9 100644 --- a/drivers/bus/pci/pci_common_uio.c +++ b/drivers/bus/pci/pci_common_uio.c @@ -26,7 +26,7 @@ EAL_REGISTER_TAILQ(rte_uio_tailq) static int pci_uio_map_secondary(struct rte_pci_device *dev) { - int fd, i, j; + int fd, i, map_idx; struct mapped_pci_resource *uio_res; struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); @@ -37,41 +37,41 @@ pci_uio_map_secondary(struct rte_pci_device *dev) if (rte_pci_addr_cmp(&uio_res->pci_addr, &dev->addr)) continue; - for (i = 0; i != uio_res->nb_maps; i++) { + for (map_idx = 0; map_idx != uio_res->nb_maps; map_idx++) { /* * open devname, to mmap it */ - fd = open(uio_res->maps[i].path, O_RDWR); + fd = open(uio_res->maps[map_idx].path, O_RDWR); if (fd < 0) { RTE_LOG(ERR, EAL, "Cannot open %s: %s\n", - uio_res->maps[i].path, strerror(errno)); + uio_res->maps[map_idx].path, strerror(errno)); return -1; } - void *mapaddr = pci_map_resource(uio_res->maps[i].addr, - fd, (off_t)uio_res->maps[i].offset, - (size_t)uio_res->maps[i].size, 0); + void *mapaddr = pci_map_resource(uio_res->maps[map_idx].addr, + fd, (off_t)uio_res->maps[map_idx].offset, + (size_t)uio_res->maps[map_idx].size, 0); /* fd is not needed in secondary process, close it */ close(fd); - if (mapaddr != uio_res->maps[i].addr) { + if (mapaddr != uio_res->maps[map_idx].addr) { RTE_LOG(ERR, EAL, "Cannot mmap device resource file %s to address: %p\n", - uio_res->maps[i].path, - uio_res->maps[i].addr); + uio_res->maps[map_idx].path, + uio_res->maps[map_idx].addr); if (mapaddr != NULL) { /* unmap addrs correctly mapped */ - for (j = 0; j < i; j++) + for (i = 0; i < map_idx; i++) pci_unmap_resource( - uio_res->maps[j].addr, - (size_t)uio_res->maps[j].size); + uio_res->maps[i].addr, + (size_t)uio_res->maps[i].size); /* unmap addr wrongly mapped */ pci_unmap_resource(mapaddr, - (size_t)uio_res->maps[i].size); + (size_t)uio_res->maps[map_idx].size); } return -1; } - dev->mem_resource[i].addr = mapaddr; + dev->mem_resource[map_idx].addr = mapaddr; } return 0; } -- 2.39.1