aboutsummaryrefslogtreecommitdiffstats
path: root/samples/bpf/map_perf_test_user.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2017-09-27 14:37:54 -0700
committerDavid S. Miller <davem@davemloft.net>2017-09-29 06:17:05 +0100
commit88cda1c9da02c8aa31e1d5dcf22e8a35cc8c19f2 (patch)
tree5096ddd73981e33a2164606461a45b56a189889c /samples/bpf/map_perf_test_user.c
parentbpf: Add map_name to bpf_map_info (diff)
downloadlinux-dev-88cda1c9da02c8aa31e1d5dcf22e8a35cc8c19f2.tar.xz
linux-dev-88cda1c9da02c8aa31e1d5dcf22e8a35cc8c19f2.zip
bpf: libbpf: Provide basic API support to specify BPF obj name
This patch extends the libbpf to provide API support to allow specifying BPF object name. In tools/lib/bpf/libbpf, the C symbol of the function and the map is used. Regarding section name, all maps are under the same section named "maps". Hence, section name is not a good choice for map's name. To be consistent with map, bpf_prog also follows and uses its function symbol as the prog's name. This patch adds logic to collect function's symbols in libbpf. There is existing codes to collect the map's symbols and no change is needed. The bpf_load_program_name() and bpf_map_create_name() are added to take the name argument. For the other bpf_map_create_xxx() variants, a name argument is directly added to them. In samples/bpf, bpf_load.c in particular, the symbol is also used as the map's name and the map symbols has already been collected in the existing code. For bpf_prog, bpf_load.c does not collect the function symbol name. We can consider to collect them later if there is a need to continue supporting the bpf_load.c. Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Alexei Starovoitov <ast@fb.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--samples/bpf/map_perf_test_user.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c
index a0310fc70057..519d9af4b04a 100644
--- a/samples/bpf/map_perf_test_user.c
+++ b/samples/bpf/map_perf_test_user.c
@@ -137,6 +137,7 @@ static void do_test_lru(enum test_type test, int cpu)
inner_lru_map_fds[cpu] =
bpf_create_map_node(BPF_MAP_TYPE_LRU_HASH,
+ test_map_names[INNER_LRU_HASH_PREALLOC],
sizeof(uint32_t),
sizeof(long),
inner_lru_hash_size, 0,