From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0048.outbound.protection.outlook.com [104.47.41.48]) by dpdk.org (Postfix) with ESMTP id 7DF9D4CC5 for ; Tue, 13 Dec 2016 14:35:15 +0100 (CET) Received: from BN6PR03CA0031.namprd03.prod.outlook.com (10.175.124.17) by CY4PR03MB2471.namprd03.prod.outlook.com (10.168.165.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Tue, 13 Dec 2016 13:35:13 +0000 Received: from BN1BFFO11FD014.protection.gbl (2a01:111:f400:7c10::1:151) by BN6PR03CA0031.outlook.office365.com (2603:10b6:404:10c::17) 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; Tue, 13 Dec 2016 13:35:12 +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 BN1BFFO11FD014.mail.protection.outlook.com (10.58.144.77) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.761.6 via Frontend Transport; Tue, 13 Dec 2016 13:35:12 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:873; 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 uBDDYRwE005048; Tue, 13 Dec 2016 06:35:09 -0700 From: Shreyansh Jain To: , CC: , , , Ben Walker , Shreyansh Jain Date: Tue, 13 Dec 2016 19:07:10 +0530 Message-ID: <1481636232-2300-11-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481636232-2300-1-git-send-email-shreyansh.jain@nxp.com> References: <1480846288-2517-1-git-send-email-shreyansh.jain@nxp.com> <1481636232-2300-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131261097126484098; (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)(336005)(7916002)(39400400002)(39840400002)(39860400002)(39450400003)(39410400002)(39380400002)(39850400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(104016004)(36756003)(47776003)(5660300001)(85426001)(626004)(2950100002)(6666003)(86362001)(50226002)(8936002)(50986999)(106466001)(305945005)(356003)(76176999)(105606002)(50466002)(48376002)(77096006)(81166006)(68736007)(92566002)(81156014)(8676002)(8666005)(5003940100001)(33646002)(38730400001)(189998001)(5001770100001)(97736004)(4326007)(2906002)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2471; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD014; 1:WsHzhyDErlH5j0LQrPizB0vsPA/ZUFXz6KFZbZ+HdbquE49qeYGG3swwBvLypUsbpn91U1a3GDMWI351EDHSY1wUfWW/ahzZFtDZfSnBMVoTG8ttv8NKFGBV9p6UuRGbLMh7VHlAJjlcSUxhWHyMWLCiBx/XXKhQ+dK0ia9Pa9q6JBwJ2ejnu1L+n6J+YRmQ37r2VegGRfVGNJcnXLMQEiI5oU9zNRDWmDb3ZZ45ckjGh1y4ADt+OUce8JfwxNQXXTVW1MFZOYmCdLSzrOFSv7fbLBceJjLHqU4Jd5FYj02s73kAmK9zwIjKnUsrivWmf8LaJzXUbsCWk4cIy4bDMURi5oP40cqMKmS8VLkW9RihaMNGmWOuP6iY039i4f9mcef0haw7ydc/MWdQqxvEha8DQ2wd8YaDtYXU+HeXs7W0p/ReXww6g+DqRa2rQ/HzrRD2SR8Bm0+p2A5LbVBHGQa5mNfm18D0x5GpCucZ3xDYcLJI9daAgvhaMTV4FlMti4rDb2lrpZ8EptApZqEQVKsdcF7CLn6tSXsotm4MbHAO7G/5lcStH75zSeO1F4aO2wEawFwkToDuMAW6F+b9t9ySpc9a5XXTrivt1y70gK69kvs85wXp1kn00Pywg72BsEo0+bxcWHuSzKg0sKKXKsR1CX9WwaH2y878tYkq6e+PGNdtNrk7wBB+Jo+QV/66JaIjXNU7YkdYmi1BTElENil2INRwCkXlWM6JpS0aN3yNDMfOA26lIIu9F1c2eqYD8vCq2mKnJdFljDen4PVwLQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ff564875-439c-43ff-f721-08d4235cdd81 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2471; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 3:4EmRL8ZSlpaHCW8b9yZ3o8MYC9xTQWEu68WjEK9rReGFEu0eIzQx4Wdj0AIlIp+nxLjUmtsk6NCPqiqE98xHdy3TTXnf9geuj6ALKV3y996i6OkwIxWHviJCQ+ZABoR12EXrIaji+EdITeRIvYLw6MMo2MSNRYH8bdlTxjSsyhMO23ZeMW0BHlISfebfrG/MSVZUTP0+aOoIKTzziAMGP3Kmg1OYV+0YAGgqi4hGcczzv/7U6pX1OqYxBYHDb26E2uQvAc0OPZS9i5sAYUFwyHED92YmwjeZluBLWrh0pgfqr39aMCSQup67wsJNYSzR8Lm+++NXaxdpIfhF3reGuk9gkXwvuss28DTZgDLVs1/h8/nu/48dwh3jIrYk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4IXWO5PITZdYJPrMeO66Q9X4WD0wDkPOxRwA7zdd1O+jG8QsV809g5ge9Tshrswn09l+Ki08ek4dZzfvQ3qU5SdnH8qaQ= 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)(13017025)(13015025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123556025)(20161123561025)(20161123563025)(20161123565025)(20161123559025); SRVR:CY4PR03MB2471; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2471; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 4:Yuv6rOGfZZ+a5aJr8vp2gJxHKH3YxWC0fA1A6BBiNV5LWdtCwLa2xXuYTJIaffj5ukXanwH+2I+ywhN1HRZQj6ovNHMgXcUl4QZwvl6AUfQ0xOMKvpYZqzrRToU8huo0LKI37YHuQYgH0arQ1gyXgYba05rGsbkHoTujK7qzFcVU6zahEbOpTE/Iot5hiiMZC73pyAPVSVYJl2Qqv9N7DChz9jtD9PHSgNehkqFwPCJdPEb/U/wBZsi/Y4FYQkPtcGTWYVOqAYOoXzwPkxeXvTfI7ITVKgCWME1HZ1paMFkZw8/eP8GnkyK1KLahFVB2R+vS75teHapgnKmIqAPqyvxHOhWj9IlLJ2Xt/dUjhoA/0gy0TaizzUHBwXoxz7WsHVJ/kAn8IKLbPpnmr+mzg1js4gB22FrJrvp2LLETpidGRamRixRF3Qke18fh65kC6LXmUhrYTtOVsHUaJ1DgYWn+j02h8ig3bTiBSMd9vtAmTe7UIkOYLLVhcFQQiDTafyi5XtaFyNr90iYHHSBxGVdz+pojaUGg1CFA0GuC+e0dHoUTEoO7dsIKii4xLjwVbY2MKbZm0ZTHa2pn7HxPDlYjvaG+bzcP9xHV6abttB0eYkmND0AQaqJSdvOnY77MK77tq+VljQ7EkhiRKZRnb6pG3iekNAaoKTL7iSG0AVCnYaidDaXY6gz3TTmaMXsAsSHR1clKE5KqSJB/YNVQF86qljJFIaVGUBReFrnLD/+G7esU0LqeAVTqxP89d4fi2OkxJcSF1EHLmIWgVMFPnQ== X-Forefront-PRVS: 01559F388D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2471; 23:V1dWWyDYXRkmBHorB34Tp//ikAP+70IkMghsrG/xK?= =?us-ascii?Q?AppcGhFRPcixa/qW34MAMZnUQ+6V05RAatMlRywZZ8E0TYhlyY01oZHkPJKA?= =?us-ascii?Q?hF8jK1sytd3W/du6eVhCZbHE9jpzC1Wv+KmM94XZ6yyV3AoN/zmkdj33beLp?= =?us-ascii?Q?z+ghYEFf0xaHS0r0PP5Icx/419ueWMj8qtNGI78zo70gT+m8Rbdo4xH7OIxf?= =?us-ascii?Q?QxUs14HNwmuP73buME668AjfkeGWz7plr76NH5Ve9G9K/IflGvswv57Rknzv?= =?us-ascii?Q?Q09fXCXmXp/nIdhPYgYnt1Rzol9rWCuj5ue0JOj9lSXC63oHnIEXbkyi4j5B?= =?us-ascii?Q?FNPEBl2pIUJiJUgPKz6r9a5oI1BqrrKB39c5LWktIAJrvg1hwxRQWjZ+stzZ?= =?us-ascii?Q?nNjYWip4hnSS6pgEyJcwfx6jlB21cSDxWr951HOzE2QECzjD8VNvwg9NL++M?= =?us-ascii?Q?EyhYS5aLXf2/9MfcrKoo9vc6x5UatO86E64+0g94vR/zhvUh57Kqp9FTgqHA?= =?us-ascii?Q?yMRX7mjjr6heyD5yA+tBVr2Uyn+OXsysDFgpbJysHGCxOArCyFUwGdTR23p3?= =?us-ascii?Q?uqX/+cNZbr3wCvS6E+12Q3UcDsywQgkzCONoKYZZDBhMU5v5GI57/5e6HsB8?= =?us-ascii?Q?g7mulBw3jDikkMtNbdvcOkNeflKA2BHELzk4mI8OYMk3PvthxQ7PaDj8FNVC?= =?us-ascii?Q?KGRpteKER8QUBBCgqxlHGS7QOETgrxl3SZXLMt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ZqAGfpDB2aE3EOAToce5jL8ePkyRy+n2uEliXne8dJagOv+IFCRlXX0Fg6EdfaS8rdn; 5:OVRi94orWz3dyPdkPYnciJ1WXF8gps5803TLsoy8s5Gk48vVCVSDoCqddhk7hxfXgY+D2LjsIp+I3YB+xcwCZPVRmpG2OgNA5/5qrcRd5mrB4oXlCVyKYM/sSuAkwc7liQVHNwgtFIVsKIayja/EWKGd1GZBn0VdVGt2ngP3fMqK6ViYUMbxXTMhv+sBQaei; 24:QYobdll+EcGlnW2YRUBTJwjUqFviQACbdD2CzCeTxOwI/k46wSOE80JvcyuJMIOcx6e0tUd96SOkwhMoQF/jgwFuBDKHvojS0xmnedsbsQ4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 7:3uL/206PiiwZdHjg5S3GPAWsKHhfhWmiyTjZ2T153pLh9usec4JUtYt0HxtgN77+UQ1ZDAx8sU6DGfjbs/prKnjhu82rCGBosdIynRIMnEpmHUZDxWfdOOxF1Tzl2PYh7T7nDVIcuyO9hrdOedXrpk/l2+wOp/lT7+m/YUQm7xq/hXATWzkW7LdIg8tcagXhvJoX5lbqh3lk1u9uPEDvw6Gud8CH8Kp8NFFDgpfCubrZ6/fgKgGeaXB/GTkdfHaO+3YZxqPeo44XEKC5E4Jq7AgPobA0BDXSyqCNrtv1UmUXHHNwK6H2T7MdtFN8M2yTenBSoSD1mmXW/np5XY8U2JYdiaMpdTaAAtRp4cUbhcnoKLCmSEvrKQl7drwLuEQV6uVjYx0pSHyJJdz3haTeZQ/InvQ+W6Z3OxzNrDeQFtHtdyTUBK31n7o1SV80UhaT+L+JTJ097l24MT2aYM605g== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 13:35:12.4456 (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: CY4PR03MB2471 Subject: [dpdk-dev] [PATCH v2 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: Tue, 13 Dec 2016 13:35:16 -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