Skip to contentSkip to conversation

ioat driver updates

PATCH Superseded Bruce Richardson 3 participants 69 messages Mar 18, 2021 – May 4, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover ioat driver updates

This set contains a series of updates to the ioat driver, described in each of the individual patchsets.

Comments would be especially appreciated for the last patch in this set, which converts the existing idxd vdev driver to a bus driver so that probing and scanning can be done automatically. This approach is based on suggestions made in a previous discussion thread[1]

NOTE: Documentation updates are currently missing from this set, but will be included in future revisions.

[1] http://inbox.dpdk.org/dev/[email protected]/t/#mf3170e5aab50b43343b8cc34054f7bbbefd94379

Bruce Richardson (5):
raw/ioat: support limiting queues for idxd PCI device raw/ioat: add component prefix to log messages raw/ioat: add explicit padding to descriptor struct raw/ioat: rework SW ring layout
raw/ioat: add bus driver for device scanning automatically

Kevin Laatz (1):
raw/ioat: add api to query remaining ring space

 drivers/raw/ioat/idxd_bus.c            | 320 +++++++++++++++++++++++++
 drivers/raw/ioat/idxd_pci.c            |  33 ++-
 drivers/raw/ioat/idxd_vdev.c           | 231 ------------------
 drivers/raw/ioat/ioat_common.c         |  99 ++++----
 drivers/raw/ioat/ioat_private.h        |   2 +-
 drivers/raw/ioat/ioat_rawdev_test.c    | 137 +++++++++++
 drivers/raw/ioat/meson.build           |   3 +-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 280 +++++++++++++---------
 8 files changed, 711 insertions(+), 394 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c

--
2.27.0

#1 lore raw

PATCH 1/6 raw/ioat: support limiting queues for idxd PCI device

When using a full device instance via vfio, allow the user to specify a maximum number of queues to configure rather than always using the max number of supported queues.

---
 drivers/raw/ioat/idxd_pci.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/raw/ioat/idxd_pci.c +26 -2
index 01623f33f6..b48e565b4c 100644
@@ -4,6 +4,7 @@
 
 #include <rte_bus_pci.h>
 #include <rte_memzone.h>
+#include <rte_devargs.h>
 
 #include "ioat_private.h"
 #include "ioat_spec.h"
@@ -123,7 +124,8 @@ static const struct rte_rawdev_ops idxd_pci_ops = {
 #define IDXD_PORTAL_SIZE (4096 * 4)
 
 static int
-init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
+init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd,
+		unsigned int max_queues)
 {
 	struct idxd_pci_common *pci;
 	uint8_t nb_groups, nb_engines, nb_wqs;
@@ -179,6 +181,16 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
 	for (i = 0; i < nb_wqs; i++)
 		idxd_get_wq_cfg(pci, i)[0] = 0;
 
+	/* limit queues if necessary */
+	if (max_queues != 0 && nb_wqs > max_queues) {
+		nb_wqs = max_queues;
+		if (nb_engines > max_queues)
+			nb_engines = max_queues;
+		if (nb_groups > max_queues)
+			nb_engines = max_queues;
+		IOAT_PMD_DEBUG("Limiting queues to %u", nb_wqs);
+	}
+
 	/* put each engine into a separate group to avoid reordering */
 	if (nb_groups > nb_engines)
 		nb_groups = nb_engines;
@@ -242,12 +254,23 @@ idxd_rawdev_probe_pci(struct rte_pci_driver *drv, struct rte_pci_device *dev)
 	uint8_t nb_wqs;
 	int qid, ret = 0;
 	char name[PCI_PRI_STR_SIZE];
+	unsigned int max_queues = 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 = init_pci_device(dev, &idxd);
+	if (dev->device.devargs && dev->device.devargs->args[0] != '\0') {
+		/* if the number of devargs grows beyond just 1, use rte_kvargs */
+		if (sscanf(dev->device.devargs->args,
+				"max_queues=%u", &max_queues) != 1) {
+			IOAT_PMD_ERR("Invalid device parameter: '%s'",
+					dev->device.devargs->args);
+			return -1;
+		}
+	}
+
+	ret = init_pci_device(dev, &idxd, max_queues);
 	if (ret < 0) {
 		IOAT_PMD_ERR("Error initializing PCI hardware");
 		return ret;
@@ -353,3 +376,4 @@ RTE_PMD_REGISTER_PCI(IDXD_PMD_RAWDEV_NAME_PCI, idxd_pmd_drv_pci);
 RTE_PMD_REGISTER_PCI_TABLE(IDXD_PMD_RAWDEV_NAME_PCI, pci_id_idxd_map);
 RTE_PMD_REGISTER_KMOD_DEP(IDXD_PMD_RAWDEV_NAME_PCI,
 			  "* igb_uio | uio_pci_generic | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(rawdev_idxd_pci, "max_queues=0");
Signature · 1 line
2.27.0
#2 lore raw

v2 cover ioat driver updates

This set contains a series of updates to the ioat driver, described in each of the individual patchsets.

Bruce Richardson (10):
raw/ioat: add unit tests for completion batching raw/ioat: support limiting queues for idxd PCI device raw/ioat: add component prefix to log messages raw/ioat: add explicit padding to descriptor struct raw/ioat: fix script for configuring small number of queues raw/ioat: make workqueue name configurable in script raw/ioat: add bus driver for device scanning automatically raw/ioat: move idxd functions to separate file raw/ioat: rework SW ring layout
raw/ioat: report status of completed jobs

Kevin Laatz (2):
raw/ioat: allow perform operations function to return error raw/ioat: add API to query remaining ring space

 doc/guides/rawdevs/ioat.rst            |  31 +-
 doc/guides/rel_notes/release_21_05.rst |   5 +
 drivers/raw/ioat/dpdk_idxd_cfg.py      |  19 +-
 drivers/raw/ioat/idxd_bus.c            | 359 +++++++++++++++
 drivers/raw/ioat/idxd_pci.c            |  33 +-
 drivers/raw/ioat/idxd_vdev.c           | 231 ----------
 drivers/raw/ioat/ioat_common.c         | 106 +++--
 drivers/raw/ioat/ioat_private.h        |   2 +-
 drivers/raw/ioat/ioat_rawdev_test.c    | 602 ++++++++++++++++++++++---
 drivers/raw/ioat/meson.build           |   5 +-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 376 +++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h     |  57 ++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 339 +++-----------
 examples/ioat/ioatfwd.c                |  14 +-
 examples/vhost/ioat.c                  |   2 +-
 15 files changed, 1514 insertions(+), 667 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
 create mode 100644 drivers/raw/ioat/rte_idxd_rawdev_fns.h

--
2.30.2

#3 lore raw

PATCH v2 1/12 raw/ioat: add unit tests for completion batching

Add in additional unit tests to verify that we can get completion reports of multiple batches in a single completed_ops() call. Also verify we can get smaller number of completions if that is requested too.

---
 drivers/raw/ioat/ioat_rawdev_test.c | 199 +++++++++++++++++++---------
 1 file changed, 137 insertions(+), 62 deletions(-)
drivers/raw/ioat/ioat_rawdev_test.c +137 -62
index 101f24a677..a5064d739d 100644
@@ -11,6 +11,7 @@
 
 #define MAX_SUPPORTED_RAWDEVS 64
 #define TEST_SKIPPED 77
+#define COPY_LEN 1024
 
 int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
 
@@ -34,32 +35,114 @@ print_err(const char *func, int lineno, const char *format, ...)
 	return ret;
 }
 
+static int
+do_multi_copies(int dev_id, int split_batches, int split_completions)
+{
+	struct rte_mbuf *srcs[32], *dsts[32];
+	struct rte_mbuf *completed_src[64];
+	struct rte_mbuf *completed_dst[64];
+	unsigned int i, j;
+
+	for (i = 0; i < RTE_DIM(srcs); i++) {
+		char *src_data;
+
+		if (split_batches && i == RTE_DIM(srcs) / 2)
+			rte_ioat_perform_ops(dev_id);
+
+		srcs[i] = rte_pktmbuf_alloc(pool);
+		dsts[i] = rte_pktmbuf_alloc(pool);
+		src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+		for (j = 0; j < COPY_LEN; 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,
+				COPY_LEN,
+				(uintptr_t)srcs[i],
+				(uintptr_t)dsts[i]) != 1) {
+			PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
+					i);
+			return -1;
+		}
+	}
+	rte_ioat_perform_ops(dev_id);
+	usleep(100);
+
+	if (split_completions) {
+		/* gather completions in two halves */
+		uint16_t half_len = RTE_DIM(srcs) / 2;
+		if (rte_ioat_completed_ops(dev_id, half_len, (void *)completed_src,
+				(void *)completed_dst) != half_len) {
+			PRINT_ERR("Error with rte_ioat_completed_ops - first half request\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+		if (rte_ioat_completed_ops(dev_id, half_len, (void *)&completed_src[half_len],
+				(void *)&completed_dst[half_len]) != half_len) {
+			PRINT_ERR("Error with rte_ioat_completed_ops - second half request\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+	} else {
+		/* gather all completions in one go */
+		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
+				(void *)completed_dst) != RTE_DIM(srcs)) {
+			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+	}
+	for (i = 0; i < RTE_DIM(srcs); i++) {
+		char *src_data, *dst_data;
+
+		if (completed_src[i] != srcs[i]) {
+			PRINT_ERR("Error with source pointer %u\n", i);
+			return -1;
+		}
+		if (completed_dst[i] != dsts[i]) {
+			PRINT_ERR("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 < COPY_LEN; j++)
+			if (src_data[j] != dst_data[j]) {
+				PRINT_ERR("Error with copy of packet %u, byte %u\n",
+						i, j);
+				return -1;
+			}
+		rte_pktmbuf_free(srcs[i]);
+		rte_pktmbuf_free(dsts[i]);
+	}
+	return 0;
+}
+
 static int
 test_enqueue_copies(int dev_id)
 {
-	const unsigned int length = 1024;
 	unsigned int i;
 
+	/* test doing a single copy */
 	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++)
+		for (i = 0; i < COPY_LEN; 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,
+				COPY_LEN,
 				(uintptr_t)src,
 				(uintptr_t)dst) != 1) {
 			PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
@@ -79,99 +162,91 @@ test_enqueue_copies(int dev_id)
 			return -1;
 		}
 
-		for (i = 0; i < length; i++)
+		for (i = 0; i < COPY_LEN; i++)
 			if (dst_data[i] != src_data[i]) {
-				PRINT_ERR("Data mismatch at char %u\n", i);
+				PRINT_ERR("Data mismatch at char %u [Got %02x not %02x]\n",
+						i, dst_data[i], src_data[i]);
 				return -1;
 			}
 		rte_pktmbuf_free(src);
 		rte_pktmbuf_free(dst);
 	} while (0);
 
-	/* test doing multiple copies */
+	/* test doing a multiple single 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;
+		const uint16_t max_ops = 4;
+		struct rte_mbuf *src, *dst;
+		char *src_data, *dst_data;
+		struct rte_mbuf *completed[32] = {0};
+		const uint16_t max_completions = RTE_DIM(completed) / 2;
 
-			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 *);
+		src = rte_pktmbuf_alloc(pool);
+		dst = rte_pktmbuf_alloc(pool);
+		src_data = rte_pktmbuf_mtod(src, char *);
+		dst_data = rte_pktmbuf_mtod(dst, char *);
 
-			for (j = 0; j < length; j++)
-				src_data[j] = rand() & 0xFF;
+		for (i = 0; i < COPY_LEN; i++)
+			src_data[i] = rand() & 0xFF;
 
+		/* perform the same copy <max_ops> times */
+		for (i = 0; i < max_ops; i++) {
 			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]) != 1) {
-				PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
-						i);
+					src->buf_iova + src->data_off,
+					dst->buf_iova + dst->data_off,
+					COPY_LEN,
+					(uintptr_t)src,
+					(uintptr_t)dst) != 1) {
+				PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
 				return -1;
 			}
+			rte_ioat_perform_ops(dev_id);
 		}
-		rte_ioat_perform_ops(dev_id);
-		usleep(100);
+		usleep(10);
 
-		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
-				(void *)completed_dst) != RTE_DIM(srcs)) {
+		if (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],
+				(void *)&completed[max_completions]) != max_ops) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
 			return -1;
 		}
