From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0060.outbound.protection.outlook.com [104.47.32.60]) by dpdk.org (Postfix) with ESMTP id C9B3FFA53 for ; Wed, 18 Jan 2017 15:03:32 +0100 (CET) Received: from BN3PR03CA0115.namprd03.prod.outlook.com (10.174.66.33) by BY2PR0301MB0741.namprd03.prod.outlook.com (10.160.63.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Wed, 18 Jan 2017 14:03:31 +0000 Received: from BY2FFO11FD036.protection.gbl (2a01:111:f400:7c0c::118) by BN3PR03CA0115.outlook.office365.com (2603:10b6:400:4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13 via Frontend Transport; Wed, 18 Jan 2017 14:03:30 +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 BY2FFO11FD036.mail.protection.outlook.com (10.1.14.221) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Wed, 18 Jan 2017 14:03:29 +0000 Received: from tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0IE250t026776; Wed, 18 Jan 2017 07:03:28 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Wed, 18 Jan 2017 19:35:17 +0530 Message-ID: <1484748329-5418-2-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484748329-5418-1-git-send-email-shreyansh.jain@nxp.com> References: <1484735880-17178-1-git-send-email-shreyansh.jain@nxp.com> <1484748329-5418-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131292218101343916; (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)(39400400002)(39410400002)(39840400002)(39380400002)(39860400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(54906002)(53936002)(189998001)(8676002)(68736007)(47776003)(97736004)(81166006)(50226002)(8936002)(106466001)(105606002)(81156014)(104016004)(8656002)(6666003)(5660300001)(110136003)(50466002)(2950100002)(48376002)(356003)(6916009)(626004)(86362001)(4326007)(2906002)(38730400001)(77096006)(92566002)(305945005)(85426001)(36756003)(76176999)(50986999)(33646002)(2351001)(5003940100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0741; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD036; 1:joVSs6/+JgrPstz0ClhFnf6MhYePaBxfG2sFSF4Jxa9mcVuQS5d2JJwAJLg8831jSsY9bqVA+bMT6KE+Z/pz4TlJwk8V9BEFoaoguqhzDEOOqzyjdxiiINfcaN/oMTwAm+pKMv2/kGPFLgQ3QJcoeFbVlfZGPnMosusfSkwb++oTbidUUICITxa/mFKhhyusOdU53A0lBAuPqce9aDapjErArKZuK8ziBryjkUMzKcWbIHBxTXOThgZGG5rDg/w1YizuC2RTPzqm0hCmfjWIySm7AxdW58dX6WtKUxMf7tFrn0484t8J9ziPkyFqzkzKBnTJSW+pZI4HQ5sMbBOvEMaBdIll7IBV6Gb1ugGbHpjZ9NqO+Tr9lhSHoSaaA1yssSDCHIEC5vF+BR9g//OcypcijL/0tQ+EHrmolVCIZJ9CJRpFh1Z3FV4TYt767N30FdN/JSpQsm6dP2CJt0NFPSTeyOUX+b/wFzqAVRMWBHxXBsNodS9sMijx9bd5GgS2PPdLGLzQAMsrmbivD9XBhdDxzCNymipXo6KaQM20dLwjD8uz3UaIgrD+iykGwGin0e+oI5Rq1uQe9gGUOfPIpuqXaoXv/iswBHZGb/IQfqUfdvLWWPdIFxVrdkQKB1YEOSJBZdRw38vPVHF6tHbElNMlNibOHlUJFA1uyZKf0uSFw7Z6NtYiPeX5cta5d3FpiLHqth+1RkBQ4D2tlKwTWQ== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 372bf8e5-c4af-4bd9-26ac-08d43faac82b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB0741; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0741; 3:YpR6Y9JThm2PP2ZQaCqBhJpuuBfSYA1QApE4aYwDGJV3BCTkoNVGGRR+Os8/VZ+wzVvvRXUlz6plS1/Lkn+HV/ejJDlCo9ChHz1U56drogD71TUXzS0uZtji+FZBkeVuCiIjbP0ntdQMe8iV9V/bfm0c1Y3wnES0fEtNhY7zVDYueljS/YFKH/xWd66WkEF5PPm3hcS22UYsbKL/JOpbsilMwiJG66k0uq9Zft0vJJgGaIXsws87aeL/X8jy9P9HK+wNM+t8jpkx3uc3A4FQ0+143mvf61Z1kH+bwMFoE0OgKJq5ghezLKBKm2RU3J6K1K0Mo9jxZM0p7wmoUNjOYKnSpsg72PR50i9p/i2d76cSIDQpRuMyPn3cBB6kGFtm; 25:Yyypdv33RtsuzMmitYZtk8ao5jk0JTvAzQUTIzw1x3l43G0d8qAiv55RxbCJHFn5yKjb8ovG8MZjbfmuPoyV+TVqKnchOM8iXS7uCSej4FTF+5LU8X0vrIJRHqjuxvthRFQ8eJs0P3RAhNMhNaQapgcQ2Prgn5OLOHeleT3fBJisOb9CpNgvDBR/3CHkQzflMBCvTbtTUobbG31I305rex4cbkj2B4y+su8gzVWsvFfNJQouME1RATho75d4R29oYblOcYa+h3Ajw05xJnYwjlHQuRtDoAVr/0TWsENX1CHe9v+g51RlP9NGjd6c/TZAy1/vlmvp9fbeElZAq1Th4a7YjY9tlW2xJHCcKW8GV04aTjbirg+bLnP93ys9zWfBtBVWhwujlqCR273ukpLIZXOX9680cv8oLOjWH4yKis3cuGcW4QRm5JbUueD3PEdfp8WKGacSKe3sDucQUNuF0A== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0741; 31:UcHXOfWIvCsbzMEoi1VvpQ5PRpduwV54d9zhqawRxgNNUEs8lNHbYiRHSGwgU62KWMI6wBK0q6zK08U0xhIGvtHbmljCHdLga0u3YQy2sBjtu1cFoaZMZXtVdCHzTJNeSVCu8S8yjt/OEwHdp1b4nX++JkWkaNQ5tuKMJZYNFpduqMSNPIILBgrb88acBKzxHXU3ebWihZXXfNaXYt0t88SqVsSbIDHkzi8z4Wmra6jnFBHsAWJzySx1oJ7J6SXcppmLxZMCFxp8QA1ykr92UQ3lRYqSNqvwu6f+ldr/9Yk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13015025)(13018025)(13017025)(13023025)(13024025)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123556025)(20161123563025)(20161123565025)(20161123559025); SRVR:BY2PR0301MB0741; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB0741; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0741; 4:38NT2+zRgHtK05Ox5jWGbKc3CuwKuPQRPbFowWe0Zsnm4Ofd/gLFnOzCA3X1vT2848F91bchurVsswxyorv64z5byeohewOf+9giB29BdlB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LyKxNO9B1hAyqVjc+W+k9ncb8z?= =?us-ascii?Q?DA1PMDl8YvetsdpPJTZVBFOEZBxewy/oMIL5mrkh4USWvFwZdkcoF/fRP3CG?= =?us-ascii?Q?e8AqMi79Wz1u7qtigkOHUpWeEVHIQH4ufHEJBfcDfkxtZoDUr8Fze2QMS/2Z?= =?us-ascii?Q?AiXRNuxPdWB6TTdLFBntZMgM=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0741; 6:y1JNUUbNvUVXQrMpoEGzn3I5OvSBCngPt/MBeWgF3goveOvYmSbYxH9GRaHRrBwGjska1NdJxhk6xJLujtLaIs2Paa2psE2bQBCTum5gg3tIud+3YtyHXitc0W+O2KMFqpdCO90et+anlj06CibPHWAMWcfb6qQzeOsEYj7S2zwCuppEAm0OFgR9dWrCYCw8x0DVc1Y7/odBl+n99K3taF+jPrhVTHCtZbSOffurlT5fUfFT3BmHRKT5/9UTb9AoHt386Zopil0hPrwz6qqizLbs0+aOeWV1SWxYoE0naidq4utKVIfMqYqlyKzvxY+zf27otH692IWbvdy68oTCY1K4PSt0JHbViyRrs12OHXexqNsGU4BiiyW0FNsd9oPOtW4LKdVxWGyZzr5ZQI4WXifVaZqXIK+4tEio3j7iGMt5XTMxDNTRPT/JVxLscxiA; 5:1ltkUwWjTbrBiYW5HeFwg6RiO0iSZSeEGdjnFZhvbdi56f8r9j9E4nftYbaQZ0SgmDRo8gDWllL1+iAeYsCmLadL8XA4Gp2psCz6u2pGt+aIiROP/gM+zC+WwjHOfybKrvgUa3xUSIxCD7EKuRiwo8M8I883bfAv/eq1cIYiYrco0bJSrrJW0fYW5ALwmhnv; 24:vbA1KBhQQ2A9oVCe1OEv1q3qIlMEFZZLYNGZnG0ejkOOYivAWfxKZPgdZM4TvYAXQOu2jC7BFEfZqWIqZOpDTRT4hgPSHtkL4nYbWrbhWOE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0741; 7:yuOXUQ38+IHggGTMqgdzi1oc4+19CLiU0gJthfRE6sALgxf/MEadaDtbnUNzjSCLBYtABv2VD8DXzF4uuFE4U1XjQKTsK/hmSl/uupDq+p3f2Fuqn9GyrSb2o3TxUxLrU5hMOfqz8FS2h29vhtrPLmG8UUUhGVHjfSvVcT/MgnuLBOSLyYskAIshH1Ay2cdZ8VEXZeL0RzU7920UPhsQ8XTkPX/2kZZVim6E+cPfmAQ3YmIf5WQ+x/o0KyBOwKmg+T+gBo83g0T328O4g6adRwZDEL8t5XctZjL3fwnOlZfKG4WfL5dw4kO/qzWTJof+FDuy65v5zWZwlkSeRChtnz6jm9oj0DNv6dYkUYPVFJZ6KGwUP1vK8uqvxQe9k6szElZNuYvBwJFhl13jwmKQul/3CjBCXjpybutpFRhzXouxWrnANmdXtQAeQJFviGO9Qaq1/YutxgAGvSrhCIyYkQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2017 14:03:29.9471 (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: BY2PR0301MB0741 Subject: [dpdk-dev] [PATCH v10 01/13] eal/bus: introduce bus abstraction 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: Wed, 18 Jan 2017 14:03:33 -0000 This patch introduces the rte_bus abstraction for EAL. The model is: - One or more buses are connected to a CPU (or core) - One or more devices are conneted to a Bus - Drivers are running instances which manage one or more devices - Bus is responsible for identifying devices (and interrupt propogation) - Driver is responsible for initializing the device This patch adds a 'rte_bus' base class which would be extended for specific implementations. It also introduces Bus registration and deregistration functions. An example implementation would be like: .--------------->+-------------------+ | |rte_pci_bus | | | +----------------+| | | |rte_bus <------. | | | name || | | | | scan || | | | | match || | | | | probe || | | | | remove || | | | | ... || | | | +----------------+| | | | pci_driver_list | | | .-------------->pci_device_list | | | | | ... | | | | +-------------------+ | | | | | +-------------------+ | | |rte_pci_device | | '----bus | | | +----------------+| | | |rte_device || | | | bus --------------------------------' | | ... || | +----------------+| | ... | +-------------------+ Signed-off-by: Shreyansh Jain Reviewed-by: Ferruh Yigit --- lib/librte_eal/bsdapp/eal/Makefile | 3 +- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 9 ++ lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_bus.c | 95 ++++++++++++++++++++ lib/librte_eal/common/include/rte_bus.h | 111 ++++++++++++++++++++++++ lib/librte_eal/common/include/rte_dev.h | 1 + lib/librte_eal/linuxapp/eal/Makefile | 3 +- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 9 ++ 8 files changed, 230 insertions(+), 3 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_bus.c create mode 100644 lib/librte_eal/common/include/rte_bus.h diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile index a15b762..63c1fda 100644 --- a/lib/librte_eal/bsdapp/eal/Makefile +++ b/lib/librte_eal/bsdapp/eal/Makefile @@ -48,7 +48,7 @@ LDLIBS += -lgcc_s EXPORT_MAP := rte_eal_version.map -LIBABIVER := 3 +LIBABIVER := 4 # specific to bsdapp exec-env SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) := eal.c @@ -78,6 +78,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_cpuflags.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_string_fns.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_hexdump.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_devargs.c +SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_bus.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_dev.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_options.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_thread.c diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 2f81f7c..12298f2 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -174,3 +174,12 @@ DPDK_16.11 { rte_eal_vdrv_unregister; } DPDK_16.07; + +DPDK_17.02 { + global: + + rte_bus_dump; + rte_bus_register; + rte_bus_unregister; + +} DPDK_16.11; diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 09a3d3a..240995c 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -38,7 +38,7 @@ INC += rte_per_lcore.h rte_random.h INC += rte_tailq.h rte_interrupts.h rte_alarm.h INC += rte_string_fns.h rte_version.h INC += rte_eal_memconfig.h rte_malloc_heap.h -INC += rte_hexdump.h rte_devargs.h rte_dev.h rte_vdev.h +INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_vdev.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c new file mode 100644 index 0000000..49b3516 --- /dev/null +++ b/lib/librte_eal/common/eal_common_bus.c @@ -0,0 +1,95 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2016 NXP + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of NXP nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include +#include +#include + +#include "eal_private.h" + +struct rte_bus_list rte_bus_list = + TAILQ_HEAD_INITIALIZER(rte_bus_list); + +void +rte_bus_register(struct rte_bus *bus) +{ + RTE_VERIFY(bus); + RTE_VERIFY(bus->name && strlen(bus->name)); + + TAILQ_INSERT_TAIL(&rte_bus_list, bus, next); + RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name); +} + +void +rte_bus_unregister(struct rte_bus *bus) +{ + TAILQ_REMOVE(&rte_bus_list, bus, next); + RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name); +} + +/* Dump information of a single bus */ +static int +bus_dump_one(FILE *f, struct rte_bus *bus) +{ + int ret; + + /* For now, dump only the bus name */ + ret = fprintf(f, " %s\n", bus->name); + + /* Error in case of inability in writing to stream */ + if (ret < 0) + return ret; + + return 0; +} + +void +rte_bus_dump(FILE *f) +{ + int ret; + struct rte_bus *bus; + + TAILQ_FOREACH(bus, &rte_bus_list, next) { + ret = bus_dump_one(f, bus); + if (ret) { + RTE_LOG(ERR, EAL, "Unable to write to stream (%d)\n", + ret); + break; + } + } +} diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h new file mode 100644 index 0000000..2dc9bef --- /dev/null +++ b/lib/librte_eal/common/include/rte_bus.h @@ -0,0 +1,111 @@ +/*- + * BSD LICENSE + * + * Copyright(c) 2016 NXP + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of NXP nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTE_BUS_H_ +#define _RTE_BUS_H_ + +/** + * @file + * + * DPDK device bus interface + * + * This file exposes APIs and Interfaces for Bus Abstraction over the devices + * and drivers in EAL. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include +#include + +/** Double linked list of buses */ +TAILQ_HEAD(rte_bus_list, rte_bus); + +/** + * A structure describing a generic bus. + */ +struct rte_bus { + TAILQ_ENTRY(rte_bus) next; /**< Next bus object in linked list */ + const char *name; /**< Name of the bus */ +}; + +/** + * Register a Bus handler. + * + * @param bus + * A pointer to a rte_bus structure describing the bus + * to be registered. + */ +void rte_bus_register(struct rte_bus *bus); + +/** + * Unregister a Bus handler. + * + * @param bus + * A pointer to a rte_bus structure describing the bus + * to be unregistered. + */ +void rte_bus_unregister(struct rte_bus *bus); + +/** + * Dump information of all the buses registered with EAL. + * + * @param f + * A valid and open output stream handle + * + * @return + * 0 in case of success + * !0 in case there is error in opening the output stream + */ +void rte_bus_dump(FILE *f); + +/** Helper for Bus registration. The constructor has higher priority than + * PMD constructors + */ +#define RTE_REGISTER_BUS(nm, bus) \ +static void __attribute__((constructor(101), used)) businitfn_ ##nm(void) \ +{\ + (bus).name = RTE_STR(nm);\ + rte_bus_register(&bus); \ +} + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_BUS_H */ diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index b17791f..24c1c00 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -122,6 +122,7 @@ struct rte_driver; */ struct rte_device { TAILQ_ENTRY(rte_device) next; /**< Next device */ + struct rte_bus *bus; /**< Device connected to this bus */ const struct rte_driver *driver;/**< Associated driver */ int numa_node; /**< NUMA node connection */ struct rte_devargs *devargs; /**< Device user arguments */ diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 4e206f0..88fdc43 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -37,7 +37,7 @@ ARCH_DIR ?= $(RTE_ARCH) EXPORT_MAP := rte_eal_version.map VPATH += $(RTE_SDK)/lib/librte_eal/common/arch/$(ARCH_DIR) -LIBABIVER := 3 +LIBABIVER := 4 VPATH += $(RTE_SDK)/lib/librte_eal/common @@ -87,6 +87,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_cpuflags.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_string_fns.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_hexdump.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_devargs.c +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_bus.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_dev.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_options.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_thread.c diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 83721ba..d996cbc 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -178,3 +178,12 @@ DPDK_16.11 { rte_eal_vdrv_unregister; } DPDK_16.07; + +DPDK_17.02 { + global: + + rte_bus_dump; + rte_bus_register; + rte_bus_unregister; + +} DPDK_16.11; -- 2.7.4