From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0065.outbound.protection.outlook.com [104.47.41.65]) by dpdk.org (Postfix) with ESMTP id 4F122F8AA for ; Mon, 26 Dec 2016 14:21:37 +0100 (CET) Received: from BY2PR03CA044.namprd03.prod.outlook.com (10.141.249.17) by MWHPR03MB2479.namprd03.prod.outlook.com (10.169.200.149) 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 13:21:35 +0000 Received: from BY2FFO11FD045.protection.gbl (2a01:111:f400:7c0c::143) by BY2PR03CA044.outlook.office365.com (2a01:111:e400:2c5d::17) 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 13:21:35 +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 BY2FFO11FD045.mail.protection.outlook.com (10.1.15.177) 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 13:21:33 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBQDKVCZ029786; Mon, 26 Dec 2016 06:21:30 -0700 From: Shreyansh Jain To: CC: , , Ben Walker , Shreyansh Jain Date: Mon, 26 Dec 2016 18:54:02 +0530 Message-ID: <1482758645-23057-10-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482758645-23057-1-git-send-email-shreyansh.jain@nxp.com> References: <1482756644-13726-1-git-send-email-shreyansh.jain@nxp.com> <1482758645-23057-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131272320955447257; (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)(39840400002)(39450400003)(39860400002)(39410400002)(39850400002)(39380400002)(39400400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(8936002)(48376002)(50466002)(305945005)(69596002)(97736004)(5003940100001)(8676002)(68736007)(81166006)(81156014)(189998001)(85426001)(36756003)(104016004)(86362001)(105606002)(92566002)(47776003)(38730400001)(76176999)(106466001)(4326007)(2906002)(50986999)(2351001)(626004)(8656002)(356003)(6666003)(50226002)(2950100002)(110136003)(77096006)(5660300001)(33646002)(6916009)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2479; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD045; 1:PEaENNIuvEQDNmYZqOtf654RVHdLVHQvuyF5Dh+Ctf2lg1k634p2MiN3mXoZF8kvPy7pGZa+soRv3YWF1M50BjcZeJ9kRQqiUXAjsyKQ4zSeNrJ86lhIA1K7gjFrQdDSmZY3YMC9UES1sj0gEAW1FsGQz4js8JrIaUEzccBQKhAeUEP+C9Q2+0KOgDF7U7OKlDAT3x/T1R8SLcs41RpGNoO2HsEZoQ4r2MhzskjlPekKCjo9heWwv2MQ9ZHZ9mTAeTOYPeNljgI2IYdwyA7MPOMSXmJ5tn7LHS77ydqOfogGLmJnxcqdOTRMQp3N0W6FILk4uJca2InFcNib81dIpjchhoRA29qlpWkoUR5EH/B0jwSYkqoDd14oZGI39GkLXtEd5cZ1sWVgrD7SYUIykmbMD8YqEV4wDyYrakP7l4ibSG1i/krXX5qIYAcxTL+LWVmp4URMdz3KquXGQ4GhIkVjKr/z7+E4TdA0YPQB+I+RGW0vUhAHwB9w43gdNIuLOvSFSmxPx6KpnXwKmkHafK+86OH22PhR5nM/skFbaeVxwYfG+u4ZO/U9VNZCXAdaP8mQ/HvB6UggyQySkr/HuzkXxO/KW01oyIDlnZQLR6cWOlRbrvjGV79mrxkHTcAAYShTVgz24V6aLiiggozrwnhcBvLss0P64LBf9VJCJoHTTQ8bB55+EPpX8qA9Vowmspi0KzU1HHK/o9LhHMLAahYUVs9O049FGlI77YG7J9yNzLE5Cfm4IyJlym8i8e6yso1aTeDhQ3pW+XEtWk23Xg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9668f364-a7b1-4b9d-967c-08d42d921dd8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2479; 3:0ST5BlFkHE1x4Dp3yUkVROxoJuGspKeS5hUGhOTe+o8eRlUrmsS8QNx+UiUnDj+NvXaJVA2YjP7JXQbkdZ5giZhVwTYdIzPdviFwjmYdsDdqLbOjFlCm+EqJ70WAIwRZffjSy4gjRRa2c7J0FVNaUF6UzABFMDve+dkLwbqo8YlQ5o2K3TE6uyKNAkN9H5ExY+VS7nfkC2mj1RinJbm7Z9KbLI5K6EQXscpjvd3hHMrrFC2zQXbfd50IYQu9eOWBDpaFMxH3WikCZg9mzj8gZe9LyLDMXdz7BeWd+rNgi2gRHyEumrPJouGewe++tzDm+AR6EEboVqLRI9tOqnzsBar5ZK7YDdKpSDdJkI/GETBwx1Q44YRpBR5l6WhD1nPf X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2479; 25:JIeQfKdXzaSHZJSzlu/1jEttb1xDbgQ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VS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13024025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123565025)(20161123561025)(20161123559025)(20161123556025); SRVR:MWHPR03MB2479; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2479; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2479; 4:WZX9hsMG52MoZPaZOqwWQXw8JRjaRY68uBKy8PaSN3dtRu8rZhBFYYmTydikmtcIlwGdli9u4QqELirUVHDxWnJE3PCNpn7auXByHONsbsYY9IDr0+r7ujRWoYXMjFOf1thX2JURNHL9fmoqdf3jFgOhVRKzwQ8VA0qXak2uWzfUoc3GYERRe4FvYxsLUDEHuBLW+JqVbVtQt26a6G+KleN07Nl/l6OmJcODe/CsuMeAzzFxwv8CFlQMuwOWBk4Fh3mwuJnFJ5g0bvu5G3WBgVteelMRM7TvB8cqzLe/uaNVcC5geFSoOQIbN4vHg6QzkydsY6HUvCyKcI/ZJtEq2QHTMjud1pCr+5XpouD0nLEkdxt0ZHON5C5RhV75ArMKMAO4eV6WjSBcLq5ysj2ekHpBZr716egyw4SCn/sTkNR/fzs5vNHuWBjVsii/3JjsXyWvt0Dr6SpUEMKI+Scn14sKbCVpPspBxatNQy9W4VDddYekwVyWxtYl9cfkW+TZd24FQS0C6A2jCZ2GJt78OD1m9MHNoByQdGCaUUNAu4rS7uYNqyH1PFwEoevnx02MNIanTF2HLPvssqfMaZju3jjPKUBWYjfH83FiZXXNftJ7MOIjVG3A47w0c8w8QEF23GDBJQbEeemt1eYpYGjXS/T54b613FgiOzbYhfSZ/1yKF/qbtU8RLfUtu3KiG0UXp1ilvq/5leD1Bsd3sBK3b9B7KBcSn/Iiki0qZa3scCTlTczPgMMpQN8gXyCqP0ZF2jfGztc8/jBaBbSPSlGZKQ== X-Forefront-PRVS: 016885DD9B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2479; 23:KwT67rK8zSZh0W1SgDWm8B9XIvAmwOy0JdH/yk6pK?= =?us-ascii?Q?uYLCsljlCS+1MLOaxKQh/MuRaqP6xsT0KSghDFG/Q0JPZVKZK8rzkXtmYdSR?= =?us-ascii?Q?bvIke8e/KdmdtP6r4u/G0na4zoc6qCnJonvk0+fP3qWJsWnV3xoRW+ja57eV?= =?us-ascii?Q?yCYrAttsnCrYVrR0NejvTbXsWb2LOP0DIHsqRyUZe5HFBxHYgC0xohFyKeR2?= =?us-ascii?Q?xKsKkOnqZv1skDaotlRao77qCYUhKruLRGjpILZ19hSVJh7wigTMzNLuppxN?= =?us-ascii?Q?2pKCxZEUMoiM7bGN5sEsRQ2DKme3DeP/MlpTNtIYrmaSp/pGEbfuHgWnCYNa?= =?us-ascii?Q?EeggDXx4ULNEybPHzLmsvfuQVsJkF9fPeiGS/r79AVn1cyVz8+6uQ4gEV/lW?= =?us-ascii?Q?l7r+EsWt5V9o6YMOFrCPulriKpW8XZ3YzjWu7wZH8iufy6HGqkpZR2aTQBdH?= =?us-ascii?Q?2R/G4I/yYK6pOhwW/+WPtHvsimApMssziKu1K3AMOX7YCHE5ZGplYZgJvKsL?= =?us-ascii?Q?1szPq4S0CppbcI9DNbX8UIVEjby8i7Ec/ykYMKSbawLm31de7uFuIlp95o1l?= =?us-ascii?Q?fbgmAcJq41OuGuTd0WMaDq9y6wz1zvFhSEqwf5+Q8WZ8S3sKb+dnyOLKr0o9?= =?us-ascii?Q?GVjza75Rvz53EBUf5xXdSo+DeqZ17pf8M7ZeyKRowRM7B3hemR5ywMq2u795?= =?us-ascii?Q?L+a159e45T5ohiMXmmPd1RfDnS4JWkmBO5JRkdK8olgezRh9P+hZW80gdcRm?= =?us-ascii?Q?wnGunilakBqEQByS+rJmYPfUuC1M9OcjzZbdeftKEGb3yh+TKlMGPotklKn3?= =?us-ascii?Q?nBN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2DPnm3i/P/AezYG5f3BC; 5:FIVoKVHBgeTWnsPcyNcU5Y/W6vg4kIMTgwvG+5/ZN5tN1hJoNkqNQReNDjcGihOdSl4yQlKfYciXiGnAH19MWX53yZcao3ViLxh953i2MTVBlyvY8gGuMeJ8kHo86o0SdoYeRv4I+M1bUmbaL018M85mgw/3CL/+oVxM0iuSETq/Ax4V51FpOtvX8uxjIuYr; 24:Ov2Bv4yUHjxnvh8jLsKPBuridlTbhI+HDCArQYVaEdJBZX6nP4QlszzeokDJ++4rHl0AjflAxQP0luUQ55fp5AfhFNBrURDQQpPG0VrCVgI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2479; 7:1e66dMekaoz6+UyugdTaAMj/BlBEUuBoO9Q2oiQVtLIgZvdLeT8EbE/bV2Lj8GwsoxuMjWCMOCJyV7uQ1xUd0XbYPpoH/LDQVulih8022dwJophkNJevzCmkrBhzGUjSnSg0h7la5m4OcnpgTopOfc2jwZ6ztVjn/VRI0629B50rEpTYk5NuIrTMkKbo8pFuxrFRYLOsTvoVAnusPcwUe8S/xEAagnYxu/93dIGCHVgcW5aUkAOkPKpu5M+gzxn1HFa9OoEJ+nn/4CRGbLNIwRG+Ufz+5w4kz3NDCrGIWjQkD+OZAREmh9RV63VaE9hEJ+N9wpqdURLQfou4izw1u6JFepuLb2EC4PeprsDwBMsV5XUv+xeS42c7Yk+oG3ij6llr8qOa5x4T4PVQgxEae6VS3Qk+0nqhh3u18NeQCbSy8J2RKegWvJ5w8kLqV46mDTGHR4il+Fc7jhnKONm5VQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2016 13:21:33.9691 (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: MWHPR03MB2479 Subject: [dpdk-dev] [PATCH v5 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 13:21:37 -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