From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0072.outbound.protection.outlook.com [104.47.2.72]) by dpdk.org (Postfix) with ESMTP id 94C231B72A for ; Wed, 31 Jan 2018 09:58:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=c+UNke2r58guzGE6HYQQ3duHjWB2S+9N58JROBfzsO4=; b=WgdiWF0aEpzPuL3QaHsu7t6sKrexZy+S7WSxwUXi+xvWVjjB2tE+xR00N+8NfZzrVyYuWglWRoJgAasAGKPAQI0+0tBaYdff0i0FfLtZROIWrMZ5hxAcHFJKui4MXCtacTik+d2GM+W9q905oxRdimTbrpC89FQ0H9/Wlhqheig= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shreyansh.jain@nxp.com; Received: from Tophie.ap.freescale.net (192.88.169.1) by VI1PR0401MB2462.eurprd04.prod.outlook.com (2603:10a6:800:55::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Wed, 31 Jan 2018 08:58:33 +0000 From: Shreyansh Jain To: thomas@monjalon.net Cc: dev@dpdk.org, hemant.agrawal@nxp.com, fiona.trahe@intel.com, rosen.xu@intel.com, Shreyansh Jain Date: Wed, 31 Jan 2018 14:43:08 +0530 Message-Id: <20180131091318.7894-1-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180130145710.24757-1-shreyansh.jain@nxp.com> References: <20180130145710.24757-1-shreyansh.jain@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.88.169.1] X-ClientProxiedBy: HK2PR02CA0168.apcprd02.prod.outlook.com (2603:1096:201:1f::28) To VI1PR0401MB2462.eurprd04.prod.outlook.com (2603:10a6:800:55::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5e937f5a-d270-4f27-58fb-08d56888d103 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0401MB2462; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2462; 3:ou/ofosWukeuXCJm7+b24JLIFj9r6d4Ph+Nz4p8T6ZtNfd68Nql7m47JIKPfv0A1D0gMsAh2Y+xwyFKrLR8TCjsE3fpxbGNH1nVP9oVga4BS2wiROpFCmuYrdumOlO21rfQjczHPMnxQyy+6bA01LtYtXHSYmJCtu/Di03HqcKRvIzQ4AKOabdBp9Jmw+Tev6asRVwFAT10vqnV6cKM4R7ttvVo//9iovwKcBmitjRxrJ63gDY4pUWyDNMevejvF; 25:k5bHwDzhe7tqztQjx+A5YVZypVzb5yfct1BccRpWeVLra27VREDgs9mIvG3c7kWC7nCgpykaLndKyuvK4VsoJsDCaIPMlRp11Q17dgMUmDV0wnyIP54Chy3IVMBEUffwvDSP76/AYQ1Cjr/PW+etF530m0qtUDyOELE19jpG6FWUtXFWCH86xORkfSIao/VAithlRPaSVHFjc8GBU6/84uxfC7VHpGqjxHR4P/ao1ZA7HNzXwWufWAWEdXrsE22LkGaUWv2OunPshoGKepoUjg8Cg2TcI3tx+FBm6La/oeWux8zIe7dhMxG65fLdgofArHDehDZd8goX9WDaPEg3Mw==; 31:eEIkdKBZg3rBitKloBx8hQ2KSUYBmPzWy4RaVj9xbV1+gp8zRriSMLELuGPa9livGkRCmXq400VN32WGRkLlWFvs7rpjd4z+2ePEGq9zQmbGwSZrx4WER+PZpXAZABnJqBpPR8LFqHC7YCjJb9VCr+qvGS8E+LbFlRzvL85j/tieFVnklc5FB0J5RAAJM8jeyYrXij1ctn2XVo4Izk7uGP17MXfvbqccv2GB+tBsnVQ= X-MS-TrafficTypeDiagnostic: VI1PR0401MB2462: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2462; 20:xywbVVCAxBmGQwD+QeKK8iXW5DVfHpwJi5eYVQ1hP8cO80fnkgt+a98+MS91ycCx0Nd6Ojnd4vvhbhZ//3McoFyVosXu0ECIszgcv/bXgAk9bHdtBatXZnMdkB5RwKCOPxZ5yfk1q8DwNXlGWVC/ikibOlNa9+LP6LQXfMQnsaeNH0KsWm1eeD5Zr45T3IgCIITjtwB6fJjQhLKICqZOnxv9Ly9oQN08cmGLF3fRqoysUs3j5NbxMRg2lQjTgvRHA4h/7y43V0VP4spk9RYqW5CjJV7GCq3I8ZJMkXm+/VQJSoQU06cXwcigivusqKG9/3I+k3c0KSPpAArDwgpMsDunDH66HhjTp8T8VkBh422tzZlz/LSCXnaI5AKW9jJVwQ+R4secQxSNaBhKbbCnogiL3KSYWRrxpQ4Tvz/Kzguvc9N6/f71Hw6MZqK6IxSHG1xUv5ElnXQVM5sXOMZVYsmlZ3ShpFUwrNuPi0AFgbxEtGEF/CG4nTs5X27e3vo/; 4:Vb0e44tmGnGwcKI9b+WI18e8DPDj6bSpSSxHV2O0brCedFx7PMZ1nDerAlgvR+CNFiuMKPtrja0QSokQoZGyG1uQs1yoV7QhZgxZDjzPGx6yIR8SxLUXDLiMGLctXGKHnUKjNWLBrcvwvegMHBhnj0sl2UuERVxYrt64lSINNdGUUWv8HoPDR+FQ0MoQOQ9JUwaLAFX6+e+A9bVo81wTKZNi9cqx86IL12vKgxzsY3mux5kgx2ylnyH/i2tNbvrMI1x3XzCO0TtjkT445Iy/13E5l90DUNvJjbDky37yEIynPsvO1icb4ifsEg+HBaoRQt7V8e3JFfA/3jvbRfqzWGCrMdW/QwJn43ze/bx+ANw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397)(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(3231101)(2400082)(944501161)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR0401MB2462; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2462; X-Forefront-PRVS: 056929CBB8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(366004)(346002)(39860400002)(199004)(189003)(6486002)(6512007)(50226002)(8676002)(48376002)(4326008)(81156014)(316002)(8936002)(66066001)(6666003)(2950100002)(81166006)(6916009)(53936002)(6306002)(16526019)(5660300001)(47776003)(186003)(26005)(106356001)(2361001)(97736004)(16586007)(305945005)(478600001)(51416003)(386003)(36756003)(86362001)(105586002)(68736007)(2351001)(76176011)(1076002)(52116002)(2906002)(6506007)(25786009)(53376002)(3846002)(6116002)(50466002)(966005)(7736002)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2462; H:Tophie.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0401MB2462; 23:13kJzGhqjCUAjVU7MdztaxelJkKnYLN2jAjosg3?= =?us-ascii?Q?2sJDWYpm+EzsPIB8eO8YzRa1Xn/BkvyHP8lP2XtlGi7YeKjJ0PJQKRuLnFYr?= =?us-ascii?Q?Z/HkezADszFCMKKg3psZGw5G7DaREwk/Dd88oAGwwsttBB4wQwU+30exeHk4?= =?us-ascii?Q?O23acEHzq96A9AyQ082xgPcCg2oGYGzgE69JpRKTESxnQOtrytXKObZw1xmI?= =?us-ascii?Q?AhB6347xvB5R4bQgJ628VleTcAosdNczsxaW6p9gdyjxNmPsOc5DJASrv0Hb?= =?us-ascii?Q?PmJkwdalLilB+xVF8grTBT6s1m1oF0o8Fg2JUdXokHQy/nFGaV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pZkeX6/g6BSFqcMW9ihhCt5ZsxZHvkkg?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0401MB2462; 6:KdJHoig0QDuqi+WZVukn0rEr6fEmzo1GlOp2l8lDNA+fj4iok7P229biMKcESGD/aTjNa8uDF0n1gzhPByMPI6wkwoN3qRPws4HbEngvk29hmwUVY88Ev7RdDLc6cqgvzCcQo2fXzaCbDFu9Pvcpw8nmkPpgoRtyZi6nPfBzqV9wZxeZA/kwTnqaO3VL4vbACjvF4f1aMaXO8MOLHmaq92/+9oRV7krAGzVyibrH88qvREJGCVXzlvVXb47ao10V1hMOXhLF3XlWIeZxHhDErmgnOW+60RQHQMfYYV8WwS2AgN27kxfCzxyadKtkrWbLt0VIOrAB+8TnWuaD8NPSYjWahT0tfRzwdtDxajJuuZY=; 5:qho0k2NkIISA3JEQ5N1eqAtQ/xhZPZ3TmmlK4S987iLmebR8ksISczP2bxJwTy8+fYNWtTdWoxD0/VBxI9dOInZ5qiMigFymVt1llLTQbB4X/f9HowbY8Oqc2BBzZxrQBp/wE9XT6QxVqAmnHkE3s9K9xRbF/3t4KNZPzDe3NDU=; 24:XdEawDp9tElxvW4IhYUuQvcrbLdyf/OhtHvBIb/Kr3NUazgt7TWs7K8Q8nXqNVd6meTA/9agzzACpTKFljpZ0DcXyzUa6d82lYIEJ/vBC1M=; 7:AaYLAYRdU6swV8VhixKLLkKY6wXksvduJOxui33IF2EaE6T4GRjvCrC+W3Te7MQob7o+VqaY7Tu9yAfacsOAfqRrp1RdgsRwDCRgkureoKHYBkh3iXezfkOTpNYEZoNsi2m2v0EyPyOWpsQX5npDm47L0g5EouEDJC+jIItQiR6XO4QeBJZjJfB3bRVaKaAa2gqNkUtbCN09WQz7/+t2hikdcc07kPeu+1/qe1HZe/b0lh0utFj5OJbdGSmVqTZy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2018 08:58:33.9603 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e937f5a-d270-4f27-58fb-08d56888d103 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2462 Subject: [dpdk-dev] [PATCH v4 00/10] Introduce generic 'rawdevice' support 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, 31 Jan 2018 08:58:40 -0000 Change History ~~~~~~~~~~~~~~ v4: - Fix CLANG build issues - enable doxygen - add 18.02 release note and library entry - Merge MAINTAINERS with respective patch - fix doxygen comment over APIs v3: - rebased over master (367bc2a9fd) - added __rte_experimental flag - added initial documentation v2: - restructure comments to prefix model - split patches pivoted on APIs introduced in library - moved test into drivers/rawdev/skeleton from test/test - removed unused RTE_MAX_RAWDEVPORTS and RTE_MAX_RAWDEVS - merge patch configurations - checkpatch fixes Rawdevice Support in DPDK ------------------------- RFC [1] v1: [2] v2: [3] v3: [4] This patchset introduces rawdevices or generic device support in DPDK. Motivation ========== In terms of device flavor (type) support, DPDK currently has ethernet (lib_ether), cryptodev (libcryptodev), eventdev (libeventdev) and vdev (virtual device) support. For a new type of device, for example an accelerator, there are not many options except either of: 1. create another lib/librte_MySpecialDev, driver/MySpecialDrv and use it through Bus/PMD model. 2. Or, create a vdev and implement necessary custom APIs which are directly exposed from driver layer. However this may still require changes in bus code in DPDK. Either method is unclean (touching lib for specific context) and possibly non-upstreamable (custom APIs). Applications and customers prefers uniform device view and programming model. Scope ===== The rawdevice implementation is targetted towards various accelerator use cases which cannot be generalized within existing device models. Aim is to provided a generalized structure at the cost of portability guarantee. Specific PMDs may also expose any specific config APIs. Applications built over such devices are special use-cases involving IP blocks. The rawdevice may also connect to other standard devices using adapter or other methods, similar to eventdev adpter for ethernet/crypto devices. Proposed Solution ================= Defining a very generic super-set of device type and its device operations that can be exposed such that any new/upcoming/experimental device can be layered over it. 'rawdevice' semantic in this patchset represents a device that doesn't have any flavor/type associated with it which is advertised (like net, crypto etc). A *rte_rawdevice* is a raw/generic device without any standard configuration or input/output method assumption. Thus, driver for a new accelerator block, which requires operations for start/stop/enqueue/dequeue, can be quickly strapped over this rawdevice layer. Thereafter, any appropriate bus can scan for it (assuming device is discoverable over the Linux interfaces like sysfs) and match it against registered drivers. Similarly, for a new accelerator or a wireless device, which doesn't fit the eth type, a driver can be registered with a bus (on which its device would be scannable) and use this layer for configuring the device. It can also serve as a staging area for new type of devices till they find some commonality and can be standardized. The outline of this proposed library is same as existing ether/crypto devices. +-----------------------------------------------------------+ | Application(s) | +------------------------------.----------------------------+ | | +------------------------------'----------------------------+ | DPDK Framework (APIs) | +--------------|----|-----------------|---------------------+ / \ \ (crypto ops) (eth ops) (rawdev ops) +----+ / \ \ |DrvA| +-----'---+ +----`----+ +---'-----+ +----+ | crypto | | ethdev | | raw | +--/------+ +---/-----+ +----/----+ +----+ /\ __/\ / ..........|DrvB| / \ / \ / ../ \ +----+ +====+ +====+ +====+ +====+ +==/=+ ```Bus Probe |DevA| |DevB| |DevC| |DevD| |DevF| +====+ +====+ +====+ +====+ +====+ | | | | | ``|``````|````````|``````|`````````````````|````````Bus Scan (PCI) | (PCI) (PCI) (PCI) (BusA) * It is assumed above that DrvB is a PCI type driver which registers itself with PCI Bus * Thereafter, when the PCI scan is done, during probe DrvB would match the rawdev DevF ID and take control of device * Applications can then continue using the device through rawdev API interfaces Proposed Interfaces =================== Following broad API categories are exposed by the rawdevice: 1) Device State Operations (start/stop/reset) 2) Communication Channel setup/teardown (queue) 3) Attribute get/set operations (~ioctls) 4) Enqueue/Dequeue Operations (using opaque buffers) 5) Firmware Operations (Load/unload) Notes: For (1), other than standard start/stop, reset has been added extra. This is for cases where device power cycle has various definitions. Semantics of what stop->start and what reset would mean are still open-ended. For (2), though currently `queue` has been used a semantic, it would be possible in implementation to use this with other methods like internally hosted rte_ring. For (3), applications can pass on an opaque attribute handle/information which the driver can act upon. For (4), aim is to allow applications to post buffers (which can be arbit data) to the device. It is device's responsibility to interpret and handle the buffer. It can also be expanded to synchronous and async methods of posting buffer. That would provide broader use-cases. For (5), Aim is to allow for most basic device firmware management. In this, as well as other operations, it is expected that those which are not implemneted would return ENOTSUP allow the application to fail gracefully. Future Work =========== 1. Support for hotplugging and interrupt handling 2. Support for callbacks for enqueue and dequeue of buffers 3. Interfacing with Eth/Crypto/Event type devices for inline offloading References ========== [1]: http://dpdk.org/ml/archives/dev/2017-November/081550.html [2]: http://dpdk.org/ml/archives/dev/2018-January/085121.html [3]: http://dpdk.org/ml/archives/dev/2018-January/088723.html [4]: http://dpdk.org/ml/archives/dev/2018-January/089608.html Shreyansh Jain (10): rawdev: introduce raw device library support rawdev: add attribute get and set support rawdev: add buffer stream IO support rawdev: support for extended stats rawdev: support for firmware management rawdev: add self test support drivers/raw: introduce skeleton rawdev driver drivers/raw: support for rawdev testcases test: enable rawdev skeleton test doc: add rawdev library page and support Doxygen MAINTAINERS | 8 + config/common_base | 8 + doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + doc/guides/prog_guide/index.rst | 1 + doc/guides/prog_guide/rawdev_lib.rst | 107 +++ doc/guides/rel_notes/release_18_02.rst | 12 + drivers/Makefile | 2 + drivers/raw/Makefile | 9 + drivers/raw/skeleton_rawdev/Makefile | 28 + .../rte_pmd_skeleton_rawdev_version.map | 4 + drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 754 +++++++++++++++++++++ drivers/raw/skeleton_rawdev/skeleton_rawdev.h | 136 ++++ drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 431 ++++++++++++ lib/Makefile | 3 + lib/librte_rawdev/Makefile | 28 + lib/librte_rawdev/rte_rawdev.c | 546 +++++++++++++++ lib/librte_rawdev/rte_rawdev.h | 609 +++++++++++++++++ lib/librte_rawdev/rte_rawdev_pmd.h | 607 +++++++++++++++++ lib/librte_rawdev/rte_rawdev_version.map | 34 + mk/rte.app.mk | 5 + test/test/Makefile | 4 + test/test/test_rawdev.c | 27 + 23 files changed, 3365 insertions(+) create mode 100644 doc/guides/prog_guide/rawdev_lib.rst create mode 100644 drivers/raw/Makefile create mode 100644 drivers/raw/skeleton_rawdev/Makefile create mode 100644 drivers/raw/skeleton_rawdev/rte_pmd_skeleton_rawdev_version.map create mode 100644 drivers/raw/skeleton_rawdev/skeleton_rawdev.c create mode 100644 drivers/raw/skeleton_rawdev/skeleton_rawdev.h create mode 100644 drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c create mode 100644 lib/librte_rawdev/Makefile create mode 100644 lib/librte_rawdev/rte_rawdev.c create mode 100644 lib/librte_rawdev/rte_rawdev.h create mode 100644 lib/librte_rawdev/rte_rawdev_pmd.h create mode 100644 lib/librte_rawdev/rte_rawdev_version.map create mode 100644 test/test/test_rawdev.c -- 2.14.1