Skip to content

Commit

Permalink
test: queue_perf: fix queue destroy step in pair mode
Browse files Browse the repository at this point in the history
In pair mode events may end up unevenly into the queues. Fix queue clean-up
by simply dequeuing events from queues until ODP_EVENT_INVALID is
returned.

Signed-off-by: Matias Elo <[email protected]>
Reviewed-by: Tuomas Taipale <[email protected]>
  • Loading branch information
MatiasElo committed Dec 18, 2024
1 parent 101ec7a commit 15ca184
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/performance/odp_queue_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,24 +397,23 @@ static int create_queues(test_global_t *global)

static int destroy_queues(test_global_t *global)
{
odp_event_t ev;
uint32_t i, j;
uint32_t i;
int ret = 0;
test_options_t *test_options = &global->options;
uint32_t num_queue = test_options->num_queue;
uint32_t num_event = test_options->num_event;
odp_queue_t *queue = global->queue;
odp_pool_t pool = global->pool;

for (i = 0; i < num_queue; i++) {
if (queue[i] == ODP_QUEUE_INVALID)
break;

for (j = 0; j < num_event; j++) {
ev = odp_queue_deq(queue[i]);
while (1) {
odp_event_t ev = odp_queue_deq(queue[i]);

if (ev != ODP_EVENT_INVALID)
odp_event_free(ev);
if (ev == ODP_EVENT_INVALID)
break;
odp_event_free(ev);
}

if (odp_queue_destroy(queue[i])) {
Expand Down

0 comments on commit 15ca184

Please sign in to comment.