[dpdk-dev] [PATCH v4 00/10] Introduce generic 'rawdevice' support

Shreyansh Jain shreyansh.jain at nxp.com
Wed Jan 31 10:13:08 CET 2018


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



More information about the dev mailing list