From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: jerinj@marvell.com, Harry van Haaren <harry.van.haaren@intel.com>
Subject: [dpdk-dev] [PATCH] event/sw: fix selftest enqueue return value checks
Date: Wed, 27 Mar 2019 18:45:46 +0000 [thread overview]
Message-ID: <20190327184546.89483-1-harry.van.haaren@intel.com> (raw)
Message-ID: <20190327184546.NBhvMBvhbHclGtSXIGSZkhKuD6t6drelytzRelEMAsU@z> (raw)
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
next reply other threads:[~2019-03-27 18:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-27 18:45 Harry van Haaren [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190327184546.89483-1-harry.van.haaren@intel.com \
--to=harry.van.haaren@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).