DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] event/sw: fix selftest enqueue return value checks
@ 2019-03-27 18:45 Harry van Haaren
  2019-03-27 18:45 ` Harry van Haaren
  2019-03-30 15:26 ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
  0 siblings, 2 replies; 4+ messages in thread
From: Harry van Haaren @ 2019-03-27 18:45 UTC (permalink / raw)
  To: dev; +Cc: jerinj, Harry van Haaren

This patch fixes a number of instances of the same return
value mis-check, where previously we checked for a negative
return value as error, however the API returns an unsigned
integer, so these return value checks are invalid.

The rte_event_enqueue_burst() API returns the number of
events enqueued, so in order to identify the error case,
we must check for != the number of intended enqueues.

Fixes: cd1a9e3eab55 ("test/eventdev: add SW tests for load balancing")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

Given this commit only changes the test-suite, and not production
code I don't see value in backporting it to stable releases.

These issues were flagged by the LGTM static analysis tool.

---
 drivers/event/sw/sw_evdev_selftest.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index d00d5de61..38c21fa0f 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -385,7 +385,7 @@ run_prio_packet_test(struct test *t)
 			.mbuf = arp
 		};
 		err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: error failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -477,7 +477,7 @@ test_single_directed_packet(struct test *t)
 
 	/* generate pkt and enqueue */
 	err = rte_event_enqueue_burst(evdev, rx_enq, &ev, 1);
-	if (err < 0) {
+	if (err != 1) {
 		printf("%d: error failed to enqueue\n", __LINE__);
 		return -1;
 	}
@@ -546,7 +546,7 @@ test_directed_forward_credits(struct test *t)
 
 	for (i = 0; i < 1000; i++) {
 		err = rte_event_enqueue_burst(evdev, 0, &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: error failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -707,7 +707,7 @@ burst_packets(struct test *t)
 		};
 		/* generate pkt and enqueue */
 		err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -795,7 +795,7 @@ abuse_inflights(struct test *t)
 
 	/* Enqueue op only */
 	err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &release_ev, 1);
-	if (err < 0) {
+	if (err != 1) {
 		printf("%d: Failed to enqueue\n", __LINE__);
 		return -1;
 	}
@@ -2026,7 +2026,7 @@ load_balancing(struct test *t)
 		};
 		/* generate pkt and enqueue */
 		err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -2125,7 +2125,7 @@ load_balancing_history(struct test *t)
 		}
 		arp->hash.rss = flows1[i];
 		err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -2175,7 +2175,7 @@ load_balancing_history(struct test *t)
 		arp->hash.rss = flows2[i];
 
 		err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -2285,7 +2285,7 @@ invalid_qid(struct test *t)
 		};
 		/* generate pkt and enqueue */
 		err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -2372,7 +2372,7 @@ single_packet(struct test *t)
 	arp->seqn = MAGIC_SEQN;
 
 	err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-	if (err < 0) {
+	if (err != 1) {
 		printf("%d: Failed to enqueue\n", __LINE__);
 		return -1;
 	}
@@ -2416,7 +2416,7 @@ single_packet(struct test *t)
 
 	rte_pktmbuf_free(ev.mbuf);
 	err = rte_event_enqueue_burst(evdev, t->port[wrk_enq], &release_ev, 1);
-	if (err < 0) {
+	if (err != 1) {
 		printf("%d: Failed to enqueue\n", __LINE__);
 		return -1;
 	}
-- 
2.17.1

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

* [dpdk-dev] [PATCH] event/sw: fix selftest enqueue return value checks
  2019-03-27 18:45 [dpdk-dev] [PATCH] event/sw: fix selftest enqueue return value checks Harry van Haaren
@ 2019-03-27 18:45 ` Harry van Haaren
  2019-03-30 15:26 ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
  1 sibling, 0 replies; 4+ messages in thread
From: Harry van Haaren @ 2019-03-27 18:45 UTC (permalink / raw)
  To: dev; +Cc: jerinj, Harry van Haaren

This patch fixes a number of instances of the same return
value mis-check, where previously we checked for a negative
return value as error, however the API returns an unsigned
integer, so these return value checks are invalid.

The rte_event_enqueue_burst() API returns the number of
events enqueued, so in order to identify the error case,
we must check for != the number of intended enqueues.

Fixes: cd1a9e3eab55 ("test/eventdev: add SW tests for load balancing")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

---

Given this commit only changes the test-suite, and not production
code I don't see value in backporting it to stable releases.

These issues were flagged by the LGTM static analysis tool.

---
 drivers/event/sw/sw_evdev_selftest.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index d00d5de61..38c21fa0f 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -385,7 +385,7 @@ run_prio_packet_test(struct test *t)
 			.mbuf = arp
 		};
 		err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: error failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -477,7 +477,7 @@ test_single_directed_packet(struct test *t)
 
 	/* generate pkt and enqueue */
 	err = rte_event_enqueue_burst(evdev, rx_enq, &ev, 1);
