From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0060.outbound.protection.outlook.com [104.47.37.60]) by dpdk.org (Postfix) with ESMTP id A2E002BBD for ; Mon, 11 Jul 2016 15:29:13 +0200 (CEST) Received: from BN3PR0301CA0061.namprd03.prod.outlook.com (10.160.152.157) by CY1PR0301MB2026.namprd03.prod.outlook.com (10.164.2.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.534.14; Mon, 11 Jul 2016 13:29:11 +0000 Received: from BN1AFFO11FD050.protection.gbl (2a01:111:f400:7c10::191) by BN3PR0301CA0061.outlook.office365.com (2a01:111:e400:401e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.539.14 via Frontend Transport; Mon, 11 Jul 2016 13:29:12 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; rehivetech.com; dkim=none (message not signed) header.d=none;rehivetech.com; dmarc=fail action=none header.from=nxp.com; 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 BN1AFFO11FD050.mail.protection.outlook.com (10.58.53.65) with Microsoft SMTP Server (TLS) id 15.1.534.7 via Frontend Transport; Mon, 11 Jul 2016 13:29:11 +0000 Received: from [10.232.14.199] (Tophie.ap.freescale.net [10.232.14.199]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u6BDT8mM029015; Mon, 11 Jul 2016 06:29:09 -0700 To: Jan Viktorin , References: <20160708190945.24225-1-viktorin@rehivetech.com> <20160708190945.24225-2-viktorin@rehivetech.com> CC: , David Marchand From: Shreyansh jain Message-ID: <57839F4C.40507@nxp.com> Date: Mon, 11 Jul 2016 18:59:48 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <20160708190945.24225-2-viktorin@rehivetech.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131127173517894779; (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)(2980300002)(1109001)(1110001)(339900001)(377454003)(199003)(189002)(24454002)(105606002)(106466001)(8676002)(77096005)(47776003)(2906002)(104016004)(2950100001)(23746002)(4326007)(6806005)(7846002)(586003)(81156014)(65956001)(65806001)(356003)(50466002)(64126003)(305945005)(189998001)(575784001)(86362001)(33656002)(4001350100001)(5001770100001)(97736004)(85426001)(8936002)(230700001)(87936001)(83506001)(19580405001)(19580395003)(92566002)(81166006)(76176999)(50986999)(65816999)(54356999)(36756003)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB2026; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD050; 1:KrgwpUg/1Cvi45LsQwlvAG1IjQduUrsVbNQL9RwojfwgjRzWDnVvQEC3El62dHdIWBlZpRA5OPKKT1RzpmL9DuKzixrw6j3UAcaFKZQybctyA/U6jw0hEBqg22sQpa+6YwItYfXDMAW5xLmc2QK3z+6J1TPu019G+vKJMqFlWJx/JiaWeL5ViVuqgtIfpi53sUnUOtMxuPA2XW/O4duYrneayx0jjMp0RVXX5Amp6YxTMDVzFaqRYtF0bMzopo1+zCVchKBVKsbWG5hHYHZ4M34PuwcomeYTqo6rv+7DV+6oDfxQk3geLSJYs50VmHcuSI8k2OfeJOkQzwNusbCYMZnaPL2HNFMCzGQ7pznZ/wGu9JlYdjO+Rxv/FxiCSZIrVn9tZKzmlbXYUZTGlSQeBDoaAMXz5lPNEtLGGwRGoOQUHbwTdWdI9DLqYqXPG9SFNCR/Fc7DGBIgNGz/csYDW+OFVVXEl5rM/bufbKG2wnF45dngjkb9ldVNemFes1vXsbSWL7HiLTZB9AI2MDpTqA2v0ZVFMPKZQBaWEypl9tmL9yPeyjF8LqZe8R3E6Niyt0AZbL/sW3CZ9uRTta7i+Q== X-MS-Office365-Filtering-Correlation-Id: ba5a4e97-e517-4153-647b-08d3a98f5866 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2026; 2:nc8tBw9J1Yfr0e09eePiQpFBBwKJzPLu4x7UXzpEShD4PRG2uzcLltkp3tTeA3L7QrB2cTSB9dbdvbhIj77s3JutxYqc/Sb6+1Yy23P4LX+orKcEOrm+A0BdeRRJiJdTD3isT9oyASW5nu64hGr7HAs4LxMQZS0S9Eo5MeizdRECpBJR7wcgyCZ3OZKjHVOR; 3:nmTTru6N5uX0nMVQ0cxo/Oi0ONvUPORVzKNAxvlC401urthdHZE5IXr+9BhWK7Gahw60hpW/hQs6VK7zNSk7ah74rTFUoDJqiiTwM/jPbPMsc76cxakmsBbx5BSr4iqExvQFRa9R+tUb8bD2f+mqA3+bTctgmaY9vFRNy70LEP8aFQIhueNZvcIh8R//uQgtI0IQc9lNhIpK3I0cpdnLPZbI0RTcVmbplhTtZto6Oeg= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB2026; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2026; 25:nXVDj9sl3ZtSbrXtUU7NDB9x5CSNc/Pfp853mIx4WNThLTx+ki8APM69Y80oUouX/Uu3em8pDrJLlfVQb8spIkLo9/8kMEIp4MYQGzuw7r6uIiatlZQAequgrEX7ea5gGaOb1vOqUNmqamNy0gwdnMNYZh2U01AtD7qbUnLdcZfHn2MKB0RvTEwrwMOGYsAMo+1Fj75UBVMe4JFHltMESrcmBs0ZOXBEqx1TPYYRIP7XMGqwYEPPhKIM32Y+T5d9Oha8tUs1L6i5K04q5oK36dsJNzMhiW9iML0R5s+jK5dD0W7ZjBbhKKE/B12ZpoJVRx6rT4gHF/PgW8BxMdaFH8oxvoQ+F0J/jJ+MFlPC6xtvEdsU3Pu8sFKCMzjJgWWF+9WNnE+E9VKyMr0cey2P9unmoD2OQUeaRztoZxIBj3rwrl+J+s1t1t9XH++8RMvlzkRtxji7yJcE8/g3/jhiOdUuHZU4ZUS5CIedUKQ5X0WD3wqEXIxs6w0zpSdileDL1tLiRZFxohQT0JeY5M5ugHeLrJxEOhpqSi3dupX6fQr0BVI9fCDkBNC4RDKMCZSoNcwYJNgu8oIRgH7MNIjOoaNIE6XxX2tsAHYJxbbUTzS7sQbkhTzMNJcAjtS8ZiP2mQ+vt9g3NiFwttDQEBPt/2qow4ufcsYeka6UPmYZLIHmqZ/y78qJJYQJWQYQwkHy2bpjy2ZSRLqZjsmn3W7mkjBBHzPal8V6iafnjTluaX8=; 31:jHeNctWCqRqY4H0rukz0udVs3nQNzkX+VNGTM5Nv81gk6fjAUGmY1POmr003mGA+FNKhSt3e6IV141McwYGgIp+fZkQ6blaIil6yR/WohZp6ECFSlLLKr3ZL9zlLmAG5CpZ+5tUdzGwAYkL8EKcPAIWvlS7SIF1miZ87NsXhCtrhnCkLT9baXxTudoCPKBc9ETSgsniz6tTzmXsjpMl4Mg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13024025)(13023025)(13017025)(13015025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:CY1PR0301MB2026; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB2026; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2026; 4:PMEPmwTz+D5DEjCElh3GFCd80j0vACYPpPueDec4dia/x4B6J6HTmHLfp3M1zDEjRomEf0BZFuoApv1KSbNSM1BWgXiCE8jjbzIkhUfB7HMnvS8FQpXU9+cjeVt3xvO6HLzc6qKQzjdG2oyEBOP3VGmDQvOLuM17bRgpR3ZhzH7Sti2oWOFna11WACTfFEUK8GiM57TIczdUCLzex+nD4GwaqCZrO29vO7LzXaRF6eGh+pgSgdPQ6+NDTOqeVPi2zCmI5DRrtiNsjTXkL4YTLy8C2KTxm+6zv0CKTIhJA8mocRpKpaqD9b62rh5L5I4t2D7GFrzbWJHQkBZPDN+3qPnk494ai1MLxEGoODTVkN44k2lo5J+dv2tFGDN3udrNlIGF8+Ag/TPleRaw+n81lbhaC9MiQnssySCDczsjAwIs28Ws7uKc8qjCUgE2+ZRhTjqdgTvTuIf4H7v3XoxSemKVNC+HJnzxB6KerRaEmGFFq43sNZnkFa2kYB0CXDz6RO2KXL9bVItFojuNH6LwRg== X-Forefront-PRVS: 00003DBFE7 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; CY1PR0301MB2026; 23:4o4TgZCGoNBdBcEWS5ibnXugYwAqWoWhChS?= =?Windows-1252?Q?NMLEZana3h6ObvakNtjTIuHlMPWjaf9+A7ZQ6vyz0sngN6OgD0ckHYJ7?= =?Windows-1252?Q?76TMo1ADEMWK4rucB5JB9jWaVTKRb8IUtHPau2KL2boyXxnBc7eVh2uj?= =?Windows-1252?Q?iO8Y6RT4qrmOGineoqX7XIdDGjIkaqipEiyRehNmsJyJu/58auGeK9tv?= =?Windows-1252?Q?VS9e18Myi/7DEKFaREIb7gMybxOLDQnnJszXi9PuwRNgimqayCb22xKW?= =?Windows-1252?Q?RToQMyL8XP8Z7Jhjw4sWjClO567ZjY+ogMGUAoLdhyoSvRyw6eC568Nu?= =?Windows-1252?Q?4UqVkYeGfyT8kxuHpdhbSWIWSxyJeepRLZ9hzpxe1Mv5tuBGBvH3R2CW?= =?Windows-1252?Q?mKRuEuU9TF+4cMvLBWMVoxpqCmzBTz45oRe4T3h41PaUdk0E6RD5ZN5Q?= =?Windows-1252?Q?LSyxjEOjCJ/cybzKGIyR7+Di82TCIZ4KObsH2cfOdvvXDwk5GdNlquc7?= =?Windows-1252?Q?QRkKr6jMuA5puAayK+sfowf02SjHzhsZSAEZDyy0RQAAg8XogdwxK4v+?= =?Windows-1252?Q?DdTIEXkgJam/TaXZOjuVoTM+eDN2ZIO2MA+g4XmLa1h6CUutVG1pIf5v?= =?Windows-1252?Q?lEitjsRBLaOaL7UFEVkmb9BhFRnPsOpDiEt5HkoKaoPg1jgxq+9RMISd?= =?Windows-1252?Q?AmsP1JN4p5bVJbi+P5hzMeFVyNmPM+OE2tnznlkNyyVUG1gscFzJosmv?= =?Windows-1252?Q?l405Wlme/oPwbTfVaM0SmKscJe3gNP+KzR+zYH30c0W8QpPE1bmfDk0i?= =?Windows-1252?Q?PF03AM5Tbg6HTfzqptW5Lu9Bq27OuNLNaqtLuX01scwu3EKNd/dNXAi4?= =?Windows-1252?Q?aecrdmw2IA5OE0mQihens1AHo2SEFk3mNpSSCN88Nhzqh+FLdpmXIqox?= =?Windows-1252?Q?Wd3vuP6NId5Y7GKi9V1w3wNJWbecESFz1Jj53cdvdph07S2rCyr9/eoQ?= =?Windows-1252?Q?hugLsTy68VO+cd6LsUMGG/lWrg/asxvIC4b2z/2ee3BY6ygof42borYo?= =?Windows-1252?Q?GAf7nG2sb+SKOSZEKKVZPTtsjxaJsBGtJ4nq655P427ZXyFTKT5C9cy5?= =?Windows-1252?Q?SXOHcr/ChvQscTo83VRfFY1pfh9lOMuO4+j4iOogADhP8L5bk8a7aHdm?= =?Windows-1252?Q?VshlysKO+3Q57A07HREBlFREdwLDdnjfWxa6lKx+vQ4F1vpqFCXnyWj5?= =?Windows-1252?Q?3flXOpyVz3pB1lkJ8qDEbgjGzZtihgMAvk8c5aKJ9IcSxJo6b9Ww08B4?= =?Windows-1252?Q?k1JXzBm8E7lw/i3zge933ANxol8HqDHIqYDhVbFUtD+G8nUg=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB2026; 6:VPRNFtDnMSlDdCGT3gnLcE3K+JgN0K25InVMeTzx4SyMWFDPTe9cHHnBF0IYAp/th6WYo/dhq1ky/dRgLtQ4c605D9xVqt9X3j0Xl/Q2lw8KqUCV5dkM5gi07vuHN4td+/Z7Thy0fnwnqGiCLycF4KAQ/2xT1td5Z0+IsLCoiZgF66U9CAkSCLeubH88eP3gflu2ZheguOi1Tz3AYugLFaK8nh1TbSKJdAiJgJWAkmNJiZb71Azw8v4rTDXW1YtwbicWaPBG1mbJC461IPera9Ywvo9kPtyU9Ro4PDd9ieA=; 5:KMWxtZrsMAh5EhcjJSW0gHmZhcqPZyYtvuejJVykT9HJYXSVVNTBLEpY1rIsbFfgGfv8z6wpyZ0Y2payz9zUvFCacRXO/RCCa1DZPI5DIcS1saR89CTwFCDRpdiieVasoMX/QjG5/sFWCFjGVZ0rD0zV5Fgu4ZK0o0dbanWxEso=; 24:iEoKt9u1lwP2/Dma5MTbCg9BT7XnmPUxq2pAPPk6B5ujKUf210Hj2D8CFTkVkYvEEQ55tpSnBMazZe11T6s944VdFnkR4zAWF+uVLA699HM=; 7:yawrx59LKkFAywtYIZQ9FlmYSN7R+8onaHCpJDTm5ZS3CjomLCtKF7l3lh6zJFPo5KeTLGNxlxOoSPRONnKX69XZ+VDofXcyJeToANQ6Kk3JUiMglPZkTHC1IbKDHDOXGRyTeGy6OgU+74Lw4JVcUr8TB7jo6BdHaMFH6HaJfFijL46RwRokUye0n2xpidXkLFD4oUtLLMzFOgWuoaIBHpnoh622NIhryUxGcQ95tkaBbzDCatJ9LOHwKzr81q2j SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2016 13:29:11.6022 (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: CY1PR0301MB2026 Subject: Re: [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 13:29:14 -0000 Hi Jan, Some comments. On Saturday 09 July 2016 12:39 AM, Jan Viktorin wrote: > Move all PMD_VDEV-specific code into a separate module and header > file to not polute the generic code anymore. There is now a list > of virtual devices available. > > The rte_vdev_driver integrates the original rte_driver inside > (C inheritance). The rte_driver will be however change in the > future to serve as a common base for all other types of drivers. > > The existing PMDs (PMD_VDEV) are to be modified later (there is > no change for them at the moment). > > There is however a inconsistency. The functions rte_eal_vdev_init > and rte_eal_vdev_uninit are still placed in the rte_dev.h (instead > of the rte_vdev.h). > > Signed-off-by: Jan Viktorin > --- > lib/librte_eal/bsdapp/eal/Makefile | 1 + > lib/librte_eal/common/Makefile | 2 +- > lib/librte_eal/common/eal_common_dev.c | 54 +--------------- > lib/librte_eal/common/eal_common_vdev.c | 104 +++++++++++++++++++++++++++++++ > lib/librte_eal/common/include/rte_dev.h | 1 + > lib/librte_eal/common/include/rte_vdev.h | 83 ++++++++++++++++++++++++ > lib/librte_eal/linuxapp/eal/Makefile | 1 + > 7 files changed, 192 insertions(+), 54 deletions(-) > create mode 100644 lib/librte_eal/common/eal_common_vdev.c > create mode 100644 lib/librte_eal/common/include/rte_vdev.h > > diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile > index 698fa0a..b7e94a4 100644 > --- a/lib/librte_eal/bsdapp/eal/Makefile > +++ b/lib/librte_eal/bsdapp/eal/Makefile [...] > diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c > new file mode 100644 > index 0000000..ea83c41 > --- /dev/null > +++ b/lib/librte_eal/common/eal_common_vdev.c > @@ -0,0 +1,104 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2016 RehiveTech. 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 RehiveTech 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 > + > +struct vdev_driver_list vdev_driver_list = > + TAILQ_HEAD_INITIALIZER(vdev_driver_list); > + > +/* register a driver */ > +void > +rte_eal_vdrv_register(struct rte_vdev_driver *driver) > +{ > + TAILQ_INSERT_TAIL(&vdev_driver_list, driver, next); > +} > + > +/* unregister a driver */ > +void > +rte_eal_vdrv_unregister(struct rte_vdev_driver *driver) > +{ > + TAILQ_REMOVE(&vdev_driver_list, driver, next); > +} > + > +int > +rte_eal_vdev_init(const char *name, const char *args) > +{ > + struct rte_vdev_driver *driver; > + > + if (name == NULL) > + return -EINVAL; > + > + TAILQ_FOREACH(driver, &vdev_driver_list, next) { > + if (driver->driver.type != PMD_VDEV) > + continue; Now that two separate lists for vdev and pdev exist, we don't need this check anymore. In fact, PMD_VDEV might not even exist. > + > + /* > + * search a driver prefix in virtual device name. > + * For example, if the driver is pcap PMD, driver->name > + * will be "eth_pcap", but "name" will be "eth_pcapN". > + * So use strncmp to compare. > + */ > + if (!strncmp(driver->driver.name, name, strlen(driver->driver.name))) > + return driver->driver.init(name, args); > + } > + > + RTE_LOG(ERR, EAL, "no driver found for %s\n", name); > + return -EINVAL; > +} > + > +int > +rte_eal_vdev_uninit(const char *name) > +{ > + struct rte_vdev_driver *driver; > + > + if (name == NULL) > + return -EINVAL; > + > + TAILQ_FOREACH(driver, &vdev_driver_list, next) { > + if (driver->driver.type != PMD_VDEV) > + continue; Same as above, redundant check. > + > + /* > + * search a driver prefix in virtual device name. > + * For example, if the driver is pcap PMD, driver->name > + * will be "eth_pcap", but "name" will be "eth_pcapN". > + * So use strncmp to compare. > + */ > + if (!strncmp(driver->driver.name, name, strlen(driver->driver.name))) > + return driver->driver.uninit(name); > + } > + > + RTE_LOG(ERR, EAL, "no driver found for %s\n", name); > + return -EINVAL; > +} > diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h > index b1c0520..2aeb752 100644 > --- a/lib/librte_eal/common/include/rte_dev.h > +++ b/lib/librte_eal/common/include/rte_dev.h > @@ -210,6 +210,7 @@ static void devinitfn_ ##d(void)\ > rte_eal_driver_register(&d);\ > } > > + Probably a stray newline. > #ifdef __cplusplus > } > #endif > diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h > new file mode 100644 > index 0000000..523bd92 > --- /dev/null > +++ b/lib/librte_eal/common/include/rte_vdev.h > @@ -0,0 +1,83 @@ > +/*- > + * BSD LICENSE > + * > + * Copyright(c) 2016 RehiveTech. 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 RehiveTech 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_VDEV_H > +#define RTE_VDEV_H > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +#include > +#include > + > +/** Double linked list of virtual device drivers. */ > +TAILQ_HEAD(vdev_driver_list, rte_vdev_driver); > + > +/** > + * A virtual device driver abstraction. > + */ > +struct rte_vdev_driver { > + TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */ > + struct rte_driver driver; /**< Inherited general driver. */ > +}; > + > +/** > + * Register a virtual device driver. > + * > + * @param driver > + * A pointer to a rte_vdev_driver structure describing the driver > + * to be registered. > + */ > +void rte_eal_vdrv_register(struct rte_vdev_driver *driver); > + > +/** > + * Unregister a virtual device driver. > + * > + * @param driver > + * A pointer to a rte_vdev_driver structure describing the driver > + * to be unregistered. > + */ > +void rte_eal_vdrv_unregister(struct rte_vdev_driver *driver); > + > +#define RTE_EAL_VDRV_REGISTER(d)\ In the recent commits, I noticed that macros have taken the (name, driver) format. PMD_REGISTER_DRIVER() (now redundant), DRIVER_REGISTER_PCI_TABLE() ... etc It might be better to stick to the same format. > +RTE_INIT(vdrvinitfn_ ##d);\ > +static void vdrvinitfn_ ##d(void)\ > +{\ > + rte_eal_vdrv_register(&d);\ > +} > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif > diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile > index 30b30f3..9553e97 100644 > --- a/lib/librte_eal/linuxapp/eal/Makefile > +++ b/lib/librte_eal/linuxapp/eal/Makefile > @@ -85,6 +85,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_timer.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memzone.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_log.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_launch.c > +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_vdev.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_pci_uio.c > SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_memory.c >