Skip to contentSkip to conversation

raw/ioat: driver for Intel QuickData Technology

PATCH Superseded Bruce Richardson 12 participants 102 messages May 30, 2019 – Jul 4, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover raw/ioat: driver for Intel QuickData Technology

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Bruce Richardson (8):
raw/ioat: add initial support for ioat rawdev driver usertools/dpdk-devbind.py: add support for IOAT devices raw/ioat: add register definition file raw/ioat: create device on probe and destroy on release raw/ioat: add device info function
raw/ioat: add configure, start and stop functions raw/ioat: add statistics functions
raw/ioat: add local API to perform copies

 MAINTAINERS                                 |   7 +-
 app/test/Makefile                           |   1 +
 app/test/meson.build                        |   4 +
 app/test/test_ioat_rawdev.c                 | 269 +++++++++++++++++
 config/common_armv8a_linux                  |   1 +
 config/common_base                          |   5 +
 config/defconfig_arm-armv7a-linuxapp-gcc    |   1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 +
 doc/guides/rawdevs/index.rst                |   1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 227 ++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      |  11 +
 drivers/raw/Makefile                        |   1 +
 drivers/raw/ioat/Makefile                   |  29 ++
 drivers/raw/ioat/ioat_rawdev.c              | 310 ++++++++++++++++++++
 drivers/raw/ioat/meson.build                |   9 +
 drivers/raw/ioat/rte_ioat_rawdev.h          | 228 ++++++++++++++
 drivers/raw/ioat/rte_ioat_spec.h            | 301 +++++++++++++++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |   4 +
 drivers/raw/meson.build                     |   3 +-
 mk/rte.app.mk                               |   1 +
 usertools/dpdk-devbind.py                   |  10 +
 21 files changed, 1422 insertions(+), 2 deletions(-)
 create mode 100644 app/test/test_ioat_rawdev.c
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/8 raw/ioat: add initial support for ioat rawdev driver

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---
 MAINTAINERS                                 |  7 +-
 app/test/Makefile                           |  1 +
 app/test/meson.build                        |  1 +
 app/test/test_ioat_rawdev.c                 | 22 +++++
 config/common_armv8a_linux                  |  1 +
 config/common_base                          |  5 ++
 config/defconfig_arm-armv7a-linuxapp-gcc    |  1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |  1 +
 doc/guides/rawdevs/index.rst                |  1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 25 ++++++
 doc/guides/rel_notes/release_19_08.rst      | 11 +++
 drivers/raw/Makefile                        |  1 +
 drivers/raw/ioat/Makefile                   | 28 +++++++
 drivers/raw/ioat/ioat_rawdev.c              | 93 +++++++++++++++++++++
 drivers/raw/ioat/meson.build                |  8 ++
 drivers/raw/ioat/rte_ioat_rawdev.h          | 24 ++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |  4 +
 drivers/raw/meson.build                     |  3 +-
 mk/rte.app.mk                               |  1 +
 19 files changed, 236 insertions(+), 2 deletions(-)
 create mode 100644 app/test/test_ioat_rawdev.c
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
MAINTAINERS +6 -1
index 15d0829c5..b613a1e74 100644
@@ -1042,6 +1042,12 @@ M: Tianfei zhang <[email protected]>
 F: drivers/raw/ifpga_rawdev/
 F: doc/guides/rawdevs/ifpga_rawdev.rst
 
+IOAT Rawdev
+M: Bruce Richardson <[email protected]>
+F: drivers/raw/ioat/
+F: doc/guides/rawdevs/ioat_rawdev.rst
+F: app/test/test_ioat_rawdev.c
+
 NXP DPAA2 QDMA
 M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_qdma/
@@ -1052,7 +1058,6 @@ M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_cmdif/
 F: doc/guides/rawdevs/dpaa2_cmdif.rst
 
-
 Packet processing
 -----------------
 
app/test/Makefile +1 -0
index 68d6b4fbc..7fbdd0755 100644
@@ -212,6 +212,7 @@ endif
 
 ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y)
 SRCS-y += test_rawdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += test_ioat_rawdev.c
 endif
 
 SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
app/test/meson.build +1 -0
index 83391cef0..9867619d3 100644
@@ -52,6 +52,7 @@ test_sources = files('commands.c',
 	'test_hash_perf.c',
 	'test_hash_readwrite_lf.c',
 	'test_interrupts.c',
+	'test_ioat_rawdev.c',
 	'test_ipsec.c',
 	'test_kni.c',
 	'test_kvargs.c',
app/test/test_ioat_rawdev.c new file +22 -0
new file mode 100644
index 000000000..bd1bb2827
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "test.h"
+
+#ifndef RTE_LIBRTE_PMD_IOAT_RAWDEV
+
+static int
+test_ioat_rawdev(void) { return TEST_SKIPPED; }
+
+#else
+
+static int
+test_ioat_rawdev(void)
+{
+	return 0;
+}
+
+#endif /* RTE_LIBRTE_PMD_IOAT_RAWDEV */
+
+REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_ioat_rawdev);
config/common_armv8a_linux +1 -0
index 72091de1c..481712ebc 100644
@@ -34,5 +34,6 @@ CONFIG_RTE_ARCH_ARM64_MEMCPY=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
 
 CONFIG_RTE_SCHED_VECTOR=n
config/common_base +5 -0
index 6f19ad5d2..2b8db4880 100644
@@ -741,6 +741,11 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n
 #
 CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV=y
 
+#
+# Compile PMD for Intel IOAT raw device
+#
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y
+
 #
 # Compile librte_ring
 #
config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
index c9509b274..ee158ef9d 100644
@@ -54,3 +54,4 @@ CONFIG_RTE_LIBRTE_QEDE_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
 CONFIG_RTE_LIBRTE_NFP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
index 7e248b755..9f3670ec0 100644
@@ -56,3 +56,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
doc/guides/rawdevs/index.rst +1 -0
index 7c3bd9586..0a21989e4 100644
@@ -14,3 +14,4 @@ application through rawdev API.
     dpaa2_cmdif
     dpaa2_qdma
     ifpga_rawdev
+    ioat_rawdev
doc/guides/rawdevs/ioat_rawdev.rst new file +25 -0
new file mode 100644
index 000000000..40ab1b466
@@ -0,0 +1,25 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+.. include:: <isonum.txt>
+
+IOAT Rawdev Driver for Intel\ |reg| QuickData Technology
+======================================================================
+
+The ``ioat`` rawdev driver provides a poll-mode driver (PMD) for Intel\ |reg|
+QuickData Technology, part of Intel\ |reg| I/O Acceleration Technology
+`(Intel I/OAT) <https://www.intel.com/content/www/us/en/wireless-network/accel-technology.html>`_.
+This PMD allows data copies, for example, cloning packet data, to be
+accelerated by hardware rather than having to be done by software, freeing
+up CPU cycles for other tasks.
+
+Compilation
+------------
+
+For builds done with ``make``, the driver compilation is enabled by the
+``CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV`` build configuration option. This is
+enabled by default in builds for x86 platforms, and disabled in other
+configurations.
+
+For builds using ``meson`` and ``ninja``, the driver will be built when the
+target platform is x86-based.
doc/guides/rel_notes/release_19_08.rst +11 -0
index a17e7dea5..a65f3514a 100644
@@ -1,6 +1,8 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright 2019 The DPDK contributors
 
+.. include:: <isonum.txt>
+
 DPDK Release 19.08
 ==================
 
@@ -54,6 +56,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added Intel QuickData Technology PMD**
+
+  The PMD for Intel\ |reg|  QuickData Technology, part of
+  Intel\ |reg|  I/O Acceleration Technology `(Intel I/OAT)
+  <https://www.intel.com/content/www/us/en/wireless-network/accel-technology.html>`_,
+  allows data copies to be done by hardware instead
+  of via software, reducing cycles spent copying large blocks of data in
+  applications.
+
 
 Removed Items
 -------------
drivers/raw/Makefile +1 -0
index 8e29b4a56..c1b85c8c7 100644
@@ -10,5 +10,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma
 endif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga_rawdev
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/ioat/Makefile new file +28 -0
new file mode 100644
index 000000000..7726e310a
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_ioat_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+LDLIBS += -lrte_eal -lrte_rawdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_ioat_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+
+# export include files
+SYMLINK-y-include += rte_ioat_rawdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/ioat_rawdev.c new file +93 -0

93 lines not on this page · raw message

drivers/raw/ioat/meson.build new file +8 -0
new file mode 100644
index 000000000..ba7620a68
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Intel Corporation
+
+build = dpdk_conf.has('RTE_ARCH_X86')
+sources = files('ioat_rawdev.c')
+deps += ['rawdev', 'bus_pci']
+
+install_headers('rte_ioat_rawdev.h')
drivers/raw/ioat/rte_ioat_rawdev.h new file +24 -0
new file mode 100644
index 000000000..e77406403
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IOAT_RAWDEV_H_
+#define _RTE_IOAT_RAWDEV_H_
+
+/**
+ * @file rte_ioat_rawdev.h
+ *
+ * Definitions for using the ioat rawdev device driver
+ *
+ * @warning
+ * @b EXPERIMENTAL: these structures and APIs may change without prior notice
+ */
+
+/** Name of the device driver */
+#define IOAT_PMD_RAWDEV_NAME rawdev_ioat
+/** String reported as the device driver name by rte_rawdev_info_get() */
+#define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
+/** Name used to adjust the log level for this driver */
+#define IOAT_PMD_LOG_NAME "rawdev.ioat"
+
+#endif
drivers/raw/ioat/rte_pmd_ioat_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
drivers/raw/meson.build +2 -1
index a61cdccef..39eb54a90 100644
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 NXP
 
-drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma', 'ifpga_rawdev']
+drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma',
+	'ifpga_rawdev', 'ioat']
 std_deps = ['rawdev']
 config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV'
 driver_name_fmt = 'rte_pmd_@0@'
mk/rte.app.mk +1 -0
index 7c9b4b538..9232877b0 100644
@@ -303,6 +303,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV)   += -lrte_pmd_ioat_rawdev
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
 endif # !CONFIG_RTE_BUILD_SHARED_LIBS
Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/8 usertools/dpdk-devbind.py: add support for IOAT devices

In reply to Bruce Richardson

In order to allow binding/unbinding of devices for use by the ioat_rawdev, we need to update the devbind script to add a new class of device, and add device ids for the specific HW instances.

---
 doc/guides/rawdevs/ioat_rawdev.rst | 11 +++++++++++
 usertools/dpdk-devbind.py          | 10 ++++++++++
 2 files changed, 21 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 40ab1b466..99e757498 100644
@@ -23,3 +23,14 @@ configurations.
 
 For builds using ``meson`` and ``ninja``, the driver will be built when the
 target platform is x86-based.
+
+Device Setup
+-------------
+
+The Intel\ |reg| QuickData Technology HW devices will need to be bound to a
+user-space IO driver for use. The script ``dpdk-devbind.py`` script
+included with DPDK can be used to view the state of the devices and to bind
+them to a suitable DPDK-supported kernel driver. When querying the
+status of the devices, they will appear under the category of "dma
+devices", i.e. the command ``dpdk-devbind.py --status-dev dma`` can be used
+to see the state of those devices alone.
usertools/dpdk-devbind.py +10 -0
index 9e79f0d28..bd0d97df3 100755
@@ -36,11 +36,17 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
+intel_ioat_bdw = {'Class': '08', 'Vendor': '8086', 'Device': '6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
+              'SVendor': None, 'SDevice': None}
+intel_ioat_skx = {'Class': '08', 'Vendor': '8086', 'Device': '2021',
+              'SVendor': None, 'SDevice': None}
+
 network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
+dma_devices = [intel_ioat_bdw, intel_ioat_skx]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -595,6 +601,8 @@ def show_status():
     if status_dev == "compress" or status_dev == "all":
         show_device_status(compress_devices , "Compress")
 
+    if status_dev == "dma" or status_dev == "all":
+        show_device_status(dma_devices, "DMA")
 
 def parse_args():
     '''Parses the command-line arguments given by the user and takes the
@@ -670,6 +678,7 @@ def do_arg_actions():
             get_device_details(eventdev_devices)
             get_device_details(mempool_devices)
             get_device_details(compress_devices)
+            get_device_details(dma_devices)
         show_status()
 
 
@@ -690,6 +699,7 @@ def main():
     get_device_details(eventdev_devices)
     get_device_details(mempool_devices)
     get_device_details(compress_devices)
+    get_device_details(dma_devices)
     do_arg_actions()
 
 if __name__ == "__main__":
Signature · 1 line
2.21.0
#3 lore raw

PATCH 3/8 raw/ioat: add register definition file

In reply to Bruce Richardson

Add in the list of registers for the device. File is taken from the SPDK project:

https://github.com/spdk/spdk/blob/master/include/spdk/ioat_spec.h

---
 drivers/raw/ioat/Makefile        |   1 +
 drivers/raw/ioat/meson.build     |   3 +-
 drivers/raw/ioat/rte_ioat_spec.h | 301 +++++++++++++++++++++++++++++++
 3 files changed, 304 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
drivers/raw/ioat/Makefile +1 -0
index 7726e310a..1e10938f3 100644
@@ -24,5 +24,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
+SYMLINK-y-include += rte_ioat_spec.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/meson.build +2 -1
index ba7620a68..ca23e23fc 100644
@@ -5,4 +5,5 @@ build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c')
 deps += ['rawdev', 'bus_pci']
 
-install_headers('rte_ioat_rawdev.h')
+install_headers('rte_ioat_rawdev.h',
+		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_spec.h new file +301 -0

301 lines not on this page · raw message

Signature · 1 line
2.21.0
#4 lore raw

Re: [dpdk-dev] [PATCH 3/8] raw/ioat: add register definition file

drivers/raw/ioat/rte_ioat_spec.h line 19

Quoted 5 lines · On Thu, 30 May 2019 22:25:20 +0100 Bruce Richardson…
drivers/raw/ioat/rte_ioat_spec.h new file +5 -0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+

This a driver private file, why the C++ guard here?

#5 lore raw

Re: [dpdk-dev] [PATCH 3/8] raw/ioat: add register definition file

Quoted 10 lines · Stephen Hemminger

drivers/raw/ioat/rte_ioat_spec.h line 19

Quoted 5 lines · On Thu, 30 May 2019 22:25:20 +0100 Bruce Richardson…
drivers/raw/ioat/rte_ioat_spec.h new file +5 -0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+

This a driver private file, why the C++ guard here?

It's not just a private file, it's included in the regular driver .h file, as the inline functions there need access to the register definitions.

As for whether the functions need to be inline, most of them are inline for performance reasons, and the one that I would consider suitable for moving to the driver is inline also so that the user does not need to link their application against the PMD in order to use the device. Having the header at compile-time, and then the driver loaded at runtime is sufficient.

/Bruce

#6 lore raw

PATCH 4/8 raw/ioat: create device on probe and destroy on release

In reply to Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---
 doc/guides/rawdevs/ioat_rawdev.rst | 11 ++++
 drivers/raw/ioat/ioat_rawdev.c     | 93 +++++++++++++++++++++++++++++-
 drivers/raw/ioat/rte_ioat_rawdev.h | 20 +++++++
 3 files changed, 121 insertions(+), 3 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 99e757498..476b0503f 100644
@@ -34,3 +34,14 @@ them to a suitable DPDK-supported kernel driver. When querying the
 status of the devices, they will appear under the category of "dma
 devices", i.e. the command ``dpdk-devbind.py --status-dev dma`` can be used
 to see the state of those devices alone.
+
+Device Probing and Initialization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Once bound to a suitable kernel device driver, the HW devices will be found
+as part of the PCI scan done at application initialization time. No vdev
+parameters need to be passed to create or initialize the device.
+
+Once probed successfully, the device will appear as a ``rawdev``, that is a
+"raw device type" inside DPDK, and can be accessed using APIs from the
+``rte_rawdev`` library.
drivers/raw/ioat/ioat_rawdev.c +90 -3

111 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +20 -0
index e77406403..c3216a174 100644
@@ -14,6 +14,9 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <rte_memory.h>
+#include <rte_ioat_spec.h>
+
 /** Name of the device driver */
 #define IOAT_PMD_RAWDEV_NAME rawdev_ioat
 /** String reported as the device driver name by rte_rawdev_info_get() */
@@ -21,4 +24,21 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * @internal
+ * Structure representing a device instance
+ */
+struct rte_ioat_rawdev {
+	struct rte_rawdev *rawdev;
+	volatile struct rte_ioat_registers *regs;
+	phys_addr_t status_addr;
+	phys_addr_t ring_addr;
+
+	unsigned short ring_size;
+	struct rte_ioat_desc *desc_ring;
+
+	/* to report completions, the device will write status back here */
+	volatile uint64_t status __rte_cache_aligned;
+};
+
 #endif
Signature · 1 line
2.21.0
#7 lore raw

PATCH 5/8 raw/ioat: add device info function

In reply to Bruce Richardson

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---
 app/test/meson.build               |  3 +++
 app/test/test_ioat_rawdev.c        | 23 ++++++++++++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
 5 files changed, 82 insertions(+)
app/test/meson.build +3 -0
index 9867619d3..9fe3ddc89 100644
@@ -305,6 +305,9 @@ endif
 if dpdk_conf.has('RTE_LIBRTE_KNI')
 	test_deps += 'kni'
 endif
+if dpdk_conf.has('RTE_LIBRTE_PMD_IOAT_RAWDEV')
+	test_deps += 'pmd_ioat'
+endif
 
 cflags = machine_args
 if cc.has_argument('-Wno-format-truncation')
app/test/test_ioat_rawdev.c +23 -0
index bd1bb2827..ac1389f6e 100644
@@ -11,9 +11,32 @@ test_ioat_rawdev(void) { return TEST_SKIPPED; }
 
 #else
 
+#include <string.h>
+#include <unistd.h>
+
+#include <rte_mbuf.h>
+#include <rte_rawdev.h>
+#include <rte_ioat_rawdev.h>
+
 static int
 test_ioat_rawdev(void)
 {
+	const int count = rte_rawdev_count();
+	int i, found = 0;
+
+	printf("Checking %d rawdevs\n", count);
+	for (i = 0; i < count && !found; i++) {
+		struct rte_rawdev_info info = { .dev_private = NULL };
+		found = (rte_rawdev_info_get(i, &info) == 0 &&
+				strcmp(info.driver_name,
+						IOAT_PMD_RAWDEV_NAME_STR) == 0);
+	}
+
+	if (!found) {
+		printf("No IOAT rawdev found, skipping tests\n");
+		return TEST_SKIPPED;
+	}
+
 	return 0;
 }
 
doc/guides/rawdevs/ioat_rawdev.rst +34 -0
index 476b0503f..b68cdffc3 100644
@@ -45,3 +45,37 @@ parameters need to be passed to create or initialize the device.
 Once probed successfully, the device will appear as a ``rawdev``, that is a
 "raw device type" inside DPDK, and can be accessed using APIs from the
 ``rte_rawdev`` library.
+
+Using IOAT Rawdev Devices
+--------------------------
+
+To use the devices from an application, the rawdev API can be used, along
+with definitions taken from the device-specific header file
+``rte_ioat_rawdev.h``. This header is needed to get the definition of
+structure parameters used by some of the rawdev APIs for IOAT rawdev
+devices, as well as providing key functions for using the device for memory
+copies.
+
+Getting Device Information
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic information about each rawdev device can be got using the
+``rte_rawdev_info_get()`` API. For most applications, this API will be
+needed to verify that the rawdev in question is of the expected type. For
+example, the following code in ``test_ioat_rawdev.c`` is used to identify
+the IOAT rawdev device for use for the tests:
+
+.. code-block:: C
+
+        for (i = 0; i < count && !found; i++) {
+                struct rte_rawdev_info info = { .dev_private = NULL };
+                found = (rte_rawdev_info_get(i, &info) == 0 &&
+                                strcmp(info.driver_name,
+                                                IOAT_PMD_RAWDEV_NAME_STR) == 0);
+        }
+
+When calling the ``rte_rawdev_info_get()`` API for an IOAT rawdev device,
+the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
+be NULL, or else be set to point to a structure of type
+``rte_ioat_rawdev_config``, in which case the size of the configured device
+input ring will be returned in that structure.
drivers/raw/ioat/ioat_rawdev.c +11 -0
index b6964bccd..90bed2810 100644
@@ -24,10 +24,21 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+static void
+ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (cfg != NULL)
+		cfg->ring_size = ioat->ring_size;
+}
+
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_info_get = ioat_dev_info_get,
 	};
 
 	struct rte_rawdev *rawdev = NULL;
drivers/raw/ioat/rte_ioat_rawdev.h +11 -0
index c3216a174..7e0d72ca3 100644
@@ -24,6 +24,17 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * Configuration structure for an ioat rawdev instance
+ *
+ * This structure is to be passed as the ".dev_private" parameter when
+ * calling the rte_rawdev_get_info() and rte_rawdev_configure() APIs on
+ * an ioat rawdev instance.
+ */
+struct rte_ioat_rawdev_config {
+	unsigned short ring_size;
+};
+
 /**
  * @internal
  * Structure representing a device instance
Signature · 1 line
2.21.0
#8 lore raw

PATCH 6/8 raw/ioat: add configure, start and stop functions

In reply to Bruce Richardson

Allow initializing a driver instance.

---
 app/test/test_ioat_rawdev.c        | 35 +++++++++++++-
 doc/guides/rawdevs/ioat_rawdev.rst | 32 +++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 75 ++++++++++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 14 ++++++
 4 files changed, 155 insertions(+), 1 deletion(-)
app/test/test_ioat_rawdev.c +34 -1
index ac1389f6e..36e97347c 100644
@@ -18,6 +18,39 @@ test_ioat_rawdev(void) { return TEST_SKIPPED; }
 #include <rte_rawdev.h>
 #include <rte_ioat_rawdev.h>
 
+static int
+run_ioat_tests(int dev_id)
+{
+#define IOAT_TEST_RINGSIZE 512
+	struct rte_ioat_rawdev_config p = { .ring_size = -1 };
+	struct rte_rawdev_info info = { .dev_private = &p };
+
+	rte_rawdev_info_get(dev_id, &info);
+	if (p.ring_size != 0) {
+		printf("Error, initial ring size is non-zero (%d)\n",
+				(int)p.ring_size);
+		return -1;
+	}
+
+	p.ring_size = IOAT_TEST_RINGSIZE;
+	if (rte_rawdev_configure(dev_id, &info) != 0) {
+		printf("Error with rte_rawdev_configure()\n");
+		return -1;
+	}
+	rte_rawdev_info_get(dev_id, &info);
+	if (p.ring_size != IOAT_TEST_RINGSIZE) {
+		printf("Error, ring size is not %d (%d)\n",
+				IOAT_TEST_RINGSIZE, (int)p.ring_size);
+		return -1;
+	}
+
+	if (rte_rawdev_start(dev_id) != 0) {
+		printf("Error with rte_rawdev_start()\n");
+		return -1;
+	}
+	return 0;
+}
+
 static int
 test_ioat_rawdev(void)
 {
@@ -37,7 +70,7 @@ test_ioat_rawdev(void)
 		return TEST_SKIPPED;
 	}
 
-	return 0;
+	return run_ioat_tests(i);
 }
 
 #endif /* RTE_LIBRTE_PMD_IOAT_RAWDEV */
doc/guides/rawdevs/ioat_rawdev.rst +32 -0
index b68cdffc3..b3fe79033 100644
@@ -79,3 +79,35 @@ the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
 be NULL, or else be set to point to a structure of type
 ``rte_ioat_rawdev_config``, in which case the size of the configured device
 input ring will be returned in that structure.
+
+Device Configuration
+~~~~~~~~~~~~~~~~~~~~~
+
+Configuring an IOAT rawdev device is done using the
+``rte_rawdev_configure()`` API, which takes the same structure parameters
+as the, previously referenced, ``rte_rawdev_info_get()`` API. The main
+difference is that, because the parameter is used as input rather than
+output, the ``dev_private`` structure element cannot be NULL, and must
+point to a valid ``rte_ioat_rawdev_config`` structure, containing the ring
+size to be used by the device. The ring size must be a power of two,
+between 64 and 4096.
+
+The following code shows how the device is configured in
+``test_ioat_rawdev.c``:
+
+.. code-block:: C
+
+   #define IOAT_TEST_RINGSIZE 512
+        struct rte_ioat_rawdev_config p = { .ring_size = -1 };
+        struct rte_rawdev_info info = { .dev_private = &p };
+
+        /* ... */
+
+        p.ring_size = IOAT_TEST_RINGSIZE;
+        if (rte_rawdev_configure(dev_id, &info) != 0) {
+                printf("Error with rte_rawdev_configure()\n");
+                return -1;
+        }
+
+Once configured, the device can then be made ready for use by calling the
+``rte_rawdev_start()`` API.
drivers/raw/ioat/ioat_rawdev.c +75 -0

87 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +14 -0
index 7e0d72ca3..7eab216c8 100644
@@ -47,9 +47,23 @@ struct rte_ioat_rawdev {
 
 	unsigned short ring_size;
 	struct rte_ioat_desc *desc_ring;
+	__m128i *hdls; /* completion handles for returning to user */
 
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
 };
 
+/**
+ * @internal
+ * Structure representing a descriptor for a copy operation
+ */
+struct rte_ioat_desc {
+	uint32_t xfer_size __rte_cache_aligned;
+	uint32_t desc_control;
+	phys_addr_t src_addr; /* 64 bits */
+	phys_addr_t dest_addr; /* 64 bits */
+	phys_addr_t next_desc_addr; /* 64 bits */
+	uint64_t op_type_specific[4];
+};
+
 #endif
Signature · 1 line
2.21.0
#9 lore raw

PATCH 7/8 raw/ioat: add statistics functions

In reply to Bruce Richardson

Add stats functions to track what is happening in the driver, and put unit tests to check those.

---
 app/test/test_ioat_rawdev.c        | 38 ++++++++++++++++++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 14 ++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 44 ++++++++++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h |  6 ++++
 4 files changed, 102 insertions(+)
app/test/test_ioat_rawdev.c +38 -0
index 36e97347c..7081f3365 100644
@@ -24,6 +24,11 @@ run_ioat_tests(int dev_id)
 #define IOAT_TEST_RINGSIZE 512
 	struct rte_ioat_rawdev_config p = { .ring_size = -1 };
 	struct rte_rawdev_info info = { .dev_private = &p };
+	struct rte_rawdev_xstats_name *snames = NULL;
+	uint64_t *stats = NULL;
+	unsigned int *ids = NULL;
+	unsigned int nb_xstats;
+	unsigned int i;
 
 	rte_rawdev_info_get(dev_id, &info);
 	if (p.ring_size != 0) {
@@ -48,6 +53,39 @@ run_ioat_tests(int dev_id)
 		printf("Error with rte_rawdev_start()\n");
 		return -1;
 	}
+
+	/* allocate memory for xstats names and values */
+	nb_xstats = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
+
+	snames = malloc(sizeof(*snames) * nb_xstats);
+	if (snames == NULL) {
+		printf("Error allocating xstat names memory\n");
+		return -1;
+	}
+	rte_rawdev_xstats_names_get(dev_id, snames, nb_xstats);
+
+	ids = malloc(sizeof(*ids) * nb_xstats);
+	if (ids == NULL) {
+		printf("Error allocating xstat ids memory\n");
+		return -1;
+	}
+	for (i = 0; i < nb_xstats; i++)
+		ids[i] = i;
+
+	stats = malloc(sizeof(*stats) * nb_xstats);
+	if (stats == NULL) {
+		printf("Error allocating xstat memory\n");
+		return -1;
+	}
+
+	rte_rawdev_xstats_get(dev_id, ids, stats, nb_xstats);
+	for (i = 0; i < nb_xstats; i++)
+		printf("%s: %"PRIu64"   ", snames[i].name, stats[i]);
+	printf("\n");
+
+	free(snames);
+	free(stats);
+	free(ids);
 	return 0;
 }
 
doc/guides/rawdevs/ioat_rawdev.rst +14 -0
index b3fe79033..47f12e95c 100644
@@ -111,3 +111,17 @@ The following code shows how the device is configured in
 
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
+
+Querying Device Statistics
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The statistics from the IOAT rawdev device can be got via the xstats
+functions in the ``rte_rawdev`` library, i.e.
+``rte_rawdev_xstats_names_get()``, ``rte_rawdev_xstats_get()`` and
+``rte_rawdev_xstats_by_name_get``. The statistics returned for each device
+instance are:
+
+* ``failed_enqueues``
+* ``successful_enqueues``
+* ``copies_started``
+* ``copies_completed``
drivers/raw/ioat/ioat_rawdev.c +44 -0

62 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +6 -0
index 7eab216c8..abe5ba298 100644
@@ -49,6 +49,12 @@ struct rte_ioat_rawdev {
 	struct rte_ioat_desc *desc_ring;
 	__m128i *hdls; /* completion handles for returning to user */
 
+	/* some statistics for tracking, if added/changed update xstats fns*/
+	uint64_t enqueue_failed __rte_cache_aligned;
+	uint64_t enqueued;
+	uint64_t started;
+	uint64_t completed;
+
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
 };
Signature · 1 line
2.21.0
#10 lore raw

PATCH 8/8 raw/ioat: add local API to perform copies

In reply to Bruce Richardson

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

---
 app/test/test_ioat_rawdev.c        | 159 ++++++++++++++++++++++++++++-
 doc/guides/rawdevs/ioat_rawdev.rst | 100 ++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 155 +++++++++++++++++++++++++++-
 3 files changed, 410 insertions(+), 4 deletions(-)
app/test/test_ioat_rawdev.c +156 -3
index 7081f3365..f2240adec 100644
@@ -18,6 +18,131 @@ test_ioat_rawdev(void) { return TEST_SKIPPED; }
 #include <rte_rawdev.h>
 #include <rte_ioat_rawdev.h>
 
+static struct rte_mempool *pool;
+
+static int
+test_enqueue_copies(int dev_id)
+{
+	const unsigned int length = 1024;
+	unsigned int i;
+
+	do {
+		struct rte_mbuf *src, *dst;
+		char *src_data, *dst_data;
+		struct rte_mbuf *completed[2] = {0};
+
+		/* test doing a single copy */
+		src = rte_pktmbuf_alloc(pool);
+		dst = rte_pktmbuf_alloc(pool);
+		src->data_len = src->pkt_len = length;
+		dst->data_len = dst->pkt_len = length;
+		src_data = rte_pktmbuf_mtod(src, char *);
+		dst_data = rte_pktmbuf_mtod(dst, char *);
+
+		for (i = 0; i < length; i++)
+			src_data[i] = rand() & 0xFF;
+
+		if (rte_ioat_enqueue_copy(dev_id,
+				src->buf_iova + src->data_off,
+				dst->buf_iova + dst->data_off,
+				length,
+				(uintptr_t)src,
+				(uintptr_t)dst,
+				0 /* no fence */) != 1) {
+			printf("Error with rte_ioat_enqueue_copy\n");
+			return -1;
+		}
+		rte_ioat_do_copies(dev_id);
+		usleep(10);
+
+		if (rte_ioat_completed_copies(dev_id, 1, (void *)&completed[0],
+				(void *)&completed[1]) != 1) {
+			printf("Error with rte_ioat_completed_copies\n");
+			return -1;
+		}
+		if (completed[0] != src || completed[1] != dst) {
+			printf("Error with completions: got (%p, %p), not (%p,%p)\n",
+					completed[0], completed[1], src, dst);
+			return -1;
+		}
+
+		for (i = 0; i < length; i++)
+			if (dst_data[i] != src_data[i]) {
+				printf("Data mismatch at char %u\n", i);
+				return -1;
+			}
+		rte_pktmbuf_free(src);
+		rte_pktmbuf_free(dst);
+	} while(0);
+
+	/* test doing multiple copies */
+	do {
+		struct rte_mbuf *srcs[32], *dsts[32];
+		struct rte_mbuf *completed_src[64];
+		struct rte_mbuf *completed_dst[64];
+		unsigned int j;
+
+		for (i = 0; i < RTE_DIM(srcs); i++) {
+			char *src_data;
+
+			srcs[i] = rte_pktmbuf_alloc(pool);
+			dsts[i] = rte_pktmbuf_alloc(pool);
+			srcs[i]->data_len = srcs[i]->pkt_len = length;
+			dsts[i]->data_len = dsts[i]->pkt_len = length;
+			src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+			for (j = 0; j < length; j++)
+				src_data[j] = rand() & 0xFF;
+
+			if (rte_ioat_enqueue_copy(dev_id,
+					srcs[i]->buf_iova + srcs[i]->data_off,
+					dsts[i]->buf_iova + dsts[i]->data_off,
+					length,
+					(uintptr_t)srcs[i],
+					(uintptr_t)dsts[i],
+					0 /* nofence */) != 1) {
+				printf("Error with rte_ioat_enqueue_copy for buffer %u\n",
+						i);
+				return -1;
+			}
+		}
+		rte_ioat_do_copies(dev_id);
+		usleep(100);
+
+		if (rte_ioat_completed_copies(dev_id, 64, (void *)completed_src,
+				(void *)completed_dst) != RTE_DIM(srcs)) {
+			printf("Error with rte_ioat_completed_copies\n");
+			return -1;
+		}
+		for (i = 0; i < RTE_DIM(srcs); i++) {
+			char *src_data, *dst_data;
+
+			if (completed_src[i] != srcs[i]) {
+				printf("Error with source pointer %u\n", i);
+				return -1;
+			}
+			if (completed_dst[i] != dsts[i]) {
+				printf("Error with dest pointer %u\n", i);
+				return -1;
+			}
+
+			src_data = rte_pktmbuf_mtod(srcs[i], char *);
+			dst_data = rte_pktmbuf_mtod(dsts[i], char *);
+			for (j = 0; j < length; j++)
+				if (src_data[j] != dst_data[j]) {
+					printf("Error with copy of packet %u, byte %u\n",
+							i, j);
+					return -1;
+				}
+			rte_pktmbuf_free(srcs[i]);
+			rte_pktmbuf_free(dsts[i]);
+		}
+
+	} while(0);
+
+	return 0;
+}
+
 static int
 run_ioat_tests(int dev_id)
 {
@@ -54,6 +179,17 @@ run_ioat_tests(int dev_id)
 		return -1;
 	}
 
+	pool = rte_pktmbuf_pool_create("TEST_IOAT_POOL",
+			256, /* n == num elements */
+			32,  /* cache size */
+			0,   /* priv size */
+			2048, /* data room size */
+			info.socket_id);
+	if (pool == NULL) {
+		printf("Error with mempool creation\n");
+		return -1;
+	}
+
 	/* allocate memory for xstats names and values */
 	nb_xstats = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
 
@@ -78,15 +214,32 @@ run_ioat_tests(int dev_id)
 		return -1;
 	}
 
-	rte_rawdev_xstats_get(dev_id, ids, stats, nb_xstats);
-	for (i = 0; i < nb_xstats; i++)
-		printf("%s: %"PRIu64"   ", snames[i].name, stats[i]);
+	/* run the test cases */
+	for (i = 0; i < 100; i++) {
+		unsigned int j;
+
+		if (test_enqueue_copies(dev_id) != 0)
+			goto err;
+
+		rte_rawdev_xstats_get(dev_id, ids, stats, nb_xstats);
+		for (j = 0; j < nb_xstats; j++)
+			printf("%s: %"PRIu64"   ", snames[j].name, stats[j]);
+		printf("\r");
+	}
 	printf("\n");
 
+	rte_mempool_free(pool);
 	free(snames);
 	free(stats);
 	free(ids);
 	return 0;
+
+err:
+	rte_mempool_free(pool);
+	free(snames);
+	free(stats);
+	free(ids);
+	return -1;
 }
 
 static int
doc/guides/rawdevs/ioat_rawdev.rst +100 -0

106 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +154 -1

171 lines not on this page · raw message

Signature · 1 line
2.21.0
#11 lore raw

Re: [dpdk-dev] [PATCH 8/8] raw/ioat: add local API to perform copies

30/05/2019 23:25, Bruce Richardson:

Quoted 3 lines

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

Would be nice to have a small design overview in the guide.

We may need also to answer these questions:
What are the performance gains? In which use-case? What are the hardware requirements?

#12 lore raw

Re: [dpdk-dev] [PATCH 8/8] raw/ioat: add local API to perform copies

Quoted 11 lines · Thomas Monjalon

30/05/2019 23:25, Bruce Richardson:

Quoted 3 lines

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

Would be nice to have a small design overview in the guide.

We may need also to answer these questions:
What are the performance gains? In which use-case? What are the hardware requirements?

Thanks for the comments. Will try and add more details in subsequent revisions.

/Bruce

#13 lore raw

Re: [dpdk-dev] [PATCH 8/8] raw/ioat: add local API to perform copies

In reply to Bruce Richardson
Quoted 8 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bruce Richardson
Sent: Friday, May 31, 2019 2:55 AM
To: [email protected]
Cc: Bruce Richardson <[email protected]>
Subject: [dpdk-dev] [PATCH 8/8] raw/ioat: add local API to perform copies

Quoted 7 lines

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

---
 app/test/test_ioat_rawdev.c        | 159 ++++++++++++++++++++++++++++-

How about moving this test to drivers/raw/ioat/ directory by implementing dev_selftest ops? IMO, it is better to not pollute app/test with PMD specific test cases.

#14 lore raw

Re: [dpdk-dev] [PATCH 8/8] raw/ioat: add local API to perform copies

Quoted 12 lines · Jerin Jacob Kollanukkaran
Quoted 12 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bruce Richardson
Sent: Friday, May 31, 2019 2:55 AM
To: [email protected]
Cc: Bruce Richardson <[email protected]>
Subject: [dpdk-dev] [PATCH 8/8] raw/ioat: add local API to perform copies

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

Quoted 8 lines
Quoted 3 lines
---
 app/test/test_ioat_rawdev.c        | 159 ++++++++++++++++++++++++++++-

How about moving this test to drivers/raw/ioat/ directory by implementing dev_selftest ops? IMO, it is better to not pollute app/test with PMD specific test cases.

Let me look into it.

/Bruce

#15 lore raw

v2 cover raw/ioat: driver for Intel QuickData Technology

In reply to Bruce Richardson

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Performing the copies in hardware can provide performance improvements for applications where the average copy size is reasonably large, e.g. 1k packets. For smaller packets, e.g. 64-256 bytes, offloading the copy may reduce performance due to the overhead of using hardware.

V2:
* moved tests to rawdev selftest function
* some checkpatch and other small cleanups
* added extra documentation details on supported hardware
* aligned the changes to dpdk-devbind with the changes in the NTB set for consistency

Bruce Richardson (8):
raw/ioat: add initial support for ioat rawdev driver usertools/dpdk-devbind.py: add support for IOAT devices raw/ioat: add register definition file raw/ioat: create device on probe and destroy on release raw/ioat: add device info function
raw/ioat: add configure, start and stop functions raw/ioat: add statistics functions
raw/ioat: add local API to perform copies

 MAINTAINERS                                 |   6 +-
 app/test/test_rawdev.c                      |  19 ++
 config/common_armv8a_linux                  |   1 +
 config/common_base                          |   5 +
 config/defconfig_arm-armv7a-linuxapp-gcc    |   1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 +
 doc/guides/rawdevs/index.rst                |   1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 265 +++++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      |  11 +
 drivers/raw/Makefile                        |   1 +
 drivers/raw/ioat/Makefile                   |  31 ++
 drivers/raw/ioat/ioat_rawdev.c              | 313 ++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c         | 235 +++++++++++++++
 drivers/raw/ioat/meson.build                |  10 +
 drivers/raw/ioat/rte_ioat_rawdev.h          | 242 +++++++++++++++
 drivers/raw/ioat/rte_ioat_spec.h            | 301 +++++++++++++++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |   4 +
 drivers/raw/meson.build                     |   4 +-
 mk/rte.app.mk                               |   1 +
 usertools/dpdk-devbind.py                   |  10 +
 20 files changed, 1460 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
Signature · 1 line
2.21.0
#16 lore raw

PATCH v2 1/8 raw/ioat: add initial support for ioat rawdev driver

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---
V2: don't create a new file for unit testing, add to existing rawdev test
file, and place test cases in the driver selftest routine (added later in set)
Add new section in document about identifying hardware using lspci

---
 MAINTAINERS                                 |  6 +-
 app/test/test_rawdev.c                      |  8 ++
 config/common_armv8a_linux                  |  1 +
 config/common_base                          |  5 ++
 config/defconfig_arm-armv7a-linuxapp-gcc    |  1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |  1 +
 doc/guides/rawdevs/index.rst                |  1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 63 ++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      | 11 +++
 drivers/raw/Makefile                        |  1 +
 drivers/raw/ioat/Makefile                   | 28 +++++++
 drivers/raw/ioat/ioat_rawdev.c              | 93 +++++++++++++++++++++
 drivers/raw/ioat/meson.build                |  8 ++
 drivers/raw/ioat/rte_ioat_rawdev.h          | 24 ++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |  4 +
 drivers/raw/meson.build                     |  4 +-
 mk/rte.app.mk                               |  1 +
 17 files changed, 258 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
MAINTAINERS +5 -1
index fdc083db9..65735c01e 100644
@@ -1047,6 +1047,11 @@ M: Tianfei zhang <[email protected]>
 F: drivers/raw/ifpga_rawdev/
 F: doc/guides/rawdevs/ifpga_rawdev.rst
 
+IOAT Rawdev
+M: Bruce Richardson <[email protected]>
+F: drivers/raw/ioat/
+F: doc/guides/rawdevs/ioat_rawdev.rst
+
 NXP DPAA2 QDMA
 M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_qdma/
@@ -1057,7 +1062,6 @@ M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_cmdif/
 F: doc/guides/rawdevs/dpaa2_cmdif.rst
 
-
 Packet processing
 -----------------
 
app/test/test_rawdev.c +8 -0
index 043a38a13..88549fb61 100644
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
+
+static int
+test_rawdev_selftest_ioat(void)
+{
+	return TEST_SKIPPED;
+}
+
+REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
config/common_armv8a_linux +1 -0
index 72091de1c..481712ebc 100644
@@ -34,5 +34,6 @@ CONFIG_RTE_ARCH_ARM64_MEMCPY=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
 
 CONFIG_RTE_SCHED_VECTOR=n
config/common_base +5 -0
index e406e7836..7c342d8e7 100644
@@ -746,6 +746,11 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n
 #
 CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV=y
 
+#
+# Compile PMD for Intel IOAT raw device
+#
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y
+
 #
 # Compile librte_ring
 #
config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
index c9509b274..ee158ef9d 100644
@@ -54,3 +54,4 @@ CONFIG_RTE_LIBRTE_QEDE_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
 CONFIG_RTE_LIBRTE_NFP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
index 7e248b755..9f3670ec0 100644
@@ -56,3 +56,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
doc/guides/rawdevs/index.rst +1 -0
index 7c3bd9586..0a21989e4 100644
@@ -14,3 +14,4 @@ application through rawdev API.
     dpaa2_cmdif
     dpaa2_qdma
     ifpga_rawdev
+    ioat_rawdev
doc/guides/rawdevs/ioat_rawdev.rst new file +63 -0

63 lines not on this page · raw message

doc/guides/rel_notes/release_19_08.rst +11 -0
index 8c3932d06..9d26dc437 100644
@@ -1,6 +1,8 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright 2019 The DPDK contributors
 
+.. include:: <isonum.txt>
+
 DPDK Release 19.08
 ==================
 
@@ -88,6 +90,15 @@ New Features
   * Added multi-queue support to allow one af_xdp vdev with multiple netdev
     queues
 
+* **Added Intel QuickData Technology PMD**
+
+  The PMD for Intel\ |reg|  QuickData Technology, part of
+  Intel\ |reg|  I/O Acceleration Technology `(Intel I/OAT)
+  <https://www.intel.com/content/www/us/en/wireless-network/accel-technology.html>`_,
+  allows data copies to be done by hardware instead
+  of via software, reducing cycles spent copying large blocks of data in
+  applications.
+
 
 Removed Items
 -------------
drivers/raw/Makefile +1 -0
index 8e29b4a56..c1b85c8c7 100644
@@ -10,5 +10,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma
 endif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga_rawdev
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/ioat/Makefile new file +28 -0
new file mode 100644
index 000000000..7726e310a
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_ioat_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+LDLIBS += -lrte_eal -lrte_rawdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_ioat_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+
+# export include files
+SYMLINK-y-include += rte_ioat_rawdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/ioat_rawdev.c new file +93 -0

93 lines not on this page · raw message

drivers/raw/ioat/meson.build new file +8 -0
new file mode 100644
index 000000000..ba7620a68
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Intel Corporation
+
+build = dpdk_conf.has('RTE_ARCH_X86')
+sources = files('ioat_rawdev.c')
+deps += ['rawdev', 'bus_pci']
+
+install_headers('rte_ioat_rawdev.h')
drivers/raw/ioat/rte_ioat_rawdev.h new file +24 -0
new file mode 100644
index 000000000..e77406403
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IOAT_RAWDEV_H_
+#define _RTE_IOAT_RAWDEV_H_
+
+/**
+ * @file rte_ioat_rawdev.h
+ *
+ * Definitions for using the ioat rawdev device driver
+ *
+ * @warning
+ * @b EXPERIMENTAL: these structures and APIs may change without prior notice
+ */
+
+/** Name of the device driver */
+#define IOAT_PMD_RAWDEV_NAME rawdev_ioat
+/** String reported as the device driver name by rte_rawdev_info_get() */
+#define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
+/** Name used to adjust the log level for this driver */
+#define IOAT_PMD_LOG_NAME "rawdev.ioat"
+
+#endif
drivers/raw/ioat/rte_pmd_ioat_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
drivers/raw/meson.build +3 -1
index a61cdccef..2af8a70d4 100644
@@ -1,7 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 NXP
 
-drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma', 'ifpga_rawdev']
+drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
+	'ifpga_rawdev', 'ioat',
+	'skeleton_rawdev']
 std_deps = ['rawdev']
 config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV'
 driver_name_fmt = 'rte_pmd_@0@'
mk/rte.app.mk +1 -0
index d0df0b023..52a50bc4e 100644
@@ -301,6 +301,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV)   += -lrte_pmd_ioat_rawdev
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
 endif # !CONFIG_RTE_BUILD_SHARED_LIBS
Signature · 1 line
2.21.0
#17 lore raw

PATCH v2 2/8 usertools/dpdk-devbind.py: add support for IOAT devices

In reply to Bruce Richardson

In order to allow binding/unbinding of devices for use by the ioat_rawdev, we need to update the devbind script to add a new class of device, and add device ids for the specific HW instances.

---

V2: rather than adding a DMA section, add to "misc (rawdev)" section where
other device types, e.g. ntb can also do.

NOTE: this set largely overlaps with the equivalent changes made by the patchset adding NTB support [1]. Since it's unclear which set will be added first, this set is based off the latest head.

[1] http://patches.dpdk.org/patch/55127/

---
 doc/guides/rawdevs/ioat_rawdev.rst | 11 +++++++++++
 usertools/dpdk-devbind.py          | 10 ++++++++++
 2 files changed, 21 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 0c612e73a..1a4b0e03e 100644
@@ -61,3 +61,14 @@ configurations.
 
 For builds using ``meson`` and ``ninja``, the driver will be built when the
 target platform is x86-based.
+
+Device Setup
+-------------
+
+The Intel\ |reg| QuickData Technology HW devices will need to be bound to a
+user-space IO driver for use. The script ``dpdk-devbind.py`` script
+included with DPDK can be used to view the state of the devices and to bind
+them to a suitable DPDK-supported kernel driver. When querying the status
+of the devices, they will appear under the category of "Misc (rawdev)
+devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
+used to see the state of those devices alone.
usertools/dpdk-devbind.py +10 -0
index 9e79f0d28..5c1cd3548 100755
@@ -36,11 +36,17 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
+intel_ioat_bdw = {'Class': '08', 'Vendor': '8086', 'Device': '6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
+              'SVendor': None, 'SDevice': None}
+intel_ioat_skx = {'Class': '08', 'Vendor': '8086', 'Device': '2021',
+              'SVendor': None, 'SDevice': None}
+
 network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
+misc_devices = [intel_ioat_bdw, intel_ioat_skx]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -595,6 +601,8 @@ def show_status():
     if status_dev == "compress" or status_dev == "all":
         show_device_status(compress_devices , "Compress")
 
+    if status_dev == "misc" or status_dev == "all":
+        show_device_status(misc_devices, "Misc (rawdev)")
 
 def parse_args():
     '''Parses the command-line arguments given by the user and takes the
