From: Harry van Haaren Date: Wed, 27 Mar 2019 18:45:46 +0000 (+0000) Subject: event/sw: fix enqueue checks in self-test X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1b03e2929114d4ebfc7a2159d0d45f0a3e9a7ba6;p=dpdk.git event/sw: fix enqueue checks in self-test 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 --- diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c index d00d5de613..38c21fa0fa 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; }