From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0050.outbound.protection.outlook.com [104.47.33.50]) by dpdk.org (Postfix) with ESMTP id CB3072A5D for ; Tue, 13 Dec 2016 14:34:59 +0100 (CET) Received: from BN3PR0301CA0071.namprd03.prod.outlook.com (10.160.152.167) by CY4PR03MB2471.namprd03.prod.outlook.com (10.168.165.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Tue, 13 Dec 2016 13:34:58 +0000 Received: from BN1AFFO11FD018.protection.gbl (2a01:111:f400:7c10::135) by BN3PR0301CA0071.outlook.office365.com (2a01:111:e400:401e::39) 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:34:58 +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 BN1AFFO11FD018.mail.protection.outlook.com (10.58.52.78) 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:34:57 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:805; 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 uBDDYRw9005048; Tue, 13 Dec 2016 06:34:54 -0700 From: Shreyansh Jain To: , CC: , , , Shreyansh Jain Date: Tue, 13 Dec 2016 19:07:05 +0530 Message-ID: <1481636232-2300-6-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: 131261096981339439; (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)(39400400002)(39840400002)(39860400002)(39450400003)(39410400002)(39380400002)(39850400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(104016004)(36756003)(47776003)(5660300001)(85426001)(626004)(2950100002)(575784001)(6666003)(5890100001)(86362001)(50226002)(8936002)(50986999)(106466001)(305945005)(356003)(76176999)(105606002)(50466002)(48376002)(77096006)(81166006)(68736007)(92566002)(81156014)(8676002)(8666005)(5003940100001)(33646002)(38730400001)(189998001)(5001770100001)(97736004)(4326007)(2906002)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2471; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD018; 1:ztEQ38gaomRYCab6XVvT4ioiQObMVGGhPsZGkct2z3aAjMz/PqHe6y7eEyVYDk4Dh8RLHFwXdi43WWKJfFqfNxE6wGi1p4QF6KgymQLcJWy8Mvym9pp1TKPIVYUeqo3cx2vkskqcnDNbDxaNIUyaW4QeReXnDg4bzdyQUrpEPJ7tGYNJH2mos605hSLV3zgRFzVX72UIYJU5B6d+Gzj5Yiqwa+1boKLI4qLPLUObkGwIjZ4rRSQcU66uIT2fQaksykQa/226924f6JrBXi1zb0tTR0MZeqy0WeCGwiTctXZ61OE4mh6gn70FUkCc4KeF9smRwfguVdO0fJbbd5aKbiyQdWmmu62bpiUHlW6bonuDgfMWOwbs+sgjv2Hn953at8+ZPckB9evywT2gI7NkvGEPBS3VaNAJUm17xP1r37+lxC8j7zKJPGu2UO6H08b364/Jv8WVlOPUJ/QufKx/Wj/xk+fd26HkNgHyKnSD+WgqCmpeVTeezHfjOLyqEJ7oveVE9kgYNfDkSHWSl44YuAYqULNQruSl54Rod/Bc8Si+7A7UPktDmZdp2lFR7GLZOHhOkR6YXPN44JMINzIqTVHZ/tgAORf3mMXLCE+KaGgmmWx3sCKLyBqFtWwgUhbYspJzlZYUzcbn6WuuYUoxuTIRDMJg0fF9A/uHABxTtm0kAR43hz4ennUOxYLHw0LLHxRODZMUnXylo8SGkUq+EBV4lMsa9IXNYyEdHsWUo2oHfwGrWwkYjg1TvkIq5535zs4UNSL7FazPhQW0MWFU8g== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 3b899601-37a4-4e22-3bcf-08d4235cd4db X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2471; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 3:oTVH6bvb7ZJxx1omcLEOaRbCIjE8CoMC06vbN6Ob3t/0+rSN71LFWgmRehuGMcoQ+WOqxkCIfXFvJTv0WcgQ+HnzY5V20M/4w0r6z90PCJ6mEbm21GOC0aXVJK/3+crGj5wbeuMZanVe3hFHFvhambSle/7OzFlghjus/ar3kHXrwYFYzjgO5/yS98Mm4Xb2UVmKbjvJau7pJEAaA01okb157qO3+TKtkxgxbMFSJgLaw2BH1Y/u0E8tpUS4NDQNAUtwWUiyJuUn7omgv80IVtK04Be9LAf69pzHIcdintjf8ONVcit+J1WhvEdB/SVXj3qq/IX/XRIOC1b5qMg7Wj9K/0RGDz8erWlmpX9cl6zq2VEg+edVJvlk3HfhpZIy; 25:MA6li5VgbrvcCCXQ8opkf9XOr9KSclLWob+40D1wdWuq4ETlUyyWGDw78lIQNTa+Rjt9LYq4cajZ7v30jBi7jukb742Uj8Al2XV7wlhpNiEi0Ku+gCvDEokPxfucyQDObiOWWtHRNprqmM0FByMKs/GsQGxdYZt1IqL6qaYT4KxpNyLMEXLYV7duC+T3hm0N3q8WAzk1tOT0hTb6lRZpLVLvuPhEqs1cCaeuIhEtk+/pJIovWqG3QOV6Gp13a64wxj597xR3fu01B6xgdOKWNYXundWq44Z1WyIxQV40EoyEsvw7xmwLbX+RDIQUbu4WqDK+8Coah+0qnFIKmQ4wCRHWgq/6dQZAJASF+PrkkiPRVsPnlR16GlX22FBxcNf80D9BnefHwykiplhTM6XdLW4RkSBlCkJPW2g5rRVx2MNChupnaKQIR8CmuDQEh6rmNl6Ywe50pwPyZYVZQAOgWA== X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 31:g/r/66IO46+mS5ea1ecUze7kKJ9zGfaQOBUqchvYLFmkI7Su/i8g1pKu6I4XCPus/0cQjPpOAjqUntXwHMD0oleAHMWCKOVY+n8LNmoAdx0N9qyKycP6g2dbg5jGne5RXwZQUYwMCQa4kHIjsgwP4SPXfdaDMhn73E13QxZhByAjZNknG6YjYJWlZjdfuLyLSBEEtvRo7O0637TcTrOPYXozcsK9KOZqBHew3MuTIG9Lb/fDRtkxdmWK108MSfnYF53GUsZHVg9sOL7QeEW/m7NkB2ZyZadoP7bu4fJ/QH4= 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)(20161123556025)(20161123561025)(20161123563025)(20161123565025)(20161123559025); SRVR:CY4PR03MB2471; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2471; X-Microsoft-Exchange-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+DWj1pmAJ/kfyXK0fedltbGU4oVMSg04dGCncDRPYJXD7+eu/ss6XzJH2CTP2IIxUDGfmYbXCxn40XzkD1YY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 7:LBQKiHW5NEdVttj9CATKhsuhfOG98OSENVPiXG6yqDIb0CnIYGiDDozwBpLR0uiSLt7ODNVMAPTHRq7LxKiLMv9B1nKvVzNVTQCWc/wtWIt6lL0yI15/kGW5nq+H9lrIoNxxYoEnowvchmps93Fgq13/5q/9XZs9iPutouA7IV2TJgjYNAc/xLgT04pwoFtLajEzYjfqaseVwh+n7YdSj+/+8YaOrZfFIiCfDRB0WzGwLHf/H3PmWbo1Z7+qybm1M6OQCi+ipSyorAD2ElMyS9irnFGlIAavL7wO6BpxGcfw+5CJcMy9e2bN4nRjs1eB3IsiNqBDyL9tYuY98zk9tN8ipHllijPZ+VEMR6wrmORwIBKCw8e/MyXAxYNQYlZhdxJdDrutEAFqyIFbYrP0e0LuHTENtq5THGKDMwFFYjddJOCJz02OahRL0qUG+fE5L7LY2JcYY5JQsZeI85qfdQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 13:34:57.9311 (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: CY4PR03MB2471 Subject: [dpdk-dev] [PATCH v2 05/12] eal: integrate bus scan and probe with EAL 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:00 -0000 Still a dummy implementation as no real bus driver exists. This adds calls from EAL to bus specific scan, match functions. Once driver->probe is in place, and a bus handler has been installed, the code would become effective. Signed-off-by: Shreyansh Jain --- lib/librte_eal/bsdapp/eal/eal.c | 7 +++++++ lib/librte_eal/common/eal_common_bus.c | 30 ++++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_bus.h | 19 +++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 7 +++++++ 4 files changed, 63 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 35e3117..30afc6b 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -580,6 +581,9 @@ rte_eal_init(int argc, char **argv) if (rte_eal_dev_init() < 0) rte_panic("Cannot init pmd devices\n"); + if (rte_eal_bus_scan()) + rte_panic("Cannot scan the buses for devices\n"); + RTE_LCORE_FOREACH_SLAVE(i) { /* @@ -616,6 +620,9 @@ rte_eal_init(int argc, char **argv) if (rte_eal_pci_probe()) rte_panic("Cannot probe PCI\n"); + if (rte_eal_bus_probe()) + rte_panic("Cannot probe devices\n"); + rte_eal_mcfg_complete(); return fctret; diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index 3be9c77..67b808b 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -173,6 +173,36 @@ rte_eal_bus_unregister(struct rte_bus *bus) RTE_LOG(INFO, EAL, "Unregistered [%s] bus.\n", bus->name); } +/* Scan all the buses for registering devices */ +int +rte_eal_bus_scan(void) +{ + int ret; + struct rte_bus *bus = NULL; + + TAILQ_FOREACH(bus, &rte_bus_list, next) { + ret = bus->scan(bus); + if (ret) { + RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n", + bus->name); + /* TODO: Should error on a particular bus block scan + * for all others? + */ + return ret; + } + } + + return 0; +} + +/* Match driver<->device and call driver->probe() */ +int +rte_eal_bus_probe(void) +{ + /* Until driver->probe is available, this is dummy implementation */ + return 0; +} + /* dump one bus info */ static int bus_dump_one(FILE *f, struct rte_bus *bus) diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index d1bd2e8..9bd8650 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -209,6 +209,25 @@ void rte_eal_bus_unregister(struct rte_bus *bus); */ struct rte_bus *rte_eal_get_bus(const char *bus_name); +/** @internal + * Scan all the buses attached to the framework. + * + * @param void + * @return void + */ +int rte_eal_bus_scan(void); + +/** @internal + * For each device on the bus, perform a driver 'match' and call the + * driver's probe for device initialization. + * + * @param void + * @return + * 0 for successful match/probe + * !0 otherwise + */ +int rte_eal_bus_probe(void); + /** * Dump information of all the buses registered with EAL. * diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 2075282..01d0cee 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -69,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -847,6 +848,9 @@ rte_eal_init(int argc, char **argv) if (rte_eal_intr_init() < 0) rte_panic("Cannot init interrupt-handling thread\n"); + if (rte_eal_bus_scan()) + rte_panic("Cannot scan the buses for devices\n"); + RTE_LCORE_FOREACH_SLAVE(i) { /* @@ -887,6 +891,9 @@ rte_eal_init(int argc, char **argv) if (rte_eal_pci_probe()) rte_panic("Cannot probe PCI\n"); + if (rte_eal_bus_probe()) + rte_panic("Cannot probe devices\n"); + rte_eal_mcfg_complete(); return fctret; -- 2.7.4