net/ena: fix build with GCC 12
[dpdk.git] / app / test-eventdev / test_pipeline_atq.c
index 7921850..4b10197 100644 (file)
@@ -21,18 +21,20 @@ static __rte_noinline int
 pipeline_atq_worker_single_stage_tx(void *arg)
 {
        PIPELINE_WORKER_SINGLE_STAGE_INIT;
+       uint8_t enq = 0, deq = 0;
 
        while (t->done == false) {
-               uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
+               deq = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
 
-               if (!event) {
+               if (!deq) {
                        rte_pause();
                        continue;
                }
 
-               pipeline_event_tx(dev, port, &ev);
+               deq = pipeline_event_tx(dev, port, &ev, t);
                w->processed_pkts++;
        }
+       pipeline_worker_cleanup(dev, port, &ev, enq, deq);
 
        return 0;
 }
@@ -42,20 +44,22 @@ pipeline_atq_worker_single_stage_fwd(void *arg)
 {
        PIPELINE_WORKER_SINGLE_STAGE_INIT;
        const uint8_t *tx_queue = t->tx_evqueue_id;
+       uint8_t enq = 0, deq = 0;
 
        while (t->done == false) {
-               uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
+               deq = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
 
-               if (!event) {
+               if (!deq) {
                        rte_pause();
                        continue;
                }
 
                ev.queue_id = tx_queue[ev.mbuf->port];
                pipeline_fwd_event(&ev, RTE_SCHED_TYPE_ATOMIC);
-               pipeline_event_enqueue(dev, port, &ev);
+               enq = pipeline_event_enqueue(dev, port, &ev, t);
                w->processed_pkts++;
        }
+       pipeline_worker_cleanup(dev, port, &ev, enq, deq);
 
        return 0;
 }
@@ -64,10 +68,10 @@ static __rte_noinline int
 pipeline_atq_worker_single_stage_burst_tx(void *arg)
 {
        PIPELINE_WORKER_SINGLE_STAGE_BURST_INIT;
+       uint16_t nb_rx = 0, nb_tx = 0;
 
        while (t->done == false) {
-               uint16_t nb_rx = rte_event_dequeue_burst(dev, port, ev,
-                               BURST_SIZE, 0);
+               nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
 
                if (!nb_rx) {
                        rte_pause();
@@ -79,9 +83,10 @@ pipeline_atq_worker_single_stage_burst_tx(void *arg)
                        rte_event_eth_tx_adapter_txq_set(ev[i].mbuf, 0);
                }
 
-               pipeline_event_tx_burst(dev, port, ev, nb_rx);
-               w->processed_pkts += nb_rx;
+               nb_tx = pipeline_event_tx_burst(dev, port, ev, nb_rx, t);
+               w->processed_pkts += nb_tx;
        }
+       pipeline_worker_cleanup(dev, port, ev, nb_tx, nb_rx);
 
        return 0;
 }
@@ -91,10 +96,10 @@ pipeline_atq_worker_single_stage_burst_fwd(void *arg)
 {
        PIPELINE_WORKER_SINGLE_STAGE_BURST_INIT;
        const uint8_t *tx_queue = t->tx_evqueue_id;
+       uint16_t nb_rx = 0, nb_tx = 0;
 
        while (t->done == false) {
-               uint16_t nb_rx = rte_event_dequeue_burst(dev, port, ev,
-                               BURST_SIZE, 0);
+               nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
 
                if (!nb_rx) {
                        rte_pause();
@@ -108,9 +113,10 @@ pipeline_atq_worker_single_stage_burst_fwd(void *arg)
                        pipeline_fwd_event(&ev[i], RTE_SCHED_TYPE_ATOMIC);
                }
 
-               pipeline_event_enqueue_burst(dev, port, ev, nb_rx);
-               w->processed_pkts += nb_rx;
+               nb_tx = pipeline_event_enqueue_burst(dev, port, ev, nb_rx, t);
+               w->processed_pkts += nb_tx;
        }
+       pipeline_worker_cleanup(dev, port, ev, nb_tx, nb_rx);
 
        return 0;
 }
@@ -119,19 +125,21 @@ static __rte_noinline int
 pipeline_atq_worker_single_stage_tx_vector(void *arg)
 {
        PIPELINE_WORKER_SINGLE_STAGE_INIT;
+       uint8_t enq = 0, deq = 0;
        uint16_t vector_sz;
 
        while (!t->done) {
-               uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
+               deq = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
 
-               if (!event) {
+               if (!deq) {
                        rte_pause();
                        continue;
                }
                vector_sz = ev.vec->nb_elem;
-               pipeline_event_tx_vector(dev, port, &ev);
+               enq = pipeline_event_tx_vector(dev, port, &ev, t);
                w->processed_pkts += vector_sz;
        }
+       pipeline_worker_cleanup(dev, port, &ev, enq, deq);
 
        return 0;
 }
@@ -141,12 +149,13 @@ pipeline_atq_worker_single_stage_fwd_vector(void *arg)
 {
        PIPELINE_WORKER_SINGLE_STAGE_INIT;
        const uint8_t *tx_queue = t->tx_evqueue_id;
+       uint8_t enq = 0, deq = 0;
        uint16_t vector_sz;
 
        while (!t->done) {
-               uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
+               deq = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
 
-               if (!event) {
+               if (!deq) {
                        rte_pause();
                        continue;
                }
@@ -155,9 +164,10 @@ pipeline_atq_worker_single_stage_fwd_vector(void *arg)
                ev.queue_id = tx_queue[ev.vec->port];
                ev.vec->queue = 0;
                pipeline_fwd_event_vector(&ev, RTE_SCHED_TYPE_ATOMIC);
-               pipeline_event_enqueue(dev, port, &ev);
+               enq = pipeline_event_enqueue(dev, port, &ev, t);
                w->processed_pkts += vector_sz;
        }
+       pipeline_worker_cleanup(dev, port, &ev, enq, deq);
 
        return 0;
 }
@@ -166,11 +176,11 @@ static __rte_noinline int
 pipeline_atq_worker_single_stage_burst_tx_vector(void *arg)
 {
        PIPELINE_WORKER_SINGLE_STAGE_BURST_INIT;
+       uint16_t nb_rx = 0, nb_tx = 0;
        uint16_t vector_sz;
 
        while (!t->done) {
-               uint16_t nb_rx =
-                       rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
+               nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
 
                if (!nb_rx) {
                        rte_pause();
@@ -182,9 +192,10 @@ pipeline_atq_worker_single_stage_burst_tx_vector(void *arg)
                        ev[i].vec->queue = 0;
                }
 
-               pipeline_event_tx_burst(dev, port, ev, nb_rx);
+               nb_tx = pipeline_event_tx_burst(dev, port, ev, nb_rx, t);
                w->processed_pkts += vector_sz;
        }
+       pipeline_worker_cleanup(dev, port, ev, nb_tx, nb_rx);
 
        return 0;
 }
@@ -194,11 +205,11 @@ pipeline_atq_worker_single_stage_burst_fwd_vector(void *arg)
 {
        PIPELINE_WORKER_SINGLE_STAGE_BURST_INIT;
        const uint8_t *tx_queue = t->tx_evqueue_id;
+       uint16_t nb_rx = 0, nb_tx = 0;
        uint16_t vector_sz;
 
        while (!t->done) {
-               uint16_t nb_rx =
-                       rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
+               nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
 
                if (!nb_rx) {
                        rte_pause();
@@ -214,9 +225,10 @@ pipeline_atq_worker_single_stage_burst_fwd_vector(void *arg)
                                                  RTE_SCHED_TYPE_ATOMIC);
                }
 
-               pipeline_event_enqueue_burst(dev, port, ev, nb_rx);
+               nb_tx = pipeline_event_enqueue_burst(dev, port, ev, nb_rx, t);
                w->processed_pkts += vector_sz;
        }
+       pipeline_worker_cleanup(dev, port, ev, nb_tx, nb_rx);
 
        return 0;
 }
@@ -225,11 +237,12 @@ static __rte_noinline int
 pipeline_atq_worker_multi_stage_tx(void *arg)
 {
        PIPELINE_WORKER_MULTI_STAGE_INIT;
+       uint8_t enq = 0, deq = 0;
 
        while (t->done == false) {
-               uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
+               deq = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
 
-               if (!event) {
+               if (!deq) {
                        rte_pause();
                        continue;
                }
@@ -237,15 +250,16 @@ pipeline_atq_worker_multi_stage_tx(void *arg)
                cq_id = ev.sub_event_type % nb_stages;
 
                if (cq_id == last_queue) {
-                       pipeline_event_tx(dev, port, &ev);
+                       enq = pipeline_event_tx(dev, port, &ev, t);
                        w->processed_pkts++;
                        continue;
                }
 
                ev.sub_event_type++;
                pipeline_fwd_event(&ev, sched_type_list[cq_id]);
-               pipeline_event_enqueue(dev, port, &ev);
+               enq = pipeline_event_enqueue(dev, port, &ev, t);
        }
+       pipeline_worker_cleanup(dev, port, &ev, enq, deq);
 
        return 0;
 }
@@ -255,11 +269,12 @@ pipeline_atq_worker_multi_stage_fwd(void *arg)
 {
        PIPELINE_WORKER_MULTI_STAGE_INIT;
        const uint8_t *tx_queue = t->tx_evqueue_id;
+       uint8_t enq = 0, deq = 0;
 
        while (t->done == false) {
-               uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
+               deq = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
 
-               if (!event) {
+               if (!deq) {
                        rte_pause();
                        continue;
                }
@@ -275,8 +290,9 @@ pipeline_atq_worker_multi_stage_fwd(void *arg)
                        pipeline_fwd_event(&ev, sched_type_list[cq_id]);
                }
 
-               pipeline_event_enqueue(dev, port, &ev);
+               enq = pipeline_event_enqueue(dev, port, &ev, t);
        }
+       pipeline_worker_cleanup(dev, port, &ev, enq, deq);
 
        return 0;
 }
@@ -285,10 +301,10 @@ static __rte_noinline int
 pipeline_atq_worker_multi_stage_burst_tx(void *arg)
 {
        PIPELINE_WORKER_MULTI_STAGE_BURST_INIT;
+       uint16_t nb_rx = 0, nb_tx = 0;
 
        while (t->done == false) {
-               uint16_t nb_rx = rte_event_dequeue_burst(dev, port, ev,
-                               BURST_SIZE, 0);
+               nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
 
                if (!nb_rx) {
                        rte_pause();
@@ -300,7 +316,7 @@ pipeline_atq_worker_multi_stage_burst_tx(void *arg)
                        cq_id = ev[i].sub_event_type % nb_stages;
 
                        if (cq_id == last_queue) {
-                               pipeline_event_tx(dev, port, &ev[i]);
+                               pipeline_event_tx(dev, port, &ev[i], t);
                                ev[i].op = RTE_EVENT_OP_RELEASE;
                                w->processed_pkts++;
                                continue;
@@ -310,8 +326,9 @@ pipeline_atq_worker_multi_stage_burst_tx(void *arg)
                        pipeline_fwd_event(&ev[i], sched_type_list[cq_id]);
                }
 
-               pipeline_event_enqueue_burst(dev, port, ev, nb_rx);
+               nb_tx = pipeline_event_enqueue_burst(dev, port, ev, nb_rx, t);
        }
+       pipeline_worker_cleanup(dev, port, ev, nb_tx, nb_rx);
 
        return 0;
 }
@@ -321,10 +338,10 @@ pipeline_atq_worker_multi_stage_burst_fwd(void *arg)
 {
        PIPELINE_WORKER_MULTI_STAGE_BURST_INIT;
        const uint8_t *tx_queue = t->tx_evqueue_id;
+       uint16_t nb_rx = 0, nb_tx = 0;
 
        while (t->done == false) {
-               uint16_t nb_rx = rte_event_dequeue_burst(dev, port, ev,
-                               BURST_SIZE, 0);
+               nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
 
                if (!nb_rx) {
                        rte_pause();
@@ -347,8 +364,9 @@ pipeline_atq_worker_multi_stage_burst_fwd(void *arg)
                        }
                }
 
-               pipeline_event_enqueue_burst(dev, port, ev, nb_rx);
+               nb_tx = pipeline_event_enqueue_burst(dev, port, ev, nb_rx, t);
        }
+       pipeline_worker_cleanup(dev, port, ev, nb_tx, nb_rx);
 
        return 0;
 }
@@ -357,12 +375,13 @@ static __rte_noinline int
 pipeline_atq_worker_multi_stage_tx_vector(void *arg)
 {
        PIPELINE_WORKER_MULTI_STAGE_INIT;
+       uint8_t enq = 0, deq = 0;
        uint16_t vector_sz;
 
        while (!t->done) {
-               uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
+               deq = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
 
-               if (!event) {
+               if (!deq) {
                        rte_pause();
                        continue;
                }
@@ -371,15 +390,16 @@ pipeline_atq_worker_multi_stage_tx_vector(void *arg)
 
                if (cq_id == last_queue) {
                        vector_sz = ev.vec->nb_elem;
-                       pipeline_event_tx_vector(dev, port, &ev);
+                       enq = pipeline_event_tx_vector(dev, port, &ev, t);
                        w->processed_pkts += vector_sz;
                        continue;
                }
 
                ev.sub_event_type++;
                pipeline_fwd_event_vector(&ev, sched_type_list[cq_id]);
-               pipeline_event_enqueue(dev, port, &ev);
+               enq = pipeline_event_enqueue(dev, port, &ev, t);
        }
+       pipeline_worker_cleanup(dev, port, &ev, enq, deq);
 
        return 0;
 }
@@ -389,12 +409,13 @@ pipeline_atq_worker_multi_stage_fwd_vector(void *arg)
 {
        PIPELINE_WORKER_MULTI_STAGE_INIT;
        const uint8_t *tx_queue = t->tx_evqueue_id;
+       uint8_t enq = 0, deq = 0;
        uint16_t vector_sz;
 
        while (!t->done) {
-               uint16_t event = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
+               deq = rte_event_dequeue_burst(dev, port, &ev, 1, 0);
 
-               if (!event) {
+               if (!deq) {
                        rte_pause();
                        continue;
                }
@@ -406,14 +427,15 @@ pipeline_atq_worker_multi_stage_fwd_vector(void *arg)
                        ev.vec->queue = 0;
                        vector_sz = ev.vec->nb_elem;
                        pipeline_fwd_event_vector(&ev, RTE_SCHED_TYPE_ATOMIC);
-                       pipeline_event_enqueue(dev, port, &ev);
+                       enq = pipeline_event_enqueue(dev, port, &ev, t);
                        w->processed_pkts += vector_sz;
                } else {
                        ev.sub_event_type++;
                        pipeline_fwd_event_vector(&ev, sched_type_list[cq_id]);
-                       pipeline_event_enqueue(dev, port, &ev);
+                       enq = pipeline_event_enqueue(dev, port, &ev, t);
                }
        }
+       pipeline_worker_cleanup(dev, port, &ev, enq, deq);
 
        return 0;
 }
@@ -422,11 +444,11 @@ static __rte_noinline int
 pipeline_atq_worker_multi_stage_burst_tx_vector(void *arg)
 {
        PIPELINE_WORKER_MULTI_STAGE_BURST_INIT;
+       uint16_t nb_rx = 0, nb_tx = 0;
        uint16_t vector_sz;
 
        while (!t->done) {
-               uint16_t nb_rx =
-                       rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
+               nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
 
                if (!nb_rx) {
                        rte_pause();
@@ -438,7 +460,7 @@ pipeline_atq_worker_multi_stage_burst_tx_vector(void *arg)
 
                        if (cq_id == last_queue) {
                                vector_sz = ev[i].vec->nb_elem;
-                               pipeline_event_tx_vector(dev, port, &ev[i]);
+                               pipeline_event_tx_vector(dev, port, &ev[i], t);
                                ev[i].op = RTE_EVENT_OP_RELEASE;
                                w->processed_pkts += vector_sz;
                                continue;
@@ -449,8 +471,9 @@ pipeline_atq_worker_multi_stage_burst_tx_vector(void *arg)
                                                  sched_type_list[cq_id]);
                }
 
-               pipeline_event_enqueue_burst(dev, port, ev, nb_rx);
+               nb_tx = pipeline_event_enqueue_burst(dev, port, ev, nb_rx, t);
        }
+       pipeline_worker_cleanup(dev, port, ev, nb_tx, nb_rx);
 
        return 0;
 }
@@ -460,11 +483,11 @@ pipeline_atq_worker_multi_stage_burst_fwd_vector(void *arg)
 {
        PIPELINE_WORKER_MULTI_STAGE_BURST_INIT;
        const uint8_t *tx_queue = t->tx_evqueue_id;
+       uint16_t nb_rx = 0, nb_tx = 0;
        uint16_t vector_sz;
 
        while (!t->done) {
-               uint16_t nb_rx =
-                       rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
+               nb_rx = rte_event_dequeue_burst(dev, port, ev, BURST_SIZE, 0);
 
                if (!nb_rx) {
                        rte_pause();
@@ -488,8 +511,9 @@ pipeline_atq_worker_multi_stage_burst_fwd_vector(void *arg)
                        }
                }
 
-               pipeline_event_enqueue_burst(dev, port, ev, nb_rx);
+               nb_tx = pipeline_event_enqueue_burst(dev, port, ev, nb_rx, t);
        }
+       pipeline_worker_cleanup(dev, port, ev, nb_tx, nb_rx);
 
        return 0;
 }