From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0069.outbound.protection.outlook.com [104.47.33.69]) by dpdk.org (Postfix) with ESMTP id E0BEF558D for ; Mon, 26 Dec 2016 13:50:51 +0100 (CET) Received: from BN6PR03CA0054.namprd03.prod.outlook.com (10.173.137.16) by BN1PR0301MB0740.namprd03.prod.outlook.com (10.160.78.147) 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 12:50:50 +0000 Received: from BN1BFFO11FD037.protection.gbl (2a01:111:f400:7c10::1:175) by BN6PR03CA0054.outlook.office365.com (2603:10b6:404:4c::16) 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 12:50:50 +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 BN1BFFO11FD037.mail.protection.outlook.com (10.58.144.100) 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 12:50:50 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id uBQCl90O011201; Mon, 26 Dec 2016 05:50:47 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Mon, 26 Dec 2016 18:20:38 +0530 Message-ID: <1482756644-13726-7-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482756644-13726-1-git-send-email-shreyansh.jain@nxp.com> References: <1481893853-31790-1-git-send-email-shreyansh.jain@nxp.com> <1482756644-13726-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131272302504422888; (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)(39450400003)(39400400002)(39840400002)(39860400002)(39380400002)(39850400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(50466002)(8936002)(8676002)(81156014)(81166006)(5660300001)(92566002)(68736007)(38730400001)(305945005)(110136003)(356003)(97736004)(48376002)(85426001)(5003940100001)(6916009)(189998001)(6666003)(86362001)(2950100002)(626004)(36756003)(50226002)(8656002)(47776003)(50986999)(76176999)(105606002)(106466001)(69596002)(77096006)(33646002)(4326007)(2906002)(2351001)(104016004)(7059030)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0740; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD037; 1:SreNe2Zz3Z4mpKENJhz2Eq0Wac+Af6gRfOVpqa3YuwZnyon6+lFUUDxZT/h1EeztukK3Nu25LFiBTklZfkKDYYsMEpr+5JrkChT2/Cw4mrpvWF/Y1CcEKpdI6jhqZqQD5o1EtpE5oOHSR0LT6rAZuGiJ/Vvzg74DPgVEW07gWsK0emsdblOaTJB4szwimXflqf/ECSKDEIaRVBhFsUY2fyqtQYM7Z7vmq8LLyg+HxaA17hpQmNAHwGvwdqlFSngcYv0PaBCz0di8HY/ydiGi4lqfp8u9giowhw3zqIMIQSHzjRASKlNy3fxI0WiaTXs0TMUC18gJvjPgWbnEkzwjoUUEmPZBfB3hXhGMSLZrBrERYk3qiCOBEkcPFU539EMJF1zdga+Un28l6I36UrakIpGKyj8wXeDLDnhZmkEYrlCrXvHt34KxoMsyB1LcqScP35jd1YoTDo0/NHym5jy8fpF8IjochP5x3sPvio1vXEj6MKE3g1IpN9tbj9P4dZYcqHycVqHhCt/iQRSlL7s9zeCAEZt6LzYqid8CgMKfsv/Gq0hFCTzYormEr6oBVr9rW1uVjazmvMPE9O8B8b3EQr0BlXteqoC/P6lc9R0DjxGe2/ixd9pbi12paEpm0yrn3t9lX0x68itu4axNkSIBC20biIXqSGki9dd8z5gx/C4wbXwYO3A2qRcntPRqhiYXZ7CJyLU01yKp+nqmHRXW3u+4u9YjrHIV/0dAm9+A/JI= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 01dcd3aa-9627-4434-4188-08d42d8dd201 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 3:cdfVMv6u3Zpy4bGkOHvJwqGEM0zeC8iFjukSwTheGRQH3ywBNthkD1nn5O31ScMj/K50PmCjt9pXLl+ZnFS6PS2033/bxTcLHo8+omqnhbGSbdKTqxznRbQLSW7sEhuv7l9PjHR+V6urW2XHKmNca5xG3AsK2YH9PNMl5W9sqsrwpsA0M1oA7vocfLYfSvJknGGlWHdzh5qfoAHV3GH1jljGfKLEAkLB4/I+yDXvJ3qLo4aMnv0iu022flqJoDYNxvNETZd9I9vytvO3XSuqGdAN2w5JnqdUxT6pzPwzJpEzDX29O4h3ntoQxtkgeBXI+hGFBPsG+iP7mtUCqYeJLqRkDqfxPcdPDw9gP2bt2n8=; 25:6eBNO0oIf0Honjv9DSHL4nhnhI9SFvGZEI0AYhCYnlK31u2nXPfRECwBaFD15t6U/z0az9ObSshBvso0SvYvpKQl5SfWV5CroN0tBchJ4NJuOK585YjghlNpwJ18FEf83tWHlP4ji7vrLnQDDQjfJif/2OWTkC/3x+IEKNMbiSs/bJBGC4PqQnQ7fbs8C0ZDkmsa2i5HRAso1KVK4g0AiRsdnWfWSwf7wXAPnEPU0ir3j/QKoJwQBjBiEFdrIemB8s4AXPWMFR/pOSBbsNmLzsE415PcXxjF5RGEiEymsH+m/P6JnPVzbpNDwoTJtLHWI7tygs0QqWh7XwHvBZ+mY1Bdy//JKaQLZJ8/Jh7MY5veBBUdMlakYN1LePW78yuuiHFAvIh/uNocWDZced4sMEO5pQEzZqWocNIrM/9leeuQUaOELCwjaBe8wBgpljb0xhEVpWEAkqd1s7tgoForbw== X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 31:P2AE2fgKU15ODad9b5KYhMX8eA+x8FGpAHjblUlt0SREqVEfFsIZBggLeBNxkXgnDlzyCJo/bZYmqpo4aUH43ek87r4Okb1PNRTt01pomZ+spkrCKqYZ0lwMG7stMzn15UtKpcpqk1wV44bm9HYaiplWuvcT93U0AYX6FHfSY8nfMWDmmIElcJ8GjyWjhPGKisGMYbAeAk2Bb149uOg0O52gefQeRVyCBnZanpy9+7jRP53a5dP3ahWK0TGcMc/YgxckDKJBXVKrMR1KcOKJcQ== 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:BN1PR0301MB0740; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 4:olfSiO7yY8ZoLTg0ap1MO7wfoQLQ61nRJA1s0uQDd2SPqoP+xmHGsmFJSdUFTUVDM+5Q0NPbdVqJWXM22tejkBsp/DktGm19VHd9z2Ae8cXBmHkWslQZSYWCJXF3Yo8MxH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: 1; BN1PR0301MB0740; 7:0lV7NA1cowCYpyUeA0mQfI+oh2tTcPJ1zI3cpwOIHOlayhNfGqYSxb8pvTBRGCaWOaoRi/rBk3o9ubYJTMQj8NU5Q4lBEWnVvIVU32X5M97kr8EHT/xPEi7m/FHOn0VqAc0++jB8CB1QKWHCQ6rXjyypaScj/vFbPGl70+CY5HrcJ9fVQ9l8S3uMTEljHRiF9yIBSdnH0bEDGCy0uoCRwoEP1fuBgeVNtYG0vKQc/MlPYeQkn2gBcyTPxEfzOPYM7/+9w4DLer4mc5SuUgU39NvykUzBD5rLgO5oG/d8gwZ6y9QIwg2v77bIbPu+KWuwP3lrRS+I/8wUI7EMtFnpPZQa5Yn24kdEMcfVvKL8icyWE35s+vQSrseeuQttKURD7akbu2sJVLcIrE4Grk5ItXFyg0iHohSP1Kqdjvk6TUVejGGOP9ymLlXZUH/7if9TBqnSGwF4KbqZZUzqUMxIZA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Dec 2016 12:50:50.0678 (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: BN1PR0301MB0740 Subject: [dpdk-dev] [PATCH v4 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 12:50:52 -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