From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0043.outbound.protection.outlook.com [104.47.41.43]) by dpdk.org (Postfix) with ESMTP id 064044A59 for ; Sun, 4 Dec 2016 11:09:32 +0100 (CET) Received: from BN6PR03CA0044.namprd03.prod.outlook.com (10.175.124.30) by BY2PR0301MB0743.namprd03.prod.outlook.com (10.160.63.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.13; Sun, 4 Dec 2016 10:09:30 +0000 Received: from BL2FFO11OLC008.protection.gbl (2a01:111:f400:7c09::193) by BN6PR03CA0044.outlook.office365.com (2603:10b6:404:10c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9 via Frontend Transport; Sun, 4 Dec 2016 10:09:29 +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 BL2FFO11OLC008.mail.protection.outlook.com (10.173.160.143) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.734.4 via Frontend Transport; Sun, 4 Dec 2016 10:09:28 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:759; Count:10 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uB4A8pKF019825; Sun, 4 Dec 2016 03:09:25 -0700 From: Shreyansh Jain To: CC: , , Ben Walker , Shreyansh Jain Date: Sun, 4 Dec 2016 15:41:26 +0530 Message-ID: <1480846288-2517-12-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480846288-2517-1-git-send-email-shreyansh.jain@nxp.com> References: <1480846288-2517-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131253197691504705; (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)(7916002)(2980300002)(1109001)(1110001)(339900001)(336004)(189002)(199003)(85426001)(39450400002)(106466001)(81166006)(50986999)(81156014)(5660300001)(110136003)(36756003)(8676002)(68736007)(2906002)(105606002)(6916009)(76176999)(2950100002)(50226002)(8936002)(4326007)(50466002)(7846002)(626004)(356003)(8666005)(33646002)(69596002)(38730400001)(39380400001)(39400400001)(39410400001)(305945005)(2351001)(48376002)(97736004)(5003940100001)(92566002)(189998001)(47776003)(104016004)(86362001)(77096006)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0743; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC008; 1:NLonuUd73tuQrGvZ/Mvecce4h3PuD0VMp3QYDJpg29pOlPb9eRivOWUwNoQiWm52wZg4uqaH38Aj2KzcakCF9ZhDgbwxzEVrlO/9up49u4HMcnrc216+Ll4Iq2kuTw+W1pAl9Pv+wlqk7eAQYGmhA2eGhhFU/sirO2X53UOScfH9tlpRl58SCCjUtczX6jslhZL3SJO36wAl/0FTEgrngWyYFhZ1M7S5Csiu5tfEZ/vLOU+9EtZNIxqEzwu3WsU1cJtYa4PJMRp7iWLJTEbm3zhkornal63Tlwg85B3o6tL05w3riBLIT3KUgFW2Ghn/A63oXu719tJ8svz+NJ6zmd83mu09rnYYUkM9XFallRSMwZ7xMBTRqeklq2wMBYAUafLdxUrxnt974cebBlMr1M1uHATb4prYoRop2sw/5A/Gfnro1MIUh+QXwKrfFuS1cbvjmn20p+BwywDVTNLgBtwETNtZMxiTSfB59m4+1mozBfRuvXCE3zG/Ue+s3R1aG/PmFU85DRWGD4glb7IPVbRigbGdSw/xAl/xs7gwiU7NwSteQ0JaE2lQeyQm2Vhs7xw1a5AG6lZU+3viaJ4Y2kkRtYvyQpa4/idujeErHtgfEleXhY1U0GGW27KL/ztVlIoaML+PrhsKWsz2TFDeWCeYm3KmZmRuZJOcFUUgfxNHoBaVGEvb2LX30Y8ktOnaCnF8u0AHfoHqIIYcAJFQK0I2Xb6BdEqs7XphAbq9s1+bip3oDz4U6b378h9JOxJdBhXD//9rS7t86wedfRf8wQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a3324725-58bf-43b6-3d59-08d41c2da26d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB0743; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 3:40H75jOX3quNi9EaB45IUyylf0sMBIImVozMa1gpNkLGQfcYFjdZAt1vPyexnf6pPuh53Vbcf6pxiTwQsWxRul9uVIV4OTIh0OIKCTa8e99A5qVwnAYRK8g4U1n4EITO2khcBvwUEGtEhp1cwoR56BC/+W6zWQdgNAKoHchBzCwzpCbIFhhOX1MT2UsmsYHy6VC7uC60xACxLTavKuiJMk2uF4XmRNTdmdGjnPFN9Qcy/2K5DreiP1V/O56f1RLXW+vXtYBvZ4ka395dMSVsYJ7G1Zqx5dw4d+kZwQectli+Lh+zzEN2mwI1C3WzE1sJAOqDDU5rTuiLyZKrP6eH7chMvZdKMZ02QkqQuvZs50t1/xVJCCzHCMZuI/6vVOgD; 25:o3gZJYCzv0MomKUHCbeY8/weNLESkLNYaMLYKqm2I+2DsQNlJb9xx7BQkPSg7EuLuHMqmg4dl3mBhGQC8QcYTcMiIeAnnaj561DQqd9/Bk7bbaCAnYZ1jkzikhETGksd3BhDHN8nMydmVT16I60qreF0WRUncyg9GWrslurCHL4YAzxUSoVGumMRoAtJDfacxEicbAyMKQdF58EhbcruBRiXWnS2dtH6bZmiI7TZebPE6EehafWoIAiUYUKWrZUNFwnLwyQc3Dj8Lth529RW1n+KUB5c9pceLqPAP0QQ+l6u56y9/OEJKJKDR8NKgs70Sw+CDnUSKslxwwv6iO/xDj77cuPw/DzGSYG1FmMf2amOTcDE2eUsFX1azw33LMDnehE24oZZGWioY9NPGaB6iu1qFCK515mQ5YiBuG8Gw8Ah3Ma3Ac/7oVkB2kmkWTGxQv7007ACQl9ux7QSWDHNPA== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 31:jlJGuKQKDSwPymWU6JJ1f8lMPuEIFl5mM8iYrofEkjPKNkKHtKUbUv6y/V0NpUayquqHRWKxB3wTPinK079J+hhmtBChnO5xqLQBkVZ4ySWYfm0GnCi17fml7zaYQN3HOK1JYyA5DNa5y6pkezHs7T3ypfwv7F1KEpS8nhbtI/LyRfQqIco5J5P9NM29KUaCCnecdcpxVxfxzO8dlY2cyQc1IIYlyA1G3YHAgkGEyHnzBb908aZAKo1FNQ/6hTFu1wN39v5Wut/81aZw6z3+Ww== 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)(13017025)(13023025)(13015025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123561025)(20161123559025)(20161123556025)(20161123563025); SRVR:BY2PR0301MB0743; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB0743; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 4:GEQX5POH1EGJ0Ivz9PiBhMlyxGYmUnphfHZ8hzvU0f5BJD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mufYvhmqI1YpHRaXQxd0vLcjJW?= =?us-ascii?Q?wzsvRbxyNu2AASFZl5ghnYDxkDNSeSaZD5ly08bwl3y4aCsmc9adCGeOXaeH?= =?us-ascii?Q?/SutI4TajJg0vvh4SzX8fKwjuJFuHfPeZMVD4Ta28zbdvNNJ4dp2hs0FlwA?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 6:sFOPUjDW0t97F8G23LYkBr74oVPZzmpcxP67d+3AJ+nc447W50rys53X75TPqT4cU9Ww8Jsb9VD5LRXLN+I8yk9E2TNgjyx5hOpkXYlDPLPd7Qp8Dn6k7Axeg7PtNi0OdTBNX8gRSNv4r7fyqHhvMYG+dR95zEm2NiqCbW7PAO8HzPuTuI2HGycK2kSI0wo5IWeiNLd3sEBRfr/A9YkOViwnTUVRVwPmLLMFId1ZHjCr5pYlOB35gWg1Lm5g8b6U0InemaUlv48P0tvKRk5+AZiCXtLvuAB9eWIU0DsdHhINw9KeyLAnk2moI5tNA23WynVLzERq2jiT/ZGhSYVcJIEJutqXvuksUEjuj2D6/EtSU7JXH/uNOqAL2uIxAhBrRBuc8Ax/C+ChE1rj61op1DrPsJgoWP18S6KfDx4FFrVFoBpK1AiL+8DSO5LK4ZV6; 5:A1RDDxjzPIeRN7NRiq80QgSXiVnYtqtT7SVVJ4a4mJkES2rL+0insIUEnRYV9KwCXWNtzky/L99d9fZszH5o9/Stp/qlmIZSUk0wlgRAHH5jhYBAilSLWsDAWX7QShFDROUybS036cihwmmWyTJk0OPPs1TdxdMkjXgZKR6PQl0HdMPBCY+rVgyxjypgxOqE; 24:1ix6zijr+faU1tKsPn4Ec3sScfdRUHRH8e+UB7kJN7Xzy9eNqDEC2CGrV6yx+MZyswn6Ec9dx8fYNpdAL/7mJTWJOfIhsQra5+r/SJcHfJA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0743; 7:gnVAim/qt5nb59+CoRZnz/UsHbl9iUIyGl6PbkPrXzb7Ymx8hQnQiS+/4jMCFe5yz6ZD5erPsh4PYt+bQ9Y3nmXARlFG7EgTNAdMPTFbyCGjMdAg+i4Iqxl57KgFbUI0D82SlkmWoTKHrehW+j6o8woZB6qtxgIxtg/PGV9tWNDd3R05hQ6Yv3PenpuBZY4ZfvJaFSmcRhkmTNbdYghRmY2rXK93nwyN12nMpmbaSd7fHXwVSbW3CLsnK02v2cr8wifksdXSWYMFrX3CsgU99TjhDP24fSjRRjpl8DEJrRZhGXrMoFNbHR3H4vA8kd5cPLC32Ef4QbSzzvt8Jf1PgEFkyct6AD5Ri/VJEB7Knh5yFqTGx/JOSAua5dCHi292eQeRr/an8VVOl4tLgBYQ+73Tr9qtZpPhKQPSyVbWAtZtA1F4JU/iHI25WOe5GOG3o7qHmIFSzZRYKaI2TmVCGQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2016 10:09:28.7916 (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: BY2PR0301MB0743 Subject: [dpdk-dev] [PATCH 11/13] 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: Sun, 04 Dec 2016 10:09:32 -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