From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0085.outbound.protection.outlook.com [104.47.32.85]) by dpdk.org (Postfix) with ESMTP id 30F404B79 for ; Sun, 4 Dec 2016 11:09:25 +0100 (CET) Received: from BN6PR03CA0030.namprd03.prod.outlook.com (10.175.124.16) by BN1PR0301MB0737.namprd03.prod.outlook.com (10.160.78.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.10; Sun, 4 Dec 2016 10:09:21 +0000 Received: from BN1BFFO11FD042.protection.gbl (2a01:111:f400:7c10::1:169) by BN6PR03CA0030.outlook.office365.com (2603:10b6:404:10c::16) 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:21 +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 BN1BFFO11FD042.mail.protection.outlook.com (10.58.144.105) 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:20 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:701; 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 uB4A8pKC019825; Sun, 4 Dec 2016 03:09:17 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Sun, 4 Dec 2016 15:41:23 +0530 Message-ID: <1480846288-2517-9-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: 131253197609074673; (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)(1110001)(1109001)(339900001)(336004)(189002)(199003)(50466002)(5660300001)(39380400001)(39450400002)(39410400001)(47776003)(77096006)(39400400001)(110136003)(104016004)(69596002)(97736004)(33646002)(86362001)(356003)(626004)(68736007)(8666005)(85426001)(7846002)(189998001)(2906002)(5003940100001)(38730400001)(92566002)(105606002)(6916009)(106466001)(2351001)(2950100002)(36756003)(8676002)(81166006)(81156014)(305945005)(8936002)(6666003)(4326007)(50226002)(50986999)(76176999)(48376002)(7059030)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0737; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD042; 1:sP1qO8lffmUsPzZ6UO9LNVpR8iCsZuLLKtqlIi9kUzPM5QcncYT8sNUB9aIrruTYMHZwhr3TFWUhOuUxPfU8HIbdIgzO7N4n8Hz0tIi+HKgKKw04Lw/hdX9pIjSEX0lxOEPDGV7NGkhfme5CxjlEyLH1PJSG66fZ4DJF81bl1YIQleeGqmtBRFzLUvN5KAjXxAjsnRz4ipNMSiTpS6qWZoRpg+Iz4kauHF2QHfNoDw1YHJSd512AMF7ofSz3OCO+bpHMUKXJOTPo5xBoFqGd76QnxOzZyf5Jv3fGdgl8zG7WCsnMkYhlYOtaKw0l4eVnppfkRnjIYirrwetCjlVk+LP52eYv/gV0z799Om12KpUCP5/AqHmKaVQ1JOm4TKDXfkunGU5d7GAu2VTmrTCAjh5SsAgcRpY0eAL376SWVjqpyZjNpnC2QcBYT7U+lB3ESLOkFRZ9+fA439igMgeqBYtmaiLgAlBPK+7WgDqOe6mEJ8C11bX7cqD9IMeF3N110rr7XhAelth3cf+ZYNFX0ZDuyAC8Lc6Nu4nnFhcIKVlK5k73RqP7MkX8LIuQFS9uF5pZvPsZ6bnwnl4FyJvbctAFQhH1faiCuWLfsjJ3U07WNcVlSYl1jGMy4AkiHeiTZ9ppEpf7bfQDh8X8IhxnVPXpyWdRvgjmuNgU23OjgG2k6QyYuphcFgIlowd7GsiVD5/lSHPQaZqYwZmr7co+nbDpwwsiO0pusaBe6sN/l+Y= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: e9e06cb0-d21d-43be-74e1-08d41c2d9d83 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0737; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0737; 3:jwBvtardkGnKUOu6PvT/cPfPVUgOBxDYFWw7Ghix0cgX4kd3k2pWBYOf3R7ma8hb4E4f3gbWOtc7RegNQ77Hjpvr4RZivcxzbE0b8uYbzXzLnDdXd1Trh2l1CFZYiZAoCZIHw7RhfcYNq5vjpMxbwggrExw7dthAWa6ECNnLOxo6tR6pZnVXnO4rQE4Q5mj9lSqTs9ZYaeP8HE1cII7zO7g+2q1psCAO5BsomIo19w50itKt+5k4sYJmArebdJ+fnzcTECLbbi6omkEgIXj+CmHDu4B9+GWr3wC4WULn8VqY5e+4Z1/PwYVeN1cQbwtl3Z7CmMY/bC7ZZ19aUx7KefiILYsYaVZIxXcXNH/p9VMSnfk1mjCVcnjh8SJ/88cA X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0737; 25:9xDK1jS9gx4j3PDih/6Xyn5Ftbv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FHFDJorC/aIq49LpQtl8Shr9i7Cy5Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13018025)(13017025)(13015025)(13023025)(8121501046)(5005006)(13024025)(10201501046)(3002001)(6055026)(6096035)(20161123556025)(20161123565025)(20161123563025)(20161123561025)(20161123559025); SRVR:BN1PR0301MB0737; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0737; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0737; 4:RKePM48yl3MA7F/Vdza18ZEPvVTZOlj/FVu6Q08F4APusEG69zV9o3e7T4yzsPnJMufQ7T2okySi4se8X2TdAlpcRWJQK2cXoQO6Gwj9knoUNXZjk3nqw8aUarfeEJz0d0J0jbqwozDOedKxsxTltrfrl6uB9RqG6I3Y94+y9SX6F/iMWilZb64SkLqG7G3K+RL8bzCyLIgXj0u27IdPUbigWulNUhKBApjMz739dNMQC+AS1LKTW8TZyDEwtTC5GvUR7C1QknEt3EzB1kdpESL+lRq0ieqX19db6OGwG1//eIxXKuC05NV5V8GKutmRgW1+iAObdnx/cHR4FvIOpW9op05OSlQKiMVksjsCWZ9p/Bbn4Nm45pHjOlGxzjGLVoJ+PvXhQjfB7AoF4Yk6ajtIJnRmdwWIle9CGQIVDDRnV0VlWNqejrKupZbXLuGsIf3ICsrOKoGOmebZ5qfz5ZiaNwii5tebYV+4X2qXunTTJkQE+HZD0Kf5FZqzXUa8rrTGrkfJ0rAjpde/PbOm+hieolLnUgoqaxOkS8alK4+R4UG0q9hmjcp2n78XCoIxz/IGU5tJ2daO5aEL2shgbP0TQt4ZH7AGf2IjX+DjIQGFw8uWlFQA0mm3N3JE+WdFHjEAxKnzQKjsa6Sj+nTlhlgClBsOyUu7QYrS7OsrDorzvOYk12hoaHLAeYJbQMqLtHM0T3ojheAJjyhZFr1EsxO4PYAZN0joH33cjAUBhKqDTHJZpJLhTuJcWThFUlC4 X-Forefront-PRVS: 014617085B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0737; 23:oCoeXR1LRyRmJoSE9O/D8EbSKO7KSvYiHE0jBUZ?= =?us-ascii?Q?y1ZSgIb1E88Xf3w0AjEDFdOmGOMH8+QO+G1+li3JGFBueDIoshj6nskcvWO8?= =?us-ascii?Q?B4DjJ+JUeYVX2YjCHWhWn7lmWf3hyot+lZIbHJMu3EkMr5NYqNdu7GW6l6Mo?= =?us-ascii?Q?nliNQrC0+S7rNV45q7oLsjbea0tomkbDpdPzFR02hNkwKjikciqd7agN0W8z?= =?us-ascii?Q?ljz7ZWNZyBAh1Ys93r2xG8fiUOnioDZFn/PZxqNx8dyAQUUNB8tGWIveZYlh?= =?us-ascii?Q?pKg+FW0cV77Y4GiPWHiEUZ1XU/mxjqWG+WyTyEkZzM03Ii6Gw7GjGoJ/fW0W?= =?us-ascii?Q?GHmsZjt5gWIK00/YJXIqTLpMpcGkgZU/EbkUCiDYrOfnTodc6+fDjdk5I4aH?= =?us-ascii?Q?Pk1OaZf3BgGzdz4Qpk7uUDn3CRtH0pNdciZl3CrqnofDaqZ1EFROJvGrCSeo?= =?us-ascii?Q?Dxik+ubyHdn/RcIfavwSmZl04NlFI8mCwvM1AttUbqOdhcCwQ+07vL7x9GEW?= =?us-ascii?Q?pdBjBtE21hxWojp914THeMQB1UkaZK1EWrRriupEahTCFaO8IehYBf5JgJ34?= =?us-ascii?Q?GHRb62OIuF8SX3ImoDpolqROzSV0lQNwkERN60AI5AgrH5zkiKlfSeNJUn9V?= =?us-ascii?Q?aE0En+gG5vYpJy/mfv2EOKPEx7XPoOOnlRFQ4wMmu01vJ4fCXFNo/aphbTFa?= =?us-ascii?Q?K8wioq6fASF9QLKh/6StpUUOX6i9xQX6GAPWLzp+0Z7VbfPVgNopjwwS3MAl?= =?us-ascii?Q?dtka4ezNv08uUl5enBLtr8vW02QreQzg+0Qvkec4rX7TO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5:kksEnmITj8DHHMGO6ocwH0rR3NIYqsqEeC+Ee6DiH5hXGHfkA3qtzLHazZExl+0tnhDniHPuotVbS0CyhT+H8O7ZpPatanvs3yKnE1mm3gTcNIWBjOeLLZp1WHO/qpPzcbmn6f7AO+6OmBoRj2/LaSolsT8ZJiFYGBsH4udJ96qMyBQBDn6Clq/FnSTVzEjj; 24:fH+m92DRl3wf8Nj/pJ5uBoDh2LqfU6j2FDiuMgjgsuC4ZnU+vz1IzE6+Vm47LEFsIb5ba2gWYnHq5YQehBDXGSXu8Y7mWNISQPGmBXHOqh4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0737; 7:r3H0hYsgaIG8plVtJREU25rCX5/kDUxqfPe6xVTaaGYHoaYdIrI5wvGrQPMJCJvHbDskBZwC0MK5e7OtnupqiE9/msnUnDBMlx5MUEjzVBTy6QgIefAHNV/R8dpIDqfAknKApyb891QT3Sv5WkxyzOWzQRDzQ1bUwIcp6bQpYN+z3T8ZG530GGnoSDAFyBxJnZS4jNkMnoQ4+X7HCJHIT8Cd6pxI4Ba5I4Hl/f182LcU5aQI31Ih5SrItj9RSq8arobfzGXVtGKvFctRrbkoNOnxUt4w1l1MOV79Fz5b+c9ZUYbI3xFFJKLmqqSIH65d2Pwwm5+ih/kzwjq6fFnpNF1k1Krj6FIKMjhYFqud2pAnHcB/f9uPPuhJ6vkjVt6NK5Jg5RVkHw6MBCICuksL9dxdKbm/XUoESfqklynpzMqKbR9nEanddBh/0kkVnKfA1CJofJlZ/rmBDKUiSIpxDg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2016 10:09:20.5486 (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: BN1PR0301MB0737 Subject: [dpdk-dev] [PATCH 08/13] eal: enable probe and remove from bus infrastructure 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:26 -0000 The model is: rte_eal_init `--> calls rte_eal_bus_probe() This iterates over all the drivers and devices and matches them. For matched bus specific device-driver: `--> bus->probe() This would be responsible for generic work, equivalent to rte_eal_pci_probe - specific to the bus. Handles over control to, `--> rte_driver->probe() which works equivalent to rte_eth_dev_pci_probe for alloc- -ating a ethernet device. This would hand over the control to, `--> rte_xxx_driver->probe() Calls driver specific initialization of the eth_dev Similar to what eth_dev_init of eth_driver does. In further changes, eth_driver would be removed. Signed-off-by: Shreyansh Jain --- lib/librte_eal/common/eal_common_bus.c | 50 +++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index 67b808b..469abac 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -195,11 +195,59 @@ rte_eal_bus_scan(void) return 0; } +static int +perform_probe(struct rte_bus *bus __rte_unused, struct rte_driver *driver, + struct rte_device *device) +{ + int ret; + + if (!driver->probe) { + RTE_LOG(ERR, EAL, "Driver (%s) doesn't support probe.\n", + driver->name); + /* This is not an error - just a badly implemented PMD */ + return 0; + } + + ret = driver->probe(driver, device); + if (ret < 0) + /* One of the probes failed */ + RTE_LOG(ERR, EAL, "Probe failed for (%s).\n", driver->name); + + /* In either case, ret <0 (error), ret > 0 (not supported) and ret = 0 + * success, return ret + */ + return ret; +} + /* Match driver<->device and call driver->probe() */ int rte_eal_bus_probe(void) { - /* Until driver->probe is available, this is dummy implementation */ + int ret; + struct rte_bus *bus; + struct rte_device *device; + struct rte_driver *driver; + + /* For each bus registered with EAL */ + TAILQ_FOREACH(bus, &rte_bus_list, next) { + TAILQ_FOREACH(device, &bus->device_list, next) { + TAILQ_FOREACH(driver, &bus->driver_list, next) { + ret = bus->match(driver, device); + if (!ret) { + ret = perform_probe(bus, driver, + device); + if (ret < 0) + return ret; + + /* ret == 0 is success; ret >0 implies + * driver doesn't support the device. + * in either case, continue + */ + } + } + } + } + return 0; } -- 2.7.4