From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0089.outbound.protection.outlook.com [104.47.37.89]) by dpdk.org (Postfix) with ESMTP id C272CF614 for ; Mon, 26 Dec 2016 14:21:27 +0100 (CET) Received: from BN6PR03CA0065.namprd03.prod.outlook.com (10.173.137.27) by CY1PR0301MB0745.namprd03.prod.outlook.com (10.160.159.151) 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:25 +0000 Received: from BN1BFFO11FD007.protection.gbl (2a01:111:f400:7c10::1:198) by BN6PR03CA0065.outlook.office365.com (2603:10b6:404:4c::27) 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:25 +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 BN1BFFO11FD007.mail.protection.outlook.com (10.58.144.70) 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:25 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBQDKVCW029786; Mon, 26 Dec 2016 06:21:22 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Mon, 26 Dec 2016 18:53:59 +0530 Message-ID: <1482758645-23057-7-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: 131272320854053886; (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)(39410400002)(39400400002)(39850400002)(39840400002)(39860400002)(39380400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(4326007)(8656002)(5660300001)(69596002)(2906002)(48376002)(50466002)(33646002)(356003)(76176999)(50986999)(189998001)(6916009)(2950100002)(85426001)(47776003)(106466001)(110136003)(2351001)(626004)(6666003)(92566002)(105606002)(97736004)(104016004)(38730400001)(77096006)(68736007)(305945005)(81166006)(81156014)(8936002)(8676002)(86362001)(36756003)(5003940100001)(50226002)(7059030)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0745; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD007; 1:wN/ujFKmvJtqoEsYIEo5F40S/Bqx80zc6w6YlMelb4YeIp3hEjpcbNxWLWz+R/Gd/+Uj0c/WBTyQOLl0gbxatIaVC1nZ4lpeOzSgFkovLQEAgFM7jxvhCWdF0D6N1EtPe/r0TBw09wrXL8nxlt+B/srADimZ18RIVqhEGZ35N+C7zXbm9Nw1p19cRjMwb5yy2Trw9ogJ4aLvdMK4J4hKkiHVDhfv/WU6pSNgnpjwoEGfgrjAqSQWE/8JS/isRtCSXy+ldLLPvOMK/K6vlNvQvQmfauk5YUYJY2ubJBnb1zMx6u2nn5FFjZQKXkMv2SR0lLbbVPn/MgBp2BJU18ktM3jN1azRmbqbw7SclFSw2dF6engMqPfrxQR0Vpj9hZaaW4tVyuU260RHtBSK4L/mnfJj6Kcbz9R1dMz4GPmd9VFbwocEcQXqFoKe8PrJWqpSf0Fbk+GwZnJIu8ia1KJjGvs0pKBkDM9QEK8KXZx9+95j99ctUrx5DTBq3kdRqlXd33asDyIHmSAXSQT/G8lEcdu2OJWGL9D09YCHdi9ofXMTn2Xc3dn1CWJ/aDWHcIvk17VN7NqZynPxG67oPpMgDQ7ebYgtP+/xdBHkNMjSCVy9YwdmV+wu3KoRaFjcTSqRvBoEhrI8uC2OGC/9/b3CzyeFCx7D9VZ9OkpVNEzSWLaq5h6KnYlwyrENjGv4hUokhW5EeVfUMo9jJYO8cYTl/z791QnEKBfwAi9ujTPy8FI= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 97ddfaf0-0edf-48d4-2a5e-08d42d9217bf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY1PR0301MB0745; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0745; 3:VKHQQD/jN1DJDzJEzwRjr2LRUmc6Ljr/LAtDzo22IexDSrOtfFp2EsD7z8FXz5C0c30QZz1jPYg2MynbLzsmPNXa+/BjEz8c49qdN+Rp11F3q5EZFm82cvPt7kWUuDFdVOKNEdutHhOi8kRquSEQgmMJ4M1iYVzsyZJT4YMBui7VL/hCO9q1evoOK3QOgMhNhDpxXIFb+osutE/a/I+hccX4euQKozZK1E1zZLQf50sCZbMtSVaqkw1aU3gtcr4F01O6QfEEZv/DiIbHy36vgml+O9kBMWjG6kCeaJu/UE447Iaw/JQnVoM4ZNy0LTjgMhIn0xF6Qmy60OTP3NB+aY7/JCa1OV6x7Bq+G9Xc5ivxRjN/vuXOTPHxFnOB9S+3; 25:V5ozGy0FhVyl2UUNnGZIvSHPif57zy6C7XKDpeIhYFVY9zreZJIPtuZ9dxulyyw5X4WedOigntfTriH+AayXU1HrFMKB2IrpEj4H5x5tpXBcPMZXZ9YiXBrRkYLRllkhYHbceLj+kR6Sq2ozFzvXTdjGsDeP26tdUi7lskG4IhnKMIWCHxnggusIC6/C+/HeYJMQhyEeioaauhqmPJ3XRbL28ULbsZJAEBvLKCmjwJx/Rr/0WumlVRea4JBKzJvDCR7rrKWs6ltGuESuB2j9Ll6kdtQcpsRipTcrL9BAueDzlSfsvdeD6Waa+vwWvUTS5zXA/rJGUlJS4KNQbpgyGuW3K2OTQiUKmakiJZiWO8zwzsagmcblaNtrGkrh1Q5+qJIgKV6OgSJVwAbEN3ImGuXbaYJR+uOx/ERSlizo369X7okUqHNnZ2j2dViyBUQJsrmoWDslCZmqkXMQwhX+LQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0745; 31:l1By1wTYncaftXvMCYCzEdFOpdlujhh8lIdcLCU4f5hxZpNuoYWnKoW7M16llxK3L6guokOawpKySKfmbMaOmvXCzaNq8QaYG6GMAXrj5FCpjVlVIYkm9lcZ2CroK/ld6COIt9Z/nhZmi0I9AmVlt28I9Hwk1tIFFDLkN62zjGiPpe4/NtVlKPVQCPFb2QCF0kRxOMVKzLS/QKSUsQykadc2ydluiHJqqoJgw7+xmZyKuxrlD7XOSwP0O77E/B8fsqF5x5yUddMj2KIVMyI1xQ== 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)(13024025)(13023025)(13015025)(13017025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6096035)(20161123561025)(20161123559025)(20161123556025)(20161123565025)(20161123563025); SRVR:CY1PR0301MB0745; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0745; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0745; 4:I/Urx575Htp16mE7Jeix0jTSjROvcb+zQlsjkHHMEq5KAneLg2dnaRjapQu5yauanITYCA4HGU8grkFgDE6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DiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0745; 7:o1MCJP7PlevoEdorazFVGacFxp1P08Qblai9qlXC/rDd9XuLoIRo+fcw5L1i/F5qnuuAzE4ClY5uXhNZSDMOkRaG+acRMXrrcGW9SRhaAJAnJocM5KbPadBuKcLu5ks5EHE2QKLAfL95eaHsMqXQnllDQptbKH0sC3HFFPIrmqApKxCZD2/JV5V4d0Zm2D1+i8oBlmFb6/q4lzwAGbuHLxuu02YZ7Ku2spPpNeCOY08FojkVb7BLWq6rSI/sTPXhUxgpNPQIU6LlFA1BmhDjecqNCIxxcpUXq40L9b+d692zJJWHlq9BjMJZ1+JWOczC0OYaSqqxyQ0FtAdQ+ExtTxp92QLAxbOo+DaZqeCkRt9qPDz+eh880knq8VDiy/+SWEDIGaRzpwHphxLgRSvTm3T4E9xhiltEnPNFYU4H8uTwzI4cVKHu+7Rm/IergQ6Y52NKmw1GmDRTDAEd7sdGgA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2016 13:21:25.0309 (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: CY1PR0301MB0745 Subject: [dpdk-dev] [PATCH v5 06/12] eal: enable probe 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: Mon, 26 Dec 2016 13:21:28 -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 and calls: `-> rte_driver->probe() for all matched device/drivers (rte_bus->match() successful) This would be responsible for devargs related checks, eventually calling: `-> rte_xxx_driver->probe() which does all the work from eth_dev allocation to init. (Currently, eth_dev init is done by eth_driver->eth_dev_init, which would be removed soon) Signed-off-by: Shreyansh Jain --- lib/librte_eal/common/eal_common_bus.c | 51 +++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index b7ccbd8..6dc7b73 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -194,11 +194,60 @@ 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; + + device->driver = driver; + /* ret == 0 is success; ret >0 implies + * driver doesn't support the device. + * in either case, continue + */ + } + } + } + } + return 0; } -- 2.7.4