-		for (i = 0; i < RTE_DIM(srcs); i++) {
-			char *src_data, *dst_data;
+		if (completed[0] != src || completed[max_completions] != dst) {
+			PRINT_ERR("Error with completions: got (%p, %p), not (%p,%p)\n",
+					completed[0], completed[max_completions], src, dst);
+			return -1;
+		}
 
-			if (completed_src[i] != srcs[i]) {
-				PRINT_ERR("Error with source pointer %u\n", i);
-				return -1;
-			}
-			if (completed_dst[i] != dsts[i]) {
-				PRINT_ERR("Error with dest pointer %u\n", i);
+		for (i = 0; i < COPY_LEN; i++)
+			if (dst_data[i] != src_data[i]) {
+				PRINT_ERR("Data mismatch at char %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]) {
-					PRINT_ERR("Error with copy of packet %u, byte %u\n",
-							i, j);
-					return -1;
-				}
-			rte_pktmbuf_free(srcs[i]);
-			rte_pktmbuf_free(dsts[i]);
-		}
-
+		rte_pktmbuf_free(src);
+		rte_pktmbuf_free(dst);
 	} while (0);
 
+	/* test doing multiple copies */
+	do_multi_copies(dev_id, 0, 0); /* enqueue and complete one batch at a time */
+	do_multi_copies(dev_id, 1, 0); /* enqueue 2 batches and then complete both */
+	do_multi_copies(dev_id, 0, 1); /* enqueue 1 batch, then complete in two halves */
 	return 0;
 }
 
 static int
 test_enqueue_fill(int dev_id)
 {
-	const unsigned int length[] = {8, 64, 1024, 50, 100, 89};
+	const unsigned int lengths[] = {8, 64, 1024, 50, 100, 89};
 	struct rte_mbuf *dst = rte_pktmbuf_alloc(pool);
 	char *dst_data = rte_pktmbuf_mtod(dst, char *);
 	struct rte_mbuf *completed[2] = {0};
 	uint64_t pattern = 0xfedcba9876543210;
 	unsigned int i, j;
 
-	for (i = 0; i < RTE_DIM(length); i++) {
+	for (i = 0; i < RTE_DIM(lengths); i++) {
 		/* reset dst_data */
-		memset(dst_data, 0, length[i]);
+		memset(dst_data, 0, lengths[i]);
 
 		/* perform the fill operation */
 		if (rte_ioat_enqueue_fill(dev_id, pattern,
-				dst->buf_iova + dst->data_off, length[i],
+				dst->buf_iova + dst->data_off, lengths[i],
 				(uintptr_t)dst) != 1) {
 			PRINT_ERR("Error with rte_ioat_enqueue_fill\n");
 			return -1;
@@ -186,11 +261,11 @@ test_enqueue_fill(int dev_id)
 			return -1;
 		}
 		/* check the result */
-		for (j = 0; j < length[i]; j++) {
+		for (j = 0; j < lengths[i]; j++) {
 			char pat_byte = ((char *)&pattern)[j % 8];
 			if (dst_data[j] != pat_byte) {
-				PRINT_ERR("Error with fill operation (length = %u): got (%x), not (%x)\n",
-						length[i], dst_data[j],
+				PRINT_ERR("Error with fill operation (lengths = %u): got (%x), not (%x)\n",
+						lengths[i], dst_data[j],
 						pat_byte);
 				return -1;
 			}
Signature · 1 line
2.30.2
#4 lore raw

PATCH v2 2/12 raw/ioat: support limiting queues for idxd PCI device

In reply to Bruce Richardson

When using a full device instance via vfio, allow the user to specify a maximum number of queues to configure rather than always using the max number of supported queues.

---
 doc/guides/rawdevs/ioat.rst |  8 ++++++++
 drivers/raw/ioat/idxd_pci.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)
doc/guides/rawdevs/ioat.rst +8 -0
index 250cfc48a6..60438cc3bc 100644
@@ -106,6 +106,14 @@ For devices bound to a suitable DPDK-supported VFIO/UIO driver, the HW devices w
 be found as part of the device scan done at application initialization time without
 the need to pass parameters to the application.
 
+For Intel\ |reg| DSA devices, DPDK will automatically configure the device with the
+maximum number of workqueues available on it, partitioning all resources equally
+among the queues.
+If fewer workqueues are required, then the ``max_queues`` parameter may be passed to
+the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e.g.::
+
+	$ dpdk-test -a <b:d:f>,max_queues=4
+
 If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
 then a specific work queue needs to be passed to the application via a vdev parameter.
 This vdev parameter take the driver name and work queue name as parameters.
drivers/raw/ioat/idxd_pci.c +26 -2
index 01623f33f6..b48e565b4c 100644
@@ -4,6 +4,7 @@
 
 #include <rte_bus_pci.h>
 #include <rte_memzone.h>
+#include <rte_devargs.h>
 
 #include "ioat_private.h"
 #include "ioat_spec.h"
@@ -123,7 +124,8 @@ static const struct rte_rawdev_ops idxd_pci_ops = {
 #define IDXD_PORTAL_SIZE (4096 * 4)
 
 static int
-init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
+init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd,
+		unsigned int max_queues)
 {
 	struct idxd_pci_common *pci;
 	uint8_t nb_groups, nb_engines, nb_wqs;
@@ -179,6 +181,16 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
 	for (i = 0; i < nb_wqs; i++)
 		idxd_get_wq_cfg(pci, i)[0] = 0;
 
+	/* limit queues if necessary */
+	if (max_queues != 0 && nb_wqs > max_queues) {
+		nb_wqs = max_queues;
+		if (nb_engines > max_queues)
+			nb_engines = max_queues;
+		if (nb_groups > max_queues)
+			nb_engines = max_queues;
+		IOAT_PMD_DEBUG("Limiting queues to %u", nb_wqs);
+	}
+
 	/* put each engine into a separate group to avoid reordering */
 	if (nb_groups > nb_engines)
 		nb_groups = nb_engines;
@@ -242,12 +254,23 @@ idxd_rawdev_probe_pci(struct rte_pci_driver *drv, struct rte_pci_device *dev)
 	uint8_t nb_wqs;
 	int qid, ret = 0;
 	char name[PCI_PRI_STR_SIZE];
+	unsigned int max_queues = 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 = init_pci_device(dev, &idxd);
+	if (dev->device.devargs && dev->device.devargs->args[0] != '\0') {
+		/* if the number of devargs grows beyond just 1, use rte_kvargs */
+		if (sscanf(dev->device.devargs->args,
+				"max_queues=%u", &max_queues) != 1) {
+			IOAT_PMD_ERR("Invalid device parameter: '%s'",
+					dev->device.devargs->args);
+			return -1;
+		}
+	}
+
+	ret = init_pci_device(dev, &idxd, max_queues);
 	if (ret < 0) {
 		IOAT_PMD_ERR("Error initializing PCI hardware");
 		return ret;
@@ -353,3 +376,4 @@ RTE_PMD_REGISTER_PCI(IDXD_PMD_RAWDEV_NAME_PCI, idxd_pmd_drv_pci);
 RTE_PMD_REGISTER_PCI_TABLE(IDXD_PMD_RAWDEV_NAME_PCI, pci_id_idxd_map);
 RTE_PMD_REGISTER_KMOD_DEP(IDXD_PMD_RAWDEV_NAME_PCI,
 			  "* igb_uio | uio_pci_generic | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(rawdev_idxd_pci, "max_queues=0");
Signature · 1 line
2.30.2
#5 lore raw

PATCH v2 3/12 raw/ioat: add component prefix to log messages

In reply to Bruce Richardson

Add the driver prefix "IOAT" to log messages for the driver.

---
 drivers/raw/ioat/ioat_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/raw/ioat/ioat_private.h +1 -1
index 6c423811ec..f032d5fe3d 100644
@@ -21,7 +21,7 @@
 extern int ioat_pmd_logtype;
 
 #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
-		ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
+		ioat_pmd_logtype, "IOAT: %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)
Signature · 1 line
2.30.2
#6 lore raw

PATCH v2 4/12 raw/ioat: add explicit padding to descriptor struct

In reply to Bruce Richardson

Add an explicit padding field to the end of the descriptor structure so that when the batch descriptor is defined on the stack for perform-ops, the unused space is all zeroed appropriately.

---
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/raw/ioat/rte_ioat_rawdev_fns.h +4 -1
index c2c4601ca7..e96edc9053 100644
@@ -140,7 +140,10 @@ struct rte_idxd_hw_desc {
 
 	uint32_t size;    /* length of data for op, or batch size */
 
-	/* 28 bytes of padding here */
+	uint16_t intr_handle; /* completion interrupt handle */
+
+	/* remaining 26 bytes are reserved */
+	uint16_t __reserved[13];
 } __rte_aligned(64);
 
 /**
Signature · 1 line
2.30.2
#7 lore raw

PATCH v2 5/12 raw/ioat: fix script for configuring small number of queues

In reply to Bruce Richardson

The dpdk_idxd_cfg.py script included with the driver for convenience did not work properly where the number of queues to be configured was less than the number of groups or engines. This was because there would be configured groups/engines not assigned to queues. Fix this by limiting the engine and group counts to be no bigger than the number of queues.

Fixes 01863b9d2354 ("raw/ioat: include example configuration script")
---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/raw/ioat/dpdk_idxd_cfg.py +5 -5
index bce4bb5bd4..56e44063e4 100755
@@ -39,15 +39,15 @@ def configure_dsa(dsa_id, queues):
     max_queues = dsa_dir.read_int("max_work_queues")
     max_tokens = dsa_dir.read_int("max_tokens")
 
-    # we want one engine per group
-    nb_groups = min(max_engines, max_groups)
-    for grp in range(nb_groups):
-        dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
-
     nb_queues = min(queues, max_queues)
     if queues > nb_queues:
         print(f"Setting number of queues to max supported value: {max_queues}")
 
+    # we want one engine per group, and no more engines than queues
+    nb_groups = min(max_engines, max_groups, nb_queues)
+    for grp in range(nb_groups):
+        dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
+
     # configure each queue
     for q in range(nb_queues):
         wq_dir = SysfsDir(os.path.join(dsa_dir.path, f"wq{dsa_id}.{q}"))
Signature · 1 line
2.30.2
#8 lore raw

PATCH v2 6/12 raw/ioat: make workqueue name configurable in script

In reply to Bruce Richardson

Add a "--name-prefix" parameter to the quick configuration script for DSA. This allows the queues configured on a DSA instance to be made available to only one DPDK process in a setup with multiple DPDK process instances.

---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/raw/ioat/dpdk_idxd_cfg.py +6 -3
index 56e44063e4..ff06d9e240 100755
@@ -29,7 +29,7 @@ def write_values(self, values):
                 f.write(str(contents))
 
 
-def configure_dsa(dsa_id, queues):
+def configure_dsa(dsa_id, queues, prefix):
     "Configure the DSA instance with appropriate number of queues"
     dsa_dir = SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}")
     drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa")
@@ -54,7 +54,7 @@ def configure_dsa(dsa_id, queues):
         wq_dir.write_values({"group_id": q % nb_groups,
                              "type": "user",
                              "mode": "dedicated",
-                             "name": f"dpdk_wq{dsa_id}.{q}",
+                             "name": f"{prefix}_wq{dsa_id}.{q}",
                              "priority": 1,
                              "size": int(max_tokens / nb_queues)})
 
@@ -71,8 +71,11 @@ def main(args):
     arg_p.add_argument('dsa_id', type=int, help="DSA instance number")
     arg_p.add_argument('-q', metavar='queues', type=int, default=255,
                        help="Number of queues to set up")
+    arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix',
+                       default="dpdk",
+                       help="Prefix for workqueue name to mark for DPDK use [default: 'dpdk']")
     parsed_args = arg_p.parse_args(args[1:])
-    configure_dsa(parsed_args.dsa_id, parsed_args.q)
+    configure_dsa(parsed_args.dsa_id, parsed_args.q, parsed_args.prefix)
 
 
 if __name__ == "__main__":
Signature · 1 line
2.30.2
#9 lore raw

PATCH v2 7/12 raw/ioat: allow perform operations function to return error

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Change the return type for the rte_ioat_perform_ops() function from void to int to allow the possibility of returning an error code in future, should it be necessary.

---
 drivers/raw/ioat/rte_ioat_rawdev.h     |  4 +++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 11 +++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/raw/ioat/rte_ioat_rawdev.h +3 -1
index f9e8425a7f..e5a22a0799 100644
@@ -124,8 +124,10 @@ rte_ioat_fence(int dev_id);
  *
  * @param dev_id
  *   The rawdev device id of the ioat instance
+ * @return
+ *   0 on success. Non-zero return on error.
  */
-static inline void
+static inline int
 __rte_experimental
 rte_ioat_perform_ops(int dev_id);
 
drivers/raw/ioat/rte_ioat_rawdev_fns.h +7 -4
index e96edc9053..477c1b7b41 100644
@@ -291,7 +291,7 @@ __ioat_fence(int dev_id)
 /*
  * Trigger hardware to begin performing enqueued operations
  */
-static __rte_always_inline void
+static __rte_always_inline int
 __ioat_perform_ops(int dev_id)
 {
 	struct rte_ioat_rawdev *ioat =
@@ -301,6 +301,8 @@ __ioat_perform_ops(int dev_id)
 	rte_compiler_barrier();
 	*ioat->doorbell = ioat->next_write;
 	ioat->xstats.started = ioat->xstats.enqueued;
+
+	return 0;
 }
 
 /**
@@ -462,7 +464,7 @@ __idxd_movdir64b(volatile void *dst, const void *src)
 			: "a" (dst), "d" (src));
 }
 
-static __rte_always_inline void
+static __rte_always_inline int
 __idxd_perform_ops(int dev_id)
 {
 	struct rte_idxd_rawdev *idxd =
@@ -470,7 +472,7 @@ __idxd_perform_ops(int dev_id)
 	struct rte_idxd_desc_batch *b = &idxd->batch_ring[idxd->next_batch];
 
 	if (b->submitted || b->op_count == 0)
-		return;
+		return 0;
 	b->hdl_end = idxd->next_free_hdl;
 	b->comp.status = 0;
 	b->submitted = 1;
@@ -480,6 +482,7 @@ __idxd_perform_ops(int dev_id)
 	if (++idxd->next_batch == idxd->batch_ring_sz)
 		idxd->next_batch = 0;
 	idxd->xstats.started = idxd->xstats.enqueued;
+	return 0;
 }
 
 static __rte_always_inline int
@@ -558,7 +561,7 @@ rte_ioat_fence(int dev_id)
 		return __ioat_fence(dev_id);
 }
 
-static inline void
+static inline int
 rte_ioat_perform_ops(int dev_id)
 {
 	enum rte_ioat_dev_type *type =
Signature · 1 line
2.30.2
#10 lore raw

PATCH v2 8/12 raw/ioat: add bus driver for device scanning automatically

In reply to Bruce Richardson

Rather than using a vdev with args, DPDK can scan and initialize the devices automatically using a bus-type driver. This bus does not need to worry about registering device drivers, rather it can initialize the devices directly on probe.

The device instances (queues) to use are detected from /dev with the additional info about them got from /sys.

---
 doc/guides/rawdevs/ioat.rst  |  23 ++-
 drivers/raw/ioat/idxd_bus.c  | 359 +++++++++++++++++++++++++++++++++++
 drivers/raw/ioat/idxd_vdev.c | 231 ----------------------
 drivers/raw/ioat/meson.build |   4 +-
 4 files changed, 374 insertions(+), 243 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
doc/guides/rawdevs/ioat.rst +13 -10
index 60438cc3bc..2ad13db294 100644
@@ -78,7 +78,7 @@ Example configuration for a work queue::
 
         $ accel-config config-wq dsa0/wq0.0 --group-id=0 \
            --mode=dedicated --priority=10 --wq-size=8 \
-           --type=user --name=app1
+           --type=user --name=dpdk_app1
 
 Once the devices have been configured, they need to be enabled::
 
@@ -114,15 +114,18 @@ the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e
 
 	$ dpdk-test -a <b:d:f>,max_queues=4
 
-If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
-then a specific work queue needs to be passed to the application via a vdev parameter.
-This vdev parameter take the driver name and work queue name as parameters.
-For example, to use work queue 0 on Intel\ |reg| DSA instance 0::
-
-        $ dpdk-test --no-pci --vdev=rawdev_idxd,wq=0.0
-
-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
+For devices bound to the IDXD kernel driver,
+the DPDK ioat driver will automatically perform a scan for available workqueues to use.
+Any workqueues found listed in ``/dev/dsa`` on the system will be checked in ``/sys``,
+and any which have ``dpdk_`` prefix in their name will be automatically probed by the
+driver to make them available to the application.
+Alternatively, to support use by multiple DPDK processes simultaneously,
+the value used as the DPDK ``--file-prefix`` parameter may be used as a workqueue name prefix,
+instead of ``dpdk_``,
+allowing each DPDK application instance to only use a subset of configured queues.
+
+Once probed successfully, irrespective of kernel driver, 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
drivers/raw/ioat/idxd_bus.c new file +359 -0

359 lines not on this page · raw message

drivers/raw/ioat/idxd_vdev.c deleted +0 -231

231 lines not on this page · raw message

drivers/raw/ioat/meson.build +2 -2
index 3b8ea65398..6382a826e7 100644
@@ -4,13 +4,13 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'
 sources = files(
+        'idxd_bus.c',
         'idxd_pci.c',
-        'idxd_vdev.c',
         'ioat_common.c',
         'ioat_rawdev.c',
         'ioat_rawdev_test.c',
 )
-deps += ['bus_pci', 'bus_vdev', 'mbuf', 'rawdev']
+deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
         'rte_ioat_rawdev_fns.h',
Signature · 1 line
2.30.2
#11 lore raw

PATCH v2 9/12 raw/ioat: move idxd functions to separate file

In reply to Bruce Richardson

Split the rte_ioat_rawdev_fns.h file into two separate headers, so that the data structures for the original ioat devices and the newer idxd ones can be kept separate from each other. This makes code management and rework easier.

---
 drivers/raw/ioat/meson.build           |   1 +
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 275 ++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 310 ++-----------------------
 3 files changed, 299 insertions(+), 287 deletions(-)
 create mode 100644 drivers/raw/ioat/rte_idxd_rawdev_fns.h
drivers/raw/ioat/meson.build +1 -0
index 6382a826e7..0e81cb5951 100644
@@ -13,5 +13,6 @@ sources = files(
 deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
+        'rte_idxd_rawdev_fns.h',
         'rte_ioat_rawdev_fns.h',
 )
drivers/raw/ioat/rte_idxd_rawdev_fns.h new file +275 -0

275 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev_fns.h +23 -287

334 lines not on this page · raw message

Signature · 1 line
2.30.2
#12 lore raw

PATCH v2 10/12 raw/ioat: rework SW ring layout

In reply to Bruce Richardson

The ring management in the idxd part of the driver is more complex than it needs to be, tracking individual batches in a ring and having null descriptors as padding to avoid having single-operation batches. This can be simplified by using a regular ring-based layout, with additional overflow at the end to ensure that the one does not need to wrap within a batch.

---
 drivers/raw/ioat/idxd_pci.c            |   5 +-
 drivers/raw/ioat/ioat_common.c         |  99 +++++------
 drivers/raw/ioat/ioat_rawdev_test.c    |   1 +
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 233 +++++++++++++------------
 4 files changed, 179 insertions(+), 159 deletions(-)
drivers/raw/ioat/idxd_pci.c +3 -2
index b48e565b4c..13515dbc6c 100644
@@ -90,7 +90,7 @@ idxd_pci_dev_start(struct rte_rawdev *dev)
 		return 0;
 	}
 
-	if (idxd->public.batch_ring == NULL) {
+	if (idxd->public.desc_ring == NULL) {
 		IOAT_PMD_ERR("WQ %d has not been fully configured", idxd->qid);
 		return -EINVAL;
 	}
@@ -337,7 +337,8 @@ idxd_rawdev_destroy(const char *name)
 	/* free device memory */
 	IOAT_PMD_DEBUG("Freeing device driver memory");
 	rdev->dev_private = NULL;
-	rte_free(idxd->public.batch_ring);
+	rte_free(idxd->public.batch_idx_ring);
+	rte_free(idxd->public.desc_ring);
 	rte_free(idxd->public.hdl_ring);
 	rte_memzone_free(idxd->mz);
 
drivers/raw/ioat/ioat_common.c +50 -49

155 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +1 -0
index a5064d739d..51eebe152f 100644
@@ -206,6 +206,7 @@ test_enqueue_copies(int dev_id)
 		if (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],
 				(void *)&completed[max_completions]) != max_ops) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
 			return -1;
 		}
 		if (completed[0] != src || completed[max_completions] != dst) {
drivers/raw/ioat/rte_idxd_rawdev_fns.h +125 -108

316 lines not on this page · raw message

Signature · 1 line
2.30.2
#13 lore raw

PATCH v2 11/12 raw/ioat: add API to query remaining ring space

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Add a new API to query remaining descriptor ring capacity. This API is useful, for example, when an application needs to enqueue a fragmented packet and wants to ensure that all segments of the packet will be enqueued together.

---
 drivers/raw/ioat/ioat_rawdev_test.c    | 138 ++++++++++++++++++++++++-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h |  22 ++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h |  24 +++++
 3 files changed, 183 insertions(+), 1 deletion(-)
drivers/raw/ioat/ioat_rawdev_test.c +137 -1
index 51eebe152f..5f75c6ff69 100644
@@ -277,6 +277,138 @@ test_enqueue_fill(int dev_id)
 	return 0;
 }
 
+static inline void
+reset_ring_ptrs(int dev_id)
+{
+	enum rte_ioat_dev_type *type =
+		(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+
+	if (*type == RTE_IDXD_DEV) {
+		struct rte_idxd_rawdev *idxd =
+			(struct rte_idxd_rawdev *)rte_rawdevs[dev_id].dev_private;
+
+		idxd->batch_start = 0;
+		idxd->hdls_read = 0;
+	} else {
+		struct rte_ioat_rawdev *ioat =
+			(struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private;
+
+		ioat->next_read = 0;
+		ioat->next_write = 0;
+	}
+}
+
+static int
+test_burst_capacity(int dev_id)
+{
+#define BURST_SIZE			64
+	struct rte_mbuf *src, *dst;
+	unsigned int bursts_enqueued = 0;
+	unsigned int i;
+	unsigned int length = 1024;
+	uintptr_t completions[BURST_SIZE];
+
+	/* Ring pointer reset needed for checking test results */
+	reset_ring_ptrs(dev_id);
+
+	const unsigned int ring_space = rte_ioat_burst_capacity(dev_id);
+	const unsigned int expected_bursts = (ring_space)/BURST_SIZE;
+	src = rte_pktmbuf_alloc(pool);
+	dst = rte_pktmbuf_alloc(pool);
+
+	/* Enqueue burst until they won't fit */
+	while (rte_ioat_burst_capacity(dev_id) >= BURST_SIZE) {
+		for (i = 0; i < BURST_SIZE; i++) {
+
+			if (rte_ioat_enqueue_copy(dev_id, rte_pktmbuf_iova(src),
+					rte_pktmbuf_iova(dst), length, 0, 0) != 1) {
+				PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
+				return -1;
+			}
+		}
+		bursts_enqueued++;
+		if ((i & 1) == 1) /* hit doorbell every second burst */
+			rte_ioat_perform_ops(dev_id);
+	}
+	rte_ioat_perform_ops(dev_id);
+
+	/* check the number of bursts enqueued was as expected */
+	if (bursts_enqueued != expected_bursts) {
+		PRINT_ERR("Capacity test failed, enqueued %u not %u bursts\n",
+				bursts_enqueued, expected_bursts);
+		return -1;
+	}
+
+	/* check the space is now as expected */
+	if (rte_ioat_burst_capacity(dev_id) != ring_space - bursts_enqueued * BURST_SIZE) {
+		printf("Capacity error. Expected %u free slots, got %u\n",
+				ring_space - bursts_enqueued * BURST_SIZE,
+				rte_ioat_burst_capacity(dev_id));
+		return -1;
+	}
+
+	/* do cleanup before next tests */
+	usleep(100);
+	for (i = 0; i < bursts_enqueued; i++) {
+		if (rte_ioat_completed_ops(dev_id, BURST_SIZE, completions,
+				completions) != BURST_SIZE) {
+			PRINT_ERR("error with completions\n");
+			return -1;
+		}
+	}
+
+	/* Since we reset the ring pointers before the previous test, and we enqueued
+	 * the max amount of bursts, enqueuing one more burst will enable us to test
+	 * the wrap around handling in rte_ioat_burst_capacity().
+	 */
+
+	/* Verify the descriptor ring is empty before we test */
+	if (rte_ioat_burst_capacity(dev_id) != ring_space) {
+		PRINT_ERR("Error, ring should be empty\n");
+		return -1;
+	}
+
+	/* Enqueue one burst of mbufs & verify the expected space is taken */
+	for (i = 0; i < BURST_SIZE; i++) {
+		if (rte_ioat_enqueue_copy(dev_id, rte_pktmbuf_iova(src),
+				rte_pktmbuf_iova(dst), length, 0, 0) != 1) {
+			PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
+			return -1;
+		}
+	}
+
+	/* Perform the copy before checking the capacity again so that the write
+	 * pointer in the descriptor ring is wrapped/masked
+	 */
+	rte_ioat_perform_ops(dev_id);
+	usleep(100);
+
+	/* This check will confirm both that the correct amount of space is taken
+	 * the ring, and that the ring wrap around handling is correct.
+	 */
+	if (rte_ioat_burst_capacity(dev_id) != ring_space - BURST_SIZE) {
+		PRINT_ERR("Error, space available not as expected\n");
+		return -1;
+	}
+
+	/* Now we gather completions to update the read pointer */
+	if (rte_ioat_completed_ops(dev_id, BURST_SIZE, completions, completions) != BURST_SIZE) {
+		PRINT_ERR("Error with completions\n");
+		return -1;
+	}
+
+	/* After gathering the completions, the descriptor ring should be empty */
+	if (rte_ioat_burst_capacity(dev_id) != ring_space) {
+		PRINT_ERR("Error, space available not as expected\n");
+		return -1;
+	}
+
+	rte_pktmbuf_free(src);
+	rte_pktmbuf_free(dst);
+
+	return 0;
+}
+
 int
 ioat_rawdev_test(uint16_t dev_id)
 {
@@ -321,7 +453,7 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 
 	pool = rte_pktmbuf_pool_create("TEST_IOAT_POOL",
-			256, /* n == num elements */
+			p.ring_size * 2, /* n == num elements */
 			32,  /* cache size */
 			0,   /* priv size */
 			2048, /* data room size */
@@ -385,6 +517,10 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 	printf("\n");
 
+	printf("Running Burst Capacity Test\n");
+	if (test_burst_capacity(dev_id) != 0)
+		goto err;
+
 	rte_rawdev_stop(dev_id);
 	if (rte_rawdev_xstats_reset(dev_id, NULL, 0) != 0) {
 		PRINT_ERR("Error resetting xstat values\n");
drivers/raw/ioat/rte_idxd_rawdev_fns.h +22 -0
index 4c49d2b84a..41f0ad6e99 100644
@@ -106,6 +106,28 @@ struct rte_idxd_rawdev {
 	struct rte_idxd_user_hdl *hdl_ring;
 };
 
+static __rte_always_inline uint16_t
+__idxd_burst_capacity(int dev_id)
+{
+	struct rte_idxd_rawdev *idxd =
+			(struct rte_idxd_rawdev *)rte_rawdevs[dev_id].dev_private;
+	uint16_t write_idx = idxd->batch_start + idxd->batch_size;
+	uint16_t used_space;
+
+	/* Check for space in the batch ring */
+	if ((idxd->batch_idx_read == 0 && idxd->batch_idx_write == idxd->max_batches) ||
+			idxd->batch_idx_write + 1 == idxd->batch_idx_read)
+		return 0;
+
+	/* for descriptors, check for wrap-around on write but not read */
+	if (idxd->hdls_read > write_idx)
+		write_idx += idxd->desc_ring_mask + 1;
+	used_space = write_idx - idxd->hdls_read;
+
+	/* Return amount of free space in the descriptor ring */
+	return idxd->desc_ring_mask - used_space;
+}
+
 static __rte_always_inline rte_iova_t
 __desc_idx_to_iova(struct rte_idxd_rawdev *idxd, uint16_t n)
 {
drivers/raw/ioat/rte_ioat_rawdev_fns.h +24 -0
index 598852b1fa..92ccdd03b9 100644
@@ -100,6 +100,19 @@ struct rte_ioat_rawdev {
 #define RTE_IOAT_CHANSTS_HALTED			0x3
 #define RTE_IOAT_CHANSTS_ARMED			0x4
 
+static __rte_always_inline uint16_t
+__ioat_burst_capacity(int dev_id)
+{
+	struct rte_ioat_rawdev *ioat =
+			(struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private;
+	unsigned short size = ioat->ring_size - 1;
+	unsigned short read = ioat->next_read;
+	unsigned short write = ioat->next_write;
+	unsigned short space = size - (write - read);
+
+	return space;
+}
+
 static __rte_always_inline int
 __ioat_write_desc(int dev_id, uint32_t op, uint64_t src, phys_addr_t dst,
 		unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl)
@@ -260,6 +273,17 @@ __ioat_completed_ops(int dev_id, uint8_t max_copies,
 	return count;
 }
 
+static inline uint16_t
+rte_ioat_burst_capacity(int dev_id)
+{
+	enum rte_ioat_dev_type *type =
+		(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+	if (*type == RTE_IDXD_DEV)
+		return __idxd_burst_capacity(dev_id);
+	else
+		return __ioat_burst_capacity(dev_id);
+}
+
 static inline int
 rte_ioat_enqueue_fill(int dev_id, uint64_t pattern, phys_addr_t dst,
 		unsigned int len, uintptr_t dst_hdl)
Signature · 1 line
2.30.2
#14 lore raw

PATCH v2 12/12 raw/ioat: report status of completed jobs

In reply to Bruce Richardson

Add improved error handling to rte_ioat_completed_ops(). This patch adds new parameters to the function to enable the user to track the completion status of each individual operation in a batch. With this addition, the function can help the user to determine firstly, how many operations may have failed or been skipped and then secondly, which specific operations did not complete successfully.

---
 doc/guides/rel_notes/release_21_05.rst |   5 +
 drivers/raw/ioat/ioat_common.c         |   9 +
 drivers/raw/ioat/ioat_rawdev_test.c    | 300 +++++++++++++++++++++++--
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 146 ++++++++----
 drivers/raw/ioat/rte_ioat_rawdev.h     |  53 ++++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h |  15 +-
 examples/ioat/ioatfwd.c                |  14 +-
 examples/vhost/ioat.c                  |   2 +-
 8 files changed, 464 insertions(+), 80 deletions(-)
doc/guides/rel_notes/release_21_05.rst +5 -0
index b3224dc332..7f29f5789f 100644
@@ -329,6 +329,11 @@ API Changes
   ``policer_action_recolor_supported`` and ``policer_action_drop_supported``
   have been removed.
 
+* raw/ioat: The experimental function ``rte_ioat_completed_ops()`` now
+  supports two additional parameters, ``status`` and ``num_unsuccessful``,
+  to allow the reporting of errors from hardware when performing copy
+  operations.
+
 
 ABI Changes
 -----------
drivers/raw/ioat/ioat_common.c +9 -0
index fcb30572e6..d01c1ee367 100644
@@ -162,6 +162,15 @@ idxd_dev_configure(const struct rte_rawdev *dev,
 		rte_idxd->desc_ring = NULL;
 		return -ENOMEM;
 	}
+	rte_idxd->hdl_ring_flags = rte_zmalloc(NULL,
+			sizeof(*rte_idxd->hdl_ring_flags) * max_desc, 0);
+	if (rte_idxd->hdl_ring_flags == NULL) {
+		rte_free(rte_idxd->desc_ring);
+		rte_free(rte_idxd->hdl_ring);
+		rte_idxd->desc_ring = NULL;
+		rte_idxd->hdl_ring = NULL;
+		return -ENOMEM;
+	}
 	rte_idxd->hdls_read = rte_idxd->batch_start = 0;
 	rte_idxd->batch_size = 0;
 
drivers/raw/ioat/ioat_rawdev_test.c +279 -21

410 lines not on this page · raw message

drivers/raw/ioat/rte_idxd_rawdev_fns.h +104 -42

217 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +45 -8

91 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev_fns.h +11 -4
index 92ccdd03b9..9b8a9fa88e 100644
@@ -334,16 +334,22 @@ rte_ioat_perform_ops(int dev_id)
 
 static inline int
 rte_ioat_completed_ops(int dev_id, uint8_t max_copies,
+		uint32_t *status, uint8_t *num_unsuccessful,
 		uintptr_t *src_hdls, uintptr_t *dst_hdls)
 {
 	enum rte_ioat_dev_type *type =
 			(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+	uint8_t tmp; /* used so functions don't need to check for null parameter */
+
+	if (num_unsuccessful == NULL)
+		num_unsuccessful = &tmp;
+
+	*num_unsuccessful = 0;
 	if (*type == RTE_IDXD_DEV)
-		return __idxd_completed_ops(dev_id, max_copies,
+		return __idxd_completed_ops(dev_id, max_copies, status, num_unsuccessful,
 				src_hdls, dst_hdls);
 	else
-		return __ioat_completed_ops(dev_id,  max_copies,
-				src_hdls, dst_hdls);
+		return __ioat_completed_ops(dev_id, max_copies, src_hdls, dst_hdls);
 }
 
 static inline void
@@ -355,7 +361,8 @@ __rte_deprecated_msg("use rte_ioat_completed_ops() instead")
 rte_ioat_completed_copies(int dev_id, uint8_t max_copies,
 		uintptr_t *src_hdls, uintptr_t *dst_hdls)
 {
-	return rte_ioat_completed_ops(dev_id, max_copies, src_hdls, dst_hdls);
+	return rte_ioat_completed_ops(dev_id, max_copies, NULL, NULL,
+			src_hdls, dst_hdls);
 }
 
 #endif /* _RTE_IOAT_RAWDEV_FNS_H_ */
examples/ioat/ioatfwd.c +10 -4
index 845301a6db..2e377e2d4b 100644
@@ -447,12 +447,15 @@ ioat_tx_port(struct rxtx_port_config *tx_config)
 
 	for (i = 0; i < tx_config->nb_queues; i++) {
 		if (copy_mode == COPY_MODE_IOAT_NUM) {
-			/* Deque the mbufs from IOAT device. */
+			/* Dequeue the mbufs from IOAT device. Since all memory
+			 * is DPDK pinned memory and therefore all addresses should
+			 * be valid, we don't check for copy errors
+			 */
 			nb_dq = rte_ioat_completed_ops(
-				tx_config->ioat_ids[i], MAX_PKT_BURST,
+				tx_config->ioat_ids[i], MAX_PKT_BURST, NULL, NULL,
 				(void *)mbufs_src, (void *)mbufs_dst);
 		} else {
-			/* Deque the mbufs from rx_to_tx_ring. */
+			/* Dequeue the mbufs from rx_to_tx_ring. */
 			nb_dq = rte_ring_dequeue_burst(
 				tx_config->rx_to_tx_ring, (void *)mbufs_dst,
 				MAX_PKT_BURST, NULL);
@@ -725,7 +728,10 @@ check_link_status(uint32_t port_mask)
 static void
 configure_rawdev_queue(uint32_t dev_id)
 {
-	struct rte_ioat_rawdev_config dev_config = { .ring_size = ring_size };
+	struct rte_ioat_rawdev_config dev_config = {
+			.ring_size = ring_size,
+			.no_prefetch_completions = (cfg.nb_lcores > 1),
+	};
 	struct rte_rawdev_info info = { .dev_private = &dev_config };
 
 	if (rte_rawdev_configure(dev_id, &info, sizeof(dev_config)) != 0) {
examples/vhost/ioat.c +1 -1
index 60b73be936..efdd3f6f76 100644
@@ -183,7 +183,7 @@ ioat_check_completed_copies_cb(int vid, uint16_t queue_id,
 
 		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
-		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
+		n_seg = rte_ioat_completed_ops(dev_id, 255, NULL, NULL, dump, dump);
 		if (n_seg < 0) {
 			RTE_LOG(ERR,
 				VHOST_DATA,
Signature · 1 line
2.30.2
#15 lore raw

PATCH 2/6 raw/ioat: add component prefix to log messages

In reply to Bruce Richardson

Add the driver prefix "IOAT" to log messages for the driver.

---
 drivers/raw/ioat/ioat_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/raw/ioat/ioat_private.h +1 -1
index 6c423811ec..f032d5fe3d 100644
@@ -21,7 +21,7 @@
 extern int ioat_pmd_logtype;
 
 #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
-		ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
+		ioat_pmd_logtype, "IOAT: %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)
Signature · 1 line
2.27.0
#16 lore raw

PATCH 3/6 raw/ioat: add explicit padding to descriptor struct

In reply to Bruce Richardson

Add an explicit padding field to the end of the descriptor structure so that when the batch descriptor is defined on the stack for perform-ops, the unused space is all zeroed appropriately.

---
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/raw/ioat/rte_ioat_rawdev_fns.h +4 -1
index c2c4601ca7..e96edc9053 100644
@@ -140,7 +140,10 @@ struct rte_idxd_hw_desc {
 
 	uint32_t size;    /* length of data for op, or batch size */
 
-	/* 28 bytes of padding here */
+	uint16_t intr_handle; /* completion interrupt handle */
+
+	/* remaining 26 bytes are reserved */
+	uint16_t __reserved[13];
 } __rte_aligned(64);
 
 /**
Signature · 1 line
2.27.0
#17 lore raw

PATCH 4/6 raw/ioat: rework SW ring layout

In reply to Bruce Richardson

The ring management in the idxd part of the driver is more complex than it needs to be, tracking individual batches in a ring and having null descriptors as padding to avoid having single-operation batches. This can be simplified by using a regular ring-based layout, with additional overflow at the end to ensure that the one does not need to wrap within a batch.

---
 drivers/raw/ioat/idxd_pci.c            |   5 +-
 drivers/raw/ioat/idxd_vdev.c           |   3 +-
 drivers/raw/ioat/ioat_common.c         |  99 +++++------
 drivers/raw/ioat/ioat_rawdev_test.c    |   1 +
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 229 +++++++++++++------------
 5 files changed, 179 insertions(+), 158 deletions(-)
drivers/raw/ioat/idxd_pci.c +3 -2
index b48e565b4c..13515dbc6c 100644
@@ -90,7 +90,7 @@ idxd_pci_dev_start(struct rte_rawdev *dev)
 		return 0;
 	}
 
-	if (idxd->public.batch_ring == NULL) {
+	if (idxd->public.desc_ring == NULL) {
 		IOAT_PMD_ERR("WQ %d has not been fully configured", idxd->qid);
 		return -EINVAL;
 	}
@@ -337,7 +337,8 @@ idxd_rawdev_destroy(const char *name)
 	/* free device memory */
 	IOAT_PMD_DEBUG("Freeing device driver memory");
 	rdev->dev_private = NULL;
-	rte_free(idxd->public.batch_ring);
+	rte_free(idxd->public.batch_idx_ring);
+	rte_free(idxd->public.desc_ring);
 	rte_free(idxd->public.hdl_ring);
 	rte_memzone_free(idxd->mz);
 
drivers/raw/ioat/idxd_vdev.c +2 -1
index 30a53b3b82..af585053b4 100644
@@ -209,7 +209,8 @@ idxd_rawdev_remove_vdev(struct rte_vdev_device *vdev)
 			ret = -errno;
 		}
 
-		rte_free(idxd->public.batch_ring);
+		rte_free(idxd->public.batch_idx_ring);
+		rte_free(idxd->public.desc_ring);
 		rte_free(idxd->public.hdl_ring);
 
 		rte_memzone_free(idxd->mz);
drivers/raw/ioat/ioat_common.c +50 -49

155 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +1 -0
index 101f24a677..3de8273704 100644
@@ -124,6 +124,7 @@ test_enqueue_copies(int dev_id)
 		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
 				(void *)completed_dst) != RTE_DIM(srcs)) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
 			return -1;
 		}
 		for (i = 0; i < RTE_DIM(srcs); i++) {
drivers/raw/ioat/rte_ioat_rawdev_fns.h +123 -106

316 lines not on this page · raw message

Signature · 1 line
2.27.0
#18 lore raw

PATCH 5/6 raw/ioat: add api to query remaining ring space

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Add a new API to query remaining descriptor ring capacity. This API is useful, for example, when an application needs to enqueue a fragmented packet and wants to ensure that all segments of the packet will be enqueued together.

---
 drivers/raw/ioat/ioat_rawdev_test.c    | 136 +++++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h |  46 +++++++++
 2 files changed, 182 insertions(+)
drivers/raw/ioat/ioat_rawdev_test.c +136 -0
index 3de8273704..3a4c7a5161 100644
@@ -202,6 +202,138 @@ test_enqueue_fill(int dev_id)
 	return 0;
 }
 
+static int
+test_burst_capacity(int dev_id, unsigned int ring_size)
+{
+	unsigned int i, j;
+	unsigned int length = 1024;
+
+	/* Test to make sure it does not enqueue if we cannot fit the entire burst */
+	do {
+#define BURST_SIZE			19
+#define EXPECTED_REJECTS	5
+		struct rte_mbuf *srcs[BURST_SIZE], *dsts[BURST_SIZE];
+		struct rte_mbuf *completed_src[BURST_SIZE];
+		struct rte_mbuf *completed_dst[BURST_SIZE];
+		unsigned int cnt_success = 0;
+		unsigned int cnt_rejected = 0;
+		unsigned int valid_iters = (ring_size - 1)/BURST_SIZE;
+
+		/* Enqueue burst until they won't fit + some extra iterations which should
+		* be rejected
+		*/
+		for (i = 0; i < valid_iters + EXPECTED_REJECTS; i++) {
+			if (rte_ioat_burst_capacity(dev_id) >= BURST_SIZE) {
+				for (j = 0; j < BURST_SIZE; j++) {
+
+					srcs[j] = rte_pktmbuf_alloc(pool);
+					dsts[j] = rte_pktmbuf_alloc(pool);
+					srcs[j]->data_len = srcs[j]->pkt_len = length;
+					dsts[j]->data_len = dsts[j]->pkt_len = length;
+
+					if (rte_ioat_enqueue_copy(dev_id,
+							srcs[j]->buf_iova + srcs[j]->data_off,
+							dsts[j]->buf_iova + dsts[j]->data_off,
+							length,
+							(uintptr_t)srcs[j],
+							(uintptr_t)dsts[j]) != 1) {
+						PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
+						return -1;
+					}
+
+					rte_pktmbuf_free(srcs[j]);
+					rte_pktmbuf_free(dsts[j]);
+					cnt_success++;
+				}
+			} else {
+				cnt_rejected++;
+			}
+		}
+
+		/* do cleanup before next tests */
+		rte_ioat_perform_ops(dev_id);
+		usleep(100);
+		for (i = 0; i < valid_iters; i++) {
+			if (rte_ioat_completed_ops(dev_id, BURST_SIZE, (void *)completed_src,
+					(void *)completed_dst) != BURST_SIZE) {
+				PRINT_ERR("error with completions\n");
+				return -1;
+			}
+		}
+
+		printf("successful_enqueues: %u  expected_successful: %u  rejected_iters: %u  expected_rejects: %u\n",
+				cnt_success, valid_iters * BURST_SIZE, cnt_rejected,
+				EXPECTED_REJECTS);
+
+		if (!(cnt_success == (valid_iters * BURST_SIZE)) &&
+				!(cnt_rejected == EXPECTED_REJECTS)) {
+			PRINT_ERR("Burst Capacity test failed\n");
+			return -1;
+		}
+	} while (0);
+
+	/* Verify that space is taken and free'd as expected.
+	 * Repeat the test to verify wrap-around handling is correct in
+	 * rte_ioat_burst_capacity().
+	 */
+	for (i = 0; i < ring_size / 32; i++) {
+		struct rte_mbuf *srcs[64], *dsts[64];
+		struct rte_mbuf *completed_src[64];
+		struct rte_mbuf *completed_dst[64];
+
+		/* Make sure the ring is clean before we start */
+		if (rte_ioat_burst_capacity(dev_id) != ring_size - 1) {
+			PRINT_ERR("Error, ring should be empty\n");
+			return -1;
+		}
+
+		/* Enqueue 64 mbufs & verify that space is taken */
+		for (j = 0; j < 64; j++) {
+			srcs[j] = rte_pktmbuf_alloc(pool);
+			dsts[j] = rte_pktmbuf_alloc(pool);
+			srcs[j]->data_len = srcs[j]->pkt_len = length;
+			dsts[j]->data_len = dsts[j]->pkt_len = length;
+
+			if (rte_ioat_enqueue_copy(dev_id,
+					srcs[j]->buf_iova + srcs[j]->data_off,
+					dsts[j]->buf_iova + dsts[j]->data_off,
+					length,
+					(uintptr_t)srcs[j],
+					(uintptr_t)dsts[j]) != 1) {
+				PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
+				return -1;
+			}
+
+			rte_pktmbuf_free(srcs[j]);
+			rte_pktmbuf_free(dsts[j]);
+		}
+
+		if (rte_ioat_burst_capacity(dev_id) != (ring_size - 1) - 64) {
+			PRINT_ERR("Error, space available not as expected\n");
+			return -1;
+		}
+
+		/* Copy, gather completions, and make sure the space is free'd again */
+		rte_ioat_perform_ops(dev_id);
+		usleep(100);
+		for (j = 0; j < 2; j++) {
+			if (rte_ioat_completed_ops(dev_id, 32, (void *)completed_src,
+					(void *)completed_dst) != 32) {
+				PRINT_ERR("error with completions\n");
+				return -1;	
+			}
+		}
+
+		if (rte_ioat_burst_capacity(dev_id) != ring_size - 1) {
+			PRINT_ERR("Error, space available not as expected\n");
+			return -1;
+		}
+
+	}
+
+	return 0;
+}
+
 int
 ioat_rawdev_test(uint16_t dev_id)
 {
@@ -310,6 +442,10 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 	printf("\n");
 
+	printf("Running Burst Capacity Test\n");
+	if (test_burst_capacity(dev_id, expected_ring_size[dev_id]) != 0)
+		goto err;
+
 	rte_rawdev_stop(dev_id);
 	if (rte_rawdev_xstats_reset(dev_id, NULL, 0) != 0) {
 		PRINT_ERR("Error resetting xstat values\n");
drivers/raw/ioat/rte_ioat_rawdev_fns.h +46 -0

64 lines not on this page · raw message

Signature · 1 line
2.27.0
#20 lore raw

PATCH 6/6 raw/ioat: add bus driver for device scanning automatically

In reply to Bruce Richardson

Rather than using a vdev with args, DPDK can scan and initialize the devices automatically using a bus-type driver. This bus does not need to worry about registering device drivers, rather it can initialize the devices directly on probe.

The device instances (queues) to use are detected from /dev with the additional info about them got from /sys.

---
 drivers/raw/ioat/idxd_bus.c  | 320 +++++++++++++++++++++++++++++++++++
 drivers/raw/ioat/idxd_vdev.c | 232 -------------------------
 drivers/raw/ioat/meson.build |   3 +-
 3 files changed, 321 insertions(+), 234 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
drivers/raw/ioat/idxd_bus.c new file +320 -0
new file mode 100644
index 0000000000..ec15d9736a
@@ -0,0 +1,320 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+
+#include <dirent.h>
+#include <libgen.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#include <rte_bus.h>
+#include <rte_log.h>
+#include <rte_string_fns.h>
+#include "ioat_private.h"
+
+/* default value for DSA paths, but allow override in environment for testing */
+#define DSA_DEV_PATH "/dev/dsa"
+#define DSA_SYSFS_PATH "/sys/bus/dsa/devices"
+
+/** a DSA device instance */
+struct rte_dsa_device {
+	TAILQ_ENTRY(rte_dsa_device) next;   /**< next dev in list */
+	struct rte_device device;           /**< Inherit core device */
+	char wq_name[32];                   /**< the workqueue name/number e.g. wq0.1 */
+	uint16_t device_id;                 /**< the DSA instance number */
+	uint16_t wq_id;                     /**< the queue on the DSA instance */
+};
+
+/* forward prototypes */
+struct dsa_bus;
+static int dsa_scan(void);
+static int dsa_probe(void);
+static struct rte_device *dsa_find_device(const struct rte_device *start,
+		rte_dev_cmp_t cmp,  const void *data);
+
+/** List of devices */
+TAILQ_HEAD(dsa_device_list, rte_dsa_device);
+
+/**
+ * Structure describing the DSA bus
+ */
+struct dsa_bus {
+	struct rte_bus bus;               /**< Inherit the generic class */
+	struct rte_driver driver;         /**< Driver struct for devices to point to */
+	struct dsa_device_list device_list;  /**< List of PCI devices */
+};
+
+struct dsa_bus dsa_bus = {
+	.bus = {
+		.scan = dsa_scan,
+		.probe = dsa_probe,
+		.find_device = dsa_find_device,
+	},
+	.driver = {
+		.name = "rawdev_idxd"
+	},
+	.device_list = TAILQ_HEAD_INITIALIZER(dsa_bus.device_list),
+};
+
+static inline const char *
+dsa_get_dev_path(void)
+{
+	const char *path = getenv("DSA_DEV_PATH");
+	return path ? path : DSA_DEV_PATH;
+}
+
+static inline const char *
+dsa_get_sysfs_path(void)
+{
+	const char *path = getenv("DSA_SYSFS_PATH");
+	return path ? path : DSA_SYSFS_PATH;
+}
+
+static const struct rte_rawdev_ops idxd_vdev_ops = {
+		.dev_close = idxd_rawdev_close,
+		.dev_selftest = ioat_rawdev_test,
+		.dump = idxd_dev_dump,
+		.dev_configure = idxd_dev_configure,
+		.dev_info_get = idxd_dev_info_get,
+		.xstats_get = ioat_xstats_get,
+		.xstats_get_names = ioat_xstats_get_names,
+		.xstats_reset = ioat_xstats_reset,
+};
+
+static void *
+idxd_vdev_mmap_wq(struct rte_dsa_device *dev)
+{
+	void *addr;
+	char path[PATH_MAX];
+	int fd;
+
+	snprintf(path, sizeof(path), "%s/%s", dsa_get_dev_path(), dev->wq_name);
+	fd = open(path, O_RDWR);
+	if (fd < 0) {
+		IOAT_PMD_ERR("Failed to open device path: %s", path);
+		return NULL;
+	}
+
+	addr = mmap(NULL, 0x1000, PROT_WRITE, MAP_SHARED, fd, 0);
+	close(fd);
+	if (addr == MAP_FAILED) {
+		IOAT_PMD_ERR("Failed to mmap device %s", path);
+		return NULL;
+	}
+
+	return addr;
+}
+
+static int
+read_wq_string(struct rte_dsa_device *dev, const char *filename,
+		char *value, size_t valuelen)
+{
+	char sysfs_node[PATH_MAX];
+	int len;
+	int fd;
+
+	snprintf(sysfs_node, sizeof(sysfs_node), "%s/%s/%s",
+			dsa_get_sysfs_path(), dev->wq_name, filename);
+	if ((fd = open(sysfs_node, O_RDONLY)) < 0) {
+		IOAT_PMD_ERR("%s(): opening file '%s' failed: %s",
+				__func__, sysfs_node, strerror(errno));
+		return -1;
+	}
+
+	len = read(fd, value, valuelen - 1);
+	close(fd);
+	if (len < 0) {
+		IOAT_PMD_ERR("%s(): error reading file '%s': %s",
+				__func__, sysfs_node, strerror(errno));
+		return -1;
+	}
+	value[len] = '\0';
+	return 0;
+}
+
+static int
+read_wq_int(struct rte_dsa_device *dev, const char *filename,
+		int *value)
+{
+	char sysfs_node[PATH_MAX];
+	FILE *f;
+	int ret = 0;
+
+	snprintf(sysfs_node, sizeof(sysfs_node), "%s/%s/%s",
+			dsa_get_sysfs_path(), dev->wq_name, filename);
+	f = fopen(sysfs_node, "r");
+	if (f == NULL) {
+		IOAT_PMD_ERR("%s(): opening file '%s' failed: %s",
+				__func__, sysfs_node, strerror(errno));
+		return -1;
+	}
+
+	if (fscanf(f, "%d", value) != 1) {
+		IOAT_PMD_ERR("%s(): error reading file '%s': %s",
+				__func__, sysfs_node, strerror(errno));
+		ret = -1;
+	}
+
+	fclose(f);
+	return ret;
+}
+
+static int
+read_device_int(struct rte_dsa_device *dev, const char *filename,
+		int *value)
+{
+	char sysfs_node[PATH_MAX];
+	FILE *f;
+	int ret;
+
+	snprintf(sysfs_node, sizeof(sysfs_node), "%s/dsa%d/%s",
+			dsa_get_sysfs_path(), dev->device_id, filename);
+	f = fopen(sysfs_node, "r");
+	if (f == NULL) {
+		IOAT_PMD_ERR("%s(): opening file '%s' failed: %s",
+				__func__, sysfs_node, strerror(errno));
+		return -1;
+	}
+
+	if (fscanf(f, "%d", value) != 1) {
+		IOAT_PMD_ERR("%s(): error reading file '%s': %s",
+				__func__, sysfs_node, strerror(errno));
+		ret = -1;
+	}
+
+	fclose(f);
+	return ret;
+}
+
+static int
+idxd_rawdev_probe_dsa(struct rte_dsa_device *dev)
+{
+	struct idxd_rawdev idxd = {{0}}; /* double {} to avoid error on BSD12 */
+	int ret = 0;
+
+	IOAT_PMD_INFO("Probing device %s on numa node %d",
+			dev->wq_name, dev->device.numa_node);
+	if (read_wq_int(dev, "size", &ret) < 0)
+		return -1;
+	idxd.max_batches = ret;
+	idxd.qid = dev->wq_id;
+	idxd.u.vdev.dsa_id = dev->device_id;
+
+	idxd.public.portal = idxd_vdev_mmap_wq(dev);
+	if (idxd.public.portal == NULL) {
+		IOAT_PMD_ERR("WQ mmap failed");
+		return -ENOENT;
+	}
+
+	ret = idxd_rawdev_create(dev->wq_name, &dev->device, &idxd, &idxd_vdev_ops);
+	if (ret) {
+		IOAT_PMD_ERR("Failed to create rawdev %s", dev->wq_name);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+is_for_this_process_use(const char *name)
+{
+	char *runtime_dir = strdup(rte_eal_get_runtime_dir());
+	char *prefix = basename(runtime_dir);
+	int prefixlen = strlen(prefix);
+	int retval = 0;
+
+	if (strncmp(name, "dpdk_", 5) == 0)
+		retval = 1;
+	if (strncmp(name, prefix, prefixlen) == 0 && name[prefixlen] == '_')
+		retval = 1;
+
+	free(runtime_dir);
+	return retval;
+}
+
+static int
+dsa_probe(void)
+{
+	struct rte_dsa_device *dev;
+
+	TAILQ_FOREACH(dev, &dsa_bus.device_list, next) {
+		char type[64], name[64];
+
+		if (read_wq_string(dev, "type", type, sizeof(type)) < 0 ||
+				read_wq_string(dev, "name", name, sizeof(name)) < 0)
+			continue;
+
+		if (strncmp(type, "user", 4) == 0 && is_for_this_process_use(name)) {
+			dev->device.driver = &dsa_bus.driver;
+			idxd_rawdev_probe_dsa(dev);
+			continue;
+		}
+		IOAT_PMD_DEBUG("WQ '%s', not allocated to DPDK", dev->wq_name);
+	}
+
+	return 0;
+}
+
+static int
+dsa_scan(void)
+{
+	const char *path = dsa_get_dev_path();
+	struct dirent *wq;
+	DIR *dev_dir;
+
+	dev_dir = opendir(path);
+	if (dev_dir == NULL) {
+		if (errno == ENOENT)
+			return 0; /* no bus, return witout error */
+		IOAT_PMD_ERR("%s(): opendir '%s' failed: %s",
+				__func__, path, strerror(errno));
+		return -1;
+	}
+
+	while ((wq = readdir(dev_dir)) != NULL) {
+		struct rte_dsa_device *dev;
+		unsigned int device_id, wq_id;
+		int numa_node = -1;
+
+		if (strncmp(wq->d_name, "wq", 2) != 0)
+			continue;
+		if (strnlen(wq->d_name, sizeof(dev->wq_name)) == sizeof(dev->wq_name)) {
+			IOAT_PMD_ERR("%s(): wq name too long: '%s', skipping",
+					__func__, wq->d_name);
+			continue;
+		}
+		IOAT_PMD_DEBUG("%s(): found %s/%s", __func__, path, wq->d_name);
+
+		if (sscanf(wq->d_name, "wq%u.%u", &device_id, &wq_id) != 2) {
+			IOAT_PMD_ERR("Error parsing WQ name: %s", wq->d_name);
+			continue;
+		}
+
+		dev = malloc(sizeof(*dev));
+		dev->device_id = device_id;
+		dev->wq_id = wq_id;
+		dev->device.bus = &dsa_bus.bus;
+		strlcpy(dev->wq_name, wq->d_name, sizeof(dev->wq_name));
+		TAILQ_INSERT_TAIL(&dsa_bus.device_list, dev, next);
+
+		read_device_int(dev, "numa_node", &numa_node);
+		dev->device.numa_node = numa_node;
+	}
+
+	return 0;
+}
+
+static struct rte_device *
+dsa_find_device(const struct rte_device *start, rte_dev_cmp_t cmp,
+			 const void *data)
+{
+	RTE_SET_USED(start);
+	RTE_SET_USED(cmp);
+	RTE_SET_USED(data);
+	return NULL;
+}
+
+RTE_REGISTER_BUS(dsa, dsa_bus.bus);
drivers/raw/ioat/idxd_vdev.c deleted +0 -232

232 lines not on this page · raw message

drivers/raw/ioat/meson.build +1 -2
index 6fbae05b78..b48e2b2c26 100644
@@ -4,13 +4,12 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'
 sources = files(
+	'idxd_bus.c',
 	'idxd_pci.c',
-	'idxd_vdev.c',
 	'ioat_common.c',
 	'ioat_rawdev.c',
 	'ioat_rawdev_test.c')
 deps += ['bus_pci',
-	'bus_vdev',
 	'mbuf',
 	'rawdev']
 

--
2.27.0

#21 lore raw

v3 cover ioat driver updates

In reply to Bruce Richardson

This set contains a series of updates to the ioat driver, described in each of the individual patchsets.

V3: fixed checkpatch issue flagged
reworked capacity unit tests
fixed ring wrap-around issue with final patch

V2: added doc changes and expanded scope of patchset

Bruce Richardson (10):
raw/ioat: add unit tests for completion batching raw/ioat: support limiting queues for idxd PCI device raw/ioat: add component prefix to log messages raw/ioat: add explicit padding to descriptor struct raw/ioat: fix script for configuring small number of queues raw/ioat: make workqueue name configurable in script raw/ioat: add bus driver for device scanning automatically raw/ioat: move idxd functions to separate file raw/ioat: rework SW ring layout
raw/ioat: report status of completed jobs

Kevin Laatz (2):
raw/ioat: allow perform operations function to return error raw/ioat: add API to query remaining ring space

 doc/guides/rawdevs/ioat.rst            |  31 +-
 doc/guides/rel_notes/release_21_05.rst |   5 +
 drivers/raw/ioat/dpdk_idxd_cfg.py      |  19 +-
 drivers/raw/ioat/idxd_bus.c            | 359 +++++++++++++++++
 drivers/raw/ioat/idxd_pci.c            |  33 +-
 drivers/raw/ioat/idxd_vdev.c           | 231 -----------
 drivers/raw/ioat/ioat_common.c         | 106 ++---
 drivers/raw/ioat/ioat_private.h        |   2 +-
 drivers/raw/ioat/ioat_rawdev_test.c    | 533 ++++++++++++++++++++++---
 drivers/raw/ioat/meson.build           |   5 +-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 379 ++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h     |  57 ++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 339 +++-------------
 examples/ioat/ioatfwd.c                |  14 +-
 examples/vhost/ioat.c                  |   2 +-
 15 files changed, 1448 insertions(+), 667 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
 create mode 100644 drivers/raw/ioat/rte_idxd_rawdev_fns.h

--
2.30.2

#22 lore raw

PATCH v3 1/12 raw/ioat: add unit tests for completion batching

Add in additional unit tests to verify that we can get completion reports of multiple batches in a single completed_ops() call. Also verify we can get smaller number of completions if that is requested too.

---
 drivers/raw/ioat/ioat_rawdev_test.c | 199 +++++++++++++++++++---------
 1 file changed, 137 insertions(+), 62 deletions(-)
drivers/raw/ioat/ioat_rawdev_test.c +137 -62
index 101f24a677..a5064d739d 100644
@@ -11,6 +11,7 @@
 
 #define MAX_SUPPORTED_RAWDEVS 64
 #define TEST_SKIPPED 77
+#define COPY_LEN 1024
 
 int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
 
@@ -34,32 +35,114 @@ print_err(const char *func, int lineno, const char *format, ...)
 	return ret;
 }
 
+static int
+do_multi_copies(int dev_id, int split_batches, int split_completions)
+{
+	struct rte_mbuf *srcs[32], *dsts[32];
+	struct rte_mbuf *completed_src[64];
+	struct rte_mbuf *completed_dst[64];
+	unsigned int i, j;
+
+	for (i = 0; i < RTE_DIM(srcs); i++) {
+		char *src_data;
+
+		if (split_batches && i == RTE_DIM(srcs) / 2)
+			rte_ioat_perform_ops(dev_id);
+
+		srcs[i] = rte_pktmbuf_alloc(pool);
+		dsts[i] = rte_pktmbuf_alloc(pool);
+		src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+		for (j = 0; j < COPY_LEN; 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,
+				COPY_LEN,
+				(uintptr_t)srcs[i],
+				(uintptr_t)dsts[i]) != 1) {
+			PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
+					i);
+			return -1;
+		}
+	}
+	rte_ioat_perform_ops(dev_id);
+	usleep(100);
+
+	if (split_completions) {
+		/* gather completions in two halves */
+		uint16_t half_len = RTE_DIM(srcs) / 2;
+		if (rte_ioat_completed_ops(dev_id, half_len, (void *)completed_src,
+				(void *)completed_dst) != half_len) {
+			PRINT_ERR("Error with rte_ioat_completed_ops - first half request\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+		if (rte_ioat_completed_ops(dev_id, half_len, (void *)&completed_src[half_len],
+				(void *)&completed_dst[half_len]) != half_len) {
+			PRINT_ERR("Error with rte_ioat_completed_ops - second half request\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+	} else {
+		/* gather all completions in one go */
+		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
+				(void *)completed_dst) != RTE_DIM(srcs)) {
+			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+	}
+	for (i = 0; i < RTE_DIM(srcs); i++) {
+		char *src_data, *dst_data;
+
+		if (completed_src[i] != srcs[i]) {
+			PRINT_ERR("Error with source pointer %u\n", i);
+			return -1;
+		}
+		if (completed_dst[i] != dsts[i]) {
+			PRINT_ERR("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 < COPY_LEN; j++)
+			if (src_data[j] != dst_data[j]) {
+				PRINT_ERR("Error with copy of packet %u, byte %u\n",
+						i, j);
+				return -1;
+			}
+		rte_pktmbuf_free(srcs[i]);
+		rte_pktmbuf_free(dsts[i]);
+	}
+	return 0;
+}
+
 static int
 test_enqueue_copies(int dev_id)
 {
-	const unsigned int length = 1024;
 	unsigned int i;
 
+	/* test doing a single copy */
 	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++)
+		for (i = 0; i < COPY_LEN; 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,
+				COPY_LEN,
 				(uintptr_t)src,
 				(uintptr_t)dst) != 1) {
 			PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
@@ -79,99 +162,91 @@ test_enqueue_copies(int dev_id)
 			return -1;
 		}
 
-		for (i = 0; i < length; i++)
+		for (i = 0; i < COPY_LEN; i++)
 			if (dst_data[i] != src_data[i]) {
-				PRINT_ERR("Data mismatch at char %u\n", i);
+				PRINT_ERR("Data mismatch at char %u [Got %02x not %02x]\n",
+						i, dst_data[i], src_data[i]);
 				return -1;
 			}
 		rte_pktmbuf_free(src);
 		rte_pktmbuf_free(dst);
 	} while (0);
 
-	/* test doing multiple copies */
+	/* test doing a multiple single 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;
+		const uint16_t max_ops = 4;
+		struct rte_mbuf *src, *dst;
+		char *src_data, *dst_data;
+		struct rte_mbuf *completed[32] = {0};
+		const uint16_t max_completions = RTE_DIM(completed) / 2;
 
-			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 *);
+		src = rte_pktmbuf_alloc(pool);
+		dst = rte_pktmbuf_alloc(pool);
+		src_data = rte_pktmbuf_mtod(src, char *);
+		dst_data = rte_pktmbuf_mtod(dst, char *);
 
-			for (j = 0; j < length; j++)
-				src_data[j] = rand() & 0xFF;
+		for (i = 0; i < COPY_LEN; i++)
+			src_data[i] = rand() & 0xFF;
 
+		/* perform the same copy <max_ops> times */
+		for (i = 0; i < max_ops; i++) {
 			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]) != 1) {
-				PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
-						i);
+					src->buf_iova + src->data_off,
+					dst->buf_iova + dst->data_off,
+					COPY_LEN,
+					(uintptr_t)src,
+					(uintptr_t)dst) != 1) {
+				PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
 				return -1;
 			}
+			rte_ioat_perform_ops(dev_id);
 		}
-		rte_ioat_perform_ops(dev_id);
-		usleep(100);
+		usleep(10);
 
-		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
-				(void *)completed_dst) != RTE_DIM(srcs)) {
+		if (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],
+				(void *)&completed[max_completions]) != max_ops) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
 			return -1;
 		}
-		for (i = 0; i < RTE_DIM(srcs); i++) {
-			char *src_data, *dst_data;
+		if (completed[0] != src || completed[max_completions] != dst) {
+			PRINT_ERR("Error with completions: got (%p, %p), not (%p,%p)\n",
+					completed[0], completed[max_completions], src, dst);
+			return -1;
+		}
 
-			if (completed_src[i] != srcs[i]) {
-				PRINT_ERR("Error with source pointer %u\n", i);
-				return -1;
-			}
-			if (completed_dst[i] != dsts[i]) {
-				PRINT_ERR("Error with dest pointer %u\n", i);
+		for (i = 0; i < COPY_LEN; i++)
+			if (dst_data[i] != src_data[i]) {
+				PRINT_ERR("Data mismatch at char %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]) {
-					PRINT_ERR("Error with copy of packet %u, byte %u\n",
-							i, j);
-					return -1;
-				}
-			rte_pktmbuf_free(srcs[i]);
-			rte_pktmbuf_free(dsts[i]);
-		}
-
+		rte_pktmbuf_free(src);
+		rte_pktmbuf_free(dst);
 	} while (0);
 
+	/* test doing multiple copies */
+	do_multi_copies(dev_id, 0, 0); /* enqueue and complete one batch at a time */
+	do_multi_copies(dev_id, 1, 0); /* enqueue 2 batches and then complete both */
+	do_multi_copies(dev_id, 0, 1); /* enqueue 1 batch, then complete in two halves */
 	return 0;
 }
 
 static int
 test_enqueue_fill(int dev_id)
 {
-	const unsigned int length[] = {8, 64, 1024, 50, 100, 89};
+	const unsigned int lengths[] = {8, 64, 1024, 50, 100, 89};
 	struct rte_mbuf *dst = rte_pktmbuf_alloc(pool);
 	char *dst_data = rte_pktmbuf_mtod(dst, char *);
 	struct rte_mbuf *completed[2] = {0};
 	uint64_t pattern = 0xfedcba9876543210;
 	unsigned int i, j;
 
-	for (i = 0; i < RTE_DIM(length); i++) {
+	for (i = 0; i < RTE_DIM(lengths); i++) {
 		/* reset dst_data */
-		memset(dst_data, 0, length[i]);
+		memset(dst_data, 0, lengths[i]);
 
 		/* perform the fill operation */
 		if (rte_ioat_enqueue_fill(dev_id, pattern,
-				dst->buf_iova + dst->data_off, length[i],
+				dst->buf_iova + dst->data_off, lengths[i],
 				(uintptr_t)dst) != 1) {
 			PRINT_ERR("Error with rte_ioat_enqueue_fill\n");
 			return -1;
@@ -186,11 +261,11 @@ test_enqueue_fill(int dev_id)
 			return -1;
 		}
 		/* check the result */
-		for (j = 0; j < length[i]; j++) {
+		for (j = 0; j < lengths[i]; j++) {
 			char pat_byte = ((char *)&pattern)[j % 8];
 			if (dst_data[j] != pat_byte) {
-				PRINT_ERR("Error with fill operation (length = %u): got (%x), not (%x)\n",
-						length[i], dst_data[j],
+				PRINT_ERR("Error with fill operation (lengths = %u): got (%x), not (%x)\n",
+						lengths[i], dst_data[j],
 						pat_byte);
 				return -1;
 			}
Signature · 1 line
2.30.2
#23 lore raw

PATCH v3 2/12 raw/ioat: support limiting queues for idxd PCI device

In reply to Bruce Richardson

When using a full device instance via vfio, allow the user to specify a maximum number of queues to configure rather than always using the max number of supported queues.

---
 doc/guides/rawdevs/ioat.rst |  8 ++++++++
 drivers/raw/ioat/idxd_pci.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)
doc/guides/rawdevs/ioat.rst +8 -0
index 250cfc48a6..60438cc3bc 100644
@@ -106,6 +106,14 @@ For devices bound to a suitable DPDK-supported VFIO/UIO driver, the HW devices w
 be found as part of the device scan done at application initialization time without
 the need to pass parameters to the application.
 
+For Intel\ |reg| DSA devices, DPDK will automatically configure the device with the
+maximum number of workqueues available on it, partitioning all resources equally
+among the queues.
+If fewer workqueues are required, then the ``max_queues`` parameter may be passed to
+the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e.g.::
+
+	$ dpdk-test -a <b:d:f>,max_queues=4
+
 If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
 then a specific work queue needs to be passed to the application via a vdev parameter.
 This vdev parameter take the driver name and work queue name as parameters.
drivers/raw/ioat/idxd_pci.c +26 -2
index 01623f33f6..b48e565b4c 100644
@@ -4,6 +4,7 @@
 
 #include <rte_bus_pci.h>
 #include <rte_memzone.h>
+#include <rte_devargs.h>
 
 #include "ioat_private.h"
 #include "ioat_spec.h"
@@ -123,7 +124,8 @@ static const struct rte_rawdev_ops idxd_pci_ops = {
 #define IDXD_PORTAL_SIZE (4096 * 4)
 
 static int
-init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
+init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd,
+		unsigned int max_queues)
 {
 	struct idxd_pci_common *pci;
 	uint8_t nb_groups, nb_engines, nb_wqs;
@@ -179,6 +181,16 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
 	for (i = 0; i < nb_wqs; i++)
 		idxd_get_wq_cfg(pci, i)[0] = 0;
 
+	/* limit queues if necessary */
+	if (max_queues != 0 && nb_wqs > max_queues) {
+		nb_wqs = max_queues;
+		if (nb_engines > max_queues)
+			nb_engines = max_queues;
+		if (nb_groups > max_queues)
+			nb_engines = max_queues;
+		IOAT_PMD_DEBUG("Limiting queues to %u", nb_wqs);
+	}
+
 	/* put each engine into a separate group to avoid reordering */
 	if (nb_groups > nb_engines)
 		nb_groups = nb_engines;
@@ -242,12 +254,23 @@ idxd_rawdev_probe_pci(struct rte_pci_driver *drv, struct rte_pci_device *dev)
 	uint8_t nb_wqs;
 	int qid, ret = 0;
 	char name[PCI_PRI_STR_SIZE];
+	unsigned int max_queues = 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 = init_pci_device(dev, &idxd);
+	if (dev->device.devargs && dev->device.devargs->args[0] != '\0') {
+		/* if the number of devargs grows beyond just 1, use rte_kvargs */
+		if (sscanf(dev->device.devargs->args,
+				"max_queues=%u", &max_queues) != 1) {
+			IOAT_PMD_ERR("Invalid device parameter: '%s'",
+					dev->device.devargs->args);
+			return -1;
+		}
+	}
+
+	ret = init_pci_device(dev, &idxd, max_queues);
 	if (ret < 0) {
 		IOAT_PMD_ERR("Error initializing PCI hardware");
 		return ret;
@@ -353,3 +376,4 @@ RTE_PMD_REGISTER_PCI(IDXD_PMD_RAWDEV_NAME_PCI, idxd_pmd_drv_pci);
 RTE_PMD_REGISTER_PCI_TABLE(IDXD_PMD_RAWDEV_NAME_PCI, pci_id_idxd_map);
 RTE_PMD_REGISTER_KMOD_DEP(IDXD_PMD_RAWDEV_NAME_PCI,
 			  "* igb_uio | uio_pci_generic | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(rawdev_idxd_pci, "max_queues=0");
Signature · 1 line
2.30.2
#24 lore raw

PATCH v3 3/12 raw/ioat: add component prefix to log messages

In reply to Bruce Richardson

Add the driver prefix "IOAT" to log messages for the driver.

---
 drivers/raw/ioat/ioat_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/raw/ioat/ioat_private.h +1 -1
index 6c423811ec..f032d5fe3d 100644
@@ -21,7 +21,7 @@
 extern int ioat_pmd_logtype;
 
 #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
-		ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
+		ioat_pmd_logtype, "IOAT: %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)
Signature · 1 line
2.30.2
#25 lore raw

PATCH v3 4/12 raw/ioat: add explicit padding to descriptor struct

In reply to Bruce Richardson

Add an explicit padding field to the end of the descriptor structure so that when the batch descriptor is defined on the stack for perform-ops, the unused space is all zeroed appropriately.

---
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/raw/ioat/rte_ioat_rawdev_fns.h +4 -1
index c2c4601ca7..e96edc9053 100644
@@ -140,7 +140,10 @@ struct rte_idxd_hw_desc {
 
 	uint32_t size;    /* length of data for op, or batch size */
 
-	/* 28 bytes of padding here */
+	uint16_t intr_handle; /* completion interrupt handle */
+
+	/* remaining 26 bytes are reserved */
+	uint16_t __reserved[13];
 } __rte_aligned(64);
 
 /**
Signature · 1 line
2.30.2
#26 lore raw

PATCH v3 5/12 raw/ioat: fix script for configuring small number of queues

In reply to Bruce Richardson

The dpdk_idxd_cfg.py script included with the driver for convenience did not work properly where the number of queues to be configured was less than the number of groups or engines. This was because there would be configured groups/engines not assigned to queues. Fix this by limiting the engine and group counts to be no bigger than the number of queues.

Fixes 01863b9d2354 ("raw/ioat: include example configuration script")
---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/raw/ioat/dpdk_idxd_cfg.py +5 -5
index bce4bb5bd4..56e44063e4 100755
@@ -39,15 +39,15 @@ def configure_dsa(dsa_id, queues):
     max_queues = dsa_dir.read_int("max_work_queues")
     max_tokens = dsa_dir.read_int("max_tokens")
 
-    # we want one engine per group
-    nb_groups = min(max_engines, max_groups)
-    for grp in range(nb_groups):
-        dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
-
     nb_queues = min(queues, max_queues)
     if queues > nb_queues:
         print(f"Setting number of queues to max supported value: {max_queues}")
 
+    # we want one engine per group, and no more engines than queues
+    nb_groups = min(max_engines, max_groups, nb_queues)
+    for grp in range(nb_groups):
+        dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
+
     # configure each queue
     for q in range(nb_queues):
         wq_dir = SysfsDir(os.path.join(dsa_dir.path, f"wq{dsa_id}.{q}"))
Signature · 1 line
2.30.2
#27 lore raw

PATCH v3 6/12 raw/ioat: make workqueue name configurable in script

In reply to Bruce Richardson

Add a "--name-prefix" parameter to the quick configuration script for DSA. This allows the queues configured on a DSA instance to be made available to only one DPDK process in a setup with multiple DPDK process instances.

---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/raw/ioat/dpdk_idxd_cfg.py +6 -3
index 56e44063e4..ff06d9e240 100755
@@ -29,7 +29,7 @@ def write_values(self, values):
                 f.write(str(contents))
 
 
-def configure_dsa(dsa_id, queues):
+def configure_dsa(dsa_id, queues, prefix):
     "Configure the DSA instance with appropriate number of queues"
     dsa_dir = SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}")
     drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa")
@@ -54,7 +54,7 @@ def configure_dsa(dsa_id, queues):
         wq_dir.write_values({"group_id": q % nb_groups,
                              "type": "user",
                              "mode": "dedicated",
-                             "name": f"dpdk_wq{dsa_id}.{q}",
+                             "name": f"{prefix}_wq{dsa_id}.{q}",
                              "priority": 1,
                              "size": int(max_tokens / nb_queues)})
 
@@ -71,8 +71,11 @@ def main(args):
     arg_p.add_argument('dsa_id', type=int, help="DSA instance number")
     arg_p.add_argument('-q', metavar='queues', type=int, default=255,
                        help="Number of queues to set up")
+    arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix',
+                       default="dpdk",
+                       help="Prefix for workqueue name to mark for DPDK use [default: 'dpdk']")
     parsed_args = arg_p.parse_args(args[1:])
-    configure_dsa(parsed_args.dsa_id, parsed_args.q)
+    configure_dsa(parsed_args.dsa_id, parsed_args.q, parsed_args.prefix)
 
 
 if __name__ == "__main__":
Signature · 1 line
2.30.2
#28 lore raw

PATCH v3 7/12 raw/ioat: allow perform operations function to return error

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Change the return type for the rte_ioat_perform_ops() function from void to int to allow the possibility of returning an error code in future, should it be necessary.

---
 drivers/raw/ioat/rte_ioat_rawdev.h     |  4 +++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 11 +++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/raw/ioat/rte_ioat_rawdev.h +3 -1
index f9e8425a7f..e5a22a0799 100644
@@ -124,8 +124,10 @@ rte_ioat_fence(int dev_id);
  *
  * @param dev_id
  *   The rawdev device id of the ioat instance
+ * @return
+ *   0 on success. Non-zero return on error.
  */
-static inline void
+static inline int
 __rte_experimental
 rte_ioat_perform_ops(int dev_id);
 
drivers/raw/ioat/rte_ioat_rawdev_fns.h +7 -4
index e96edc9053..477c1b7b41 100644
@@ -291,7 +291,7 @@ __ioat_fence(int dev_id)
 /*
  * Trigger hardware to begin performing enqueued operations
  */
-static __rte_always_inline void
+static __rte_always_inline int
 __ioat_perform_ops(int dev_id)
 {
 	struct rte_ioat_rawdev *ioat =
@@ -301,6 +301,8 @@ __ioat_perform_ops(int dev_id)
 	rte_compiler_barrier();
 	*ioat->doorbell = ioat->next_write;
 	ioat->xstats.started = ioat->xstats.enqueued;
+
+	return 0;
 }
 
 /**
@@ -462,7 +464,7 @@ __idxd_movdir64b(volatile void *dst, const void *src)
 			: "a" (dst), "d" (src));
 }
 
-static __rte_always_inline void
+static __rte_always_inline int
 __idxd_perform_ops(int dev_id)
 {
 	struct rte_idxd_rawdev *idxd =
@@ -470,7 +472,7 @@ __idxd_perform_ops(int dev_id)
 	struct rte_idxd_desc_batch *b = &idxd->batch_ring[idxd->next_batch];
 
 	if (b->submitted || b->op_count == 0)
-		return;
+		return 0;
 	b->hdl_end = idxd->next_free_hdl;
 	b->comp.status = 0;
 	b->submitted = 1;
@@ -480,6 +482,7 @@ __idxd_perform_ops(int dev_id)
 	if (++idxd->next_batch == idxd->batch_ring_sz)
 		idxd->next_batch = 0;
 	idxd->xstats.started = idxd->xstats.enqueued;
+	return 0;
 }
 
 static __rte_always_inline int
@@ -558,7 +561,7 @@ rte_ioat_fence(int dev_id)
 		return __ioat_fence(dev_id);
 }
 
-static inline void
+static inline int
 rte_ioat_perform_ops(int dev_id)
 {
 	enum rte_ioat_dev_type *type =
Signature · 1 line
2.30.2
#29 lore raw

PATCH v3 8/12 raw/ioat: add bus driver for device scanning automatically

In reply to Bruce Richardson

Rather than using a vdev with args, DPDK can scan and initialize the devices automatically using a bus-type driver. This bus does not need to worry about registering device drivers, rather it can initialize the devices directly on probe.

The device instances (queues) to use are detected from /dev with the additional info about them got from /sys.

---
 doc/guides/rawdevs/ioat.rst  |  23 ++-
 drivers/raw/ioat/idxd_bus.c  | 359 +++++++++++++++++++++++++++++++++++
 drivers/raw/ioat/idxd_vdev.c | 231 ----------------------
 drivers/raw/ioat/meson.build |   4 +-
 4 files changed, 374 insertions(+), 243 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
doc/guides/rawdevs/ioat.rst +13 -10
index 60438cc3bc..2ad13db294 100644
@@ -78,7 +78,7 @@ Example configuration for a work queue::
 
         $ accel-config config-wq dsa0/wq0.0 --group-id=0 \
            --mode=dedicated --priority=10 --wq-size=8 \
-           --type=user --name=app1
+           --type=user --name=dpdk_app1
 
 Once the devices have been configured, they need to be enabled::
 
@@ -114,15 +114,18 @@ the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e
 
 	$ dpdk-test -a <b:d:f>,max_queues=4
 
-If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
-then a specific work queue needs to be passed to the application via a vdev parameter.
-This vdev parameter take the driver name and work queue name as parameters.
-For example, to use work queue 0 on Intel\ |reg| DSA instance 0::
-
-        $ dpdk-test --no-pci --vdev=rawdev_idxd,wq=0.0
-
-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
+For devices bound to the IDXD kernel driver,
+the DPDK ioat driver will automatically perform a scan for available workqueues to use.
+Any workqueues found listed in ``/dev/dsa`` on the system will be checked in ``/sys``,
+and any which have ``dpdk_`` prefix in their name will be automatically probed by the
+driver to make them available to the application.
+Alternatively, to support use by multiple DPDK processes simultaneously,
+the value used as the DPDK ``--file-prefix`` parameter may be used as a workqueue name prefix,
+instead of ``dpdk_``,
+allowing each DPDK application instance to only use a subset of configured queues.
+
+Once probed successfully, irrespective of kernel driver, 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
drivers/raw/ioat/idxd_bus.c new file +359 -0

359 lines not on this page · raw message

drivers/raw/ioat/idxd_vdev.c deleted +0 -231

231 lines not on this page · raw message

drivers/raw/ioat/meson.build +2 -2
index 3b8ea65398..6382a826e7 100644
@@ -4,13 +4,13 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'
 sources = files(
+        'idxd_bus.c',
         'idxd_pci.c',
-        'idxd_vdev.c',
         'ioat_common.c',
         'ioat_rawdev.c',
         'ioat_rawdev_test.c',
 )
-deps += ['bus_pci', 'bus_vdev', 'mbuf', 'rawdev']
+deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
         'rte_ioat_rawdev_fns.h',
Signature · 1 line
2.30.2
#30 lore raw

PATCH v3 9/12 raw/ioat: move idxd functions to separate file

In reply to Bruce Richardson

Split the rte_ioat_rawdev_fns.h file into two separate headers, so that the data structures for the original ioat devices and the newer idxd ones can be kept separate from each other. This makes code management and rework easier.

---
 drivers/raw/ioat/meson.build           |   1 +
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 275 ++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 310 ++-----------------------
 3 files changed, 299 insertions(+), 287 deletions(-)
 create mode 100644 drivers/raw/ioat/rte_idxd_rawdev_fns.h
drivers/raw/ioat/meson.build +1 -0
index 6382a826e7..0e81cb5951 100644
@@ -13,5 +13,6 @@ sources = files(
 deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
+        'rte_idxd_rawdev_fns.h',
         'rte_ioat_rawdev_fns.h',
 )
drivers/raw/ioat/rte_idxd_rawdev_fns.h new file +275 -0

275 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev_fns.h +23 -287

334 lines not on this page · raw message

Signature · 1 line
2.30.2
#31 lore raw

PATCH v3 10/12 raw/ioat: rework SW ring layout

In reply to Bruce Richardson

The ring management in the idxd part of the driver is more complex than it needs to be, tracking individual batches in a ring and having null descriptors as padding to avoid having single-operation batches. This can be simplified by using a regular ring-based layout, with additional overflow at the end to ensure that the one does not need to wrap within a batch.

---
 drivers/raw/ioat/idxd_pci.c            |   5 +-
 drivers/raw/ioat/ioat_common.c         |  99 +++++------
 drivers/raw/ioat/ioat_rawdev_test.c    |   1 +
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 233 +++++++++++++------------
 4 files changed, 179 insertions(+), 159 deletions(-)
drivers/raw/ioat/idxd_pci.c +3 -2
index b48e565b4c..13515dbc6c 100644
@@ -90,7 +90,7 @@ idxd_pci_dev_start(struct rte_rawdev *dev)
 		return 0;
 	}
 
-	if (idxd->public.batch_ring == NULL) {
+	if (idxd->public.desc_ring == NULL) {
 		IOAT_PMD_ERR("WQ %d has not been fully configured", idxd->qid);
 		return -EINVAL;
 	}
@@ -337,7 +337,8 @@ idxd_rawdev_destroy(const char *name)
 	/* free device memory */
 	IOAT_PMD_DEBUG("Freeing device driver memory");
 	rdev->dev_private = NULL;
-	rte_free(idxd->public.batch_ring);
+	rte_free(idxd->public.batch_idx_ring);
+	rte_free(idxd->public.desc_ring);
 	rte_free(idxd->public.hdl_ring);
 	rte_memzone_free(idxd->mz);
 
drivers/raw/ioat/ioat_common.c +50 -49

155 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +1 -0
index a5064d739d..51eebe152f 100644
@@ -206,6 +206,7 @@ test_enqueue_copies(int dev_id)
 		if (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],
 				(void *)&completed[max_completions]) != max_ops) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
 			return -1;
 		}
 		if (completed[0] != src || completed[max_completions] != dst) {
drivers/raw/ioat/rte_idxd_rawdev_fns.h +125 -108

316 lines not on this page · raw message

Signature · 1 line
2.30.2
#32 lore raw

PATCH v3 11/12 raw/ioat: add API to query remaining ring space

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Add a new API to query remaining descriptor ring capacity. This API is useful, for example, when an application needs to enqueue a fragmented packet and wants to ensure that all segments of the packet will be enqueued together.

---
 drivers/raw/ioat/ioat_rawdev_test.c    | 69 +++++++++++++++++++++++++-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 22 ++++++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 24 +++++++++
 3 files changed, 114 insertions(+), 1 deletion(-)
drivers/raw/ioat/ioat_rawdev_test.c +68 -1
index 51eebe152f..b007549275 100644
@@ -277,6 +277,69 @@ test_enqueue_fill(int dev_id)
 	return 0;
 }
 
+static int
+test_burst_capacity(int dev_id)
+{
+#define BURST_SIZE			64
+	const unsigned int ring_space = rte_ioat_burst_capacity(dev_id);
+	struct rte_mbuf *src, *dst;
+	unsigned int length = 1024;
+	unsigned int i, j, iter;
+	unsigned int old_cap, cap;
+	uintptr_t completions[BURST_SIZE];
+
+	src = rte_pktmbuf_alloc(pool);
+	dst = rte_pktmbuf_alloc(pool);
+
+	old_cap = ring_space;
+	/* to test capacity, we enqueue elements and check capacity is reduced
+	 * by one each time - rebaselining the expected value after each burst
+	 * as the capacity is only for a burst. We enqueue multiple bursts to
+	 * fill up half the ring, before emptying it again. We do this twice to
+	 * ensure that we get to test scenarios where we get ring wrap-around
+	 */
+	for (iter = 0; iter < 2; iter++) {
+		for (i = 0; i < ring_space / (2 * BURST_SIZE); i++) {
+			cap = rte_ioat_burst_capacity(dev_id);
+			if (cap > old_cap) {
+				PRINT_ERR("Error, avail ring capacity has gone up, not down\n");
+				return -1;
+			}
+			old_cap = cap;
+
+			for (j = 0; j < BURST_SIZE; j++) {
+				if (rte_ioat_enqueue_copy(dev_id, rte_pktmbuf_iova(src),
+						rte_pktmbuf_iova(dst), length, 0, 0) != 1) {
+					PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
+					return -1;
+				}
+				if (cap - rte_ioat_burst_capacity(dev_id) != j + 1) {
+					PRINT_ERR("Error, ring capacity did not change as expected\n");
+					return -1;
+				}
+			}
+			rte_ioat_perform_ops(dev_id);
+		}
+		usleep(100);
+		for (i = 0; i < ring_space / (2 * BURST_SIZE); i++) {
+			if (rte_ioat_completed_ops(dev_id, BURST_SIZE,
+					completions, completions) != BURST_SIZE) {
+				PRINT_ERR("Error with completions\n");
+				return -1;
+			}
+		}
+		if (rte_ioat_burst_capacity(dev_id) != ring_space) {
+			PRINT_ERR("Error, ring capacity has not reset to original value\n");
+			return -1;
+		}
+	}
+
+	rte_pktmbuf_free(src);
+	rte_pktmbuf_free(dst);
+
+	return 0;
+}
+
 int
 ioat_rawdev_test(uint16_t dev_id)
 {
@@ -321,7 +384,7 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 
 	pool = rte_pktmbuf_pool_create("TEST_IOAT_POOL",
-			256, /* n == num elements */
+			p.ring_size * 2, /* n == num elements */
 			32,  /* cache size */
 			0,   /* priv size */
 			2048, /* data room size */
@@ -385,6 +448,10 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 	printf("\n");
 
+	printf("Running Burst Capacity Test\n");
+	if (test_burst_capacity(dev_id) != 0)
+		goto err;
+
 	rte_rawdev_stop(dev_id);
 	if (rte_rawdev_xstats_reset(dev_id, NULL, 0) != 0) {
 		PRINT_ERR("Error resetting xstat values\n");
drivers/raw/ioat/rte_idxd_rawdev_fns.h +22 -0
index 4c49d2b84a..41f0ad6e99 100644
@@ -106,6 +106,28 @@ struct rte_idxd_rawdev {
 	struct rte_idxd_user_hdl *hdl_ring;
 };
 
+static __rte_always_inline uint16_t
+__idxd_burst_capacity(int dev_id)
+{
+	struct rte_idxd_rawdev *idxd =
+			(struct rte_idxd_rawdev *)rte_rawdevs[dev_id].dev_private;
+	uint16_t write_idx = idxd->batch_start + idxd->batch_size;
+	uint16_t used_space;
+
+	/* Check for space in the batch ring */
+	if ((idxd->batch_idx_read == 0 && idxd->batch_idx_write == idxd->max_batches) ||
+			idxd->batch_idx_write + 1 == idxd->batch_idx_read)
+		return 0;
+
+	/* for descriptors, check for wrap-around on write but not read */
+	if (idxd->hdls_read > write_idx)
+		write_idx += idxd->desc_ring_mask + 1;
+	used_space = write_idx - idxd->hdls_read;
+
+	/* Return amount of free space in the descriptor ring */
+	return idxd->desc_ring_mask - used_space;
+}
+
 static __rte_always_inline rte_iova_t
 __desc_idx_to_iova(struct rte_idxd_rawdev *idxd, uint16_t n)
 {
drivers/raw/ioat/rte_ioat_rawdev_fns.h +24 -0
index 598852b1fa..92ccdd03b9 100644
@@ -100,6 +100,19 @@ struct rte_ioat_rawdev {
 #define RTE_IOAT_CHANSTS_HALTED			0x3
 #define RTE_IOAT_CHANSTS_ARMED			0x4
 
+static __rte_always_inline uint16_t
+__ioat_burst_capacity(int dev_id)
+{
+	struct rte_ioat_rawdev *ioat =
+			(struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private;
+	unsigned short size = ioat->ring_size - 1;
+	unsigned short read = ioat->next_read;
+	unsigned short write = ioat->next_write;
+	unsigned short space = size - (write - read);
+
+	return space;
+}
+
 static __rte_always_inline int
 __ioat_write_desc(int dev_id, uint32_t op, uint64_t src, phys_addr_t dst,
 		unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl)
@@ -260,6 +273,17 @@ __ioat_completed_ops(int dev_id, uint8_t max_copies,
 	return count;
 }
 
+static inline uint16_t
+rte_ioat_burst_capacity(int dev_id)
+{
+	enum rte_ioat_dev_type *type =
+		(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+	if (*type == RTE_IDXD_DEV)
+		return __idxd_burst_capacity(dev_id);
+	else
+		return __ioat_burst_capacity(dev_id);
+}
+
 static inline int
 rte_ioat_enqueue_fill(int dev_id, uint64_t pattern, phys_addr_t dst,
 		unsigned int len, uintptr_t dst_hdl)
Signature · 1 line
2.30.2
#33 lore raw

PATCH v3 12/12 raw/ioat: report status of completed jobs

In reply to Bruce Richardson

Add improved error handling to rte_ioat_completed_ops(). This patch adds new parameters to the function to enable the user to track the completion status of each individual operation in a batch. With this addition, the function can help the user to determine firstly, how many operations may have failed or been skipped and then secondly, which specific operations did not complete successfully.

---
 doc/guides/rel_notes/release_21_05.rst |   5 +
 drivers/raw/ioat/ioat_common.c         |   9 +
 drivers/raw/ioat/ioat_rawdev_test.c    | 274 ++++++++++++++++++++++++-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 151 ++++++++++----
 drivers/raw/ioat/rte_ioat_rawdev.h     |  53 ++++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h |  15 +-
 examples/ioat/ioatfwd.c                |  14 +-
 examples/vhost/ioat.c                  |   2 +-
 8 files changed, 455 insertions(+), 68 deletions(-)
doc/guides/rel_notes/release_21_05.rst +5 -0
index b3224dc332..7f29f5789f 100644
@@ -329,6 +329,11 @@ API Changes
   ``policer_action_recolor_supported`` and ``policer_action_drop_supported``
   have been removed.
 
+* raw/ioat: The experimental function ``rte_ioat_completed_ops()`` now
+  supports two additional parameters, ``status`` and ``num_unsuccessful``,
+  to allow the reporting of errors from hardware when performing copy
+  operations.
+
 
 ABI Changes
 -----------
drivers/raw/ioat/ioat_common.c +9 -0
index fcb30572e6..d01c1ee367 100644
@@ -162,6 +162,15 @@ idxd_dev_configure(const struct rte_rawdev *dev,
 		rte_idxd->desc_ring = NULL;
 		return -ENOMEM;
 	}
+	rte_idxd->hdl_ring_flags = rte_zmalloc(NULL,
+			sizeof(*rte_idxd->hdl_ring_flags) * max_desc, 0);
+	if (rte_idxd->hdl_ring_flags == NULL) {
+		rte_free(rte_idxd->desc_ring);
+		rte_free(rte_idxd->hdl_ring);
+		rte_idxd->desc_ring = NULL;
+		rte_idxd->hdl_ring = NULL;
+		return -ENOMEM;
+	}
 	rte_idxd->hdls_read = rte_idxd->batch_start = 0;
 	rte_idxd->batch_size = 0;
 
drivers/raw/ioat/ioat_rawdev_test.c +266 -8

343 lines not on this page · raw message

drivers/raw/ioat/rte_idxd_rawdev_fns.h +108 -43

230 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +45 -8

91 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev_fns.h +11 -4
index 92ccdd03b9..9b8a9fa88e 100644
@@ -334,16 +334,22 @@ rte_ioat_perform_ops(int dev_id)
 
 static inline int
 rte_ioat_completed_ops(int dev_id, uint8_t max_copies,
+		uint32_t *status, uint8_t *num_unsuccessful,
 		uintptr_t *src_hdls, uintptr_t *dst_hdls)
 {
 	enum rte_ioat_dev_type *type =
 			(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+	uint8_t tmp; /* used so functions don't need to check for null parameter */
+
+	if (num_unsuccessful == NULL)
+		num_unsuccessful = &tmp;
+
+	*num_unsuccessful = 0;
 	if (*type == RTE_IDXD_DEV)
-		return __idxd_completed_ops(dev_id, max_copies,
+		return __idxd_completed_ops(dev_id, max_copies, status, num_unsuccessful,
 				src_hdls, dst_hdls);
 	else
-		return __ioat_completed_ops(dev_id,  max_copies,
-				src_hdls, dst_hdls);
+		return __ioat_completed_ops(dev_id, max_copies, src_hdls, dst_hdls);
 }
 
 static inline void
@@ -355,7 +361,8 @@ __rte_deprecated_msg("use rte_ioat_completed_ops() instead")
 rte_ioat_completed_copies(int dev_id, uint8_t max_copies,
 		uintptr_t *src_hdls, uintptr_t *dst_hdls)
 {
-	return rte_ioat_completed_ops(dev_id, max_copies, src_hdls, dst_hdls);
+	return rte_ioat_completed_ops(dev_id, max_copies, NULL, NULL,
+			src_hdls, dst_hdls);
 }
 
 #endif /* _RTE_IOAT_RAWDEV_FNS_H_ */
examples/ioat/ioatfwd.c +10 -4
index 845301a6db..2e377e2d4b 100644
@@ -447,12 +447,15 @@ ioat_tx_port(struct rxtx_port_config *tx_config)
 
 	for (i = 0; i < tx_config->nb_queues; i++) {
 		if (copy_mode == COPY_MODE_IOAT_NUM) {
-			/* Deque the mbufs from IOAT device. */
+			/* Dequeue the mbufs from IOAT device. Since all memory
+			 * is DPDK pinned memory and therefore all addresses should
+			 * be valid, we don't check for copy errors
+			 */
 			nb_dq = rte_ioat_completed_ops(
-				tx_config->ioat_ids[i], MAX_PKT_BURST,
+				tx_config->ioat_ids[i], MAX_PKT_BURST, NULL, NULL,
 				(void *)mbufs_src, (void *)mbufs_dst);
 		} else {
-			/* Deque the mbufs from rx_to_tx_ring. */
+			/* Dequeue the mbufs from rx_to_tx_ring. */
 			nb_dq = rte_ring_dequeue_burst(
 				tx_config->rx_to_tx_ring, (void *)mbufs_dst,
 				MAX_PKT_BURST, NULL);
@@ -725,7 +728,10 @@ check_link_status(uint32_t port_mask)
 static void
 configure_rawdev_queue(uint32_t dev_id)
 {
-	struct rte_ioat_rawdev_config dev_config = { .ring_size = ring_size };
+	struct rte_ioat_rawdev_config dev_config = {
+			.ring_size = ring_size,
+			.no_prefetch_completions = (cfg.nb_lcores > 1),
+	};
 	struct rte_rawdev_info info = { .dev_private = &dev_config };
 
 	if (rte_rawdev_configure(dev_id, &info, sizeof(dev_config)) != 0) {
examples/vhost/ioat.c +1 -1
index 60b73be936..efdd3f6f76 100644
@@ -183,7 +183,7 @@ ioat_check_completed_copies_cb(int vid, uint16_t queue_id,
 
 		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
-		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
+		n_seg = rte_ioat_completed_ops(dev_id, 255, NULL, NULL, dump, dump);
 		if (n_seg < 0) {
 			RTE_LOG(ERR,
 				VHOST_DATA,
Signature · 1 line
2.30.2
#34 lore raw

v4 cover ioat driver updates

In reply to Bruce Richardson

This set contains a series of updates to the ioat driver, described in each of the individual patchsets.

V4: fix issue with capacity unit test [due to missed line when rebasing to
create v3 patchset]

V3: fixed checkpatch issue flagged
reworked capacity unit tests
fixed ring wrap-around issue with final patch

V2: added doc changes and expanded scope of patchset

Bruce Richardson (10):
raw/ioat: add unit tests for completion batching raw/ioat: support limiting queues for idxd PCI device raw/ioat: add component prefix to log messages raw/ioat: add explicit padding to descriptor struct raw/ioat: fix script for configuring small number of queues raw/ioat: make workqueue name configurable in script raw/ioat: add bus driver for device scanning automatically raw/ioat: move idxd functions to separate file raw/ioat: rework SW ring layout
raw/ioat: report status of completed jobs

Kevin Laatz (2):
raw/ioat: allow perform operations function to return error raw/ioat: add API to query remaining ring space

 doc/guides/rawdevs/ioat.rst            |  31 +-
 doc/guides/rel_notes/release_21_05.rst |   5 +
 drivers/raw/ioat/dpdk_idxd_cfg.py      |  19 +-
 drivers/raw/ioat/idxd_bus.c            | 359 +++++++++++++++++
 drivers/raw/ioat/idxd_pci.c            |  33 +-
 drivers/raw/ioat/idxd_vdev.c           | 231 -----------
 drivers/raw/ioat/ioat_common.c         | 106 ++---
 drivers/raw/ioat/ioat_private.h        |   2 +-
 drivers/raw/ioat/ioat_rawdev_test.c    | 534 ++++++++++++++++++++++---
 drivers/raw/ioat/meson.build           |   5 +-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 379 ++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h     |  57 ++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 339 +++-------------
 examples/ioat/ioatfwd.c                |  14 +-
 examples/vhost/ioat.c                  |   2 +-
 15 files changed, 1449 insertions(+), 667 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
 create mode 100644 drivers/raw/ioat/rte_idxd_rawdev_fns.h

--
2.30.2

#35 lore raw

PATCH v4 1/12 raw/ioat: add unit tests for completion batching

Add in additional unit tests to verify that we can get completion reports of multiple batches in a single completed_ops() call. Also verify we can get smaller number of completions if that is requested too.

---
 drivers/raw/ioat/ioat_rawdev_test.c | 199 +++++++++++++++++++---------
 1 file changed, 137 insertions(+), 62 deletions(-)
drivers/raw/ioat/ioat_rawdev_test.c +137 -62
index 101f24a677..a5064d739d 100644
@@ -11,6 +11,7 @@
 
 #define MAX_SUPPORTED_RAWDEVS 64
 #define TEST_SKIPPED 77
+#define COPY_LEN 1024
 
 int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
 
@@ -34,32 +35,114 @@ print_err(const char *func, int lineno, const char *format, ...)
 	return ret;
 }
 
+static int
+do_multi_copies(int dev_id, int split_batches, int split_completions)
+{
+	struct rte_mbuf *srcs[32], *dsts[32];
+	struct rte_mbuf *completed_src[64];
+	struct rte_mbuf *completed_dst[64];
+	unsigned int i, j;
+
+	for (i = 0; i < RTE_DIM(srcs); i++) {
+		char *src_data;
+
+		if (split_batches && i == RTE_DIM(srcs) / 2)
+			rte_ioat_perform_ops(dev_id);
+
+		srcs[i] = rte_pktmbuf_alloc(pool);
+		dsts[i] = rte_pktmbuf_alloc(pool);
+		src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+		for (j = 0; j < COPY_LEN; 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,
+				COPY_LEN,
+				(uintptr_t)srcs[i],
+				(uintptr_t)dsts[i]) != 1) {
+			PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
+					i);
+			return -1;
+		}
+	}
+	rte_ioat_perform_ops(dev_id);
+	usleep(100);
+
+	if (split_completions) {
+		/* gather completions in two halves */
+		uint16_t half_len = RTE_DIM(srcs) / 2;
+		if (rte_ioat_completed_ops(dev_id, half_len, (void *)completed_src,
+				(void *)completed_dst) != half_len) {
+			PRINT_ERR("Error with rte_ioat_completed_ops - first half request\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+		if (rte_ioat_completed_ops(dev_id, half_len, (void *)&completed_src[half_len],
+				(void *)&completed_dst[half_len]) != half_len) {
+			PRINT_ERR("Error with rte_ioat_completed_ops - second half request\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+	} else {
+		/* gather all completions in one go */
+		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
+				(void *)completed_dst) != RTE_DIM(srcs)) {
+			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+	}
+	for (i = 0; i < RTE_DIM(srcs); i++) {
+		char *src_data, *dst_data;
+
+		if (completed_src[i] != srcs[i]) {
+			PRINT_ERR("Error with source pointer %u\n", i);
+			return -1;
+		}
+		if (completed_dst[i] != dsts[i]) {
+			PRINT_ERR("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 < COPY_LEN; j++)
+			if (src_data[j] != dst_data[j]) {
+				PRINT_ERR("Error with copy of packet %u, byte %u\n",
+						i, j);
+				return -1;
+			}
+		rte_pktmbuf_free(srcs[i]);
+		rte_pktmbuf_free(dsts[i]);
+	}
+	return 0;
+}
+
 static int
 test_enqueue_copies(int dev_id)
 {
-	const unsigned int length = 1024;
 	unsigned int i;
 
+	/* test doing a single copy */
 	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++)
+		for (i = 0; i < COPY_LEN; 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,
+				COPY_LEN,
 				(uintptr_t)src,
 				(uintptr_t)dst) != 1) {
 			PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
@@ -79,99 +162,91 @@ test_enqueue_copies(int dev_id)
 			return -1;
 		}
 
-		for (i = 0; i < length; i++)
+		for (i = 0; i < COPY_LEN; i++)
 			if (dst_data[i] != src_data[i]) {
-				PRINT_ERR("Data mismatch at char %u\n", i);
+				PRINT_ERR("Data mismatch at char %u [Got %02x not %02x]\n",
+						i, dst_data[i], src_data[i]);
 				return -1;
 			}
 		rte_pktmbuf_free(src);
 		rte_pktmbuf_free(dst);
 	} while (0);
 
-	/* test doing multiple copies */
+	/* test doing a multiple single 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;
+		const uint16_t max_ops = 4;
+		struct rte_mbuf *src, *dst;
+		char *src_data, *dst_data;
+		struct rte_mbuf *completed[32] = {0};
+		const uint16_t max_completions = RTE_DIM(completed) / 2;
 
-			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 *);
+		src = rte_pktmbuf_alloc(pool);
+		dst = rte_pktmbuf_alloc(pool);
+		src_data = rte_pktmbuf_mtod(src, char *);
+		dst_data = rte_pktmbuf_mtod(dst, char *);
 
-			for (j = 0; j < length; j++)
-				src_data[j] = rand() & 0xFF;
+		for (i = 0; i < COPY_LEN; i++)
+			src_data[i] = rand() & 0xFF;
 
+		/* perform the same copy <max_ops> times */
+		for (i = 0; i < max_ops; i++) {
 			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]) != 1) {
-				PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
-						i);
+					src->buf_iova + src->data_off,
+					dst->buf_iova + dst->data_off,
+					COPY_LEN,
+					(uintptr_t)src,
+					(uintptr_t)dst) != 1) {
+				PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
 				return -1;
 			}
+			rte_ioat_perform_ops(dev_id);
 		}
-		rte_ioat_perform_ops(dev_id);
-		usleep(100);
+		usleep(10);
 
-		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
-				(void *)completed_dst) != RTE_DIM(srcs)) {
+		if (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],
+				(void *)&completed[max_completions]) != max_ops) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
 			return -1;
 		}
-		for (i = 0; i < RTE_DIM(srcs); i++) {
-			char *src_data, *dst_data;
+		if (completed[0] != src || completed[max_completions] != dst) {
+			PRINT_ERR("Error with completions: got (%p, %p), not (%p,%p)\n",
+					completed[0], completed[max_completions], src, dst);
+			return -1;
+		}
 
-			if (completed_src[i] != srcs[i]) {
-				PRINT_ERR("Error with source pointer %u\n", i);
-				return -1;
-			}
-			if (completed_dst[i] != dsts[i]) {
-				PRINT_ERR("Error with dest pointer %u\n", i);
+		for (i = 0; i < COPY_LEN; i++)
+			if (dst_data[i] != src_data[i]) {
+				PRINT_ERR("Data mismatch at char %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]) {
-					PRINT_ERR("Error with copy of packet %u, byte %u\n",
-							i, j);
-					return -1;
-				}
-			rte_pktmbuf_free(srcs[i]);
-			rte_pktmbuf_free(dsts[i]);
-		}
-
+		rte_pktmbuf_free(src);
+		rte_pktmbuf_free(dst);
 	} while (0);
 
+	/* test doing multiple copies */
+	do_multi_copies(dev_id, 0, 0); /* enqueue and complete one batch at a time */
+	do_multi_copies(dev_id, 1, 0); /* enqueue 2 batches and then complete both */
+	do_multi_copies(dev_id, 0, 1); /* enqueue 1 batch, then complete in two halves */
 	return 0;
 }
 
 static int
 test_enqueue_fill(int dev_id)
 {
-	const unsigned int length[] = {8, 64, 1024, 50, 100, 89};
+	const unsigned int lengths[] = {8, 64, 1024, 50, 100, 89};
 	struct rte_mbuf *dst = rte_pktmbuf_alloc(pool);
 	char *dst_data = rte_pktmbuf_mtod(dst, char *);
 	struct rte_mbuf *completed[2] = {0};
 	uint64_t pattern = 0xfedcba9876543210;
 	unsigned int i, j;
 
-	for (i = 0; i < RTE_DIM(length); i++) {
+	for (i = 0; i < RTE_DIM(lengths); i++) {
 		/* reset dst_data */
-		memset(dst_data, 0, length[i]);
+		memset(dst_data, 0, lengths[i]);
 
 		/* perform the fill operation */
 		if (rte_ioat_enqueue_fill(dev_id, pattern,
-				dst->buf_iova + dst->data_off, length[i],
+				dst->buf_iova + dst->data_off, lengths[i],
 				(uintptr_t)dst) != 1) {
 			PRINT_ERR("Error with rte_ioat_enqueue_fill\n");
 			return -1;
@@ -186,11 +261,11 @@ test_enqueue_fill(int dev_id)
 			return -1;
 		}
 		/* check the result */
-		for (j = 0; j < length[i]; j++) {
+		for (j = 0; j < lengths[i]; j++) {
 			char pat_byte = ((char *)&pattern)[j % 8];
 			if (dst_data[j] != pat_byte) {
-				PRINT_ERR("Error with fill operation (length = %u): got (%x), not (%x)\n",
-						length[i], dst_data[j],
+				PRINT_ERR("Error with fill operation (lengths = %u): got (%x), not (%x)\n",
+						lengths[i], dst_data[j],
 						pat_byte);
 				return -1;
 			}
Signature · 1 line
2.30.2
#36 lore raw

PATCH v4 2/12 raw/ioat: support limiting queues for idxd PCI device

In reply to Bruce Richardson

When using a full device instance via vfio, allow the user to specify a maximum number of queues to configure rather than always using the max number of supported queues.

---
 doc/guides/rawdevs/ioat.rst |  8 ++++++++
 drivers/raw/ioat/idxd_pci.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)
doc/guides/rawdevs/ioat.rst +8 -0
index 250cfc48a6..60438cc3bc 100644
@@ -106,6 +106,14 @@ For devices bound to a suitable DPDK-supported VFIO/UIO driver, the HW devices w
 be found as part of the device scan done at application initialization time without
 the need to pass parameters to the application.
 
+For Intel\ |reg| DSA devices, DPDK will automatically configure the device with the
+maximum number of workqueues available on it, partitioning all resources equally
+among the queues.
+If fewer workqueues are required, then the ``max_queues`` parameter may be passed to
+the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e.g.::
+
+	$ dpdk-test -a <b:d:f>,max_queues=4
+
 If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
 then a specific work queue needs to be passed to the application via a vdev parameter.
 This vdev parameter take the driver name and work queue name as parameters.
drivers/raw/ioat/idxd_pci.c +26 -2
index 01623f33f6..b48e565b4c 100644
@@ -4,6 +4,7 @@
 
 #include <rte_bus_pci.h>
 #include <rte_memzone.h>
+#include <rte_devargs.h>
 
 #include "ioat_private.h"
 #include "ioat_spec.h"
@@ -123,7 +124,8 @@ static const struct rte_rawdev_ops idxd_pci_ops = {
 #define IDXD_PORTAL_SIZE (4096 * 4)
 
 static int
-init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
+init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd,
+		unsigned int max_queues)
 {
 	struct idxd_pci_common *pci;
 	uint8_t nb_groups, nb_engines, nb_wqs;
@@ -179,6 +181,16 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
 	for (i = 0; i < nb_wqs; i++)
 		idxd_get_wq_cfg(pci, i)[0] = 0;
 
+	/* limit queues if necessary */
+	if (max_queues != 0 && nb_wqs > max_queues) {
+		nb_wqs = max_queues;
+		if (nb_engines > max_queues)
+			nb_engines = max_queues;
+		if (nb_groups > max_queues)
+			nb_engines = max_queues;
+		IOAT_PMD_DEBUG("Limiting queues to %u", nb_wqs);
+	}
+
 	/* put each engine into a separate group to avoid reordering */
 	if (nb_groups > nb_engines)
 		nb_groups = nb_engines;
@@ -242,12 +254,23 @@ idxd_rawdev_probe_pci(struct rte_pci_driver *drv, struct rte_pci_device *dev)
 	uint8_t nb_wqs;
 	int qid, ret = 0;
 	char name[PCI_PRI_STR_SIZE];
+	unsigned int max_queues = 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 = init_pci_device(dev, &idxd);
+	if (dev->device.devargs && dev->device.devargs->args[0] != '\0') {
+		/* if the number of devargs grows beyond just 1, use rte_kvargs */
+		if (sscanf(dev->device.devargs->args,
+				"max_queues=%u", &max_queues) != 1) {
+			IOAT_PMD_ERR("Invalid device parameter: '%s'",
+					dev->device.devargs->args);
+			return -1;
+		}
+	}
+
+	ret = init_pci_device(dev, &idxd, max_queues);
 	if (ret < 0) {
 		IOAT_PMD_ERR("Error initializing PCI hardware");
 		return ret;
@@ -353,3 +376,4 @@ RTE_PMD_REGISTER_PCI(IDXD_PMD_RAWDEV_NAME_PCI, idxd_pmd_drv_pci);
 RTE_PMD_REGISTER_PCI_TABLE(IDXD_PMD_RAWDEV_NAME_PCI, pci_id_idxd_map);
 RTE_PMD_REGISTER_KMOD_DEP(IDXD_PMD_RAWDEV_NAME_PCI,
 			  "* igb_uio | uio_pci_generic | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(rawdev_idxd_pci, "max_queues=0");
Signature · 1 line
2.30.2
#37 lore raw

PATCH v4 3/12 raw/ioat: add component prefix to log messages

In reply to Bruce Richardson

Add the driver prefix "IOAT" to log messages for the driver.

---
 drivers/raw/ioat/ioat_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/raw/ioat/ioat_private.h +1 -1
index 6c423811ec..f032d5fe3d 100644
@@ -21,7 +21,7 @@
 extern int ioat_pmd_logtype;
 
 #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
-		ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
+		ioat_pmd_logtype, "IOAT: %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)
Signature · 1 line
2.30.2
#38 lore raw

PATCH v4 4/12 raw/ioat: add explicit padding to descriptor struct

In reply to Bruce Richardson

Add an explicit padding field to the end of the descriptor structure so that when the batch descriptor is defined on the stack for perform-ops, the unused space is all zeroed appropriately.

---
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/raw/ioat/rte_ioat_rawdev_fns.h +4 -1
index c2c4601ca7..e96edc9053 100644
@@ -140,7 +140,10 @@ struct rte_idxd_hw_desc {
 
 	uint32_t size;    /* length of data for op, or batch size */
 
-	/* 28 bytes of padding here */
+	uint16_t intr_handle; /* completion interrupt handle */
+
+	/* remaining 26 bytes are reserved */
+	uint16_t __reserved[13];
 } __rte_aligned(64);
 
 /**
Signature · 1 line
2.30.2
#39 lore raw

Re: [dpdk-dev] [PATCH v4 04/12] raw/ioat: add explicit padding to descriptor struct

30/04/2021 17:06, Bruce Richardson:

drivers/raw/ioat/rte_ioat_rawdev_fns.h struct rte_idxd_hw_desc { · line 143

Quoted 10 lines

Add an explicit padding field to the end of the descriptor structure so that when the batch descriptor is defined on the stack for perform-ops, the unused space is all zeroed appropriately.

---

drivers/raw/ioat/rte_ioat_rawdev_fns.h +1 -1
-	/* 28 bytes of padding here */
+	uint16_t intr_handle; /* completion interrupt handle */

This is more than padding.
Does it deserve its own commit?

Quoted 4 lines
drivers/raw/ioat/rte_ioat_rawdev_fns.h +3 -0
+
+	/* remaining 26 bytes are reserved */
+	uint16_t __reserved[13];
 } __rte_aligned(64);
#40 lore raw

Re: [dpdk-dev] [PATCH v4 04/12] raw/ioat: add explicit padding to descriptor struct

Quoted 5 lines · Thomas Monjalon

30/04/2021 17:06, Bruce Richardson:

Quoted 4 lines

Add an explicit padding field to the end of the descriptor structure so that when the batch descriptor is defined on the stack for perform-ops, the unused space is all zeroed appropriately.

Quoted 10 lines

drivers/raw/ioat/rte_ioat_rawdev_fns.h struct rte_idxd_hw_desc { · line 143

Quoted 6 lines

---

drivers/raw/ioat/rte_ioat_rawdev_fns.h +1 -1
-	/* 28 bytes of padding here */
+	uint16_t intr_handle; /* completion interrupt handle */

This is more than padding.
Does it deserve its own commit?

This field is unused by the driver, since we don't use any interrupts, so I consider it as padding in that regard. However, I agree that in reality it's not padding, but I think rather than having it's own commit, I can just reword the patch commit log to cover it. Something like:

raw/ioat: expand descriptor struct to full 64 bytes

Although it's unused by the driver, add the interrupt handle field in the descriptor to the descriptor structure for completeness, and explicitly add the reserved padding field on the end of the structure too. This means that when a descriptor is defined on the stack, or initialized by the compiler, the unused/reserved space will be zeroed appropriately.

Quoted 7 lines
Quoted 4 lines
drivers/raw/ioat/rte_ioat_rawdev_fns.h +3 -0
+
+	/* remaining 26 bytes are reserved */
+	uint16_t __reserved[13];
 } __rte_aligned(64);
#41 lore raw

Re: [dpdk-dev] [PATCH v4 04/12] raw/ioat: add explicit padding to descriptor struct

04/05/2021 14:04, Bruce Richardson:

Quoted 22 lines · Thomas Monjalon
Quoted 5 lines

30/04/2021 17:06, Bruce Richardson:

Quoted 4 lines

Add an explicit padding field to the end of the descriptor structure so that when the batch descriptor is defined on the stack for perform-ops, the unused space is all zeroed appropriately.

Quoted 10 lines

drivers/raw/ioat/rte_ioat_rawdev_fns.h struct rte_idxd_hw_desc { · line 143

Quoted 6 lines

---

drivers/raw/ioat/rte_ioat_rawdev_fns.h +1 -1
-	/* 28 bytes of padding here */
+	uint16_t intr_handle; /* completion interrupt handle */

This is more than padding.
Does it deserve its own commit?

This field is unused by the driver, since we don't use any interrupts, so I consider it as padding in that regard. However, I agree that in reality it's not padding, but I think rather than having it's own commit, I can just reword the patch commit log to cover it. Something like:

Quoted 7 lines

raw/ioat: expand descriptor struct to full 64 bytes

Although it's unused by the driver, add the interrupt handle field in the descriptor to the descriptor structure for completeness, and explicitly add the reserved padding field on the end of the structure too. This means that when a descriptor is defined on the stack, or initialized by the compiler, the unused/reserved space will be zeroed appropriately.

OK, thanks for adding full explanation in the git history.

#42 lore raw

PATCH v4 5/12 raw/ioat: fix script for configuring small number of queues

In reply to Bruce Richardson

The dpdk_idxd_cfg.py script included with the driver for convenience did not work properly where the number of queues to be configured was less than the number of groups or engines. This was because there would be configured groups/engines not assigned to queues. Fix this by limiting the engine and group counts to be no bigger than the number of queues.

Fixes 01863b9d2354 ("raw/ioat: include example configuration script")
---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/raw/ioat/dpdk_idxd_cfg.py +5 -5
index bce4bb5bd4..56e44063e4 100755
@@ -39,15 +39,15 @@ def configure_dsa(dsa_id, queues):
     max_queues = dsa_dir.read_int("max_work_queues")
     max_tokens = dsa_dir.read_int("max_tokens")
 
-    # we want one engine per group
-    nb_groups = min(max_engines, max_groups)
-    for grp in range(nb_groups):
-        dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
-
     nb_queues = min(queues, max_queues)
     if queues > nb_queues:
         print(f"Setting number of queues to max supported value: {max_queues}")
 
+    # we want one engine per group, and no more engines than queues
+    nb_groups = min(max_engines, max_groups, nb_queues)
+    for grp in range(nb_groups):
+        dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
+
     # configure each queue
     for q in range(nb_queues):
         wq_dir = SysfsDir(os.path.join(dsa_dir.path, f"wq{dsa_id}.{q}"))
Signature · 1 line
2.30.2
#43 lore raw

PATCH v4 6/12 raw/ioat: make workqueue name configurable in script

In reply to Bruce Richardson

Add a "--name-prefix" parameter to the quick configuration script for DSA. This allows the queues configured on a DSA instance to be made available to only one DPDK process in a setup with multiple DPDK process instances.

---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/raw/ioat/dpdk_idxd_cfg.py +6 -3
index 56e44063e4..ff06d9e240 100755
@@ -29,7 +29,7 @@ def write_values(self, values):
                 f.write(str(contents))
 
 
-def configure_dsa(dsa_id, queues):
+def configure_dsa(dsa_id, queues, prefix):
     "Configure the DSA instance with appropriate number of queues"
     dsa_dir = SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}")
     drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa")
@@ -54,7 +54,7 @@ def configure_dsa(dsa_id, queues):
         wq_dir.write_values({"group_id": q % nb_groups,
                              "type": "user",
                              "mode": "dedicated",
-                             "name": f"dpdk_wq{dsa_id}.{q}",
+                             "name": f"{prefix}_wq{dsa_id}.{q}",
                              "priority": 1,
                              "size": int(max_tokens / nb_queues)})
 
@@ -71,8 +71,11 @@ def main(args):
     arg_p.add_argument('dsa_id', type=int, help="DSA instance number")
     arg_p.add_argument('-q', metavar='queues', type=int, default=255,
                        help="Number of queues to set up")
+    arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix',
+                       default="dpdk",
+                       help="Prefix for workqueue name to mark for DPDK use [default: 'dpdk']")
     parsed_args = arg_p.parse_args(args[1:])
-    configure_dsa(parsed_args.dsa_id, parsed_args.q)
+    configure_dsa(parsed_args.dsa_id, parsed_args.q, parsed_args.prefix)
 
 
 if __name__ == "__main__":
Signature · 1 line
2.30.2
#44 lore raw

PATCH v4 7/12 raw/ioat: allow perform operations function to return error

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Change the return type for the rte_ioat_perform_ops() function from void to int to allow the possibility of returning an error code in future, should it be necessary.

---
 drivers/raw/ioat/rte_ioat_rawdev.h     |  4 +++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 11 +++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/raw/ioat/rte_ioat_rawdev.h +3 -1
index f9e8425a7f..e5a22a0799 100644
@@ -124,8 +124,10 @@ rte_ioat_fence(int dev_id);
  *
  * @param dev_id
  *   The rawdev device id of the ioat instance
+ * @return
+ *   0 on success. Non-zero return on error.
  */
-static inline void
+static inline int
 __rte_experimental
 rte_ioat_perform_ops(int dev_id);
 
drivers/raw/ioat/rte_ioat_rawdev_fns.h +7 -4
index e96edc9053..477c1b7b41 100644
@@ -291,7 +291,7 @@ __ioat_fence(int dev_id)
 /*
  * Trigger hardware to begin performing enqueued operations
  */
-static __rte_always_inline void
+static __rte_always_inline int
 __ioat_perform_ops(int dev_id)
 {
 	struct rte_ioat_rawdev *ioat =
@@ -301,6 +301,8 @@ __ioat_perform_ops(int dev_id)
 	rte_compiler_barrier();
 	*ioat->doorbell = ioat->next_write;
 	ioat->xstats.started = ioat->xstats.enqueued;
+
+	return 0;
 }
 
 /**
@@ -462,7 +464,7 @@ __idxd_movdir64b(volatile void *dst, const void *src)
 			: "a" (dst), "d" (src));
 }
 
-static __rte_always_inline void
+static __rte_always_inline int
 __idxd_perform_ops(int dev_id)
 {
 	struct rte_idxd_rawdev *idxd =
@@ -470,7 +472,7 @@ __idxd_perform_ops(int dev_id)
 	struct rte_idxd_desc_batch *b = &idxd->batch_ring[idxd->next_batch];
 
 	if (b->submitted || b->op_count == 0)
-		return;
+		return 0;
 	b->hdl_end = idxd->next_free_hdl;
 	b->comp.status = 0;
 	b->submitted = 1;
@@ -480,6 +482,7 @@ __idxd_perform_ops(int dev_id)
 	if (++idxd->next_batch == idxd->batch_ring_sz)
 		idxd->next_batch = 0;
 	idxd->xstats.started = idxd->xstats.enqueued;
+	return 0;
 }
 
 static __rte_always_inline int
@@ -558,7 +561,7 @@ rte_ioat_fence(int dev_id)
 		return __ioat_fence(dev_id);
 }
 
-static inline void
+static inline int
 rte_ioat_perform_ops(int dev_id)
 {
 	enum rte_ioat_dev_type *type =
Signature · 1 line
2.30.2
#45 lore raw

PATCH v4 8/12 raw/ioat: add bus driver for device scanning automatically

In reply to Bruce Richardson

Rather than using a vdev with args, DPDK can scan and initialize the devices automatically using a bus-type driver. This bus does not need to worry about registering device drivers, rather it can initialize the devices directly on probe.

The device instances (queues) to use are detected from /dev with the additional info about them got from /sys.

---
 doc/guides/rawdevs/ioat.rst  |  23 ++-
 drivers/raw/ioat/idxd_bus.c  | 359 +++++++++++++++++++++++++++++++++++
 drivers/raw/ioat/idxd_vdev.c | 231 ----------------------
 drivers/raw/ioat/meson.build |   4 +-
 4 files changed, 374 insertions(+), 243 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
doc/guides/rawdevs/ioat.rst +13 -10
index 60438cc3bc..2ad13db294 100644
@@ -78,7 +78,7 @@ Example configuration for a work queue::
 
         $ accel-config config-wq dsa0/wq0.0 --group-id=0 \
            --mode=dedicated --priority=10 --wq-size=8 \
-           --type=user --name=app1
+           --type=user --name=dpdk_app1
 
 Once the devices have been configured, they need to be enabled::
 
@@ -114,15 +114,18 @@ the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e
 
 	$ dpdk-test -a <b:d:f>,max_queues=4
 
-If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
-then a specific work queue needs to be passed to the application via a vdev parameter.
-This vdev parameter take the driver name and work queue name as parameters.
-For example, to use work queue 0 on Intel\ |reg| DSA instance 0::
-
-        $ dpdk-test --no-pci --vdev=rawdev_idxd,wq=0.0
-
-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
+For devices bound to the IDXD kernel driver,
+the DPDK ioat driver will automatically perform a scan for available workqueues to use.
+Any workqueues found listed in ``/dev/dsa`` on the system will be checked in ``/sys``,
+and any which have ``dpdk_`` prefix in their name will be automatically probed by the
+driver to make them available to the application.
+Alternatively, to support use by multiple DPDK processes simultaneously,
+the value used as the DPDK ``--file-prefix`` parameter may be used as a workqueue name prefix,
+instead of ``dpdk_``,
+allowing each DPDK application instance to only use a subset of configured queues.
+
+Once probed successfully, irrespective of kernel driver, 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
drivers/raw/ioat/idxd_bus.c new file +359 -0

359 lines not on this page · raw message

drivers/raw/ioat/idxd_vdev.c deleted +0 -231

231 lines not on this page · raw message

drivers/raw/ioat/meson.build +2 -2
index 3b8ea65398..6382a826e7 100644
@@ -4,13 +4,13 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'
 sources = files(
+        'idxd_bus.c',
         'idxd_pci.c',
-        'idxd_vdev.c',
         'ioat_common.c',
         'ioat_rawdev.c',
         'ioat_rawdev_test.c',
 )
-deps += ['bus_pci', 'bus_vdev', 'mbuf', 'rawdev']
+deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
         'rte_ioat_rawdev_fns.h',
Signature · 1 line
2.30.2
#46 lore raw

Re: [dpdk-dev] [PATCH v4 08/12] raw/ioat: add bus driver for device scanning automatically

30/04/2021 17:06, Bruce Richardson:

Quoted 13 lines

Rather than using a vdev with args, DPDK can scan and initialize the devices automatically using a bus-type driver. This bus does not need to worry about registering device drivers, rather it can initialize the devices directly on probe.

The device instances (queues) to use are detected from /dev with the additional info about them got from /sys.

---

doc/guides/rawdevs/ioat.rst Example configuration for a work queue:: · line 81

Quoted 5 lines
doc/guides/rawdevs/ioat.rst +1 -1
@@ -78,7 +78,7 @@ Example configuration for a work queue::
 
         $ accel-config config-wq dsa0/wq0.0 --group-id=0 \
            --mode=dedicated --priority=10 --wq-size=8 \
-           --type=user --name=app1
+           --type=user --name=dpdk_app1

It looks to belong to commit "make workqueue name configurable in script".

Quoted 28 lines
doc/guides/rawdevs/ioat.rst +12 -9
 Once the devices have been configured, they need to be enabled::
 
@@ -114,15 +114,18 @@ the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e
 
 	$ dpdk-test -a <b:d:f>,max_queues=4
 
-If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
-then a specific work queue needs to be passed to the application via a vdev parameter.
-This vdev parameter take the driver name and work queue name as parameters.
-For example, to use work queue 0 on Intel\ |reg| DSA instance 0::
-
-        $ dpdk-test --no-pci --vdev=rawdev_idxd,wq=0.0
-
-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
+For devices bound to the IDXD kernel driver,
+the DPDK ioat driver will automatically perform a scan for available workqueues to use.
+Any workqueues found listed in ``/dev/dsa`` on the system will be checked in ``/sys``,
+and any which have ``dpdk_`` prefix in their name will be automatically probed by the
+driver to make them available to the application.
+Alternatively, to support use by multiple DPDK processes simultaneously,
+the value used as the DPDK ``--file-prefix`` parameter may be used as a workqueue name prefix,
+instead of ``dpdk_``,
+allowing each DPDK application instance to only use a subset of configured queues.
+
+Once probed successfully, irrespective of kernel driver, 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.

[...]

Quoted 5 lines
drivers/raw/ioat/meson.build +0 -0
@@ -4,13 +4,13 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'

drivers/raw/ioat/meson.build line 13

Quoted 10 lines
drivers/raw/ioat/meson.build +2 -2
 sources = files(
+        'idxd_bus.c',
         'idxd_pci.c',
-        'idxd_vdev.c',
         'ioat_common.c',
         'ioat_rawdev.c',
         'ioat_rawdev_test.c',
 )
-deps += ['bus_pci', 'bus_vdev', 'mbuf', 'rawdev']
+deps += ['bus_pci', 'mbuf', 'rawdev']

OK to remove the vdev dependency by creating a bus singleton.

You may want to allow iterating devices of the bus by implementing .dev_iterate callback.

#47 lore raw

Re: [dpdk-dev] [PATCH v4 08/12] raw/ioat: add bus driver for device scanning automatically

Quoted 15 lines · Thomas Monjalon

30/04/2021 17:06, Bruce Richardson:

Quoted 14 lines

Rather than using a vdev with args, DPDK can scan and initialize the devices automatically using a bus-type driver. This bus does not need to worry about registering device drivers, rather it can initialize the devices directly on probe.

The device instances (queues) to use are detected from /dev with the additional info about them got from /sys.

---

doc/guides/rawdevs/ioat.rst +0 -0
@@ -78,7 +78,7 @@ Example configuration for a work queue::
 
Quoted 7 lines

doc/guides/rawdevs/ioat.rst Example configuration for a work queue:: · line 81

Quoted 4 lines
doc/guides/rawdevs/ioat.rst +1 -1
         $ accel-config config-wq dsa0/wq0.0 --group-id=0 \
            --mode=dedicated --priority=10 --wq-size=8 \
-           --type=user --name=app1
+           --type=user --name=dpdk_app1

It looks to belong to commit "make workqueue name configurable in script".

It could, but I think it better belongs here, because this is the commit where it's important that the name of the queue has the appropriate prefix.

Quoted 47 lines
Quoted 28 lines
doc/guides/rawdevs/ioat.rst +12 -9
 Once the devices have been configured, they need to be enabled::
 
@@ -114,15 +114,18 @@ the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e
 
 	$ dpdk-test -a <b:d:f>,max_queues=4
 
-If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
-then a specific work queue needs to be passed to the application via a vdev parameter.
-This vdev parameter take the driver name and work queue name as parameters.
-For example, to use work queue 0 on Intel\ |reg| DSA instance 0::
-
-        $ dpdk-test --no-pci --vdev=rawdev_idxd,wq=0.0
-
-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
+For devices bound to the IDXD kernel driver,
+the DPDK ioat driver will automatically perform a scan for available workqueues to use.
+Any workqueues found listed in ``/dev/dsa`` on the system will be checked in ``/sys``,
+and any which have ``dpdk_`` prefix in their name will be automatically probed by the
+driver to make them available to the application.
+Alternatively, to support use by multiple DPDK processes simultaneously,
+the value used as the DPDK ``--file-prefix`` parameter may be used as a workqueue name prefix,
+instead of ``dpdk_``,
+allowing each DPDK application instance to only use a subset of configured queues.
+
+Once probed successfully, irrespective of kernel driver, 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.

[...]

Quoted 5 lines
drivers/raw/ioat/meson.build +0 -0
@@ -4,13 +4,13 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'

drivers/raw/ioat/meson.build line 13

Quoted 10 lines
drivers/raw/ioat/meson.build +2 -2
 sources = files(
+        'idxd_bus.c',
         'idxd_pci.c',
-        'idxd_vdev.c',
         'ioat_common.c',
         'ioat_rawdev.c',
         'ioat_rawdev_test.c',
 )
-deps += ['bus_pci', 'bus_vdev', 'mbuf', 'rawdev']
+deps += ['bus_pci', 'mbuf', 'rawdev']

OK to remove the vdev dependency by creating a bus singleton.

Quoted 3 lines

You may want to allow iterating devices of the bus by implementing .dev_iterate callback.

I was wondering about that. What is the expected use-case in general for such iteration?

#48 lore raw

Re: [dpdk-dev] [PATCH v4 08/12] raw/ioat: add bus driver for device scanning automatically

04/05/2021 14:07, Bruce Richardson:

Quoted 7 lines · Thomas Monjalon
Quoted 3 lines

30/04/2021 17:06, Bruce Richardson:
You may want to allow iterating devices of the bus by implementing .dev_iterate callback.

I was wondering about that. What is the expected use-case in general for such iteration?

Simple things like listing devices.
You can check git grep RTE_DEV_FOREACH for the first usages. This callback can be implemented in next release, no rush.

#49 lore raw

PATCH v4 9/12 raw/ioat: move idxd functions to separate file

In reply to Bruce Richardson

Split the rte_ioat_rawdev_fns.h file into two separate headers, so that the data structures for the original ioat devices and the newer idxd ones can be kept separate from each other. This makes code management and rework easier.

---
 drivers/raw/ioat/meson.build           |   1 +
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 275 ++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 310 ++-----------------------
 3 files changed, 299 insertions(+), 287 deletions(-)
 create mode 100644 drivers/raw/ioat/rte_idxd_rawdev_fns.h
drivers/raw/ioat/meson.build +1 -0
index 6382a826e7..0e81cb5951 100644
@@ -13,5 +13,6 @@ sources = files(
 deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
+        'rte_idxd_rawdev_fns.h',
         'rte_ioat_rawdev_fns.h',
 )
drivers/raw/ioat/rte_idxd_rawdev_fns.h new file +275 -0

275 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev_fns.h +23 -287

334 lines not on this page · raw message

Signature · 1 line
2.30.2
#50 lore raw

Re: [dpdk-dev] [PATCH v4 09/12] raw/ioat: move idxd functions to separate file

30/04/2021 17:06, Bruce Richardson:

Quoted 10 lines

Split the rte_ioat_rawdev_fns.h file into two separate headers, so that the data structures for the original ioat devices and the newer idxd ones can be kept separate from each other. This makes code management and rework easier.

---

drivers/raw/ioat/rte_idxd_rawdev_fns.h line 5

Quoted 5 lines
drivers/raw/ioat/rte_idxd_rawdev_fns.h new file +5 -0
@@ -0,0 +1,275 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+#ifndef _RTE_IDXD_RAWDEV_FNS_H_
+#define _RTE_IDXD_RAWDEV_FNS_H_

Please add a doxygen @file to explain the purpose of this file. The same is needed for rte_ioat_rawdev_fns.h.
We miss the explanation of the difference between ioat and idxd.

#51 lore raw

Re: [dpdk-dev] [PATCH v4 09/12] raw/ioat: move idxd functions to separate file

Quoted 6 lines · Thomas Monjalon

30/04/2021 17:06, Bruce Richardson:

Quoted 5 lines

Split the rte_ioat_rawdev_fns.h file into two separate headers, so that the data structures for the original ioat devices and the newer idxd ones can be kept separate from each other. This makes code management and rework easier.

Quoted 15 lines

drivers/raw/ioat/rte_idxd_rawdev_fns.h line 5

Quoted 10 lines

---

drivers/raw/ioat/rte_idxd_rawdev_fns.h new file +5 -0
@@ -0,0 +1,275 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+#ifndef _RTE_IDXD_RAWDEV_FNS_H_
+#define _RTE_IDXD_RAWDEV_FNS_H_

Please add a doxygen @file to explain the purpose of this file. The same is needed for rte_ioat_rawdev_fns.h.
We miss the explanation of the difference between ioat and idxd.

Agreed. Will do in new revision of this set.

#52 lore raw

PATCH v4 10/12 raw/ioat: rework SW ring layout

In reply to Bruce Richardson

The ring management in the idxd part of the driver is more complex than it needs to be, tracking individual batches in a ring and having null descriptors as padding to avoid having single-operation batches. This can be simplified by using a regular ring-based layout, with additional overflow at the end to ensure that the one does not need to wrap within a batch.

---
 drivers/raw/ioat/idxd_pci.c            |   5 +-
 drivers/raw/ioat/ioat_common.c         |  99 +++++------
 drivers/raw/ioat/ioat_rawdev_test.c    |   1 +
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 233 +++++++++++++------------
 4 files changed, 179 insertions(+), 159 deletions(-)
drivers/raw/ioat/idxd_pci.c +3 -2
index b48e565b4c..13515dbc6c 100644
@@ -90,7 +90,7 @@ idxd_pci_dev_start(struct rte_rawdev *dev)
 		return 0;
 	}
 
-	if (idxd->public.batch_ring == NULL) {
+	if (idxd->public.desc_ring == NULL) {
 		IOAT_PMD_ERR("WQ %d has not been fully configured", idxd->qid);
 		return -EINVAL;
 	}
@@ -337,7 +337,8 @@ idxd_rawdev_destroy(const char *name)
 	/* free device memory */
 	IOAT_PMD_DEBUG("Freeing device driver memory");
 	rdev->dev_private = NULL;
-	rte_free(idxd->public.batch_ring);
+	rte_free(idxd->public.batch_idx_ring);
+	rte_free(idxd->public.desc_ring);
 	rte_free(idxd->public.hdl_ring);
 	rte_memzone_free(idxd->mz);
 
drivers/raw/ioat/ioat_common.c +50 -49

155 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +1 -0
index a5064d739d..51eebe152f 100644
@@ -206,6 +206,7 @@ test_enqueue_copies(int dev_id)
 		if (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],
 				(void *)&completed[max_completions]) != max_ops) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
 			return -1;
 		}
 		if (completed[0] != src || completed[max_completions] != dst) {
drivers/raw/ioat/rte_idxd_rawdev_fns.h +125 -108

316 lines not on this page · raw message

Signature · 1 line
2.30.2
#53 lore raw

PATCH v4 11/12 raw/ioat: add API to query remaining ring space

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Add a new API to query remaining descriptor ring capacity. This API is useful, for example, when an application needs to enqueue a fragmented packet and wants to ensure that all segments of the packet will be enqueued together.

---
 drivers/raw/ioat/ioat_rawdev_test.c    | 70 +++++++++++++++++++++++++-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 22 ++++++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 24 +++++++++
 3 files changed, 115 insertions(+), 1 deletion(-)
drivers/raw/ioat/ioat_rawdev_test.c +69 -1
index 51eebe152f..839a716a21 100644
@@ -277,6 +277,70 @@ test_enqueue_fill(int dev_id)
 	return 0;
 }
 
+static int
+test_burst_capacity(int dev_id)
+{
+#define BURST_SIZE			64
+	const unsigned int ring_space = rte_ioat_burst_capacity(dev_id);
+	struct rte_mbuf *src, *dst;
+	unsigned int length = 1024;
+	unsigned int i, j, iter;
+	unsigned int old_cap, cap;
+	uintptr_t completions[BURST_SIZE];
+
+	src = rte_pktmbuf_alloc(pool);
+	dst = rte_pktmbuf_alloc(pool);
+
+	old_cap = ring_space;
+	/* to test capacity, we enqueue elements and check capacity is reduced
+	 * by one each time - rebaselining the expected value after each burst
+	 * as the capacity is only for a burst. We enqueue multiple bursts to
+	 * fill up half the ring, before emptying it again. We do this twice to
+	 * ensure that we get to test scenarios where we get ring wrap-around
+	 */
+	for (iter = 0; iter < 2; iter++) {
+		for (i = 0; i < ring_space / (2 * BURST_SIZE); i++) {
+			cap = rte_ioat_burst_capacity(dev_id);
+			if (cap > old_cap) {
+				PRINT_ERR("Error, avail ring capacity has gone up, not down\n");
+				return -1;
+			}
+			old_cap = cap;
+
+			for (j = 0; j < BURST_SIZE; j++) {
+				if (rte_ioat_enqueue_copy(dev_id, rte_pktmbuf_iova(src),
+						rte_pktmbuf_iova(dst), length, 0, 0) != 1) {
+					PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
+					return -1;
+				}
+				if (cap - rte_ioat_burst_capacity(dev_id) != j + 1) {
+					PRINT_ERR("Error, ring capacity did not change as expected\n");
+					return -1;
+				}
+			}
+			rte_ioat_perform_ops(dev_id);
+		}
+		usleep(100);
+		for (i = 0; i < ring_space / (2 * BURST_SIZE); i++) {
+			if (rte_ioat_completed_ops(dev_id, BURST_SIZE,
+					completions, completions) != BURST_SIZE) {
+				PRINT_ERR("Error with completions\n");
+				return -1;
+			}
+		}
+		if (rte_ioat_burst_capacity(dev_id) != ring_space) {
+			PRINT_ERR("Error, ring capacity has not reset to original value\n");
+			return -1;
+		}
+		old_cap = ring_space;
+	}
+
+	rte_pktmbuf_free(src);
+	rte_pktmbuf_free(dst);
+
+	return 0;
+}
+
 int
 ioat_rawdev_test(uint16_t dev_id)
 {
@@ -321,7 +385,7 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 
 	pool = rte_pktmbuf_pool_create("TEST_IOAT_POOL",
-			256, /* n == num elements */
+			p.ring_size * 2, /* n == num elements */
 			32,  /* cache size */
 			0,   /* priv size */
 			2048, /* data room size */
@@ -385,6 +449,10 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 	printf("\n");
 
+	printf("Running Burst Capacity Test\n");
+	if (test_burst_capacity(dev_id) != 0)
+		goto err;
+
 	rte_rawdev_stop(dev_id);
 	if (rte_rawdev_xstats_reset(dev_id, NULL, 0) != 0) {
 		PRINT_ERR("Error resetting xstat values\n");
drivers/raw/ioat/rte_idxd_rawdev_fns.h +22 -0
index 4c49d2b84a..41f0ad6e99 100644
@@ -106,6 +106,28 @@ struct rte_idxd_rawdev {
 	struct rte_idxd_user_hdl *hdl_ring;
 };
 
+static __rte_always_inline uint16_t
+__idxd_burst_capacity(int dev_id)
+{
+	struct rte_idxd_rawdev *idxd =
+			(struct rte_idxd_rawdev *)rte_rawdevs[dev_id].dev_private;
+	uint16_t write_idx = idxd->batch_start + idxd->batch_size;
+	uint16_t used_space;
+
+	/* Check for space in the batch ring */
+	if ((idxd->batch_idx_read == 0 && idxd->batch_idx_write == idxd->max_batches) ||
+			idxd->batch_idx_write + 1 == idxd->batch_idx_read)
+		return 0;
+
+	/* for descriptors, check for wrap-around on write but not read */
+	if (idxd->hdls_read > write_idx)
+		write_idx += idxd->desc_ring_mask + 1;
+	used_space = write_idx - idxd->hdls_read;
+
+	/* Return amount of free space in the descriptor ring */
+	return idxd->desc_ring_mask - used_space;
+}
+
 static __rte_always_inline rte_iova_t
 __desc_idx_to_iova(struct rte_idxd_rawdev *idxd, uint16_t n)
 {
drivers/raw/ioat/rte_ioat_rawdev_fns.h +24 -0
index 598852b1fa..92ccdd03b9 100644
@@ -100,6 +100,19 @@ struct rte_ioat_rawdev {
 #define RTE_IOAT_CHANSTS_HALTED			0x3
 #define RTE_IOAT_CHANSTS_ARMED			0x4
 
+static __rte_always_inline uint16_t
+__ioat_burst_capacity(int dev_id)
+{
+	struct rte_ioat_rawdev *ioat =
+			(struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private;
+	unsigned short size = ioat->ring_size - 1;
+	unsigned short read = ioat->next_read;
+	unsigned short write = ioat->next_write;
+	unsigned short space = size - (write - read);
+
+	return space;
+}
+
 static __rte_always_inline int
 __ioat_write_desc(int dev_id, uint32_t op, uint64_t src, phys_addr_t dst,
 		unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl)
@@ -260,6 +273,17 @@ __ioat_completed_ops(int dev_id, uint8_t max_copies,
 	return count;
 }
 
+static inline uint16_t
+rte_ioat_burst_capacity(int dev_id)
+{
+	enum rte_ioat_dev_type *type =
+		(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+	if (*type == RTE_IDXD_DEV)
+		return __idxd_burst_capacity(dev_id);
+	else
+		return __ioat_burst_capacity(dev_id);
+}
+
 static inline int
 rte_ioat_enqueue_fill(int dev_id, uint64_t pattern, phys_addr_t dst,
 		unsigned int len, uintptr_t dst_hdl)
Signature · 1 line
2.30.2
#54 lore raw

PATCH v4 12/12 raw/ioat: report status of completed jobs

In reply to Bruce Richardson

Add improved error handling to rte_ioat_completed_ops(). This patch adds new parameters to the function to enable the user to track the completion status of each individual operation in a batch. With this addition, the function can help the user to determine firstly, how many operations may have failed or been skipped and then secondly, which specific operations did not complete successfully.

---
 doc/guides/rel_notes/release_21_05.rst |   5 +
 drivers/raw/ioat/ioat_common.c         |   9 +
 drivers/raw/ioat/ioat_rawdev_test.c    | 274 ++++++++++++++++++++++++-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 151 ++++++++++----
 drivers/raw/ioat/rte_ioat_rawdev.h     |  53 ++++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h |  15 +-
 examples/ioat/ioatfwd.c                |  14 +-
 examples/vhost/ioat.c                  |   2 +-
 8 files changed, 455 insertions(+), 68 deletions(-)
doc/guides/rel_notes/release_21_05.rst +5 -0
index b3224dc332..7f29f5789f 100644
@@ -329,6 +329,11 @@ API Changes
   ``policer_action_recolor_supported`` and ``policer_action_drop_supported``
   have been removed.
 
+* raw/ioat: The experimental function ``rte_ioat_completed_ops()`` now
+  supports two additional parameters, ``status`` and ``num_unsuccessful``,
+  to allow the reporting of errors from hardware when performing copy
+  operations.
+
 
 ABI Changes
 -----------
drivers/raw/ioat/ioat_common.c +9 -0
index fcb30572e6..d01c1ee367 100644
@@ -162,6 +162,15 @@ idxd_dev_configure(const struct rte_rawdev *dev,
 		rte_idxd->desc_ring = NULL;
 		return -ENOMEM;
 	}
+	rte_idxd->hdl_ring_flags = rte_zmalloc(NULL,
+			sizeof(*rte_idxd->hdl_ring_flags) * max_desc, 0);
+	if (rte_idxd->hdl_ring_flags == NULL) {
+		rte_free(rte_idxd->desc_ring);
+		rte_free(rte_idxd->hdl_ring);
+		rte_idxd->desc_ring = NULL;
+		rte_idxd->hdl_ring = NULL;
+		return -ENOMEM;
+	}
 	rte_idxd->hdls_read = rte_idxd->batch_start = 0;
 	rte_idxd->batch_size = 0;
 
drivers/raw/ioat/ioat_rawdev_test.c +266 -8

343 lines not on this page · raw message

drivers/raw/ioat/rte_idxd_rawdev_fns.h +108 -43

230 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +45 -8

91 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev_fns.h +11 -4
index 92ccdd03b9..9b8a9fa88e 100644
@@ -334,16 +334,22 @@ rte_ioat_perform_ops(int dev_id)
 
 static inline int
 rte_ioat_completed_ops(int dev_id, uint8_t max_copies,
+		uint32_t *status, uint8_t *num_unsuccessful,
 		uintptr_t *src_hdls, uintptr_t *dst_hdls)
 {
 	enum rte_ioat_dev_type *type =
 			(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+	uint8_t tmp; /* used so functions don't need to check for null parameter */
+
+	if (num_unsuccessful == NULL)
+		num_unsuccessful = &tmp;
+
+	*num_unsuccessful = 0;
 	if (*type == RTE_IDXD_DEV)
-		return __idxd_completed_ops(dev_id, max_copies,
+		return __idxd_completed_ops(dev_id, max_copies, status, num_unsuccessful,
 				src_hdls, dst_hdls);
 	else
-		return __ioat_completed_ops(dev_id,  max_copies,
-				src_hdls, dst_hdls);
+		return __ioat_completed_ops(dev_id, max_copies, src_hdls, dst_hdls);
 }
 
 static inline void
@@ -355,7 +361,8 @@ __rte_deprecated_msg("use rte_ioat_completed_ops() instead")
 rte_ioat_completed_copies(int dev_id, uint8_t max_copies,
 		uintptr_t *src_hdls, uintptr_t *dst_hdls)
 {
-	return rte_ioat_completed_ops(dev_id, max_copies, src_hdls, dst_hdls);
+	return rte_ioat_completed_ops(dev_id, max_copies, NULL, NULL,
+			src_hdls, dst_hdls);
 }
 
 #endif /* _RTE_IOAT_RAWDEV_FNS_H_ */
examples/ioat/ioatfwd.c +10 -4
index 845301a6db..2e377e2d4b 100644
@@ -447,12 +447,15 @@ ioat_tx_port(struct rxtx_port_config *tx_config)
 
 	for (i = 0; i < tx_config->nb_queues; i++) {
 		if (copy_mode == COPY_MODE_IOAT_NUM) {
-			/* Deque the mbufs from IOAT device. */
+			/* Dequeue the mbufs from IOAT device. Since all memory
+			 * is DPDK pinned memory and therefore all addresses should
+			 * be valid, we don't check for copy errors
+			 */
 			nb_dq = rte_ioat_completed_ops(
-				tx_config->ioat_ids[i], MAX_PKT_BURST,
+				tx_config->ioat_ids[i], MAX_PKT_BURST, NULL, NULL,
 				(void *)mbufs_src, (void *)mbufs_dst);
 		} else {
-			/* Deque the mbufs from rx_to_tx_ring. */
+			/* Dequeue the mbufs from rx_to_tx_ring. */
 			nb_dq = rte_ring_dequeue_burst(
 				tx_config->rx_to_tx_ring, (void *)mbufs_dst,
 				MAX_PKT_BURST, NULL);
@@ -725,7 +728,10 @@ check_link_status(uint32_t port_mask)
 static void
 configure_rawdev_queue(uint32_t dev_id)
 {
-	struct rte_ioat_rawdev_config dev_config = { .ring_size = ring_size };
+	struct rte_ioat_rawdev_config dev_config = {
+			.ring_size = ring_size,
+			.no_prefetch_completions = (cfg.nb_lcores > 1),
+	};
 	struct rte_rawdev_info info = { .dev_private = &dev_config };
 
 	if (rte_rawdev_configure(dev_id, &info, sizeof(dev_config)) != 0) {
examples/vhost/ioat.c +1 -1
index 60b73be936..efdd3f6f76 100644
@@ -183,7 +183,7 @@ ioat_check_completed_copies_cb(int vid, uint16_t queue_id,
 
 		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
-		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
+		n_seg = rte_ioat_completed_ops(dev_id, 255, NULL, NULL, dump, dump);
 		if (n_seg < 0) {
 			RTE_LOG(ERR,
 				VHOST_DATA,
Signature · 1 line
2.30.2
#55 lore raw

v5 cover ioat driver updates

In reply to Bruce Richardson

This set contains a series of updates to the ioat driver, described in each of the individual patchsets.

V5: updated following feedback on-list:
* reworked commit log of patch 4
* added doxygen @file documentation to patch 9

V4: fix issue with capacity unit test [due to missed line when rebasing to
create v3 patchset]

V3: fixed checkpatch issue flagged
reworked capacity unit tests
fixed ring wrap-around issue with final patch

V2: added doc changes and expanded scope of patchset

Bruce Richardson (10):
raw/ioat: add unit tests for completion batching raw/ioat: support limiting queues for idxd PCI device raw/ioat: add component prefix to log messages raw/ioat: expand descriptor struct to full 64 bytes raw/ioat: fix script for configuring small number of queues raw/ioat: make workqueue name configurable in script raw/ioat: add bus driver for device scanning automatically raw/ioat: move idxd functions to separate file raw/ioat: rework SW ring layout
raw/ioat: report status of completed jobs

Kevin Laatz (2):
raw/ioat: allow perform operations function to return error raw/ioat: add API to query remaining ring space

 doc/guides/rawdevs/ioat.rst            |  31 +-
 doc/guides/rel_notes/release_21_05.rst |   5 +
 drivers/raw/ioat/dpdk_idxd_cfg.py      |  19 +-
 drivers/raw/ioat/idxd_bus.c            | 359 +++++++++++++++++
 drivers/raw/ioat/idxd_pci.c            |  33 +-
 drivers/raw/ioat/idxd_vdev.c           | 231 -----------
 drivers/raw/ioat/ioat_common.c         | 106 ++---
 drivers/raw/ioat/ioat_private.h        |   2 +-
 drivers/raw/ioat/ioat_rawdev_test.c    | 534 ++++++++++++++++++++++---
 drivers/raw/ioat/meson.build           |   5 +-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 390 ++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev.h     |  57 ++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 350 ++++------------
 examples/ioat/ioatfwd.c                |  14 +-
 examples/vhost/ioat.c                  |   2 +-
 15 files changed, 1471 insertions(+), 667 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
 create mode 100644 drivers/raw/ioat/rte_idxd_rawdev_fns.h

--
2.30.2

#56 lore raw

PATCH v5 1/12 raw/ioat: add unit tests for completion batching

Add in additional unit tests to verify that we can get completion reports of multiple batches in a single completed_ops() call. Also verify we can get smaller number of completions if that is requested too.

---
 drivers/raw/ioat/ioat_rawdev_test.c | 199 +++++++++++++++++++---------
 1 file changed, 137 insertions(+), 62 deletions(-)
drivers/raw/ioat/ioat_rawdev_test.c +137 -62
index 101f24a677..a5064d739d 100644
@@ -11,6 +11,7 @@
 
 #define MAX_SUPPORTED_RAWDEVS 64
 #define TEST_SKIPPED 77
+#define COPY_LEN 1024
 
 int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
 
@@ -34,32 +35,114 @@ print_err(const char *func, int lineno, const char *format, ...)
 	return ret;
 }
 
+static int
+do_multi_copies(int dev_id, int split_batches, int split_completions)
+{
+	struct rte_mbuf *srcs[32], *dsts[32];
+	struct rte_mbuf *completed_src[64];
+	struct rte_mbuf *completed_dst[64];
+	unsigned int i, j;
+
+	for (i = 0; i < RTE_DIM(srcs); i++) {
+		char *src_data;
+
+		if (split_batches && i == RTE_DIM(srcs) / 2)
+			rte_ioat_perform_ops(dev_id);
+
+		srcs[i] = rte_pktmbuf_alloc(pool);
+		dsts[i] = rte_pktmbuf_alloc(pool);
+		src_data = rte_pktmbuf_mtod(srcs[i], char *);
+
+		for (j = 0; j < COPY_LEN; 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,
+				COPY_LEN,
+				(uintptr_t)srcs[i],
+				(uintptr_t)dsts[i]) != 1) {
+			PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
+					i);
+			return -1;
+		}
+	}
+	rte_ioat_perform_ops(dev_id);
+	usleep(100);
+
+	if (split_completions) {
+		/* gather completions in two halves */
+		uint16_t half_len = RTE_DIM(srcs) / 2;
+		if (rte_ioat_completed_ops(dev_id, half_len, (void *)completed_src,
+				(void *)completed_dst) != half_len) {
+			PRINT_ERR("Error with rte_ioat_completed_ops - first half request\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+		if (rte_ioat_completed_ops(dev_id, half_len, (void *)&completed_src[half_len],
+				(void *)&completed_dst[half_len]) != half_len) {
+			PRINT_ERR("Error with rte_ioat_completed_ops - second half request\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+	} else {
+		/* gather all completions in one go */
+		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
+				(void *)completed_dst) != RTE_DIM(srcs)) {
+			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
+			return -1;
+		}
+	}
+	for (i = 0; i < RTE_DIM(srcs); i++) {
+		char *src_data, *dst_data;
+
+		if (completed_src[i] != srcs[i]) {
+			PRINT_ERR("Error with source pointer %u\n", i);
+			return -1;
+		}
+		if (completed_dst[i] != dsts[i]) {
+			PRINT_ERR("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 < COPY_LEN; j++)
+			if (src_data[j] != dst_data[j]) {
+				PRINT_ERR("Error with copy of packet %u, byte %u\n",
+						i, j);
+				return -1;
+			}
+		rte_pktmbuf_free(srcs[i]);
+		rte_pktmbuf_free(dsts[i]);
+	}
+	return 0;
+}
+
 static int
 test_enqueue_copies(int dev_id)
 {
-	const unsigned int length = 1024;
 	unsigned int i;
 
+	/* test doing a single copy */
 	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++)
+		for (i = 0; i < COPY_LEN; 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,
+				COPY_LEN,
 				(uintptr_t)src,
 				(uintptr_t)dst) != 1) {
 			PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
@@ -79,99 +162,91 @@ test_enqueue_copies(int dev_id)
 			return -1;
 		}
 
-		for (i = 0; i < length; i++)
+		for (i = 0; i < COPY_LEN; i++)
 			if (dst_data[i] != src_data[i]) {
-				PRINT_ERR("Data mismatch at char %u\n", i);
+				PRINT_ERR("Data mismatch at char %u [Got %02x not %02x]\n",
+						i, dst_data[i], src_data[i]);
 				return -1;
 			}
 		rte_pktmbuf_free(src);
 		rte_pktmbuf_free(dst);
 	} while (0);
 
-	/* test doing multiple copies */
+	/* test doing a multiple single 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;
+		const uint16_t max_ops = 4;
+		struct rte_mbuf *src, *dst;
+		char *src_data, *dst_data;
+		struct rte_mbuf *completed[32] = {0};
+		const uint16_t max_completions = RTE_DIM(completed) / 2;
 
-			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 *);
+		src = rte_pktmbuf_alloc(pool);
+		dst = rte_pktmbuf_alloc(pool);
+		src_data = rte_pktmbuf_mtod(src, char *);
+		dst_data = rte_pktmbuf_mtod(dst, char *);
 
-			for (j = 0; j < length; j++)
-				src_data[j] = rand() & 0xFF;
+		for (i = 0; i < COPY_LEN; i++)
+			src_data[i] = rand() & 0xFF;
 
+		/* perform the same copy <max_ops> times */
+		for (i = 0; i < max_ops; i++) {
 			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]) != 1) {
-				PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
-						i);
+					src->buf_iova + src->data_off,
+					dst->buf_iova + dst->data_off,
+					COPY_LEN,
+					(uintptr_t)src,
+					(uintptr_t)dst) != 1) {
+				PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
 				return -1;
 			}
+			rte_ioat_perform_ops(dev_id);
 		}
-		rte_ioat_perform_ops(dev_id);
-		usleep(100);
+		usleep(10);
 
-		if (rte_ioat_completed_ops(dev_id, 64, (void *)completed_src,
-				(void *)completed_dst) != RTE_DIM(srcs)) {
+		if (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],
+				(void *)&completed[max_completions]) != max_ops) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
 			return -1;
 		}
-		for (i = 0; i < RTE_DIM(srcs); i++) {
-			char *src_data, *dst_data;
+		if (completed[0] != src || completed[max_completions] != dst) {
+			PRINT_ERR("Error with completions: got (%p, %p), not (%p,%p)\n",
+					completed[0], completed[max_completions], src, dst);
+			return -1;
+		}
 
-			if (completed_src[i] != srcs[i]) {
-				PRINT_ERR("Error with source pointer %u\n", i);
-				return -1;
-			}
-			if (completed_dst[i] != dsts[i]) {
-				PRINT_ERR("Error with dest pointer %u\n", i);
+		for (i = 0; i < COPY_LEN; i++)
+			if (dst_data[i] != src_data[i]) {
+				PRINT_ERR("Data mismatch at char %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]) {
-					PRINT_ERR("Error with copy of packet %u, byte %u\n",
-							i, j);
-					return -1;
-				}
-			rte_pktmbuf_free(srcs[i]);
-			rte_pktmbuf_free(dsts[i]);
-		}
-
+		rte_pktmbuf_free(src);
+		rte_pktmbuf_free(dst);
 	} while (0);
 
+	/* test doing multiple copies */
+	do_multi_copies(dev_id, 0, 0); /* enqueue and complete one batch at a time */
+	do_multi_copies(dev_id, 1, 0); /* enqueue 2 batches and then complete both */
+	do_multi_copies(dev_id, 0, 1); /* enqueue 1 batch, then complete in two halves */
 	return 0;
 }
 
 static int
 test_enqueue_fill(int dev_id)
 {
-	const unsigned int length[] = {8, 64, 1024, 50, 100, 89};
+	const unsigned int lengths[] = {8, 64, 1024, 50, 100, 89};
 	struct rte_mbuf *dst = rte_pktmbuf_alloc(pool);
 	char *dst_data = rte_pktmbuf_mtod(dst, char *);
 	struct rte_mbuf *completed[2] = {0};
 	uint64_t pattern = 0xfedcba9876543210;
 	unsigned int i, j;
 
-	for (i = 0; i < RTE_DIM(length); i++) {
+	for (i = 0; i < RTE_DIM(lengths); i++) {
 		/* reset dst_data */
-		memset(dst_data, 0, length[i]);
+		memset(dst_data, 0, lengths[i]);
 
 		/* perform the fill operation */
 		if (rte_ioat_enqueue_fill(dev_id, pattern,
-				dst->buf_iova + dst->data_off, length[i],
+				dst->buf_iova + dst->data_off, lengths[i],
 				(uintptr_t)dst) != 1) {
 			PRINT_ERR("Error with rte_ioat_enqueue_fill\n");
 			return -1;
@@ -186,11 +261,11 @@ test_enqueue_fill(int dev_id)
 			return -1;
 		}
 		/* check the result */
-		for (j = 0; j < length[i]; j++) {
+		for (j = 0; j < lengths[i]; j++) {
 			char pat_byte = ((char *)&pattern)[j % 8];
 			if (dst_data[j] != pat_byte) {
-				PRINT_ERR("Error with fill operation (length = %u): got (%x), not (%x)\n",
-						length[i], dst_data[j],
+				PRINT_ERR("Error with fill operation (lengths = %u): got (%x), not (%x)\n",
+						lengths[i], dst_data[j],
 						pat_byte);
 				return -1;
 			}
Signature · 1 line
2.30.2
#57 lore raw

PATCH v5 2/12 raw/ioat: support limiting queues for idxd PCI device

In reply to Bruce Richardson

When using a full device instance via vfio, allow the user to specify a maximum number of queues to configure rather than always using the max number of supported queues.

---
 doc/guides/rawdevs/ioat.rst |  8 ++++++++
 drivers/raw/ioat/idxd_pci.c | 28 ++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)
doc/guides/rawdevs/ioat.rst +8 -0
index 250cfc48a6..60438cc3bc 100644
@@ -106,6 +106,14 @@ For devices bound to a suitable DPDK-supported VFIO/UIO driver, the HW devices w
 be found as part of the device scan done at application initialization time without
 the need to pass parameters to the application.
 
+For Intel\ |reg| DSA devices, DPDK will automatically configure the device with the
+maximum number of workqueues available on it, partitioning all resources equally
+among the queues.
+If fewer workqueues are required, then the ``max_queues`` parameter may be passed to
+the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e.g.::
+
+	$ dpdk-test -a <b:d:f>,max_queues=4
+
 If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
 then a specific work queue needs to be passed to the application via a vdev parameter.
 This vdev parameter take the driver name and work queue name as parameters.
drivers/raw/ioat/idxd_pci.c +26 -2
index 01623f33f6..b48e565b4c 100644
@@ -4,6 +4,7 @@
 
 #include <rte_bus_pci.h>
 #include <rte_memzone.h>
+#include <rte_devargs.h>
 
 #include "ioat_private.h"
 #include "ioat_spec.h"
@@ -123,7 +124,8 @@ static const struct rte_rawdev_ops idxd_pci_ops = {
 #define IDXD_PORTAL_SIZE (4096 * 4)
 
 static int
-init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
+init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd,
+		unsigned int max_queues)
 {
 	struct idxd_pci_common *pci;
 	uint8_t nb_groups, nb_engines, nb_wqs;
@@ -179,6 +181,16 @@ init_pci_device(struct rte_pci_device *dev, struct idxd_rawdev *idxd)
 	for (i = 0; i < nb_wqs; i++)
 		idxd_get_wq_cfg(pci, i)[0] = 0;
 
+	/* limit queues if necessary */
+	if (max_queues != 0 && nb_wqs > max_queues) {
+		nb_wqs = max_queues;
+		if (nb_engines > max_queues)
+			nb_engines = max_queues;
+		if (nb_groups > max_queues)
+			nb_engines = max_queues;
+		IOAT_PMD_DEBUG("Limiting queues to %u", nb_wqs);
+	}
+
 	/* put each engine into a separate group to avoid reordering */
 	if (nb_groups > nb_engines)
 		nb_groups = nb_engines;
@@ -242,12 +254,23 @@ idxd_rawdev_probe_pci(struct rte_pci_driver *drv, struct rte_pci_device *dev)
 	uint8_t nb_wqs;
 	int qid, ret = 0;
 	char name[PCI_PRI_STR_SIZE];
+	unsigned int max_queues = 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 = init_pci_device(dev, &idxd);
+	if (dev->device.devargs && dev->device.devargs->args[0] != '\0') {
+		/* if the number of devargs grows beyond just 1, use rte_kvargs */
+		if (sscanf(dev->device.devargs->args,
+				"max_queues=%u", &max_queues) != 1) {
+			IOAT_PMD_ERR("Invalid device parameter: '%s'",
+					dev->device.devargs->args);
+			return -1;
+		}
+	}
+
+	ret = init_pci_device(dev, &idxd, max_queues);
 	if (ret < 0) {
 		IOAT_PMD_ERR("Error initializing PCI hardware");
 		return ret;
@@ -353,3 +376,4 @@ RTE_PMD_REGISTER_PCI(IDXD_PMD_RAWDEV_NAME_PCI, idxd_pmd_drv_pci);
 RTE_PMD_REGISTER_PCI_TABLE(IDXD_PMD_RAWDEV_NAME_PCI, pci_id_idxd_map);
 RTE_PMD_REGISTER_KMOD_DEP(IDXD_PMD_RAWDEV_NAME_PCI,
 			  "* igb_uio | uio_pci_generic | vfio-pci");
+RTE_PMD_REGISTER_PARAM_STRING(rawdev_idxd_pci, "max_queues=0");
Signature · 1 line
2.30.2
#58 lore raw

PATCH v5 3/12 raw/ioat: add component prefix to log messages

In reply to Bruce Richardson

Add the driver prefix "IOAT" to log messages for the driver.

---
 drivers/raw/ioat/ioat_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/raw/ioat/ioat_private.h +1 -1
index 6c423811ec..f032d5fe3d 100644
@@ -21,7 +21,7 @@
 extern int ioat_pmd_logtype;
 
 #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \
-		ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args)
+		ioat_pmd_logtype, "IOAT: %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)
Signature · 1 line
2.30.2
#59 lore raw

PATCH v5 4/12 raw/ioat: expand descriptor struct to full 64 bytes

In reply to Bruce Richardson

Although it's unused by the driver, add the interrupt handle field in the descriptor to the descriptor structure for completeness, and explicitly add the reserved padding field on the end of the structure too. This means that when a descriptor is defined on the stack, or initialized by the compiler, the unused/reserved space will be zeroed appropriately.

---
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/raw/ioat/rte_ioat_rawdev_fns.h +4 -1
index c2c4601ca7..e96edc9053 100644
@@ -140,7 +140,10 @@ struct rte_idxd_hw_desc {
 
 	uint32_t size;    /* length of data for op, or batch size */
 
-	/* 28 bytes of padding here */
+	uint16_t intr_handle; /* completion interrupt handle */
+
+	/* remaining 26 bytes are reserved */
+	uint16_t __reserved[13];
 } __rte_aligned(64);
 
 /**
Signature · 1 line
2.30.2
#60 lore raw

PATCH v5 5/12 raw/ioat: fix script for configuring small number of queues

In reply to Bruce Richardson

The dpdk_idxd_cfg.py script included with the driver for convenience did not work properly where the number of queues to be configured was less than the number of groups or engines. This was because there would be configured groups/engines not assigned to queues. Fix this by limiting the engine and group counts to be no bigger than the number of queues.

Fixes 01863b9d2354 ("raw/ioat: include example configuration script")
---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/raw/ioat/dpdk_idxd_cfg.py +5 -5
index bce4bb5bd4..56e44063e4 100755
@@ -39,15 +39,15 @@ def configure_dsa(dsa_id, queues):
     max_queues = dsa_dir.read_int("max_work_queues")
     max_tokens = dsa_dir.read_int("max_tokens")
 
-    # we want one engine per group
-    nb_groups = min(max_engines, max_groups)
-    for grp in range(nb_groups):
-        dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
-
     nb_queues = min(queues, max_queues)
     if queues > nb_queues:
         print(f"Setting number of queues to max supported value: {max_queues}")
 
+    # we want one engine per group, and no more engines than queues
+    nb_groups = min(max_engines, max_groups, nb_queues)
+    for grp in range(nb_groups):
+        dsa_dir.write_values({f"engine{dsa_id}.{grp}/group_id": grp})
+
     # configure each queue
     for q in range(nb_queues):
         wq_dir = SysfsDir(os.path.join(dsa_dir.path, f"wq{dsa_id}.{q}"))
Signature · 1 line
2.30.2
#61 lore raw

PATCH v5 6/12 raw/ioat: make workqueue name configurable in script

In reply to Bruce Richardson

Add a "--name-prefix" parameter to the quick configuration script for DSA. This allows the queues configured on a DSA instance to be made available to only one DPDK process in a setup with multiple DPDK process instances.

---
 drivers/raw/ioat/dpdk_idxd_cfg.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/raw/ioat/dpdk_idxd_cfg.py +6 -3
index 56e44063e4..ff06d9e240 100755
@@ -29,7 +29,7 @@ def write_values(self, values):
                 f.write(str(contents))
 
 
-def configure_dsa(dsa_id, queues):
+def configure_dsa(dsa_id, queues, prefix):
     "Configure the DSA instance with appropriate number of queues"
     dsa_dir = SysfsDir(f"/sys/bus/dsa/devices/dsa{dsa_id}")
     drv_dir = SysfsDir("/sys/bus/dsa/drivers/dsa")
@@ -54,7 +54,7 @@ def configure_dsa(dsa_id, queues):
         wq_dir.write_values({"group_id": q % nb_groups,
                              "type": "user",
                              "mode": "dedicated",
-                             "name": f"dpdk_wq{dsa_id}.{q}",
+                             "name": f"{prefix}_wq{dsa_id}.{q}",
                              "priority": 1,
                              "size": int(max_tokens / nb_queues)})
 
@@ -71,8 +71,11 @@ def main(args):
     arg_p.add_argument('dsa_id', type=int, help="DSA instance number")
     arg_p.add_argument('-q', metavar='queues', type=int, default=255,
                        help="Number of queues to set up")
+    arg_p.add_argument('--name-prefix', metavar='prefix', dest='prefix',
+                       default="dpdk",
+                       help="Prefix for workqueue name to mark for DPDK use [default: 'dpdk']")
     parsed_args = arg_p.parse_args(args[1:])
-    configure_dsa(parsed_args.dsa_id, parsed_args.q)
+    configure_dsa(parsed_args.dsa_id, parsed_args.q, parsed_args.prefix)
 
 
 if __name__ == "__main__":
Signature · 1 line
2.30.2
#62 lore raw

PATCH v5 7/12 raw/ioat: allow perform operations function to return error

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Change the return type for the rte_ioat_perform_ops() function from void to int to allow the possibility of returning an error code in future, should it be necessary.

---
 drivers/raw/ioat/rte_ioat_rawdev.h     |  4 +++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 11 +++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
drivers/raw/ioat/rte_ioat_rawdev.h +3 -1
index f9e8425a7f..e5a22a0799 100644
@@ -124,8 +124,10 @@ rte_ioat_fence(int dev_id);
  *
  * @param dev_id
  *   The rawdev device id of the ioat instance
+ * @return
+ *   0 on success. Non-zero return on error.
  */
-static inline void
+static inline int
 __rte_experimental
 rte_ioat_perform_ops(int dev_id);
 
drivers/raw/ioat/rte_ioat_rawdev_fns.h +7 -4
index e96edc9053..477c1b7b41 100644
@@ -291,7 +291,7 @@ __ioat_fence(int dev_id)
 /*
  * Trigger hardware to begin performing enqueued operations
  */
-static __rte_always_inline void
+static __rte_always_inline int
 __ioat_perform_ops(int dev_id)
 {
 	struct rte_ioat_rawdev *ioat =
@@ -301,6 +301,8 @@ __ioat_perform_ops(int dev_id)
 	rte_compiler_barrier();
 	*ioat->doorbell = ioat->next_write;
 	ioat->xstats.started = ioat->xstats.enqueued;
+
+	return 0;
 }
 
 /**
@@ -462,7 +464,7 @@ __idxd_movdir64b(volatile void *dst, const void *src)
 			: "a" (dst), "d" (src));
 }
 
-static __rte_always_inline void
+static __rte_always_inline int
 __idxd_perform_ops(int dev_id)
 {
 	struct rte_idxd_rawdev *idxd =
@@ -470,7 +472,7 @@ __idxd_perform_ops(int dev_id)
 	struct rte_idxd_desc_batch *b = &idxd->batch_ring[idxd->next_batch];
 
 	if (b->submitted || b->op_count == 0)
-		return;
+		return 0;
 	b->hdl_end = idxd->next_free_hdl;
 	b->comp.status = 0;
 	b->submitted = 1;
@@ -480,6 +482,7 @@ __idxd_perform_ops(int dev_id)
 	if (++idxd->next_batch == idxd->batch_ring_sz)
 		idxd->next_batch = 0;
 	idxd->xstats.started = idxd->xstats.enqueued;
+	return 0;
 }
 
 static __rte_always_inline int
@@ -558,7 +561,7 @@ rte_ioat_fence(int dev_id)
 		return __ioat_fence(dev_id);
 }
 
-static inline void
+static inline int
 rte_ioat_perform_ops(int dev_id)
 {
 	enum rte_ioat_dev_type *type =
Signature · 1 line
2.30.2
#63 lore raw

PATCH v5 8/12 raw/ioat: add bus driver for device scanning automatically

In reply to Bruce Richardson

Rather than using a vdev with args, DPDK can scan and initialize the devices automatically using a bus-type driver. This bus does not need to worry about registering device drivers, rather it can initialize the devices directly on probe.

The device instances (queues) to use are detected from /dev with the additional info about them got from /sys.

---
 doc/guides/rawdevs/ioat.rst  |  23 ++-
 drivers/raw/ioat/idxd_bus.c  | 359 +++++++++++++++++++++++++++++++++++
 drivers/raw/ioat/idxd_vdev.c | 231 ----------------------
 drivers/raw/ioat/meson.build |   4 +-
 4 files changed, 374 insertions(+), 243 deletions(-)
 create mode 100644 drivers/raw/ioat/idxd_bus.c
 delete mode 100644 drivers/raw/ioat/idxd_vdev.c
doc/guides/rawdevs/ioat.rst +13 -10
index 60438cc3bc..2ad13db294 100644
@@ -78,7 +78,7 @@ Example configuration for a work queue::
 
         $ accel-config config-wq dsa0/wq0.0 --group-id=0 \
            --mode=dedicated --priority=10 --wq-size=8 \
-           --type=user --name=app1
+           --type=user --name=dpdk_app1
 
 Once the devices have been configured, they need to be enabled::
 
@@ -114,15 +114,18 @@ the device driver on the EAL commandline, via the ``allowlist`` or ``-a`` flag e
 
 	$ dpdk-test -a <b:d:f>,max_queues=4
 
-If the device is bound to the IDXD kernel driver (and previously configured with sysfs),
-then a specific work queue needs to be passed to the application via a vdev parameter.
-This vdev parameter take the driver name and work queue name as parameters.
-For example, to use work queue 0 on Intel\ |reg| DSA instance 0::
-
-        $ dpdk-test --no-pci --vdev=rawdev_idxd,wq=0.0
-
-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
+For devices bound to the IDXD kernel driver,
+the DPDK ioat driver will automatically perform a scan for available workqueues to use.
+Any workqueues found listed in ``/dev/dsa`` on the system will be checked in ``/sys``,
+and any which have ``dpdk_`` prefix in their name will be automatically probed by the
+driver to make them available to the application.
+Alternatively, to support use by multiple DPDK processes simultaneously,
+the value used as the DPDK ``--file-prefix`` parameter may be used as a workqueue name prefix,
+instead of ``dpdk_``,
+allowing each DPDK application instance to only use a subset of configured queues.
+
+Once probed successfully, irrespective of kernel driver, 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
drivers/raw/ioat/idxd_bus.c new file +359 -0

359 lines not on this page · raw message

drivers/raw/ioat/idxd_vdev.c deleted +0 -231

231 lines not on this page · raw message

drivers/raw/ioat/meson.build +2 -2
index 3b8ea65398..6382a826e7 100644
@@ -4,13 +4,13 @@
 build = dpdk_conf.has('RTE_ARCH_X86')
 reason = 'only supported on x86'
 sources = files(
+        'idxd_bus.c',
         'idxd_pci.c',
-        'idxd_vdev.c',
         'ioat_common.c',
         'ioat_rawdev.c',
         'ioat_rawdev_test.c',
 )
-deps += ['bus_pci', 'bus_vdev', 'mbuf', 'rawdev']
+deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
         'rte_ioat_rawdev_fns.h',
Signature · 1 line
2.30.2
#64 lore raw

PATCH v5 9/12 raw/ioat: move idxd functions to separate file

In reply to Bruce Richardson

Split the rte_ioat_rawdev_fns.h file into two separate headers, so that the data structures for the original ioat devices and the newer idxd ones can be kept separate from each other. This makes code management and rework easier.

---
 drivers/raw/ioat/meson.build           |   1 +
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 286 ++++++++++++++++++++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 321 +++----------------------
 3 files changed, 321 insertions(+), 287 deletions(-)
 create mode 100644 drivers/raw/ioat/rte_idxd_rawdev_fns.h
drivers/raw/ioat/meson.build +1 -0
index 6382a826e7..0e81cb5951 100644
@@ -13,5 +13,6 @@ sources = files(
 deps += ['bus_pci', 'mbuf', 'rawdev']
 headers = files(
         'rte_ioat_rawdev.h',
+        'rte_idxd_rawdev_fns.h',
         'rte_ioat_rawdev_fns.h',
 )
drivers/raw/ioat/rte_idxd_rawdev_fns.h new file +286 -0

286 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev_fns.h +34 -287

350 lines not on this page · raw message

Signature · 1 line
2.30.2
#65 lore raw

PATCH v5 10/12 raw/ioat: rework SW ring layout

In reply to Bruce Richardson

The ring management in the idxd part of the driver is more complex than it needs to be, tracking individual batches in a ring and having null descriptors as padding to avoid having single-operation batches. This can be simplified by using a regular ring-based layout, with additional overflow at the end to ensure that the one does not need to wrap within a batch.

---
 drivers/raw/ioat/idxd_pci.c            |   5 +-
 drivers/raw/ioat/ioat_common.c         |  99 +++++------
 drivers/raw/ioat/ioat_rawdev_test.c    |   1 +
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 233 +++++++++++++------------
 4 files changed, 179 insertions(+), 159 deletions(-)
drivers/raw/ioat/idxd_pci.c +3 -2
index b48e565b4c..13515dbc6c 100644
@@ -90,7 +90,7 @@ idxd_pci_dev_start(struct rte_rawdev *dev)
 		return 0;
 	}
 
-	if (idxd->public.batch_ring == NULL) {
+	if (idxd->public.desc_ring == NULL) {
 		IOAT_PMD_ERR("WQ %d has not been fully configured", idxd->qid);
 		return -EINVAL;
 	}
@@ -337,7 +337,8 @@ idxd_rawdev_destroy(const char *name)
 	/* free device memory */
 	IOAT_PMD_DEBUG("Freeing device driver memory");
 	rdev->dev_private = NULL;
-	rte_free(idxd->public.batch_ring);
+	rte_free(idxd->public.batch_idx_ring);
+	rte_free(idxd->public.desc_ring);
 	rte_free(idxd->public.hdl_ring);
 	rte_memzone_free(idxd->mz);
 
drivers/raw/ioat/ioat_common.c +50 -49

155 lines not on this page · raw message

drivers/raw/ioat/ioat_rawdev_test.c +1 -0
index a5064d739d..51eebe152f 100644
@@ -206,6 +206,7 @@ test_enqueue_copies(int dev_id)
 		if (rte_ioat_completed_ops(dev_id, max_completions, (void *)&completed[0],
 				(void *)&completed[max_completions]) != max_ops) {
 			PRINT_ERR("Error with rte_ioat_completed_ops\n");
+			rte_rawdev_dump(dev_id, stdout);
 			return -1;
 		}
 		if (completed[0] != src || completed[max_completions] != dst) {
drivers/raw/ioat/rte_idxd_rawdev_fns.h +125 -108

316 lines not on this page · raw message

Signature · 1 line
2.30.2
#66 lore raw

PATCH v5 11/12 raw/ioat: add API to query remaining ring space

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Add a new API to query remaining descriptor ring capacity. This API is useful, for example, when an application needs to enqueue a fragmented packet and wants to ensure that all segments of the packet will be enqueued together.

---
 drivers/raw/ioat/ioat_rawdev_test.c    | 70 +++++++++++++++++++++++++-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 22 ++++++++
 drivers/raw/ioat/rte_ioat_rawdev_fns.h | 24 +++++++++
 3 files changed, 115 insertions(+), 1 deletion(-)
drivers/raw/ioat/ioat_rawdev_test.c +69 -1
index 51eebe152f..839a716a21 100644
@@ -277,6 +277,70 @@ test_enqueue_fill(int dev_id)
 	return 0;
 }
 
+static int
+test_burst_capacity(int dev_id)
+{
+#define BURST_SIZE			64
+	const unsigned int ring_space = rte_ioat_burst_capacity(dev_id);
+	struct rte_mbuf *src, *dst;
+	unsigned int length = 1024;
+	unsigned int i, j, iter;
+	unsigned int old_cap, cap;
+	uintptr_t completions[BURST_SIZE];
+
+	src = rte_pktmbuf_alloc(pool);
+	dst = rte_pktmbuf_alloc(pool);
+
+	old_cap = ring_space;
+	/* to test capacity, we enqueue elements and check capacity is reduced
+	 * by one each time - rebaselining the expected value after each burst
+	 * as the capacity is only for a burst. We enqueue multiple bursts to
+	 * fill up half the ring, before emptying it again. We do this twice to
+	 * ensure that we get to test scenarios where we get ring wrap-around
+	 */
+	for (iter = 0; iter < 2; iter++) {
+		for (i = 0; i < ring_space / (2 * BURST_SIZE); i++) {
+			cap = rte_ioat_burst_capacity(dev_id);
+			if (cap > old_cap) {
+				PRINT_ERR("Error, avail ring capacity has gone up, not down\n");
+				return -1;
+			}
+			old_cap = cap;
+
+			for (j = 0; j < BURST_SIZE; j++) {
+				if (rte_ioat_enqueue_copy(dev_id, rte_pktmbuf_iova(src),
+						rte_pktmbuf_iova(dst), length, 0, 0) != 1) {
+					PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
+					return -1;
+				}
+				if (cap - rte_ioat_burst_capacity(dev_id) != j + 1) {
+					PRINT_ERR("Error, ring capacity did not change as expected\n");
+					return -1;
+				}
+			}
+			rte_ioat_perform_ops(dev_id);
+		}
+		usleep(100);
+		for (i = 0; i < ring_space / (2 * BURST_SIZE); i++) {
+			if (rte_ioat_completed_ops(dev_id, BURST_SIZE,
+					completions, completions) != BURST_SIZE) {
+				PRINT_ERR("Error with completions\n");
+				return -1;
+			}
+		}
+		if (rte_ioat_burst_capacity(dev_id) != ring_space) {
+			PRINT_ERR("Error, ring capacity has not reset to original value\n");
+			return -1;
+		}
+		old_cap = ring_space;
+	}
+
+	rte_pktmbuf_free(src);
+	rte_pktmbuf_free(dst);
+
+	return 0;
+}
+
 int
 ioat_rawdev_test(uint16_t dev_id)
 {
@@ -321,7 +385,7 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 
 	pool = rte_pktmbuf_pool_create("TEST_IOAT_POOL",
-			256, /* n == num elements */
+			p.ring_size * 2, /* n == num elements */
 			32,  /* cache size */
 			0,   /* priv size */
 			2048, /* data room size */
@@ -385,6 +449,10 @@ ioat_rawdev_test(uint16_t dev_id)
 	}
 	printf("\n");
 
+	printf("Running Burst Capacity Test\n");
+	if (test_burst_capacity(dev_id) != 0)
+		goto err;
+
 	rte_rawdev_stop(dev_id);
 	if (rte_rawdev_xstats_reset(dev_id, NULL, 0) != 0) {
 		PRINT_ERR("Error resetting xstat values\n");
drivers/raw/ioat/rte_idxd_rawdev_fns.h +22 -0
index dfc591bb80..0bd9cfbd0d 100644
@@ -117,6 +117,28 @@ struct rte_idxd_rawdev {
 	struct rte_idxd_user_hdl *hdl_ring;
 };
 
+static __rte_always_inline uint16_t
+__idxd_burst_capacity(int dev_id)
+{
+	struct rte_idxd_rawdev *idxd =
+			(struct rte_idxd_rawdev *)rte_rawdevs[dev_id].dev_private;
+	uint16_t write_idx = idxd->batch_start + idxd->batch_size;
+	uint16_t used_space;
+
+	/* Check for space in the batch ring */
+	if ((idxd->batch_idx_read == 0 && idxd->batch_idx_write == idxd->max_batches) ||
+			idxd->batch_idx_write + 1 == idxd->batch_idx_read)
+		return 0;
+
+	/* for descriptors, check for wrap-around on write but not read */
+	if (idxd->hdls_read > write_idx)
+		write_idx += idxd->desc_ring_mask + 1;
+	used_space = write_idx - idxd->hdls_read;
+
+	/* Return amount of free space in the descriptor ring */
+	return idxd->desc_ring_mask - used_space;
+}
+
 static __rte_always_inline rte_iova_t
 __desc_idx_to_iova(struct rte_idxd_rawdev *idxd, uint16_t n)
 {
drivers/raw/ioat/rte_ioat_rawdev_fns.h +24 -0
index 072fcf9c15..1eff75ec0a 100644
@@ -111,6 +111,19 @@ struct rte_ioat_rawdev {
 #define RTE_IOAT_CHANSTS_HALTED			0x3
 #define RTE_IOAT_CHANSTS_ARMED			0x4
 
+static __rte_always_inline uint16_t
+__ioat_burst_capacity(int dev_id)
+{
+	struct rte_ioat_rawdev *ioat =
+			(struct rte_ioat_rawdev *)rte_rawdevs[dev_id].dev_private;
+	unsigned short size = ioat->ring_size - 1;
+	unsigned short read = ioat->next_read;
+	unsigned short write = ioat->next_write;
+	unsigned short space = size - (write - read);
+
+	return space;
+}
+
 static __rte_always_inline int
 __ioat_write_desc(int dev_id, uint32_t op, uint64_t src, phys_addr_t dst,
 		unsigned int length, uintptr_t src_hdl, uintptr_t dst_hdl)
@@ -271,6 +284,17 @@ __ioat_completed_ops(int dev_id, uint8_t max_copies,
 	return count;
 }
 
+static inline uint16_t
+rte_ioat_burst_capacity(int dev_id)
+{
+	enum rte_ioat_dev_type *type =
+		(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+	if (*type == RTE_IDXD_DEV)
+		return __idxd_burst_capacity(dev_id);
+	else
+		return __ioat_burst_capacity(dev_id);
+}
+
 static inline int
 rte_ioat_enqueue_fill(int dev_id, uint64_t pattern, phys_addr_t dst,
 		unsigned int len, uintptr_t dst_hdl)
Signature · 1 line
2.30.2
#67 lore raw

PATCH v5 12/12 raw/ioat: report status of completed jobs

In reply to Bruce Richardson

Add improved error handling to rte_ioat_completed_ops(). This patch adds new parameters to the function to enable the user to track the completion status of each individual operation in a batch. With this addition, the function can help the user to determine firstly, how many operations may have failed or been skipped and then secondly, which specific operations did not complete successfully.

---
 doc/guides/rel_notes/release_21_05.rst |   5 +
 drivers/raw/ioat/ioat_common.c         |   9 +
 drivers/raw/ioat/ioat_rawdev_test.c    | 274 ++++++++++++++++++++++++-
 drivers/raw/ioat/rte_idxd_rawdev_fns.h | 151 ++++++++++----
 drivers/raw/ioat/rte_ioat_rawdev.h     |  53 ++++-
 drivers/raw/ioat/rte_ioat_rawdev_fns.h |  15 +-
 examples/ioat/ioatfwd.c                |  14 +-
 examples/vhost/ioat.c                  |   2 +-
 8 files changed, 455 insertions(+), 68 deletions(-)
doc/guides/rel_notes/release_21_05.rst +5 -0
index cd33898c55..064810a8f9 100644
@@ -333,6 +333,11 @@ API Changes
   it's not supported on the current platform. Instead ``rte_stack_create()``
   fails and ``rte_errno`` is set to ``ENOTSUP``.
 
+* raw/ioat: The experimental function ``rte_ioat_completed_ops()`` now
+  supports two additional parameters, ``status`` and ``num_unsuccessful``,
+  to allow the reporting of errors from hardware when performing copy
+  operations.
+
 
 ABI Changes
 -----------
drivers/raw/ioat/ioat_common.c +9 -0
index fcb30572e6..d01c1ee367 100644
@@ -162,6 +162,15 @@ idxd_dev_configure(const struct rte_rawdev *dev,
 		rte_idxd->desc_ring = NULL;
 		return -ENOMEM;
 	}
+	rte_idxd->hdl_ring_flags = rte_zmalloc(NULL,
+			sizeof(*rte_idxd->hdl_ring_flags) * max_desc, 0);
+	if (rte_idxd->hdl_ring_flags == NULL) {
+		rte_free(rte_idxd->desc_ring);
+		rte_free(rte_idxd->hdl_ring);
+		rte_idxd->desc_ring = NULL;
+		rte_idxd->hdl_ring = NULL;
+		return -ENOMEM;
+	}
 	rte_idxd->hdls_read = rte_idxd->batch_start = 0;
 	rte_idxd->batch_size = 0;
 
drivers/raw/ioat/ioat_rawdev_test.c +266 -8

343 lines not on this page · raw message

drivers/raw/ioat/rte_idxd_rawdev_fns.h +108 -43

230 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev.h +45 -8

91 lines not on this page · raw message

drivers/raw/ioat/rte_ioat_rawdev_fns.h +11 -4
index 1eff75ec0a..6049e3bd8b 100644
@@ -345,16 +345,22 @@ rte_ioat_perform_ops(int dev_id)
 
 static inline int
 rte_ioat_completed_ops(int dev_id, uint8_t max_copies,
+		uint32_t *status, uint8_t *num_unsuccessful,
 		uintptr_t *src_hdls, uintptr_t *dst_hdls)
 {
 	enum rte_ioat_dev_type *type =
 			(enum rte_ioat_dev_type *)rte_rawdevs[dev_id].dev_private;
+	uint8_t tmp; /* used so functions don't need to check for null parameter */
+
+	if (num_unsuccessful == NULL)
+		num_unsuccessful = &tmp;
+
+	*num_unsuccessful = 0;
 	if (*type == RTE_IDXD_DEV)
-		return __idxd_completed_ops(dev_id, max_copies,
+		return __idxd_completed_ops(dev_id, max_copies, status, num_unsuccessful,
 				src_hdls, dst_hdls);
 	else
-		return __ioat_completed_ops(dev_id,  max_copies,
-				src_hdls, dst_hdls);
+		return __ioat_completed_ops(dev_id, max_copies, src_hdls, dst_hdls);
 }
 
 static inline void
@@ -366,7 +372,8 @@ __rte_deprecated_msg("use rte_ioat_completed_ops() instead")
 rte_ioat_completed_copies(int dev_id, uint8_t max_copies,
 		uintptr_t *src_hdls, uintptr_t *dst_hdls)
 {
-	return rte_ioat_completed_ops(dev_id, max_copies, src_hdls, dst_hdls);
+	return rte_ioat_completed_ops(dev_id, max_copies, NULL, NULL,
+			src_hdls, dst_hdls);
 }
 
 #endif /* _RTE_IOAT_RAWDEV_FNS_H_ */
examples/ioat/ioatfwd.c +10 -4
index 845301a6db..2e377e2d4b 100644
@@ -447,12 +447,15 @@ ioat_tx_port(struct rxtx_port_config *tx_config)
 
 	for (i = 0; i < tx_config->nb_queues; i++) {
 		if (copy_mode == COPY_MODE_IOAT_NUM) {
-			/* Deque the mbufs from IOAT device. */
+			/* Dequeue the mbufs from IOAT device. Since all memory
+			 * is DPDK pinned memory and therefore all addresses should
+			 * be valid, we don't check for copy errors
+			 */
 			nb_dq = rte_ioat_completed_ops(
-				tx_config->ioat_ids[i], MAX_PKT_BURST,
+				tx_config->ioat_ids[i], MAX_PKT_BURST, NULL, NULL,
 				(void *)mbufs_src, (void *)mbufs_dst);
 		} else {
-			/* Deque the mbufs from rx_to_tx_ring. */
+			/* Dequeue the mbufs from rx_to_tx_ring. */
 			nb_dq = rte_ring_dequeue_burst(
 				tx_config->rx_to_tx_ring, (void *)mbufs_dst,
 				MAX_PKT_BURST, NULL);
@@ -725,7 +728,10 @@ check_link_status(uint32_t port_mask)
 static void
 configure_rawdev_queue(uint32_t dev_id)
 {
-	struct rte_ioat_rawdev_config dev_config = { .ring_size = ring_size };
+	struct rte_ioat_rawdev_config dev_config = {
+			.ring_size = ring_size,
+			.no_prefetch_completions = (cfg.nb_lcores > 1),
+	};
 	struct rte_rawdev_info info = { .dev_private = &dev_config };
 
 	if (rte_rawdev_configure(dev_id, &info, sizeof(dev_config)) != 0) {
examples/vhost/ioat.c +1 -1
index 60b73be936..efdd3f6f76 100644
@@ -183,7 +183,7 @@ ioat_check_completed_copies_cb(int vid, uint16_t queue_id,
 
 		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
-		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
+		n_seg = rte_ioat_completed_ops(dev_id, 255, NULL, NULL, dump, dump);
 		if (n_seg < 0) {
 			RTE_LOG(ERR,
 				VHOST_DATA,
Signature · 1 line
2.30.2
#68 lore raw
In reply to Bruce Richardson

04/05/2021 15:14, Bruce Richardson:

Quoted 12 lines

Bruce Richardson (10):
raw/ioat: add unit tests for completion batching raw/ioat: support limiting queues for idxd PCI device raw/ioat: add component prefix to log messages raw/ioat: expand descriptor struct to full 64 bytes raw/ioat: fix script for configuring small number of queues raw/ioat: make workqueue name configurable in script raw/ioat: add bus driver for device scanning automatically raw/ioat: move idxd functions to separate file raw/ioat: rework SW ring layout
raw/ioat: report status of completed jobs

Quoted 3 lines

Kevin Laatz (2):
raw/ioat: allow perform operations function to return error raw/ioat: add API to query remaining ring space

Series applied, thanks.