From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0054.outbound.protection.outlook.com [104.47.36.54]) by dpdk.org (Postfix) with ESMTP id 19EF31B63C for ; Tue, 30 Jan 2018 16:24:50 +0100 (CET) Received: from CY4PR03CA0016.namprd03.prod.outlook.com (10.168.162.26) by BLUPR03MB1412.namprd03.prod.outlook.com (10.163.81.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Tue, 30 Jan 2018 15:24:48 +0000 Received: from BL2FFO11FD040.protection.gbl (2a01:111:f400:7c09::138) by CY4PR03CA0016.outlook.office365.com (2603:10b6:903:33::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.444.14 via Frontend Transport; Tue, 30 Jan 2018 15:24:48 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BL2FFO11FD040.mail.protection.outlook.com (10.173.161.136) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.444.13 via Frontend Transport; Tue, 30 Jan 2018 15:24:46 +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 w0UEh7sd023996; Tue, 30 Jan 2018 07:43:08 -0700 From: Shreyansh Jain To: CC: , , , , Shreyansh Jain Date: Tue, 30 Jan 2018 20:26:59 +0530 Message-ID: <20180130145710.24757-1-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180123135910.10755-1-shreyansh.jain@nxp.com> References: <20180123135910.10755-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131617994877214248; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(39380400002)(396003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(4326008)(48376002)(8936002)(5660300001)(966005)(498600001)(36756003)(2351001)(97736004)(105606002)(106466001)(104016004)(86362001)(50226002)(2906002)(6666003)(305945005)(316002)(6306002)(53936002)(77096007)(68736007)(26005)(8676002)(336011)(81166006)(81156014)(47776003)(76176011)(16586007)(6862004)(54906003)(85426001)(51416003)(2950100002)(50466002)(356003)(1076002)(53376002)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB1412; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD040; 1:fvE5L9b5Dndsh9gGL4p/xpTa8QgKln2lasD0Rcyu5oEoIZqczW5dnG9BGCaGep7FITM7UVs/O2cUAp0V+cfkbZ9PW5RnEiAFhUFTPL4AaxnZnA7mffha4PH2Bst19BjN MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a168b334-1d6d-4979-d05e-08d567f59913 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BLUPR03MB1412; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB1412; 3:GUeHvXW3RHxGLDipc626pzX1G9wb2CQuomt/IaQl/zPb5djydFC4NR0um/tfYmEdKJ/TowgNayBYRENGirB/YFWvzVWPVEWVQo4BauhZ0kCUvpjku+wC0+/1N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gRvwzGHzYMHFEv661PTyIl/APAQL6+WU5ob3D94D/lidB7QBVxS4T2TzMSDXJYlc3sQA9EFZSXCGi/zk+k+RUMNh1cSYVgYPvOLiwPmzr1I1sxWuwbq80S1x+jhSTd1olM8LSaxDMniR3RsJFoVJrgPJAOXFbjizkvJ10fQYrxmG7OCOPu3fMiF8lVKLH1DFGPU47XwtW/BxqBxW X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(60795455431006)(278428928389397)(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231101)(944501161)(3002001)(10201501046)(6055026)(6096035)(20161123565025)(20161123563025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(20161123561025)(20161123556025)(201708071742011); SRVR:BLUPR03MB1412; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR03MB1412; X-Forefront-PRVS: 0568F32D91 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB1412; 23:xV7aW59fSSyOdyzOyLli+AcpYMrZjzOseAaGKM0xk?= =?us-ascii?Q?9tvUh2ezbfFWZQK7974LR37X6N8toeVCzGdFBcqa6IsorMo1ZFmCO4ImDUJX?= =?us-ascii?Q?pUaTN2PEpM50SqrGGCkOXDOGzA+lPTTX26wxTIF0aPcssuZY6gEMXET9LPZe?= =?us-ascii?Q?PF55WwcTX7BZMN2GoQKo/l/wWHU4si+WC0IzfJHwkneKV0WkLFVqIq09FHSo?= =?us-ascii?Q?5YLC09aaSTGk4K0HrsmoalX+xGHaJFAD5llV6NP4NEExUky3xwvNWa1WGWKW?= =?us-ascii?Q?dFatYr+VwrqjlzjwEXWBqxM7oTaEwscdmcCBFNNzAGRH7oL/dgU9td31258x?= =?us-ascii?Q?xSgp7CHW0JlEcJLjg8JiiA/b35G7PSPP1kCvTWTEHVnaVfOnvRpxNor1BvtO?= =?us-ascii?Q?zOLzZD5oF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G3iWeJGXNZeRtIrhl42y7O+U1+ZHmWZH/WTnky+JelUc5SF+FXtKoBluC2sJqdnw9tWCu0n1CtAqIy6P1kE0hd623jVWpThUdVq9vPF58ndGlo6DP37D7sQjYJMYZc6MkwYF0hR+vbEKzsC2c57hD7jvSwmVfjJoKC+7nGDGKgKH4OplKn2+tSszsFzC6FtO7GKUM6SUVR1U8uqb37kjQArtQl3s1gAH7HrMqgzTjUKeRzAwyDKnO5yS1DunUVqjcT8K+gCmaDb/RBuEmG2WlYj0ybUy2Y5TuXHY4U1vhoh17ereQU=; 5:BdyvHKpH1C6roJryweBoiH2JKQa3DSRhYwKehmxRek8BPFVl8RSThpTrhFE57C62qi59QIV9/U/jvgnxA4s0Y0bGVKd6gf7OS6myHEMjqAgh7FN1TkIJ5Jgd2YvHJ8B9jFr28vBWxdLg4TAO2EW6WBMfl2la+wTSSGMUbvHLvqg=; 24:QrRc+5oT2lM1sa0spXOh7dLrAjbUzesMS766zg0Dv4dIqckzGbT1QeKvOsdO53E9ticv751LSk97Efeq3pwSCTEd+tGJlUZ68ppXOWqv8z8=; 7:YBME+vIH7qSXyZ5AYpvNjvayYoGQtplTrCK0EVxQ/OLV0ZCC0iYBxF3B2VpexWrF9kKaA/ltPNNxNBViJPFqf8YU2udq3rg1FpEQ4oHHa215fm0J0l7n0bbwomXmUeZk9F9hKuNmOSwTiLWkCpSQZftuNM+jdc1yCZ3xmqEExX8HShFMo57D6D8s+JbUqkr9sBJ5xuGGfEBWEo8CpzdkKWMzxBG3hJDcBNbVZ2Mwma7uIPzfl9hCsY0UxA28A8Xv SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2018 15:24:46.4110 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a168b334-1d6d-4979-d05e-08d567f59913 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: BLUPR03MB1412 Subject: [dpdk-dev] [PATCH v3 00/11] 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: Tue, 30 Jan 2018 15:24:51 -0000 Change History ~~~~~~~~~~~~~~ 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] 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 Shreyansh Jain (11): 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 maintainers: claim ownership of rawdev doc: add rawdev library page MAINTAINERS | 6 + config/common_base | 8 + doc/guides/prog_guide/index.rst | 1 + doc/guides/prog_guide/rawdev_lib.rst | 83 +++ 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 | 597 ++++++++++++++++ lib/librte_rawdev/rte_rawdev_pmd.h | 605 +++++++++++++++++ lib/librte_rawdev/rte_rawdev_version.map | 34 + mk/rte.app.mk | 5 + test/test/Makefile | 4 + test/test/test_rawdev.c | 27 + 20 files changed, 3311 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