@@ -670,6 +678,7 @@ def do_arg_actions():
             get_device_details(eventdev_devices)
             get_device_details(mempool_devices)
             get_device_details(compress_devices)
+            get_device_details(misc_devices)
         show_status()
 
 
@@ -690,6 +699,7 @@ def main():
     get_device_details(eventdev_devices)
     get_device_details(mempool_devices)
     get_device_details(compress_devices)
+    get_device_details(misc_devices)
     do_arg_actions()
 
 if __name__ == "__main__":
Signature · 1 line
2.21.0
#18 lore raw

PATCH v2 3/8 raw/ioat: add register definition file

In reply to Bruce Richardson

Add in the list of registers for the device. File is taken from the SPDK project:

https://github.com/spdk/spdk/blob/master/include/spdk/ioat_spec.h

---
 drivers/raw/ioat/Makefile        |   1 +
 drivers/raw/ioat/meson.build     |   3 +-
 drivers/raw/ioat/rte_ioat_spec.h | 301 +++++++++++++++++++++++++++++++
 3 files changed, 304 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
drivers/raw/ioat/Makefile +1 -0
index 7726e310a..1e10938f3 100644
@@ -24,5 +24,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
+SYMLINK-y-include += rte_ioat_spec.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/meson.build +2 -1
index ba7620a68..ca23e23fc 100644
@@ -5,4 +5,5 @@ build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c')
 deps += ['rawdev', 'bus_pci']
 
-install_headers('rte_ioat_rawdev.h')
+install_headers('rte_ioat_rawdev.h',
+		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_spec.h new file +301 -0

301 lines not on this page · raw message

Signature · 1 line
2.21.0
#19 lore raw

PATCH v2 4/8 raw/ioat: create device on probe and destroy on release

In reply to Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---
 doc/guides/rawdevs/ioat_rawdev.rst | 11 ++++
 drivers/raw/ioat/ioat_rawdev.c     | 93 +++++++++++++++++++++++++++++-
 drivers/raw/ioat/rte_ioat_rawdev.h | 20 +++++++
 3 files changed, 121 insertions(+), 3 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 1a4b0e03e..4b7fe8a8f 100644
@@ -72,3 +72,14 @@ them to a suitable DPDK-supported kernel driver. When querying the status
 of the devices, they will appear under the category of "Misc (rawdev)
 devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
 used to see the state of those devices alone.
+
+Device Probing and Initialization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Once bound to a suitable kernel device driver, the HW devices will be found
+as part of the PCI scan done at application initialization time. No vdev
+parameters need to be passed to create or initialize the device.
+
+Once probed successfully, the device will appear as a ``rawdev``, that is a
+"raw device type" inside DPDK, and can be accessed using APIs from the
+``rte_rawdev`` library.
drivers/raw/ioat/ioat_rawdev.c +90 -3

111 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +20 -0
index e77406403..c3216a174 100644
@@ -14,6 +14,9 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <rte_memory.h>
+#include <rte_ioat_spec.h>
+
 /** Name of the device driver */
 #define IOAT_PMD_RAWDEV_NAME rawdev_ioat
 /** String reported as the device driver name by rte_rawdev_info_get() */
@@ -21,4 +24,21 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * @internal
+ * Structure representing a device instance
+ */
+struct rte_ioat_rawdev {
+	struct rte_rawdev *rawdev;
+	volatile struct rte_ioat_registers *regs;
+	phys_addr_t status_addr;
+	phys_addr_t ring_addr;
+
+	unsigned short ring_size;
+	struct rte_ioat_desc *desc_ring;
+
+	/* to report completions, the device will write status back here */
+	volatile uint64_t status __rte_cache_aligned;
+};
+
 #endif
Signature · 1 line
2.21.0
#20 lore raw

PATCH v2 5/8 raw/ioat: add device info function

In reply to Bruce Richardson

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---

V2: Test case is placed in driver self-test routine

---
 app/test/test_rawdev.c             | 11 ++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
 4 files changed, 67 insertions(+)
app/test/test_rawdev.c +11 -0
index 88549fb61..4db762b4c 100644
@@ -29,6 +29,17 @@ REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
 static int
 test_rawdev_selftest_ioat(void)
 {
+	const int count = rte_rawdev_count();
+	int i;
+
+	for (i = 0; i < count; i++) {
+		struct rte_rawdev_info info = { .dev_private = NULL };
+		if (rte_rawdev_info_get(i, &info) == 0 &&
+				strstr(info.driver_name, "ioat") != NULL)
+			return 0;
+	}
+
+	printf("No IOAT rawdev found, skipping tests\n");
 	return TEST_SKIPPED;
 }
 
doc/guides/rawdevs/ioat_rawdev.rst +34 -0
index 4b7fe8a8f..0ce984490 100644
@@ -83,3 +83,37 @@ parameters need to be passed to create or initialize the device.
 Once probed successfully, the device will appear as a ``rawdev``, that is a
 "raw device type" inside DPDK, and can be accessed using APIs from the
 ``rte_rawdev`` library.
+
+Using IOAT Rawdev Devices
+--------------------------
+
+To use the devices from an application, the rawdev API can be used, along
+with definitions taken from the device-specific header file
+``rte_ioat_rawdev.h``. This header is needed to get the definition of
+structure parameters used by some of the rawdev APIs for IOAT rawdev
+devices, as well as providing key functions for using the device for memory
+copies.
+
+Getting Device Information
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic information about each rawdev device can be got using the
+``rte_rawdev_info_get()`` API. For most applications, this API will be
+needed to verify that the rawdev in question is of the expected type. For
+example, the following code in ``test_ioat_rawdev.c`` is used to identify
+the IOAT rawdev device for use for the tests:
+
+.. code-block:: C
+
+        for (i = 0; i < count && !found; i++) {
+                struct rte_rawdev_info info = { .dev_private = NULL };
+                found = (rte_rawdev_info_get(i, &info) == 0 &&
+                                strcmp(info.driver_name,
+                                                IOAT_PMD_RAWDEV_NAME_STR) == 0);
+        }
+
+When calling the ``rte_rawdev_info_get()`` API for an IOAT rawdev device,
+the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
+be NULL, or else be set to point to a structure of type
+``rte_ioat_rawdev_config``, in which case the size of the configured device
+input ring will be returned in that structure.
drivers/raw/ioat/ioat_rawdev.c +11 -0
index d13391dd5..08e7586c6 100644
@@ -24,10 +24,21 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+static void
+ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (cfg != NULL)
+		cfg->ring_size = ioat->ring_size;
+}
+
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_info_get = ioat_dev_info_get,
 	};
 
 	struct rte_rawdev *rawdev = NULL;
drivers/raw/ioat/rte_ioat_rawdev.h +11 -0
index c3216a174..7e0d72ca3 100644
@@ -24,6 +24,17 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * Configuration structure for an ioat rawdev instance
+ *
+ * This structure is to be passed as the ".dev_private" parameter when
+ * calling the rte_rawdev_get_info() and rte_rawdev_configure() APIs on
+ * an ioat rawdev instance.
+ */
+struct rte_ioat_rawdev_config {
+	unsigned short ring_size;
+};
+
 /**
  * @internal
  * Structure representing a device instance
Signature · 1 line
2.21.0
#21 lore raw

PATCH v2 6/8 raw/ioat: add configure, start and stop functions

In reply to Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

---

V2: test cases placed in self-test routine

---
 app/test/test_rawdev.c              |  2 +-
 doc/guides/rawdevs/ioat_rawdev.rst  | 32 ++++++++++++
 drivers/raw/ioat/Makefile           |  1 +
 drivers/raw/ioat/ioat_rawdev.c      | 78 +++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 41 +++++++++++++++
 drivers/raw/ioat/meson.build        |  3 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  | 15 ++++++
 7 files changed, 170 insertions(+), 2 deletions(-)
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
app/test/test_rawdev.c +1 -1
index 4db762b4c..731e51717 100644
@@ -36,7 +36,7 @@ test_rawdev_selftest_ioat(void)
 		struct rte_rawdev_info info = { .dev_private = NULL };
 		if (rte_rawdev_info_get(i, &info) == 0 &&
 				strstr(info.driver_name, "ioat") != NULL)
-			return 0;
+			return rte_rawdev_selftest(i);
 	}
 
 	printf("No IOAT rawdev found, skipping tests\n");
doc/guides/rawdevs/ioat_rawdev.rst +32 -0
index 0ce984490..9ab97e2aa 100644
@@ -117,3 +117,35 @@ the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
 be NULL, or else be set to point to a structure of type
 ``rte_ioat_rawdev_config``, in which case the size of the configured device
 input ring will be returned in that structure.
+
+Device Configuration
+~~~~~~~~~~~~~~~~~~~~~
+
+Configuring an IOAT rawdev device is done using the
+``rte_rawdev_configure()`` API, which takes the same structure parameters
+as the, previously referenced, ``rte_rawdev_info_get()`` API. The main
+difference is that, because the parameter is used as input rather than
+output, the ``dev_private`` structure element cannot be NULL, and must
+point to a valid ``rte_ioat_rawdev_config`` structure, containing the ring
+size to be used by the device. The ring size must be a power of two,
+between 64 and 4096.
+
+The following code shows how the device is configured in
+``test_ioat_rawdev.c``:
+
+.. code-block:: C
+
+   #define IOAT_TEST_RINGSIZE 512
+        struct rte_ioat_rawdev_config p = { .ring_size = -1 };
+        struct rte_rawdev_info info = { .dev_private = &p };
+
+        /* ... */
+
+        p.ring_size = IOAT_TEST_RINGSIZE;
+        if (rte_rawdev_configure(dev_id, &info) != 0) {
+                printf("Error with rte_rawdev_configure()\n");
+                return -1;
+        }
+
+Once configured, the device can then be made ready for use by calling the
+``rte_rawdev_start()`` API.
drivers/raw/ioat/Makefile +1 -0
index 1e10938f3..b1af9c666 100644
@@ -21,6 +21,7 @@ EXPORT_MAP := rte_pmd_ioat_version.map
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev_test.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
drivers/raw/ioat/ioat_rawdev.c +78 -0

95 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c new file +41 -0

41 lines not on this page · raw message

drivers/raw/ioat/meson.build +2 -1
index ca23e23fc..40fff6654 100644
@@ -2,7 +2,8 @@
 # Copyright 2019 Intel Corporation
 
 build = dpdk_conf.has('RTE_ARCH_X86')
-sources = files('ioat_rawdev.c')
+sources = files('ioat_rawdev.c',
+		'ioat_rawdev_test.c')
 deps += ['rawdev', 'bus_pci']
 
 install_headers('rte_ioat_rawdev.h',
drivers/raw/ioat/rte_ioat_rawdev.h +15 -0
index 7e0d72ca3..0c41a9dcf 100644
@@ -14,6 +14,7 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <x86intrin.h>
 #include <rte_memory.h>
 #include <rte_ioat_spec.h>
 
@@ -47,9 +48,23 @@ struct rte_ioat_rawdev {
 
 	unsigned short ring_size;
 	struct rte_ioat_desc *desc_ring;
+	__m128i *hdls; /* completion handles for returning to user */
 
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
 };
 
+/**
+ * @internal
+ * Structure representing a descriptor for a copy operation
+ */
+struct rte_ioat_desc {
+	uint32_t xfer_size __rte_cache_aligned;
+	uint32_t desc_control;
+	phys_addr_t src_addr; /* 64 bits */
+	phys_addr_t dest_addr; /* 64 bits */
+	phys_addr_t next_desc_addr; /* 64 bits */
+	uint64_t op_type_specific[4];
+};
+
 #endif
Signature · 1 line
2.21.0
#22 lore raw

PATCH v2 7/8 raw/ioat: add statistics functions

In reply to Bruce Richardson

Add stats functions to track what is happening in the driver, and put unit tests to check those.

---

V2: test cases moved to self-test routine

---
 doc/guides/rawdevs/ioat_rawdev.rst  | 14 +++++++++
 drivers/raw/ioat/ioat_rawdev.c      | 44 +++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 39 +++++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h  |  6 ++++
 4 files changed, 103 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +14 -0
index 9ab97e2aa..b908f31e0 100644
@@ -149,3 +149,17 @@ The following code shows how the device is configured in
 
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
+
+Querying Device Statistics
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The statistics from the IOAT rawdev device can be got via the xstats
+functions in the ``rte_rawdev`` library, i.e.
+``rte_rawdev_xstats_names_get()``, ``rte_rawdev_xstats_get()`` and
+``rte_rawdev_xstats_by_name_get``. The statistics returned for each device
+instance are:
+
+* ``failed_enqueues``
+* ``successful_enqueues``
+* ``copies_started``
+* ``copies_completed``
drivers/raw/ioat/ioat_rawdev.c +44 -0

62 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +39 -0
index 5375da26c..5098d71ae 100644
@@ -2,6 +2,7 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <inttypes.h>
 #include "rte_rawdev.h"
 #include "rte_ioat_rawdev.h"
 
@@ -13,6 +14,11 @@ ioat_rawdev_test(uint16_t dev_id)
 #define IOAT_TEST_RINGSIZE 512
 	struct rte_ioat_rawdev_config p = { .ring_size = -1 };
 	struct rte_rawdev_info info = { .dev_private = &p };
+	struct rte_rawdev_xstats_name *snames = NULL;
+	uint64_t *stats = NULL;
+	unsigned int *ids = NULL;
+	unsigned int nb_xstats;
+	unsigned int i;
 
 	rte_rawdev_info_get(dev_id, &info);
 	if (p.ring_size != 0) {
@@ -37,5 +43,38 @@ ioat_rawdev_test(uint16_t dev_id)
 		printf("Error with rte_rawdev_start()\n");
 		return -1;
 	}
+
+	/* allocate memory for xstats names and values */
+	nb_xstats = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
+
+	snames = malloc(sizeof(*snames) * nb_xstats);
+	if (snames == NULL) {
+		printf("Error allocating xstat names memory\n");
+		return -1;
+	}
+	rte_rawdev_xstats_names_get(dev_id, snames, nb_xstats);
+
+	ids = malloc(sizeof(*ids) * nb_xstats);
+	if (ids == NULL) {
+		printf("Error allocating xstat ids memory\n");
+		return -1;
+	}
+	for (i = 0; i < nb_xstats; i++)
+		ids[i] = i;
+
+	stats = malloc(sizeof(*stats) * nb_xstats);
+	if (stats == NULL) {
+		printf("Error allocating xstat memory\n");
+		return -1;
+	}
+
+	rte_rawdev_xstats_get(dev_id, ids, stats, nb_xstats);
+	for (i = 0; i < nb_xstats; i++)
+		printf("%s: %"PRIu64"   ", snames[i].name, stats[i]);
+	printf("\n");
+
+	free(snames);
+	free(stats);
+	free(ids);
 	return 0;
 }
drivers/raw/ioat/rte_ioat_rawdev.h +6 -0
index 0c41a9dcf..90119bc70 100644
@@ -50,6 +50,12 @@ struct rte_ioat_rawdev {
 	struct rte_ioat_desc *desc_ring;
 	__m128i *hdls; /* completion handles for returning to user */
 
+	/* some statistics for tracking, if added/changed update xstats fns*/
+	uint64_t enqueue_failed __rte_cache_aligned;
+	uint64_t enqueued;
+	uint64_t started;
+	uint64_t completed;
+
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
 };
Signature · 1 line
2.21.0
#23 lore raw

PATCH v2 8/8 raw/ioat: add local API to perform copies

In reply to Bruce Richardson

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

---

V2: test cases moved to self-test routine

---
 doc/guides/rawdevs/ioat_rawdev.rst  | 100 +++++++++++++++++
 drivers/raw/ioat/Makefile           |   1 +
 drivers/raw/ioat/ioat_rawdev_test.c | 161 +++++++++++++++++++++++++-
 drivers/raw/ioat/meson.build        |   2 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  | 168 +++++++++++++++++++++++++++-
 5 files changed, 427 insertions(+), 5 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +100 -0
index b908f31e0..22bb8a22c 100644
@@ -150,6 +150,106 @@ The following code shows how the device is configured in
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
 
+Performing Data Copies
+~~~~~~~~~~~~~~~~~~~~~~~
+
+To perform data copies using IOAT rawdev devices, the functions
+``rte_ioat_enqueue_copy()`` and ``rte_ioat_do_copies()`` should be used.
+Once copies have been completed, the completion will be reported back when
+the application calls ``rte_ioat_completed_copies()``.
+
+The ``rte_ioat_enqueue_copy()`` function enqueues a single copy to the
+device ring for copying at a later point. The parameters to that function
+include the physical addresses of both the source and destination buffers,
+as well as two "handles" to be returned to the user when the copy is
+completed. These handles can be arbitrary values, but two are provided so
+that the library can track handles for both source and destination on
+behalf of the user, e.g. virtual addresses for the buffers, or mbuf
+pointers if packet data is being copied.
+
+While the ``rte_ioat_enqueue_copy()`` function enqueues a copy operation on
+the device ring, the copy will not actually be performed until after the
+application calls the ``rte_ioat_do_copies()`` function. This function
+informs the device hardware of the elements enqueued on the ring, and the
+device will begin to process them. It is expected that, for efficiency
+reasons, a burst of operations will be enqueued to the device via multiple
+enqueue calls between calls to the ``rte_ioat_do_copies()`` function.
+
+The following code from ``test_ioat_rawdev.c`` demonstrates how to enqueue
+a burst of copies to the device and start the hardware processing of them:
+
+.. code-block:: C
+
+        struct rte_mbuf *srcs[32], *dsts[32];
+        unsigned int j;
+
+        for (i = 0; i < RTE_DIM(srcs); i++) {
+                char *src_data;
+
+                srcs[i] = rte_pktmbuf_alloc(pool);
+                dsts[i] = rte_pktmbuf_alloc(pool);
+                srcs[i]->data_len = srcs[i]->pkt_len = length;
+                dsts[i]->data_len = dsts[i]->pkt_len = length;
+                src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+                for (j = 0; j < length; j++)
+                        src_data[j] = rand() & 0xFF;
+
+                if (rte_ioat_enqueue_copy(dev_id,
+                                srcs[i]->buf_iova + srcs[i]->data_off,
+                                dsts[i]->buf_iova + dsts[i]->data_off,
+                                length,
+                                (uintptr_t)srcs[i],
+                                (uintptr_t)dsts[i],
+                                0 /* nofence */) != 1) {
+                        printf("Error with rte_ioat_enqueue_copy for buffer %u\n",
+                                        i);
+                        return -1;
+                }
+        }
+        rte_ioat_do_copies(dev_id);
+
+To retrieve information about completed copies, the API
+``rte_ioat_completed_copies()`` should be used. This API will return to the
+application a set of completion handles passed in when the relevant copies
+were enqueued.
+
+The following code from ``test_ioat_rawdev.c`` shows the test code
+retrieving information about the completed copies and validating the data
+is correct before freeing the data buffers using the returned handles:
+
+.. code-block:: C
+
+        if (rte_ioat_completed_copies(dev_id, 64, (void *)completed_src,
+                        (void *)completed_dst) != RTE_DIM(srcs)) {
+                printf("Error with rte_ioat_completed_copies\n");
+                return -1;
+        }
+        for (i = 0; i < RTE_DIM(srcs); i++) {
+                char *src_data, *dst_data;
+
+                if (completed_src[i] != srcs[i]) {
+                        printf("Error with source pointer %u\n", i);
+                        return -1;
+                }
+                if (completed_dst[i] != dsts[i]) {
+                        printf("Error with dest pointer %u\n", i);
+                        return -1;
+                }
+
+                src_data = rte_pktmbuf_mtod(srcs[i], char *);
+                dst_data = rte_pktmbuf_mtod(dsts[i], char *);
+                for (j = 0; j < length; j++)
+                        if (src_data[j] != dst_data[j]) {
+                                printf("Error with copy of packet %u, byte %u\n",
+                                                i, j);
+                                return -1;
+                        }
+                rte_pktmbuf_free(srcs[i]);
+                rte_pktmbuf_free(dsts[i]);
+        }
+
+
 Querying Device Statistics
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
drivers/raw/ioat/Makefile +1 -0
index b1af9c666..32f079845 100644
@@ -12,6 +12,7 @@ CFLAGS += $(WERROR_FLAGS)
 
 LDLIBS += -lrte_eal -lrte_rawdev
 LDLIBS += -lrte_pci -lrte_bus_pci
+LDLIBS += -lrte_mbuf -lrte_mempool
 
 # library version
 LIBABIVER := 1
drivers/raw/ioat/ioat_rawdev_test.c +158 -3

189 lines not on this page · raw message

drivers/raw/ioat/meson.build +1 -1
index 40fff6654..247ff88bf 100644
@@ -4,7 +4,7 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c',
 		'ioat_rawdev_test.c')
