From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0041.outbound.protection.outlook.com [104.47.40.41]) by dpdk.org (Postfix) with ESMTP id 9017AFA38 for ; Fri, 16 Dec 2016 14:09:24 +0100 (CET) Received: from BN6PR03CA0015.namprd03.prod.outlook.com (10.168.230.153) by BY2PR0301MB1576.namprd03.prod.outlook.com (10.163.28.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Fri, 16 Dec 2016 13:09:22 +0000 Received: from BN1AFFO11FD039.protection.gbl (2a01:111:f400:7c10::169) by BN6PR03CA0015.outlook.office365.com (2603:10b6:404:23::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8 via Frontend Transport; Fri, 16 Dec 2016 13:09:22 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD039.mail.protection.outlook.com (10.58.52.243) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.771.7 via Frontend Transport; Fri, 16 Dec 2016 13:09:20 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:876; Count:10 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uBGD8BtL028345; Fri, 16 Dec 2016 06:09:17 -0700 From: Shreyansh Jain To: , CC: , , , Ben Walker , Shreyansh Jain Date: Fri, 16 Dec 2016 18:40:51 +0530 Message-ID: <1481893853-31790-11-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481893853-31790-1-git-send-email-shreyansh.jain@nxp.com> References: <1481636232-2300-1-git-send-email-shreyansh.jain@nxp.com> <1481893853-31790-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131263673613936868; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(336005)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(48376002)(626004)(85426001)(81156014)(81166006)(68736007)(50466002)(92566002)(8676002)(8936002)(77096006)(5660300001)(106466001)(97736004)(356003)(38730400001)(8666005)(5001770100001)(50226002)(305945005)(86362001)(189998001)(50986999)(76176999)(6666003)(104016004)(2950100002)(4326007)(33646002)(47776003)(36756003)(105606002)(5003940100001)(2906002)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB1576; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD039; 1:Co2xJCc5T8je63kCqlpxRpKTytc50Q1HCUCXMTxDhSGKEaVSKTk5AA+7U/QycQsLGKTVyLcE6pxeNaumuvEs69HuPJkIr6MgeZXb7YdXHvx93sLt40mBZG8CETKUVtsu05LjdipsPyv9n4fI4S1f2XSAcbGmkE2kVvSXwf6Rdj8gxYp7u3YGPUSFfirrZxZOu/P+FdOvzSG5ETYIrWZpaaR+WggFMpadcg90FRs2pvhRY+jV325NBUzyGE03lfnIk8NTi8E0725KC4LqkrG1LET2AodDBOFrzcujLILFS3EBTMovZreo1RTcDMOZzQKm2u4F6s6TvXKIYRRMrzjn2dgoHth1tFtl7ySJNV5HrFR7dPeuYUyGsx3R/5jJP1KJbWv5WhHIrkr6GmJLYjGILpAUWSFjQVijW0FHJMYLrEiObx3mo7ALwfUxcEumlaPaBatQYvUUmYbZjWB4cNHHFAsICLqVx/wW0fN8iUEZjoYMSxHI0NuHntplGRnQZPFp072/UV+rnaKQtf8hNY8/tHIXP0ZCf0X9arzP2lmhHtJpVebiSQqvAt4vNt0m3PtRs6z8D5n/+Ku5O/kGtM1IL0zn5eRe+PVXD0zLaGwPGBnt9F2Bq3T93Soh4FPO4qmQzDhn11mjPW9S6r/MpBWZi3xblt+JS6NUQ41sfPEoQxMybWb5PDVkhKiohaUiP7zkLWdxEjIPR/sukYk7cEbl7Sja57q4i8CQ3ISkZPGdPLLvEnscfjFT10lPkxkDTHRXHPNIWwMR+lolPuIZ76avaQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: e43210f7-0ed9-4305-dddc-08d425b4c00f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB1576; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1576; 3:WYa/iy7qonWZiPD2oa8X8YyGJbCtd1VgZv1jU3GFO55HcyCTSNK8vlBL6QcfB5fzRTeEenqTgya23+QXCqIZM1ihZuP1h93fidAymVz3uk+Nrp/pjslDH7hXlF01brxy8JwDU9gnFqQ9fPcLjSjofV98/tUK/RGZxPPrZSm6sa58Uk8e9yLwCA7dixAEqsX85KV6X0e8RVMrHZbR9UpSmv+FoG8iRw8gQY8oGvb2MwTiuHTwZ9nGcxfxthgRUAQ9sksn7eCivbcQ40egZOT5ul9LALoiejktQaU4gH+AZnWmjZInqVvW5o6YcyVkZH3gkTq97Yh/lolHmzJjwB8X7Rr8RXgj6+lHrO/0a+a2XsgPMzoCnibml2CUkMV8mraA; 25:mrptXWGi1kszHg1vjdmI59ZAuPB4P3D+qguzCMDER4dRFULPqZ2NG5zFYjSWuC6V5dYZAYkSdT/kxEa4cvEg68x98ArkqR9e5dWylF7b9Unlg4KfHP/XPkDiFnpwfslR0tATrMZ5wQjRoDIh7QM7CJqpY7DTUuhX5sB87ZI5qzCafRUfRiYW8ZrBhM1vDLEvceYdgQDbua5DjAiKdUBeuHUaHGCc1Bt9kqeYTNN+m1rT6cWjaWSkJzgv5IbmRUYhOVBPRoNit/j8uWAHhTFGr18wfBGSh/GbjAN4mjjOjPJrfW3VqWtr9OcWFINCbpp5gwR6y1mVqXEPPPcbuSxu97SkbsuiPLFJyqv5eMylCmn/K5twFUfI8Kx5meM9pxR7lr9SEFNff2y2Wj/nMeS8PoCpVDkP8bm9MhdDd50T4t3araJHG1Dm59L9THaVhj6KHaITguJVultVipJITCJ1yQ== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1576; 31:FSpf/UlhdX1ffGS9KM8leP6kLwfaLtHQaNEI5vEcmN8uUbX26EWISdaIK8icffa8uQcBXQBI3xBmFk9Kcroxq9iPZKFXywI6AOKVANGZqWwulh7nrBWZECjVeDhhYh/3wEXWIiDgW0cEKyyfWYFMsU0H7++hx3/RAthTX9yrGUl3pNFPvylUxj3uffnyIUzta5aJ4SAUIKAn8refVranWJtpLHC5Z7QaLWjRd+ZM5WVgqDLvhryL6eh/l1x3gn6VwVvF/NTdgDBFT8K6HLiY1Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13018025)(13024025)(13015025)(5005006)(13017025)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123556025)(20161123565025)(20161123559025)(20161123563025)(20161123561025); SRVR:BY2PR0301MB1576; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB1576; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1576; 4:IzC8DCEqfxQEDudbbzfWxy75kHR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eajwxSdbAYLXwrbBS839Lr+4YN96b7x7p4qP1bpLn4VQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1576; 6:H+tWSIcKldCjp0YhMJWlNDRmaOJogYf6zsZbqFQ+0lycWQH6jUfe6ouvnDmpNEYYG22c5Oc27yscI9XeeWtq0MFaRJEmNngJ3oOYyNiJsM+XF7cTHJfSOn1+xVYNsf8Z0iNEv7SpdtyP3ZXeiSbEoFjcnRCZe8CGEbYKyvNFuox2i7GGlBN/wF0qknLcomEvpnNv62Reaz3dDE7uF1e9YwOlA7gQq4EKPSfJDePLCR1f7VGGMBOtHrUb5GZ8I2nOR/KOA24L2JkXV62BIo+JPP+YJWiiIcu5kQ9TxYdTRFtmR57ABhWe9/zNfbnRFNrz3J60x/1JvotpNjDCKyHeUZaKJoGl6y8Uc8eefOOooDdKfgSrP9y0xWQHMplOu+ROiWiTGUHgEFwl3V4bQ3ewyEBhnUU5fSy4awA5DTrC9/7WzdeSF05OY7axdR2O2pin; 5:1uaKNTNQvokj/KBX7g7lS9L2v4YxoQvsx6DswHsc+qDF1hfQN1R55xxo1dtf28paHF4Fz+fGFuVJVpDNX97XsS65KlJ1wDPT6qt+XyOdrzziwUcygEGWivvsdlCk0O9anJ9uhsM5TvLs9IWFtKx1oO5A96UlNPyHZXEs1RnqWM5djh077+j8QB7xyEmBNqCf; 24:kK//8xzlzckEnkRl/u+xbZL4uMC7GB+AzFq581WDgBqGkA2L0+uVleWJsMonF2Gyij5zRtZyLwF7GsdgTDb0pZi5zGb43R0buEPXyGHdmuc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1576; 7:khGgTCa9MM0+hVM5D1CSrDLtBqWFavi9ibVoRseP4F6foT5TSoOcGrNKHWq1YDDenV9YPBiD4xR4eE3z1S5d9qVeCDJnXv9yCOFjqiiJgy7oJgR6ahNVZchSdzerTIZZ2jfONyCiiJJiTZG93nGiwAXLrA/MddQ3eeJudyFAryr62UtDh/QhMX5w28pA8cAlf2XuCKyvwQro+0r7AA6ebWUQlTcNqsp0sYtlAq1BBkxFlBaY9rm0C7JZQUWxCOulccKSEpNpA+//zKVyxulmzfob6fB3nCm6EWV9L06Og0FejBL93jT1nsn3MOyk/PZ6g8ElV9v+oRkaHCz/rPnLHCws1752Ui3+XHCm09CATwc5hW03cIAFQExgLPhNX+JSZsPzgWeYYI/AjUYeB1goIYNm+5cjLNpSBTN3GLgedK4g18IobS+ITRl/WDLiwTSKLRPQBxnzUjModxWtYNsEmw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2016 13:09:20.6136 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB1576 Subject: [dpdk-dev] [PATCH v3 10/12] pci: Pass rte_pci_addr to functions instead of separate args X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2016 13:09:25 -0000 From: Ben Walker Instead of passing domain, bus, devid, func, just pass an rte_pci_addr. Signed-off-by: Ben Walker [Shreyansh: Checkpatch error fix] Signed-off-by: Shreyansh Jain --- lib/librte_eal/linuxapp/eal/eal_pci.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index bafb7fb..cbd25df 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -267,8 +267,7 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev) /* Scan one pci sysfs entry, and fill the devices list from it. */ static int -pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus, - uint8_t devid, uint8_t function) +pci_scan_one(const char *dirname, const struct rte_pci_addr *addr) { char filename[PATH_MAX]; unsigned long tmp; @@ -281,10 +280,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus, return -1; memset(dev, 0, sizeof(*dev)); - dev->addr.domain = domain; - dev->addr.bus = bus; - dev->addr.devid = devid; - dev->addr.function = function; + dev->addr = *addr; /* get vendor id */ snprintf(filename, sizeof(filename), "%s/vendor", dirname); @@ -429,16 +425,14 @@ pci_update_device(const struct rte_pci_addr *addr) pci_get_sysfs_path(), addr->domain, addr->bus, addr->devid, addr->function); - return pci_scan_one(filename, addr->domain, addr->bus, addr->devid, - addr->function); + return pci_scan_one(filename, addr); } /* * split up a pci address into its constituent parts. */ static int -parse_pci_addr_format(const char *buf, int bufsize, uint16_t *domain, - uint8_t *bus, uint8_t *devid, uint8_t *function) +parse_pci_addr_format(const char *buf, int bufsize, struct rte_pci_addr *addr) { /* first split on ':' */ union splitaddr { @@ -466,10 +460,10 @@ parse_pci_addr_format(const char *buf, int bufsize, uint16_t *domain, /* now convert to int values */ errno = 0; - *domain = (uint16_t)strtoul(splitaddr.domain, NULL, 16); - *bus = (uint8_t)strtoul(splitaddr.bus, NULL, 16); - *devid = (uint8_t)strtoul(splitaddr.devid, NULL, 16); - *function = (uint8_t)strtoul(splitaddr.function, NULL, 10); + addr->domain = (uint16_t)strtoul(splitaddr.domain, NULL, 16); + addr->bus = (uint8_t)strtoul(splitaddr.bus, NULL, 16); + addr->devid = (uint8_t)strtoul(splitaddr.devid, NULL, 16); + addr->function = (uint8_t)strtoul(splitaddr.function, NULL, 10); if (errno != 0) goto error; @@ -490,8 +484,7 @@ rte_eal_pci_scan(struct rte_bus *bus_p __rte_unused) struct dirent *e; DIR *dir; char dirname[PATH_MAX]; - uint16_t domain; - uint8_t bus, devid, function; + struct rte_pci_addr addr; dir = opendir(pci_get_sysfs_path()); if (dir == NULL) { @@ -500,20 +493,22 @@ rte_eal_pci_scan(struct rte_bus *bus_p __rte_unused) return -1; } + while ((e = readdir(dir)) != NULL) { if (e->d_name[0] == '.') continue; - if (parse_pci_addr_format(e->d_name, sizeof(e->d_name), &domain, - &bus, &devid, &function) != 0) + if (parse_pci_addr_format(e->d_name, + sizeof(e->d_name), &addr) != 0) continue; snprintf(dirname, sizeof(dirname), "%s/%s", pci_get_sysfs_path(), e->d_name); - if (pci_scan_one(dirname, domain, bus, devid, function) < 0) + if (pci_scan_one(dirname, &addr) < 0) goto error; } closedir(dir); + return 0; error: -- 2.7.4