From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yonghong Song Subject: Re: [PATCH bpf-next] bpf: enable btf for use in all maps Date: Thu, 9 Aug 2018 13:50:57 -0700 Message-ID: References: <20180809194220.17484-1-daniel@iogearbox.net> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: To: Daniel Borkmann , Return-path: Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:55138 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726744AbeHIXSL (ORCPT ); Thu, 9 Aug 2018 19:18:11 -0400 In-Reply-To: <20180809194220.17484-1-daniel@iogearbox.net> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 8/9/18 12:42 PM, Daniel Borkmann wrote: > Commit a26ca7c982cb ("bpf: btf: Add pretty print support to > the basic arraymap") enabled support for BTF and dumping via > BPF fs for arraymap. However, both can be decoupled from each > other such that all BPF maps can be supported for attaching > BTF key/value information, while not all maps necessarily > need to dump via map_seq_show_elem() callback. > > The check in array_map_check_btf() can be generalized as > ultimatively the key and value size is the only contraint > that needs to match for the map. The fact that the key needs > to be of type int is optional; it could be any data type as > long as it matches the 4 byte key size, just like hash table > key or others could be of any data type as well. > > Minimal example of a hash table dump which then works out > of the box for bpftool: > > # bpftool map dump id 19 > [{ > "key": { > "": { > "vip": 0, > "vipv6": [] > }, > "port": 0, > "family": 0, > "proto": 0 > }, > "value": { > "flags": 0, > "vip_num": 0 > } > } > ] > > Signed-off-by: Daniel Borkmann > Cc: Yonghong Song LGTM. Thanks! Acked-by: Yonghong Song