-deps += ['rawdev', 'bus_pci']
+deps += ['rawdev', 'bus_pci', 'mbuf']
 
 install_headers('rte_ioat_rawdev.h',
 		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_rawdev.h +167 -1

184 lines not on this page · raw message

Signature · 1 line
2.21.0
#24 lore raw

v3 cover raw/ioat: driver for Intel QuickData Technology

In reply to Bruce Richardson

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Performing the copies in hardware can provide performance improvements for applications where the average copy size is reasonably large, e.g. 1k packets. For smaller packets, e.g. 64-256 bytes, offloading the copy may reduce performance due to the overhead of using hardware.

V3:
* removed DPDK-specific structure for the descriptor format and reused the structure in the imported file rte_ioat_spec.h

V2:
* moved tests to rawdev selftest function
* some checkpatch and other small cleanups
* added extra documentation details on supported hardware
* aligned the changes to dpdk-devbind with the changes in the NTB set for consistency

Bruce Richardson (8):
raw/ioat: add initial support for ioat rawdev driver usertools/dpdk-devbind.py: add support for IOAT devices raw/ioat: add register definition file raw/ioat: create device on probe and destroy on release raw/ioat: add device info function
raw/ioat: add configure, start and stop functions raw/ioat: add statistics functions
raw/ioat: add local API to perform copies

 MAINTAINERS                                 |   6 +-
 app/test/test_rawdev.c                      |  19 ++
 config/common_armv8a_linux                  |   1 +
 config/common_base                          |   5 +
 config/defconfig_arm-armv7a-linuxapp-gcc    |   1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 +
 doc/guides/rawdevs/index.rst                |   1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 265 +++++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      |  11 +
 drivers/raw/Makefile                        |   1 +
 drivers/raw/ioat/Makefile                   |  31 ++
 drivers/raw/ioat/ioat_rawdev.c              | 313 ++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c         | 235 +++++++++++++++
 drivers/raw/ioat/meson.build                |  10 +
 drivers/raw/ioat/rte_ioat_rawdev.h          | 230 ++++++++++++++
 drivers/raw/ioat/rte_ioat_spec.h            | 301 +++++++++++++++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |   4 +
 drivers/raw/meson.build                     |   4 +-
 mk/rte.app.mk                               |   1 +
 usertools/dpdk-devbind.py                   |  10 +
 20 files changed, 1448 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
Signature · 1 line
2.21.0
#25 lore raw

PATCH v3 1/8 raw/ioat: add initial support for ioat rawdev driver

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---
V2: don't create a new file for unit testing, add to existing rawdev test
file, and place test cases in the driver selftest routine (added later in set)
Add new section in document about identifying hardware using lspci

---
 MAINTAINERS                                 |  6 +-
 app/test/test_rawdev.c                      |  8 ++
 config/common_armv8a_linux                  |  1 +
 config/common_base                          |  5 ++
 config/defconfig_arm-armv7a-linuxapp-gcc    |  1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |  1 +
 doc/guides/rawdevs/index.rst                |  1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 63 ++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      | 11 +++
 drivers/raw/Makefile                        |  1 +
 drivers/raw/ioat/Makefile                   | 28 +++++++
 drivers/raw/ioat/ioat_rawdev.c              | 93 +++++++++++++++++++++
 drivers/raw/ioat/meson.build                |  8 ++
 drivers/raw/ioat/rte_ioat_rawdev.h          | 24 ++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |  4 +
 drivers/raw/meson.build                     |  4 +-
 mk/rte.app.mk                               |  1 +
 17 files changed, 258 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
MAINTAINERS +5 -1
index 0c3b48920..f28c526bc 100644
@@ -1068,6 +1068,11 @@ M: Tianfei zhang <[email protected]>
 F: drivers/raw/ifpga_rawdev/
 F: doc/guides/rawdevs/ifpga_rawdev.rst
 
+IOAT Rawdev
+M: Bruce Richardson <[email protected]>
+F: drivers/raw/ioat/
+F: doc/guides/rawdevs/ioat_rawdev.rst
+
 NXP DPAA2 QDMA
 M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_qdma/
@@ -1078,7 +1083,6 @@ M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_cmdif/
 F: doc/guides/rawdevs/dpaa2_cmdif.rst
 
-
 Packet processing
 -----------------
 
app/test/test_rawdev.c +8 -0
index 043a38a13..88549fb61 100644
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
+
+static int
+test_rawdev_selftest_ioat(void)
+{
+	return TEST_SKIPPED;
+}
+
+REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
config/common_armv8a_linux +1 -0
index 72091de1c..481712ebc 100644
@@ -34,5 +34,6 @@ CONFIG_RTE_ARCH_ARM64_MEMCPY=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
 
 CONFIG_RTE_SCHED_VECTOR=n
config/common_base +5 -0
index fa1ae249a..e6b830923 100644
@@ -747,6 +747,11 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n
 #
 CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV=y
 
+#
+# Compile PMD for Intel IOAT raw device
+#
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y
+
 #
 # Compile librte_ring
 #
config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
index c9509b274..ee158ef9d 100644
@@ -54,3 +54,4 @@ CONFIG_RTE_LIBRTE_QEDE_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
 CONFIG_RTE_LIBRTE_NFP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
index 7e248b755..9f3670ec0 100644
@@ -56,3 +56,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
doc/guides/rawdevs/index.rst +1 -0
index 7c3bd9586..0a21989e4 100644
@@ -14,3 +14,4 @@ application through rawdev API.
     dpaa2_cmdif
     dpaa2_qdma
     ifpga_rawdev
+    ioat_rawdev
doc/guides/rawdevs/ioat_rawdev.rst new file +63 -0

63 lines not on this page · raw message

doc/guides/rel_notes/release_19_08.rst +11 -0
index 3da266705..720c13f8b 100644
@@ -1,6 +1,8 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright 2019 The DPDK contributors
 
+.. include:: <isonum.txt>
+
 DPDK Release 19.08
 ==================
 
@@ -99,6 +101,15 @@ New Features
   Updated ``librte_telemetry`` to fetch the global metrics from the
   ``librte_metrics`` library.
 
+* **Added Intel QuickData Technology PMD**
+
+  The PMD for Intel\ |reg|  QuickData Technology, part of
+  Intel\ |reg|  I/O Acceleration Technology `(Intel I/OAT)
+  <https://www.intel.com/content/www/us/en/wireless-network/accel-technology.html>`_,
+  allows data copies to be done by hardware instead
+  of via software, reducing cycles spent copying large blocks of data in
+  applications.
+
 
 Removed Items
 -------------
drivers/raw/Makefile +1 -0
index 8e29b4a56..c1b85c8c7 100644
@@ -10,5 +10,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma
 endif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga_rawdev
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/ioat/Makefile new file +28 -0
new file mode 100644
index 000000000..7726e310a
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_ioat_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+LDLIBS += -lrte_eal -lrte_rawdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_ioat_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+
+# export include files
+SYMLINK-y-include += rte_ioat_rawdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/ioat_rawdev.c new file +93 -0

93 lines not on this page · raw message

drivers/raw/ioat/meson.build new file +8 -0
new file mode 100644
index 000000000..ba7620a68
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Intel Corporation
+
+build = dpdk_conf.has('RTE_ARCH_X86')
+sources = files('ioat_rawdev.c')
+deps += ['rawdev', 'bus_pci']
+
+install_headers('rte_ioat_rawdev.h')
drivers/raw/ioat/rte_ioat_rawdev.h new file +24 -0
new file mode 100644
index 000000000..e77406403
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IOAT_RAWDEV_H_
+#define _RTE_IOAT_RAWDEV_H_
+
+/**
+ * @file rte_ioat_rawdev.h
+ *
+ * Definitions for using the ioat rawdev device driver
+ *
+ * @warning
+ * @b EXPERIMENTAL: these structures and APIs may change without prior notice
+ */
+
+/** Name of the device driver */
+#define IOAT_PMD_RAWDEV_NAME rawdev_ioat
+/** String reported as the device driver name by rte_rawdev_info_get() */
+#define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
+/** Name used to adjust the log level for this driver */
+#define IOAT_PMD_LOG_NAME "rawdev.ioat"
+
+#endif
drivers/raw/ioat/rte_pmd_ioat_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
drivers/raw/meson.build +3 -1
index a61cdccef..2af8a70d4 100644
@@ -1,7 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 NXP
 
-drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma', 'ifpga_rawdev']
+drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
+	'ifpga_rawdev', 'ioat',
+	'skeleton_rawdev']
 std_deps = ['rawdev']
 config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV'
 driver_name_fmt = 'rte_pmd_@0@'
mk/rte.app.mk +1 -0
index 81be289a8..2a534796f 100644
@@ -306,6 +306,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV)   += -lrte_pmd_ioat_rawdev
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
 endif # !CONFIG_RTE_BUILD_SHARED_LIBS
Signature · 1 line
2.21.0
Acked-by on v3 1/8
#26 lore raw

Re: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

Quoted 12 lines · Bruce Richardson

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---

<snip>

MAINTAINERS M: Nipun Gupta <[email protected]> · line 1086

Quoted 9 lines

NXP DPAA2 QDMA
M: Nipun Gupta <[email protected]>
F: drivers/raw/dpaa2_qdma/

MAINTAINERS +0 -1
@@ -1078,7 +1083,6 @@ M: Nipun Gupta <[email protected]>
  F: drivers/raw/dpaa2_cmdif/
  F: doc/guides/rawdevs/dpaa2_cmdif.rst
 
-
  Packet processing

Unnecessary whitespace change :)

Quoted 8 lines
MAINTAINERS +0 -0
  -----------------
 
app/test/test_rawdev.c +0 -0
index 043a38a13..88549fb61 100644
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)
  }

<snip>

doc/guides/rel_notes/release_19_08.rst line 5

Quoted 10 lines
doc/guides/rel_notes/release_19_08.rst +2 -0
index 3da266705..720c13f8b 100644
@@ -1,6 +1,8 @@
  ..  SPDX-License-Identifier: BSD-3-Clause
      Copyright 2019 The DPDK contributors
 
+.. include:: <isonum.txt>
+

Is this accidental? This doesn't look related to this patch.

Other than a couple of nitpicks, LGTM

Signature · 2 lines
Thanks,
Anatoly
#27 lore raw

Re: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

Quoted 16 lines · Anatoly
Quoted 12 lines · Bruce Richardson

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---

<snip>

Quoted 11 lines

MAINTAINERS M: Nipun Gupta <[email protected]> · line 1085

Quoted 8 lines

NXP DPAA2 QDMA
M: Nipun Gupta <[email protected]>
F: drivers/raw/dpaa2_qdma/

MAINTAINERS +0 -1
@@ -1078,7 +1083,6 @@ M: Nipun Gupta <[email protected]>
  F: drivers/raw/dpaa2_cmdif/
  F: doc/guides/rawdevs/dpaa2_cmdif.rst
-
  Packet processing

Unnecessary whitespace change :)

Thanks, good catch.

Quoted 10 lines
Quoted 7 lines
MAINTAINERS +0 -0
  -----------------
app/test/test_rawdev.c +0 -0
index 043a38a13..88549fb61 100644
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)
  }

<snip>

Quoted 12 lines

doc/guides/rel_notes/release_19_08.rst line 4

Quoted 9 lines
doc/guides/rel_notes/release_19_08.rst +2 -0
index 3da266705..720c13f8b 100644
@@ -1,6 +1,8 @@
  ..  SPDX-License-Identifier: BSD-3-Clause
      Copyright 2019 The DPDK contributors
+.. include:: <isonum.txt>
+

Is this accidental? This doesn't look related to this patch.

No, it's not accidental. It's the sphinx / rst include which allows the use of the actual symbols for (c) (R) etc. I make use of those symbols in the official product names in the following documentation. [It's a useful include that I think should always be put in our docs.]

#28 lore raw

Re: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

In reply to Bruce Richardson

Hi Bruce,

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 6:41 PM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---
V2: don't create a new file for unit testing, add to existing rawdev test
file, and place test cases in the driver selftest routine (added later in set)
Add new section in document about identifying hardware using lspci

---
 MAINTAINERS                                 |  6 +-
 app/test/test_rawdev.c                      |  8 ++
 config/common_armv8a_linux                  |  1 +
 config/common_base                          |  5 ++
 config/defconfig_arm-armv7a-linuxapp-gcc    |  1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |  1 +
 doc/guides/rawdevs/index.rst                |  1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 63 ++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      | 11 +++
 drivers/raw/Makefile                        |  1 +
 drivers/raw/ioat/Makefile                   | 28 +++++++
 drivers/raw/ioat/ioat_rawdev.c              | 93 +++++++++++++++++++++
 drivers/raw/ioat/meson.build                |  8 ++
 drivers/raw/ioat/rte_ioat_rawdev.h          | 24 ++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |  4 +
 drivers/raw/meson.build                     |  4 +-
 mk/rte.app.mk                               |  1 +
 17 files changed, 258 insertions(+), 2 deletions(-)  create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile  create mode 100644 drivers/raw/ioat/ioat_rawdev.c  create mode 100644 drivers/raw/ioat/meson.build  create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
MAINTAINERS +5 -1
index 0c3b48920..f28c526bc 100644
@@ -1068,6 +1068,11 @@ M: Tianfei zhang <[email protected]>
 F: drivers/raw/ifpga_rawdev/
 F: doc/guides/rawdevs/ifpga_rawdev.rst
 
+IOAT Rawdev
+M: Bruce Richardson <[email protected]>
+F: drivers/raw/ioat/
+F: doc/guides/rawdevs/ioat_rawdev.rst
+
 NXP DPAA2 QDMA
 M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_qdma/
@@ -1078,7 +1083,6 @@ M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_cmdif/
 F: doc/guides/rawdevs/dpaa2_cmdif.rst
 
-
 Packet processing
 -----------------
 
app/test/test_rawdev.c +8 -0
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
+
+static int
+test_rawdev_selftest_ioat(void)
+{
+	return TEST_SKIPPED;
+}
+
+REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
config/common_armv8a_linux +1 -0
@@ -34,5 +34,6 @@ CONFIG_RTE_ARCH_ARM64_MEMCPY=n  CONFIG_RTE_LIBRTE_FM10K_PMD=n  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n  CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
 
 CONFIG_RTE_SCHED_VECTOR=n
config/common_base +4 -0
@@ -747,6 +747,11 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n
 #
 CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV=y
 
+#
+# Compile PMD for Intel IOAT raw device # 
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y
+
 #
 # Compile librte_ring
 #
config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
index c9509b274..ee158ef9d 100644
@@ -54,3 +54,4 @@ CONFIG_RTE_LIBRTE_QEDE_PMD=n  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n  CONFIG_RTE_LIBRTE_AVP_PMD=n  CONFIG_RTE_LIBRTE_NFP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
index 7e248b755..9f3670ec0 100644
@@ -56,3 +56,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n  CONFIG_RTE_LIBRTE_FM10K_PMD=n  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n  CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
doc/guides/rawdevs/index.rst +1 -0
@@ -14,3 +14,4 @@ application through rawdev API.
     dpaa2_cmdif
     dpaa2_qdma
     ifpga_rawdev
+    ioat_rawdev
doc/guides/rawdevs/ioat_rawdev.rst new file +63 -0

63 lines not on this page · raw message

+ Registers (rev 04)
+ 00:04.6 System peripheral: Intel Corporation Sky Lake-E CBDMA
+ Registers (rev 04)
+ 00:04.7 System peripheral: Intel Corporation Sky Lake-E CBDMA
+ Registers (rev 04)
+
+
+Compilation
+------------
+
+For builds done with ``make``, the driver compilation is enabled by the +``CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV`` build configuration option. This +is enabled by default in builds for x86 platforms, and disabled in +other configurations.
+
+For builds using ``meson`` and ``ninja``, the driver will be built when +the target platform is x86-based.

doc/guides/rel_notes/release_19_08.rst +11 -0
index 3da266705..720c13f8b 100644
@@ -1,6 +1,8 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright 2019 The DPDK contributors
 
+.. include:: <isonum.txt>
+
 DPDK Release 19.08
 ==================
 
@@ -99,6 +101,15 @@ New Features
   Updated ``librte_telemetry`` to fetch the global metrics from the
   ``librte_metrics`` library.
 
+* **Added Intel QuickData Technology PMD**
+
+  The PMD for Intel\ |reg|  QuickData Technology, part of  Intel\ |reg|  
+ I/O Acceleration Technology `(Intel I/OAT)  
+ <https://www.intel.com/content/www/us/en/wireless-network/accel-techno
+ logy.html>`_,  allows data copies to be done by hardware instead  of 
+ via software, reducing cycles spent copying large blocks of data in  
+ applications.
+
 
 Removed Items
 -------------
drivers/raw/Makefile +1 -0
@@ -10,5 +10,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma  endif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga_rawdev
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/ioat/Makefile new file +28 -0
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel 
+Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_ioat_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+LDLIBS += -lrte_eal -lrte_rawdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_ioat_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+
+# export include files
+SYMLINK-y-include += rte_ioat_rawdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/ioat_rawdev.c new file +16 -0
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_bus_pci.h>
+#include <rte_rawdev_pmd.h>
+
+#include "rte_ioat_rawdev.h"
+
+/* Dynamic log type identifier */
+int ioat_pmd_logtype;
+
+static struct rte_pci_driver ioat_pmd_drv;
+
+#define IOAT_VENDOR_ID		0x8086
+#define IOAT_DEVICE_ID		0x2021

In the second patch, the script dpdk-devbind.py supports CBDMAs in both Broadwell and Skylake. But you only supports Skylake here.

Thanks,
Jiayu
+
+#define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
+ ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
+

+#define IOAT_PMD_DEBUG(fmt, args...)  IOAT_PMD_LOG(DEBUG, fmt, ## args)
+#define IOAT_PMD_INFO(fmt, args...)   IOAT_PMD_LOG(INFO, fmt, ## args)
+#define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
+#define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)

+
+static int
+ioat_rawdev_create(const char *name, struct rte_pci_device *dev) {
+ RTE_SET_USED(name);
+ RTE_SET_USED(dev);
+ return 0;
+}
+
+static int
+ioat_rawdev_destroy(const char *name)
+{
+ RTE_SET_USED(name);
+ return 0;
+}
+
+static int
+ioat_rawdev_probe(struct rte_pci_driver *drv, struct rte_pci_device +*dev) {
+ char name[32];
+ int ret = 0;
+
+
+ rte_pci_device_name(&dev->addr, name, sizeof(name));
+ IOAT_PMD_INFO("Init %s on NUMA node %d", name, dev->device.numa_node);
+
+ dev->device.driver = &drv->driver;
+ ret = ioat_rawdev_create(name, dev);
+ return ret;
+}
+
+static int
+ioat_rawdev_remove(struct rte_pci_device *dev) {
+ char name[32];
+ int ret;
+
+ rte_pci_device_name(&dev->addr, name, sizeof(name));
+
+ IOAT_PMD_INFO("Closing %s on NUMA node %d",
+ name, dev->device.numa_node);
+
+ ret = ioat_rawdev_destroy(name);
+ return ret;
+}
+
+static const struct rte_pci_id pci_id_ioat_map[] = {
+ { RTE_PCI_DEVICE(IOAT_VENDOR_ID, IOAT_DEVICE_ID) },
+ { .vendor_id = 0, /* sentinel */ },
+};
+
+static struct rte_pci_driver ioat_pmd_drv = {
+ .id_table = pci_id_ioat_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_IOVA_AS_VA,
+ .probe = ioat_rawdev_probe,
+ .remove = ioat_rawdev_remove,
+};
+
+RTE_PMD_REGISTER_PCI(IOAT_PMD_RAWDEV_NAME, ioat_pmd_drv); +RTE_PMD_REGISTER_PCI_TABLE(IOAT_PMD_RAWDEV_NAME, pci_id_ioat_map); +RTE_PMD_REGISTER_KMOD_DEP(IOAT_PMD_RAWDEV_NAME, "* igb_uio | +uio_pci_generic");
+
+RTE_INIT(ioat_pmd_init_log)
+{
+ ioat_pmd_logtype = rte_log_register(IOAT_PMD_LOG_NAME);
+ if (ioat_pmd_logtype >= 0)
+ rte_log_set_level(ioat_pmd_logtype, RTE_LOG_INFO); }

drivers/raw/ioat/meson.build new file +8 -0
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright 2019 Intel 
+Corporation
+
+build = dpdk_conf.has('RTE_ARCH_X86')
+sources = files('ioat_rawdev.c')
+deps += ['rawdev', 'bus_pci']
+
+install_headers('rte_ioat_rawdev.h')
drivers/raw/ioat/rte_ioat_rawdev.h new file +24 -0
new file mode 100644
index 000000000..e77406403
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IOAT_RAWDEV_H_
+#define _RTE_IOAT_RAWDEV_H_
+
+/**
+ * @file rte_ioat_rawdev.h
+ *
+ * Definitions for using the ioat rawdev device driver
+ *
+ * @warning
+ * @b EXPERIMENTAL: these structures and APIs may change without prior 
+notice  */
+
+/** Name of the device driver */
+#define IOAT_PMD_RAWDEV_NAME rawdev_ioat
+/** String reported as the device driver name by rte_rawdev_info_get() 
+*/ #define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
+/** Name used to adjust the log level for this driver */ #define 
+IOAT_PMD_LOG_NAME "rawdev.ioat"
+
+#endif
drivers/raw/ioat/rte_pmd_ioat_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
drivers/raw/meson.build +3 -1
@@ -1,7 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright 2018 NXP
 
-drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma', 'ifpga_rawdev']
+drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
+	'ifpga_rawdev', 'ioat',
+	'skeleton_rawdev']
 std_deps = ['rawdev']
 config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV'
 driver_name_fmt = 'rte_pmd_@0@'
mk/rte.app.mk +1 -0
@@ -306,6 +306,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV)   += -lrte_pmd_ioat_rawdev
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
 endif # !CONFIG_RTE_BUILD_SHARED_LIBS

--
2.21.0

#29 lore raw

Re: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

Hi Jiayu,

01/07/2019 09:38, Hu, Jiayu:
Hi Bruce,

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 6:41 PM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---
V2: don't create a new file for unit testing, add to existing rawdev test file, and place test cases in the driver selftest routine (added later in set)
Add new section in document about identifying hardware using lspci
---

MAINTAINERS                                 |  6 +-
app/test/test_rawdev.c                      |  8 ++
config/common_armv8a_linux                  |  1 +
config/common_base                          |  5 ++
config/defconfig_arm-armv7a-linuxapp-gcc    |  1 +
config/defconfig_ppc_64-power8-linuxapp-gcc |  1 +
doc/guides/rawdevs/index.rst                |  1 +
doc/guides/rawdevs/ioat_rawdev.rst          | 63 ++++++++++++++
doc/guides/rel_notes/release_19_08.rst      | 11 +++
drivers/raw/Makefile                        |  1 +
drivers/raw/ioat/Makefile                   | 28 +++++++
drivers/raw/ioat/ioat_rawdev.c              | 93 +++++++++++++++++++++
drivers/raw/ioat/meson.build                |  8 ++
drivers/raw/ioat/rte_ioat_rawdev.h          | 24 ++++++
drivers/raw/ioat/rte_pmd_ioat_version.map   |  4 +
drivers/raw/meson.build                     |  4 +-
mk/rte.app.mk                               |  1 +
17 files changed, 258 insertions(+), 2 deletions(-)  create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst

create mode 100644 drivers/raw/ioat/Makefile create mode 100644 drivers/raw/ioat/ioat_rawdev.c create mode 100644 drivers/raw/ioat/meson.build create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map

MAINTAINERS +0 -0
index 0c3b48920..f28c526bc 100644
@@ -1068,6 +1068,11 @@ M: Tianfei zhang <[email protected]>

F: drivers/raw/ifpga_rawdev/
F: doc/guides/rawdevs/ifpga_rawdev.rst

+IOAT Rawdev
+M: Bruce Richardson <[email protected]> +F: drivers/raw/ioat/
+F: doc/guides/rawdevs/ioat_rawdev.rst
+
NXP DPAA2 QDMA
M: Nipun Gupta <[email protected]>
F: drivers/raw/dpaa2_qdma/
@@ -1078,7 +1083,6 @@ M: Nipun Gupta <[email protected]>
F: drivers/raw/dpaa2_cmdif/
F: doc/guides/rawdevs/dpaa2_cmdif.rst

-
Packet processing
-----------------

app/test/test_rawdev.c +0 -0
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)

}

REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton); +
+static int
+test_rawdev_selftest_ioat(void)
+{
+ return TEST_SKIPPED;
+}
+
+REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);

config/common_armv8a_linux +1 -0
@@ -34,5 +34,6 @@ CONFIG_RTE_ARCH_ARM64_MEMCPY=n  CONFIG_RTE_LIBRTE_FM10K_PMD=n  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n  CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
  

CONFIG_RTE_SCHED_VECTOR=n

config/common_base +0 -0
@@ -747,6 +747,11 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n

#
CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV=y

+#
+# Compile PMD for Intel IOAT raw device #
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y
+
#
# Compile librte_ring
#

config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
index c9509b274..ee158ef9d 100644
@@ -54,3 +54,4 @@ CONFIG_RTE_LIBRTE_QEDE_PMD=n  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n  CONFIG_RTE_LIBRTE_AVP_PMD=n  CONFIG_RTE_LIBRTE_NFP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
index 7e248b755..9f3670ec0 100644
@@ -56,3 +56,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n  CONFIG_RTE_LIBRTE_FM10K_PMD=n  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n  CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
doc/guides/rawdevs/index.rst +0 -0
@@ -14,3 +14,4 @@ application through rawdev API.

dpaa2_cmdif
dpaa2_qdma
ifpga_rawdev
+ ioat_rawdev

doc/guides/rawdevs/ioat_rawdev.rst new file +63 -0

63 lines not on this page · raw message

+ Registers (rev 04)
+ 00:04.6 System peripheral: Intel Corporation Sky Lake-E CBDMA
+ Registers (rev 04)
+ 00:04.7 System peripheral: Intel Corporation Sky Lake-E CBDMA
+ Registers (rev 04)
+
+
+Compilation
+------------
+
+For builds done with ``make``, the driver compilation is enabled by the +``CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV`` build configuration option. This +is enabled by default in builds for x86 platforms, and disabled in +other configurations.
+
+For builds using ``meson`` and ``ninja``, the driver will be built when +the target platform is x86-based.

doc/guides/rel_notes/release_19_08.rst +0 -0
index 3da266705..720c13f8b 100644
@@ -1,6 +1,8 @@

.. SPDX-License-Identifier: BSD-3-Clause
Copyright 2019 The DPDK contributors

+.. include:: <isonum.txt>
+
DPDK Release 19.08
==================

@@ -99,6 +101,15 @@ New Features
Updated ``librte_telemetry`` to fetch the global metrics from the ``librte_metrics`` library.

+* **Added Intel QuickData Technology PMD**
+
+ The PMD for Intel\ |reg| QuickData Technology, part of Intel\ |reg|
+ I/O Acceleration Technology `(Intel I/OAT)
+ <https://www.intel.com/content/www/us/en/wireless-network/accel-techno
+ logy.html>`_, allows data copies to be done by hardware instead of
+ via software, reducing cycles spent copying large blocks of data in
+ applications.
+

Removed Items
-------------

drivers/raw/Makefile +0 -0
@@ -10,5 +10,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif

DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma endif DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga_rawdev +DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat

include $(RTE_SDK)/mk/rte.subdir.mk

drivers/raw/ioat/Makefile new file +28 -0
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019 Intel 
+Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_ioat_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+LDLIBS += -lrte_eal -lrte_rawdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_ioat_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+
+# export include files
+SYMLINK-y-include += rte_ioat_rawdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/ioat_rawdev.c new file +16 -0
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_bus_pci.h>
+#include <rte_rawdev_pmd.h>
+
+#include "rte_ioat_rawdev.h"
+
+/* Dynamic log type identifier */
+int ioat_pmd_logtype;
+
+static struct rte_pci_driver ioat_pmd_drv;
+
+#define IOAT_VENDOR_ID		0x8086
+#define IOAT_DEVICE_ID		0x2021

In the second patch, the script dpdk-devbind.py supports CBDMAs in both Broadwell and Skylake. But you only supports Skylake here.

Thanks,
Jiayu
+
+#define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
+ ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
+

+#define IOAT_PMD_DEBUG(fmt, args...)  IOAT_PMD_LOG(DEBUG, fmt, ## args)
+#define IOAT_PMD_INFO(fmt, args...)   IOAT_PMD_LOG(INFO, fmt, ## args)
+#define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
+#define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)

+
+static int
+ioat_rawdev_create(const char *name, struct rte_pci_device *dev) {
+ RTE_SET_USED(name);
+ RTE_SET_USED(dev);
+ return 0;
+}
+
+static int
+ioat_rawdev_destroy(const char *name)
+{
+ RTE_SET_USED(name);
+ return 0;
+}
+
+static int
+ioat_rawdev_probe(struct rte_pci_driver *drv, struct rte_pci_device +*dev) {
+ char name[32];
+ int ret = 0;
+
+
+ rte_pci_device_name(&dev->addr, name, sizeof(name));
+ IOAT_PMD_INFO("Init %s on NUMA node %d", name, dev->device.numa_node);
+
+ dev->device.driver = &drv->driver;
+ ret = ioat_rawdev_create(name, dev);
+ return ret;
+}
+
+static int
+ioat_rawdev_remove(struct rte_pci_device *dev) {
+ char name[32];
+ int ret;
+
+ rte_pci_device_name(&dev->addr, name, sizeof(name));
+
+ IOAT_PMD_INFO("Closing %s on NUMA node %d",
+ name, dev->device.numa_node);
+
+ ret = ioat_rawdev_destroy(name);
+ return ret;
+}
+
+static const struct rte_pci_id pci_id_ioat_map[] = {
+ { RTE_PCI_DEVICE(IOAT_VENDOR_ID, IOAT_DEVICE_ID) },
+ { .vendor_id = 0, /* sentinel */ },
+};
+
+static struct rte_pci_driver ioat_pmd_drv = {
+ .id_table = pci_id_ioat_map,
+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+ RTE_PCI_DRV_IOVA_AS_VA,
+ .probe = ioat_rawdev_probe,
+ .remove = ioat_rawdev_remove,
+};
+
+RTE_PMD_REGISTER_PCI(IOAT_PMD_RAWDEV_NAME, ioat_pmd_drv); +RTE_PMD_REGISTER_PCI_TABLE(IOAT_PMD_RAWDEV_NAME, pci_id_ioat_map); +RTE_PMD_REGISTER_KMOD_DEP(IOAT_PMD_RAWDEV_NAME, "* igb_uio | +uio_pci_generic");
+
+RTE_INIT(ioat_pmd_init_log)
+{
+ ioat_pmd_logtype = rte_log_register(IOAT_PMD_LOG_NAME);
+ if (ioat_pmd_logtype >= 0)
+ rte_log_set_level(ioat_pmd_logtype, RTE_LOG_INFO); }

drivers/raw/ioat/meson.build new file +8 -0
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause # Copyright 2019 Intel 
+Corporation
+
+build = dpdk_conf.has('RTE_ARCH_X86')
+sources = files('ioat_rawdev.c')
+deps += ['rawdev', 'bus_pci']
+
+install_headers('rte_ioat_rawdev.h')
drivers/raw/ioat/rte_ioat_rawdev.h new file +24 -0
new file mode 100644
index 000000000..e77406403
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IOAT_RAWDEV_H_
+#define _RTE_IOAT_RAWDEV_H_
+
+/**
+ * @file rte_ioat_rawdev.h
+ *
+ * Definitions for using the ioat rawdev device driver
+ *
+ * @warning
+ * @b EXPERIMENTAL: these structures and APIs may change without prior 
+notice  */
+
+/** Name of the device driver */
+#define IOAT_PMD_RAWDEV_NAME rawdev_ioat
+/** String reported as the device driver name by rte_rawdev_info_get() 
+*/ #define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
+/** Name used to adjust the log level for this driver */ #define 
+IOAT_PMD_LOG_NAME "rawdev.ioat"
+
+#endif
drivers/raw/ioat/rte_pmd_ioat_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
drivers/raw/meson.build +0 -0
@@ -1,7 +1,9 @@

# SPDX-License-Identifier: BSD-3-Clause # Copyright 2018 NXP

-drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma', 'ifpga_rawdev'] +drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
+ 'ifpga_rawdev', 'ioat',
+ 'skeleton_rawdev']
std_deps = ['rawdev']
config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV'
driver_name_fmt = 'rte_pmd_@0@'

mk/rte.app.mk +0 -0
@@ -306,6 +306,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)

_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += -lrte_pmd_ifpga_rawdev
_LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += -lrte_pmd_ipn3ke
endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += -lrte_pmd_ioat_rawdev
endif # CONFIG_RTE_LIBRTE_RAWDEV

endif # !CONFIG_RTE_BUILD_SHARED_LIBS
--
2.21.0

#30 lore raw

Re: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

In reply to Bruce Richardson

Sorry for the incorrect format in the last mail.
The comment is repeated below.

Quoted 333 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 6:41 PM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---
V2: don't create a new file for unit testing, add to existing rawdev test
file, and place test cases in the driver selftest routine (added later in set)
Add new section in document about identifying hardware using lspci

---
 MAINTAINERS                                 |  6 +-
 app/test/test_rawdev.c                      |  8 ++
 config/common_armv8a_linux                  |  1 +
 config/common_base                          |  5 ++
 config/defconfig_arm-armv7a-linuxapp-gcc    |  1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |  1 +
 doc/guides/rawdevs/index.rst                |  1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 63 ++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      | 11 +++
 drivers/raw/Makefile                        |  1 +
 drivers/raw/ioat/Makefile                   | 28 +++++++
 drivers/raw/ioat/ioat_rawdev.c              | 93 +++++++++++++++++++++
 drivers/raw/ioat/meson.build                |  8 ++
 drivers/raw/ioat/rte_ioat_rawdev.h          | 24 ++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |  4 +
 drivers/raw/meson.build                     |  4 +-
 mk/rte.app.mk                               |  1 +
 17 files changed, 258 insertions(+), 2 deletions(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
MAINTAINERS +5 -1
index 0c3b48920..f28c526bc 100644
@@ -1068,6 +1068,11 @@ M: Tianfei zhang <[email protected]>
 F: drivers/raw/ifpga_rawdev/
 F: doc/guides/rawdevs/ifpga_rawdev.rst
 
+IOAT Rawdev
+M: Bruce Richardson <[email protected]>
+F: drivers/raw/ioat/
+F: doc/guides/rawdevs/ioat_rawdev.rst
+
 NXP DPAA2 QDMA
 M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_qdma/
@@ -1078,7 +1083,6 @@ M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_cmdif/
 F: doc/guides/rawdevs/dpaa2_cmdif.rst
 
-
 Packet processing
 -----------------
 
app/test/test_rawdev.c +0 -0
index 043a38a13..88549fb61 100644
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest,

test_rawdev_selftest_skeleton);

app/test/test_rawdev.c +8 -0
+
+static int
+test_rawdev_selftest_ioat(void)
+{
+	return TEST_SKIPPED;
+}
+
+REGISTER_TEST_COMMAND(ioat_rawdev_autotest,

test_rawdev_selftest_ioat);

config/common_armv8a_linux +1 -0
index 72091de1c..481712ebc 100644
@@ -34,5 +34,6 @@ CONFIG_RTE_ARCH_ARM64_MEMCPY=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
 
 CONFIG_RTE_SCHED_VECTOR=n
config/common_base +0 -0
index fa1ae249a..e6b830923 100644
@@ -747,6 +747,11 @@

CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n
#
CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV=y

config/common_base +5 -0
+#
+# Compile PMD for Intel IOAT raw device
+#
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y
+
 #
 # Compile librte_ring
 #
config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
index c9509b274..ee158ef9d 100644
@@ -54,3 +54,4 @@ CONFIG_RTE_LIBRTE_QEDE_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
 CONFIG_RTE_LIBRTE_NFP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
index 7e248b755..9f3670ec0 100644
@@ -56,3 +56,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
doc/guides/rawdevs/index.rst +1 -0
index 7c3bd9586..0a21989e4 100644
@@ -14,3 +14,4 @@ application through rawdev API.
     dpaa2_cmdif
     dpaa2_qdma
     ifpga_rawdev
+    ioat_rawdev
doc/guides/rawdevs/ioat_rawdev.rst new file +7 -0
new file mode 100644
index 000000000..0c612e73a
@@ -0,0 +1,63 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2019 Intel Corporation.
+
+.. include:: <isonum.txt>
+
+IOAT Rawdev Driver for Intel\ |reg| QuickData Technology
+===============================================================

=======