-	if (err < 0) {
+	if (err != 1) {
 		printf("%d: error failed to enqueue\n", __LINE__);
 		return -1;
 	}
@@ -546,7 +546,7 @@ test_directed_forward_credits(struct test *t)
 
 	for (i = 0; i < 1000; i++) {
 		err = rte_event_enqueue_burst(evdev, 0, &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: error failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -707,7 +707,7 @@ burst_packets(struct test *t)
 		};
 		/* generate pkt and enqueue */
 		err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -795,7 +795,7 @@ abuse_inflights(struct test *t)
 
 	/* Enqueue op only */
 	err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &release_ev, 1);
-	if (err < 0) {
+	if (err != 1) {
 		printf("%d: Failed to enqueue\n", __LINE__);
 		return -1;
 	}
@@ -2026,7 +2026,7 @@ load_balancing(struct test *t)
 		};
 		/* generate pkt and enqueue */
 		err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -2125,7 +2125,7 @@ load_balancing_history(struct test *t)
 		}
 		arp->hash.rss = flows1[i];
 		err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -2175,7 +2175,7 @@ load_balancing_history(struct test *t)
 		arp->hash.rss = flows2[i];
 
 		err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -2285,7 +2285,7 @@ invalid_qid(struct test *t)
 		};
 		/* generate pkt and enqueue */
 		err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-		if (err < 0) {
+		if (err != 1) {
 			printf("%d: Failed to enqueue\n", __LINE__);
 			return -1;
 		}
@@ -2372,7 +2372,7 @@ single_packet(struct test *t)
 	arp->seqn = MAGIC_SEQN;
 
 	err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1);
-	if (err < 0) {
+	if (err != 1) {
 		printf("%d: Failed to enqueue\n", __LINE__);
 		return -1;
 	}
@@ -2416,7 +2416,7 @@ single_packet(struct test *t)
 
 	rte_pktmbuf_free(ev.mbuf);
 	err = rte_event_enqueue_burst(evdev, t->port[wrk_enq], &release_ev, 1);
-	if (err < 0) {
+	if (err != 1) {
 		printf("%d: Failed to enqueue\n", __LINE__);
 		return -1;
 	}
-- 
2.17.1


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

* Re: [dpdk-dev] [EXT] [PATCH] event/sw: fix selftest enqueue return value checks
  2019-03-27 18:45 [dpdk-dev] [PATCH] event/sw: fix selftest enqueue return value checks Harry van Haaren
  2019-03-27 18:45 ` Harry van Haaren
@ 2019-03-30 15:26 ` Jerin Jacob Kollanukkaran
  2019-03-30 15:26   ` Jerin Jacob Kollanukkaran
  1 sibling, 1 reply; 4+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-30 15:26 UTC (permalink / raw)
  To: harry.van.haaren, dev; +Cc: stable

On Wed, 2019-03-27 at 18:45 +0000, Harry van Haaren wrote:
> -------------------------------------------------------------------
> ---
> This patch fixes a number of instances of the same return
> value mis-check, where previously we checked for a negative
> return value as error, however the API returns an unsigned
> integer, so these return value checks are invalid.
> 
> The rte_event_enqueue_burst() API returns the number of
> events enqueued, so in order to identify the error case,
> we must check for != the number of intended enqueues.
> 
> Fixes: cd1a9e3eab55 ("test/eventdev: add SW tests for load
> balancing")

Cc: stable@dpdk.org


> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

Applied to dpdk-next-eventdev/master. Thanks.

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

* Re: [dpdk-dev] [EXT] [PATCH] event/sw: fix selftest enqueue return value checks
  2019-03-30 15:26 ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
@ 2019-03-30 15:26   ` Jerin Jacob Kollanukkaran
  0 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob Kollanukkaran @ 2019-03-30 15:26 UTC (permalink / raw)
  To: harry.van.haaren, dev; +Cc: stable

On Wed, 2019-03-27 at 18:45 +0000, Harry van Haaren wrote:
> -------------------------------------------------------------------
> ---
> This patch fixes a number of instances of the same return
> value mis-check, where previously we checked for a negative
> return value as error, however the API returns an unsigned
> integer, so these return value checks are invalid.
> 
> The rte_event_enqueue_burst() API returns the number of
> events enqueued, so in order to identify the error case,
> we must check for != the number of intended enqueues.
> 
> Fixes: cd1a9e3eab55 ("test/eventdev: add SW tests for load
> balancing")

Cc: stable@dpdk.org


> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>

Applied to dpdk-next-eventdev/master. Thanks.

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

end of thread, other threads:[~2019-03-30 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 18:45 [dpdk-dev] [PATCH] event/sw: fix selftest enqueue return value checks Harry van Haaren
2019-03-27 18:45 ` Harry van Haaren
2019-03-30 15:26 ` [dpdk-dev] [EXT] " Jerin Jacob Kollanukkaran
2019-03-30 15:26   ` Jerin Jacob Kollanukkaran

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).