linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: Pedro Tammela <pctammela@gmail.com>
Cc: Pedro Tammela <pctammela@mojatatu.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, Martin Lau <kafai@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Joe Stringer <joe@cilium.io>,
	Quentin Monnet <quentin@isovalent.com>,
	Yang Li <yang.lee@linux.alibaba.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()'
Date: Mon, 29 Mar 2021 16:28:18 +0000	[thread overview]
Message-ID: <BCF68ADA-5114-4E61-87DE-D5E5C946BC6F@fb.com> (raw)
In-Reply-To: <20210328161055.257504-3-pctammela@mojatatu.com>



> On Mar 28, 2021, at 9:10 AM, Pedro Tammela <pctammela@gmail.com> wrote:
> 
> 'bpf_ring_buffer__poll()' abstracts the polling method, so abstract the
> constants that make the implementation don't wait or wait indefinetly
> for data.
> 
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
> ---
> tools/lib/bpf/libbpf.h                                 | 3 +++
> tools/testing/selftests/bpf/benchs/bench_ringbufs.c    | 2 +-
> tools/testing/selftests/bpf/prog_tests/ringbuf.c       | 6 +++---
> tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c | 4 ++--
> 4 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> index f500621d28e5..3817d84f91c6 100644
> --- a/tools/lib/bpf/libbpf.h
> +++ b/tools/lib/bpf/libbpf.h
> @@ -540,6 +540,9 @@ LIBBPF_API int ring_buffer__poll(struct ring_buffer *rb, int timeout_ms);
> LIBBPF_API int ring_buffer__consume(struct ring_buffer *rb);
> LIBBPF_API int ring_buffer__epoll_fd(const struct ring_buffer *rb);
> 
> +#define ring_buffer__poll_wait(rb) ring_buffer__poll(rb, -1)
> +#define ring_buffer__poll_nowait(rb) ring_buffer__poll(rb, 0)

I think we don't need ring_buffer__poll_wait() as ring_buffer__poll() already 
means "wait for timeout_ms". 

Actually, I think ring_buffer__poll() is enough. ring_buffer__poll_nowait() 
is not that useful either. 

Thanks,
Song


  reply	other threads:[~2021-03-29 16:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-28 16:10 [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag Pedro Tammela
2021-03-28 16:10 ` [PATCH bpf-next] bpf: check flags in 'bpf_ringbuf_discard()' and 'bpf_ringbuf_submit()' Pedro Tammela
2021-03-29 16:10   ` Song Liu
2021-03-30 14:22     ` Pedro Tammela
2021-03-30 18:12       ` Song Liu
2021-03-31  6:58   ` Andrii Nakryiko
2021-03-28 16:10 ` [PATCH bpf-next] libbpf: Add '_wait()' and '_nowait()' macros for 'bpf_ring_buffer__poll()' Pedro Tammela
2021-03-29 16:28   ` Song Liu [this message]
2021-03-31 18:59     ` Andrii Nakryiko
2021-03-29 16:05 ` [PATCH bpf-next] bpf: add 'BPF_RB_MAY_WAKEUP' flag Song Liu
2021-03-31  6:53 ` Andrii Nakryiko
2021-04-03 13:34   ` Pedro Tammela
2021-04-03 15:51     ` Andrii Nakryiko

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=BCF68ADA-5114-4E61-87DE-D5E5C946BC6F@fb.com \
    --to=songliubraving@fb.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=joe@cilium.io \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pctammela@gmail.com \
    --cc=pctammela@mojatatu.com \
    --cc=quentin@isovalent.com \
    --cc=shuah@kernel.org \
    --cc=yang.lee@linux.alibaba.com \
    --cc=yhs@fb.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).