doc/guides/rawdevs/ioat_rawdev.rst new file +5 -0
+
+The ``ioat`` rawdev driver provides a poll-mode driver (PMD) for Intel\ |reg|
+QuickData Technology, part of Intel\ |reg| I/O Acceleration Technology
+`(Intel I/OAT)
+<https://www.intel.com/content/www/us/en/wireless-network/accel-

technology.html>`_.
+This PMD, when used on supported hardware, allows data copies, for example,
+cloning packet data, to be accelerated by that hardware rather than having to

doc/guides/rawdevs/ioat_rawdev.rst new file +6 -0
+be done by software, freeing up CPU cycles for other tasks.
+
+Hardware Requirements
+----------------------
+
+On Linux, the presence of an Intel\ |reg| QuickData Technology hardware

can

doc/guides/rawdevs/ioat_rawdev.rst new file +3 -0
+be detected by checking the output of the ``lspci`` command, where the
+hardware will be often listed as "Crystal Beach DMA" or "CBDMA". For
+example, on a system with Intel\ |reg| Xeon\ |reg| CPU E5-2699 v4

@2.20GHz,

doc/guides/rawdevs/ioat_rawdev.rst new file +6 -0
+lspci shows:
+
+.. code-block:: console
+
+  # lspci | grep DMA
+  00:04.0 System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon

E3 v4/Xeon D Crystal Beach DMA Channel 0 (rev 01)
+ 00:04.1 System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 1 (rev 01)
+ 00:04.2 System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 2 (rev 01)
+ 00:04.3 System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 3 (rev 01)
+ 00:04.4 System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 4 (rev 01)
+ 00:04.5 System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 5 (rev 01)
+ 00:04.6 System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 6 (rev 01)
+ 00:04.7 System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Crystal Beach DMA Channel 7 (rev 01)

doc/guides/rawdevs/ioat_rawdev.rst new file +8 -0
+
+On a system with Intel\ |reg| Xeon\ |reg| Gold 6154 CPU @ 3.00GHz, lspci
+shows:
+
+.. code-block:: console
+
+  # lspci | grep DMA
+  00:04.0 System peripheral: Intel Corporation Sky Lake-E CBDMA Registers

(rev 04)
+ 00:04.1 System peripheral: Intel Corporation Sky Lake-E CBDMA Registers (rev 04)
+ 00:04.2 System peripheral: Intel Corporation Sky Lake-E CBDMA Registers (rev 04)
+ 00:04.3 System peripheral: Intel Corporation Sky Lake-E CBDMA Registers (rev 04)
+ 00:04.4 System peripheral: Intel Corporation Sky Lake-E CBDMA Registers (rev 04)
+ 00:04.5 System peripheral: Intel Corporation Sky Lake-E CBDMA Registers (rev 04)
+ 00:04.6 System peripheral: Intel Corporation Sky Lake-E CBDMA Registers (rev 04)
+ 00:04.7 System peripheral: Intel Corporation Sky Lake-E CBDMA Registers (rev 04)

doc/guides/rawdevs/ioat_rawdev.rst new file +7 -0
+
+
+Compilation
+------------
+
+For builds done with ``make``, the driver compilation is enabled by the
+``CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV`` build configuration option.

This is

doc/guides/rawdevs/ioat_rawdev.rst new file +5 -0
+enabled by default in builds for x86 platforms, and disabled in other
+configurations.
+
+For builds using ``meson`` and ``ninja``, the driver will be built when the
+target platform is x86-based.
doc/guides/rel_notes/release_19_08.rst +11 -0
index 3da266705..720c13f8b 100644
@@ -1,6 +1,8 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright 2019 The DPDK contributors
 
+.. include:: <isonum.txt>
+
 DPDK Release 19.08
 ==================
 
@@ -99,6 +101,15 @@ New Features
   Updated ``librte_telemetry`` to fetch the global metrics from the
   ``librte_metrics`` library.
 
+* **Added Intel QuickData Technology PMD**
+
+  The PMD for Intel\ |reg|  QuickData Technology, part of
+  Intel\ |reg|  I/O Acceleration Technology `(Intel I/OAT)
+  <https://www.intel.com/content/www/us/en/wireless-network/accel-
 technology.html>`_,
+  allows data copies to be done by hardware instead
+  of via software, reducing cycles spent copying large blocks of data in
+  applications.
+
 
 Removed Items

-------------

drivers/raw/Makefile +0 -0
index 8e29b4a56..c1b85c8c7 100644
@@ -10,5 +10,6 @@ DIRS-

$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif
DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) +=
dpaa2_qdma
endif
DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga_rawdev

drivers/raw/Makefile +1 -0
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/ioat/Makefile new file +28 -0
new file mode 100644
index 000000000..7726e310a
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_ioat_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+LDLIBS += -lrte_eal -lrte_rawdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_ioat_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+
+# export include files
+SYMLINK-y-include += rte_ioat_rawdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/ioat_rawdev.c new file +6 -0
new file mode 100644
index 000000000..d9fc3091a
@@ -0,0 +1,93 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include <rte_bus_pci.h>
+#include <rte_rawdev_pmd.h>

drivers/raw/ioat/ioat_rawdev.c line 16

Quoted 10 lines
drivers/raw/ioat/ioat_rawdev.c new file +10 -0
+
+#include "rte_ioat_rawdev.h"
+
+/* Dynamic log type identifier */
+int ioat_pmd_logtype;
+
+static struct rte_pci_driver ioat_pmd_drv;
+
+#define IOAT_VENDOR_ID		0x8086
+#define IOAT_DEVICE_ID		0x2021

In the second patch, the script dpdk-devbind.py supports CBDMAs in both Broadwell and Skylake. But you only supports Skylake here.

Thanks,
Jiayu

Quoted 171 lines
drivers/raw/ioat/ioat_rawdev.c new file +5 -0
+
+#define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
+	ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
+
+#define IOAT_PMD_DEBUG(fmt, args...)  IOAT_PMD_LOG(DEBUG, fmt, ##

args)

drivers/raw/ioat/ioat_rawdev.c new file +3 -0
+#define IOAT_PMD_INFO(fmt, args...)   IOAT_PMD_LOG(INFO, fmt, ## args)
+#define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
+#define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt,

## args)

drivers/raw/ioat/ioat_rawdev.c new file +25 -0
+
+static int
+ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
+{
+	RTE_SET_USED(name);
+	RTE_SET_USED(dev);
+	return 0;
+}
+
+static int
+ioat_rawdev_destroy(const char *name)
+{
+	RTE_SET_USED(name);
+	return 0;
+}
+
+static int
+ioat_rawdev_probe(struct rte_pci_driver *drv, struct rte_pci_device *dev)
+{
+	char name[32];
+	int ret = 0;
+
+
+	rte_pci_device_name(&dev->addr, name, sizeof(name));
+	IOAT_PMD_INFO("Init %s on NUMA node %d", name, dev-
Quoted 1 line

device.numa_node);

drivers/raw/ioat/ioat_rawdev.c new file +29 -0
+
+	dev->device.driver = &drv->driver;
+	ret = ioat_rawdev_create(name, dev);
+	return ret;
+}
+
+static int
+ioat_rawdev_remove(struct rte_pci_device *dev)
+{
+	char name[32];
+	int ret;
+
+	rte_pci_device_name(&dev->addr, name, sizeof(name));
+
+	IOAT_PMD_INFO("Closing %s on NUMA node %d",
+			name, dev->device.numa_node);
+
+	ret = ioat_rawdev_destroy(name);
+	return ret;
+}
+
+static const struct rte_pci_id pci_id_ioat_map[] = {
+	{ RTE_PCI_DEVICE(IOAT_VENDOR_ID, IOAT_DEVICE_ID) },
+	{ .vendor_id = 0, /* sentinel */ },
+};
+
+static struct rte_pci_driver ioat_pmd_drv = {
+	.id_table = pci_id_ioat_map,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING |

RTE_PCI_DRV_INTR_LSC |

drivers/raw/ioat/ioat_rawdev.c new file +7 -0
+		     RTE_PCI_DRV_IOVA_AS_VA,
+	.probe = ioat_rawdev_probe,
+	.remove = ioat_rawdev_remove,
+};
+
+RTE_PMD_REGISTER_PCI(IOAT_PMD_RAWDEV_NAME, ioat_pmd_drv);
+RTE_PMD_REGISTER_PCI_TABLE(IOAT_PMD_RAWDEV_NAME,

pci_id_ioat_map); +RTE_PMD_REGISTER_KMOD_DEP(IOAT_PMD_RAWDEV_NAME, "* igb_uio | uio_pci_generic");

drivers/raw/ioat/ioat_rawdev.c new file +7 -0
+
+RTE_INIT(ioat_pmd_init_log)
+{
+	ioat_pmd_logtype = rte_log_register(IOAT_PMD_LOG_NAME);
+	if (ioat_pmd_logtype >= 0)
+		rte_log_set_level(ioat_pmd_logtype, RTE_LOG_INFO);
+}
drivers/raw/ioat/meson.build new file +8 -0
new file mode 100644
index 000000000..ba7620a68
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Intel Corporation
+
+build = dpdk_conf.has('RTE_ARCH_X86')
+sources = files('ioat_rawdev.c')
+deps += ['rawdev', 'bus_pci']
+
+install_headers('rte_ioat_rawdev.h')
drivers/raw/ioat/rte_ioat_rawdev.h new file +14 -0
new file mode 100644
index 000000000..e77406403
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IOAT_RAWDEV_H_
+#define _RTE_IOAT_RAWDEV_H_
+
+/**
+ * @file rte_ioat_rawdev.h
+ *
+ * Definitions for using the ioat rawdev device driver
+ *
+ * @warning
+ * @b EXPERIMENTAL: these structures and APIs may change without prior

notice
+ */

drivers/raw/ioat/rte_ioat_rawdev.h new file +9 -0
+
+/** Name of the device driver */
+#define IOAT_PMD_RAWDEV_NAME rawdev_ioat
+/** String reported as the device driver name by rte_rawdev_info_get() */
+#define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
+/** Name used to adjust the log level for this driver */
+#define IOAT_PMD_LOG_NAME "rawdev.ioat"
+
+#endif
drivers/raw/ioat/rte_pmd_ioat_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
drivers/raw/meson.build +3 -1
index a61cdccef..2af8a70d4 100644
@@ -1,7 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 NXP
 
-drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma', 'ifpga_rawdev']
+drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
+	'ifpga_rawdev', 'ioat',
+	'skeleton_rawdev']
 std_deps = ['rawdev']
 config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV'
 driver_name_fmt = 'rte_pmd_@0@'
mk/rte.app.mk +0 -0
index 81be289a8..2a534796f 100644
@@ -306,6 +306,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -

lrte_pmd_ifpga_rawdev
_LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD) += -lrte_pmd_ipn3ke
endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += -
lrte_pmd_ioat_rawdev
endif # CONFIG_RTE_LIBRTE_RAWDEV

endif # !CONFIG_RTE_BUILD_SHARED_LIBS
--
2.21.0

#31 lore raw

Re: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

Quoted 24 lines · Jiayu

Sorry for the incorrect format in the last mail.
The comment is repeated below.

Quoted 21 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 6:41 PM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH v3 1/8] raw/ioat: add initial support for ioat rawdev driver

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---

<snip>

Quoted 9 lines

+

drivers/raw/ioat/ioat_rawdev.c line 16

Quoted 4 lines
drivers/raw/ioat/ioat_rawdev.c new file +4 -0
+static struct rte_pci_driver ioat_pmd_drv;
+
+#define IOAT_VENDOR_ID		0x8086
+#define IOAT_DEVICE_ID		0x2021

In the second patch, the script dpdk-devbind.py supports CBDMAs in both Broadwell and Skylake. But you only supports Skylake here.

Will fix in v4, thanks.

/Bruce

#32 lore raw

PATCH v3 2/8 usertools/dpdk-devbind.py: add support for IOAT devices

In reply to Bruce Richardson

In order to allow binding/unbinding of devices for use by the ioat_rawdev, we need to update the devbind script to add a new class of device, and add device ids for the specific HW instances.

---

V2: rather than adding a DMA section, add to "misc (rawdev)" section where
other device types, e.g. ntb can also do.

NOTE: this set largely overlaps with the equivalent changes made by the patchset adding NTB support [1]. Since it's unclear which set will be added first, this set is based off the latest head.

[1] http://patches.dpdk.org/patch/55127/

---
 doc/guides/rawdevs/ioat_rawdev.rst | 11 +++++++++++
 usertools/dpdk-devbind.py          | 10 ++++++++++
 2 files changed, 21 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 0c612e73a..1a4b0e03e 100644
@@ -61,3 +61,14 @@ configurations.
 
 For builds using ``meson`` and ``ninja``, the driver will be built when the
 target platform is x86-based.
+
+Device Setup
+-------------
+
+The Intel\ |reg| QuickData Technology HW devices will need to be bound to a
+user-space IO driver for use. The script ``dpdk-devbind.py`` script
+included with DPDK can be used to view the state of the devices and to bind
+them to a suitable DPDK-supported kernel driver. When querying the status
+of the devices, they will appear under the category of "Misc (rawdev)
+devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
+used to see the state of those devices alone.
usertools/dpdk-devbind.py +10 -0
index 9e79f0d28..5c1cd3548 100755
@@ -36,11 +36,17 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
+intel_ioat_bdw = {'Class': '08', 'Vendor': '8086', 'Device': '6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
+              'SVendor': None, 'SDevice': None}
+intel_ioat_skx = {'Class': '08', 'Vendor': '8086', 'Device': '2021',
+              'SVendor': None, 'SDevice': None}
+
 network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
+misc_devices = [intel_ioat_bdw, intel_ioat_skx]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -595,6 +601,8 @@ def show_status():
     if status_dev == "compress" or status_dev == "all":
         show_device_status(compress_devices , "Compress")
 
