DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/4] simplify unit-testing of rawdevs
@ 2020-08-21 15:59 Bruce Richardson
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 1/4] raw/ioat: support multiple devices being tested Bruce Richardson
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Bruce Richardson @ 2020-08-21 15:59 UTC (permalink / raw)
  To: Hemant Agrawal, Nipun Gupta; +Cc: dev, Bruce Richardson

At present the "rawdev_autotest" command creates a skeleton rawdev and runs
a series of tests on the rawdev API and on that rawdev. While the rawdev
API set includes a "selftest" function, it is not hooked up to this test so
to test an individual rawdev driver, e.g. ioat, requires that a new test
command be added.

This patchset improves the situation by changing the UT to first run the
existing API tests, but then call selftest on all rawdevs on the system.
This removes the need for any new test commands for new drivers. If there
are multiple rawdevs on a system, the sub-set to be tested can be limited
via existing means such as using the device block/allow EAL parameters or
similarly via vdev args, etc.

As part of this change, the ioat rawdev autotest is fixed to allow calling
on multiple instances inside the one test run, and thereafter the custom
test command for it is removed as it is no longer necessary.

Bruce Richardson (4):
  raw/ioat: support multiple devices being tested
  raw/ioat: include extra info in error messages
  app/test: change rawdev autotest to run selftest on all devs
  app/test: remove ioat-specific autotest

 app/test/test_rawdev.c              | 38 +++++++++-------
 drivers/raw/ioat/ioat_rawdev_test.c | 69 ++++++++++++++++++++---------
 2 files changed, 68 insertions(+), 39 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH 1/4] raw/ioat: support multiple devices being tested
  2020-08-21 15:59 [dpdk-dev] [PATCH 0/4] simplify unit-testing of rawdevs Bruce Richardson
@ 2020-08-21 15:59 ` Bruce Richardson
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 2/4] raw/ioat: include extra info in error messages Bruce Richardson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2020-08-21 15:59 UTC (permalink / raw)
  To: Hemant Agrawal, Nipun Gupta; +Cc: dev, Bruce Richardson

The current selftest function uses a single global variable to track state
which implies that only a single instance can have the selftest function
called on it. Change this to an array to allow multiple instances to be
tested.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/raw/ioat/ioat_rawdev_test.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/raw/ioat/ioat_rawdev_test.c b/drivers/raw/ioat/ioat_rawdev_test.c
index 724cdb9e74..6262995256 100644
--- a/drivers/raw/ioat/ioat_rawdev_test.c
+++ b/drivers/raw/ioat/ioat_rawdev_test.c
@@ -9,10 +9,13 @@
 #include "rte_ioat_rawdev.h"
 #include "ioat_private.h"
 
+#define MAX_SUPPORTED_RAWDEVS 64
+#define TEST_SKIPPED 77
+
 int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
 
 static struct rte_mempool *pool;
-static unsigned short expected_ring_size;
+static unsigned short expected_ring_size[MAX_SUPPORTED_RAWDEVS];
 
 static int
 test_enqueue_copies(int dev_id)
@@ -149,10 +152,16 @@ ioat_rawdev_test(uint16_t dev_id)
 	unsigned int nb_xstats;
 	unsigned int i;
 
+	if (dev_id >= MAX_SUPPORTED_RAWDEVS) {
+		printf("Skipping test. Cannot test rawdevs with id's greater than %d\n",
+				MAX_SUPPORTED_RAWDEVS);
+		return TEST_SKIPPED;
+	}
+
 	rte_rawdev_info_get(dev_id, &info, sizeof(p));
-	if (p.ring_size != expected_ring_size) {
+	if (p.ring_size != expected_ring_size[dev_id]) {
 		printf("Error, initial ring size is not as expected (Actual: %d, Expected: %d)\n",
-				(int)p.ring_size, expected_ring_size);
+				(int)p.ring_size, expected_ring_size[dev_id]);
 		return -1;
 	}
 
@@ -167,7 +176,7 @@ ioat_rawdev_test(uint16_t dev_id)
 				IOAT_TEST_RINGSIZE, (int)p.ring_size);
 		return -1;
 	}
-	expected_ring_size = p.ring_size;
+	expected_ring_size[dev_id] = p.ring_size;
 
 	if (rte_rawdev_start(dev_id) != 0) {
 		printf("Error with rte_rawdev_start()\n");
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH 2/4] raw/ioat: include extra info in error messages
  2020-08-21 15:59 [dpdk-dev] [PATCH 0/4] simplify unit-testing of rawdevs Bruce Richardson
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 1/4] raw/ioat: support multiple devices being tested Bruce Richardson
@ 2020-08-21 15:59 ` Bruce Richardson
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 3/4] app/test: change rawdev autotest to run selftest on all devs Bruce Richardson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2020-08-21 15:59 UTC (permalink / raw)
  To: Hemant Agrawal, Nipun Gupta; +Cc: dev, Bruce Richardson

