aboutsummaryrefslogtreecommitdiff
path: root/test/performance
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@linaro.org>2015-07-01 18:06:18 +0100
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-07-16 16:34:17 +0300
commit63754dbfa2e6263cfc3f5005a7bfec8dfca20dbf (patch)
treeb69b0a27ffb6966a461269096002195b9ef342f1 /test/performance
parent2e62eaca812e4d0194a2ca804a492ba03098cc67 (diff)
queue: handle return value of odp_queue_enq()
Unsent packet has to be released. If the event type is obvious from the context, use directly the relevant release functions, otherwise odp_event(free). Wider error handling is attempted, but this patch can't fix all the flaws in the many calling functions of odp_queue_enq() Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'test/performance')
-rw-r--r--test/performance/odp_l2fwd.c6
-rw-r--r--test/performance/odp_pktio_perf.c10
-rw-r--r--test/performance/odp_scheduling.c7
3 files changed, 20 insertions, 3 deletions
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index dd0b4b1..9cc201f 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -152,7 +152,11 @@ static void *pktio_queue_thread(void *arg)
outq_def = lookup_dest_q(pkt);
/* Enqueue the packet for output */
- odp_queue_enq(outq_def, ev);
+ if (odp_queue_enq(outq_def, ev)) {
+ printf(" [%i] Queue enqueue failed.\n", thr);
+ odp_packet_free(pkt);
+ continue;
+ }
stats->packets += 1;
}
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index c2e95fb..fe575ff 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -275,8 +275,14 @@ static int send_packets(odp_queue_t outq,
if (num_pkts == 0)
return 0;
- else if (num_pkts == 1)
- return odp_queue_enq(outq, event_tbl[0]) == 0 ? 1 : 0;
+ else if (num_pkts == 1) {
+ if (odp_queue_enq(outq, event_tbl[0])) {
+ odp_event_free(event_tbl[0]);
+ return 0;
+ } else {
+ return 1;
+ }
+ }
ret = odp_queue_enq_multi(outq, event_tbl, num_pkts);
i = ret < 0 ? 0 : ret;
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index a9ebfaa..42b21cf 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -116,6 +116,7 @@ static int create_queue(int thr, odp_pool_t msg_pool, int prio)
if (odp_queue_enq(queue, odp_buffer_to_event(buf))) {
LOG_ERR(" [%i] Queue enqueue failed.\n", thr);
+ odp_buffer_free(buf);
return -1;
}
@@ -163,6 +164,7 @@ static int create_queues(int thr, odp_pool_t msg_pool, int prio)
if (odp_queue_enq(queue, odp_buffer_to_event(buf))) {
LOG_ERR(" [%i] Queue enqueue failed.\n", thr);
+ odp_buffer_free(buf);
return -1;
}
}
@@ -296,6 +298,7 @@ static int test_poll_queue(int thr, odp_pool_t msg_pool)
if (odp_queue_enq(queue, ev)) {
LOG_ERR(" [%i] Queue enqueue failed.\n", thr);
+ odp_buffer_free(buf);
return -1;
}
@@ -354,6 +357,7 @@ static int test_schedule_single(const char *str, int thr,
if (odp_queue_enq(queue, ev)) {
LOG_ERR(" [%i] Queue enqueue failed.\n", thr);
+ odp_event_free(ev);
return -1;
}
}
@@ -373,6 +377,7 @@ static int test_schedule_single(const char *str, int thr,
if (odp_queue_enq(queue, ev)) {
LOG_ERR(" [%i] Queue enqueue failed.\n", thr);
+ odp_event_free(ev);
return -1;
}
}
@@ -433,6 +438,7 @@ static int test_schedule_many(const char *str, int thr,
if (odp_queue_enq(queue, ev)) {
LOG_ERR(" [%i] Queue enqueue failed.\n", thr);
+ odp_event_free(ev);
return -1;
}
}
@@ -452,6 +458,7 @@ static int test_schedule_many(const char *str, int thr,
if (odp_queue_enq(queue, ev)) {
LOG_ERR(" [%i] Queue enqueue failed.\n", thr);
+ odp_event_free(ev);
return -1;
}
}