From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0057.outbound.protection.outlook.com [104.47.34.57]) by dpdk.org (Postfix) with ESMTP id B9CF0D4A4 for ; Mon, 26 Dec 2016 13:51:02 +0100 (CET) Received: from BN6PR03CA0070.namprd03.prod.outlook.com (10.173.137.32) by MWHPR03MB2478.namprd03.prod.outlook.com (10.169.200.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Mon, 26 Dec 2016 12:51:01 +0000 Received: from BY2FFO11FD031.protection.gbl (2a01:111:f400:7c0c::176) by BN6PR03CA0070.outlook.office365.com (2603:10b6:404:4c::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11 via Frontend Transport; Mon, 26 Dec 2016 12:51:00 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) 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.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD031.mail.protection.outlook.com (10.1.14.196) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Mon, 26 Dec 2016 12:50:57 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBQCl90R011201; Mon, 26 Dec 2016 05:50:54 -0700 From: Shreyansh Jain To: CC: , , Ben Walker , Shreyansh Jain Date: Mon, 26 Dec 2016 18:20:41 +0530 Message-ID: <1482756644-13726-10-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482756644-13726-1-git-send-email-shreyansh.jain@nxp.com> References: <1481893853-31790-1-git-send-email-shreyansh.jain@nxp.com> <1482756644-13726-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131272302600189343; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39400400002)(39380400002)(39850400002)(39410400002)(39840400002)(39860400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(69596002)(36756003)(50226002)(77096006)(85426001)(92566002)(68736007)(104016004)(8936002)(110136003)(105606002)(626004)(81156014)(8676002)(5660300001)(81166006)(2906002)(6916009)(38730400001)(2950100002)(6666003)(97736004)(48376002)(4326007)(5003940100001)(189998001)(76176999)(356003)(8656002)(47776003)(50986999)(33646002)(2351001)(86362001)(106466001)(305945005)(50466002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2478; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD031; 1:CDDmRUeNly6fdoU43w6RpMLlZRB0lMcvRm57qOo8NyMipFGnJKtASNvD8WzdvD/a0PHp5WYKJOOukiPoaIPyW/+oNb70tfmeNEGHi2Gj9Y495N66rSrq/74OLahwIyj+67/oqFFFWJE/33pgO98Fhq8caIOISOAkczsXdTNZFLAu28+I/e8nk0/x7ao9+YXqdDvVeDjmhrj7B7hfpJPfQTc0arkRvK1Ga0Pna49fHR3/TAApWwYH1jltxpWGamvpWa8hz9n4eMIqBZE+7tncvLJdNtlwq2pHWrlU5DmsW/wSqmBF49wu7zP9qEGeMPO7/Ue423DqeqKAwTTX1xRM6lvR8D6cMa6DFT947AePkTMcljQE971juNjBhQGjNwAjPyviJfYe5XsDz8O2cixmt1ltAw8Q60trzIsPZv4qgJ0nlm50WqnF386sYQKOwyKuGusPV+X1+4wHbho91KlUIkFmxByWYD1saBhxuJcp39J2bIQcFPBEKrI15OS1r2TKXAboj34xBXhm8SPBUGV/CRcscbqjk60IXMnYvmkmFQvufAZo83u422/COOMUjcGm+zkrNH+y1cS9dDRsRW9U0wkuLNjNZpMM1zKR4seHj4Qnuk0eY95FoWHDk8NrWWYMCc8drJlpJuhH7CMecmEv1Q+vuxhv2puDOfSxMNJc1YUYO0hdFuTSQ/2MmUdTEFCaJVUxXdO9T/ZLKbt9N4/hUBk6h4p/cwOHfzFTWJW3WLvgwGHBHUg3z/DuYDjmO7CoGVwALuol8hXXONXsXksaLQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: aa1e55d2-3ee4-4dc3-df8f-08d42d8dd7a5 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2478; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2478; 3:rp4y9eY288zJIieWpa5JEIliF1TQLKIIc1TRzK1WZhi9GBAU3Wy0VtOEnim72bvPHXOfEISkVQeAkgaXb9FoZc5+VHNGbbIhU5EPnkus/OOTLvQu1dX2u4jq2qQgY6i9HVp8UwVcHBe43t3knzt2NeqJCV4Ad+MoXozWJ7omxWef1915Pl2rWZNXG/Frhr+aLgUiXpODufkYtz/osYgRqd4V/NXZrf/BCKgVfJ5ZJEirLySWVkRnk0xo7LNSl1s8GdI2EOdRcxroQxosXxeFhQZjUdATq8gJ14Acb7SIIA1k0aZ85XZhdjoJDZOY5rAlQ/2bhdHrEltSPmU8lSPFR8EgT4bRcCBfbD9MQX0WTTc= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2478; 25:2eptsxIbqykakwQwbAmFFI2cn3ZjN8Zpa+gS0H638kodDAxqAqrFtzvRGUqXNcolkZ2sCFLY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Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:MWHPR03MB2478; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2478; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2478; 4:dmBcq05IMhP+uPYBPUPgEKilBZViL/Ml2TcUy8ZgBur+CnW27Jjzi2UbTcv8FesV3AiRlbtd6+h1VcVOTcZ/To6EF89EcyBgVUODt2jvHqRmpJvSZHgqRNllILsjb8RBTj2ySaUAvx0ypJ80vl4e3ChMQfqvrDFSmO/QG6inOTTBL47ptUtS1Nk+SmaEgApk1FUCuyCHyCxBkwUsTf7E2TOon5aVlwdbvp0QQUmSoqFrmrEUgagRy9O2JXISPsSrZPBNBiQtqFpKneekKZTGWtoxmZ86M+GOLdmZLaN56GC8ArawbRMPFrjcEABh3H7DtjJi6hBIY787fLNjYTHdTasQyKTzaoZvR2HDrPrpiTjTaJ5yIeF3xb+PERHWjugcdub0B4dSPuZfgWj5sswG2cxtI/yT2J+QfcT03iKsNneEh7VlbYH03yKxeSF5vNeA3mKE67jsImPjvdk6arRQOdJ5Cx/etmcb9Onkkxe6rtQymLrINGSGurWiSbB+nVfgc/jBsvzz0bb0rqwi8gkaB/Hbhdfmhlwfc6ZWsGEf2TzFb3coKCknxDc39YMFf/5ivsVMBTLna7mxh17NkiXqCUGBe6Xgb/mOC8fjDXcPPIrfflIaJFwIZW+gUG+UQ/yeZgNASAyS+vYgsb2m9nZaiOk1vYMb7G65QGRVMaQOrFHG988mXTrDh7y6IgyqST2ffXVkol1rAUrBsbShy1OxFQM143mhZM1xdwTj5/ofP8dQVQg11vcMz1w8rXlReOAkFiu14Mifs4wmElevI7dOeQ== X-Forefront-PR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19KMjYE7wZjgxSoBXJ2BHih6; 5:2Nco7/DUNV9mNqGaWXflJkUBDIENR5/Y9L3BTIDYA2P7TzKOsbsvrQOrdL0gyu/9uQk5cu5TF2ItgkL2FbaXKu7fHOZSSjjVKiDWXqWvAXe5FqbeJrf+qtX5d79anHIzYSgCV3pyfGb3GTUMqZYvypcsKgbxV4KQBZhYA/KZkq78hTs938nF0iXPJ6RnzKsR; 24:F7nBY2VrrwsjY/vKPqWn4gAByjbEW/q4vgNbAaXHdzUbYcqFPx4V66pq/wUnF34Od9pLOpsvdqQE0tcr8JJZA1Nh7wU9pcTZrCthZ9U5kCA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2478; 7:q8nMiO32zPspaGfU/jMnosOVOrc5uj0nXMJWAcGp92PIRpg5jdpZmfnCPlXWV2KR+VFYin9TGgCl0RxAzv2PDaOWdzG74G97YYC3Pfe43U4f2t2KG+FpuqcJY+j8SOzaRVmZjSVLzTIulcvydyH5+9Vt50Q0S0zT9Rdu1F6AhV8+hfD+U+Yo2P/PJy/cHgvdjNDuUHTfLTkqFeColOkaMYz5zRaXROHBPhVpBJavFEjDdz6eP2zuT3asEaKOnJR+b1oyBS3V467pylu6JIjaWFj+aCoN5xIZo5T1jPvPA0EwjEjVkTDeXVjpHs7pLsNkqH7MavbIDmkk6xg0X6i36GcIHWsECPZPhxgRvEX2B1OInwN9Dgv5aY1wALrgLkm3gqv0ErPln7zXwBNX9M1q56yWc0roEW2un0xIPNHCNLueQwZ4GJErECD0m2BPquXdDdujuYb+xUPEToOGSK6YJg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2016 12:50:57.8973 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2478 Subject: [dpdk-dev] [PATCH v4 09/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: Mon, 26 Dec 2016 12:51:03 -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 7e092d2..4a0207d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -228,8 +228,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; @@ -242,10 +241,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); @@ -390,16 +386,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 { @@ -427,10 +421,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; @@ -451,8 +445,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) { @@ -461,20 +454,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