In case of any failures, include the function name and the line number of
the error message in the message, to make tracking down the failure easier.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/raw/ioat/ioat_rawdev_test.c | 52 +++++++++++++++++++----------
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/drivers/raw/ioat/ioat_rawdev_test.c b/drivers/raw/ioat/ioat_rawdev_test.c
index 6262995256..534b07b124 100644
--- a/drivers/raw/ioat/ioat_rawdev_test.c
+++ b/drivers/raw/ioat/ioat_rawdev_test.c
@@ -17,6 +17,22 @@ int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
 static struct rte_mempool *pool;
 static unsigned short expected_ring_size[MAX_SUPPORTED_RAWDEVS];
 
+#define PRINT_ERR(...) print_err(__func__, __LINE__, __VA_ARGS__)
+
+static inline int
+print_err(const char *func, int lineno, const char *format, ...)
+{
+	va_list ap;
+	int ret;
+
+	ret = fprintf(stderr, "In %s:%d - ", func, lineno);
+	va_start(ap, format);
+	ret += vfprintf(stderr, format, ap);
+	va_end(ap);
+
+	return ret;
+}
+
 static int
 test_enqueue_copies(int dev_id)
 {
@@ -46,7 +62,7 @@ test_enqueue_copies(int dev_id)
 				(uintptr_t)src,
 				(uintptr_t)dst,
 				0 /* no fence */) != 1) {
-			printf("Error with rte_ioat_enqueue_copy\n");
+			PRINT_ERR("Error with rte_ioat_enqueue_copy\n");
 			return -1;
 		}
 		rte_ioat_do_copies(dev_id);
