bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, "Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <kafai@fb.com>,
	"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Jesper Dangaard Brouer" <brouer@redhat.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	Networking <netdev@vger.kernel.org>
Subject: Re: [PATCH RFC bpf-next 15/15] samples: bpf: convert xdp_samples to use raw_tracepoints
Date: Sat, 29 May 2021 20:07:40 -0700	[thread overview]
Message-ID: <CAEf4BzZ76CYnUnOqn+qqqPhpFKSPVo2YqLZe6cSGyDna7+-_XQ@mail.gmail.com> (raw)
In-Reply-To: <20210528235250.2635167-16-memxor@gmail.com>

On Fri, May 28, 2021 at 4:54 PM Kumar Kartikeya Dwivedi
<memxor@gmail.com> wrote:
>
> These are faster, and hence speeds up cases where user passes --stats to
> enable success case redirect accounting. We can extend this to all other
> tracepoints as well, so make that part of this change.
>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> ---
>  samples/bpf/xdp_sample_kern.h | 145 +++++++++++-----------------------
>  samples/bpf/xdp_sample_user.c |   2 +-
>  2 files changed, 45 insertions(+), 102 deletions(-)
>

[...]

>
> -/* Tracepoint format: /sys/kernel/debug/tracing/events/xdp/xdp_exception/format
> - * Code in:                kernel/include/trace/events/xdp.h
> - */
> -struct xdp_exception_ctx {
> -       u64 __pad;      // First 8 bytes are not accessible by bpf code
> -       int prog_id;    //      offset:8;  size:4; signed:1;
> -       u32 act;        //      offset:12; size:4; signed:0;
> -       int ifindex;    //      offset:16; size:4; signed:1;
> -};
> -
> -SEC("tracepoint/xdp/xdp_exception")
> -int trace_xdp_exception(struct xdp_exception_ctx *ctx)
> +SEC("raw_tracepoint/xdp_exception")
> +int trace_xdp_exception(struct bpf_raw_tracepoint_args *ctx)
>  {

check out use of BPF_PROG macro for raw_tracepoint and fentry/fexit
programs, it looks nicer, IMO.

> +       u32 key = ctx->args[2];
>         struct datarec *rec;
> -       u32 key = ctx->act;
>
>         if (key > XDP_REDIRECT)
>                 key = XDP_UNKNOWN;

[...]

      reply	other threads:[~2021-05-30  3:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 23:52 [PATCH RFC bpf-next 00/15] Improve XDP samples usability and output Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 01/15] samples: bpf: fix a couple of NULL dereferences Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 02/15] samples: bpf: fix a couple of warnings Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 03/15] samples: bpf: split out common bpf progs to its own file Kumar Kartikeya Dwivedi
2021-05-30  3:05   ` Andrii Nakryiko
2021-05-28 23:52 ` [PATCH RFC bpf-next 04/15] samples: bpf: refactor generic parts out of xdp_redirect_cpu_user Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 05/15] samples: bpf: convert xdp_redirect_map to use xdp_samples Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 06/15] samples: bpf: prepare devmap_xmit support in xdp_sample Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 07/15] samples: bpf: add extended reporting for xdp redirect error Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 08/15] samples: bpf: add per exception reporting for xdp_exception Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 09/15] samples: bpf: convert xdp_monitor to use xdp_samples Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 10/15] samples: bpf: implement terse output mode and make it default Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 11/15] samples: bpf: print summary of session on exit Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 12/15] samples: bpf: subtract time spent in collection from polling interval Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 13/15] samples: bpf: add new options for xdp samples Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 14/15] samples: bpf: add documentation Kumar Kartikeya Dwivedi
2021-05-28 23:52 ` [PATCH RFC bpf-next 15/15] samples: bpf: convert xdp_samples to use raw_tracepoints Kumar Kartikeya Dwivedi
2021-05-30  3:07   ` Andrii Nakryiko [this message]

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=CAEf4BzZ76CYnUnOqn+qqqPhpFKSPVo2YqLZe6cSGyDna7+-_XQ@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=toke@redhat.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).