2018-01-15 19:17:14

by Roman Gushchin

[permalink] [raw]
Subject: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

Bpftool doesn't recognize BPF_PROG_TYPE_CGROUP_DEVICE programs,
so the prog show command prints the numeric type value:

$ bpftool prog show
1: type 15 name bpf_prog1 tag ac9f93dbfd6d9b74
loaded_at Jan 15/07:58 uid 0
xlated 96B jited 105B memlock 4096B

This patch defines the corresponding textual representation:

$ bpftool prog show
1: cgroup_device name bpf_prog1 tag ac9f93dbfd6d9b74
loaded_at Jan 15/07:58 uid 0
xlated 96B jited 105B memlock 4096B

Signed-off-by: Roman Gushchin <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Quentin Monnet <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
---
tools/bpf/bpftool/prog.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index c6a28be4665c..099e21cf1b5c 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -66,6 +66,7 @@ static const char * const prog_type_name[] = {
[BPF_PROG_TYPE_LWT_XMIT] = "lwt_xmit",
[BPF_PROG_TYPE_SOCK_OPS] = "sock_ops",
[BPF_PROG_TYPE_SK_SKB] = "sk_skb",
+ [BPF_PROG_TYPE_CGROUP_DEVICE] = "cgroup_device",
};

static void print_boot_time(__u64 nsecs, char *buf, unsigned int size)
--
2.14.3


2018-01-15 19:32:06

by Quentin Monnet

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

2018-01-15 19:16 UTC+0000 ~ Roman Gushchin <[email protected]>
> Bpftool doesn't recognize BPF_PROG_TYPE_CGROUP_DEVICE programs,
> so the prog show command prints the numeric type value:
>
> $ bpftool prog show
> 1: type 15 name bpf_prog1 tag ac9f93dbfd6d9b74
> loaded_at Jan 15/07:58 uid 0
> xlated 96B jited 105B memlock 4096B
>
> This patch defines the corresponding textual representation:
>
> $ bpftool prog show
> 1: cgroup_device name bpf_prog1 tag ac9f93dbfd6d9b74
> loaded_at Jan 15/07:58 uid 0
> xlated 96B jited 105B memlock 4096B
>
> Signed-off-by: Roman Gushchin <[email protected]>
> Cc: Jakub Kicinski <[email protected]>
> Cc: Quentin Monnet <[email protected]>
> Cc: Daniel Borkmann <[email protected]>
> Cc: Alexei Starovoitov <[email protected]>
> ---
> tools/bpf/bpftool/prog.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> index c6a28be4665c..099e21cf1b5c 100644
> --- a/tools/bpf/bpftool/prog.c
> +++ b/tools/bpf/bpftool/prog.c
> @@ -66,6 +66,7 @@ static const char * const prog_type_name[] = {
> [BPF_PROG_TYPE_LWT_XMIT] = "lwt_xmit",
> [BPF_PROG_TYPE_SOCK_OPS] = "sock_ops",
> [BPF_PROG_TYPE_SK_SKB] = "sk_skb",
> + [BPF_PROG_TYPE_CGROUP_DEVICE] = "cgroup_device",
> };
>
> static void print_boot_time(__u64 nsecs, char *buf, unsigned int size)

Looks good, thanks Roman!
Would you mind updating the map names as well? It seems the
BPF_MAP_TYPE_CPUMAP is missing from the list in map.c.

Quentin

2018-01-15 19:42:08

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

On Mon, 15 Jan 2018 19:16:15 +0000, Roman Gushchin wrote:
> Bpftool doesn't recognize BPF_PROG_TYPE_CGROUP_DEVICE programs,
> so the prog show command prints the numeric type value:
>
> $ bpftool prog show
> 1: type 15 name bpf_prog1 tag ac9f93dbfd6d9b74
> loaded_at Jan 15/07:58 uid 0
> xlated 96B jited 105B memlock 4096B
>
> This patch defines the corresponding textual representation:
>
> $ bpftool prog show
> 1: cgroup_device name bpf_prog1 tag ac9f93dbfd6d9b74
> loaded_at Jan 15/07:58 uid 0
> xlated 96B jited 105B memlock 4096B
>
> Signed-off-by: Roman Gushchin <[email protected]>
> Cc: Jakub Kicinski <[email protected]>
> Cc: Quentin Monnet <[email protected]>
> Cc: Daniel Borkmann <[email protected]>
> Cc: Alexei Starovoitov <[email protected]>

