From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0057.outbound.protection.outlook.com [104.47.41.57]) by dpdk.org (Postfix) with ESMTP id 357D9376C for ; Tue, 13 Dec 2016 14:35:05 +0100 (CET) Received: from BN3PR0301CA0024.namprd03.prod.outlook.com (10.160.180.162) by MWHPR03MB2477.namprd03.prod.outlook.com (10.169.200.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Tue, 13 Dec 2016 13:35:04 +0000 Received: from BN1BFFO11FD026.protection.gbl (2a01:111:f400:7c10::1:156) by BN3PR0301CA0024.outlook.office365.com (2a01:111:e400:4000::34) 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:03 +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 BN1BFFO11FD026.mail.protection.outlook.com (10.58.144.89) 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:03 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:804; 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 uBDDYRwB005048; Tue, 13 Dec 2016 06:35:00 -0700 From: Shreyansh Jain To: , CC: , , , Shreyansh Jain Date: Tue, 13 Dec 2016 19:07:07 +0530 Message-ID: <1481636232-2300-8-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: 131261097039404794; (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)(7916002)(336005)(39400400002)(39450400003)(39380400002)(39840400002)(39410400002)(39850400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(105606002)(106466001)(626004)(5001770100001)(97736004)(5003940100001)(77096006)(38730400001)(2950100002)(305945005)(33646002)(4326007)(47776003)(5660300001)(76176999)(50986999)(85426001)(50466002)(104016004)(48376002)(356003)(8936002)(189998001)(2906002)(50226002)(8676002)(92566002)(81166006)(81156014)(68736007)(8666005)(86362001)(36756003)(7059030)(21314002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2477; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD026; 1:b41LQG9HDnT1jaco4J/QddkoZNIfmEcTwZBIhMurN9ZRG8Bh40rh1NXWldiS+Fooyhha4XY4RxLelejk5Tha59PmSFnKWnzGevLJkgK5rcndFxMG8MDiyk9bb/L0VlABFHePnxZ9pgMrfcJ0eB4CRJDt3VR30KMR5j+Bn4bbHZwvh2bd8pvqKPv5OLc/AFab78y9SWnt665zl/8c1EGctYKKu9MWpMNrrexxx145xiTaN+6Jr7LYVaZCRbk1DkEleQVT/fDuQsLu2mZTEA+5NxDdO8KoyUNhqNNdVXn3VZbwUOKRLeBK2nbpH525MPLIq+sqfHO1ByTwXEEQXoAWeS8DDEi43xN/pEx6RDL2N4TqNp6fzdHkZc0YCsvRyoprZj+wpOinWHO6/B2cnJrUUS33Iguzc5DcvHH3fQg1Te8kvhTjdNftB/vEQiFI669nkjeQdZFDazSAWkHxbBWMaiSqVfDFPfGSPgoHAq4Zhd/CvZqD3I2TA8N5cVQRmwgIjvY2clD4OS6vAYQKmy5vq6meYuB0z+QaJzsjcBDl46AV+9/Vrn1rNZqKz7pgHroYzSUN20bcpVvgUAX4wjXkMAZU8wvtORSXAIeCFHrwjt+O7aRKXYZ6hNW2VvrOf6hK1QdMeCmfrZHbDsr2OzcTHANKYvGbcdPDwvjvzS3CFb75TbuKE8jrSzkhoju8vJsEmhwCZ4rAdmgF2OlolUvyEfSvLyWIfjBLdq7Sod0Wtm4oWNIuerlGN8WNx4FggeOHQLgxGnfPR70PXuSCgvIp+A== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5cfa8a96-30d7-48eb-3d99-08d4235cd851 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 3:AsJFHfrZMj0PPUj9/1wniPBZ90CnqMIJ01gLE4WKKUuVzTfOxQ/j8/ADal+Kxz4T/KlA9uK2leXGnrUyp4XpZegyrhHbQ1o8/rtCRreSqixJiDHpmWgNOxJNCbsUS53V8sXFSJg7US0JmjjJWwQkd3Pa8e7Vy/LxrzWIjO6Bgzsy1b+adE1EZfOQRx60is73/cxOf8/n32Tb6mDyKShpnV3IrvjImoViyLi70VuJsOZY84sHihpcot9Vy/+VARe7cbV5uy1L3sKNxBmaBgcnuvOkYWAAa3FC6ILCwiCJphv5NjEZGXDL7uddgyWeq2NNUhfL4m9av10k3QzfdJPVhUjH0SEeQlYLqz9ad3gKVKgfnttBzTLQpNxAW6tQShc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TMzKQrNWfgi1f2FRoaaGPi3EM1r6PzryL4JUZLOpl7gAjOE8yMBV7wULkqNMqdFIFgCn0jlV1rD27vg== 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)(13017025)(13015025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6096035)(20161123565025)(20161123563025)(20161123559025)(20161123561025)(20161123556025); SRVR:MWHPR03MB2477; BCL:0; PCL:0; RULEID:(400006); SRVR:MWHPR03MB2477; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 4:xdi2znWWTGSkuJPNNc292NTM2AcBCdUxeoWl4yOFeGajB9FZW+nWzwUDl/GptjVDwS5xGeVNZwpTYL5VJRYviJMtCb3skw7bnAUqFHoHZBEgEr7nVykb6KbPreZ4B+wcgrPWIz4DZyqjl0FVG5YJeq0AtYdCD7c0w7/+aT+uMQMfFdkYXkBGTJQ3UKUB0nvy6ntQEIeatRqusWJb4eLXJ4TVrDW8JT7zhUm4hr6aiU8+BVwawn3r5rWGP4th2++YJjpKsImhL0rgsEeLiyV9gTMqO1sxZmranQY4kJZ7zEhWIxdh6VcIK08szz3rnDcav3AXuGyZNiQQMk5XgWpthz9pJ/VkldiW9d3ETYOPD9/iL/I4XSsGAxC7kCBU7/l2Lg44AVbzZe083buSeJacU6/g21nLfICO/6ynLunzt6Ec47OjEnL/zjG7kT+LxKwfMDeyaUomY/6sFAN8jZL/+aIt550IDGmdcRrXy8Y7ZaJ8B+ItUR4LCTJi5T23ZPoehbtUoizdQSl1apFcfbZWtK3VZf3nCEBDLdQf8P1GH6jawfflfmbTkDHmaMFjH0HS5Xov26h0VGjE7/QmqAQflk1Ry8SWPd4dZ2t5iIpI6o4NQMX11BWy0/QOOxUtB0DlcNDGZbjE8iucoug+SGZ1U9TULSyX6U6EsQI/N5tXnmk9+ySOM12bVMgwlIQgYHahX7LsM5Xbiyp5h4DvnqbMwty/vVN/AVUfNW6D6d2cJtvteNQ0ftf7GQzJC8omjqWd X-Forefront-PRVS: 01559F388D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2477; 23:CW7yuLl+vKKk42iG4EmQxhFESqdP3cWBee/U08WUE?= =?us-ascii?Q?Q+l1e/EoSduDiWAYnfuou0ln746zH6gJtOJbQOTxvbJrctuLG7O3MsEWbjLN?= =?us-ascii?Q?P9wiAkYniw1iDtIczwv82YC8wxqKU0idHwvoqdsV4p9OUFPtw9wXglALQ2N+?= =?us-ascii?Q?gUf6HIgZmJmAQbrRebtSweVFkFqjbh3ST9Klc4L1S8tMVxjJgcsMPhn/ckwf?= =?us-ascii?Q?v8yEQMbKZdHLr3/3c+IzbJp9tVgA8sl0elLKXwc57iqoLi0TLy665i4a4msF?= =?us-ascii?Q?Tvb0gx4htuCzvLQMHBUFrKyD+sp6nblf9ViN4XtqXj1aa5Y3IAKpQ5Cw8gTJ?= =?us-ascii?Q?1HEEQlYzQB3l3XVvQGmkWc+tp+1jm6AdXdpmRKJAzY3aC0K4RZ20H1eWoAys?= =?us-ascii?Q?/Q+oWWcyBg140lriYXyUNtoaWPo1PmVTKUsz3GEPf3k9ggqdk9z6/x9k7h+1?= =?us-ascii?Q?vQ14a2I0+nl0clwPJvqpJZKzhF2ztUFQCFwicQDynfEqHdE/LSed6/oqXndb?= =?us-ascii?Q?yCqxjABWpvBrGfhUL1KM8fcy4EDeFlLVDATsvoWKvdtz/z/enkBM8Nmt5tFY?= =?us-ascii?Q?JM22utrNPLdcG6rkjxHtFXNC4xl5CG1sqm40r8AZgxxY/B4geCVB0WH513Yi?= =?us-ascii?Q?VrMe+VokYDOz1tK6wO9WC6Z7fa/24ltXKAwmRG0IrLzZjih+KlSRvDL+kgGw?= =?us-ascii?Q?Mo7RNu3ovr2VphHgv8tU0ZS1AYADFzBkyV3DSpO/m4MuAJwpmdODw08eJPb3?= =?us-ascii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M4G+kVypHceHcBP5Q1mDyXIUgdggikCD0lLUlywqcM3t4+VxZO2uet/k2i; 5:mS0+f4Gc9ZAVyGmdCF1xwQv+ma9ZpQ0LSLhIdanhMdAdMZhhDMyCkQ2+aF6FqOzaeX6x8GC2ypK3jEVH1DAqk3klWE7oQce05LFqkwxxpyRN3EtdhgNRKh0uQegw3gxGBVnuwIPq8HKgEobMKbKae5SsLSi/Qfz9MzIajwun0Oj0eeq4aLxjKYfh11oA6cCQ; 24:eP/XrpS3mo2bOYWLL+/Y9mqfSqR84MDoEyRpALn6RNPQ7NQR5qhTKaZTtNpElOmibVmc/0QunHJtaVevF9dWobz1c5YkJUyJcHy78JMR7F0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2477; 7:CtlijClKg9480QSKvPlg5pFgxKWda/vVawRfiZA1qQw1NCSbI8MTei/YOwpcfKPbomLlzc64N3pN+XCZxAVXBkum1PSfkMiPsu/Uk8Uj5q23bpzS8uZBifnDZKxrtQUty8RHFm+EZ7orA1Qx21C7Vp8r0S+CzSSJdXzaWgoBZDvFjvbbAkPoEKH0ypoF60BjVFn2o75ZOSHTrToVv+kzUpZ2J5F/d9P0Wpa4Uv1uJZu0GJGcTjjfwiSNKIInpd7Ph8FQk5lWyV8QXy7kCE+lQbNVP+3b0uw3LqOJAAcLr9DZUrRxLtTTFKch8b35ywZBKw7VE4/7A5/f3qK7QLSLrL2kPZOiHc0betY3vtc9Kq6eqc75v3D87nFXMZYkPTkTTv8GYTsg5OlIRxj8W5/tzlw5Y4y3J2qQlYbhDS/NIRmFDNI0Yf9DQ6MSs6ZV7yFeHnBq69UbZCXPyBjuRacG4A== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 13:35:03.7532 (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: MWHPR03MB2477 Subject: [dpdk-dev] [PATCH v2 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: Tue, 13 Dec 2016 13:35:05 -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 -- v2: - No more bus->probe call --- 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