]> git.droids-corp.org - dpdk.git/commitdiff
distributor: use wait until scheme
authorFeifei Wang <feifei.wang2@arm.com>
Mon, 1 Nov 2021 06:00:07 +0000 (14:00 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 3 Nov 2021 14:50:14 +0000 (15:50 +0100)
Instead of polling for bufptr64 to be updated, use
wait until scheme for this case.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
lib/distributor/rte_distributor_single.c

index f4725b1d0bf986f1b96bf6a4b3595066b1b94d72..b6536206883e1d27b724ab5f7d27088b4cde9b54 100644 (file)
@@ -33,9 +33,8 @@ rte_distributor_request_pkt_single(struct rte_distributor_single *d,
        union rte_distributor_buffer_single *buf = &d->bufs[worker_id];
        int64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS)
                        | RTE_DISTRIB_GET_BUF;
-       while (unlikely(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED)
-                       & RTE_DISTRIB_FLAGS_MASK))
-               rte_pause();
+       RTE_WAIT_UNTIL_MASKED(&buf->bufptr64, RTE_DISTRIB_FLAGS_MASK,
+               ==, 0, __ATOMIC_RELAXED);
 
        /* Sync with distributor on GET_BUF flag. */
        __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE);
@@ -74,9 +73,8 @@ rte_distributor_return_pkt_single(struct rte_distributor_single *d,
        union rte_distributor_buffer_single *buf = &d->bufs[worker_id];
        uint64_t req = (((int64_t)(uintptr_t)oldpkt) << RTE_DISTRIB_FLAG_BITS)
                        | RTE_DISTRIB_RETURN_BUF;
-       while (unlikely(__atomic_load_n(&buf->bufptr64, __ATOMIC_RELAXED)
-                       & RTE_DISTRIB_FLAGS_MASK))
-               rte_pause();
+       RTE_WAIT_UNTIL_MASKED(&buf->bufptr64, RTE_DISTRIB_FLAGS_MASK,
+               ==, 0, __ATOMIC_RELAXED);
 
        /* Sync with distributor on RETURN_BUF flag. */
        __atomic_store_n(&(buf->bufptr64), req, __ATOMIC_RELEASE);