Acked-by: Jakub Kicinski <[email protected]>

Thanks!

2018-01-15 19:50:36

by Roman Gushchin

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

On Mon, Jan 15, 2018 at 07:32:01PM +0000, Quentin Monnet wrote:
> 2018-01-15 19:16 UTC+0000 ~ Roman Gushchin <[email protected]>
> > Bpftool doesn't recognize BPF_PROG_TYPE_CGROUP_DEVICE programs,
> > so the prog show command prints the numeric type value:
> >
> > $ bpftool prog show
> > 1: type 15 name bpf_prog1 tag ac9f93dbfd6d9b74
> > loaded_at Jan 15/07:58 uid 0
> > xlated 96B jited 105B memlock 4096B
> >
> > This patch defines the corresponding textual representation:
> >
> > $ bpftool prog show
> > 1: cgroup_device name bpf_prog1 tag ac9f93dbfd6d9b74
> > loaded_at Jan 15/07:58 uid 0
> > xlated 96B jited 105B memlock 4096B
> >
> > Signed-off-by: Roman Gushchin <[email protected]>
> > Cc: Jakub Kicinski <[email protected]>
> > Cc: Quentin Monnet <[email protected]>
> > Cc: Daniel Borkmann <[email protected]>
> > Cc: Alexei Starovoitov <[email protected]>
> > ---
> > tools/bpf/bpftool/prog.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> > index c6a28be4665c..099e21cf1b5c 100644
> > --- a/tools/bpf/bpftool/prog.c
> > +++ b/tools/bpf/bpftool/prog.c
> > @@ -66,6 +66,7 @@ static const char * const prog_type_name[] = {
> > [BPF_PROG_TYPE_LWT_XMIT] = "lwt_xmit",
> > [BPF_PROG_TYPE_SOCK_OPS] = "sock_ops",
> > [BPF_PROG_TYPE_SK_SKB] = "sk_skb",
> > + [BPF_PROG_TYPE_CGROUP_DEVICE] = "cgroup_device",
> > };
> >
> > static void print_boot_time(__u64 nsecs, char *buf, unsigned int size)
>
> Looks good, thanks Roman!
> Would you mind updating the map names as well? It seems the
> BPF_MAP_TYPE_CPUMAP is missing from the list in map.c.

Hello, Quentin!

Sure, I'll take a look.

Thanks!

2018-01-16 01:52:58

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

On 01/15/2018 08:49 PM, Roman Gushchin wrote:
> On Mon, Jan 15, 2018 at 07:32:01PM +0000, Quentin Monnet wrote:
>> 2018-01-15 19:16 UTC+0000 ~ Roman Gushchin <[email protected]>
>>> Bpftool doesn't recognize BPF_PROG_TYPE_CGROUP_DEVICE programs,
>>> so the prog show command prints the numeric type value:
>>>
>>> $ bpftool prog show
>>> 1: type 15 name bpf_prog1 tag ac9f93dbfd6d9b74
>>> loaded_at Jan 15/07:58 uid 0
>>> xlated 96B jited 105B memlock 4096B
>>>
>>> This patch defines the corresponding textual representation:
>>>
>>> $ bpftool prog show
>>> 1: cgroup_device name bpf_prog1 tag ac9f93dbfd6d9b74
>>> loaded_at Jan 15/07:58 uid 0
>>> xlated 96B jited 105B memlock 4096B
>>>
>>> Signed-off-by: Roman Gushchin <[email protected]>
>>> Cc: Jakub Kicinski <[email protected]>
>>> Cc: Quentin Monnet <[email protected]>
>>> Cc: Daniel Borkmann <[email protected]>
>>> Cc: Alexei Starovoitov <[email protected]>
>>> ---
>>> tools/bpf/bpftool/prog.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
>>> index c6a28be4665c..099e21cf1b5c 100644
>>> --- a/tools/bpf/bpftool/prog.c
>>> +++ b/tools/bpf/bpftool/prog.c
>>> @@ -66,6 +66,7 @@ static const char * const prog_type_name[] = {
>>> [BPF_PROG_TYPE_LWT_XMIT] = "lwt_xmit",
>>> [BPF_PROG_TYPE_SOCK_OPS] = "sock_ops",
>>> [BPF_PROG_TYPE_SK_SKB] = "sk_skb",
>>> + [BPF_PROG_TYPE_CGROUP_DEVICE] = "cgroup_device",
>>> };
>>>
>>> static void print_boot_time(__u64 nsecs, char *buf, unsigned int size)
>>
>> Looks good, thanks Roman!
>> Would you mind updating the map names as well? It seems the
>> BPF_MAP_TYPE_CPUMAP is missing from the list in map.c.
>
> Hello, Quentin!
>
> Sure, I'll take a look.

Ok, I presume this comes in as a separate one anyway, so I've applied
this one into bpf-next already, thanks Roman!

2018-01-19 14:21:49

by Roman Gushchin

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

On Mon, Jan 15, 2018 at 07:32:01PM +0000, Quentin Monnet wrote:
> 2018-01-15 19:16 UTC+0000 ~ Roman Gushchin <[email protected]>
> > Bpftool doesn't recognize BPF_PROG_TYPE_CGROUP_DEVICE programs,
> > so the prog show command prints the numeric type value:
> >
> > $ bpftool prog show
> > 1: type 15 name bpf_prog1 tag ac9f93dbfd6d9b74
> > loaded_at Jan 15/07:58 uid 0
> > xlated 96B jited 105B memlock 4096B
> >
> > This patch defines the corresponding textual representation:
> >
> > $ bpftool prog show
> > 1: cgroup_device name bpf_prog1 tag ac9f93dbfd6d9b74
> > loaded_at Jan 15/07:58 uid 0
> > xlated 96B jited 105B memlock 4096B
> >
> > Signed-off-by: Roman Gushchin <[email protected]>
> > Cc: Jakub Kicinski <[email protected]>
> > Cc: Quentin Monnet <[email protected]>
> > Cc: Daniel Borkmann <[email protected]>
> > Cc: Alexei Starovoitov <[email protected]>
> > ---
> > tools/bpf/bpftool/prog.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> > index c6a28be4665c..099e21cf1b5c 100644
> > --- a/tools/bpf/bpftool/prog.c
> > +++ b/tools/bpf/bpftool/prog.c
> > @@ -66,6 +66,7 @@ static const char * const prog_type_name[] = {
> > [BPF_PROG_TYPE_LWT_XMIT] = "lwt_xmit",
> > [BPF_PROG_TYPE_SOCK_OPS] = "sock_ops",
> > [BPF_PROG_TYPE_SK_SKB] = "sk_skb",
> > + [BPF_PROG_TYPE_CGROUP_DEVICE] = "cgroup_device",
> > };
> >
> > static void print_boot_time(__u64 nsecs, char *buf, unsigned int size)
>
> Looks good, thanks Roman!
> Would you mind updating the map names as well? It seems the
> BPF_MAP_TYPE_CPUMAP is missing from the list in map.c.

Hello, Quentin!


Here is the patch.


Thanks!

--

From 16245383a894038a63cc1ad4b77629ba704aaa38 Mon Sep 17 00:00:00 2001
From: Roman Gushchin <[email protected]>
Date: Fri, 19 Jan 2018 14:07:38 +0000
Subject: [PATCH bpf-next] bpftool: recognize BPF_MAP_TYPE_CPUMAP maps

Add BPF_MAP_TYPE_CPUMAP map type to the list
of map type recognized by bpftool and define
corresponding text representation.

Signed-off-by: Roman Gushchin <[email protected]>
Cc: Quentin Monnet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
---
tools/bpf/bpftool/map.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index a152c1a5c94c..f95fa67bb498 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -66,6 +66,7 @@ static const char * const map_type_name[] = {
[BPF_MAP_TYPE_HASH_OF_MAPS] = "hash_of_maps",
[BPF_MAP_TYPE_DEVMAP] = "devmap",
[BPF_MAP_TYPE_SOCKMAP] = "sockmap",
+ [BPF_MAP_TYPE_CPUMAP] = "cpumap",
};

static unsigned int get_possible_cpus(void)
--
2.14.3

2018-01-19 14:39:07

by Quentin Monnet

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

2018-01-19 14:17 UTC+0000 ~ Roman Gushchin <[email protected]>
> On Mon, Jan 15, 2018 at 07:32:01PM +0000, Quentin Monnet wrote:

[...]

