Use __atomic_fetch_{add,and,or,sub,xor} instead of
__atomic_{add,and,or,sub,xor}_fetch adding the necessary code to
allow consumption of the resulting value.

Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c 
b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 2a20a69..c7786cc 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -979,7 +979,7 @@ static int link_xdp_prog_with_dev(int ifindex, int fd, 
__u32 flags)
                        break;
                xsk_socket__delete(rxq->xsk);
 
-               if (__atomic_sub_fetch(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE)
+               if (__atomic_fetch_sub(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE) 
- 1
                                == 0) {
                        (void)xsk_umem__delete(rxq->umem->umem);
                        xdp_umem_destroy(rxq->umem);
@@ -1710,7 +1710,7 @@ struct msg_internal {
 out_xsk:
        xsk_socket__delete(rxq->xsk);
 out_umem:
-       if (__atomic_sub_fetch(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE) == 0)
+       if (__atomic_fetch_sub(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE) - 1 == 
0)
                xdp_umem_destroy(rxq->umem);
 
        return ret;
-- 
1.8.3.1

Reply via email to