[2/2] raw/ioat: fix initial ring size check

Message ID 20191010123603.58007-3-ciara.power@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series enable ioat test to run multiple times |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Power, Ciara Oct. 10, 2019, 12:36 p.m. UTC
  When running the ioat_rawdev_autotest, the ring size was initially required
to be 0. This prevented the test being run multiple times, as the ring size
is modified to a non-zero value when running the first test.

A global variable is now used to track the expected ring size, and is used
in the initial value check.  This enables the test to be run more than
once.

Fixes: 849470d522ed ("raw/ioat: add configure, start and stop functions")
Cc: bruce.richardson@intel.com

Reported-by: Yinan Wang <yinan.wang@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 drivers/raw/ioat/ioat_rawdev_test.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

Bruce Richardson Oct. 10, 2019, 12:40 p.m. UTC | #1
On Thu, Oct 10, 2019 at 01:36:03PM +0100, Ciara Power wrote:
> When running the ioat_rawdev_autotest, the ring size was initially required
> to be 0. This prevented the test being run multiple times, as the ring size
> is modified to a non-zero value when running the first test.
> 
> A global variable is now used to track the expected ring size, and is used
> in the initial value check.  This enables the test to be run more than
> once.
> 
> Fixes: 849470d522ed ("raw/ioat: add configure, start and stop functions")
> Cc: bruce.richardson@intel.com
> 
> Reported-by: Yinan Wang <yinan.wang@intel.com>
> Signed-off-by: Ciara Power <ciara.power@intel.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/drivers/raw/ioat/ioat_rawdev_test.c b/drivers/raw/ioat/ioat_rawdev_test.c
index 6aad79486..e99f97ec4 100644
--- a/drivers/raw/ioat/ioat_rawdev_test.c
+++ b/drivers/raw/ioat/ioat_rawdev_test.c
@@ -11,6 +11,7 @@ 
 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 int
 test_enqueue_copies(int dev_id)
@@ -148,9 +149,9 @@  ioat_rawdev_test(uint16_t dev_id)
 	unsigned int i;
 
 	rte_rawdev_info_get(dev_id, &info);
-	if (p.ring_size != 0) {
-		printf("Error, initial ring size is non-zero (%d)\n",
-				(int)p.ring_size);
+	if (p.ring_size != expected_ring_size) {
+		printf("Error, initial ring size is not as expected (Actual: %d, Expected: %d)\n",
+				(int)p.ring_size, expected_ring_size);
 		return -1;
 	}
 
@@ -165,6 +166,7 @@  ioat_rawdev_test(uint16_t dev_id)
 				IOAT_TEST_RINGSIZE, (int)p.ring_size);
 		return -1;
 	}
+	expected_ring_size = p.ring_size;
 
 	if (rte_rawdev_start(dev_id) != 0) {
 		printf("Error with rte_rawdev_start()\n");