>> Looks good, thanks Roman!
>> Would you mind updating the map names as well? It seems the
>> BPF_MAP_TYPE_CPUMAP is missing from the list in map.c.
>
> Hello, Quentin!
>
>
> Here is the patch.
>
>
> Thanks!
>
> --
>
> From 16245383a894038a63cc1ad4b77629ba704aaa38 Mon Sep 17 00:00:00 2001
> From: Roman Gushchin <[email protected]>
> Date: Fri, 19 Jan 2018 14:07:38 +0000
> Subject: [PATCH bpf-next] bpftool: recognize BPF_MAP_TYPE_CPUMAP maps
>
> Add BPF_MAP_TYPE_CPUMAP map type to the list
> of map type recognized by bpftool and define
> corresponding text representation.
>
> Signed-off-by: Roman Gushchin <[email protected]>
> Cc: Quentin Monnet <[email protected]>
> Cc: Jakub Kicinski <[email protected]>
> Cc: Daniel Borkmann <[email protected]>
> Cc: Alexei Starovoitov <[email protected]>
> ---
> tools/bpf/bpftool/map.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index a152c1a5c94c..f95fa67bb498 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -66,6 +66,7 @@ static const char * const map_type_name[] = {
> [BPF_MAP_TYPE_HASH_OF_MAPS] = "hash_of_maps",
> [BPF_MAP_TYPE_DEVMAP] = "devmap",
> [BPF_MAP_TYPE_SOCKMAP] = "sockmap",
> + [BPF_MAP_TYPE_CPUMAP] = "cpumap",
> };
>
> static unsigned int get_possible_cpus(void)
>

Good, thank you!

Acked-by: Quentin Monnet <[email protected]>

2018-01-19 22:22:20

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

On 01/19/2018 03:37 PM, Quentin Monnet wrote:
> 2018-01-19 14:17 UTC+0000 ~ Roman Gushchin <[email protected]>
>> On Mon, Jan 15, 2018 at 07:32:01PM +0000, Quentin Monnet wrote:
>
> [...]
>
>>> Looks good, thanks Roman!
>>> Would you mind updating the map names as well? It seems the
>>> BPF_MAP_TYPE_CPUMAP is missing from the list in map.c.
>>
>> Hello, Quentin!
>>
>>
>> Here is the patch.
>>
>>
>> Thanks!
>>
>> --
>>
>> From 16245383a894038a63cc1ad4b77629ba704aaa38 Mon Sep 17 00:00:00 2001
>> From: Roman Gushchin <[email protected]>
>> Date: Fri, 19 Jan 2018 14:07:38 +0000
>> Subject: [PATCH bpf-next] bpftool: recognize BPF_MAP_TYPE_CPUMAP maps
>>
>> Add BPF_MAP_TYPE_CPUMAP map type to the list
>> of map type recognized by bpftool and define
>> corresponding text representation.
>>
>> Signed-off-by: Roman Gushchin <[email protected]>
>> Cc: Quentin Monnet <[email protected]>
>> Cc: Jakub Kicinski <[email protected]>
>> Cc: Daniel Borkmann <[email protected]>
>> Cc: Alexei Starovoitov <[email protected]>
>> ---
>> tools/bpf/bpftool/map.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
>> index a152c1a5c94c..f95fa67bb498 100644
>> --- a/tools/bpf/bpftool/map.c
>> +++ b/tools/bpf/bpftool/map.c
>> @@ -66,6 +66,7 @@ static const char * const map_type_name[] = {
>> [BPF_MAP_TYPE_HASH_OF_MAPS] = "hash_of_maps",
>> [BPF_MAP_TYPE_DEVMAP] = "devmap",
>> [BPF_MAP_TYPE_SOCKMAP] = "sockmap",
>> + [BPF_MAP_TYPE_CPUMAP] = "cpumap",
>> };
>>
>> static unsigned int get_possible_cpus(void)
>>
>
> Good, thank you!
>
> Acked-by: Quentin Monnet <[email protected]>

Applied to bpf-next, thanks for following up Roman!

2018-01-19 22:24:51

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH bpf-next] bpftool: recognize BPF_PROG_TYPE_CGROUP_DEVICE programs

On Fri, 19 Jan 2018 14:17:45 +0000, Roman Gushchin wrote:
> > Looks good, thanks Roman!
> > Would you mind updating the map names as well? It seems the
> > BPF_MAP_TYPE_CPUMAP is missing from the list in map.c.
>
> Hello, Quentin!
>
> Here is the patch.

Thank you for following up, would you also be abble to find time to
look into bash completions for cgroups before 4.16-rc1? It would be
cool to have the completions... complete ;)