[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ76CYnUnOqn+qqqPhpFKSPVo2YqLZe6cSGyDna7+-_XQ@mail.gmail.com>
Date: Sat, 29 May 2021 20:07:40 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH RFC bpf-next 15/15] samples: bpf: convert xdp_samples to
use raw_tracepoints
On Fri, May 28, 2021 at 4:54 PM Kumar Kartikeya Dwivedi
<memxor@...il.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@...il.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;
[...]
Powered by blists - more mailing lists