Skip to content

Commit

Permalink
ip4_select_id use rte_atomic32_add_return
Browse files Browse the repository at this point in the history
  • Loading branch information
donghaobo authored and ywc689 committed Dec 8, 2023
1 parent 4eb867f commit 1a7ac1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1a7ac1b

Please sign in to comment.