* [PATCH bpf-next 0/2] show btf id in bpftool map list
@ 2019-04-16 8:59 Prashant Bhole
2019-04-16 8:59 ` [PATCH bpf-next 1/2] tools/bpftool: re-organize newline printing for map listing Prashant Bhole
2019-04-16 8:59 ` [PATCH bpf-next 2/2] tools/bpftool: show btf_id in " Prashant Bhole
0 siblings, 2 replies; 9+ messages in thread
From: Prashant Bhole @ 2019-04-16 8:59 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: Prashant Bhole, Jakub Kicinski, Quentin Monnet, Martin KaFai Lau,
Song Liu, Yonghong Song, Andrii Nakryiko, prashantbhole.linux,
netdev
Patch 1: re-organizes newline character printing at the end of
map information.
Patch 2: prints btf id of map if it exists
Prashant Bhole (2):
tools/bpftool: re-organize newline printing for map listing
tools/bpftool: show btf_id in map listing
tools/bpf/bpftool/map.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--
2.17.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH bpf-next 1/2] tools/bpftool: re-organize newline printing for map listing
2019-04-16 8:59 [PATCH bpf-next 0/2] show btf id in bpftool map list Prashant Bhole
@ 2019-04-16 8:59 ` Prashant Bhole
2019-04-16 9:22 ` Quentin Monnet
2019-04-16 8:59 ` [PATCH bpf-next 2/2] tools/bpftool: show btf_id in " Prashant Bhole
1 sibling, 1 reply; 9+ messages in thread
From: Prashant Bhole @ 2019-04-16 8:59 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: Prashant Bhole, Jakub Kicinski, Quentin Monnet, Martin KaFai Lau,
Song Liu, Yonghong Song, Andrii Nakryiko, prashantbhole.linux,
netdev
Let's move the final newline printing in show_map_close_plain() at
the end of the function because it looks correct and consistent with
prog.c. Also let's do related changes for the line which prints
pinned file name.
Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
tools/bpf/bpftool/map.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index e96903078991..cda0f27fa895 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -604,15 +604,16 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
}
close(fd);
- printf("\n");
if (!hash_empty(map_table.table)) {
struct pinned_obj *obj;
hash_for_each_possible(map_table.table, obj, hash, info->id) {
if (obj->id == info->id)
- printf("\tpinned %s\n", obj->path);
+ printf("\n\tpinned %s", obj->path);
}
}
+
+ printf("\n");
return 0;
}
--
2.17.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH bpf-next 2/2] tools/bpftool: show btf_id in map listing
2019-04-16 8:59 [PATCH bpf-next 0/2] show btf id in bpftool map list Prashant Bhole
2019-04-16 8:59 ` [PATCH bpf-next 1/2] tools/bpftool: re-organize newline printing for map listing Prashant Bhole
@ 2019-04-16 8:59 ` Prashant Bhole
2019-04-16 9:22 ` Quentin Monnet
1 sibling, 1 reply; 9+ messages in thread
From: Prashant Bhole @ 2019-04-16 8:59 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: Prashant Bhole, Jakub Kicinski, Quentin Monnet, Martin KaFai Lau,
Song Liu, Yonghong Song, Andrii Nakryiko, prashantbhole.linux,
netdev
Let's print btf id of map similar to the way we are printing it
for programs.
Sample output:
user@test# bpftool map -f
61: lpm_trie flags 0x1
key 20B value 8B max_entries 1 memlock 4096B
133: array name test_btf_id flags 0x0
key 4B value 4B max_entries 4 memlock 4096B
pinned /sys/fs/bpf/test100
btf_id 174
170: array name test_btf_id flags 0x0
key 4B value 4B max_entries 4 memlock 4096B
btf_id 240
Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
---
tools/bpf/bpftool/map.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index cda0f27fa895..de3e4cb32d21 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -550,6 +550,9 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
jsonw_end_array(json_wtr);
}
+ if (info->btf_id)
+ jsonw_int_field(json_wtr, "btf_id", info->btf_id);
+
jsonw_end_object(json_wtr);
return 0;
@@ -613,6 +616,9 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
}
}
+ if (info->btf_id)
+ printf("\n\tbtf_id %d", info->btf_id);
+
printf("\n");
return 0;
}
--
2.17.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH bpf-next 1/2] tools/bpftool: re-organize newline printing for map listing
2019-04-16 8:59 ` [PATCH bpf-next 1/2] tools/bpftool: re-organize newline printing for map listing Prashant Bhole
@ 2019-04-16 9:22 ` Quentin Monnet
2019-04-16 20:30 ` Song Liu
0 siblings, 1 reply; 9+ messages in thread
From: Quentin Monnet @ 2019-04-16 9:22 UTC (permalink / raw)
To: Prashant Bhole, Alexei Starovoitov, Daniel Borkmann
Cc: Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song,
Andrii Nakryiko, prashantbhole.linux, netdev
2019-04-16 17:59 UTC+0900 ~ Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
> Let's move the final newline printing in show_map_close_plain() at
> the end of the function because it looks correct and consistent with
> prog.c. Also let's do related changes for the line which prints
> pinned file name.
>
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
> ---
> tools/bpf/bpftool/map.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index e96903078991..cda0f27fa895 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -604,15 +604,16 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
> }
> close(fd);
>
> - printf("\n");
> if (!hash_empty(map_table.table)) {
> struct pinned_obj *obj;
>
> hash_for_each_possible(map_table.table, obj, hash, info->id) {
> if (obj->id == info->id)
> - printf("\tpinned %s\n", obj->path);
> + printf("\n\tpinned %s", obj->path);
> }
> }
> +
> + printf("\n");
> return 0;
> }
>
>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH bpf-next 2/2] tools/bpftool: show btf_id in map listing
2019-04-16 8:59 ` [PATCH bpf-next 2/2] tools/bpftool: show btf_id in " Prashant Bhole
@ 2019-04-16 9:22 ` Quentin Monnet
2019-04-16 20:31 ` Song Liu
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Quentin Monnet @ 2019-04-16 9:22 UTC (permalink / raw)
To: Prashant Bhole, Alexei Starovoitov, Daniel Borkmann
Cc: Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song,
Andrii Nakryiko, prashantbhole.linux, netdev
2019-04-16 17:59 UTC+0900 ~ Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
> Let's print btf id of map similar to the way we are printing it
> for programs.
>
> Sample output:
> user@test# bpftool map -f
> 61: lpm_trie flags 0x1
> key 20B value 8B max_entries 1 memlock 4096B
> 133: array name test_btf_id flags 0x0
> key 4B value 4B max_entries 4 memlock 4096B
> pinned /sys/fs/bpf/test100
> btf_id 174
> 170: array name test_btf_id flags 0x0
> key 4B value 4B max_entries 4 memlock 4096B
> btf_id 240
>
> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
> ---
> tools/bpf/bpftool/map.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index cda0f27fa895..de3e4cb32d21 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -550,6 +550,9 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
> jsonw_end_array(json_wtr);
> }
>
> + if (info->btf_id)
> + jsonw_int_field(json_wtr, "btf_id", info->btf_id);
> +
Just as a note, if you want to have things more consistent with prog.c,
you could print the btf_id _before_ the paths of pinned maps in JSON,
since this is what you did for programs.
> jsonw_end_object(json_wtr);
>
> return 0;
> @@ -613,6 +616,9 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
> }
> }
>
> + if (info->btf_id)
> + printf("\n\tbtf_id %d", info->btf_id);
> +
> printf("\n");
> return 0;
> }
>
Looks good to me, thank you!
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH bpf-next 1/2] tools/bpftool: re-organize newline printing for map listing
2019-04-16 9:22 ` Quentin Monnet
@ 2019-04-16 20:30 ` Song Liu
0 siblings, 0 replies; 9+ messages in thread
From: Song Liu @ 2019-04-16 20:30 UTC (permalink / raw)
To: Quentin Monnet
Cc: Prashant Bhole, Alexei Starovoitov, Daniel Borkmann,
Jakub Kicinski, Martin Lau, Yonghong Song, Andrii Nakryiko,
prashantbhole.linux, netdev
> On Apr 16, 2019, at 2:22 AM, Quentin Monnet <quentin.monnet@netronome.com> wrote:
>
> 2019-04-16 17:59 UTC+0900 ~ Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
>> Let's move the final newline printing in show_map_close_plain() at
>> the end of the function because it looks correct and consistent with
>> prog.c. Also let's do related changes for the line which prints
>> pinned file name.
>> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Acked-by: Song Liu <songliubraving@fb.com>
>> ---
>> tools/bpf/bpftool/map.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
>> index e96903078991..cda0f27fa895 100644
>> --- a/tools/bpf/bpftool/map.c
>> +++ b/tools/bpf/bpftool/map.c
>> @@ -604,15 +604,16 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
>> }
>> close(fd);
>> - printf("\n");
>> if (!hash_empty(map_table.table)) {
>> struct pinned_obj *obj;
>> hash_for_each_possible(map_table.table, obj, hash, info->id) {
>> if (obj->id == info->id)
>> - printf("\tpinned %s\n", obj->path);
>> + printf("\n\tpinned %s", obj->path);
>> }
>> }
>> +
>> + printf("\n");
>> return 0;
>> }
>>
>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
> Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH bpf-next 2/2] tools/bpftool: show btf_id in map listing
2019-04-16 9:22 ` Quentin Monnet
@ 2019-04-16 20:31 ` Song Liu
2019-04-16 21:36 ` Jakub Kicinski
2019-04-16 23:52 ` Prashant Bhole
2 siblings, 0 replies; 9+ messages in thread
From: Song Liu @ 2019-04-16 20:31 UTC (permalink / raw)
To: Quentin Monnet
Cc: Prashant Bhole, Alexei Starovoitov, Daniel Borkmann,
Jakub Kicinski, Martin Lau, Yonghong Song, Andrii Nakryiko,
prashantbhole.linux, netdev
> On Apr 16, 2019, at 2:22 AM, Quentin Monnet <quentin.monnet@netronome.com> wrote:
>
> 2019-04-16 17:59 UTC+0900 ~ Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
>> Let's print btf id of map similar to the way we are printing it
>> for programs.
>> Sample output:
>> user@test# bpftool map -f
>> 61: lpm_trie flags 0x1
>> key 20B value 8B max_entries 1 memlock 4096B
>> 133: array name test_btf_id flags 0x0
>> key 4B value 4B max_entries 4 memlock 4096B
>> pinned /sys/fs/bpf/test100
>> btf_id 174
>> 170: array name test_btf_id flags 0x0
>> key 4B value 4B max_entries 4 memlock 4096B
>> btf_id 240
>> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
>> ---
>> tools/bpf/bpftool/map.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
>> index cda0f27fa895..de3e4cb32d21 100644
>> --- a/tools/bpf/bpftool/map.c
>> +++ b/tools/bpf/bpftool/map.c
>> @@ -550,6 +550,9 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
>> jsonw_end_array(json_wtr);
>> }
>> + if (info->btf_id)
>> + jsonw_int_field(json_wtr, "btf_id", info->btf_id);
>> +
>
> Just as a note, if you want to have things more consistent with prog.c, you could print the btf_id _before_ the paths of pinned maps in JSON, since this is what you did for programs.
>
>> jsonw_end_object(json_wtr);
>> return 0;
>> @@ -613,6 +616,9 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
>> }
>> }
>> + if (info->btf_id)
>> + printf("\n\tbtf_id %d", info->btf_id);
>> +
>> printf("\n");
>> return 0;
>> }
>
> Looks good to me, thank you!
>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Song Liu <songliubraving@fb.com>
Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH bpf-next 2/2] tools/bpftool: show btf_id in map listing
2019-04-16 9:22 ` Quentin Monnet
2019-04-16 20:31 ` Song Liu
@ 2019-04-16 21:36 ` Jakub Kicinski
2019-04-16 23:52 ` Prashant Bhole
2 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2019-04-16 21:36 UTC (permalink / raw)
To: Quentin Monnet
Cc: Prashant Bhole, Alexei Starovoitov, Daniel Borkmann,
Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
prashantbhole.linux, netdev
On Tue, 16 Apr 2019 10:22:15 +0100, Quentin Monnet wrote:
> > diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> > index cda0f27fa895..de3e4cb32d21 100644
> > --- a/tools/bpf/bpftool/map.c
> > +++ b/tools/bpf/bpftool/map.c
> > @@ -550,6 +550,9 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
> > jsonw_end_array(json_wtr);
> > }
> >
> > + if (info->btf_id)
> > + jsonw_int_field(json_wtr, "btf_id", info->btf_id);
> > +
>
> Just as a note, if you want to have things more consistent with prog.c,
> you could print the btf_id _before_ the paths of pinned maps in JSON,
> since this is what you did for programs.
+1, otherwise:
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
for both patches, thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH bpf-next 2/2] tools/bpftool: show btf_id in map listing
2019-04-16 9:22 ` Quentin Monnet
2019-04-16 20:31 ` Song Liu
2019-04-16 21:36 ` Jakub Kicinski
@ 2019-04-16 23:52 ` Prashant Bhole
2 siblings, 0 replies; 9+ messages in thread
From: Prashant Bhole @ 2019-04-16 23:52 UTC (permalink / raw)
To: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann
Cc: Jakub Kicinski, Martin KaFai Lau, Song Liu, Yonghong Song,
Andrii Nakryiko, prashantbhole.linux, netdev
On 4/16/2019 6:22 PM, Quentin Monnet wrote:
> 2019-04-16 17:59 UTC+0900 ~ Prashant Bhole
> <bhole_prashant_q7@lab.ntt.co.jp>
>> Let's print btf id of map similar to the way we are printing it
>> for programs.
>>
>> Sample output:
>> user@test# bpftool map -f
>> 61: lpm_trie flags 0x1
>> key 20B value 8B max_entries 1 memlock 4096B
>> 133: array name test_btf_id flags 0x0
>> key 4B value 4B max_entries 4 memlock 4096B
>> pinned /sys/fs/bpf/test100
>> btf_id 174
>> 170: array name test_btf_id flags 0x0
>> key 4B value 4B max_entries 4 memlock 4096B
>> btf_id 240
>>
>> Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
>> ---
>> tools/bpf/bpftool/map.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
>> index cda0f27fa895..de3e4cb32d21 100644
>> --- a/tools/bpf/bpftool/map.c
>> +++ b/tools/bpf/bpftool/map.c
>> @@ -550,6 +550,9 @@ static int show_map_close_json(int fd, struct
>> bpf_map_info *info)
>> jsonw_end_array(json_wtr);
>> }
>> + if (info->btf_id)
>> + jsonw_int_field(json_wtr, "btf_id", info->btf_id);
>> +
>
> Just as a note, if you want to have things more consistent with prog.c,
> you could print the btf_id _before_ the paths of pinned maps in JSON,
> since this is what you did for programs.
Ok. I will send v2 with these changes soon. Thanks!
- Prashant
>
>> jsonw_end_object(json_wtr);
>> return 0;
>> @@ -613,6 +616,9 @@ static int show_map_close_plain(int fd, struct
>> bpf_map_info *info)
>> }
>> }
>> + if (info->btf_id)
>> + printf("\n\tbtf_id %d", info->btf_id);
>> +
>> printf("\n");
>> return 0;
>> }
>>
>
> Looks good to me, thank you!
>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-04-16 23:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16 8:59 [PATCH bpf-next 0/2] show btf id in bpftool map list Prashant Bhole
2019-04-16 8:59 ` [PATCH bpf-next 1/2] tools/bpftool: re-organize newline printing for map listing Prashant Bhole
2019-04-16 9:22 ` Quentin Monnet
2019-04-16 20:30 ` Song Liu
2019-04-16 8:59 ` [PATCH bpf-next 2/2] tools/bpftool: show btf_id in " Prashant Bhole
2019-04-16 9:22 ` Quentin Monnet
2019-04-16 20:31 ` Song Liu
2019-04-16 21:36 ` Jakub Kicinski
2019-04-16 23:52 ` Prashant Bhole
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.