[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51D30E96-C1A6-488E-97DD-63690F29714A@fb.com>
Date: Tue, 16 Apr 2019 20:31:29 +0000
From: Song Liu <songliubraving@...com>
To: Quentin Monnet <quentin.monnet@...ronome.com>
CC: Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Martin Lau <kafai@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
"prashantbhole.linux@...il.com" <prashantbhole.linux@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next 2/2] tools/bpftool: show btf_id in map listing
> On Apr 16, 2019, at 2:22 AM, Quentin Monnet <quentin.monnet@...ronome.com> wrote:
>
> 2019-04-16 17:59 UTC+0900 ~ Prashant Bhole <bhole_prashant_q7@....ntt.co.jp>
>> Let's print btf id of map similar to the way we are printing it
>> for programs.
>> Sample output:
>> user@...t# 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@....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@...ronome.com>
Acked-by: Song Liu <songliubraving@...com>
Thanks!
Powered by blists - more mailing lists