From 1a7ac1b2af3c99fcd0c6db2c62ac0b182996e727 Mon Sep 17 00:00:00 2001 From: donghaobo <122531097@qq.com> Date: Wed, 25 Oct 2023 10:22:18 +0800 Subject: [PATCH] ip4_select_id use rte_atomic32_add_return --- src/ipv4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ipv4.c b/src/ipv4.c index 652a351c3..21884c7a5 100644 --- a/src/ipv4.c +++ b/src/ipv4.c @@ -518,8 +518,8 @@ uint32_t ip4_select_id(struct rte_ipv4_hdr *iph) iph->next_proto_id, ip4_id_hashrnd); p_id = ip4_idents + hash % IP4_IDENTS_SZ; - id = htons(rte_atomic32_read(p_id)); - rte_atomic32_add(p_id, 1); + id = rte_atomic32_add_return(p_id, 1) - 1; + id = htons(id); return id; }