1*6c1b8cb6SAnton Protopopov // SPDX-License-Identifier: GPL-2.0 2*6c1b8cb6SAnton Protopopov /* Copyright (c) 2023 Isovalent */ 3*6c1b8cb6SAnton Protopopov 4*6c1b8cb6SAnton Protopopov #include "vmlinux.h" 5*6c1b8cb6SAnton Protopopov #include <bpf/bpf_helpers.h> 6*6c1b8cb6SAnton Protopopov #include <bpf/bpf_tracing.h> 7*6c1b8cb6SAnton Protopopov 8*6c1b8cb6SAnton Protopopov __u32 target_id; 9*6c1b8cb6SAnton Protopopov 10*6c1b8cb6SAnton Protopopov __s64 bpf_map_sum_elem_count(struct bpf_map *map) __ksym; 11*6c1b8cb6SAnton Protopopov 12*6c1b8cb6SAnton Protopopov SEC("iter/bpf_map") dump_bpf_map(struct bpf_iter__bpf_map * ctx)13*6c1b8cb6SAnton Protopopovint dump_bpf_map(struct bpf_iter__bpf_map *ctx) 14*6c1b8cb6SAnton Protopopov { 15*6c1b8cb6SAnton Protopopov struct seq_file *seq = ctx->meta->seq; 16*6c1b8cb6SAnton Protopopov struct bpf_map *map = ctx->map; 17*6c1b8cb6SAnton Protopopov 18*6c1b8cb6SAnton Protopopov if (map && map->id == target_id) 19*6c1b8cb6SAnton Protopopov BPF_SEQ_PRINTF(seq, "%lld", bpf_map_sum_elem_count(map)); 20*6c1b8cb6SAnton Protopopov 21*6c1b8cb6SAnton Protopopov return 0; 22*6c1b8cb6SAnton Protopopov } 23*6c1b8cb6SAnton Protopopov 24*6c1b8cb6SAnton Protopopov char _license[] SEC("license") = "GPL"; 25