bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: "Daniel T. Lee" <danieltimlee@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	Lorenzo Bianconi <lorenzo@kernel.org>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Xdp <xdp-newbies@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 2/3] samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu
Date: Sat, 10 Oct 2020 16:55:08 -0700	[thread overview]
Message-ID: <CAEf4Bzbw5TOkbQMOv99ONc374yp9xVXAKnGZAnwCw=TUro0wsA@mail.gmail.com> (raw)
In-Reply-To: <20201010181734.1109-3-danieltimlee@gmail.com>

On Sat, Oct 10, 2020 at 11:17 AM Daniel T. Lee <danieltimlee@gmail.com> wrote:
>
> From commit d7a18ea7e8b6 ("libbpf: Add generic bpf_program__attach()"),
> for some BPF programs, it is now possible to attach BPF programs
> with __attach() instead of explicitly calling __attach_<type>().
>
> This commit refactors the __attach_tracepoint() with libbpf's generic
> __attach() method. In addition, this refactors the logic of setting
> the map FD to simplify the code. Also, the missing removal of
> bpf_load.o in Makefile has been fixed.
>
> Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
>
> ---
> Changes in v2:
>  - program section match with bpf_program__is_<type> instead of strncmp
>  - refactor pointer array initialization
>  - error code cleanup
>
>  samples/bpf/Makefile                |   2 +-
>  samples/bpf/xdp_redirect_cpu_user.c | 153 +++++++++++++---------------
>  2 files changed, 73 insertions(+), 82 deletions(-)
>

[...]

> @@ -986,6 +975,8 @@ int main(int argc, char **argv)
>
>         stats_poll(interval, use_separators, prog_name, mprog_name,
>                    &value, stress_mode);
> +
> +       err = EXIT_OK;
>  out:

This one doesn't call bpf_object__close() as well, but let's land your
refactoring and we can do further improvements in the follow ups.

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>         free(cpu);
>         return err;
> --
> 2.25.1
>

  reply	other threads:[~2020-10-10 23:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10 18:17 [PATCH bpf-next v2 0/3] samples: bpf: Refactor XDP programs with libbpf Daniel T. Lee
2020-10-10 18:17 ` [PATCH bpf-next v2 1/3] samples: bpf: Refactor xdp_monitor " Daniel T. Lee
2020-10-10 23:56   ` Andrii Nakryiko
2020-10-10 18:17 ` [PATCH bpf-next v2 2/3] samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu Daniel T. Lee
2020-10-10 23:55   ` Andrii Nakryiko [this message]
2020-10-10 18:17 ` [PATCH bpf-next v2 3/3] samples: bpf: refactor XDP kern program maps with BTF-defined map Daniel T. Lee
2020-10-10 23:56   ` Andrii Nakryiko
  -- strict thread matches above, loose matches on Subject: below --
2020-10-10 10:44 [PATCH bpf-next v2 0/3] samples: bpf: Refactor XDP programs with libbpf Daniel T. Lee
2020-10-10 10:44 ` [PATCH bpf-next v2 2/3] samples: bpf: Replace attach_tracepoint() to attach() in xdp_redirect_cpu Daniel T. Lee

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='CAEf4Bzbw5TOkbQMOv99ONc374yp9xVXAKnGZAnwCw=TUro0wsA@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=danieltimlee@gmail.com \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xdp-newbies@vger.kernel.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
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).