]> git.droids-corp.org - dpdk.git/commitdiff
bpf: use wait until scheme for Rx/Tx iteration
authorFeifei Wang <feifei.wang2@arm.com>
Mon, 1 Nov 2021 06:00:06 +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 cbi->use to be updated, use wait until scheme.

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/bpf/bpf_pkt.c

index 6e8248f0d6e4dea9e2f4b6c43d2ad6c8de5bc0ba..08eebd99b3718562d0d10bbc9b1045b4e996fc7d 100644 (file)
@@ -113,7 +113,7 @@ bpf_eth_cbi_unuse(struct bpf_eth_cbi *cbi)
 static void
 bpf_eth_cbi_wait(const struct bpf_eth_cbi *cbi)
 {
-       uint32_t nuse, puse;
+       uint32_t puse;
 
        /* make sure all previous loads and stores are completed */
        rte_smp_mb();
@@ -122,11 +122,8 @@ bpf_eth_cbi_wait(const struct bpf_eth_cbi *cbi)
 
        /* in use, busy wait till current RX/TX iteration is finished */
        if ((puse & BPF_ETH_CBI_INUSE) != 0) {
-               do {
-                       rte_pause();
-                       rte_compiler_barrier();
-                       nuse = cbi->use;
-               } while (nuse == puse);
+               RTE_WAIT_UNTIL_MASKED((uint32_t *)(uintptr_t)&cbi->use,
+                       UINT32_MAX, !=, puse, __ATOMIC_RELAXED);
        }
 }