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 A3B5258EC for ; Fri, 16 Dec 2016 14:09:13 +0100 (CET) Received: from CY1PR03CA0005.namprd03.prod.outlook.com (10.174.128.15) by BN1PR0301MB0738.namprd03.prod.outlook.com (10.160.78.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Fri, 16 Dec 2016 13:09:12 +0000 Received: from BN1AFFO11FD041.protection.gbl (2a01:111:f400:7c10::157) by CY1PR03CA0005.outlook.office365.com (2603:10b6:600::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14 via Frontend Transport; Fri, 16 Dec 2016 13:09: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 BN1AFFO11FD041.mail.protection.outlook.com (10.58.52.252) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.771.7 via Frontend Transport; Fri, 16 Dec 2016 13:09:11 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:807; 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 uBGD8BtI028345; Fri, 16 Dec 2016 06:09:08 -0700 From: Shreyansh Jain To: , CC: , , , Shreyansh Jain Date: Fri, 16 Dec 2016 18:40:48 +0530 Message-ID: <1481893853-31790-8-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481893853-31790-1-git-send-email-shreyansh.jain@nxp.com> References: <1481636232-2300-1-git-send-email-shreyansh.jain@nxp.com> <1481893853-31790-1-git-send-email-shreyansh.jain@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131263673518126811; (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)(39850400002)(39840400002)(39450400003)(39410400002)(39400400002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(8936002)(47776003)(104016004)(50226002)(8676002)(81156014)(81166006)(356003)(8666005)(305945005)(33646002)(85426001)(86362001)(4326007)(2906002)(68736007)(5003940100001)(189998001)(76176999)(50986999)(50466002)(5001770100001)(97736004)(92566002)(105606002)(2950100002)(6666003)(38730400001)(77096006)(5660300001)(36756003)(48376002)(626004)(106466001)(7059030)(21314002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0738; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD041; 1:xolZ1p4GQIVGL9y3SArJB4eG0r0Kdrl9shcTWYt1MEuQIPHCNjDtbqBUc7tIdRF88hQa7mqCfv9TdH+RHRz+lPkrM9LaoYf25RJxqX3vISDttShQ6UnNG1o9JoOv9zlZwaslaNtYKf+AU3AaP4GBApILbk7/5yj9YO8pa6ZLK4Iivd1D35jZ6zcIGwXfuAOArtw81/dEu1GU+myThWX6YxVX9txzByqvy6u0/0YXSrHwLgSo69DBp9Ao4r7eYdd6wGoj/qjPk0SlrwwPpxO1FtuoMArQR4xcxxaxsOkPJ7OxBrLht2dJL75KzbtpWzHuxWbpjZs9BZ2GUNL9WR5EFsGIVr3WjAnVbOKr+A5Hl6Qssa+BmqKTaI7N4gd4zF1PS/uIBDDkdvRl1L7E1/x7VWctSH61nIRrVWad2gb5ARq/4sAoasd3a68D4WpsKucHlh/GJPvGp0//A7a01+7ISOz650olD4inCeNoQjucdPWN4BAQBHzk293bZd+I/RKf1i0fXJzxj+njv0+inqY7TDfxIPd69qYJ10OK3zYlmsw2bEj/zESW8lD0/tXt/KxB6h+Jxll7vsUbBEdh0OmWQ3MSa7nbuMSFXvk6PS2KFzEUl8LOREOHWQJdZEqpM2htwK7yfpPzhp0rynB547QUER6C3PFhZ16hXJFkNd807Q9hcqpgwWjJ5dAvr1YT+/KA9lnXLNemCxZosKopNavIJ8hUfPLPLLBGknEfbPEKcR3BuiBCmlxVwcWcACh5kXuhIKXhc0PR9ovAJfdChHZcHQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b47a2178-ed02-484b-f6db-08d425b4ba6c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0738; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 3:eE0cCjl/bLSMQzgc/Sa0ajO5iGFAHILWN676WmyLqrsxINtY4TBVI1aggIdXTQ3e/iO5RXJf2yfT08V6jZFUwLVf5Kc61dcSNXHH5koyIKgo7Mwsd65o5UudQafozj7QdJFunUuVgmfe8axefkJVcBvGSPrsYFUvI8Y5JC2b29YivVEpDnr+4QYDuh/jDi+QfN/Fj/bDQJ9jziYyamuhbs+b6HPr9hKLLw/v0p2aNuGF1IJ0Ruy0nYXIsJD+8eIGa+XhamzdQfQLXZgvlCC7yN5zQ3LPREkviZNQaqk8MC3w25jUYka4He4n700ND4+ZnvN59Z2rdDf1u9Ln74t+XQItJxtBBHDUSiFPXX1jHbZoZP0Kc/1a25KDQXwQ3XAM; 25:oXYKJh/ErxBeJsRCqQPTHwaiU7AhJFVFb0CoYnWlkIh4h8QfI+uHAfIzVsT9n9FNM0SM7VhxlvcvUWFUmEXD4r6ET++nrbhNBIJ9bGGZ7McvkUt+Fu3kZTt9r1KmTEPpcDokDg/Mc8XII0OVqPE3ZRpcmHFxushVltp4UgK/znjjCXmHX1Dv9WnGvWLsXguM2qbjsEMOWS3U8gcQY1VeQQkIevCmc0KEflL7FIkfpb34m6DHzun+pWIgkVv61c/ZbaxCM5uyJKBEM8S6WnTKwd7v2W2BrIKf9bjDJScS8F4UrgH1HStruZAt+EbL3f9ZdpL41qnaVre0UG61Cfz/U0dKvQI6mWVAj8j3Jy1gQuF3NA0IVq5YpE+zYaTfcoE3ameW4Zv3i6RsvR3LHD3j5LXxNjQyrpSlfY2ZYoJMIvpmk+V+E1vies6bC7McRCi88frRx5HrsAMJ5ElH0mImwg== X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 31:pAFiGD+37SciInIXdA9Am8RImjx0SYhw2p3swcDPCn/JxK8OajxGxfgRZ4AaaYwBHSnudSBaA11dbkzW5b9RQDvb0qZ2AoYXlJLsrdcu5XwKOpC4j4zfE5E/Zd2LsH/FdiL8X0oF0BgtkkeE77JOPIT2XzjFaUL0/1cUwKmje3Ux+NXqWEz9L2ZW4zJko1oYG2nTtbY1dwu9fNBC7Go92WXRMSZQ3fai4Aa15ekiwqYQST3reGl7SED31O9qHifSe0GKRUC0wFwLCMBxp9vjvaMpm13zrgdxzMnr1kfA/jhioPLPZbz2KuT1Z9lZaptL 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)(13023025)(8121501046)(5005006)(13024025)(13017025)(13018025)(13015025)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123565025)(20161123556025)(20161123559025)(20161123563025); SRVR:BN1PR0301MB0738; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0738; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 4:vrg7Pe+kr0ymMAnQBRB9o6tklOh7kw6gXLn5Bfn/mqDX4hoMoT09GQxwQAwutp83NkgecKj6KYflIINt+KbhlJ+VjxGpHj+ezVbwwV69U53t+bSq60TdHZnH1L14j0s8lmieFOMw6cxeo/0ZneZRJTBshMgr4n0H2JEPEK7C22nvokVzy/EXnNytEirg4ATK/WaqIfPvi3dghmdl5Ntc27923Pu65LcHcsUIemaO5UWScvwUsNY9MvxyasS7NOEQNwm7SnbhxExL3KiGExW6cunVLh+Nu1Ga0pLA54Ad/Xizd2qd69ZGSF2Izze9Gl/3YmDRHI3ylEVLb7MZR5YvPdicP66E5nG8KkQ7hIFvIBxdpbbzj4KCMTv7ARbhF6bWq80rVUtdTPwSs4rB2j0EsK7SSaSvYB2AAeVFj12d2XiRAmFQvQOEexJaumdDl3FJ17+fUjTBoxTLmuosKZH43VBgRMqbMp7SkgyYwZBgwgeVMeJpFStf8V7xir0D5kLERZgXbx+W62gK5EO3/Oo5yDUpn1TRfc13YX3b7/16fTWMfnn8zZsZ6MI8Swz+cdgON3XT8IcUeo44a8ETtfYHyi4Wd8rcsQUO3NpSqZH/brzKgYsHpVWaRdAwNPHyWq46j44M8UzWIbyJ6VtMiPiT2642Tu9ZHAWY/HoBj5bpWTIBxuVSVNhcJNfRAsAXj4jRXpNrRY4EF5HKjNDxJM398vdp6xMrFMa0T9xoN3ydEVfTVc1LdrbYeaylZMTcrkJW X-Forefront-PRVS: 01583E185C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0301MB0738; 23:eywOK99GgyMdmU+zuouYVbbR9Au0mWOJJOOTCeP?= =?us-ascii?Q?D8u5+OAnihc1oGHxjpmxRhbzetK1WpTSn/AEM5uOgT5Fspe6nzJ0ji/V/mK9?= =?us-ascii?Q?aao6b8U5Xl3YqPqRBRzZl7bCcbu2vCzcDeHHCM2Gqm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aL0vtHKwffLdE8+coYkk2c8dkTxp2kW/UAK9N3RkE0obCuGPlaYoCRCeniYm7LSfg6bZZrH3z6/9wnQ+0a/SoQxe3Bf7t1HU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0738; 7:Jkn6FBDjhd74mG4geSxbeus+0A+WLDqq05NlupgqrZKjKUa5s8O1nJV5sRUjfyQKPXoZi15HVenDvwxrSSa2U3vveqs/OeOTXh1y53nZrBy/CagZqbXixsPvNTRjFRyrO+jJ7gGIlGTUpjWkrzad4XplLQsCO9VKtaqxiKVgNH7mdpLs/EocMEv5/oCpCKwvpAsd27dELeSOGNSHlVGRXEy6gG/8/n5Qja4buG9k+ZOKWTFEh55MseVY3Wiq0VKO/XxZsmx8z2wHXHisjWGjXorVv3BE36Glm8SGAVwNgv4kMHC005043vBfa4E1aQtSQsXO+yyhAWf7JFI0+jt3ZFICFiJOQQiSaFXf4/hlOYCNQ34BwWNVFE1wrDn39BSuPLkQ+3KbF2s5sowI6suWAZQS3kg4mI/U61jf6Nlr+1BKd5FgQg9Ke/FhxQeMbsbsOCEzHdT9m+nmGw0E1Sz4pw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2016 13:09:11.6254 (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: BN1PR0301MB0738 Subject: [dpdk-dev] [PATCH v3 07/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: Fri, 16 Dec 2016 13:09:14 -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 5fbfdcc..0dfa800 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -196,11 +196,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