@@ -54,18 +70,18 @@ test_enqueue_copies(int dev_id)
 
 		if (rte_ioat_completed_copies(dev_id, 1, (void *)&completed[0],
 				(void *)&completed[1]) != 1) {
-			printf("Error with rte_ioat_completed_copies\n");
+			PRINT_ERR("Error with rte_ioat_completed_copies\n");
 			return -1;
 		}
 		if (completed[0] != src || completed[1] != dst) {
-			printf("Error with completions: got (%p, %p), not (%p,%p)\n",
+			PRINT_ERR("Error with completions: got (%p, %p), not (%p,%p)\n",
 					completed[0], completed[1], src, dst);
 			return -1;
 		}
 
 		for (i = 0; i < length; i++)
 			if (dst_data[i] != src_data[i]) {
-				printf("Data mismatch at char %u\n", i);
+				PRINT_ERR("Data mismatch at char %u\n", i);
 				return -1;
 			}
 		rte_pktmbuf_free(src);
@@ -98,7 +114,7 @@ test_enqueue_copies(int dev_id)
 					(uintptr_t)srcs[i],
 					(uintptr_t)dsts[i],
 					0 /* nofence */) != 1) {
-				printf("Error with rte_ioat_enqueue_copy for buffer %u\n",
+				PRINT_ERR("Error with rte_ioat_enqueue_copy for buffer %u\n",
 						i);
 				return -1;
 			}
@@ -108,18 +124,18 @@ test_enqueue_copies(int dev_id)
 
 		if (rte_ioat_completed_copies(dev_id, 64, (void *)completed_src,
 				(void *)completed_dst) != RTE_DIM(srcs)) {
-			printf("Error with rte_ioat_completed_copies\n");
+			PRINT_ERR("Error with rte_ioat_completed_copies\n");
 			return -1;
 		}
 		for (i = 0; i < RTE_DIM(srcs); i++) {
 			char *src_data, *dst_data;
 
 			if (completed_src[i] != srcs[i]) {
-				printf("Error with source pointer %u\n", i);
+				PRINT_ERR("Error with source pointer %u\n", i);
 				return -1;
 			}
 			if (completed_dst[i] != dsts[i]) {
-				printf("Error with dest pointer %u\n", i);
+				PRINT_ERR("Error with dest pointer %u\n", i);
 				return -1;
 			}
 
@@ -127,7 +143,7 @@ test_enqueue_copies(int dev_id)
 			dst_data = rte_pktmbuf_mtod(dsts[i], char *);
 			for (j = 0; j < length; j++)
 				if (src_data[j] != dst_data[j]) {
-					printf("Error with copy of packet %u, byte %u\n",
+					PRINT_ERR("Error with copy of packet %u, byte %u\n",
 							i, j);
 					return -1;
 				}
@@ -160,26 +176,26 @@ ioat_rawdev_test(uint16_t dev_id)
 
 	rte_rawdev_info_get(dev_id, &info, sizeof(p));
 	if (p.ring_size != expected_ring_size[dev_id]) {
-		printf("Error, initial ring size is not as expected (Actual: %d, Expected: %d)\n",
+		PRINT_ERR("Error, initial ring size is not as expected (Actual: %d, Expected: %d)\n",
 				(int)p.ring_size, expected_ring_size[dev_id]);
 		return -1;
 	}
 
 	p.ring_size = IOAT_TEST_RINGSIZE;
 	if (rte_rawdev_configure(dev_id, &info, sizeof(p)) != 0) {
-		printf("Error with rte_rawdev_configure()\n");
+		PRINT_ERR("Error with rte_rawdev_configure()\n");
 		return -1;
 	}
 	rte_rawdev_info_get(dev_id, &info, sizeof(p));
 	if (p.ring_size != IOAT_TEST_RINGSIZE) {
-		printf("Error, ring size is not %d (%d)\n",
+		PRINT_ERR("Error, ring size is not %d (%d)\n",
 				IOAT_TEST_RINGSIZE, (int)p.ring_size);
 		return -1;
 	}
 	expected_ring_size[dev_id] = p.ring_size;
 
 	if (rte_rawdev_start(dev_id) != 0) {
-		printf("Error with rte_rawdev_start()\n");
+		PRINT_ERR("Error with rte_rawdev_start()\n");
 		return -1;
 	}
 
@@ -190,7 +206,7 @@ ioat_rawdev_test(uint16_t dev_id)
 			2048, /* data room size */
 			info.socket_id);
 	if (pool == NULL) {
-		printf("Error with mempool creation\n");
+		PRINT_ERR("Error with mempool creation\n");
 		return -1;
 	}
 
@@ -199,14 +215,14 @@ ioat_rawdev_test(uint16_t dev_id)
 
 	snames = malloc(sizeof(*snames) * nb_xstats);
 	if (snames == NULL) {
-		printf("Error allocating xstat names memory\n");
+		PRINT_ERR("Error allocating xstat names memory\n");
 		goto err;
 	}
 	rte_rawdev_xstats_names_get(dev_id, snames, nb_xstats);
 
 	ids = malloc(sizeof(*ids) * nb_xstats);
 	if (ids == NULL) {
-		printf("Error allocating xstat ids memory\n");
+		PRINT_ERR("Error allocating xstat ids memory\n");
 		goto err;
 	}
 	for (i = 0; i < nb_xstats; i++)
@@ -214,7 +230,7 @@ ioat_rawdev_test(uint16_t dev_id)
 
 	stats = malloc(sizeof(*stats) * nb_xstats);
 	if (stats == NULL) {
-		printf("Error allocating xstat memory\n");
+		PRINT_ERR("Error allocating xstat memory\n");
 		goto err;
 	}
 
@@ -234,7 +250,7 @@ ioat_rawdev_test(uint16_t dev_id)
 
 	rte_rawdev_stop(dev_id);
 	if (rte_rawdev_xstats_reset(dev_id, NULL, 0) != 0) {
-		printf("Error resetting xstat values\n");
+		PRINT_ERR("Error resetting xstat values\n");
 		goto err;
 	}
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH 3/4] app/test: change rawdev autotest to run selftest on all devs
  2020-08-21 15:59 [dpdk-dev] [PATCH 0/4] simplify unit-testing of rawdevs Bruce Richardson
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 1/4] raw/ioat: support multiple devices being tested Bruce Richardson
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 2/4] raw/ioat: include extra info in error messages Bruce Richardson
@ 2020-08-21 15:59 ` Bruce Richardson
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 4/4] app/test: remove ioat-specific autotest Bruce Richardson
  2020-09-10 16:47 ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Bruce Richardson
  4 siblings, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2020-08-21 15:59 UTC (permalink / raw)
  To: Hemant Agrawal, Nipun Gupta; +Cc: dev, Bruce Richardson

Rather than having each rawdev provide its own autotest command, we can
instead just use the generic rawdev_autotest to test any and all available
rawdevs.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_rawdev.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/app/test/test_rawdev.c b/app/test/test_rawdev.c
index d8d9595be1..0e25ccf8dc 100644
--- a/app/test/test_rawdev.c
+++ b/app/test/test_rawdev.c
@@ -14,14 +14,38 @@
 static int
 test_rawdev_selftest_impl(const char *pmd, const char *opts)
 {
+	int ret;
+
+	printf("\n### Test rawdev infrastructure using skeleton driver\n");
 	rte_vdev_init(pmd, opts);
-	return rte_rawdev_selftest(rte_rawdev_get_dev_id(pmd));
+	ret = rte_rawdev_selftest(rte_rawdev_get_dev_id(pmd));
+	rte_vdev_uninit(pmd);
+	return ret;
 }
 
 static int
 test_rawdev_selftest_skeleton(void)
 {
-	return test_rawdev_selftest_impl("rawdev_skeleton", "");
+	const int count = rte_rawdev_count();
+	int ret = 0;
+	int i;
+
+	/* basic sanity on rawdev infrastructure */
+	if (test_rawdev_selftest_impl("rawdev_skeleton", "") < 0)
+		return -1;
+
+	/* now run self-test on all rawdevs */
+	if (count > 0)
+		printf("\n### Run selftest on each available rawdev\n");
+	for (i = 0; i < count; i++) {
+		int result = rte_rawdev_selftest(i);
+		printf("Rawdev %u (%s) selftest: %s\n", i,
+				rte_rawdevs[i].name,
+				result == 0 ? "Passed" : "Failed");
+		ret |=  result;
+	}
+
+	return ret;
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH 4/4] app/test: remove ioat-specific autotest
  2020-08-21 15:59 [dpdk-dev] [PATCH 0/4] simplify unit-testing of rawdevs Bruce Richardson
                   ` (2 preceding siblings ...)
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 3/4] app/test: change rawdev autotest to run selftest on all devs Bruce Richardson
@ 2020-08-21 15:59 ` Bruce Richardson
  2020-09-10 16:47 ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Bruce Richardson
  4 siblings, 0 replies; 13+ messages in thread
From: Bruce Richardson @ 2020-08-21 15:59 UTC (permalink / raw)
  To: Hemant Agrawal, Nipun Gupta; +Cc: dev, Bruce Richardson

Since the rawdev autotest can now be used to test all rawdevs on the
system, there is no need for a dedicated ioat autotest command.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_rawdev.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/app/test/test_rawdev.c b/app/test/test_rawdev.c
index 0e25ccf8dc..44651ba3cc 100644
--- a/app/test/test_rawdev.c
+++ b/app/test/test_rawdev.c
@@ -49,23 +49,3 @@ test_rawdev_selftest_skeleton(void)
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
-
-static int
-test_rawdev_selftest_ioat(void)
-{
-	const int count = rte_rawdev_count();
-	int i;
-
-	for (i = 0; i < count; i++) {
-		struct rte_rawdev_info info = { .dev_private = NULL };
-		if (rte_rawdev_info_get(i, &info, 0) == 0 &&
-				strstr(info.driver_name, "ioat") != NULL)
-			return rte_rawdev_selftest(i) == 0 ?
-					TEST_SUCCESS : TEST_FAILED;
-	}
-
-	printf("No IOAT rawdev found, skipping tests\n");
-	return TEST_SKIPPED;
-}
-
-REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs
  2020-08-21 15:59 [dpdk-dev] [PATCH 0/4] simplify unit-testing of rawdevs Bruce Richardson
                   ` (3 preceding siblings ...)
  2020-08-21 15:59 ` [dpdk-dev] [PATCH 4/4] app/test: remove ioat-specific autotest Bruce Richardson
@ 2020-09-10 16:47 ` Bruce Richardson
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 1/3] raw/ioat: support multiple devices being tested Bruce Richardson
                     ` (3 more replies)
  4 siblings, 4 replies; 13+ messages in thread
From: Bruce Richardson @ 2020-09-10 16:47 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

At present the "rawdev_autotest" command creates a skeleton rawdev and runs
a series of tests on the rawdev API and on that rawdev. While the rawdev
API set includes a "selftest" function, it is not hooked up to this test so
to test an individual rawdev driver, e.g. ioat, requires that a new test
command be added.

This patchset improves the situation by changing the UT to first run the
existing API tests, but then call selftest on all rawdevs on the system.
This removes the need for any new test commands for new drivers. If there
are multiple rawdevs on a system, the sub-set to be tested can be limited
via existing means such as using the device block/allow EAL parameters or
similarly via vdev args, etc.

As part of this change, the ioat rawdev autotest is fixed to allow calling
on multiple instances inside the one test run, and thereafter the custom
test command for it is removed as it is no longer necessary. 

Depends-on: series-12105 ("Enhance rawdev APIs")

V2:
 - dropped patch 2, which had ioat-only changes to debug prints, and wasn't
   relevant to the rest of the set
 - improved the naming of the test functions in test_rawdev.c
 - added release note entry for these changes

Bruce Richardson (3):
  raw/ioat: support multiple devices being tested
  app/test: change rawdev autotest to run selftest on all devs
  app/test: remove ioat-specific autotest

 app/test/test_rawdev.c                 | 34 +++++++++++++++++---------
 doc/guides/rel_notes/release_20_11.rst |  7 ++++++
 drivers/raw/ioat/ioat_rawdev_test.c    | 17 ++++++++++---
 3 files changed, 42 insertions(+), 16 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH v2 1/3] raw/ioat: support multiple devices being tested
  2020-09-10 16:47 ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Bruce Richardson
@ 2020-09-10 16:47   ` Bruce Richardson
  2020-09-14 12:34     ` Laatz, Kevin
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 2/3] app/test: change rawdev autotest to run selftest on all devs Bruce Richardson
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Bruce Richardson @ 2020-09-10 16:47 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

The current selftest function uses a single global variable to track state
which implies that only a single instance can have the selftest function
called on it. Change this to an array to allow multiple instances to be
tested.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/raw/ioat/ioat_rawdev_test.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/raw/ioat/ioat_rawdev_test.c b/drivers/raw/ioat/ioat_rawdev_test.c
index c463a82ad6..e5b50ae9f4 100644
--- a/drivers/raw/ioat/ioat_rawdev_test.c
+++ b/drivers/raw/ioat/ioat_rawdev_test.c
@@ -8,10 +8,13 @@
 #include "rte_rawdev.h"
 #include "rte_ioat_rawdev.h"
 
+#define MAX_SUPPORTED_RAWDEVS 64
+#define TEST_SKIPPED 77
+
 int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */
 
 static struct rte_mempool *pool;
-static unsigned short expected_ring_size;
+static unsigned short expected_ring_size[MAX_SUPPORTED_RAWDEVS];
 
 static int
 test_enqueue_copies(int dev_id)
@@ -148,10 +151,16 @@ ioat_rawdev_test(uint16_t dev_id)
 	unsigned int nb_xstats;
 	unsigned int i;
 
+	if (dev_id >= MAX_SUPPORTED_RAWDEVS) {
+		printf("Skipping test. Cannot test rawdevs with id's greater than %d\n",
+				MAX_SUPPORTED_RAWDEVS);
+		return TEST_SKIPPED;
+	}
+
 	rte_rawdev_info_get(dev_id, &info, sizeof(p));
-	if (p.ring_size != expected_ring_size) {
+	if (p.ring_size != expected_ring_size[dev_id]) {
 		printf("Error, initial ring size is not as expected (Actual: %d, Expected: %d)\n",
-				(int)p.ring_size, expected_ring_size);
+				(int)p.ring_size, expected_ring_size[dev_id]);
 		return -1;
 	}
 
@@ -166,7 +175,7 @@ ioat_rawdev_test(uint16_t dev_id)
 				IOAT_TEST_RINGSIZE, (int)p.ring_size);
 		return -1;
 	}
-	expected_ring_size = p.ring_size;
+	expected_ring_size[dev_id] = p.ring_size;
 
 	if (rte_rawdev_start(dev_id) != 0) {
 		printf("Error with rte_rawdev_start()\n");
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH v2 2/3] app/test: change rawdev autotest to run selftest on all devs
  2020-09-10 16:47 ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Bruce Richardson
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 1/3] raw/ioat: support multiple devices being tested Bruce Richardson
@ 2020-09-10 16:47   ` Bruce Richardson
  2020-09-14 12:28     ` Laatz, Kevin
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 3/3] app/test: remove ioat-specific autotest Bruce Richardson
  2020-10-06  7:28   ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Thomas Monjalon
  3 siblings, 1 reply; 13+ messages in thread
From: Bruce Richardson @ 2020-09-10 16:47 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Nipun Gupta, Hemant Agrawal, John McNamara,
	Marko Kovacevic

Rather than having each rawdev provide its own autotest command, we can
instead just use the generic rawdev_autotest to test any and all available
rawdevs.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_rawdev.c                 | 34 ++++++++++++++++++++++++--
 doc/guides/rel_notes/release_20_11.rst |  5 ++++
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/app/test/test_rawdev.c b/app/test/test_rawdev.c
index d8d9595be1..7e2fb2cf27 100644
--- a/app/test/test_rawdev.c
+++ b/app/test/test_rawdev.c
@@ -14,8 +14,13 @@
 static int
 test_rawdev_selftest_impl(const char *pmd, const char *opts)
 {
+	int ret;
+
+	printf("\n### Test rawdev infrastructure using skeleton driver\n");
 	rte_vdev_init(pmd, opts);
-	return rte_rawdev_selftest(rte_rawdev_get_dev_id(pmd));
+	ret = rte_rawdev_selftest(rte_rawdev_get_dev_id(pmd));
+	rte_vdev_uninit(pmd);
+	return ret;
 }
 
 static int
@@ -24,7 +29,32 @@ test_rawdev_selftest_skeleton(void)
 	return test_rawdev_selftest_impl("rawdev_skeleton", "");
 }
 
-REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);
+static int
+test_rawdev_selftests(void)
+{
+	const int count = rte_rawdev_count();
+	int ret = 0;
+	int i;
+
+	/* basic sanity on rawdev infrastructure */
+	if (test_rawdev_selftest_skeleton() < 0)
+		return -1;
+
+	/* now run self-test on all rawdevs */
+	if (count > 0)
+		printf("\n### Run selftest on each available rawdev\n");
+	for (i = 0; i < count; i++) {
+		int result = rte_rawdev_selftest(i);
+		printf("Rawdev %u (%s) selftest: %s\n", i,
+				rte_rawdevs[i].name,
+				result == 0 ? "Passed" : "Failed");
+		ret |=  result;
+	}
+
+	return ret;
+}
+
+REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftests);
 
 static int
 test_rawdev_selftest_ioat(void)
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 667e3d54ad..2ac7dca9a0 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -93,6 +93,11 @@ API Changes
   and the function ``rte_rawdev_queue_conf_get()``
   from ``void`` to ``int`` allowing the return of error codes from drivers.
 
+* rawdev: The running of a drivers ``selftest()`` function can now be done
+  using the ``rawdev_autotest`` command in the ``dpdk-test`` binary. This
+  command now calls the self-test function for each rawdev found on the
+  system, and does not require a specific command per device type.
+
 
 ABI Changes
 -----------
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dpdk-dev] [PATCH v2 3/3] app/test: remove ioat-specific autotest
  2020-09-10 16:47 ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Bruce Richardson
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 1/3] raw/ioat: support multiple devices being tested Bruce Richardson
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 2/3] app/test: change rawdev autotest to run selftest on all devs Bruce Richardson
@ 2020-09-10 16:47   ` Bruce Richardson
  2020-09-14 12:31     ` Laatz, Kevin
  2020-10-06  7:28   ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Thomas Monjalon
  3 siblings, 1 reply; 13+ messages in thread
From: Bruce Richardson @ 2020-09-10 16:47 UTC (permalink / raw)
  To: dev
  Cc: Bruce Richardson, Nipun Gupta, Hemant Agrawal, John McNamara,
	Marko Kovacevic

Since the rawdev autotest can now be used to test all rawdevs on the
system, there is no need for a dedicated ioat autotest command.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test/test_rawdev.c                 | 20 --------------------
 doc/guides/rel_notes/release_20_11.rst |  2 ++
 2 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/app/test/test_rawdev.c b/app/test/test_rawdev.c
index 7e2fb2cf27..081fab969b 100644
--- a/app/test/test_rawdev.c
+++ b/app/test/test_rawdev.c
@@ -55,23 +55,3 @@ test_rawdev_selftests(void)
 }
 
 REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftests);
-
-static int
-test_rawdev_selftest_ioat(void)
-{
-	const int count = rte_rawdev_count();
-	int i;
-
-	for (i = 0; i < count; i++) {
-		struct rte_rawdev_info info = { .dev_private = NULL };
-		if (rte_rawdev_info_get(i, &info, 0) == 0 &&
-				strstr(info.driver_name, "ioat") != NULL)
-			return rte_rawdev_selftest(i) == 0 ?
-					TEST_SUCCESS : TEST_FAILED;
-	}
-
-	printf("No IOAT rawdev found, skipping tests\n");
-	return TEST_SKIPPED;
-}
-
-REGISTER_TEST_COMMAND(ioat_rawdev_autotest, test_rawdev_selftest_ioat);
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 2ac7dca9a0..0cec16b61d 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -97,6 +97,8 @@ API Changes
   using the ``rawdev_autotest`` command in the ``dpdk-test`` binary. This
   command now calls the self-test function for each rawdev found on the
   system, and does not require a specific command per device type.
+  Following this change, the ``ioat_rawdev_autotest`` command has been
+  removed as no longer needed.
 
 
 ABI Changes
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/3] app/test: change rawdev autotest to run selftest on all devs
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 2/3] app/test: change rawdev autotest to run selftest on all devs Bruce Richardson
@ 2020-09-14 12:28     ` Laatz, Kevin
  0 siblings, 0 replies; 13+ messages in thread
