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 9546A4551D; Fri, 28 Jun 2024 09:36:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DD6D427BB; Fri, 28 Jun 2024 09:36:50 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2130.outbound.protection.outlook.com [40.107.243.130]) by mails.dpdk.org (Postfix) with ESMTP id 0E91A40FDE for ; Fri, 28 Jun 2024 09:36:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dqQjfSQnLtn4KKZbKROhFslg3Bc2OLm3iWlmOXPl6e1HfdBZGT/Jofi+0PFmxQKOWMvj04/Eh8twmGG3ZZqBRETjxYMVfSthGmoZ5Roc5JvbGJseCOQ+qP5NvrLn+siIit+IK/ukuzdL3IJuOgTtWadlV/MES4hRfz1/CuFIuIkUSQUABIb5qgtxVvPgYWhNfOhsc41PueO9wm4ajx1OcZyU01NWzgTgQ39+ZaGTuOAjCwirde7UvABQza321ncVmfYo5Sd7OiqWpZThxk+brOPHj3SNsRTSI82Tdv2iyRd+nWMYodFwqGluNSNHf5e/7IAnioxRRceKrf0F75lPCw== 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=SEY7/FjcqSAzdTojpgKNjBIm15//xqUHhiX+XrxfoNEezQty1zwMmxYrCJnDjpMlx8x6J3HCuenULugeMyo8+4lgckqYK1IeVhEyGu1qqYet7jxRQK02ngLb6z+wWn/M0KDF0VvPTDVviPhFOwVU5eOqsrUeYansNxCmwPDeUqD9C3AT/Ri/bNVegcushAc31k7tjbfLapKZUaVR8VstqDBwPbEtuz5Y664Uw+mGEHYfWxyijN3n8hInWYNIaQYF16h3uSx885+x/L4LLHLhOI4bsBIObjjVAajndiUaH8wJlXiM0HSORBRTntpNV7nmiLaaL0sWt68dFz/aJv9HAQ== 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=PEb0hwQEqZW/OI/DC2zW2X5dQIav/uwcWEN+ZgFXviywKpCdoxms9VsXEw4tlGF2+pYtXiW+SPDRRj9Nz8jN+VTAw9sKGhpCFylZLft4iXKQ1fhX8kf2FEnMAtZ6qDpu7ptk1ELQ4Ma5WVqR/kYfNfqY01r6s9jhSBjJHd7GB7s= 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 SJ2PR13MB6166.namprd13.prod.outlook.com (2603:10b6:a03:4f9::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.26; Fri, 28 Jun 2024 07:36:46 +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.7698.033; Fri, 28 Jun 2024 07:36:46 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Zerun Fu , Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v4 1/3] bus/pci: rename the variable in UIO secondary map logic Date: Fri, 28 Jun 2024 15:36:22 +0800 Message-Id: <20240628073624.4122899-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240628073624.4122899-1-chaoyong.he@corigine.com> References: <20240419032630.1215256-1-chaoyong.he@corigine.com> <20240628073624.4122899-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0065.namprd03.prod.outlook.com (2603:10b6:a03:331::10) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SJ2PR13MB6166:EE_ X-MS-Office365-Filtering-Correlation-Id: c7205092-35d1-4170-1de6-08dc97451066 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?y5wzk+jklZxIN976RcLPth9f113TlC/kth1fYV2577G92KLg2KFCxw37zGhu?= =?us-ascii?Q?jJyOtU91YOy1mt6RwR9ZlfXt3ka/OUREhDZe1DMbnKhphOyzNLvPyXIXnLB/?= =?us-ascii?Q?y2Ig7dq5ELVOIREOoarip12D2LG69pyR5lR/VhPsBy7RdN4L+kfK/6mcl4fv?= =?us-ascii?Q?wHHJHDV7UJVNN/41Z/R5QRoloq/mr2a2YvKZepAPxyqA0G5+A/oNhR3ymn5W?= =?us-ascii?Q?Om8DHGip2daY7e25WvjHEjsIbx8DM80kWaiiwOPJS/oheNqzCJwKq5dcseM2?= =?us-ascii?Q?1FAF0efQNuGMkTw5ZhwmrN+YWppXVZ8ewczg6FeoUMpjVM/RnCZ56KTog3X7?= =?us-ascii?Q?C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U5Qqnh0ZTq?= =?us-ascii?Q?s4rlOAHU9xjLRh7r88zClibDBAKcfY2FFn+MHCv42xyPEV8IdUIOgDi6GgCs?= =?us-ascii?Q?YGemiUgahYJygg7jr2mdL6olgPwnHBic2jhVJAIOG65hO/9GYlwdLtfccjCm?= =?us-ascii?Q?YeOjrNujORQBoIMvtdz6qMM10wRWM3OTMGgSHUwH+aYktgluFA=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)(1800799024)(376014)(52116014)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LoKoRRf9EUNaX9idz06Md3NtfxmFTa2iCAk5iaQKgoYdsYWg8y1ofWQO9wok?= =?us-ascii?Q?VMAPyoRvXXr5dpy7z5Mza4FB/zPK0b51u/JM5NEpgvmHMD8OyIeUs5C+9U+M?= =?us-ascii?Q?X3DmK6tJ0MVZ57PKu//Wk6Z0Bu1oBej0THdJQzbskJg0cB2+8Mbf2xK37lJB?= =?us-ascii?Q?I18dixM9NwLjZ4ObRlZslHxDEty1Nnyx3Q2IhCIrWEYfCNbreT7Z+OODUtj2?= =?us-ascii?Q?uY7jyNKcik9dd8Vr8PwSSrgJVn9W6SLhDdlSLpGds3ExoasNMgchhKeUd1wK?= =?us-ascii?Q?DrWTKbCLr+ASMcfQJSunLzTYGYyLBIkVNkRQ1jFtmyGF/mwHhuqSSPbe7utg?= =?us-ascii?Q?e6sTI5rL7IyGJq3I6OhD8ooELEgLtqRBROb18yXBCyOttnef3NNfy7iP8y/f?= =?us-ascii?Q?Z/9zy9nBMv2Bx2jGXw8Oze4ocxR4R6Icu3VyfsNso7kqR5Ob5c1x+pjA69BO?= =?us-ascii?Q?3ORDpVHzwi3HNXJB9A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c?= =?us-ascii?Q?uCPQZPRTDK1jH9jbBtPROlPae9grhqGJoawPOaUm+3mqvQCSOGos1teEYBb7?= =?us-ascii?Q?73/7N7rzMxRJrvJb45WnJ10qzT15Z9BRiMOOvajJfa0U4nHBDx5fJqQcVn1p?= =?us-ascii?Q?92yOpPl2ndFtvhG2lhh/Dn2pHTIKk1Ghfn1ZdZSYu/iojwobBmFzPLhkiYTr?= =?us-ascii?Q?2iy3r1vPCB2vAamwbGnH6c5//eth3tGRdYDytf7JE9DWu48wphv4gvadhPch?= =?us-ascii?Q?8Q=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7205092-35d1-4170-1de6-08dc97451066 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2024 07:36:46.6089 (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: +jZ+9i+yFoWDjGGhAfRmVJMu4wyZZCP8XWbuqnfRnZVQ6DmHrj1xkmRzCLdR6gtaSTe3nnZUg6xOvX+mZVR7ayHeyo47DozMMRY6EYwQgAQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR13MB6166 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