+    if status_dev == "misc" or status_dev == "all":
+        show_device_status(misc_devices, "Misc (rawdev)")
 
 def parse_args():
     '''Parses the command-line arguments given by the user and takes the
@@ -670,6 +678,7 @@ def do_arg_actions():
             get_device_details(eventdev_devices)
             get_device_details(mempool_devices)
             get_device_details(compress_devices)
+            get_device_details(misc_devices)
         show_status()
 
 
@@ -690,6 +699,7 @@ def main():
     get_device_details(eventdev_devices)
     get_device_details(mempool_devices)
     get_device_details(compress_devices)
+    get_device_details(misc_devices)
     do_arg_actions()
 
 if __name__ == "__main__":
Signature · 1 line
2.21.0
Acked-by on v3 2/8
#33 lore raw

Re: [dpdk-dev] [PATCH v3 2/8] usertools/dpdk-devbind.py: add support for IOAT devices

Quoted 7 lines · Bruce Richardson

In order to allow binding/unbinding of devices for use by the ioat_rawdev, we need to update the devbind script to add a new class of device, and add device ids for the specific HW instances.

---

Signature · 2 lines
Thanks,
Anatoly
#34 lore raw

PATCH v3 3/8 raw/ioat: add register definition file

In reply to Bruce Richardson

Add in the list of registers for the device. File is taken from the SPDK project:

https://github.com/spdk/spdk/blob/master/include/spdk/ioat_spec.h

---
 drivers/raw/ioat/Makefile        |   1 +
 drivers/raw/ioat/meson.build     |   3 +-
 drivers/raw/ioat/rte_ioat_spec.h | 301 +++++++++++++++++++++++++++++++
 3 files changed, 304 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
drivers/raw/ioat/Makefile +1 -0
index 7726e310a..1e10938f3 100644
@@ -24,5 +24,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
+SYMLINK-y-include += rte_ioat_spec.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/meson.build +2 -1
index ba7620a68..ca23e23fc 100644
@@ -5,4 +5,5 @@ build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c')
 deps += ['rawdev', 'bus_pci']
 
-install_headers('rte_ioat_rawdev.h')
+install_headers('rte_ioat_rawdev.h',
+		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_spec.h new file +301 -0

301 lines not on this page · raw message

Signature · 1 line
2.21.0
Acked-by on v3 3/8
#35 lore raw

Re: [dpdk-dev] [PATCH v3 3/8] raw/ioat: add register definition file

Quoted 7 lines · Bruce Richardson

Add in the list of registers for the device. File is taken from the SPDK project:

https://github.com/spdk/spdk/blob/master/include/spdk/ioat_spec.h

---

The indentation is slightly inconsistent across the file, but LGTM

Signature · 2 lines
Thanks,
Anatoly
#36 lore raw

Re: [dpdk-dev] [PATCH v3 3/8] raw/ioat: add register definition file

Quoted 4 lines · Anatoly
Quoted 3 lines · Bruce Richardson

Add in the list of registers for the device. File is taken from the SPDK project:

Quoted 9 lines
Quoted 4 lines

https://github.com/spdk/spdk/blob/master/include/spdk/ioat_spec.h

---

The indentation is slightly inconsistent across the file, but LGTM

I've tried to keep the delta to the original file to a minimum, so didn't look at whitespace. I think it's ok as-is.

#37 lore raw

PATCH v3 4/8 raw/ioat: create device on probe and destroy on release

In reply to Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---
 doc/guides/rawdevs/ioat_rawdev.rst | 11 ++++
 drivers/raw/ioat/ioat_rawdev.c     | 93 +++++++++++++++++++++++++++++-
 drivers/raw/ioat/rte_ioat_rawdev.h | 20 +++++++
 3 files changed, 121 insertions(+), 3 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 1a4b0e03e..4b7fe8a8f 100644
@@ -72,3 +72,14 @@ them to a suitable DPDK-supported kernel driver. When querying the status
 of the devices, they will appear under the category of "Misc (rawdev)
 devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
 used to see the state of those devices alone.
+
+Device Probing and Initialization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Once bound to a suitable kernel device driver, the HW devices will be found
+as part of the PCI scan done at application initialization time. No vdev
+parameters need to be passed to create or initialize the device.
+
+Once probed successfully, the device will appear as a ``rawdev``, that is a
+"raw device type" inside DPDK, and can be accessed using APIs from the
+``rte_rawdev`` library.
drivers/raw/ioat/ioat_rawdev.c +90 -3

111 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +20 -0
index e77406403..c3216a174 100644
@@ -14,6 +14,9 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <rte_memory.h>
+#include <rte_ioat_spec.h>
+
 /** Name of the device driver */
 #define IOAT_PMD_RAWDEV_NAME rawdev_ioat
 /** String reported as the device driver name by rte_rawdev_info_get() */
@@ -21,4 +24,21 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * @internal
+ * Structure representing a device instance
+ */
+struct rte_ioat_rawdev {
+	struct rte_rawdev *rawdev;
+	volatile struct rte_ioat_registers *regs;
+	phys_addr_t status_addr;
+	phys_addr_t ring_addr;
+
+	unsigned short ring_size;
+	struct rte_ioat_desc *desc_ring;
+
+	/* to report completions, the device will write status back here */
+	volatile uint64_t status __rte_cache_aligned;
+};
+
 #endif
Signature · 1 line
2.21.0
#38 lore raw

Re: [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release

Quoted 6 lines · Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---

<snip>

Quoted 7 lines
  ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
  {
drivers/raw/ioat/ioat_rawdev.c +3 -2
-	RTE_SET_USED(name);
-	RTE_SET_USED(dev);
+	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+	};
+

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 42

Quoted 10 lines
drivers/raw/ioat/ioat_rawdev.c +10 -0
+	struct rte_rawdev *rawdev = NULL;
+	struct rte_ioat_rawdev *ioat = NULL;
+	int ret = 0;
+	int retry = 0;
+
+	if (!name) {
+		IOAT_PMD_ERR("Invalid name of the device!");
+		ret = -EINVAL;
+		goto cleanup;
+	}

Is checking dev not necessary here?

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 50

Quoted 8 lines
drivers/raw/ioat/ioat_rawdev.c +8 -0
+
+	/* Allocate device structure */
+	rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct rte_ioat_rawdev),
+					 dev->device.numa_node);
+	if (rawdev == NULL) {
+		IOAT_PMD_ERR("Unable to allocate raw device");
+		ret = -EINVAL;
+		goto cleanup;

EINVAL is supposed to be used to indicate invalid arguments. Inability to allocate is not an "invalid arguments" condition. Does rte_rawdev_pmd_allocate() set its own errno value? If so, perhaps it would be worth passing it on? If not, perhaps -ENOMEM would be a better return value?

Signature · 2 lines
Thanks,
Anatoly
#39 lore raw

Re: [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release

Quoted 21 lines · Anatoly
Quoted 6 lines · Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---

<snip>

Quoted 11 lines
  ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
  {
drivers/raw/ioat/ioat_rawdev.c +7 -2
-	RTE_SET_USED(name);
-	RTE_SET_USED(dev);
+	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+	};
+
+	struct rte_rawdev *rawdev = NULL;
+	struct rte_ioat_rawdev *ioat = NULL;
+	int ret = 0;
+	int retry = 0;
Quoted 9 lines

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 42

Quoted 6 lines
drivers/raw/ioat/ioat_rawdev.c +6 -0
+
+	if (!name) {
+		IOAT_PMD_ERR("Invalid name of the device!");
+		ret = -EINVAL;
+		goto cleanup;
+	}

Is checking dev not necessary here?

No, the only place it's called from is already using the PCI device structure. I don't think the probe function can ever be called with a NULL parameter.

Quoted 6 lines
Quoted 6 lines
drivers/raw/ioat/ioat_rawdev.c +6 -0
+
+	/* Allocate device structure */
+	rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct rte_ioat_rawdev),
+					 dev->device.numa_node);
+	if (rawdev == NULL) {
+		IOAT_PMD_ERR("Unable to allocate raw device");
Quoted 9 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+		ret = -EINVAL;
+		goto cleanup;

EINVAL is supposed to be used to indicate invalid arguments. Inability to allocate is not an "invalid arguments" condition. Does rte_rawdev_pmd_allocate() set its own errno value? If so, perhaps it would be worth passing it on? If not, perhaps -ENOMEM would be a better return value?

Fixing in v4.

#40 lore raw

Re: [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release

In reply to Bruce Richardson
Quoted 6 lines · Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---

<snip>

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 63

Quoted 9 lines
drivers/raw/ioat/ioat_rawdev.c +9 -0
+	rawdev->driver_name = dev->device.driver->name;
+
+	ioat = rawdev->dev_private;
+	ioat->rawdev = rawdev;
+	ioat->regs = dev->mem_resource[0].addr;
+	ioat->ring_size = 0;
+	ioat->desc_ring = NULL;
+	ioat->status_addr = rte_malloc_virt2iova(ioat) +
+			offsetof(struct rte_ioat_rawdev, status);

While reviewing other patch, i remembered that i've seen this here. You can't make any guarantees about IOVA addresses in rte_malloc-allocated memory. Are you sure you don't require IOVA-contiguous memory here?

Signature · 2 lines
Thanks,
Anatoly
#41 lore raw

Re: [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release

Quoted 10 lines · Anatoly
Quoted 6 lines · Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---

<snip>

Quoted 14 lines

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 63

Quoted 9 lines
drivers/raw/ioat/ioat_rawdev.c +9 -0
+	rawdev->driver_name = dev->device.driver->name;
+
+	ioat = rawdev->dev_private;
+	ioat->rawdev = rawdev;
+	ioat->regs = dev->mem_resource[0].addr;
+	ioat->ring_size = 0;
+	ioat->desc_ring = NULL;
+	ioat->status_addr = rte_malloc_virt2iova(ioat) +
+			offsetof(struct rte_ioat_rawdev, status);

While reviewing other patch, i remembered that i've seen this here. You can't make any guarantees about IOVA addresses in rte_malloc-allocated memory. Are you sure you don't require IOVA-contiguous memory here?

Presumably we can guarantee that for structures less than 1 page in size, this will work? I believe the device structure should be within that page limit.

#42 lore raw

Re: [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release

Quoted 25 lines · Bruce Richardson
Quoted 10 lines · Anatoly
Quoted 6 lines · Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---

<snip>

Quoted 14 lines

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 63

Quoted 9 lines
drivers/raw/ioat/ioat_rawdev.c +9 -0
+	rawdev->driver_name = dev->device.driver->name;
+
+	ioat = rawdev->dev_private;
+	ioat->rawdev = rawdev;
+	ioat->regs = dev->mem_resource[0].addr;
+	ioat->ring_size = 0;
+	ioat->desc_ring = NULL;
+	ioat->status_addr = rte_malloc_virt2iova(ioat) +
+			offsetof(struct rte_ioat_rawdev, status);

While reviewing other patch, i remembered that i've seen this here. You can't make any guarantees about IOVA addresses in rte_malloc-allocated memory. Are you sure you don't require IOVA-contiguous memory here?

Quoted 4 lines

Presumably we can guarantee that for structures less than 1 page in size, this will work? I believe the device structure should be within that page limit.

No, we can't. That would only be true if you were allocating IOVA-contiguous memory. Otherwise there's nothing stopping the allocator to allocate even a few kilobytes across page boundary.

You can only ever guarantee that *one cache line* will not cross the page boundary with rte_malloc. With rte_memzone and IOVA_CONTIG flag, you'll be able to guarantee IOVA-contiguousness in all cases (or allocation failure).

Signature · 2 lines
Thanks,
Anatoly
#43 lore raw

Re: [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release

Quoted 31 lines · Anatoly
Quoted 25 lines · Bruce Richardson
Quoted 10 lines · Anatoly
Quoted 6 lines · Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---

<snip>

Quoted 14 lines

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 63

Quoted 9 lines
drivers/raw/ioat/ioat_rawdev.c +9 -0
+	rawdev->driver_name = dev->device.driver->name;
+
+	ioat = rawdev->dev_private;
+	ioat->rawdev = rawdev;
+	ioat->regs = dev->mem_resource[0].addr;
+	ioat->ring_size = 0;
+	ioat->desc_ring = NULL;
+	ioat->status_addr = rte_malloc_virt2iova(ioat) +
+			offsetof(struct rte_ioat_rawdev, status);

While reviewing other patch, i remembered that i've seen this here. You can't make any guarantees about IOVA addresses in rte_malloc-allocated memory. Are you sure you don't require IOVA-contiguous memory here?

Quoted 4 lines

Presumably we can guarantee that for structures less than 1 page in size, this will work? I believe the device structure should be within that page limit.

Quoted 8 lines

No, we can't. That would only be true if you were allocating IOVA-contiguous memory. Otherwise there's nothing stopping the allocator to allocate even a few kilobytes across page boundary.

You can only ever guarantee that *one cache line* will not cross the page boundary with rte_malloc. With rte_memzone and IOVA_CONTIG flag, you'll be able to guarantee IOVA-contiguousness in all cases (or allocation failure).

Ok, so I either need to move this field to the start of the structure, i.e. have offset zero, or else use contiguous allocation. Will fix in next version.

/Bruce

#44 lore raw

Re: [dpdk-dev] [PATCH v3 4/8] raw/ioat: create device on probe and destroy on release

Quoted 40 lines · Bruce Richardson
Quoted 31 lines · Anatoly
Quoted 25 lines · Bruce Richardson
Quoted 10 lines · Anatoly
Quoted 6 lines · Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---

<snip>

Quoted 14 lines

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 63

Quoted 9 lines
drivers/raw/ioat/ioat_rawdev.c +9 -0
+	rawdev->driver_name = dev->device.driver->name;
+
+	ioat = rawdev->dev_private;
+	ioat->rawdev = rawdev;
+	ioat->regs = dev->mem_resource[0].addr;
+	ioat->ring_size = 0;
+	ioat->desc_ring = NULL;
+	ioat->status_addr = rte_malloc_virt2iova(ioat) +
+			offsetof(struct rte_ioat_rawdev, status);

While reviewing other patch, i remembered that i've seen this here. You can't make any guarantees about IOVA addresses in rte_malloc-allocated memory. Are you sure you don't require IOVA-contiguous memory here?

Quoted 4 lines

Presumably we can guarantee that for structures less than 1 page in size, this will work? I believe the device structure should be within that page limit.

Quoted 8 lines

No, we can't. That would only be true if you were allocating IOVA-contiguous memory. Otherwise there's nothing stopping the allocator to allocate even a few kilobytes across page boundary.

You can only ever guarantee that *one cache line* will not cross the page boundary with rte_malloc. With rte_memzone and IOVA_CONTIG flag, you'll be able to guarantee IOVA-contiguousness in all cases (or allocation failure).

Quoted 6 lines

Ok, so I either need to move this field to the start of the structure, i.e. have offset zero, or else use contiguous allocation. Will fix in next version.

/Bruce

The latter is probably more explicit in intention, i'd rather the code not rely on details of rte_malloc implementation :)

Signature · 2 lines
Thanks,
Anatoly
#45 lore raw

PATCH v3 5/8 raw/ioat: add device info function

In reply to Bruce Richardson

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---

V2: Test case is placed in driver self-test routine

---
 app/test/test_rawdev.c             | 11 ++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
 4 files changed, 67 insertions(+)
app/test/test_rawdev.c +11 -0
index 88549fb61..4db762b4c 100644
@@ -29,6 +29,17 @@ REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
 static int
 test_rawdev_selftest_ioat(void)
 {
+	const int count = rte_rawdev_count();
+	int i;
+
+	for (i = 0; i < count; i++) {
+		struct rte_rawdev_info info = { .dev_private = NULL };
+		if (rte_rawdev_info_get(i, &info) == 0 &&
+				strstr(info.driver_name, "ioat") != NULL)
+			return 0;
+	}
+
+	printf("No IOAT rawdev found, skipping tests\n");
 	return TEST_SKIPPED;
 }
 
doc/guides/rawdevs/ioat_rawdev.rst +34 -0
index 4b7fe8a8f..0ce984490 100644
@@ -83,3 +83,37 @@ parameters need to be passed to create or initialize the device.
 Once probed successfully, the device will appear as a ``rawdev``, that is a
 "raw device type" inside DPDK, and can be accessed using APIs from the
 ``rte_rawdev`` library.
+
+Using IOAT Rawdev Devices
+--------------------------
+
+To use the devices from an application, the rawdev API can be used, along
+with definitions taken from the device-specific header file
+``rte_ioat_rawdev.h``. This header is needed to get the definition of
+structure parameters used by some of the rawdev APIs for IOAT rawdev
+devices, as well as providing key functions for using the device for memory
+copies.
+
+Getting Device Information
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic information about each rawdev device can be got using the
+``rte_rawdev_info_get()`` API. For most applications, this API will be
+needed to verify that the rawdev in question is of the expected type. For
+example, the following code in ``test_ioat_rawdev.c`` is used to identify
+the IOAT rawdev device for use for the tests:
+
+.. code-block:: C
+
+        for (i = 0; i < count && !found; i++) {
+                struct rte_rawdev_info info = { .dev_private = NULL };
+                found = (rte_rawdev_info_get(i, &info) == 0 &&
+                                strcmp(info.driver_name,
+                                                IOAT_PMD_RAWDEV_NAME_STR) == 0);
+        }
+
+When calling the ``rte_rawdev_info_get()`` API for an IOAT rawdev device,
+the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
+be NULL, or else be set to point to a structure of type
+``rte_ioat_rawdev_config``, in which case the size of the configured device
+input ring will be returned in that structure.
drivers/raw/ioat/ioat_rawdev.c +11 -0
index d13391dd5..08e7586c6 100644
@@ -24,10 +24,21 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+static void
+ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (cfg != NULL)
+		cfg->ring_size = ioat->ring_size;
+}
+
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_info_get = ioat_dev_info_get,
 	};
 
 	struct rte_rawdev *rawdev = NULL;
drivers/raw/ioat/rte_ioat_rawdev.h +11 -0
index c3216a174..7e0d72ca3 100644
@@ -24,6 +24,17 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * Configuration structure for an ioat rawdev instance
+ *
+ * This structure is to be passed as the ".dev_private" parameter when
+ * calling the rte_rawdev_get_info() and rte_rawdev_configure() APIs on
+ * an ioat rawdev instance.
+ */
+struct rte_ioat_rawdev_config {
+	unsigned short ring_size;
+};
+
 /**
  * @internal
  * Structure representing a device instance
Signature · 1 line
2.21.0
#46 lore raw

Re: [dpdk-dev] [PATCH v3 5/8] raw/ioat: add device info function

Quoted 22 lines · Bruce Richardson

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---

V2: Test case is placed in driver self-test routine

---
  app/test/test_rawdev.c             | 11 ++++++++++
  doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++
  drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
  drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
  4 files changed, 67 insertions(+)
app/test/test_rawdev.c +0 -0
index 88549fb61..4db762b4c 100644
@@ -29,6 +29,17 @@ REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
  static int

app/test/test_rawdev.c REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton); · line 39

Quoted 10 lines
app/test/test_rawdev.c +8 -0
  test_rawdev_selftest_ioat(void)
  {
+	const int count = rte_rawdev_count();
+	int i;
+
+	for (i = 0; i < count; i++) {
+		struct rte_rawdev_info info = { .dev_private = NULL };
+		if (rte_rawdev_info_get(i, &info) == 0 &&
+				strstr(info.driver_name, "ioat") != NULL)
+			return 0;

TEST_SUCCESS? Also, didn't "ioat" have a macro for its name?

Quoted 19 lines
app/test/test_rawdev.c +3 -0
+	}
+
+	printf("No IOAT rawdev found, skipping tests\n");
  	return TEST_SKIPPED;
  }
 
doc/guides/rawdevs/ioat_rawdev.rst +5 -0
index 4b7fe8a8f..0ce984490 100644
@@ -83,3 +83,37 @@ parameters need to be passed to create or initialize the device.
  Once probed successfully, the device will appear as a ``rawdev``, that is a
  "raw device type" inside DPDK, and can be accessed using APIs from the
  ``rte_rawdev`` library.
+
+Using IOAT Rawdev Devices
+--------------------------
+
+To use the devices from an application, the rawdev API can be used, along

doc/guides/rawdevs/ioat_rawdev.rst parameters need to be passed to create or initialize the device. · line 100

Quoted 10 lines
doc/guides/rawdevs/ioat_rawdev.rst +10 -0
+with definitions taken from the device-specific header file
+``rte_ioat_rawdev.h``. This header is needed to get the definition of
+structure parameters used by some of the rawdev APIs for IOAT rawdev
+devices, as well as providing key functions for using the device for memory
+copies.
+
+Getting Device Information
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic information about each rawdev device can be got using the

According to certain unreliable sources [1], usage of "can be got" has not been used since the end of 19th century. I didn't think you were *that* old, Bruce!

doc/guides/rawdevs/ioat_rawdev.rst parameters need to be passed to create or initialize the device. · line 113

Quoted 13 lines
doc/guides/rawdevs/ioat_rawdev.rst +13 -0
+``rte_rawdev_info_get()`` API. For most applications, this API will be
+needed to verify that the rawdev in question is of the expected type. For
+example, the following code in ``test_ioat_rawdev.c`` is used to identify
+the IOAT rawdev device for use for the tests:
+
+.. code-block:: C
+
+        for (i = 0; i < count && !found; i++) {
+                struct rte_rawdev_info info = { .dev_private = NULL };
+                found = (rte_rawdev_info_get(i, &info) == 0 &&
+                                strcmp(info.driver_name,
+                                                IOAT_PMD_RAWDEV_NAME_STR) == 0);
+        }

The code here doesn't match the actual implementation in the autotest.

Signature · 2 lines
Thanks,
Anatoly
#47 lore raw

Re: [dpdk-dev] [PATCH v3 5/8] raw/ioat: add device info function

Quoted 27 lines · Anatoly
Quoted 26 lines · Bruce Richardson

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---

V2: Test case is placed in driver self-test routine

---
  app/test/test_rawdev.c             | 11 ++++++++++
  doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++
  drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
  drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
  4 files changed, 67 insertions(+)
app/test/test_rawdev.c +2 -0
index 88549fb61..4db762b4c 100644
@@ -29,6 +29,17 @@ REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
  static int
  test_rawdev_selftest_ioat(void)
  {
+	const int count = rte_rawdev_count();
+	int i;
Quoted 9 lines

app/test/test_rawdev.c REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton); · line 39

Quoted 6 lines
app/test/test_rawdev.c +6 -0
+
+	for (i = 0; i < count; i++) {
+		struct rte_rawdev_info info = { .dev_private = NULL };
+		if (rte_rawdev_info_get(i, &info) == 0 &&
+				strstr(info.driver_name, "ioat") != NULL)
+			return 0;

TEST_SUCCESS? Also, didn't "ioat" have a macro for its name?

Ack on the TEST_SUCCESS part.

For the seond point, yes, there is a macro for the name, but to get it one has to include the header file for the driver, which will not be available if the driver is not being built. Therefore, I just use a basic check for the "ioat" name, rather than cluttering up the code with lots of conditionals for handling cases where the driver won't be built.

/Bruce

#48 lore raw

PATCH v3 6/8 raw/ioat: add configure, start and stop functions

In reply to Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

---

V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h
V2: test cases placed in self-test routine

---
 app/test/test_rawdev.c              |  2 +-
 doc/guides/rawdevs/ioat_rawdev.rst  | 32 ++++++++++++
 drivers/raw/ioat/Makefile           |  1 +
 drivers/raw/ioat/ioat_rawdev.c      | 78 +++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 41 +++++++++++++++
 drivers/raw/ioat/meson.build        |  3 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  |  4 +-
 7 files changed, 158 insertions(+), 3 deletions(-)
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
app/test/test_rawdev.c +1 -1
index 4db762b4c..731e51717 100644
@@ -36,7 +36,7 @@ test_rawdev_selftest_ioat(void)
 		struct rte_rawdev_info info = { .dev_private = NULL };
 		if (rte_rawdev_info_get(i, &info) == 0 &&
 				strstr(info.driver_name, "ioat") != NULL)
-			return 0;
+			return rte_rawdev_selftest(i);
 	}
 
 	printf("No IOAT rawdev found, skipping tests\n");
doc/guides/rawdevs/ioat_rawdev.rst +32 -0
index 0ce984490..9ab97e2aa 100644
@@ -117,3 +117,35 @@ the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
 be NULL, or else be set to point to a structure of type
 ``rte_ioat_rawdev_config``, in which case the size of the configured device
 input ring will be returned in that structure.
+
+Device Configuration
+~~~~~~~~~~~~~~~~~~~~~
+
+Configuring an IOAT rawdev device is done using the
+``rte_rawdev_configure()`` API, which takes the same structure parameters
+as the, previously referenced, ``rte_rawdev_info_get()`` API. The main
+difference is that, because the parameter is used as input rather than
+output, the ``dev_private`` structure element cannot be NULL, and must
+point to a valid ``rte_ioat_rawdev_config`` structure, containing the ring
+size to be used by the device. The ring size must be a power of two,
+between 64 and 4096.
+
+The following code shows how the device is configured in
+``test_ioat_rawdev.c``:
+
+.. code-block:: C
+
+   #define IOAT_TEST_RINGSIZE 512
+        struct rte_ioat_rawdev_config p = { .ring_size = -1 };
+        struct rte_rawdev_info info = { .dev_private = &p };
+
+        /* ... */
+
+        p.ring_size = IOAT_TEST_RINGSIZE;
+        if (rte_rawdev_configure(dev_id, &info) != 0) {
+                printf("Error with rte_rawdev_configure()\n");
+                return -1;
+        }
+
+Once configured, the device can then be made ready for use by calling the
+``rte_rawdev_start()`` API.
drivers/raw/ioat/Makefile +1 -0
index 1e10938f3..b1af9c666 100644
@@ -21,6 +21,7 @@ EXPORT_MAP := rte_pmd_ioat_version.map
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev_test.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
drivers/raw/ioat/ioat_rawdev.c +78 -0

95 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c new file +41 -0

41 lines not on this page · raw message

drivers/raw/ioat/meson.build +2 -1
index ca23e23fc..40fff6654 100644
@@ -2,7 +2,8 @@
 # Copyright 2019 Intel Corporation
 
 build = dpdk_conf.has('RTE_ARCH_X86')
-sources = files('ioat_rawdev.c')
+sources = files('ioat_rawdev.c',
+		'ioat_rawdev_test.c')
 deps += ['rawdev', 'bus_pci']
 
 install_headers('rte_ioat_rawdev.h',
drivers/raw/ioat/rte_ioat_rawdev.h +3 -1
index 7e0d72ca3..c09fd0791 100644
@@ -14,6 +14,7 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <x86intrin.h>
 #include <rte_memory.h>
 #include <rte_ioat_spec.h>
 
@@ -46,7 +47,8 @@ struct rte_ioat_rawdev {
 	phys_addr_t ring_addr;
 
 	unsigned short ring_size;
-	struct rte_ioat_desc *desc_ring;
+	struct rte_ioat_generic_hw_desc *desc_ring;
+	__m128i *hdls; /* completion handles for returning to user */
 
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
Signature · 1 line
2.21.0
#49 lore raw

Re: [dpdk-dev] [PATCH v3 6/8] raw/ioat: add configure, start and stop functions

Quoted 25 lines · Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

---

V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h
V2: test cases placed in self-test routine

---
  app/test/test_rawdev.c              |  2 +-
  doc/guides/rawdevs/ioat_rawdev.rst  | 32 ++++++++++++
  drivers/raw/ioat/Makefile           |  1 +
  drivers/raw/ioat/ioat_rawdev.c      | 78 +++++++++++++++++++++++++++++
  drivers/raw/ioat/ioat_rawdev_test.c | 41 +++++++++++++++
  drivers/raw/ioat/meson.build        |  3 +-
  drivers/raw/ioat/rte_ioat_rawdev.h  |  4 +-
  7 files changed, 158 insertions(+), 3 deletions(-)

create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c

app/test/test_rawdev.c +0 -0
index 4db762b4c..731e51717 100644

app/test/test_rawdev.c test_rawdev_selftest_ioat(void) · line 39

Quoted 5 lines
app/test/test_rawdev.c +1 -1
@@ -36,7 +36,7 @@ test_rawdev_selftest_ioat(void)
  		struct rte_rawdev_info info = { .dev_private = NULL };
  		if (rte_rawdev_info_get(i, &info) == 0 &&
  				strstr(info.driver_name, "ioat") != NULL)
-			return 0;
+			return rte_rawdev_selftest(i);

Even though it doesn't matter in practice, technically, we can't pass a raw return value to the test caller. It should be TEST_SUCCESS or TEST_FAILURE.

Quoted 23 lines
app/test/test_rawdev.c +0 -0
  	}
 
  	printf("No IOAT rawdev found, skipping tests\n");
doc/guides/rawdevs/ioat_rawdev.rst +12 -0
index 0ce984490..9ab97e2aa 100644
@@ -117,3 +117,35 @@ the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
  be NULL, or else be set to point to a structure of type
  ``rte_ioat_rawdev_config``, in which case the size of the configured device
  input ring will be returned in that structure.
+
+Device Configuration
+~~~~~~~~~~~~~~~~~~~~~
+
+Configuring an IOAT rawdev device is done using the
+``rte_rawdev_configure()`` API, which takes the same structure parameters
+as the, previously referenced, ``rte_rawdev_info_get()`` API. The main
+difference is that, because the parameter is used as input rather than
+output, the ``dev_private`` structure element cannot be NULL, and must
+point to a valid ``rte_ioat_rawdev_config`` structure, containing the ring
+size to be used by the device. The ring size must be a power of two,
+between 64 and 4096.

<snip>

Quoted 7 lines
doc/guides/rawdevs/ioat_rawdev.rst +7 -0
+	if (params->ring_size > 4096 || params->ring_size < 64 ||
+			!rte_is_power_of_2(params->ring_size))
+		return -EINVAL;
+
+	ioat->ring_size = params->ring_size;
+	if (ioat->desc_ring != NULL) {
+		rte_free(ioat->desc_ring);

doc/guides/rawdevs/ioat_rawdev.rst

Quoted 10 lines
doc/guides/rawdevs/ioat_rawdev.rst +10 -0
+		ioat->desc_ring = NULL;
+	}
+
+	/* allocate one block of memory for both descriptors
+	 * and completion handles.
+	 */
+	ioat->desc_ring = rte_zmalloc_socket(NULL,
+			(DESC_SZ + COMPLETION_SZ) * ioat->ring_size,
+			0, /* alignment, default to 64Byte */
+			dev->device->numa_node);

Using rte_zmalloc for hardware structures seems suspect. Do you not need IOVA-contiguous memory here?

doc/guides/rawdevs/ioat_rawdev.rst

Quoted 11 lines
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
+	if (ioat->desc_ring == NULL)
+		return -ENOMEM;
+	ioat->hdls = (void *)&ioat->desc_ring[ioat->ring_size];
+
+	ioat->ring_addr = rte_malloc_virt2iova(ioat->desc_ring);
+
+	/* configure descriptor ring - each one points to next */
+	for (i = 0; i < ioat->ring_size; i++) {
+		ioat->desc_ring[i].next = ioat->ring_addr +
+				(((i + 1) % ioat->ring_size) * DESC_SZ);
+	}

OK, this *definitely* looks suspect :) with rte_zmalloc(), there's no guarantee that the entire allocated block resides on the same physical page, so you can't assume IOVA addresses will be contiguous either, unless you only intend to operate in IOVA as VA mode (which i didn't notice).

Signature · 2 lines
Thanks,
Anatoly
#50 lore raw

Re: [dpdk-dev] [PATCH v3 6/8] raw/ioat: add configure, start and stop functions

In reply to Bruce Richardson
Quoted 10 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 11:41 AM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH v3 6/8] raw/ioat: add configure, start and stop functions

<snip>

drivers/raw/ioat/ioat_rawdev.c ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) · line 119

Quoted 10 lines
drivers/raw/ioat/ioat_rawdev.c +6 -0
+int ioat_rawdev_test(uint16_t dev_id);
+
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)  {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_configure = ioat_dev_configure,
+			.dev_start = ioat_dev_start,
+			.dev_stop = ioat_dev_stop,
 			.dev_info_get = ioat_dev_info_get,
+			.dev_selftest = ioat_rawdev_test,

Build fail for ./devtools/test-build.sh x86_64-native-linux-gcc+next+shared
/drivers/raw/ioat/ioat_rawdev.c: In function 'ioat_rawdev_create':
drivers/raw/ioat/ioat_rawdev.c:163:20: error: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(uint16_t)' {aka 'int (*)(short unsigned int)'} [-Werror=incompatible-pointer-types]
163 | .dev_selftest = ioat_rawdev_test,

Thanks,
Reshma

#51 lore raw

Re: [dpdk-dev] [PATCH v3 6/8] raw/ioat: add configure, start and stop functions

Quoted 13 lines · Reshma
Quoted 10 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 11:41 AM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH v3 6/8] raw/ioat: add configure, start and stop functions

<snip>

Quoted 16 lines

drivers/raw/ioat/ioat_rawdev.c ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) · line 119

Quoted 10 lines
drivers/raw/ioat/ioat_rawdev.c +6 -0
+int ioat_rawdev_test(uint16_t dev_id);
+
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)  {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_configure = ioat_dev_configure,
+			.dev_start = ioat_dev_start,
+			.dev_stop = ioat_dev_stop,
 			.dev_info_get = ioat_dev_info_get,
+			.dev_selftest = ioat_rawdev_test,

Build fail for ./devtools/test-build.sh x86_64-native-linux-gcc+next+shared
/drivers/raw/ioat/ioat_rawdev.c: In function 'ioat_rawdev_create':
drivers/raw/ioat/ioat_rawdev.c:163:20: error: initialization of 'int (*)(void)' from incompatible pointer type 'int (*)(uint16_t)' {aka 'int (*)(short unsigned int)'} [-Werror=incompatible-pointer-types]
163 | .dev_selftest = ioat_rawdev_test,

Apologies, I forgot to put in the cover letter that this depends upon the rawdev patchset I previously upstreamed:

http://patches.dpdk.org/project/dpdk/list/?series=5120

#52 lore raw

PATCH v3 7/8 raw/ioat: add statistics functions

In reply to Bruce Richardson

Add stats functions to track what is happening in the driver, and put unit tests to check those.

---

V2: test cases moved to self-test routine

---
 doc/guides/rawdevs/ioat_rawdev.rst  | 14 +++++++++
 drivers/raw/ioat/ioat_rawdev.c      | 44 +++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 39 +++++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h  |  6 ++++
 4 files changed, 103 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +14 -0
index 9ab97e2aa..b908f31e0 100644
@@ -149,3 +149,17 @@ The following code shows how the device is configured in
 
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
+
+Querying Device Statistics
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The statistics from the IOAT rawdev device can be got via the xstats
+functions in the ``rte_rawdev`` library, i.e.
+``rte_rawdev_xstats_names_get()``, ``rte_rawdev_xstats_get()`` and
+``rte_rawdev_xstats_by_name_get``. The statistics returned for each device
+instance are:
+
+* ``failed_enqueues``
+* ``successful_enqueues``
+* ``copies_started``
+* ``copies_completed``
drivers/raw/ioat/ioat_rawdev.c +44 -0

62 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +39 -0
index 5375da26c..5098d71ae 100644
@@ -2,6 +2,7 @@
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <inttypes.h>
 #include "rte_rawdev.h"
 #include "rte_ioat_rawdev.h"
 
@@ -13,6 +14,11 @@ ioat_rawdev_test(uint16_t dev_id)
 #define IOAT_TEST_RINGSIZE 512
 	struct rte_ioat_rawdev_config p = { .ring_size = -1 };
 	struct rte_rawdev_info info = { .dev_private = &p };
+	struct rte_rawdev_xstats_name *snames = NULL;
+	uint64_t *stats = NULL;
+	unsigned int *ids = NULL;
+	unsigned int nb_xstats;
+	unsigned int i;
 
 	rte_rawdev_info_get(dev_id, &info);
 	if (p.ring_size != 0) {
@@ -37,5 +43,38 @@ ioat_rawdev_test(uint16_t dev_id)
 		printf("Error with rte_rawdev_start()\n");
 		return -1;
 	}
+
+	/* allocate memory for xstats names and values */
+	nb_xstats = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
+
+	snames = malloc(sizeof(*snames) * nb_xstats);
+	if (snames == NULL) {
+		printf("Error allocating xstat names memory\n");
+		return -1;
+	}
+	rte_rawdev_xstats_names_get(dev_id, snames, nb_xstats);
+
+	ids = malloc(sizeof(*ids) * nb_xstats);
+	if (ids == NULL) {
+		printf("Error allocating xstat ids memory\n");
+		return -1;
+	}
+	for (i = 0; i < nb_xstats; i++)
+		ids[i] = i;
+
+	stats = malloc(sizeof(*stats) * nb_xstats);
+	if (stats == NULL) {
+		printf("Error allocating xstat memory\n");
+		return -1;
+	}
+
+	rte_rawdev_xstats_get(dev_id, ids, stats, nb_xstats);
+	for (i = 0; i < nb_xstats; i++)
+		printf("%s: %"PRIu64"   ", snames[i].name, stats[i]);
+	printf("\n");
+
+	free(snames);
+	free(stats);
+	free(ids);
 	return 0;
 }
drivers/raw/ioat/rte_ioat_rawdev.h +6 -0
index c09fd0791..aa534f9cf 100644
@@ -50,6 +50,12 @@ struct rte_ioat_rawdev {
 	struct rte_ioat_generic_hw_desc *desc_ring;
 	__m128i *hdls; /* completion handles for returning to user */
 
+	/* some statistics for tracking, if added/changed update xstats fns*/
+	uint64_t enqueue_failed __rte_cache_aligned;
+	uint64_t enqueued;
+	uint64_t started;
+	uint64_t completed;
+
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
 };
Signature · 1 line
2.21.0
#53 lore raw

Re: [dpdk-dev] [PATCH v3 7/8] raw/ioat: add statistics functions

Quoted 5 lines · Bruce Richardson

Add stats functions to track what is happening in the driver, and put unit tests to check those.

---

<snip>

Quoted 4 lines
drivers/raw/ioat/ioat_rawdev_test.c +4 -0
+	/* allocate memory for xstats names and values */
+	nb_xstats = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
+
+	snames = malloc(sizeof(*snames) * nb_xstats);

drivers/raw/ioat/ioat_rawdev_test.c ioat_rawdev_test(uint16_t dev_id) · line 60

Quoted 10 lines
drivers/raw/ioat/ioat_rawdev_test.c +10 -0
+	if (snames == NULL) {
+		printf("Error allocating xstat names memory\n");
+		return -1;
+	}
+	rte_rawdev_xstats_names_get(dev_id, snames, nb_xstats);
+
+	ids = malloc(sizeof(*ids) * nb_xstats);
+	if (ids == NULL) {
+		printf("Error allocating xstat ids memory\n");
+		return -1;

Leaking snames here.

drivers/raw/ioat/ioat_rawdev_test.c ioat_rawdev_test(uint16_t dev_id) · line 68

Quoted 8 lines
drivers/raw/ioat/ioat_rawdev_test.c +8 -0
+	}
+	for (i = 0; i < nb_xstats; i++)
+		ids[i] = i;
+
+	stats = malloc(sizeof(*stats) * nb_xstats);
+	if (stats == NULL) {
+		printf("Error allocating xstat memory\n");
+		return -1;

Leaking snames and ids here. Perhaps a goto and a ret value wouldn't hurt :)

Signature · 2 lines
Thanks,
Anatoly
#54 lore raw

Re: [dpdk-dev] [PATCH v3 7/8] raw/ioat: add statistics functions

In reply to Bruce Richardson
Quoted 6 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 11:41 AM
To: [email protected]

<snip>

Quoted 7 lines
drivers/raw/ioat/ioat_rawdev.c +7 -0
+static int
+ioat_xstats_get(const struct rte_rawdev *dev, const unsigned int ids[],
+		uint64_t values[], unsigned int n)
+{
+	const struct rte_ioat_rawdev *ioat = dev->dev_private;
+	unsigned int i;
+

drivers/raw/ioat/ioat_rawdev.c ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) · line 131

Quoted 10 lines
drivers/raw/ioat/ioat_rawdev.c +10 -0
+	for (i = 0; i < n; i++) {
+		switch (ids[i]) {
+		case 0: values[i] = ioat->enqueue_failed; break;
+		case 1: values[i] = ioat->enqueued; break;
+		case 2: values[i] = ioat->started; break;
+		case 3: values[i] = ioat->completed; break;
+		default: values[i] = 0; break;
+		}
+	}
+	return n;

Should this return n or how many actually filled ?

Thanks,
Reshma

#55 lore raw

Re: [dpdk-dev] [PATCH v3 7/8] raw/ioat: add statistics functions

Quoted 21 lines · Reshma
Quoted 6 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 11:41 AM
To: [email protected]

<snip>

Quoted 11 lines
drivers/raw/ioat/ioat_rawdev.c +11 -0
+static int
+ioat_xstats_get(const struct rte_rawdev *dev, const unsigned int ids[],
+		uint64_t values[], unsigned int n)
+{
+	const struct rte_ioat_rawdev *ioat = dev->dev_private;
+	unsigned int i;
+
+	for (i = 0; i < n; i++) {
+		switch (ids[i]) {
+		case 0: values[i] = ioat->enqueue_failed; break;
+		case 1: values[i] = ioat->enqueued; break;
Quoted 9 lines

drivers/raw/ioat/ioat_rawdev.c ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) · line 131

Quoted 6 lines
drivers/raw/ioat/ioat_rawdev.c +6 -0
+		case 2: values[i] = ioat->started; break;
+		case 3: values[i] = ioat->completed; break;
+		default: values[i] = 0; break;
+		}
+	}
+	return n;

Should this return n or how many actually filled ?

They should both be "n", since we never break out of the loop early.

/Bruce

#56 lore raw

PATCH v3 8/8 raw/ioat: add local API to perform copies

In reply to Bruce Richardson

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

---

V3: updated to use descriptor format in rte_ioat_spec.h
V2: test cases moved to self-test routine

---
 doc/guides/rawdevs/ioat_rawdev.rst  | 100 ++++++++++++++++
 drivers/raw/ioat/Makefile           |   1 +
 drivers/raw/ioat/ioat_rawdev_test.c | 161 +++++++++++++++++++++++++-
 drivers/raw/ioat/meson.build        |   2 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  | 169 +++++++++++++++++++++++++++-
 5 files changed, 428 insertions(+), 5 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +100 -0
index b908f31e0..22bb8a22c 100644
@@ -150,6 +150,106 @@ The following code shows how the device is configured in
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
 
+Performing Data Copies
+~~~~~~~~~~~~~~~~~~~~~~~
+
+To perform data copies using IOAT rawdev devices, the functions
+``rte_ioat_enqueue_copy()`` and ``rte_ioat_do_copies()`` should be used.
+Once copies have been completed, the completion will be reported back when
+the application calls ``rte_ioat_completed_copies()``.
+
+The ``rte_ioat_enqueue_copy()`` function enqueues a single copy to the
+device ring for copying at a later point. The parameters to that function
+include the physical addresses of both the source and destination buffers,
+as well as two "handles" to be returned to the user when the copy is
+completed. These handles can be arbitrary values, but two are provided so
+that the library can track handles for both source and destination on
+behalf of the user, e.g. virtual addresses for the buffers, or mbuf
+pointers if packet data is being copied.
+
+While the ``rte_ioat_enqueue_copy()`` function enqueues a copy operation on
+the device ring, the copy will not actually be performed until after the
+application calls the ``rte_ioat_do_copies()`` function. This function
+informs the device hardware of the elements enqueued on the ring, and the
+device will begin to process them. It is expected that, for efficiency
+reasons, a burst of operations will be enqueued to the device via multiple
+enqueue calls between calls to the ``rte_ioat_do_copies()`` function.
+
+The following code from ``test_ioat_rawdev.c`` demonstrates how to enqueue
+a burst of copies to the device and start the hardware processing of them:
+
+.. code-block:: C
+
+        struct rte_mbuf *srcs[32], *dsts[32];
+        unsigned int j;
+
+        for (i = 0; i < RTE_DIM(srcs); i++) {
+                char *src_data;
+
+                srcs[i] = rte_pktmbuf_alloc(pool);
+                dsts[i] = rte_pktmbuf_alloc(pool);
+                srcs[i]->data_len = srcs[i]->pkt_len = length;
+                dsts[i]->data_len = dsts[i]->pkt_len = length;
+                src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+                for (j = 0; j < length; j++)
+                        src_data[j] = rand() & 0xFF;
+
+                if (rte_ioat_enqueue_copy(dev_id,
+                                srcs[i]->buf_iova + srcs[i]->data_off,
+                                dsts[i]->buf_iova + dsts[i]->data_off,
+                                length,
+                                (uintptr_t)srcs[i],
+                                (uintptr_t)dsts[i],
+                                0 /* nofence */) != 1) {
+                        printf("Error with rte_ioat_enqueue_copy for buffer %u\n",
+                                        i);
+                        return -1;
+                }
+        }
+        rte_ioat_do_copies(dev_id);
+
+To retrieve information about completed copies, the API
+``rte_ioat_completed_copies()`` should be used. This API will return to the
+application a set of completion handles passed in when the relevant copies
+were enqueued.
+
+The following code from ``test_ioat_rawdev.c`` shows the test code
+retrieving information about the completed copies and validating the data
+is correct before freeing the data buffers using the returned handles:
+
+.. code-block:: C
+
+        if (rte_ioat_completed_copies(dev_id, 64, (void *)completed_src,
+                        (void *)completed_dst) != RTE_DIM(srcs)) {
+                printf("Error with rte_ioat_completed_copies\n");
+                return -1;
+        }
+        for (i = 0; i < RTE_DIM(srcs); i++) {
+                char *src_data, *dst_data;
+
+                if (completed_src[i] != srcs[i]) {
+                        printf("Error with source pointer %u\n", i);
+                        return -1;
+                }
+                if (completed_dst[i] != dsts[i]) {
+                        printf("Error with dest pointer %u\n", i);
+                        return -1;
+                }
+
+                src_data = rte_pktmbuf_mtod(srcs[i], char *);
+                dst_data = rte_pktmbuf_mtod(dsts[i], char *);
+                for (j = 0; j < length; j++)
+                        if (src_data[j] != dst_data[j]) {
+                                printf("Error with copy of packet %u, byte %u\n",
+                                                i, j);
+                                return -1;
+                        }
+                rte_pktmbuf_free(srcs[i]);
+                rte_pktmbuf_free(dsts[i]);
+        }
+
+
 Querying Device Statistics
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
drivers/raw/ioat/Makefile +1 -0
index b1af9c666..32f079845 100644
@@ -12,6 +12,7 @@ CFLAGS += $(WERROR_FLAGS)
 
 LDLIBS += -lrte_eal -lrte_rawdev
 LDLIBS += -lrte_pci -lrte_bus_pci
+LDLIBS += -lrte_mbuf -lrte_mempool
 
 # library version
 LIBABIVER := 1
drivers/raw/ioat/ioat_rawdev_test.c +158 -3

189 lines not on this page · raw message

drivers/raw/ioat/meson.build +1 -1
index 40fff6654..247ff88bf 100644
@@ -4,7 +4,7 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c',
 		'ioat_rawdev_test.c')
-deps += ['rawdev', 'bus_pci']
+deps += ['rawdev', 'bus_pci', 'mbuf']
 
 install_headers('rte_ioat_rawdev.h',
 		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_rawdev.h +168 -1

185 lines not on this page · raw message

Signature · 1 line
2.21.0
Acked-by on v3 8/8
#57 lore raw

Re: [dpdk-dev] [PATCH v3 8/8] raw/ioat: add local API to perform copies

Quoted 27 lines · Bruce Richardson

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

---

V3: updated to use descriptor format in rte_ioat_spec.h
V2: test cases moved to self-test routine

---
  doc/guides/rawdevs/ioat_rawdev.rst  | 100 ++++++++++++++++
  drivers/raw/ioat/Makefile           |   1 +
  drivers/raw/ioat/ioat_rawdev_test.c | 161 +++++++++++++++++++++++++-
  drivers/raw/ioat/meson.build        |   2 +-
  drivers/raw/ioat/rte_ioat_rawdev.h  | 169 +++++++++++++++++++++++++++-
  5 files changed, 428 insertions(+), 5 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +1 -0
index b908f31e0..22bb8a22c 100644
@@ -150,6 +150,106 @@ The following code shows how the device is configured in
  Once configured, the device can then be made ready for use by calling the
  ``rte_rawdev_start()`` API.
 
+Performing Data Copies

doc/guides/rawdevs/ioat_rawdev.rst The following code shows how the device is configured in · line 163

Quoted 10 lines
doc/guides/rawdevs/ioat_rawdev.rst +10 -0
+~~~~~~~~~~~~~~~~~~~~~~~
+
+To perform data copies using IOAT rawdev devices, the functions
+``rte_ioat_enqueue_copy()`` and ``rte_ioat_do_copies()`` should be used.
+Once copies have been completed, the completion will be reported back when
+the application calls ``rte_ioat_completed_copies()``.
+
+The ``rte_ioat_enqueue_copy()`` function enqueues a single copy to the
+device ring for copying at a later point. The parameters to that function
+include the physical addresses of both the source and destination buffers,

Physical or IOVA?

Quoted 8 lines
doc/guides/rawdevs/ioat_rawdev.rst +8 -0
+as well as two "handles" to be returned to the user when the copy is
+completed. These handles can be arbitrary values, but two are provided so
+that the library can track handles for both source and destination on
+behalf of the user, e.g. virtual addresses for the buffers, or mbuf
+pointers if packet data is being copied.
+
+While the ``rte_ioat_enqueue_copy()`` function enqueues a copy operation on
+the device ring, the copy will not actually be performed until after the

<snip>

doc/guides/rawdevs/ioat_rawdev.rst

Quoted 12 lines
doc/guides/rawdevs/ioat_rawdev.rst +8 -0
+	rte_mempool_free(pool);
  	free(snames);
  	free(stats);
  	free(ids);
  	return 0;
+
+err:
+	rte_mempool_free(pool);
+	free(snames);
+	free(stats);
+	free(ids);
+	return -1;

The goto is added a commit too late :D

Otherwise, LGTM

Signature · 2 lines
Thanks,
Anatoly
#58 lore raw
In reply to Bruce Richardson
Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bruce Richardson
Sent: Thursday, June 27, 2019 11:41 AM
To: [email protected]
Cc: [email protected]; [email protected]; Richardson, Bruce <[email protected]>
Subject: [dpdk-dev] [PATCH v3 0/8] raw/ioat: driver for Intel QuickData Technology

Quoted 8 lines

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Performing the copies in hardware can provide performance improvements for applications where the average copy size is reasonably large, e.g. 1k packets. For smaller packets, e.g. 64-256 bytes, offloading the copy may reduce performance due to the overhead of using hardware.

Applied (release notes conflict - but that's par for the course close to integration) Build each patch with meson (git rebase -x is awesome :)

Ran unit tests:

$ ioat_rawdev_probe(): Init 0000:00:04.0 on NUMA node 0
$ failed_enqueues: 0   successful_enqueues: 3300   copies_started: 3300   copies_completed: 3300

All seems fine to me;

#59 lore raw

v4 cover raw/ioat: driver for Intel QuickData Technology

In reply to Bruce Richardson

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Performing the copies in hardware can provide performance improvements for applications where the average copy size is reasonably large, e.g. 1k packets. For smaller packets, e.g. 64-256 bytes, offloading the copy may reduce performance due to the overhead of using hardware.

V4:
* changed memory management to use contiguous memzones instead of malloc memory
* added missing device ids for BDX platforms
* other misc cleanup following review (see individual patches logs)

V3:
* removed DPDK-specific structure for the descriptor format and reused the structure in the imported file rte_ioat_spec.h

V2:
* moved tests to rawdev selftest function
* some checkpatch and other small cleanups
* added extra documentation details on supported hardware
* aligned the changes to dpdk-devbind with the changes in the NTB set for consistency

Bruce Richardson (9):
rawdev: allow devices to skip extra memory allocation raw/ioat: add initial support for ioat rawdev driver usertools/dpdk-devbind.py: add support for IOAT devices raw/ioat: add register definition file raw/ioat: create device on probe and destroy on release raw/ioat: add device info function
raw/ioat: add configure, start and stop functions raw/ioat: add statistics functions
raw/ioat: add local API to perform copies

 MAINTAINERS                                 |   5 +
 app/test/test_rawdev.c                      |  20 ++
 config/common_armv8a_linux                  |   1 +
 config/common_base                          |   5 +
 config/defconfig_arm-armv7a-linuxapp-gcc    |   1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 +
 doc/guides/rawdevs/index.rst                |   1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 265 +++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      |  11 +
 drivers/raw/Makefile                        |   1 +
 drivers/raw/ioat/Makefile                   |  31 ++
 drivers/raw/ioat/ioat_rawdev.c              | 356 ++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c         | 235 +++++++++++++
 drivers/raw/ioat/meson.build                |  10 +
 drivers/raw/ioat/rte_ioat_rawdev.h          | 234 +++++++++++++
 drivers/raw/ioat/rte_ioat_spec.h            | 301 +++++++++++++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |   4 +
 drivers/raw/meson.build                     |   4 +-
 lib/librte_rawdev/rte_rawdev.c              |  11 +-
 mk/rte.app.mk                               |   1 +
 usertools/dpdk-devbind.py                   |  10 +
 21 files changed, 1502 insertions(+), 6 deletions(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
Signature · 1 line
2.21.0
#60 lore raw

PATCH v4 1/9 rawdev: allow devices to skip extra memory allocation

Some device drivers want to allocate their own private memory, and should be allowed to do so. Therefore skip memory allocation and associated error checks if zero-length private memory is requested.

While adjusting the code for new indent level, fix incorrect error message.

Cc Shreyansh Jain <[email protected]>
Cc Hemant Agrawal <[email protected]>
---
 lib/librte_rawdev/rte_rawdev.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
lib/librte_rawdev/rte_rawdev.c +6 -5
index 15de2d413..b6f1e1c77 100644
@@ -496,16 +496,17 @@ rte_rawdev_pmd_allocate(const char *name, size_t dev_priv_size, int socket_id)
 
 	rawdev = &rte_rawdevs[dev_id];
 
-	rawdev->dev_private = rte_zmalloc_socket("rawdev private",
+	if (dev_priv_size > 0) {
+		rawdev->dev_private = rte_zmalloc_socket("rawdev private",
 				     dev_priv_size,
 				     RTE_CACHE_LINE_SIZE,
 				     socket_id);
-	if (!rawdev->dev_private) {
-		RTE_RDEV_ERR("Unable to allocate memory to Skeleton dev");
-		return NULL;
+		if (!rawdev->dev_private) {
+			RTE_RDEV_ERR("Unable to allocate memory for rawdev");
+			return NULL;
+		}
 	}
 
-
 	rawdev->dev_id = dev_id;
 	rawdev->socket_id = socket_id;
 	rawdev->started = 0;
Signature · 1 line
2.21.0
Acked-by on v4 1/9
#62 lore raw

Re: [dpdk-dev] [PATCH v4 1/9] rawdev: allow devices to skip extra memory allocation

In reply to Bruce Richardson
Quoted 10 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Monday, July 1, 2019 9:26 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Bruce Richardson <[email protected]>; Shreyansh Jain <[email protected]>; Hemant Agrawal <[email protected]>
Subject: [PATCH v4 1/9] rawdev: allow devices to skip extra memory allocation

Quoted 5 lines

Some device drivers want to allocate their own private memory, and should
be allowed to do so. Therefore skip memory allocation and associated error
checks if zero-length private memory is requested.

Agree with this - rawdev was intended for flexibility and this (allowing them their own memory) is definitely better way ahead. Thanks for proposing. But, I think the kind of caveat should also be added to the header declaring this function:

Probably something like this:

--->8--- lib/librte_rawdev/rte_rawdev_pmd.h ---
/**
* Allocates a new rawdev slot for an raw device and returns the pointer
* to that slot for the driver to use.
*
* @param name
* Unique identifier name for each device
* @param dev_private_size
* Private data allocated within rte_rawdev object.
* <b>Set to 0 to disable internal allocation and allow for self-allocation</b>
* @param socket_id
* Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_rawdev *
rte_rawdev_pmd_allocate(const char *name, size_t dev_private_size,

                        int socket_id);

--->8---

Quoted 8 lines

While adjusting the code for new indent level, fix incorrect error message.

Cc Shreyansh Jain <[email protected]>
Cc Hemant Agrawal <[email protected]>

---

If you can update the header, please use my ACK in next version.

[...]

#63 lore raw

Re: [dpdk-dev] [PATCH v4 1/9] rawdev: allow devices to skip extra memory allocation

Quoted 45 lines · Shreyansh Jain
Quoted 10 lines

-----Original Message-----
From: Bruce Richardson <[email protected]>
Sent: Monday, July 1, 2019 9:26 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Bruce Richardson <[email protected]>; Shreyansh Jain <[email protected]>; Hemant Agrawal <[email protected]>
Subject: [PATCH v4 1/9] rawdev: allow devices to skip extra memory allocation

Quoted 5 lines

Some device drivers want to allocate their own private memory, and should
be allowed to do so. Therefore skip memory allocation and associated error
checks if zero-length private memory is requested.

Agree with this - rawdev was intended for flexibility and this (allowing them their own memory) is definitely better way ahead. Thanks for proposing. But, I think the kind of caveat should also be added to the header declaring this function:

Probably something like this:

--->8--- lib/librte_rawdev/rte_rawdev_pmd.h ---
/**
* Allocates a new rawdev slot for an raw device and returns the pointer
* to that slot for the driver to use.
*
* @param name
* Unique identifier name for each device
* @param dev_private_size
* Private data allocated within rte_rawdev object.
* <b>Set to 0 to disable internal allocation and allow for self-allocation</b>
* @param socket_id
* Socket to allocate resources on.
* @return
* - Slot in the rte_dev_devices array for a new device;
*/
struct rte_rawdev *
rte_rawdev_pmd_allocate(const char *name, size_t dev_private_size,

                        int socket_id);

--->8---

Quoted 4 lines

While adjusting the code for new indent level, fix incorrect error message.

Quoted 9 lines
Quoted 4 lines
Cc Shreyansh Jain <[email protected]>
Cc Hemant Agrawal <[email protected]>

---

If you can update the header, please use my ACK in next version.

Thanks Shreyansh, will do.

/Bruce

#64 lore raw

PATCH v4 2/9 raw/ioat: add initial support for ioat rawdev driver

In reply to Bruce Richardson

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---
V4: add in missing device IDs
V3: remove unneeded whitespace change
V2: don't create a new file for unit testing, add to existing rawdev test
file, and place test cases in the driver selftest routine (added later in set)
Add new section in document about identifying hardware using lspci

---
 MAINTAINERS                                 |   5 +
 app/test/test_rawdev.c                      |   8 ++
 config/common_armv8a_linux                  |   1 +
 config/common_base                          |   5 +
 config/defconfig_arm-armv7a-linuxapp-gcc    |   1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 +
 doc/guides/rawdevs/index.rst                |   1 +
 doc/guides/rawdevs/ioat_rawdev.rst          |  63 +++++++++++
 doc/guides/rel_notes/release_19_08.rst      |  11 ++
 drivers/raw/Makefile                        |   1 +
 drivers/raw/ioat/Makefile                   |  28 +++++
 drivers/raw/ioat/ioat_rawdev.c              | 113 ++++++++++++++++++++
 drivers/raw/ioat/meson.build                |   8 ++
 drivers/raw/ioat/rte_ioat_rawdev.h          |  24 +++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |   4 +
 drivers/raw/meson.build                     |   4 +-
 mk/rte.app.mk                               |   1 +
 17 files changed, 278 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
MAINTAINERS +5 -0
index bbec1982c..2cfafe000 100644
@@ -1074,6 +1074,11 @@ M: Tianfei zhang <[email protected]>
 F: drivers/raw/ifpga_rawdev/
 F: doc/guides/rawdevs/ifpga_rawdev.rst
 
+IOAT Rawdev
+M: Bruce Richardson <[email protected]>
+F: drivers/raw/ioat/
+F: doc/guides/rawdevs/ioat_rawdev.rst
+
 NXP DPAA2 QDMA
 M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_qdma/
app/test/test_rawdev.c +8 -0
index 043a38a13..88549fb61 100644
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
+
+static int
+test_rawdev_selftest_ioat(void)
+{
+	return TEST_SKIPPED;
+}
+
+REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
config/common_armv8a_linux +1 -0
index 72091de1c..481712ebc 100644
@@ -34,5 +34,6 @@ CONFIG_RTE_ARCH_ARM64_MEMCPY=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
 
 CONFIG_RTE_SCHED_VECTOR=n
config/common_base +5 -0
index fa1ae249a..e6b830923 100644
@@ -747,6 +747,11 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n
 #
 CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV=y
 
+#
+# Compile PMD for Intel IOAT raw device
+#
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y
+
 #
 # Compile librte_ring
 #
config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
index c9509b274..ee158ef9d 100644
@@ -54,3 +54,4 @@ CONFIG_RTE_LIBRTE_QEDE_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
 CONFIG_RTE_LIBRTE_NFP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
index 7e248b755..9f3670ec0 100644
@@ -56,3 +56,4 @@ CONFIG_RTE_LIBRTE_ENIC_PMD=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
doc/guides/rawdevs/index.rst +1 -0
index 7c3bd9586..0a21989e4 100644
@@ -14,3 +14,4 @@ application through rawdev API.
     dpaa2_cmdif
     dpaa2_qdma
     ifpga_rawdev
+    ioat_rawdev
doc/guides/rawdevs/ioat_rawdev.rst new file +63 -0

63 lines not on this page · raw message

doc/guides/rel_notes/release_19_08.rst +11 -0
index ad0ac4333..aa77348db 100644
@@ -1,6 +1,8 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright 2019 The DPDK contributors
 
+.. include:: <isonum.txt>
+
 DPDK Release 19.08
 ==================
 
@@ -118,6 +120,15 @@ New Features
   Added telemetry mode to l3fwd-power application to report
   application level busyness, empty and full polls of rte_eth_rx_burst().
 
+* **Added Intel QuickData Technology PMD**
+
+  The PMD for Intel\ |reg|  QuickData Technology, part of
+  Intel\ |reg|  I/O Acceleration Technology `(Intel I/OAT)
+  <https://www.intel.com/content/www/us/en/wireless-network/accel-technology.html>`_,
+  allows data copies to be done by hardware instead
+  of via software, reducing cycles spent copying large blocks of data in
+  applications.
+
 
 Removed Items
 -------------
drivers/raw/Makefile +1 -0
index 8e29b4a56..c1b85c8c7 100644
@@ -10,5 +10,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma
 endif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga_rawdev
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/ioat/Makefile new file +28 -0
new file mode 100644
index 000000000..7726e310a
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_ioat_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+LDLIBS += -lrte_eal -lrte_rawdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_ioat_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+
+# export include files
+SYMLINK-y-include += rte_ioat_rawdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/ioat_rawdev.c new file +113 -0

113 lines not on this page · raw message

drivers/raw/ioat/meson.build new file +8 -0
new file mode 100644
index 000000000..ba7620a68
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Intel Corporation
+
+build = dpdk_conf.has('RTE_ARCH_X86')
+sources = files('ioat_rawdev.c')
+deps += ['rawdev', 'bus_pci']
+
+install_headers('rte_ioat_rawdev.h')
drivers/raw/ioat/rte_ioat_rawdev.h new file +24 -0
new file mode 100644
index 000000000..e77406403
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IOAT_RAWDEV_H_
+#define _RTE_IOAT_RAWDEV_H_
+
+/**
+ * @file rte_ioat_rawdev.h
+ *
+ * Definitions for using the ioat rawdev device driver
+ *
+ * @warning
+ * @b EXPERIMENTAL: these structures and APIs may change without prior notice
+ */
+
+/** Name of the device driver */
+#define IOAT_PMD_RAWDEV_NAME rawdev_ioat
+/** String reported as the device driver name by rte_rawdev_info_get() */
+#define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
+/** Name used to adjust the log level for this driver */
+#define IOAT_PMD_LOG_NAME "rawdev.ioat"
+
+#endif
drivers/raw/ioat/rte_pmd_ioat_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
drivers/raw/meson.build +3 -1
index a61cdccef..2af8a70d4 100644
@@ -1,7 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 NXP
 
-drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma', 'ifpga_rawdev']
+drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
+	'ifpga_rawdev', 'ioat',
+	'skeleton_rawdev']
 std_deps = ['rawdev']
 config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV'
 driver_name_fmt = 'rte_pmd_@0@'
mk/rte.app.mk +1 -0
index 81be289a8..2a534796f 100644
@@ -306,6 +306,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV)   += -lrte_pmd_ioat_rawdev
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
 endif # !CONFIG_RTE_BUILD_SHARED_LIBS
Signature · 1 line
2.21.0
#65 lore raw

PATCH v4 3/9 usertools/dpdk-devbind.py: add support for IOAT devices

In reply to Bruce Richardson

In order to allow binding/unbinding of devices for use by the ioat_rawdev, we need to update the devbind script to add a new class of device, and add device ids for the specific HW instances.

---

V2: rather than adding a DMA section, add to "misc (rawdev)" section where
other device types, e.g. ntb can also do.

NOTE: this set largely overlaps with the equivalent changes made by the patchset adding NTB support [1]. Since it's unclear which set will be added first, this set is based off the latest head.

[1] http://patches.dpdk.org/patch/55127/

---
 doc/guides/rawdevs/ioat_rawdev.rst | 11 +++++++++++
 usertools/dpdk-devbind.py          | 10 ++++++++++
 2 files changed, 21 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 0c612e73a..1a4b0e03e 100644
@@ -61,3 +61,14 @@ configurations.
 
 For builds using ``meson`` and ``ninja``, the driver will be built when the
 target platform is x86-based.
+
+Device Setup
+-------------
+
+The Intel\ |reg| QuickData Technology HW devices will need to be bound to a
+user-space IO driver for use. The script ``dpdk-devbind.py`` script
+included with DPDK can be used to view the state of the devices and to bind
+them to a suitable DPDK-supported kernel driver. When querying the status
+of the devices, they will appear under the category of "Misc (rawdev)
+devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
+used to see the state of those devices alone.
usertools/dpdk-devbind.py +10 -0
index 9e79f0d28..5c1cd3548 100755
@@ -36,11 +36,17 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
+intel_ioat_bdw = {'Class': '08', 'Vendor': '8086', 'Device': '6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
+              'SVendor': None, 'SDevice': None}
+intel_ioat_skx = {'Class': '08', 'Vendor': '8086', 'Device': '2021',
+              'SVendor': None, 'SDevice': None}
+
 network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
+misc_devices = [intel_ioat_bdw, intel_ioat_skx]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -595,6 +601,8 @@ def show_status():
     if status_dev == "compress" or status_dev == "all":
         show_device_status(compress_devices , "Compress")
 
+    if status_dev == "misc" or status_dev == "all":
+        show_device_status(misc_devices, "Misc (rawdev)")
 
 def parse_args():
     '''Parses the command-line arguments given by the user and takes the
