From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0044.outbound.protection.outlook.com [104.47.38.44]) by dpdk.org (Postfix) with ESMTP id 6858C7D30 for ; Tue, 2 Jan 2018 13:43:46 +0100 (CET) Received: from BN6PR03CA0086.namprd03.prod.outlook.com (10.164.122.152) by BN6PR03MB2690.namprd03.prod.outlook.com (10.173.144.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 2 Jan 2018 12:43:45 +0000 Received: from BL2FFO11FD014.protection.gbl (2a01:111:f400:7c09::188) by BN6PR03CA0086.outlook.office365.com (2603:10b6:405:6f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Tue, 2 Jan 2018 12:43:45 +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; 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 BL2FFO11FD014.mail.protection.outlook.com (10.173.160.222) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 2 Jan 2018 12:43:20 +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 w02Chfdc020140; Tue, 2 Jan 2018 05:43:42 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain Date: Tue, 2 Jan 2018 18:27:44 +0530 Message-ID: <20180102125749.2379-1-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131593706005943775; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(376002)(396003)(346002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(47776003)(5660300001)(498600001)(68736007)(50226002)(48376002)(50466002)(966005)(36756003)(305945005)(104016004)(6916009)(53936002)(356003)(53376002)(97736004)(77096006)(8656006)(8936002)(85426001)(105606002)(81166006)(81156014)(86362001)(106466001)(8676002)(15188555004)(6306002)(2906002)(316002)(16586007)(2351001)(54906003)(1076002)(4326008)(51416003)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2690; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD014; 1:+zi4gX6Tt5z4SueyQVjCOwq0hvGxW9OYXthZz/C/cNPl7stO6i3Xd4Jo80SD5tbg19JxW0BGsPFRM3WUDT6HRjHw6Nu+/QVF7i/MwktDX5FViwi3zoWDUbzDp19okmmW MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ae65ae8-27a6-4694-55df-08d551de67a0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BN6PR03MB2690; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2690; 3:tGDGnVz/WWtSD86Bj/SgHY7G5hOv1KnseekEbIyRKtbqzhwvTF9oabz6glOJoUXRXlwLq95fRWBqVVGW12GvdhBJ/ytOl+ZFZyGHayW1mhtoQKiRFEmH0L/Gx75q8lQMx/QuCsVLkt4oM10YPx1iAeNH84WgvJ5+lu3bKnQMRIzbPnlcT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BEKcqjU79SFIWOQAvTFISerDtCzZmFkkTEOC1IY0ysJkt2TDm2fXplxDRtJtvPSyAZRB5kq7H8QJru0Vb/2iutTpCMB72ia2JSeLEFXuCXOJvmwFAdqeqvyRa8Lob8ueUa/graN1kc X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397)(185117386973197)(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231023)(944510075)(944921075)(946801075)(946901075)(3002001)(6055026)(6096035)(20161123561025)(20161123565025)(20161123559100)(20161123556025)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(201708071742011); SRVR:BN6PR03MB2690; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6PR03MB2690; X-Forefront-PRVS: 0540846A1D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2690; 23:o1w6bfaEGbXPGSMZPSpAQ2WeD0s9VqOjTFL1fXVUz?= =?us-ascii?Q?hbs2139g/O6DbNizcXE06DgzHmIkWFas1wLzsDHMUONDIQIPrv9G6HsRqXew?= =?us-ascii?Q?65ej5JHdRDsD71hFjy+yflUjMZl1fMbmnusH9ehJYrMY0u+BnLDOTNC30WR2?= =?us-ascii?Q?Tdcw2fqUrKPbx6DMorFSp3iKMetQrgUFCRxKjVPTw8zvDXe6mo/4uFmlNIDX?= =?us-ascii?Q?u0/H2zoq4BWkGHBJRwyO7e1U2eVbuw7HiKMG7lpiknV8eok/nnChDPP+Kyh3?= =?us-ascii?Q?hvFkND9tZ1sBtG83VgwSglHFLSuU7Vgj6MQ9UeLMbtg9YBRYa5heyXvXW7uv?= =?us-ascii?Q?YtQgoCmfiamraSB59RWmKWjYIkCnkO8q+5zZgUkMMBW1U9qZvgm4i0EnYx8h?= =?us-ascii?Q?gdkYOGsB2VhKhX/JBSweay5OcvTk0hYyMnlU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yAtFLcaUdZW1ccoksXUXc/aiEOnqnFy8vCLRIBnTW8qMc53aBEVavjy8HZz+dER6Vd1KRnHWUHcCuOLLTraubHPaLNvA17C1qIpVEXgqAEBleLi5/HO/5W77kWV4/qRnCT3OxQKtKvInZRGMPJ/Cv0mAmj9X2NZlb9VgWwhCqHyfQDmI7ux4I0bR4OmMBaqAs91XfB4tliybOldguNghglZ7E=; 5:xVHTWYTVzyBxkwpfevnEftOCii+c/G7+CzNrRjZeYBQDOQ7HEGtzCJnqIc227DqOZfzvSDCI+3a8u+wbrgQ95HWssFziKd+lvkP8lNpdt61SqyKNgYVjIHrXmIECcbubQXc8HtxMfF0LizVeaGdH8cprOJevvDQCGcbP82nAo80=; 24:sZWzn3VFlztWCOQo2w6BcHuuSDWmC42F4wXOczAFU4EN19yM00zKEanO9ZHrbvXURk4HIZ/X6/OLgn2dXZOQkXW9UFSDPwkFrpfPhf0sneo=; 7:DCafaSqDZ4wulDKVonH9lrGx0FxbDRwq3pu6PAjkMTdrIPshOraDBnmXFRZ04Kwo5YaBsYOO7Y3qb0ZnPgB4kFOb9hg8dvyOMzBcLDezEq2m8vltDtyIJpv7j0m5JOlJayrO1CxKmMrJttfs6IkQ4jQ1AEYs2TAFXI33+UKcPvOglD4AmjvJBkIazxk8N0ysBSO+VY8hT8Yf0xb7HRt/HWWq5YicbLsVA11zgMxTA7fh4RxNthrhS/2f8hFyNBhJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2018 12:43:20.4227 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ae65ae8-27a6-4694-55df-08d551de67a0 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: BN6PR03MB2690 Subject: [dpdk-dev] [PATCH v1 0/5] 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, 02 Jan 2018 12:43:46 -0000 Rawdevice Support in DPDK ------------------------- RFC [1]: http://dpdk.org/ml/archives/dev/2017-November/081550.html (from: hemant.agrawal@nxp.com) 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. Patchset Information ==================== This patchset includes 5 patches: * 1~2: Introduce the rawdev library and enable its compilation * 3~4: Adds a skeleton rawdevice driver, for demonstration purpose. * 5 : Unittest framewework based on the skeleton driver as backend 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 I will be adding a documentation page in v2, shortly. Maintainers patch would be sent once I have some comments and scope of getting it IN in 18.02. References ========== [1]: http://dpdk.org/ml/archives/dev/2017-November/081550.html Shreyansh Jain (5): rawdev: introduce raw device library support config: enable compilation of rawdev library drivers/raw: introduce skeleton rawdev driver config: enable compilation of rawdev skeleton driver test: support for rawdev testcases config/common_base | 8 + drivers/Makefile | 2 + drivers/raw/Makefile | 9 + drivers/raw/skeleton_rawdev/Makefile | 25 + .../rte_pmd_skeleton_rawdev_version.map | 4 + drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 668 +++++++++++++++++++++ drivers/raw/skeleton_rawdev/skeleton_rawdev.h | 130 ++++ lib/Makefile | 3 + lib/librte_rawdev/Makefile | 27 + lib/librte_rawdev/rte_rawdev.c | 540 +++++++++++++++++ lib/librte_rawdev/rte_rawdev.h | 586 ++++++++++++++++++ lib/librte_rawdev/rte_rawdev_pmd.h | 588 ++++++++++++++++++ lib/librte_rawdev/rte_rawdev_version.map | 33 + mk/rte.app.mk | 5 + test/test/Makefile | 4 + test/test/test_rawdev.c | 376 ++++++++++++ 16 files changed, 3008 insertions(+) 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 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