Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org> --- platform/linux-generic/include/odp_queue_internal.h | 2 +- platform/linux-generic/odp_queue.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index 9cca552..0f7e3ba 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -78,7 +78,7 @@ struct queue_entry_s { odp_pktio_t pktout; char name[ODP_QUEUE_NAME_LEN]; uint64_t order_in; - uint64_t order_out; + volatile uint64_t order_out; /* May be observed unlocked */ odp_buffer_hdr_t *reorder_head; odp_buffer_hdr_t *reorder_tail; }; diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index e92ef57..cfae99b 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -22,6 +22,7 @@ #include <odp_debug_internal.h> #include <odp/hints.h> #include <odp/sync.h> +#include <odp_spin_internal.h> #ifdef USE_TICKETLOCK #include <odp/ticketlock.h> @@ -922,3 +923,19 @@ int odp_schedule_order_copy(odp_event_t src_event, odp_event_t dst_event) UNLOCK(&origin_qe->s.lock); return 0; } + +int odp_schedule_order_sync(odp_event_t ev) +{ + odp_buffer_hdr_t *buf_hdr = odp_buf_to_hdr(odp_buffer_from_event(ev)); + queue_entry_t *origin_qe = buf_hdr->origin_qe; + + /* Can't lock if we didn't originate from an ordered queue */ + if (!origin_qe) + return -1; + + /* Wait until we are in order */ + while (buf_hdr->order > origin_qe->s.order_out) + odp_spin(); + + return 0; +} -- 2.1.4 _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp