The BPF_ST_ATOMIC_REG macro generated code with deprecated rte_atomicNN_add and rte_atomicNN_exchange.
Replace this with the equivalent rte_stdatomic definitions. Use memory order seq_cst to preserve the previous behavior of rte_atomicNN_add() / rte_atomicNN_exchange() and matches the Linux kernel BPF interpreter for these opcodes. Signed-off-by: Stephen Hemminger <[email protected]> --- lib/bpf/bpf_exec.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/bpf/bpf_exec.c b/lib/bpf/bpf_exec.c index 18013753b1..ee6ec7516f 100644 --- a/lib/bpf/bpf_exec.c +++ b/lib/bpf/bpf_exec.c @@ -10,6 +10,7 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_byteorder.h> +#include <rte_stdatomic.h> #include "bpf_impl.h" @@ -65,16 +66,16 @@ (type)(reg)[(ins)->src_reg]) #define BPF_ST_ATOMIC_REG(reg, ins, tp) do { \ + RTE_ATOMIC(uint##tp##_t) *dst = (RTE_ATOMIC(uint##tp##_t) *) \ + (uintptr_t)((reg)[(ins)->dst_reg] + (ins)->off); \ switch (ins->imm) { \ case BPF_ATOMIC_ADD: \ - rte_atomic##tp##_add((rte_atomic##tp##_t *) \ - (uintptr_t)((reg)[(ins)->dst_reg] + (ins)->off), \ - (reg)[(ins)->src_reg]); \ + rte_atomic_fetch_add_explicit(dst, \ + (reg)[(ins)->src_reg], rte_memory_order_seq_cst); \ break; \ case BPF_ATOMIC_XCHG: \ - (reg)[(ins)->src_reg] = rte_atomic##tp##_exchange((uint##tp##_t *) \ - (uintptr_t)((reg)[(ins)->dst_reg] + (ins)->off), \ - (reg)[(ins)->src_reg]); \ + (reg)[(ins)->src_reg] = rte_atomic_exchange_explicit(dst, \ + (reg)[(ins)->src_reg], rte_memory_order_seq_cst); \ break; \ default: \ /* this should be caught by validator and never reach here */ \ -- 2.53.0

