From: Petri Savolainen <petri.savolai...@linaro.org>

Extend direct packet input processing to parallel queues. Parallel
queues do not quarantee ordering, so also those can pass packets
directly to application and (potentially) stash some per thread.

Signed-off-by: Petri Savolainen <petri.savolai...@linaro.org>
---
/** Email created from pull request 504 (psavol:master-sched-optim-2)
 ** https://github.com/Linaro/odp/pull/504
 ** Patch: https://github.com/Linaro/odp/pull/504.patch
 ** Base sha: e1c0e4570a45d05dd9f2e8e052ce71164209d112
 ** Merge commit sha: 964132736e0785222be184065d6ac73121cd46ac
 **/
 platform/linux-generic/odp_schedule_basic.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/platform/linux-generic/odp_schedule_basic.c 
b/platform/linux-generic/odp_schedule_basic.c
index 3ea261fae..d662bd6a4 100644
--- a/platform/linux-generic/odp_schedule_basic.c
+++ b/platform/linux-generic/odp_schedule_basic.c
@@ -846,19 +846,19 @@ static inline int do_schedule_grp(odp_queue_t *out_queue, 
odp_event_t out_ev[],
                                 * priorities. Stop scheduling queue when pktio
                                 * has been stopped. */
                                if (pktin) {
-                                       int atomic = queue_is_atomic(qi);
-                                       int num_pkt = poll_pktin(qi, atomic);
+                                       int stash = !ordered;
+                                       int num_pkt = poll_pktin(qi, stash);
 
                                        if (odp_unlikely(num_pkt < 0))
                                                continue;
 
-                                       if (num_pkt == 0 || !atomic) {
+                                       if (num_pkt == 0 || !stash) {
                                                ring_enq(ring, RING_MASK, qi);
                                                break;
                                        }
 
-                                       /* Process packets from an atomic queue
-                                        * right away */
+                                       /* Process packets from an atomic or
+                                        * parallel queue right away. */
                                        num = num_pkt;
                                } else {
                                        /* Remove empty queue from scheduling.
@@ -868,12 +868,6 @@ static inline int do_schedule_grp(odp_queue_t *out_queue, 
odp_event_t out_ev[],
                                }
                        }
 
-                       handle            = queue_from_index(qi);
-                       sched_local.num   = num;
-                       sched_local.index = 0;
-                       sched_local.queue = handle;
-                       ret = copy_events(out_ev, max_num);
-
                        if (ordered) {
                                uint64_t ctx;
                                odp_atomic_u64_t *next_ctx;
@@ -895,6 +889,12 @@ static inline int do_schedule_grp(odp_queue_t *out_queue, 
odp_event_t out_ev[],
                                ring_enq(ring, RING_MASK, qi);
                        }
 
+                       handle            = queue_from_index(qi);
+                       sched_local.num   = num;
+                       sched_local.index = 0;
+                       sched_local.queue = handle;
+                       ret = copy_events(out_ev, max_num);
+
                        /* Output the source queue handle */
                        if (out_queue)
                                *out_queue = handle;

Reply via email to