diff mbox series

[bpf-next,v2,2/4] libbpf: add support for BPF_CGROUP_INET_SOCK_RELEASE

Message ID 20200626165231.672001-2-sdf@google.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series [bpf-next,v2,1/4] bpf: add BPF_CGROUP_INET_SOCK_RELEASE hook | expand

Commit Message

Stanislav Fomichev June 26, 2020, 4:52 p.m. UTC
Add auto-detection for the cgroup/sock_release programs.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 tools/include/uapi/linux/bpf.h | 1 +
 tools/lib/bpf/libbpf.c         | 2 ++
 2 files changed, 3 insertions(+)

Comments

Andrii Nakryiko June 26, 2020, 10:08 p.m. UTC | #1
On Fri, Jun 26, 2020 at 10:22 AM Stanislav Fomichev <sdf@google.com> wrote:
>
> Add auto-detection for the cgroup/sock_release programs.
>
> Signed-off-by: Stanislav Fomichev <sdf@google.com>
> ---

Left a bunch of comments on v1 of this series, oops.

But where is the cover letter? Did I miss it?

>  tools/include/uapi/linux/bpf.h | 1 +
>  tools/lib/bpf/libbpf.c         | 2 ++
>  2 files changed, 3 insertions(+)
>

[...]
Stanislav Fomichev June 26, 2020, 11:52 p.m. UTC | #2
On Fri, Jun 26, 2020 at 3:08 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Fri, Jun 26, 2020 at 10:22 AM Stanislav Fomichev <sdf@google.com> wrote:
> >
> > Add auto-detection for the cgroup/sock_release programs.
> >
> > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > ---
>
> Left a bunch of comments on v1 of this series, oops.
No worries, there is not much changed since then, thanks for the review!

> But where is the cover letter? Did I miss it?
I didn't feel like it deserves a cover letter. The main patch is
small, most of the changes are in libbpf/selftests and I mostly split
them to make it easier for you to push to github (is it still a
requirement or I shouldn't worry about it anymore?).
Andrii Nakryiko June 27, 2020, 12:59 a.m. UTC | #3
On Fri, Jun 26, 2020 at 4:52 PM Stanislav Fomichev <sdf@google.com> wrote:
>
> On Fri, Jun 26, 2020 at 3:08 PM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Fri, Jun 26, 2020 at 10:22 AM Stanislav Fomichev <sdf@google.com> wrote:
> > >
> > > Add auto-detection for the cgroup/sock_release programs.
> > >
> > > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > > ---
> >
> > Left a bunch of comments on v1 of this series, oops.
> No worries, there is not much changed since then, thanks for the review!
>
> > But where is the cover letter? Did I miss it?
> I didn't feel like it deserves a cover letter. The main patch is
> small, most of the changes are in libbpf/selftests and I mostly split
> them to make it easier for you to push to github (is it still a
> requirement or I shouldn't worry about it anymore?).

It's not a requirement, sync script is pretty smart about all that, so
no need to do it specifically for the sync purposes. Still a good idea
to have selftests separately, IMO.

As for the cover letter, unless it's some trivial independent fixes,
cover letter ties everything together and is a good place to track
"what changed between versions". So I'd recommend adding it anyways.
Alexei Starovoitov June 28, 2020, 5:35 p.m. UTC | #4
On Fri, Jun 26, 2020 at 05:59:41PM -0700, Andrii Nakryiko wrote:
> 
> As for the cover letter, unless it's some trivial independent fixes,
> cover letter ties everything together and is a good place to track
> "what changed between versions". So I'd recommend adding it anyways.

+1
For independent fixes it's ok to skip cover, but it's often nice to have one.
New release hook like this one certainly deserves a cover.
diff mbox series

Patch

diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index c65b374a5090..d7aea1d0167a 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -226,6 +226,7 @@  enum bpf_attach_type {
 	BPF_CGROUP_INET4_GETSOCKNAME,
 	BPF_CGROUP_INET6_GETSOCKNAME,
 	BPF_XDP_DEVMAP,
+	BPF_CGROUP_INET_SOCK_RELEASE,
 	__MAX_BPF_ATTACH_TYPE
 };
 
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 7f01be2b88b8..acbab6d0672d 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -6670,6 +6670,8 @@  static const struct bpf_sec_def section_defs[] = {
 	BPF_APROG_SEC("cgroup_skb/egress",	BPF_PROG_TYPE_CGROUP_SKB,
 						BPF_CGROUP_INET_EGRESS),
 	BPF_APROG_COMPAT("cgroup/skb",		BPF_PROG_TYPE_CGROUP_SKB),
+	BPF_EAPROG_SEC("cgroup/sock_release",	BPF_PROG_TYPE_CGROUP_SOCK,
+						BPF_CGROUP_INET_SOCK_RELEASE),
 	BPF_APROG_SEC("cgroup/sock",		BPF_PROG_TYPE_CGROUP_SOCK,
 						BPF_CGROUP_INET_SOCK_CREATE),
 	BPF_EAPROG_SEC("cgroup/post_bind4",	BPF_PROG_TYPE_CGROUP_SOCK,