@@ -670,6 +678,7 @@ def do_arg_actions():
             get_device_details(eventdev_devices)
             get_device_details(mempool_devices)
             get_device_details(compress_devices)
+            get_device_details(misc_devices)
         show_status()
 
 
@@ -690,6 +699,7 @@ def main():
     get_device_details(eventdev_devices)
     get_device_details(mempool_devices)
     get_device_details(compress_devices)
+    get_device_details(misc_devices)
     do_arg_actions()
 
 if __name__ == "__main__":
Signature · 1 line
2.21.0
#66 lore raw

PATCH v4 4/9 raw/ioat: add register definition file

In reply to Bruce Richardson

Add in the list of registers for the device. File is taken from the SPDK project:

https://github.com/spdk/spdk/blob/master/include/spdk/ioat_spec.h

---
 drivers/raw/ioat/Makefile        |   1 +
 drivers/raw/ioat/meson.build     |   3 +-
 drivers/raw/ioat/rte_ioat_spec.h | 301 +++++++++++++++++++++++++++++++
 3 files changed, 304 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
drivers/raw/ioat/Makefile +1 -0
index 7726e310a..1e10938f3 100644
@@ -24,5 +24,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
+SYMLINK-y-include += rte_ioat_spec.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/meson.build +2 -1
index ba7620a68..ca23e23fc 100644
@@ -5,4 +5,5 @@ build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c')
 deps += ['rawdev', 'bus_pci']
 
-install_headers('rte_ioat_rawdev.h')
+install_headers('rte_ioat_rawdev.h',
+		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_spec.h new file +301 -0

301 lines not on this page · raw message

Signature · 1 line
2.21.0
#67 lore raw

PATCH v4 5/9 raw/ioat: create device on probe and destroy on release

In reply to Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---
V4:
* changed error code for pmd allocation to ENOMEM instead of EINVAL
* Use contiguous memory for device structure allocation

---
 doc/guides/rawdevs/ioat_rawdev.rst |  11 +++
 drivers/raw/ioat/ioat_rawdev.c     | 112 ++++++++++++++++++++++++++++-
 drivers/raw/ioat/rte_ioat_rawdev.h |  24 +++++++
 3 files changed, 144 insertions(+), 3 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 1a4b0e03e..4b7fe8a8f 100644
@@ -72,3 +72,14 @@ them to a suitable DPDK-supported kernel driver. When querying the status
 of the devices, they will appear under the category of "Misc (rawdev)
 devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
 used to see the state of those devices alone.
+
+Device Probing and Initialization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Once bound to a suitable kernel device driver, the HW devices will be found
+as part of the PCI scan done at application initialization time. No vdev
+parameters need to be passed to create or initialize the device.
+
+Once probed successfully, the device will appear as a ``rawdev``, that is a
+"raw device type" inside DPDK, and can be accessed using APIs from the
+``rte_rawdev`` library.
drivers/raw/ioat/ioat_rawdev.c +109 -3

130 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +24 -0
index e77406403..f83d26ef0 100644
@@ -14,6 +14,10 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_ioat_spec.h>
+
 /** Name of the device driver */
 #define IOAT_PMD_RAWDEV_NAME rawdev_ioat
 /** String reported as the device driver name by rte_rawdev_info_get() */
@@ -21,4 +25,24 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * @internal
+ * Structure representing a device instance
+ */
+struct rte_ioat_rawdev {
+	struct rte_rawdev *rawdev;
+	const struct rte_memzone *mz;
+	const struct rte_memzone *desc_mz;
+
+	volatile struct rte_ioat_registers *regs;
+	phys_addr_t status_addr;
+	phys_addr_t ring_addr;
+
+	unsigned short ring_size;
+	struct rte_ioat_generic_hw_desc *desc_ring;
+
+	/* to report completions, the device will write status back here */
+	volatile uint64_t status __rte_cache_aligned;
+};
+
 #endif
Signature · 1 line
2.21.0
Acked-by on v4 5/9
#68 lore raw

Re: [dpdk-dev] [PATCH v4 5/9] raw/ioat: create device on probe and destroy on release

Quoted 11 lines · Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---
V4:
* changed error code for pmd allocation to ENOMEM instead of EINVAL
* Use contiguous memory for device structure allocation
---

Signature · 2 lines
Thanks,
Anatoly
#69 lore raw

PATCH v4 6/9 raw/ioat: add device info function

In reply to Bruce Richardson

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---
V4: Use TEST_SUCCESS in place of 0, when returning from test case.
Minor documentation updates.

V2: Test case is placed in driver self-test routine

---
 app/test/test_rawdev.c             | 11 ++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
 4 files changed, 67 insertions(+)
app/test/test_rawdev.c +11 -0
index 88549fb61..623117af9 100644
@@ -29,6 +29,17 @@ REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
 static int
 test_rawdev_selftest_ioat(void)
 {
+	const int count = rte_rawdev_count();
+	int i;
+
+	for (i = 0; i < count; i++) {
+		struct rte_rawdev_info info = { .dev_private = NULL };
+		if (rte_rawdev_info_get(i, &info) == 0 &&
+				strstr(info.driver_name, "ioat") != NULL)
+			return TEST_SUCCESS;
+	}
+
+	printf("No IOAT rawdev found, skipping tests\n");
 	return TEST_SKIPPED;
 }
 
doc/guides/rawdevs/ioat_rawdev.rst +34 -0
index 4b7fe8a8f..efed9c64c 100644
@@ -83,3 +83,37 @@ parameters need to be passed to create or initialize the device.
 Once probed successfully, the device will appear as a ``rawdev``, that is a
 "raw device type" inside DPDK, and can be accessed using APIs from the
 ``rte_rawdev`` library.
+
+Using IOAT Rawdev Devices
+--------------------------
+
+To use the devices from an application, the rawdev API can be used, along
+with definitions taken from the device-specific header file
+``rte_ioat_rawdev.h``. This header is needed to get the definition of
+structure parameters used by some of the rawdev APIs for IOAT rawdev
+devices, as well as providing key functions for using the device for memory
+copies.
+
+Getting Device Information
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic information about each rawdev device can be queried using the
+``rte_rawdev_info_get()`` API. For most applications, this API will be
+needed to verify that the rawdev in question is of the expected type. For
+example, the following code snippet can be used to identify an IOAT
+rawdev device for use by an application:
+
+.. code-block:: C
+
+        for (i = 0; i < count && !found; i++) {
+                struct rte_rawdev_info info = { .dev_private = NULL };
+                found = (rte_rawdev_info_get(i, &info) == 0 &&
+                                strcmp(info.driver_name,
+                                                IOAT_PMD_RAWDEV_NAME_STR) == 0);
+        }
+
+When calling the ``rte_rawdev_info_get()`` API for an IOAT rawdev device,
+the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
+be NULL, or else be set to point to a structure of type
+``rte_ioat_rawdev_config``, in which case the size of the configured device
+input ring will be returned in that structure.
drivers/raw/ioat/ioat_rawdev.c +11 -0
index 86b5b2a77..2bfe2544d 100644
@@ -34,10 +34,21 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+static void
+ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (cfg != NULL)
+		cfg->ring_size = ioat->ring_size;
+}
+
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_info_get = ioat_dev_info_get,
 	};
 
 	struct rte_rawdev *rawdev = NULL;
drivers/raw/ioat/rte_ioat_rawdev.h +11 -0
index f83d26ef0..1d0dbdd2e 100644
@@ -25,6 +25,17 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * Configuration structure for an ioat rawdev instance
+ *
+ * This structure is to be passed as the ".dev_private" parameter when
+ * calling the rte_rawdev_get_info() and rte_rawdev_configure() APIs on
+ * an ioat rawdev instance.
+ */
+struct rte_ioat_rawdev_config {
+	unsigned short ring_size;
+};
+
 /**
  * @internal
  * Structure representing a device instance
Signature · 1 line
2.21.0
#70 lore raw

Re: [dpdk-dev] [PATCH v4 6/9] raw/ioat: add device info function

Quoted 37 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Monday, July 1, 2019 11:56 PM
To: [email protected]
Cc: [email protected]; [email protected]; Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v4 6/9] raw/ioat: add device info function

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---
V4: Use TEST_SUCCESS in place of 0, when returning from test case.
Minor documentation updates.

V2: Test case is placed in driver self-test routine

---
 app/test/test_rawdev.c             | 11 ++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 34
++++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
 4 files changed, 67 insertions(+)
drivers/raw/ioat/ioat_rawdev.c +0 -0
index 86b5b2a77..2bfe2544d 100644
@@ -34,10 +34,21 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ##
 args)

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 46

Quoted 10 lines
drivers/raw/ioat/ioat_rawdev.c +9 -0
 
+static void
+ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (cfg != NULL)
+		cfg->ring_size = ioat->ring_size;
+}

The CBDMA user may want to know the maximum copy length that the device supports and the NUMA location of the device. So can ioat_dev_info_get() return more device information?

Thanks,
Jiayu

#71 lore raw

Re: [dpdk-dev] [PATCH v4 6/9] raw/ioat: add device info function

Quoted 38 lines · Jiayu
Quoted 38 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Monday, July 1, 2019 11:56 PM
To: [email protected]
Cc: [email protected]; [email protected]; Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v4 6/9] raw/ioat: add device info function

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---
V4: Use TEST_SUCCESS in place of 0, when returning from test case.
Minor documentation updates.

V2: Test case is placed in driver self-test routine

---
 app/test/test_rawdev.c             | 11 ++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 34
++++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
 4 files changed, 67 insertions(+)
drivers/raw/ioat/ioat_rawdev.c +0 -0
index 86b5b2a77..2bfe2544d 100644
@@ -34,10 +34,21 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ##
 args)
 
Quoted 14 lines

drivers/raw/ioat/ioat_rawdev.c static struct rte_pci_driver ioat_pmd_drv; · line 45

Quoted 9 lines
drivers/raw/ioat/ioat_rawdev.c +9 -0
+static void
+ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (cfg != NULL)
+		cfg->ring_size = ioat->ring_size;
+}

The CBDMA user may want to know the maximum copy length that the device supports and the NUMA location of the device. So can ioat_dev_info_get() return more device information?

The NUMA node id is already part of the rawdev info structure returned to the user.

As for maximum copy length, yes, that could be added. However, since it's actually a characteristic of the hardware, it could be just a define inside the header file rather than needing to be returned per instance. Unlike with ethdevs and cryptodevs, rawdevs always have a device-specific dependency so using defines from the header should work fine, and not everything needs to come via dev_info.

Regards,
/Bruce

Acked-by on v4 6/9
#72 lore raw

Re: [dpdk-dev] [PATCH v4 6/9] raw/ioat: add device info function

In reply to Bruce Richardson
Quoted 4 lines · Bruce Richardson

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

Quoted 8 lines

---
V4: Use TEST_SUCCESS in place of 0, when returning from test case.
Minor documentation updates.

V2: Test case is placed in driver self-test routine
---

Signature · 2 lines
Thanks,
Anatoly
#73 lore raw

PATCH v4 7/9 raw/ioat: add configure, start and stop functions

In reply to Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

---

V4: Guarantee correct SUCCESS/FAILURE return values from test function
Use memzone rather than malloc for ring allocation so we can guarantee contiguous memory.
V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h
V2: test cases placed in self-test routine

---
 app/test/test_rawdev.c              |  3 +-
 doc/guides/rawdevs/ioat_rawdev.rst  | 32 +++++++++++
 drivers/raw/ioat/Makefile           |  1 +
 drivers/raw/ioat/ioat_rawdev.c      | 82 +++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 41 +++++++++++++++
 drivers/raw/ioat/meson.build        |  3 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  |  2 +
 7 files changed, 162 insertions(+), 2 deletions(-)
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
app/test/test_rawdev.c +2 -1
index 623117af9..524a9d5f3 100644
@@ -36,7 +36,8 @@ test_rawdev_selftest_ioat(void)
 		struct rte_rawdev_info info = { .dev_private = NULL };
 		if (rte_rawdev_info_get(i, &info) == 0 &&
 				strstr(info.driver_name, "ioat") != NULL)
-			return TEST_SUCCESS;
+			return rte_rawdev_selftest(i) == 0 ?
+					TEST_SUCCESS : TEST_FAILED;
 	}
 
 	printf("No IOAT rawdev found, skipping tests\n");
doc/guides/rawdevs/ioat_rawdev.rst +32 -0
index efed9c64c..a0594d2cb 100644
@@ -117,3 +117,35 @@ the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
 be NULL, or else be set to point to a structure of type
 ``rte_ioat_rawdev_config``, in which case the size of the configured device
 input ring will be returned in that structure.
+
+Device Configuration
+~~~~~~~~~~~~~~~~~~~~~
+
+Configuring an IOAT rawdev device is done using the
+``rte_rawdev_configure()`` API, which takes the same structure parameters
+as the, previously referenced, ``rte_rawdev_info_get()`` API. The main
+difference is that, because the parameter is used as input rather than
+output, the ``dev_private`` structure element cannot be NULL, and must
+point to a valid ``rte_ioat_rawdev_config`` structure, containing the ring
+size to be used by the device. The ring size must be a power of two,
+between 64 and 4096.
+
+The following code shows how the device is configured in
+``test_ioat_rawdev.c``:
+
+.. code-block:: C
+
+   #define IOAT_TEST_RINGSIZE 512
+        struct rte_ioat_rawdev_config p = { .ring_size = -1 };
+        struct rte_rawdev_info info = { .dev_private = &p };
+
+        /* ... */
+
+        p.ring_size = IOAT_TEST_RINGSIZE;
+        if (rte_rawdev_configure(dev_id, &info) != 0) {
+                printf("Error with rte_rawdev_configure()\n");
+                return -1;
+        }
+
+Once configured, the device can then be made ready for use by calling the
+``rte_rawdev_start()`` API.
drivers/raw/ioat/Makefile +1 -0
index 1e10938f3..b1af9c666 100644
@@ -21,6 +21,7 @@ EXPORT_MAP := rte_pmd_ioat_version.map
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev_test.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
drivers/raw/ioat/ioat_rawdev.c +82 -0

105 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c new file +41 -0

41 lines not on this page · raw message

drivers/raw/ioat/meson.build +2 -1
index ca23e23fc..40fff6654 100644
@@ -2,7 +2,8 @@
 # Copyright 2019 Intel Corporation
 
 build = dpdk_conf.has('RTE_ARCH_X86')
-sources = files('ioat_rawdev.c')
+sources = files('ioat_rawdev.c',
+		'ioat_rawdev_test.c')
 deps += ['rawdev', 'bus_pci']
 
 install_headers('rte_ioat_rawdev.h',
drivers/raw/ioat/rte_ioat_rawdev.h +2 -0
index 1d0dbdd2e..f2cf98cd9 100644
@@ -14,6 +14,7 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <x86intrin.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_ioat_spec.h>
@@ -51,6 +52,7 @@ struct rte_ioat_rawdev {
 
 	unsigned short ring_size;
 	struct rte_ioat_generic_hw_desc *desc_ring;
+	__m128i *hdls; /* completion handles for returning to user */
 
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
Signature · 1 line
2.21.0
Acked-by on v4 7/9
#74 lore raw

Re: [dpdk-dev] [PATCH v4 7/9] raw/ioat: add configure, start and stop functions

Quoted 13 lines · Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

---

V4: Guarantee correct SUCCESS/FAILURE return values from test function
Use memzone rather than malloc for ring allocation so we can guarantee contiguous memory.
V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h
V2: test cases placed in self-test routine
---

<snip>

drivers/raw/ioat/ioat_rawdev.c ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) · line 125

Quoted 11 lines
  static void
  ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
  {
drivers/raw/ioat/ioat_rawdev.c +2 -0
@@ -44,11 +119,17 @@ ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
  		cfg->ring_size = ioat->ring_size;
  }
 
+int ioat_rawdev_test(uint16_t dev_id);
+
  static int
  ioat_rawdev_create(const char *name, struct rte_pci_device *dev)

...and...

drivers/raw/ioat/ioat_rawdev_test.c line 9

Quoted 3 lines
drivers/raw/ioat/ioat_rawdev_test.c new file +3 -0
+
+int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
+

This looks like you're trying to avoid introducing a header file? (to my great shame, i don't quite get how would that even work...)

Otherwise,

Signature · 2 lines
Thanks,
Anatoly
#75 lore raw

Re: [dpdk-dev] [PATCH v4 7/9] raw/ioat: add configure, start and stop functions

Quoted 30 lines · Anatoly
Quoted 13 lines · Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

---

V4: Guarantee correct SUCCESS/FAILURE return values from test function
Use memzone rather than malloc for ring allocation so we can guarantee contiguous memory.
V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h
V2: test cases placed in self-test routine
---

<snip>

drivers/raw/ioat/ioat_rawdev.c ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) · line 124

Quoted 10 lines
  static void
  ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
  {
drivers/raw/ioat/ioat_rawdev.c +2 -0
@@ -44,11 +119,17 @@ ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
  		cfg->ring_size = ioat->ring_size;
  }
+int ioat_rawdev_test(uint16_t dev_id);
+
  static int
  ioat_rawdev_create(const char *name, struct rte_pci_device *dev)

...and...

Quoted 7 lines

drivers/raw/ioat/ioat_rawdev_test.c line 9

Quoted 3 lines
drivers/raw/ioat/ioat_rawdev_test.c new file +3 -0
+
+int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
+

This looks like you're trying to avoid introducing a header file? (to my great shame, i don't quite get how would that even work...)

Yes, yes I am. I fail to see the need to create a whole new header file just for a single function prototype, which can be easily stuck in the C file instead. If the scope of internal data or prototypes needed grows beyond this, then we can create an internal header to store it, but I don't foresee that happening any time soon, since things are pretty self-contained apart from these test cases.

Quoted 7 lines

Otherwise,

Signature · 2 lines
Thanks,
Anatoly
#76 lore raw

PATCH v4 8/9 raw/ioat: add statistics functions

In reply to Bruce Richardson

Add stats functions to track what is happening in the driver, and put unit tests to check those.

---
V4: pulled in memory leak fixes from next patch
V2: test cases moved to self-test routine

---
 doc/guides/rawdevs/ioat_rawdev.rst  | 14 +++++++++
 drivers/raw/ioat/ioat_rawdev.c      | 44 ++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 45 +++++++++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h  |  6 ++++
 4 files changed, 109 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +14 -0
index a0594d2cb..40210b3f9 100644
@@ -149,3 +149,17 @@ The following code shows how the device is configured in
 
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
+
+Querying Device Statistics
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The statistics from the IOAT rawdev device can be got via the xstats
+functions in the ``rte_rawdev`` library, i.e.
+``rte_rawdev_xstats_names_get()``, ``rte_rawdev_xstats_get()`` and
+``rte_rawdev_xstats_by_name_get``. The statistics returned for each device
+instance are:
+
+* ``failed_enqueues``
+* ``successful_enqueues``
+* ``copies_started``
+* ``copies_completed``
drivers/raw/ioat/ioat_rawdev.c +44 -0

62 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +45 -0

62 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +6 -0
index f2cf98cd9..d5326813c 100644
@@ -54,6 +54,12 @@ struct rte_ioat_rawdev {
 	struct rte_ioat_generic_hw_desc *desc_ring;
 	__m128i *hdls; /* completion handles for returning to user */
 
+	/* some statistics for tracking, if added/changed update xstats fns*/
+	uint64_t enqueue_failed __rte_cache_aligned;
+	uint64_t enqueued;
+	uint64_t started;
+	uint64_t completed;
+
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
 };
Signature · 1 line
2.21.0
Acked-by on v4 8/9
#77 lore raw

Re: [dpdk-dev] [PATCH v4 8/9] raw/ioat: add statistics functions

Quoted 9 lines · Bruce Richardson

Add stats functions to track what is happening in the driver, and put unit tests to check those.

---
V4: pulled in memory leak fixes from next patch
V2: test cases moved to self-test routine
---

Signature · 2 lines
Thanks,
Anatoly
#78 lore raw

PATCH v4 9/9 raw/ioat: add local API to perform copies

In reply to Bruce Richardson

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

---

V3: updated to use descriptor format in rte_ioat_spec.h
V2: test cases moved to self-test routine

---
 doc/guides/rawdevs/ioat_rawdev.rst  | 100 ++++++++++++++++
 drivers/raw/ioat/Makefile           |   1 +
 drivers/raw/ioat/ioat_rawdev_test.c | 155 ++++++++++++++++++++++++-
 drivers/raw/ioat/meson.build        |   2 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  | 169 +++++++++++++++++++++++++++-
 5 files changed, 422 insertions(+), 5 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +100 -0
index 40210b3f9..607cb5a86 100644
@@ -150,6 +150,106 @@ The following code shows how the device is configured in
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
 
+Performing Data Copies
+~~~~~~~~~~~~~~~~~~~~~~~
+
+To perform data copies using IOAT rawdev devices, the functions
+``rte_ioat_enqueue_copy()`` and ``rte_ioat_do_copies()`` should be used.
+Once copies have been completed, the completion will be reported back when
+the application calls ``rte_ioat_completed_copies()``.
+
+The ``rte_ioat_enqueue_copy()`` function enqueues a single copy to the
+device ring for copying at a later point. The parameters to that function
+include the physical addresses of both the source and destination buffers,
+as well as two "handles" to be returned to the user when the copy is
+completed. These handles can be arbitrary values, but two are provided so
+that the library can track handles for both source and destination on
+behalf of the user, e.g. virtual addresses for the buffers, or mbuf
+pointers if packet data is being copied.
+
+While the ``rte_ioat_enqueue_copy()`` function enqueues a copy operation on
+the device ring, the copy will not actually be performed until after the
+application calls the ``rte_ioat_do_copies()`` function. This function
+informs the device hardware of the elements enqueued on the ring, and the
+device will begin to process them. It is expected that, for efficiency
+reasons, a burst of operations will be enqueued to the device via multiple
+enqueue calls between calls to the ``rte_ioat_do_copies()`` function.
+
+The following code from ``test_ioat_rawdev.c`` demonstrates how to enqueue
+a burst of copies to the device and start the hardware processing of them:
+
+.. code-block:: C
+
+        struct rte_mbuf *srcs[32], *dsts[32];
+        unsigned int j;
+
+        for (i = 0; i < RTE_DIM(srcs); i++) {
+                char *src_data;
+
+                srcs[i] = rte_pktmbuf_alloc(pool);
+                dsts[i] = rte_pktmbuf_alloc(pool);
+                srcs[i]->data_len = srcs[i]->pkt_len = length;
+                dsts[i]->data_len = dsts[i]->pkt_len = length;
+                src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+                for (j = 0; j < length; j++)
+                        src_data[j] = rand() & 0xFF;
+
+                if (rte_ioat_enqueue_copy(dev_id,
+                                srcs[i]->buf_iova + srcs[i]->data_off,
+                                dsts[i]->buf_iova + dsts[i]->data_off,
+                                length,
+                                (uintptr_t)srcs[i],
+                                (uintptr_t)dsts[i],
+                                0 /* nofence */) != 1) {
+                        printf("Error with rte_ioat_enqueue_copy for buffer %u\n",
+                                        i);
+                        return -1;
+                }
+        }
+        rte_ioat_do_copies(dev_id);
+
+To retrieve information about completed copies, the API
+``rte_ioat_completed_copies()`` should be used. This API will return to the
+application a set of completion handles passed in when the relevant copies
+were enqueued.
+
+The following code from ``test_ioat_rawdev.c`` shows the test code
+retrieving information about the completed copies and validating the data
+is correct before freeing the data buffers using the returned handles:
+
+.. code-block:: C
+
+        if (rte_ioat_completed_copies(dev_id, 64, (void *)completed_src,
+                        (void *)completed_dst) != RTE_DIM(srcs)) {
+                printf("Error with rte_ioat_completed_copies\n");
+                return -1;
+        }
+        for (i = 0; i < RTE_DIM(srcs); i++) {
+                char *src_data, *dst_data;
+
+                if (completed_src[i] != srcs[i]) {
+                        printf("Error with source pointer %u\n", i);
+                        return -1;
+                }
+                if (completed_dst[i] != dsts[i]) {
+                        printf("Error with dest pointer %u\n", i);
+                        return -1;
+                }
+
+                src_data = rte_pktmbuf_mtod(srcs[i], char *);
+                dst_data = rte_pktmbuf_mtod(dsts[i], char *);
+                for (j = 0; j < length; j++)
+                        if (src_data[j] != dst_data[j]) {
+                                printf("Error with copy of packet %u, byte %u\n",
+                                                i, j);
+                                return -1;
+                        }
+                rte_pktmbuf_free(srcs[i]);
+                rte_pktmbuf_free(dsts[i]);
+        }
+
+
 Querying Device Statistics
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
drivers/raw/ioat/Makefile +1 -0
index b1af9c666..32f079845 100644
@@ -12,6 +12,7 @@ CFLAGS += $(WERROR_FLAGS)
 
 LDLIBS += -lrte_eal -lrte_rawdev
 LDLIBS += -lrte_pci -lrte_bus_pci
+LDLIBS += -lrte_mbuf -lrte_mempool
 
 # library version
 LIBABIVER := 1
drivers/raw/ioat/ioat_rawdev_test.c +152 -3

187 lines not on this page · raw message

