static struct rte_rcu_qsbr *t[RTE_MAX_LCORE];
static struct rte_hash *h;
static char hash_name[8];
-static rte_atomic64_t updates, checks;
-static rte_atomic64_t update_cycles, check_cycles;
+static uint64_t updates, checks;
+static uint64_t update_cycles, check_cycles;
/* Scale down results to 1000 operations to support lower
* granularity clocks.
}
cycles = rte_rdtsc_precise() - begin;
- rte_atomic64_add(&update_cycles, cycles);
- rte_atomic64_add(&updates, loop_cnt);
+ __atomic_fetch_add(&update_cycles, cycles, __ATOMIC_RELAXED);
+ __atomic_fetch_add(&updates, loop_cnt, __ATOMIC_RELAXED);
/* Make the thread offline */
rte_rcu_qsbr_thread_offline(t[0], thread_id);
} while (loop_cnt < 20000000);
cycles = rte_rdtsc_precise() - begin;
- rte_atomic64_add(&check_cycles, cycles);
- rte_atomic64_add(&checks, loop_cnt);
+ __atomic_fetch_add(&check_cycles, cycles, __ATOMIC_RELAXED);
+ __atomic_fetch_add(&checks, loop_cnt, __ATOMIC_RELAXED);
return 0;
}
writer_done = 0;
- rte_atomic64_clear(&updates);
- rte_atomic64_clear(&update_cycles);
- rte_atomic64_clear(&checks);
- rte_atomic64_clear(&check_cycles);
+ __atomic_store_n(&updates, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&update_cycles, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&checks, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&check_cycles, 0, __ATOMIC_RELAXED);
printf("\nPerf Test: %d Readers/1 Writer('wait' in qsbr_check == true)\n",
num_cores - 1);
rte_eal_mp_wait_lcore();
printf("Total quiescent state updates = %"PRIi64"\n",
- rte_atomic64_read(&updates));
+ __atomic_load_n(&updates, __ATOMIC_RELAXED));
printf("Cycles per %d quiescent state updates: %"PRIi64"\n",
RCU_SCALE_DOWN,
- rte_atomic64_read(&update_cycles) /
- (rte_atomic64_read(&updates) / RCU_SCALE_DOWN));
- printf("Total RCU checks = %"PRIi64"\n", rte_atomic64_read(&checks));
+ __atomic_load_n(&update_cycles, __ATOMIC_RELAXED) /
+ (__atomic_load_n(&updates, __ATOMIC_RELAXED) / RCU_SCALE_DOWN));
+ printf("Total RCU checks = %"PRIi64"\n", __atomic_load_n(&checks, __ATOMIC_RELAXED));
printf("Cycles per %d checks: %"PRIi64"\n", RCU_SCALE_DOWN,
- rte_atomic64_read(&check_cycles) /
- (rte_atomic64_read(&checks) / RCU_SCALE_DOWN));
+ __atomic_load_n(&check_cycles, __ATOMIC_RELAXED) /
+ (__atomic_load_n(&checks, __ATOMIC_RELAXED) / RCU_SCALE_DOWN));
rte_free(t[0]);
size_t sz;
unsigned int i, tmp_num_cores;
- rte_atomic64_clear(&updates);
- rte_atomic64_clear(&update_cycles);
+ __atomic_store_n(&updates, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&update_cycles, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
rte_eal_mp_wait_lcore();
printf("Total quiescent state updates = %"PRIi64"\n",
- rte_atomic64_read(&updates));
+ __atomic_load_n(&updates, __ATOMIC_RELAXED));
printf("Cycles per %d quiescent state updates: %"PRIi64"\n",
RCU_SCALE_DOWN,
- rte_atomic64_read(&update_cycles) /
- (rte_atomic64_read(&updates) / RCU_SCALE_DOWN));
+ __atomic_load_n(&update_cycles, __ATOMIC_RELAXED) /
+ (__atomic_load_n(&updates, __ATOMIC_RELAXED) / RCU_SCALE_DOWN));
rte_free(t[0]);
size_t sz;
unsigned int i;
- rte_atomic64_clear(&checks);
- rte_atomic64_clear(&check_cycles);
+ __atomic_store_n(&checks, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&check_cycles, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
/* Wait until all readers have exited */
rte_eal_mp_wait_lcore();
- printf("Total RCU checks = %"PRIi64"\n", rte_atomic64_read(&checks));
+ printf("Total RCU checks = %"PRIi64"\n", __atomic_load_n(&checks, __ATOMIC_RELAXED));
printf("Cycles per %d checks: %"PRIi64"\n", RCU_SCALE_DOWN,
- rte_atomic64_read(&check_cycles) /
- (rte_atomic64_read(&checks) / RCU_SCALE_DOWN));
+ __atomic_load_n(&check_cycles, __ATOMIC_RELAXED) /
+ (__atomic_load_n(&checks, __ATOMIC_RELAXED) / RCU_SCALE_DOWN));
rte_free(t[0]);
} while (!writer_done);
cycles = rte_rdtsc_precise() - begin;
- rte_atomic64_add(&update_cycles, cycles);
- rte_atomic64_add(&updates, loop_cnt);
+ __atomic_fetch_add(&update_cycles, cycles, __ATOMIC_RELAXED);
+ __atomic_fetch_add(&updates, loop_cnt, __ATOMIC_RELAXED);
rte_rcu_qsbr_thread_unregister(temp, thread_id);
writer_done = 0;
- rte_atomic64_clear(&updates);
- rte_atomic64_clear(&update_cycles);
- rte_atomic64_clear(&checks);
- rte_atomic64_clear(&check_cycles);
+ __atomic_store_n(&updates, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&update_cycles, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&checks, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&check_cycles, 0, __ATOMIC_RELAXED);
__atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
}
cycles = rte_rdtsc_precise() - begin;
- rte_atomic64_add(&check_cycles, cycles);
- rte_atomic64_add(&checks, i);
+ __atomic_fetch_add(&check_cycles, cycles, __ATOMIC_RELAXED);
+ __atomic_fetch_add(&checks, i, __ATOMIC_RELAXED);
writer_done = 1;
printf("Following numbers include calls to rte_hash functions\n");
printf("Cycles per 1 quiescent state update(online/update/offline): %"PRIi64"\n",
- rte_atomic64_read(&update_cycles) /
- rte_atomic64_read(&updates));
+ __atomic_load_n(&update_cycles, __ATOMIC_RELAXED) /
+ __atomic_load_n(&updates, __ATOMIC_RELAXED));
printf("Cycles per 1 check(start, check): %"PRIi64"\n\n",
- rte_atomic64_read(&check_cycles) /
- rte_atomic64_read(&checks));
+ __atomic_load_n(&check_cycles, __ATOMIC_RELAXED) /
+ __atomic_load_n(&checks, __ATOMIC_RELAXED));
rte_free(t[0]);
printf("Perf test: 1 writer, %d readers, 1 QSBR variable, 1 QSBR Query, Non-Blocking QSBR check\n", num_cores);
- __atomic_store_n(&thr_id, 0, __ATOMIC_SEQ_CST);
+ __atomic_store_n(&thr_id, 0, __ATOMIC_RELAXED);
if (all_registered == 1)
tmp_num_cores = num_cores;
}
cycles = rte_rdtsc_precise() - begin;
- rte_atomic64_add(&check_cycles, cycles);
- rte_atomic64_add(&checks, i);
+ __atomic_fetch_add(&check_cycles, cycles, __ATOMIC_RELAXED);
+ __atomic_fetch_add(&checks, i, __ATOMIC_RELAXED);
writer_done = 1;
/* Wait and check return value from reader threads */
printf("Following numbers include calls to rte_hash functions\n");
printf("Cycles per 1 quiescent state update(online/update/offline): %"PRIi64"\n",
- rte_atomic64_read(&update_cycles) /
- rte_atomic64_read(&updates));
+ __atomic_load_n(&update_cycles, __ATOMIC_RELAXED) /
+ __atomic_load_n(&updates, __ATOMIC_RELAXED));
printf("Cycles per 1 check(start, check): %"PRIi64"\n\n",
- rte_atomic64_read(&check_cycles) /
- rte_atomic64_read(&checks));
+ __atomic_load_n(&check_cycles, __ATOMIC_RELAXED) /
+ __atomic_load_n(&checks, __ATOMIC_RELAXED));
rte_free(t[0]);
return TEST_SKIPPED;
}
- rte_atomic64_init(&updates);
- rte_atomic64_init(&update_cycles);
- rte_atomic64_init(&checks);
- rte_atomic64_init(&check_cycles);
+ __atomic_store_n(&updates, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&update_cycles, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&checks, 0, __ATOMIC_RELAXED);
+ __atomic_store_n(&check_cycles, 0, __ATOMIC_RELAXED);
num_cores = 0;
RTE_LCORE_FOREACH_WORKER(core_id) {