From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3FA37A0C47; Tue, 26 Oct 2021 10:02:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F202D4118B; Tue, 26 Oct 2021 10:02:28 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 4F4804003E for ; Tue, 26 Oct 2021 10:02:26 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CE2191FB; Tue, 26 Oct 2021 01:02:25 -0700 (PDT) Received: from net-x86-dell-8268.shanghai.arm.com (net-x86-dell-8268.shanghai.arm.com [10.169.210.103]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 05EA83F70D; Tue, 26 Oct 2021 01:02:23 -0700 (PDT) From: Feifei Wang To: Konstantin Ananyev Cc: dev@dpdk.org, nd@arm.com, Feifei Wang , Ruifeng Wang Date: Tue, 26 Oct 2021 16:02:03 +0800 Message-Id: <20211026080204.149550-5-feifei.wang2@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211026080204.149550-1-feifei.wang2@arm.com> References: <20210902053253.3017858-1-feifei.wang2@arm.com> <20211026080204.149550-1-feifei.wang2@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 4/5] lib/bpf: use wait event scheme for Rx/Tx iteration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Instead of polling for cbi->use to be updated, use wait event scheme. Furthermore, delete 'const' for 'bpf_eth_cbi_wait'. This is because of a compilation error: ----------------------------------------------------------------------- ../lib/eal/include/rte_common.h:36:13: error: read-only variable ‘value’ used as ‘asm’ output 36 | #define asm __asm__ | ^~~~~~~ ../lib/eal/arm/include/rte_pause_64.h:66:3: note: in expansion of macro ‘asm’ 66 | asm volatile("ldaxr %w[tmp], [%x[addr]]" \ | ^~~ ../lib/eal/arm/include/rte_pause_64.h:96:3: note: in expansion of macro ‘__LOAD_EXC_32’ 96 | __LOAD_EXC_32((src), dst, memorder) \ | ^~~~~~~~~~~~~ ../lib/eal/arm/include/rte_pause_64.h:167:4: note: in expansion of macro ‘__LOAD_EXC’ 167 | __LOAD_EXC((addr), value, memorder, size) \ | ^~~~~~~~~~ ../lib/bpf/bpf_pkt.c:125:3: note: in expansion of macro ‘rte_wait_event’ 125 | rte_wait_event(&cbi->use, UINT32_MAX, ==, puse, ----------------------------------------------------------------------- Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang --- lib/bpf/bpf_pkt.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/bpf/bpf_pkt.c b/lib/bpf/bpf_pkt.c index 6e8248f0d6..213d44a75a 100644 --- a/lib/bpf/bpf_pkt.c +++ b/lib/bpf/bpf_pkt.c @@ -111,9 +111,9 @@ bpf_eth_cbi_unuse(struct bpf_eth_cbi *cbi) * Waits till datapath finished using given callback. */ static void -bpf_eth_cbi_wait(const struct bpf_eth_cbi *cbi) +bpf_eth_cbi_wait(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_event(&cbi->use, UINT32_MAX, ==, puse, + __ATOMIC_RELAXED); } } -- 2.25.1