From: Feifei Wang <feifei.wang2@arm.com> To: Konstantin Ananyev <konstantin.ananyev@intel.com>, Ferruh Yigit <ferruh.yigit@intel.com> Cc: dev@dpdk.org, nd@arm.com, Feifei Wang <feifei.wang2@arm.com>, stable@dpdk.org, Ruifeng Wang <ruifeng.wang@arm.com> Subject: [dpdk-stable] [RFC PATCH v2 4/5] lib/bpf: use wait event scheme for Rx/Tx iteration Date: Thu, 23 Sep 2021 17:59:01 +0800 Message-ID: <20210923095902.301762-5-feifei.wang2@arm.com> (raw) In-Reply-To: <20210923095902.301762-1-feifei.wang2@arm.com> First, fix the bug that keyword const of func arg should be after "*". This is because const before "*" means the value of "cbi" should not be changed. But we should monitor that cbi->use changed and then we can jump out of loop. Second, instead of polling for cbi->use to be updated, use wait event scheme. Fixes: a93ff62a8938 ("bpf: introduce basic Rx/Tx filters") Cc: konstantin.ananyev@intel.com Cc: stable@dpdk.org Signed-off-by: Feifei Wang <feifei.wang2@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> --- 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..08ed8ff68c 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 *const 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_compiler_barrier(); + rte_wait_event_32(&cbi->use, UINT_MAX, puse, ==, __ATOMIC_RELAXED); } } -- 2.25.1
next prev parent reply other threads:[~2021-09-23 9:59 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20210902053253.3017858-1-feifei.wang2@arm.com> 2021-09-02 5:32 ` [dpdk-stable] [RFC PATCH v1 4/5] lib/bpf: use wait until " Feifei Wang [not found] ` <20210923095902.301762-1-feifei.wang2@arm.com> 2021-09-23 9:59 ` Feifei Wang [this message] 2021-09-24 18:07 ` [dpdk-stable] [RFC PATCH v2 4/5] lib/bpf: use wait event " Ananyev, Konstantin 2021-09-26 2:19 ` [dpdk-stable] 回复: " Feifei Wang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210923095902.301762-5-feifei.wang2@arm.com \ --to=feifei.wang2@arm.com \ --cc=dev@dpdk.org \ --cc=ferruh.yigit@intel.com \ --cc=konstantin.ananyev@intel.com \ --cc=nd@arm.com \ --cc=ruifeng.wang@arm.com \ --cc=stable@dpdk.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
patches for DPDK stable branches This inbox may be cloned and mirrored by anyone: git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \ stable@dpdk.org public-inbox-index stable Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.stable AGPL code for this site: git clone https://public-inbox.org/public-inbox.git