drivers/raw/ioat/meson.build +1 -1
index 40fff6654..247ff88bf 100644
@@ -4,7 +4,7 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c',
 		'ioat_rawdev_test.c')
-deps += ['rawdev', 'bus_pci']
+deps += ['rawdev', 'bus_pci', 'mbuf']
 
 install_headers('rte_ioat_rawdev.h',
 		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_rawdev.h +168 -1

186 lines not on this page · raw message

Signature · 1 line
2.21.0
#79 lore raw
In reply to Bruce Richardson
Quoted 9 lines · Bruce Richardson

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Performing the copies in hardware can provide performance improvements for applications where the average copy size is reasonably large, e.g. 1k packets. For smaller packets, e.g. 64-256 bytes, offloading the copy may reduce performance due to the overhead of using hardware.

Apologies, forgot to mention this set has a dependency on:
http://patches.dpdk.org/project/dpdk/list/?series=5120

/Bruce

#80 lore raw

v5 cover raw/ioat: driver for Intel QuickData Technology

In reply to Bruce Richardson

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Performing the copies in hardware can provide performance improvements for applications where the average copy size is reasonably large, e.g. 1k packets. For smaller packets, e.g. 64-256 bytes, offloading the copy may reduce performance due to the overhead of using hardware.

V5:
* updated doxygen comment for internal rawdev pmd API

V4:
* changed memory management to use contiguous memzones instead of malloc memory
* added missing device ids for BDX platforms
* other misc cleanup following review (see individual patches logs)

V3:
* removed DPDK-specific structure for the descriptor format and reused the structure in the imported file rte_ioat_spec.h

V2:
* moved tests to rawdev selftest function
* some checkpatch and other small cleanups
* added extra documentation details on supported hardware
* aligned the changes to dpdk-devbind with the changes in the NTB set for consistency

Bruce Richardson (9):
rawdev: allow devices to skip extra memory allocation raw/ioat: add initial support for ioat rawdev driver usertools/dpdk-devbind.py: add support for IOAT devices raw/ioat: add register definition file raw/ioat: create device on probe and destroy on release raw/ioat: add device info function
raw/ioat: add configure, start and stop functions raw/ioat: add statistics functions
raw/ioat: add local API to perform copies

 MAINTAINERS                                 |   5 +
 app/test/test_rawdev.c                      |  20 ++
 config/common_armv8a_linux                  |   1 +
 config/common_base                          |   5 +
 config/defconfig_arm-armv7a-linuxapp-gcc    |   1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 +
 doc/guides/rawdevs/index.rst                |   1 +
 doc/guides/rawdevs/ioat_rawdev.rst          | 265 +++++++++++++++
 doc/guides/rel_notes/release_19_08.rst      |  11 +
 drivers/raw/Makefile                        |   1 +
 drivers/raw/ioat/Makefile                   |  31 ++
 drivers/raw/ioat/ioat_rawdev.c              | 356 ++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c         | 235 +++++++++++++
 drivers/raw/ioat/meson.build                |  10 +
 drivers/raw/ioat/rte_ioat_rawdev.h          | 234 +++++++++++++
 drivers/raw/ioat/rte_ioat_spec.h            | 301 +++++++++++++++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |   4 +
 drivers/raw/meson.build                     |   4 +-
 lib/librte_rawdev/rte_rawdev.c              |  11 +-
 lib/librte_rawdev/rte_rawdev_pmd.h          |   4 +-
 mk/rte.app.mk                               |   1 +
 usertools/dpdk-devbind.py                   |  10 +
 22 files changed, 1505 insertions(+), 7 deletions(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
Signature · 1 line
2.21.0
#81 lore raw

PATCH v5 1/9 rawdev: allow devices to skip extra memory allocation

Some device drivers want to allocate their own private memory, and should be allowed to do so. Therefore skip memory allocation and associated error checks if zero-length private memory is requested.

While adjusting the code for new indent level, fix incorrect error message.

---
V5: Added additional info to doxygen for allocate API

---
 lib/librte_rawdev/rte_rawdev.c     | 11 ++++++-----
 lib/librte_rawdev/rte_rawdev_pmd.h |  4 +++-
 2 files changed, 9 insertions(+), 6 deletions(-)
lib/librte_rawdev/rte_rawdev.c +6 -5
index 15de2d413..b6f1e1c77 100644
@@ -496,16 +496,17 @@ rte_rawdev_pmd_allocate(const char *name, size_t dev_priv_size, int socket_id)
 
 	rawdev = &rte_rawdevs[dev_id];
 
-	rawdev->dev_private = rte_zmalloc_socket("rawdev private",
+	if (dev_priv_size > 0) {
+		rawdev->dev_private = rte_zmalloc_socket("rawdev private",
 				     dev_priv_size,
 				     RTE_CACHE_LINE_SIZE,
 				     socket_id);
-	if (!rawdev->dev_private) {
-		RTE_RDEV_ERR("Unable to allocate memory to Skeleton dev");
-		return NULL;
+		if (!rawdev->dev_private) {
+			RTE_RDEV_ERR("Unable to allocate memory for rawdev");
+			return NULL;
+		}
 	}
 
-
 	rawdev->dev_id = dev_id;
 	rawdev->socket_id = socket_id;
 	rawdev->started = 0;
lib/librte_rawdev/rte_rawdev_pmd.h +3 -1
index aa6af4a37..cb3555ab5 100644
@@ -568,7 +568,9 @@ struct rte_rawdev_ops {
  * @param name
  *   Unique identifier name for each device
  * @param dev_private_size
- *   Private data allocated within rte_rawdev object.
+ *   Size of private data memory allocated within rte_rawdev object.
+ *   Set to 0 to disable internal memory allocation and allow for
+ *   self-allocation.
  * @param socket_id
  *   Socket to allocate resources on.
  * @return
Signature · 1 line
2.21.0
#82 lore raw

PATCH v5 2/9 raw/ioat: add initial support for ioat rawdev driver

In reply to Bruce Richardson

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

---
V4: add in missing device IDs
V3: remove unneeded whitespace change
V2: don't create a new file for unit testing, add to existing rawdev test
file, and place test cases in the driver selftest routine (added later in set)
Add new section in document about identifying hardware using lspci

---
 MAINTAINERS                                 |   5 +
 app/test/test_rawdev.c                      |   8 ++
 config/common_armv8a_linux                  |   1 +
 config/common_base                          |   5 +
 config/defconfig_arm-armv7a-linuxapp-gcc    |   1 +
 config/defconfig_ppc_64-power8-linuxapp-gcc |   1 +
 doc/guides/rawdevs/index.rst                |   1 +
 doc/guides/rawdevs/ioat_rawdev.rst          |  63 +++++++++++
 doc/guides/rel_notes/release_19_08.rst      |  11 ++
 drivers/raw/Makefile                        |   1 +
 drivers/raw/ioat/Makefile                   |  28 +++++
 drivers/raw/ioat/ioat_rawdev.c              | 113 ++++++++++++++++++++
 drivers/raw/ioat/meson.build                |   8 ++
 drivers/raw/ioat/rte_ioat_rawdev.h          |  24 +++++
 drivers/raw/ioat/rte_pmd_ioat_version.map   |   4 +
 drivers/raw/meson.build                     |   4 +-
 mk/rte.app.mk                               |   1 +
 17 files changed, 278 insertions(+), 1 deletion(-)
 create mode 100644 doc/guides/rawdevs/ioat_rawdev.rst
 create mode 100644 drivers/raw/ioat/Makefile
 create mode 100644 drivers/raw/ioat/ioat_rawdev.c
 create mode 100644 drivers/raw/ioat/meson.build
 create mode 100644 drivers/raw/ioat/rte_ioat_rawdev.h
 create mode 100644 drivers/raw/ioat/rte_pmd_ioat_version.map
MAINTAINERS +5 -0
index 97a009e43..dac4c866f 100644
@@ -1084,6 +1084,11 @@ M: Tianfei zhang <[email protected]>
 F: drivers/raw/ifpga_rawdev/
 F: doc/guides/rawdevs/ifpga_rawdev.rst
 
+IOAT Rawdev
+M: Bruce Richardson <[email protected]>
+F: drivers/raw/ioat/
+F: doc/guides/rawdevs/ioat_rawdev.rst
+
 NXP DPAA2 QDMA
 M: Nipun Gupta <[email protected]>
 F: drivers/raw/dpaa2_qdma/
app/test/test_rawdev.c +8 -0
index 043a38a13..88549fb61 100644
@@ -25,3 +25,11 @@ test_rawdev_selftest_skeleton(void)
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
+
+static int
+test_rawdev_selftest_ioat(void)
+{
+	return TEST_SKIPPED;
+}
+
+REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
config/common_armv8a_linux +1 -0
index 72091de1c..481712ebc 100644
@@ -34,5 +34,6 @@ CONFIG_RTE_ARCH_ARM64_MEMCPY=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
 
 CONFIG_RTE_SCHED_VECTOR=n
config/common_base +5 -0
index e700bf1e7..47ba94315 100644
@@ -752,6 +752,11 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV=n
 #
 CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV=y
 
+#
+# Compile PMD for Intel IOAT raw device
+#
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=y
+
 #
 # Compile librte_ring
 #
config/defconfig_arm-armv7a-linuxapp-gcc +1 -0
index 562439c0b..26ab5c57d 100644
@@ -55,3 +55,4 @@ CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
 CONFIG_RTE_LIBRTE_NFP_PMD=n
 CONFIG_RTE_LIBRTE_HINIC_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
config/defconfig_ppc_64-power8-linuxapp-gcc +1 -0
index cec434563..e8dafa3b4 100644
@@ -57,3 +57,4 @@ CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
 CONFIG_RTE_LIBRTE_HINIC_PMD=n
+CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV=n
doc/guides/rawdevs/index.rst +1 -0
index 7c3bd9586..0a21989e4 100644
@@ -14,3 +14,4 @@ application through rawdev API.
     dpaa2_cmdif
     dpaa2_qdma
     ifpga_rawdev
+    ioat_rawdev
doc/guides/rawdevs/ioat_rawdev.rst new file +63 -0

63 lines not on this page · raw message

doc/guides/rel_notes/release_19_08.rst +11 -0
index 60c258136..cf796694f 100644
@@ -1,6 +1,8 @@
 ..  SPDX-License-Identifier: BSD-3-Clause
     Copyright 2019 The DPDK contributors
 
+.. include:: <isonum.txt>
+
 DPDK Release 19.08
 ==================
 
@@ -126,6 +128,15 @@ New Features
   Added telemetry mode to l3fwd-power application to report
   application level busyness, empty and full polls of rte_eth_rx_burst().
 
+* **Added Intel QuickData Technology PMD**
+
+  The PMD for Intel\ |reg|  QuickData Technology, part of
+  Intel\ |reg|  I/O Acceleration Technology `(Intel I/OAT)
+  <https://www.intel.com/content/www/us/en/wireless-network/accel-technology.html>`_,
+  allows data copies to be done by hardware instead
+  of via software, reducing cycles spent copying large blocks of data in
+  applications.
+
 
 Removed Items
 -------------
drivers/raw/Makefile +1 -0
index 8e29b4a56..c1b85c8c7 100644
@@ -10,5 +10,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_CMDIF_RAWDEV) += dpaa2_cmdif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_QDMA_RAWDEV) += dpaa2_qdma
 endif
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV) += ifpga_rawdev
+DIRS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/raw/ioat/Makefile new file +28 -0
new file mode 100644
index 000000000..7726e310a
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pmd_ioat_rawdev.a
+
+# build flags
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+LDLIBS += -lrte_eal -lrte_rawdev
+LDLIBS += -lrte_pci -lrte_bus_pci
+
+# library version
+LIBABIVER := 1
+
+# versioning export map
+EXPORT_MAP := rte_pmd_ioat_version.map
+
+# library source files
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+
+# export include files
+SYMLINK-y-include += rte_ioat_rawdev.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/ioat_rawdev.c new file +113 -0

113 lines not on this page · raw message

drivers/raw/ioat/meson.build new file +8 -0
new file mode 100644
index 000000000..ba7620a68
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Intel Corporation
+
+build = dpdk_conf.has('RTE_ARCH_X86')
+sources = files('ioat_rawdev.c')
+deps += ['rawdev', 'bus_pci']
+
+install_headers('rte_ioat_rawdev.h')
drivers/raw/ioat/rte_ioat_rawdev.h new file +24 -0
new file mode 100644
index 000000000..e77406403
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_IOAT_RAWDEV_H_
+#define _RTE_IOAT_RAWDEV_H_
+
+/**
+ * @file rte_ioat_rawdev.h
+ *
+ * Definitions for using the ioat rawdev device driver
+ *
+ * @warning
+ * @b EXPERIMENTAL: these structures and APIs may change without prior notice
+ */
+
+/** Name of the device driver */
+#define IOAT_PMD_RAWDEV_NAME rawdev_ioat
+/** String reported as the device driver name by rte_rawdev_info_get() */
+#define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat"
+/** Name used to adjust the log level for this driver */
+#define IOAT_PMD_LOG_NAME "rawdev.ioat"
+
+#endif
drivers/raw/ioat/rte_pmd_ioat_version.map new file +4 -0
new file mode 100644
index 000000000..9a61188cd
@@ -0,0 +1,4 @@
+DPDK_19.08 {
+
+	local: *;
+};
drivers/raw/meson.build +3 -1
index a61cdccef..2af8a70d4 100644
@@ -1,7 +1,9 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 NXP
 
-drivers = ['skeleton_rawdev', 'dpaa2_cmdif', 'dpaa2_qdma', 'ifpga_rawdev']
+drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
+	'ifpga_rawdev', 'ioat',
+	'skeleton_rawdev']
 std_deps = ['rawdev']
 config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV'
 driver_name_fmt = 'rte_pmd_@0@'
mk/rte.app.mk +1 -0
index 2b5696a27..d31f5d55f 100644
@@ -307,6 +307,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_IFPGA_BUS),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IFPGA_RAWDEV)   += -lrte_pmd_ifpga_rawdev
 _LDLIBS-$(CONFIG_RTE_LIBRTE_IPN3KE_PMD)       += -lrte_pmd_ipn3ke
 endif # CONFIG_RTE_LIBRTE_IFPGA_BUS
+_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV)   += -lrte_pmd_ioat_rawdev
 endif # CONFIG_RTE_LIBRTE_RAWDEV
 
 endif # !CONFIG_RTE_BUILD_SHARED_LIBS
Signature · 1 line
2.21.0
Acked-by on v5 2/9
#83 lore raw

Re: [dpdk-dev] [PATCH v5 2/9] raw/ioat: add initial support for ioat rawdev driver

Quoted 24 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, July 2, 2019 10:12 PM
To: [email protected]
Cc: Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Burakov, Anatoly <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v5 2/9] raw/ioat: add initial support for ioat rawdev driver

Add stubs for ioat rawdev driver support in DPDK, specifically:

* makefile and meson build hooks
* initial public header file
* rawdev main C file, with probe and release functions
* release note update announcing the driver
* initial documentation for the new section in the rawdev doc
* unit test stubs for device unit tests

Quoted 9 lines

---
V4: add in missing device IDs
V3: remove unneeded whitespace change
V2: don't create a new file for unit testing, add to existing rawdev test
file, and place test cases in the driver selftest routine (added later in set)
Add new section in document about identifying hardware using lspci
---

#84 lore raw

PATCH v5 3/9 usertools/dpdk-devbind.py: add support for IOAT devices

In reply to Bruce Richardson

In order to allow binding/unbinding of devices for use by the ioat_rawdev, we need to update the devbind script to add a new class of device, and add device ids for the specific HW instances.

---

V2: rather than adding a DMA section, add to "misc (rawdev)" section where
other device types, e.g. ntb can also do.

NOTE: this set largely overlaps with the equivalent changes made by the patchset adding NTB support [1]. Since it's unclear which set will be added first, this set is based off the latest head.

[1] http://patches.dpdk.org/patch/55127/

---
 doc/guides/rawdevs/ioat_rawdev.rst | 11 +++++++++++
 usertools/dpdk-devbind.py          | 10 ++++++++++
 2 files changed, 21 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 0c612e73a..1a4b0e03e 100644
@@ -61,3 +61,14 @@ configurations.
 
 For builds using ``meson`` and ``ninja``, the driver will be built when the
 target platform is x86-based.
+
+Device Setup
+-------------
+
+The Intel\ |reg| QuickData Technology HW devices will need to be bound to a
+user-space IO driver for use. The script ``dpdk-devbind.py`` script
+included with DPDK can be used to view the state of the devices and to bind
+them to a suitable DPDK-supported kernel driver. When querying the status
+of the devices, they will appear under the category of "Misc (rawdev)
+devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
+used to see the state of those devices alone.
usertools/dpdk-devbind.py +10 -0
index 9e79f0d28..5c1cd3548 100755
@@ -36,11 +36,17 @@
 octeontx2_npa = {'Class': '08', 'Vendor': '177d', 'Device': 'a0fb,a0fc',
               'SVendor': None, 'SDevice': None}
 
+intel_ioat_bdw = {'Class': '08', 'Vendor': '8086', 'Device': '6f20,6f21,6f22,6f23,6f24,6f25,6f26,6f27,6f2e,6f2f',
+              'SVendor': None, 'SDevice': None}
+intel_ioat_skx = {'Class': '08', 'Vendor': '8086', 'Device': '2021',
+              'SVendor': None, 'SDevice': None}
+
 network_devices = [network_class, cavium_pkx, avp_vnic, ifpga_class]
 crypto_devices = [encryption_class, intel_processor_class]
 eventdev_devices = [cavium_sso, cavium_tim, octeontx2_sso]
 mempool_devices = [cavium_fpa, octeontx2_npa]
 compress_devices = [cavium_zip]
+misc_devices = [intel_ioat_bdw, intel_ioat_skx]
 
 # global dict ethernet devices present. Dictionary indexed by PCI address.
 # Each device within this is itself a dictionary of device properties
@@ -595,6 +601,8 @@ def show_status():
     if status_dev == "compress" or status_dev == "all":
         show_device_status(compress_devices , "Compress")
 
