aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_ring/rte_ring.h
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2017-11-13 10:38:53 +0000
committerLuca Boccassi <luca.boccassi@gmail.com>2017-11-13 10:38:59 +0000
commitc1795dec1e864d948eb5d6babac7b4417cb8b3be (patch)
treeb200074d32cb7551f54a93ba5b5b2c10b0c77b96 /lib/librte_ring/rte_ring.h
parentacf94b73356456e99aee3509f5c2e2a84aa2e10a (diff)
parent976be7358289d46cd5ed8131bbf2e2c5a6838d3c (diff)
Merge branch 'upstream' into 17.11.x
Change-Id: I68ef2636536dc97016038c50669a96e95424db0e Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'lib/librte_ring/rte_ring.h')
-rw-r--r--lib/librte_ring/rte_ring.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index 5e9b3b7b..e9244381 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -409,6 +409,12 @@ __rte_ring_move_prod_head(struct rte_ring *r, int is_sp,
n = max;
*old_head = r->prod.head;
+
+ /* add rmb barrier to avoid load/load reorder in weak
+ * memory model. It is noop on x86
+ */
+ rte_smp_rmb();
+
const uint32_t cons_tail = r->cons.tail;
/*
* The subtraction is done between two unsigned 32bits value
@@ -517,6 +523,12 @@ __rte_ring_move_cons_head(struct rte_ring *r, int is_sc,
n = max;
*old_head = r->cons.head;
+
+ /* add rmb barrier to avoid load/load reorder in weak
+ * memory model. It is noop on x86
+ */
+ rte_smp_rmb();
+
const uint32_t prod_tail = r->prod.tail;
/* The subtraction is done between two unsigned 32bits value
* (the result is always modulo 32 bits even if we have