From: Laatz, Kevin @ 2020-09-14 12:28 UTC (permalink / raw)
  To: Bruce Richardson, dev
  Cc: Nipun Gupta, Hemant Agrawal, John McNamara, Marko Kovacevic

On 10/09/2020 17:47, Bruce Richardson wrote:
> Rather than having each rawdev provide its own autotest command, we can
> instead just use the generic rawdev_autotest to test any and all available
> rawdevs.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>   app/test/test_rawdev.c                 | 34 ++++++++++++++++++++++++--
>   doc/guides/rel_notes/release_20_11.rst |  5 ++++
>   2 files changed, 37 insertions(+), 2 deletions(-)
[...]

Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH v2 3/3] app/test: remove ioat-specific autotest
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 3/3] app/test: remove ioat-specific autotest Bruce Richardson
@ 2020-09-14 12:31     ` Laatz, Kevin
  0 siblings, 0 replies; 13+ messages in thread
From: Laatz, Kevin @ 2020-09-14 12:31 UTC (permalink / raw)
  To: Bruce Richardson, dev
  Cc: Nipun Gupta, Hemant Agrawal, John McNamara, Marko Kovacevic

On 10/09/2020 17:47, Bruce Richardson wrote:
> Since the rawdev autotest can now be used to test all rawdevs on the
> system, there is no need for a dedicated ioat autotest command.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>   app/test/test_rawdev.c                 | 20 --------------------
>   doc/guides/rel_notes/release_20_11.rst |  2 ++
>   2 files changed, 2 insertions(+), 20 deletions(-)
>
[...]

Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/3] raw/ioat: support multiple devices being tested
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 1/3] raw/ioat: support multiple devices being tested Bruce Richardson
@ 2020-09-14 12:34     ` Laatz, Kevin
  0 siblings, 0 replies; 13+ messages in thread
From: Laatz, Kevin @ 2020-09-14 12:34 UTC (permalink / raw)
  To: Bruce Richardson, dev

On 10/09/2020 17:47, Bruce Richardson wrote:
> The current selftest function uses a single global variable to track state
> which implies that only a single instance can have the selftest function
> called on it. Change this to an array to allow multiple instances to be
> tested.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>   drivers/raw/ioat/ioat_rawdev_test.c | 17 +++++++++++++----
>   1 file changed, 13 insertions(+), 4 deletions(-)
>
[...]

Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs
  2020-09-10 16:47 ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Bruce Richardson
                     ` (2 preceding siblings ...)
  2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 3/3] app/test: remove ioat-specific autotest Bruce Richardson
@ 2020-10-06  7:28   ` Thomas Monjalon
  3 siblings, 0 replies; 13+ messages in thread
From: Thomas Monjalon @ 2020-10-06  7:28 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

> At present the "rawdev_autotest" command creates a skeleton rawdev and runs
> a series of tests on the rawdev API and on that rawdev. While the rawdev
> API set includes a "selftest" function, it is not hooked up to this test so
> to test an individual rawdev driver, e.g. ioat, requires that a new test
> command be added.
> 
> This patchset improves the situation by changing the UT to first run the
> existing API tests, but then call selftest on all rawdevs on the system.
> This removes the need for any new test commands for new drivers. If there
> are multiple rawdevs on a system, the sub-set to be tested can be limited
> via existing means such as using the device block/allow EAL parameters or
> similarly via vdev args, etc.
> 
> As part of this change, the ioat rawdev autotest is fixed to allow calling
> on multiple instances inside the one test run, and thereafter the custom
> test command for it is removed as it is no longer necessary.

