summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/test_xdp_noinline.c
diff options
context:
space:
mode:
authorDaniel Borkmann2019-07-05 22:52:26 +0200
committerDaniel Borkmann2019-07-05 22:52:27 +0200
commite232cb6ff75bbfdae86e01ada24ead7528dbebe4 (patch)
treedcb5097948742ffc5be049ae008120ec7a18c522 /tools/testing/selftests/bpf/progs/test_xdp_noinline.c
parentMerge branch 'bpf-libbpf-link-trace' (diff)
parentselftests/bpf: convert legacy BPF maps to BTF-defined ones (diff)
downloadkernel-qcow2-linux-e232cb6ff75bbfdae86e01ada24ead7528dbebe4.tar.gz
kernel-qcow2-linux-e232cb6ff75bbfdae86e01ada24ead7528dbebe4.tar.xz
kernel-qcow2-linux-e232cb6ff75bbfdae86e01ada24ead7528dbebe4.zip
Merge branch 'bpf-libbpf-int-btf-map'
Andrii Nakryiko says: ==================== This patch set implements an update to how BTF-defined maps are specified. The change is in how integer attributes, e.g., type, max_entries, map_flags, are specified: now they are captured as part of map definition struct's BTF type information (using array dimension), eliminating the need for compile-time data initialization and keeping all the metadata in one place. All existing selftests that were using BTF-defined maps are updated, along with some other selftests, that were switched to new syntax. v4->v5: - revert sample_map_ret0.c, which is loaded with iproute2 (kernel test robot); v3->v4: - add acks; - fix int -> uint type in commit message; v2->v3: - rename __int into __uint (Yonghong); v1->v2: - split bpf_helpers.h change from libbpf change (Song). ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_xdp_noinline.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_xdp_noinline.c81
1 files changed, 31 insertions, 50 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_xdp_noinline.c b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c
index d2eddb5553d1..dad8a7e33eaa 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp_noinline.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c
@@ -164,66 +164,47 @@ struct lb_stats {
};
struct {
- __u32 type;
- __u32 max_entries;
- struct vip_definition *key;
- struct vip_meta *value;
-} vip_map SEC(".maps") = {
- .type = BPF_MAP_TYPE_HASH,
- .max_entries = 512,
-};
+ __uint(type, BPF_MAP_TYPE_HASH);
+ __uint(max_entries, 512);
+ __type(key, struct vip_definition);
+ __type(value, struct vip_meta);
+} vip_map SEC(".maps");
struct {
- __u32 type;
- __u32 max_entries;
- __u32 map_flags;
- struct flow_key *key;
- struct real_pos_lru *value;
-} lru_cache SEC(".maps") = {
- .type = BPF_MAP_TYPE_LRU_HASH,
- .max_entries = 300,
- .map_flags = 1U << 1,
-};
+ __uint(type, BPF_MAP_TYPE_LRU_HASH);
+ __uint(max_entries, 300);
+ __uint(map_flags, 1U << 1);
+ __type(key, struct flow_key);
+ __type(value, struct real_pos_lru);
+} lru_cache SEC(".maps");
struct {
- __u32 type;
- __u32 max_entries;
- __u32 *key;
- __u32 *value;
-} ch_rings SEC(".maps") = {
- .type = BPF_MAP_TYPE_ARRAY,
- .max_entries = 12 * 655,
-};
+ __uint(type, BPF_MAP_TYPE_ARRAY);
+ __uint(max_entries, 12 * 655);
+ __type(key, __u32);
+ __type(value, __u32);
+} ch_rings SEC(".maps");
struct {
- __u32 type;
- __u32 max_entries;
- __u32 *key;
- struct real_definition *value;
-} reals SEC(".maps") = {
- .type = BPF_MAP_TYPE_ARRAY,
- .max_entries = 40,
-};
+ __uint(type, BPF_MAP_TYPE_ARRAY);
+ __uint(max_entries, 40);
+ __type(key, __u32);
+ __type(value, struct real_definition);
+} reals SEC(".maps");
struct {
- __u32 type;
- __u32 max_entries;
- __u32 *key;
- struct lb_stats *value;
-} stats SEC(".maps") = {
- .type = BPF_MAP_TYPE_PERCPU_ARRAY,
- .max_entries = 515,
-};
+ __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
+ __uint(max_entries, 515);
+ __type(key, __u32);
+ __type(value, struct lb_stats);
+} stats SEC(".maps");
struct {
- __u32 type;
- __u32 max_entries;
- __u32 *key;
- struct ctl_value *value;
-} ctl_array SEC(".maps") = {
- .type = BPF_MAP_TYPE_ARRAY,
- .max_entries = 16,
-};
+ __uint(type, BPF_MAP_TYPE_ARRAY);
+ __uint(max_entries, 16);
+ __type(key, __u32);
+ __type(value, struct ctl_value);
+} ctl_array SEC(".maps");
struct eth_hdr {
unsigned char eth_dest[6];