[dpdk-dev] [PATCH v1 0/5] Introduce generic 'rawdevice' support

Shreyansh Jain shreyansh.jain at nxp.com
Tue Jan 2 13:57:44 CET 2018


Rawdevice Support in DPDK
-------------------------

RFC [1]: http://dpdk.org/ml/archives/dev/2017-November/081550.html
         (from: hemant.agrawal at 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



More information about the dev mailing list