Applied, thanks



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-10-06  7:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 15:59 [dpdk-dev] [PATCH 0/4] simplify unit-testing of rawdevs Bruce Richardson
2020-08-21 15:59 ` [dpdk-dev] [PATCH 1/4] raw/ioat: support multiple devices being tested Bruce Richardson
2020-08-21 15:59 ` [dpdk-dev] [PATCH 2/4] raw/ioat: include extra info in error messages Bruce Richardson
2020-08-21 15:59 ` [dpdk-dev] [PATCH 3/4] app/test: change rawdev autotest to run selftest on all devs Bruce Richardson
2020-08-21 15:59 ` [dpdk-dev] [PATCH 4/4] app/test: remove ioat-specific autotest Bruce Richardson
2020-09-10 16:47 ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Bruce Richardson
2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 1/3] raw/ioat: support multiple devices being tested Bruce Richardson
2020-09-14 12:34     ` Laatz, Kevin
2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 2/3] app/test: change rawdev autotest to run selftest on all devs Bruce Richardson
2020-09-14 12:28     ` Laatz, Kevin
2020-09-10 16:47   ` [dpdk-dev] [PATCH v2 3/3] app/test: remove ioat-specific autotest Bruce Richardson
2020-09-14 12:31     ` Laatz, Kevin
2020-10-06  7:28   ` [dpdk-dev] [PATCH v2 0/3] simplify unit-testing of rawdevs Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).