From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01hn0209.outbound.protection.outlook.com [104.47.32.209]) by dpdk.org (Postfix) with ESMTP id D8665A84C for ; Tue, 23 Jan 2018 15:24:53 +0100 (CET) Received: from BN6PR03CA0072.namprd03.prod.outlook.com (10.173.137.34) by BLUPR03MB469.namprd03.prod.outlook.com (10.141.78.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Tue, 23 Jan 2018 14:24:52 +0000 Received: from BN1BFFO11FD003.protection.gbl (2a01:111:f400:7c10::1:162) by BN6PR03CA0072.outlook.office365.com (2603:10b6:404:4c::34) 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, 23 Jan 2018 14:24:52 +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 BN1BFFO11FD003.mail.protection.outlook.com (10.58.144.66) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.428.12 via Frontend Transport; Tue, 23 Jan 2018 14:24:49 +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 w0NDj5Rb022838; Tue, 23 Jan 2018 06:45:06 -0700 From: Shreyansh Jain To: , CC: , , , Shreyansh Jain Date: Tue, 23 Jan 2018 19:29:00 +0530 Message-ID: <20180123135910.10755-1-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180102125749.2379-1-shreyansh.jain@nxp.com> References: <20180102125749.2379-1-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131611910917789378; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:SPM; SFS:(10009020)(39380400002)(39860400002)(396003)(376002)(346002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(356003)(50466002)(85426001)(498600001)(5660300001)(47776003)(86362001)(106466001)(48376002)(77096007)(26005)(36756003)(966005)(6666003)(104016004)(336011)(2950100002)(53376002)(8936002)(4326008)(305945005)(51416003)(6306002)(81166006)(81156014)(105606002)(50226002)(1076002)(76176011)(8676002)(68736007)(53936002)(2906002)(316002)(16586007)(110136005)(54906003)(97736004)(59010400001); DIR:OUT; SFP:1501; SCL:5; SRVR:BLUPR03MB469; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD003; 1:3NWV7STpoNSGsk80W9ZnujWESn+uePX1zemvBbQYYEgtZ+kpeBtPq1FoGUUmtFJZq8nFxggc59tcS2IitazNzkYIN1ktteZk77zD8maKMPdMxv0gZTHXVibm7YCOOeun MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f382fd64-3e52-4d02-b56d-08d5626d10eb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BLUPR03MB469; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB469; 3:PovzPFfWmTES7RRjF4nlAhw/duY3cOG0j5z17sVHc9v6j37f8Al6SZJPtvvnYuN8IXjLcP61cXrwR9cc3mrOFWJ/EsHjbJHkJX8bkwlBW6WkCsRxUnsBypy37MNZblT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pocZGGyYmjELrl4A2nU5l726uBqOUUSJmjWAwKtYh61YC1BY7tDMBnR0Wp8YhUp/42Ed5qdae9c7hyIvbno+/L+3mJBqbz8m5WZZaEbx86CkYXDhFXWDZO0RK3a4ArJ4Tzoocn0SKzpmG3CnrtmfL7Nlly5KgoAvQNzj0EEpkkZ1C1wGqK9EpCtwzTnZ0oG3pUambhdxYN8HMt2ORw/efRfATyckiqn9A0/2PSUTKHNiZ2/6fpYTCtVJA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(60795455431006)(278428928389397)(66839620246622)(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(2232076)(944501161)(6055026)(6096035)(20161123563025)(20161123559100)(20161123565025)(20161123556025)(20161123561025)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(201708071742011); SRVR:BLUPR03MB469; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BLUPR03MB469; X-Forefront-PRVS: 05610E64EE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB469; 23:ZkEWzjJPu2/q/WKcZ3OmOuSDc+DHiXY/D553FJxCwT?= =?us-ascii?Q?9KJviPMcuIF9r1Hz3OzWjOWx1tExgtGHrG6La4bPsbqeCd+U1RXbv+00P/mu?= =?us-ascii?Q?L5kDQgSrMoODkQtKDl/3T/hr9wXqTSi0gTRDTos2sAKeBkE3RD6ddjWdetPw?= =?us-ascii?Q?SLapQAcoyAZxnwrIaJOUOVp9pEzixjHnY9pspuzaqnWbWqTXV9QxA1ryutO1?= =?us-ascii?Q?5Lv6lNsyu/iRBBoz86OZ/vRRbmOJcNynL2DbKp/Vv6l0qFIL7O1BeJKoVw/A?= =?us-ascii?Q?TEO66p5KcLxaHq8NZGEDt29+oMEl3ExjZ1mKrbdi5VBaCPZrKqTUeWa2fQP1?= =?us-ascii?Q?pAucA0QxJIGj7nW+Jr0Lc7k9k0f0CLbjXtpd0O9UsrBHZ6ZsCx1is/Fewl+7?= =?us-ascii?Q?UZn5/c1c7Zw98uUpImjGTKWs5ycJzo4uz+hjTinwEPrUpjXGkFZiwXIm+cZ4?= =?us-ascii?Q?3ldjaN/xVv4b9cjl2x/27ZO83VwaN9lAFfeNpBm1YWs0L0yoFn7BVrHHWHdO?= =?us-ascii?Q?SWr3lZHWEfVZ6RNEAuUXjCl8jTWMDEG9uVkOscr5z/1KigD9fP8oRgNL857v?= =?us-ascii?Q?n5UWb6FDw40TgP1x6YwoGddmFI0YPDbmJFnNyEBY3WKV2AM9BjUVtzK0cX6N?= =?us-ascii?Q?nnGrd7wO73qdfVrcDMik5VWujxONExlvvmbmgPZ0zjGjTabZrSW3M0Qf5fVg?= =?us-ascii?Q?L60g4LQ7xtbJXPS3KVjwjwUB5GQpIr59rklu4wo7WVVHCcXTA9HlA3r2t5Rk?= =?us-ascii?Q?SxwkMys+1fnWvkUREhz4c17X71DLBjJLNr96kwp+g9V3jj4lnqEBXDghRaV1?= =?us-ascii?Q?56kiJClwhfxm0qpbZQ5miQOSb9Z7YqYimKOog/Uz+yS4o6Vm+9wZQJZj7faP?= =?us-ascii?Q?O1O53tP/0Njb3v5IijBoY7hKilZ74JPXhCTShpXPJ0xuihWSZ77faY97UDbl?= =?us-ascii?Q?K7K+YsTcHYapqD4DjrHcDQBom9mMcv17iEaxchqyIhXBaR7KivbFHafM8hIK?= =?us-ascii?Q?pt218whKkmRf2GRjWDqO1mQSwAGjV0/jKdBSVGtejmU6hKqNW30LTeXALK47?= =?us-ascii?Q?PxIhEx7R9BLj5lsC3CMyvlqLShrQkPD3zFJrU13190j4qTprAIjAlypoLHKX?= =?us-ascii?Q?Bax6GZ70WTEHiORVel8Gnkj3vZafYOs3uJdOEq5AotfGeE1cJEiuEg/NRMRp?= =?us-ascii?Q?sJ2teWACInu37neLpJPJMU+EicMloEtCa0?= X-Microsoft-Antispam-Message-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A1w8m3ceO28VVl+yKcGcqv SpamDiagnosticOutput: 1:22 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 14:24:49.9538 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f382fd64-3e52-4d02-b56d-08d5626d10eb 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: BLUPR03MB469 Subject: [dpdk-dev] [PATCH v2 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: Tue, 23 Jan 2018 14:24:54 -0000 Change History ~~~~~~~~~~~~~~ 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] 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. ** following RST files would be added in v3 ** - doc/guides/rawdevs/skeleton_rawdev.rst - doc/guides/prog_guide/rawdev.rst 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 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 maintainers: claim ownership of rawdev MAINTAINERS | 6 + config/common_base | 8 + drivers/Makefile | 2 + drivers/raw/Makefile | 9 + drivers/raw/skeleton_rawdev/Makefile | 26 + .../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 | 27 + lib/librte_rawdev/rte_rawdev.c | 545 +++++++++++++++ lib/librte_rawdev/rte_rawdev.h | 596 ++++++++++++++++ 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 + 18 files changed, 3222 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 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