Re: [PATCH RFC bpf-next 15/15] samples: bpf: convert xdp_samples to use raw_tracepoints

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 28, 2021 at 4:54 PM Kumar Kartikeya Dwivedi
<memxor@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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;

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux