Some of the implementations of atomic_store_relaxed() evaluate their
first argument more than once, so arguments with side effects cause
strange behavior.  This fixes a problem observed on 64-bit Windows.

Reported-by: Alin Serdean <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
---
 lib/dpif-netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 071ec141f1d1..0ceef9d82914 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3201,8 +3201,8 @@ static void
 dp_netdev_rxq_set_intrvl_cycles(struct dp_netdev_rxq *rx,
                                 unsigned long long cycles)
 {
-   atomic_store_relaxed(&rx->cycles_intrvl[rx->intrvl_idx++
-                                           % PMD_RXQ_INTERVAL_MAX], cycles);
+    unsigned int idx = rx->intrvl_idx++ % PMD_RXQ_INTERVAL_MAX;
+    atomic_store_relaxed(&rx->cycles_intrvl[idx], cycles);
 }
 
 static uint64_t
-- 
2.10.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to