+    if status_dev == "misc" or status_dev == "all":
+        show_device_status(misc_devices, "Misc (rawdev)")
 
 def parse_args():
     '''Parses the command-line arguments given by the user and takes the
@@ -670,6 +678,7 @@ def do_arg_actions():
             get_device_details(eventdev_devices)
             get_device_details(mempool_devices)
             get_device_details(compress_devices)
+            get_device_details(misc_devices)
         show_status()
 
 
@@ -690,6 +699,7 @@ def main():
     get_device_details(eventdev_devices)
     get_device_details(mempool_devices)
     get_device_details(compress_devices)
+    get_device_details(misc_devices)
     do_arg_actions()
 
 if __name__ == "__main__":
Signature · 1 line
2.21.0
Acked-by on v5 3/9
#85 lore raw

Re: [dpdk-dev] [PATCH v5 3/9] usertools/dpdk-devbind.py: add support for IOAT devices

Quoted 17 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, July 2, 2019 10:12 PM
To: [email protected]
Cc: Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Burakov, Anatoly <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v5 3/9] usertools/dpdk-devbind.py: add support for IOAT devices

In order to allow binding/unbinding of devices for use by the ioat_rawdev, we need to update the devbind script to add a new class of device, and add device ids for the specific HW instances.

Quoted 9 lines

---

V2: rather than adding a DMA section, add to "misc (rawdev)" section where
other device types, e.g. ntb can also do.

#86 lore raw

PATCH v5 4/9 raw/ioat: add register definition file

In reply to Bruce Richardson

Add in the list of registers for the device. File is taken from the SPDK project:

https://github.com/spdk/spdk/blob/master/include/spdk/ioat_spec.h

---
 drivers/raw/ioat/Makefile        |   1 +
 drivers/raw/ioat/meson.build     |   3 +-
 drivers/raw/ioat/rte_ioat_spec.h | 301 +++++++++++++++++++++++++++++++
 3 files changed, 304 insertions(+), 1 deletion(-)
 create mode 100644 drivers/raw/ioat/rte_ioat_spec.h
drivers/raw/ioat/Makefile +1 -0
index 7726e310a..1e10938f3 100644
@@ -24,5 +24,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
+SYMLINK-y-include += rte_ioat_spec.h
 
 include $(RTE_SDK)/mk/rte.lib.mk
drivers/raw/ioat/meson.build +2 -1
index ba7620a68..ca23e23fc 100644
@@ -5,4 +5,5 @@ build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c')
 deps += ['rawdev', 'bus_pci']
 
-install_headers('rte_ioat_rawdev.h')
+install_headers('rte_ioat_rawdev.h',
+		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_spec.h new file +301 -0

301 lines not on this page · raw message

Signature · 1 line
2.21.0
#87 lore raw

PATCH v5 5/9 raw/ioat: create device on probe and destroy on release

In reply to Bruce Richardson

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---
V4:
* changed error code for pmd allocation to ENOMEM instead of EINVAL
* Use contiguous memory for device structure allocation

---
 doc/guides/rawdevs/ioat_rawdev.rst |  11 +++
 drivers/raw/ioat/ioat_rawdev.c     | 112 ++++++++++++++++++++++++++++-
 drivers/raw/ioat/rte_ioat_rawdev.h |  24 +++++++
 3 files changed, 144 insertions(+), 3 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +11 -0
index 1a4b0e03e..4b7fe8a8f 100644
@@ -72,3 +72,14 @@ them to a suitable DPDK-supported kernel driver. When querying the status
 of the devices, they will appear under the category of "Misc (rawdev)
 devices", i.e. the command ``dpdk-devbind.py --status-dev misc`` can be
 used to see the state of those devices alone.
+
+Device Probing and Initialization
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Once bound to a suitable kernel device driver, the HW devices will be found
+as part of the PCI scan done at application initialization time. No vdev
+parameters need to be passed to create or initialize the device.
+
+Once probed successfully, the device will appear as a ``rawdev``, that is a
+"raw device type" inside DPDK, and can be accessed using APIs from the
+``rte_rawdev`` library.
drivers/raw/ioat/ioat_rawdev.c +109 -3

130 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +24 -0
index e77406403..f83d26ef0 100644
@@ -14,6 +14,10 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_ioat_spec.h>
+
 /** Name of the device driver */
 #define IOAT_PMD_RAWDEV_NAME rawdev_ioat
 /** String reported as the device driver name by rte_rawdev_info_get() */
@@ -21,4 +25,24 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * @internal
+ * Structure representing a device instance
+ */
+struct rte_ioat_rawdev {
+	struct rte_rawdev *rawdev;
+	const struct rte_memzone *mz;
+	const struct rte_memzone *desc_mz;
+
+	volatile struct rte_ioat_registers *regs;
+	phys_addr_t status_addr;
+	phys_addr_t ring_addr;
+
+	unsigned short ring_size;
+	struct rte_ioat_generic_hw_desc *desc_ring;
+
+	/* to report completions, the device will write status back here */
+	volatile uint64_t status __rte_cache_aligned;
+};
+
 #endif
Signature · 1 line
2.21.0
Acked-by on v5 5/9
#88 lore raw

Re: [dpdk-dev] [PATCH v5 5/9] raw/ioat: create device on probe and destroy on release

Quoted 19 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, July 2, 2019 10:12 PM
To: [email protected]
Cc: Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Burakov, Anatoly <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v5 5/9] raw/ioat: create device on probe and destroy on release

Add the create/destroy driver functions so that we can actually allocate a rawdev and destroy it when done. No rawdev API functions are actually implemented at this point.

---

#89 lore raw

PATCH v5 6/9 raw/ioat: add device info function

In reply to Bruce Richardson

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---

V2: Test case is placed in driver self-test routine
V4: Use TEST_SUCCESS in place of 0, when returning from test case.
Minor documentation updates.

---
 app/test/test_rawdev.c             | 11 ++++++++++
 doc/guides/rawdevs/ioat_rawdev.rst | 34 ++++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c     | 11 ++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h | 11 ++++++++++
 4 files changed, 67 insertions(+)
app/test/test_rawdev.c +11 -0
index 88549fb61..623117af9 100644
@@ -29,6 +29,17 @@ REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
 static int
 test_rawdev_selftest_ioat(void)
 {
+	const int count = rte_rawdev_count();
+	int i;
+
+	for (i = 0; i < count; i++) {
+		struct rte_rawdev_info info = { .dev_private = NULL };
+		if (rte_rawdev_info_get(i, &info) == 0 &&
+				strstr(info.driver_name, "ioat") != NULL)
+			return TEST_SUCCESS;
+	}
+
+	printf("No IOAT rawdev found, skipping tests\n");
 	return TEST_SKIPPED;
 }
 
doc/guides/rawdevs/ioat_rawdev.rst +34 -0
index 4b7fe8a8f..efed9c64c 100644
@@ -83,3 +83,37 @@ parameters need to be passed to create or initialize the device.
 Once probed successfully, the device will appear as a ``rawdev``, that is a
 "raw device type" inside DPDK, and can be accessed using APIs from the
 ``rte_rawdev`` library.
+
+Using IOAT Rawdev Devices
+--------------------------
+
+To use the devices from an application, the rawdev API can be used, along
+with definitions taken from the device-specific header file
+``rte_ioat_rawdev.h``. This header is needed to get the definition of
+structure parameters used by some of the rawdev APIs for IOAT rawdev
+devices, as well as providing key functions for using the device for memory
+copies.
+
+Getting Device Information
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Basic information about each rawdev device can be queried using the
+``rte_rawdev_info_get()`` API. For most applications, this API will be
+needed to verify that the rawdev in question is of the expected type. For
+example, the following code snippet can be used to identify an IOAT
+rawdev device for use by an application:
+
+.. code-block:: C
+
+        for (i = 0; i < count && !found; i++) {
+                struct rte_rawdev_info info = { .dev_private = NULL };
+                found = (rte_rawdev_info_get(i, &info) == 0 &&
+                                strcmp(info.driver_name,
+                                                IOAT_PMD_RAWDEV_NAME_STR) == 0);
+        }
+
+When calling the ``rte_rawdev_info_get()`` API for an IOAT rawdev device,
+the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
+be NULL, or else be set to point to a structure of type
+``rte_ioat_rawdev_config``, in which case the size of the configured device
+input ring will be returned in that structure.
drivers/raw/ioat/ioat_rawdev.c +11 -0
index 86b5b2a77..2bfe2544d 100644
@@ -34,10 +34,21 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+static void
+ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
+{
+	struct rte_ioat_rawdev_config *cfg = dev_info;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (cfg != NULL)
+		cfg->ring_size = ioat->ring_size;
+}
+
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_info_get = ioat_dev_info_get,
 	};
 
 	struct rte_rawdev *rawdev = NULL;
drivers/raw/ioat/rte_ioat_rawdev.h +11 -0
index f83d26ef0..1d0dbdd2e 100644
@@ -25,6 +25,17 @@
 /** Name used to adjust the log level for this driver */
 #define IOAT_PMD_LOG_NAME "rawdev.ioat"
 
+/**
+ * Configuration structure for an ioat rawdev instance
+ *
+ * This structure is to be passed as the ".dev_private" parameter when
+ * calling the rte_rawdev_get_info() and rte_rawdev_configure() APIs on
+ * an ioat rawdev instance.
+ */
+struct rte_ioat_rawdev_config {
+	unsigned short ring_size;
+};
+
 /**
  * @internal
  * Structure representing a device instance
Signature · 1 line
2.21.0
Acked-by on v5 6/9
#90 lore raw

Re: [dpdk-dev] [PATCH v5 6/9] raw/ioat: add device info function

Quoted 21 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, July 2, 2019 10:12 PM
To: [email protected]
Cc: Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Burakov, Anatoly <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v5 6/9] raw/ioat: add device info function

Add in the "info_get" function to the driver, to allow us to query the device. This allows us to have the unit test pick up the presence of supported hardware or not.

---

V2: Test case is placed in driver self-test routine
V4: Use TEST_SUCCESS in place of 0, when returning from test case.

#91 lore raw

PATCH v5 7/9 raw/ioat: add configure, start and stop functions

In reply to Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

---

V4: Guarantee correct SUCCESS/FAILURE return values from test function
Use memzone rather than malloc for ring allocation so we can guarantee contiguous memory.
V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h
V2: test cases placed in self-test routine

---
 app/test/test_rawdev.c              |  3 +-
 doc/guides/rawdevs/ioat_rawdev.rst  | 32 +++++++++++
 drivers/raw/ioat/Makefile           |  1 +
 drivers/raw/ioat/ioat_rawdev.c      | 82 +++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 41 +++++++++++++++
 drivers/raw/ioat/meson.build        |  3 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  |  2 +
 7 files changed, 162 insertions(+), 2 deletions(-)
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
app/test/test_rawdev.c +2 -1
index 623117af9..524a9d5f3 100644
@@ -36,7 +36,8 @@ test_rawdev_selftest_ioat(void)
 		struct rte_rawdev_info info = { .dev_private = NULL };
 		if (rte_rawdev_info_get(i, &info) == 0 &&
 				strstr(info.driver_name, "ioat") != NULL)
-			return TEST_SUCCESS;
+			return rte_rawdev_selftest(i) == 0 ?
+					TEST_SUCCESS : TEST_FAILED;
 	}
 
 	printf("No IOAT rawdev found, skipping tests\n");
doc/guides/rawdevs/ioat_rawdev.rst +32 -0
index efed9c64c..a0594d2cb 100644
@@ -117,3 +117,35 @@ the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
 be NULL, or else be set to point to a structure of type
 ``rte_ioat_rawdev_config``, in which case the size of the configured device
 input ring will be returned in that structure.
+
+Device Configuration
+~~~~~~~~~~~~~~~~~~~~~
+
+Configuring an IOAT rawdev device is done using the
+``rte_rawdev_configure()`` API, which takes the same structure parameters
+as the, previously referenced, ``rte_rawdev_info_get()`` API. The main
+difference is that, because the parameter is used as input rather than
+output, the ``dev_private`` structure element cannot be NULL, and must
+point to a valid ``rte_ioat_rawdev_config`` structure, containing the ring
+size to be used by the device. The ring size must be a power of two,
+between 64 and 4096.
+
+The following code shows how the device is configured in
+``test_ioat_rawdev.c``:
+
+.. code-block:: C
+
+   #define IOAT_TEST_RINGSIZE 512
+        struct rte_ioat_rawdev_config p = { .ring_size = -1 };
+        struct rte_rawdev_info info = { .dev_private = &p };
+
+        /* ... */
+
+        p.ring_size = IOAT_TEST_RINGSIZE;
+        if (rte_rawdev_configure(dev_id, &info) != 0) {
+                printf("Error with rte_rawdev_configure()\n");
+                return -1;
+        }
+
+Once configured, the device can then be made ready for use by calling the
+``rte_rawdev_start()`` API.
drivers/raw/ioat/Makefile +1 -0
index 1e10938f3..b1af9c666 100644
@@ -21,6 +21,7 @@ EXPORT_MAP := rte_pmd_ioat_version.map
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev_test.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
drivers/raw/ioat/ioat_rawdev.c +82 -0

105 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c new file +41 -0

41 lines not on this page · raw message

drivers/raw/ioat/meson.build +2 -1
index ca23e23fc..40fff6654 100644
@@ -2,7 +2,8 @@
 # Copyright 2019 Intel Corporation
 
 build = dpdk_conf.has('RTE_ARCH_X86')
-sources = files('ioat_rawdev.c')
+sources = files('ioat_rawdev.c',
+		'ioat_rawdev_test.c')
 deps += ['rawdev', 'bus_pci']
 
 install_headers('rte_ioat_rawdev.h',
drivers/raw/ioat/rte_ioat_rawdev.h +2 -0
index 1d0dbdd2e..f2cf98cd9 100644
@@ -14,6 +14,7 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <x86intrin.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_ioat_spec.h>
@@ -51,6 +52,7 @@ struct rte_ioat_rawdev {
 
 	unsigned short ring_size;
 	struct rte_ioat_generic_hw_desc *desc_ring;
+	__m128i *hdls; /* completion handles for returning to user */
 
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
Signature · 1 line
2.21.0
Acked-by on v5 7/9
#92 lore raw

Re: [dpdk-dev] [PATCH v5 7/9] raw/ioat: add configure, start and stop functions

Quoted 18 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, July 2, 2019 10:12 PM
To: [email protected]
Cc: Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Burakov, Anatoly <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v5 7/9] raw/ioat: add configure, start and stop functions

Allow initializing a driver instance. Include selftest to validate these functions.

---

#93 lore raw

Re: [dpdk-dev] [PATCH v5 7/9] raw/ioat: add configure, start and stop functions

In reply to Bruce Richardson
Quoted 177 lines · Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

---

V4: Guarantee correct SUCCESS/FAILURE return values from test function
Use memzone rather than malloc for ring allocation so we can guarantee contiguous memory.
V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h
V2: test cases placed in self-test routine

---
 app/test/test_rawdev.c              |  3 +-
 doc/guides/rawdevs/ioat_rawdev.rst  | 32 +++++++++++
 drivers/raw/ioat/Makefile           |  1 +
 drivers/raw/ioat/ioat_rawdev.c      | 82 +++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 41 +++++++++++++++
 drivers/raw/ioat/meson.build        |  3 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  |  2 +
 7 files changed, 162 insertions(+), 2 deletions(-)
 create mode 100644 drivers/raw/ioat/ioat_rawdev_test.c
app/test/test_rawdev.c +2 -1
index 623117af9..524a9d5f3 100644
@@ -36,7 +36,8 @@ test_rawdev_selftest_ioat(void)
 		struct rte_rawdev_info info = { .dev_private = NULL };
 		if (rte_rawdev_info_get(i, &info) == 0 &&
 				strstr(info.driver_name, "ioat") != NULL)
-			return TEST_SUCCESS;
+			return rte_rawdev_selftest(i) == 0 ?
+					TEST_SUCCESS : TEST_FAILED;
 	}
 
 	printf("No IOAT rawdev found, skipping tests\n");
doc/guides/rawdevs/ioat_rawdev.rst +32 -0
index efed9c64c..a0594d2cb 100644
@@ -117,3 +117,35 @@ the ``dev_private`` field in the ``rte_rawdev_info`` struct should either
 be NULL, or else be set to point to a structure of type
 ``rte_ioat_rawdev_config``, in which case the size of the configured device
 input ring will be returned in that structure.
+
+Device Configuration
+~~~~~~~~~~~~~~~~~~~~~
+
+Configuring an IOAT rawdev device is done using the
+``rte_rawdev_configure()`` API, which takes the same structure parameters
+as the, previously referenced, ``rte_rawdev_info_get()`` API. The main
+difference is that, because the parameter is used as input rather than
+output, the ``dev_private`` structure element cannot be NULL, and must
+point to a valid ``rte_ioat_rawdev_config`` structure, containing the ring
+size to be used by the device. The ring size must be a power of two,
+between 64 and 4096.
+
+The following code shows how the device is configured in
+``test_ioat_rawdev.c``:
+
+.. code-block:: C
+
+   #define IOAT_TEST_RINGSIZE 512
+        struct rte_ioat_rawdev_config p = { .ring_size = -1 };
+        struct rte_rawdev_info info = { .dev_private = &p };
+
+        /* ... */
+
+        p.ring_size = IOAT_TEST_RINGSIZE;
+        if (rte_rawdev_configure(dev_id, &info) != 0) {
+                printf("Error with rte_rawdev_configure()\n");
+                return -1;
+        }
+
+Once configured, the device can then be made ready for use by calling the
+``rte_rawdev_start()`` API.
drivers/raw/ioat/Makefile +1 -0
index 1e10938f3..b1af9c666 100644
@@ -21,6 +21,7 @@ EXPORT_MAP := rte_pmd_ioat_version.map
 
 # library source files
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) += ioat_rawdev_test.c
 
 # export include files
 SYMLINK-y-include += rte_ioat_rawdev.h
drivers/raw/ioat/ioat_rawdev.c +75 -0
index 2bfe2544d..0c91b3579 100644
@@ -34,6 +34,81 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args)
 #define IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+#define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)
+#define COMPLETION_SZ sizeof(__m128i)
+
+static int
+ioat_dev_configure(const struct rte_rawdev *dev, rte_rawdev_obj_t config)
+{
+	struct rte_ioat_rawdev_config *params = config;
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+	char mz_name[RTE_MEMZONE_NAMESIZE];
+	unsigned short i;
+
+	if (dev->started)
+		return -EBUSY;
+
+	if (params == NULL)
+		return -EINVAL;
+
+	if (params->ring_size > 4096 || params->ring_size < 64 ||
+			!rte_is_power_of_2(params->ring_size))
+		return -EINVAL;
+
+	ioat->ring_size = params->ring_size;
+	if (ioat->desc_ring != NULL) {
+		rte_memzone_free(ioat->desc_mz);
+		ioat->desc_ring = NULL;
+		ioat->desc_mz = NULL;
+	}
+
+	/* allocate one block of memory for both descriptors
+	 * and completion handles.
+	 */
+	snprintf(mz_name, sizeof(mz_name), "rawdev%u_desc_ring", dev->dev_id);
+	ioat->desc_mz = rte_memzone_reserve(mz_name,
+			(DESC_SZ + COMPLETION_SZ) * ioat->ring_size,
+			dev->device->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (ioat->desc_mz == NULL)
+		return -ENOMEM;
+	ioat->desc_ring = ioat->desc_mz->addr;
+	ioat->hdls = (void *)&ioat->desc_ring[ioat->ring_size];
+
+	ioat->ring_addr = ioat->desc_mz->iova;
+
+	/* configure descriptor ring - each one points to next */
+	for (i = 0; i < ioat->ring_size; i++) {
+		ioat->desc_ring[i].next = ioat->ring_addr +
+				(((i + 1) % ioat->ring_size) * DESC_SZ);
+	}
+
+	return 0;
+}
+
+static int
+ioat_dev_start(struct rte_rawdev *dev)
+{
+	struct rte_ioat_rawdev *ioat = dev->dev_private;
+
+	if (ioat->ring_size == 0 || ioat->desc_ring == NULL)
+		return -EBUSY;
+
+	/* inform hardware of where the descriptor ring is */
+	ioat->regs->chainaddr = ioat->ring_addr;
+	/* inform hardware of where to write the status/completions */
+	ioat->regs->chancmp = ioat->status_addr;
+
+	/* prime the status register to be set to the last element */
+	ioat->status =  ioat->ring_addr + ((ioat->ring_size - 1) * DESC_SZ);
+	return 0;
+}
+
+static void
+ioat_dev_stop(struct rte_rawdev *dev)
+{
+	RTE_SET_USED(dev);
+}
+
 static void
 ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
 {

drivers/raw/ioat/ioat_rawdev.c ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) · line 123

Quoted 5 lines
drivers/raw/ioat/ioat_rawdev.c +2 -0
@@ -44,11 +119,17 @@ ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info)
 		cfg->ring_size = ioat->ring_size;
 }
 
+extern int ioat_rawdev_test(uint16_t dev_id);
+

This signature doesn't match with the rte_rawdev_ops definition (which should be int(*func)(void)).

It will generate an error as such:

../drivers/raw/ioat/ioat_rawdev.c:176:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.dev_selftest = ioat_rawdev_test,
^
../drivers/raw/ioat/ioat_rawdev.c:176:20: note: (near initialization for ‘ioat_rawdev_ops.dev_selftest’)

Quoted 101 lines
drivers/raw/ioat/ioat_rawdev.c +5 -0
 static int
 ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 {
 	static const struct rte_rawdev_ops ioat_rawdev_ops = {
+			.dev_configure = ioat_dev_configure,
+			.dev_start = ioat_dev_start,
+			.dev_stop = ioat_dev_stop,
 			.dev_info_get = ioat_dev_info_get,
+			.dev_selftest = ioat_rawdev_test,
 	};
 
 	struct rte_rawdev *rawdev = NULL;
@@ -154,6 +235,7 @@ ioat_rawdev_destroy(const char *name)
 	if (rdev->dev_private != NULL) {
 		struct rte_ioat_rawdev *ioat = rdev->dev_private;
 		rdev->dev_private = NULL;
+		rte_memzone_free(ioat->desc_mz);
 		rte_memzone_free(ioat->mz);
 	}
 
drivers/raw/ioat/ioat_rawdev_test.c new file +41 -0
new file mode 100644
index 000000000..5375da26c
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#include "rte_rawdev.h"
+#include "rte_ioat_rawdev.h"
+
+int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
+
+int
+ioat_rawdev_test(uint16_t dev_id)
+{
+#define IOAT_TEST_RINGSIZE 512
+	struct rte_ioat_rawdev_config p = { .ring_size = -1 };
+	struct rte_rawdev_info info = { .dev_private = &p };
+
+	rte_rawdev_info_get(dev_id, &info);
+	if (p.ring_size != 0) {
+		printf("Error, initial ring size is non-zero (%d)\n",
+				(int)p.ring_size);
+		return -1;
+	}
+
+	p.ring_size = IOAT_TEST_RINGSIZE;
+	if (rte_rawdev_configure(dev_id, &info) != 0) {
+		printf("Error with rte_rawdev_configure()\n");
+		return -1;
+	}
+	rte_rawdev_info_get(dev_id, &info);
+	if (p.ring_size != IOAT_TEST_RINGSIZE) {
+		printf("Error, ring size is not %d (%d)\n",
+				IOAT_TEST_RINGSIZE, (int)p.ring_size);
+		return -1;
+	}
+
+	if (rte_rawdev_start(dev_id) != 0) {
+		printf("Error with rte_rawdev_start()\n");
+		return -1;
+	}
+	return 0;
+}
drivers/raw/ioat/meson.build +2 -1
index ca23e23fc..40fff6654 100644
@@ -2,7 +2,8 @@
 # Copyright 2019 Intel Corporation
 
 build = dpdk_conf.has('RTE_ARCH_X86')
-sources = files('ioat_rawdev.c')
+sources = files('ioat_rawdev.c',
+		'ioat_rawdev_test.c')
 deps += ['rawdev', 'bus_pci']
 
 install_headers('rte_ioat_rawdev.h',
drivers/raw/ioat/rte_ioat_rawdev.h +2 -0
index 1d0dbdd2e..f2cf98cd9 100644
@@ -14,6 +14,7 @@
  * @b EXPERIMENTAL: these structures and APIs may change without prior notice
  */
 
+#include <x86intrin.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_ioat_spec.h>
@@ -51,6 +52,7 @@ struct rte_ioat_rawdev {
 
 	unsigned short ring_size;
 	struct rte_ioat_generic_hw_desc *desc_ring;
+	__m128i *hdls; /* completion handles for returning to user */
 
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
#94 lore raw

Re: [dpdk-dev] [PATCH v5 7/9] raw/ioat: add configure, start and stop functions

Quoted 121 lines · Aaron Conole
Quoted 114 lines · Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

Anatoly Burakov <[email protected]> Tested-by: Harry van Haaren <[email protected]> ---

V4: Guarantee correct SUCCESS/FAILURE return values from test function Use memzone rather than malloc for ring allocation so we can guarantee contiguous memory. V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h V2: test cases placed in self-test routine ---

app/test/test_rawdev.c              |  3 +-
doc/guides/rawdevs/ioat_rawdev.rst  | 32 +++++++++++
drivers/raw/ioat/Makefile           |  1 +
drivers/raw/ioat/ioat_rawdev.c      | 82 +++++++++++++++++++++++++++++
drivers/raw/ioat/ioat_rawdev_test.c | 41 +++++++++++++++
drivers/raw/ioat/meson.build        |  3 +-
drivers/raw/ioat/rte_ioat_rawdev.h  |  2 + 7 files changed, 162

insertions(+), 2 deletions(-) create mode 100644
drivers/raw/ioat/ioat_rawdev_test.c

app/test/test_rawdev.c index renamed from app/test/test_rawdev.c +0 -0

623117af9..524a9d5f3 100644 --- a/app/test/test_rawdev.c +++ b/app/test/test_rawdev.c @@ -36,7 +36,8 @@ test_rawdev_selftest_ioat(void) struct rte_rawdev_info info = { .dev_private = NULL }; if (rte_rawdev_info_get(i, &info) == 0 &&
strstr(info.driver_name, "ioat") != NULL) - return
TEST_SUCCESS; + return rte_rawdev_selftest(i) == 0
? + TEST_SUCCESS : TEST_FAILED;
}

app/test/test_rawdev.c index renamed from app/test/test_rawdev.c +1 -0
 	printf("No IOAT rawdev found, skipping tests\n"); diff --git
 	a/doc/guides/rawdevs/ioat_rawdev.rst
 	b/doc/guides/rawdevs/ioat_rawdev.rst index efed9c64c..a0594d2cb
 	100644 --- a/doc/guides/rawdevs/ioat_rawdev.rst +++
 	b/doc/guides/rawdevs/ioat_rawdev.rst @@ -117,3 +117,35 @@ the
 	``dev_private`` field in the ``rte_rawdev_info`` struct should
 	either be NULL, or else be set to point to a structure of type
 	``rte_ioat_rawdev_config``, in which case the size of the
 	configured device input ring will be returned in that structure.  +
 	+Device Configuration +~~~~~~~~~~~~~~~~~~~~~ + +Configuring an IOAT
 	rawdev device is done using the +``rte_rawdev_configure()`` API,
 	which takes the same structure parameters +as the, previously
 	referenced, ``rte_rawdev_info_get()`` API. The main +difference is
 	that, because the parameter is used as input rather than +output,
 	the ``dev_private`` structure element cannot be NULL, and must
 	+point to a valid ``rte_ioat_rawdev_config`` structure, containing
 	the ring +size to be used by the device. The ring size must be a
 	power of two, +between 64 and 4096.  + +The following code shows
 	how the device is configured in +``test_ioat_rawdev.c``: + +..
 	code-block:: C + +   #define IOAT_TEST_RINGSIZE 512 +        struct
 	rte_ioat_rawdev_config p = { .ring_size = -1 }; +        struct
 	rte_rawdev_info info = { .dev_private = &p }; + +        /* ... */
 	+ +        p.ring_size = IOAT_TEST_RINGSIZE; +        if
 	(rte_rawdev_configure(dev_id, &info) != 0) { +
 	printf("Error with rte_rawdev_configure()\n"); +
 	return -1; +        } + +Once configured, the device can then be
 	made ready for use by calling the +``rte_rawdev_start()`` API.
 	diff --git a/drivers/raw/ioat/Makefile b/drivers/raw/ioat/Makefile
 	index 1e10938f3..b1af9c666 100644 --- a/drivers/raw/ioat/Makefile
 	+++ b/drivers/raw/ioat/Makefile @@ -21,6 +21,7 @@ EXPORT_MAP :=
 	rte_pmd_ioat_version.map
 
 # library source files SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) +=
 ioat_rawdev.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) +=
 ioat_rawdev_test.c
 
 # export include files SYMLINK-y-include += rte_ioat_rawdev.h diff
 --git a/drivers/raw/ioat/ioat_rawdev.c
 b/drivers/raw/ioat/ioat_rawdev.c index 2bfe2544d..0c91b3579 100644 ---
 a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c
 @@ -34,6 +34,81 @@ static struct rte_pci_driver ioat_pmd_drv; #define
 IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args) #define
 IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+#define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc) +#define

COMPLETION_SZ sizeof(__m128i) + +static int +ioat_dev_configure(const
struct rte_rawdev *dev, rte_rawdev_obj_t config) +{ + struct
rte_ioat_rawdev_config *params = config; + struct rte_ioat_rawdev
*ioat = dev->dev_private; + char mz_name[RTE_MEMZONE_NAMESIZE]; +
unsigned short i; + + if (dev->started) + return
-EBUSY; + + if (params == NULL) + return -EINVAL; + + if
(params->ring_size > 4096 || params->ring_size < 64 || +
!rte_is_power_of_2(params->ring_size)) + return -EINVAL; + +
ioat->ring_size = params->ring_size; + if (ioat->desc_ring !=
NULL) { + rte_memzone_free(ioat->desc_mz); +
ioat->desc_ring = NULL; + ioat->desc_mz = NULL; + } + + /*
allocate one block of memory for both descriptors + * and completion
handles. + */ + snprintf(mz_name, sizeof(mz_name),
"rawdev%u_desc_ring", dev->dev_id); + ioat->desc_mz =
rte_memzone_reserve(mz_name, + (DESC_SZ +
COMPLETION_SZ) * ioat->ring_size, +
dev->device->numa_node, RTE_MEMZONE_IOVA_CONTIG); + if (ioat->desc_mz
== NULL) + return -ENOMEM; + ioat->desc_ring =
ioat->desc_mz->addr; + ioat->hdls = (void
*)&ioat->desc_ring[ioat->ring_size]; + + ioat->ring_addr =
ioat->desc_mz->iova; + + /* configure descriptor ring - each one
points to next */ + for (i = 0; i < ioat->ring_size; i++) { +
ioat->desc_ring[i].next = ioat->ring_addr + +
(((i + 1) % ioat->ring_size) * DESC_SZ); + } + + return 0; +} +
+static int +ioat_dev_start(struct rte_rawdev *dev) +{ + struct
rte_ioat_rawdev *ioat = dev->dev_private; + + if (ioat->ring_size
== 0 || ioat->desc_ring == NULL) + return -EBUSY; + + /*
inform hardware of where the descriptor ring is */ +
ioat->regs->chainaddr = ioat->ring_addr; + /* inform hardware of where
to write the status/completions */ + ioat->regs->chancmp =
ioat->status_addr; + + /* prime the status register to be set to
the last element */ + ioat->status = ioat->ring_addr +
((ioat->ring_size - 1) * DESC_SZ); + return 0; +} + +static void
+ioat_dev_stop(struct rte_rawdev *dev) +{ + RTE_SET_USED(dev); +} +
static void ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) { @@ -44,11 +119,17 @@ ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) cfg->ring_size = ioat->ring_size; }

Quoted 1 line

+extern int ioat_rawdev_test(uint16_t dev_id); +

This signature doesn't match with the rte_rawdev_ops definition (which should be int(*func)(void)).

Quoted 8 lines

It will generate an error as such:

../drivers/raw/ioat/ioat_rawdev.c:176:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .dev_selftest = ioat_rawdev_test, ^ ../drivers/raw/ioat/ioat_rawdev.c:176:20: note: (near initialization for ‘ioat_rawdev_ops.dev_selftest’)

That was changed by commit 863fd2930bbe ("rawdev: pass the device id as parameter to selftest") which was part of the patchset on which this set depended.

/Bruce

#95 lore raw

Re: [dpdk-dev] [PATCH v5 7/9] raw/ioat: add configure, start and stop functions

Quoted 130 lines · Bruce Richardson
Quoted 121 lines · Aaron Conole
Quoted 114 lines · Bruce Richardson

Allow initializing a driver instance. Include selftest to validate these functions.

Anatoly Burakov <[email protected]> Tested-by: Harry van Haaren <[email protected]> ---

V4: Guarantee correct SUCCESS/FAILURE return values from test function Use memzone rather than malloc for ring allocation so we can guarantee contiguous memory. V3: don't add a new descriptor format struct, reuse from rte_ioat_spec.h V2: test cases placed in self-test routine ---

app/test/test_rawdev.c              |  3 +-
doc/guides/rawdevs/ioat_rawdev.rst  | 32 +++++++++++
drivers/raw/ioat/Makefile           |  1 +
drivers/raw/ioat/ioat_rawdev.c      | 82 +++++++++++++++++++++++++++++
drivers/raw/ioat/ioat_rawdev_test.c | 41 +++++++++++++++
drivers/raw/ioat/meson.build        |  3 +-
drivers/raw/ioat/rte_ioat_rawdev.h  |  2 + 7 files changed, 162

insertions(+), 2 deletions(-) create mode 100644
drivers/raw/ioat/ioat_rawdev_test.c

app/test/test_rawdev.c index renamed from app/test/test_rawdev.c +0 -0

623117af9..524a9d5f3 100644 --- a/app/test/test_rawdev.c +++ b/app/test/test_rawdev.c @@ -36,7 +36,8 @@ test_rawdev_selftest_ioat(void) struct rte_rawdev_info info = { .dev_private = NULL }; if (rte_rawdev_info_get(i, &info) == 0 &&
strstr(info.driver_name, "ioat") != NULL) - return
TEST_SUCCESS; + return rte_rawdev_selftest(i) == 0
? + TEST_SUCCESS : TEST_FAILED;
}

app/test/test_rawdev.c index renamed from app/test/test_rawdev.c +1 -0
 	printf("No IOAT rawdev found, skipping tests\n"); diff --git
 	a/doc/guides/rawdevs/ioat_rawdev.rst
 	b/doc/guides/rawdevs/ioat_rawdev.rst index efed9c64c..a0594d2cb
 	100644 --- a/doc/guides/rawdevs/ioat_rawdev.rst +++
 	b/doc/guides/rawdevs/ioat_rawdev.rst @@ -117,3 +117,35 @@ the
 	``dev_private`` field in the ``rte_rawdev_info`` struct should
 	either be NULL, or else be set to point to a structure of type
 	``rte_ioat_rawdev_config``, in which case the size of the
 	configured device input ring will be returned in that structure.  +
 	+Device Configuration +~~~~~~~~~~~~~~~~~~~~~ + +Configuring an IOAT
 	rawdev device is done using the +``rte_rawdev_configure()`` API,
 	which takes the same structure parameters +as the, previously
 	referenced, ``rte_rawdev_info_get()`` API. The main +difference is
 	that, because the parameter is used as input rather than +output,
 	the ``dev_private`` structure element cannot be NULL, and must
 	+point to a valid ``rte_ioat_rawdev_config`` structure, containing
 	the ring +size to be used by the device. The ring size must be a
 	power of two, +between 64 and 4096.  + +The following code shows
 	how the device is configured in +``test_ioat_rawdev.c``: + +..
 	code-block:: C + +   #define IOAT_TEST_RINGSIZE 512 +        struct
 	rte_ioat_rawdev_config p = { .ring_size = -1 }; +        struct
 	rte_rawdev_info info = { .dev_private = &p }; + +        /* ... */
 	+ +        p.ring_size = IOAT_TEST_RINGSIZE; +        if
 	(rte_rawdev_configure(dev_id, &info) != 0) { +
 	printf("Error with rte_rawdev_configure()\n"); +
 	return -1; +        } + +Once configured, the device can then be
 	made ready for use by calling the +``rte_rawdev_start()`` API.
 	diff --git a/drivers/raw/ioat/Makefile b/drivers/raw/ioat/Makefile
 	index 1e10938f3..b1af9c666 100644 --- a/drivers/raw/ioat/Makefile
 	+++ b/drivers/raw/ioat/Makefile @@ -21,6 +21,7 @@ EXPORT_MAP :=
 	rte_pmd_ioat_version.map
 
 # library source files SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) +=
 ioat_rawdev.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_IOAT_RAWDEV) +=
 ioat_rawdev_test.c
 
 # export include files SYMLINK-y-include += rte_ioat_rawdev.h diff
 --git a/drivers/raw/ioat/ioat_rawdev.c
 b/drivers/raw/ioat/ioat_rawdev.c index 2bfe2544d..0c91b3579 100644 ---
 a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c
 @@ -34,6 +34,81 @@ static struct rte_pci_driver ioat_pmd_drv; #define
 IOAT_PMD_ERR(fmt, args...)    IOAT_PMD_LOG(ERR, fmt, ## args) #define
 IOAT_PMD_WARN(fmt, args...)   IOAT_PMD_LOG(WARNING, fmt, ## args)
 
+#define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc) +#define

COMPLETION_SZ sizeof(__m128i) + +static int +ioat_dev_configure(const
struct rte_rawdev *dev, rte_rawdev_obj_t config) +{ + struct
rte_ioat_rawdev_config *params = config; + struct rte_ioat_rawdev
*ioat = dev->dev_private; + char mz_name[RTE_MEMZONE_NAMESIZE]; +
unsigned short i; + + if (dev->started) + return
-EBUSY; + + if (params == NULL) + return -EINVAL; + + if
(params->ring_size > 4096 || params->ring_size < 64 || +
!rte_is_power_of_2(params->ring_size)) + return -EINVAL; + +
ioat->ring_size = params->ring_size; + if (ioat->desc_ring !=
NULL) { + rte_memzone_free(ioat->desc_mz); +
ioat->desc_ring = NULL; + ioat->desc_mz = NULL; + } + + /*
allocate one block of memory for both descriptors + * and completion
handles. + */ + snprintf(mz_name, sizeof(mz_name),
"rawdev%u_desc_ring", dev->dev_id); + ioat->desc_mz =
rte_memzone_reserve(mz_name, + (DESC_SZ +
COMPLETION_SZ) * ioat->ring_size, +
dev->device->numa_node, RTE_MEMZONE_IOVA_CONTIG); + if (ioat->desc_mz
== NULL) + return -ENOMEM; + ioat->desc_ring =
ioat->desc_mz->addr; + ioat->hdls = (void
*)&ioat->desc_ring[ioat->ring_size]; + + ioat->ring_addr =
ioat->desc_mz->iova; + + /* configure descriptor ring - each one
points to next */ + for (i = 0; i < ioat->ring_size; i++) { +
ioat->desc_ring[i].next = ioat->ring_addr + +
(((i + 1) % ioat->ring_size) * DESC_SZ); + } + + return 0; +} +
+static int +ioat_dev_start(struct rte_rawdev *dev) +{ + struct
rte_ioat_rawdev *ioat = dev->dev_private; + + if (ioat->ring_size
== 0 || ioat->desc_ring == NULL) + return -EBUSY; + + /*
inform hardware of where the descriptor ring is */ +
ioat->regs->chainaddr = ioat->ring_addr; + /* inform hardware of where
to write the status/completions */ + ioat->regs->chancmp =
ioat->status_addr; + + /* prime the status register to be set to
the last element */ + ioat->status = ioat->ring_addr +
((ioat->ring_size - 1) * DESC_SZ); + return 0; +} + +static void
+ioat_dev_stop(struct rte_rawdev *dev) +{ + RTE_SET_USED(dev); +} +
static void ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) { @@ -44,11 +119,17 @@ ioat_dev_info_get(struct rte_rawdev *dev, rte_rawdev_obj_t dev_info) cfg->ring_size = ioat->ring_size; }

Quoted 1 line

+extern int ioat_rawdev_test(uint16_t dev_id); +

This signature doesn't match with the rte_rawdev_ops definition (which should be int(*func)(void)).

Quoted 8 lines

It will generate an error as such:

../drivers/raw/ioat/ioat_rawdev.c:176:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .dev_selftest = ioat_rawdev_test, ^ ../drivers/raw/ioat/ioat_rawdev.c:176:20: note: (near initialization for ‘ioat_rawdev_ops.dev_selftest’)

Quoted 3 lines

That was changed by commit 863fd2930bbe ("rawdev: pass the device id as parameter to selftest") which was part of the patchset on which this set depended.

Strange - the robot didn't pick that commit up. Was this submitted before that commit was live?

Quoted 1 line

/Bruce

#96 lore raw

PATCH v5 8/9 raw/ioat: add statistics functions

In reply to Bruce Richardson

Add stats functions to track what is happening in the driver, and put unit tests to check those.

---
V4: pulled in memory leak fixes from next patch
V2: test cases moved to self-test routine

---
 doc/guides/rawdevs/ioat_rawdev.rst  | 14 +++++++++
 drivers/raw/ioat/ioat_rawdev.c      | 44 ++++++++++++++++++++++++++++
 drivers/raw/ioat/ioat_rawdev_test.c | 45 +++++++++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h  |  6 ++++
 4 files changed, 109 insertions(+)
doc/guides/rawdevs/ioat_rawdev.rst +14 -0
index a0594d2cb..40210b3f9 100644
@@ -149,3 +149,17 @@ The following code shows how the device is configured in
 
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
+
+Querying Device Statistics
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The statistics from the IOAT rawdev device can be got via the xstats
+functions in the ``rte_rawdev`` library, i.e.
+``rte_rawdev_xstats_names_get()``, ``rte_rawdev_xstats_get()`` and
+``rte_rawdev_xstats_by_name_get``. The statistics returned for each device
+instance are:
+
+* ``failed_enqueues``
+* ``successful_enqueues``
+* ``copies_started``
+* ``copies_completed``
drivers/raw/ioat/ioat_rawdev.c +44 -0

62 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +45 -0

62 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +6 -0
index f2cf98cd9..d5326813c 100644
@@ -54,6 +54,12 @@ struct rte_ioat_rawdev {
 	struct rte_ioat_generic_hw_desc *desc_ring;
 	__m128i *hdls; /* completion handles for returning to user */
 
+	/* some statistics for tracking, if added/changed update xstats fns*/
+	uint64_t enqueue_failed __rte_cache_aligned;
+	uint64_t enqueued;
+	uint64_t started;
+	uint64_t completed;
+
 	/* to report completions, the device will write status back here */
 	volatile uint64_t status __rte_cache_aligned;
 };
Signature · 1 line
2.21.0
Acked-by on v5 8/9
#97 lore raw

Re: [dpdk-dev] [PATCH v5 8/9] raw/ioat: add statistics functions

Quoted 19 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, July 2, 2019 10:12 PM
To: [email protected]
Cc: Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Burakov, Anatoly <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v5 8/9] raw/ioat: add statistics functions

Add stats functions to track what is happening in the driver, and put unit tests to check those.

---
V4: pulled in memory leak fixes from next patch
V2: test cases moved to self-test routine

#98 lore raw

PATCH v5 9/9 raw/ioat: add local API to perform copies

In reply to Bruce Richardson

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

---

V3: updated to use descriptor format in rte_ioat_spec.h
V2: test cases moved to self-test routine

---
 doc/guides/rawdevs/ioat_rawdev.rst  | 100 ++++++++++++++++
 drivers/raw/ioat/Makefile           |   1 +
 drivers/raw/ioat/ioat_rawdev_test.c | 155 ++++++++++++++++++++++++-
 drivers/raw/ioat/meson.build        |   2 +-
 drivers/raw/ioat/rte_ioat_rawdev.h  | 169 +++++++++++++++++++++++++++-
 5 files changed, 422 insertions(+), 5 deletions(-)
doc/guides/rawdevs/ioat_rawdev.rst +100 -0
index 40210b3f9..607cb5a86 100644
@@ -150,6 +150,106 @@ The following code shows how the device is configured in
 Once configured, the device can then be made ready for use by calling the
 ``rte_rawdev_start()`` API.
 
+Performing Data Copies
+~~~~~~~~~~~~~~~~~~~~~~~
+
+To perform data copies using IOAT rawdev devices, the functions
+``rte_ioat_enqueue_copy()`` and ``rte_ioat_do_copies()`` should be used.
+Once copies have been completed, the completion will be reported back when
+the application calls ``rte_ioat_completed_copies()``.
+
+The ``rte_ioat_enqueue_copy()`` function enqueues a single copy to the
+device ring for copying at a later point. The parameters to that function
+include the physical addresses of both the source and destination buffers,
+as well as two "handles" to be returned to the user when the copy is
+completed. These handles can be arbitrary values, but two are provided so
+that the library can track handles for both source and destination on
+behalf of the user, e.g. virtual addresses for the buffers, or mbuf
+pointers if packet data is being copied.
+
+While the ``rte_ioat_enqueue_copy()`` function enqueues a copy operation on
+the device ring, the copy will not actually be performed until after the
+application calls the ``rte_ioat_do_copies()`` function. This function
+informs the device hardware of the elements enqueued on the ring, and the
+device will begin to process them. It is expected that, for efficiency
+reasons, a burst of operations will be enqueued to the device via multiple
+enqueue calls between calls to the ``rte_ioat_do_copies()`` function.
+
+The following code from ``test_ioat_rawdev.c`` demonstrates how to enqueue
+a burst of copies to the device and start the hardware processing of them:
+
+.. code-block:: C
+
+        struct rte_mbuf *srcs[32], *dsts[32];
+        unsigned int j;
+
+        for (i = 0; i < RTE_DIM(srcs); i++) {
+                char *src_data;
+
+                srcs[i] = rte_pktmbuf_alloc(pool);
+                dsts[i] = rte_pktmbuf_alloc(pool);
+                srcs[i]->data_len = srcs[i]->pkt_len = length;
+                dsts[i]->data_len = dsts[i]->pkt_len = length;
+                src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+                for (j = 0; j < length; j++)
+                        src_data[j] = rand() & 0xFF;
+
+                if (rte_ioat_enqueue_copy(dev_id,
+                                srcs[i]->buf_iova + srcs[i]->data_off,
+                                dsts[i]->buf_iova + dsts[i]->data_off,
+                                length,
+                                (uintptr_t)srcs[i],
+                                (uintptr_t)dsts[i],
+                                0 /* nofence */) != 1) {
+                        printf("Error with rte_ioat_enqueue_copy for buffer %u\n",
+                                        i);
+                        return -1;
+                }
+        }
+        rte_ioat_do_copies(dev_id);
+
+To retrieve information about completed copies, the API
+``rte_ioat_completed_copies()`` should be used. This API will return to the
+application a set of completion handles passed in when the relevant copies
+were enqueued.
+
+The following code from ``test_ioat_rawdev.c`` shows the test code
+retrieving information about the completed copies and validating the data
+is correct before freeing the data buffers using the returned handles:
+
+.. code-block:: C
+
+        if (rte_ioat_completed_copies(dev_id, 64, (void *)completed_src,
+                        (void *)completed_dst) != RTE_DIM(srcs)) {
+                printf("Error with rte_ioat_completed_copies\n");
+                return -1;
+        }
+        for (i = 0; i < RTE_DIM(srcs); i++) {
+                char *src_data, *dst_data;
+
+                if (completed_src[i] != srcs[i]) {
+                        printf("Error with source pointer %u\n", i);
+                        return -1;
+                }
+                if (completed_dst[i] != dsts[i]) {
+                        printf("Error with dest pointer %u\n", i);
+                        return -1;
+                }
+
+                src_data = rte_pktmbuf_mtod(srcs[i], char *);
+                dst_data = rte_pktmbuf_mtod(dsts[i], char *);
+                for (j = 0; j < length; j++)
+                        if (src_data[j] != dst_data[j]) {
+                                printf("Error with copy of packet %u, byte %u\n",
+                                                i, j);
+                                return -1;
+                        }
+                rte_pktmbuf_free(srcs[i]);
+                rte_pktmbuf_free(dsts[i]);
+        }
+
+
 Querying Device Statistics
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
drivers/raw/ioat/Makefile +1 -0
index b1af9c666..32f079845 100644
@@ -12,6 +12,7 @@ CFLAGS += $(WERROR_FLAGS)
 
 LDLIBS += -lrte_eal -lrte_rawdev
 LDLIBS += -lrte_pci -lrte_bus_pci
+LDLIBS += -lrte_mbuf -lrte_mempool
 
 # library version
 LIBABIVER := 1
drivers/raw/ioat/ioat_rawdev_test.c +152 -3

187 lines not on this page · raw message

drivers/raw/ioat/meson.build +1 -1
index 40fff6654..247ff88bf 100644
@@ -4,7 +4,7 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 sources = files('ioat_rawdev.c',
 		'ioat_rawdev_test.c')
-deps += ['rawdev', 'bus_pci']
+deps += ['rawdev', 'bus_pci', 'mbuf']
 
 install_headers('rte_ioat_rawdev.h',
 		'rte_ioat_spec.h')
drivers/raw/ioat/rte_ioat_rawdev.h +168 -1

186 lines not on this page · raw message

Signature · 1 line
2.21.0
Acked-by on v5 9/9
#99 lore raw

Re: [dpdk-dev] [PATCH v5 9/9] raw/ioat: add local API to perform copies

Quoted 22 lines

-----Original Message-----
From: Richardson, Bruce
Sent: Tuesday, July 2, 2019 10:13 PM
To: [email protected]
Cc: Hu, Jiayu <[email protected]>; Richardson, Bruce <[email protected]>; Burakov, Anatoly <[email protected]>; Van Haaren, Harry <[email protected]>
Subject: [PATCH v5 9/9] raw/ioat: add local API to perform copies

Add local APIs to trigger data copies, and retrieve handle values once those copies are completed. Included are unit tests to validate the data is copies correctly.

---

V3: updated to use descriptor format in rte_ioat_spec.h
V2: test cases moved to self-test routine
---

#100 lore raw
In reply to Bruce Richardson

02/07/2019 16:12, Bruce Richardson:

Quoted 8 lines

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Performing the copies in hardware can provide performance improvements for applications where the average copy size is reasonably large, e.g. 1k packets. For smaller packets, e.g. 64-256 bytes, offloading the copy may reduce performance due to the overhead of using hardware.

[...]

Quoted 10 lines

Bruce Richardson (9):
rawdev: allow devices to skip extra memory allocation raw/ioat: add initial support for ioat rawdev driver usertools/dpdk-devbind.py: add support for IOAT devices raw/ioat: add register definition file raw/ioat: create device on probe and destroy on release raw/ioat: add device info function
raw/ioat: add configure, start and stop functions raw/ioat: add statistics functions
raw/ioat: add local API to perform copies

Applied, thanks

#101 lore raw
In reply to Bruce Richardson
Quoted 30 lines · Bruce Richardson

This patch series adds support for the Intel QuickData Technology device, part of the Intel I/O Acceleration Technology (Intel I/OAT). It is a raw device for allowing hardware DMA i.e. data copies in hardware.

Performing the copies in hardware can provide performance improvements for applications where the average copy size is reasonably large, e.g. 1k packets. For smaller packets, e.g. 64-256 bytes, offloading the copy may reduce performance due to the overhead of using hardware.

V5:
* updated doxygen comment for internal rawdev pmd API

V4:
* changed memory management to use contiguous memzones instead of malloc memory
* added missing device ids for BDX platforms
* other misc cleanup following review (see individual patches logs)

V3:
* removed DPDK-specific structure for the descriptor format and reused the structure in the imported file rte_ioat_spec.h

V2:
* moved tests to rawdev selftest function
* some checkpatch and other small cleanups
* added extra documentation details on supported hardware
* aligned the changes to dpdk-devbind with the changes in the NTB set for consistency

Quoted 10 lines

Bruce Richardson (9):
rawdev: allow devices to skip extra memory allocation raw/ioat: add initial support for ioat rawdev driver usertools/dpdk-devbind.py: add support for IOAT devices raw/ioat: add register definition file raw/ioat: create device on probe and destroy on release raw/ioat: add device info function
raw/ioat: add configure, start and stop functions raw/ioat: add statistics functions
raw/ioat: add local API to perform copies

Hi Bruce, Thomas,

Getting following build error with icc, both for 32-bit & 64-bit:

.../dpdk/drivers/raw/ioat/ioat_rawdev_test.c(28): (col. 9) error #13203: No EMMS instruction before call to function