mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
selftests/bpf: remove last tests with legacy BPF map definitions
Libbpf 1.0 stops support legacy-style BPF map definitions. Selftests has been migrated away from using legacy BPF map definitions except for two selftests, to make sure that legacy functionality still worked in pre-1.0 libbpf. Now it's time to let those tests go as libbpf 1.0 is imminent. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20220627211527.2245459-14-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
450b167fb9
commit
31e4272197
4 changed files with 0 additions and 79 deletions
|
@ -2,15 +2,6 @@
|
||||||
#ifndef __BPF_LEGACY__
|
#ifndef __BPF_LEGACY__
|
||||||
#define __BPF_LEGACY__
|
#define __BPF_LEGACY__
|
||||||
|
|
||||||
#define BPF_ANNOTATE_KV_PAIR(name, type_key, type_val) \
|
|
||||||
struct ____btf_map_##name { \
|
|
||||||
type_key key; \
|
|
||||||
type_val value; \
|
|
||||||
}; \
|
|
||||||
struct ____btf_map_##name \
|
|
||||||
__attribute__ ((section(".maps." #name), used)) \
|
|
||||||
____btf_map_##name = { }
|
|
||||||
|
|
||||||
/* llvm builtin functions that eBPF C program may use to
|
/* llvm builtin functions that eBPF C program may use to
|
||||||
* emit BPF_LD_ABS and BPF_LD_IND instructions
|
* emit BPF_LD_ABS and BPF_LD_IND instructions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4651,7 +4651,6 @@ struct btf_file_test {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct btf_file_test file_tests[] = {
|
static struct btf_file_test file_tests[] = {
|
||||||
{ .file = "test_btf_haskv.o", },
|
|
||||||
{ .file = "test_btf_newkv.o", },
|
{ .file = "test_btf_newkv.o", },
|
||||||
{ .file = "test_btf_nokv.o", .btf_kv_notfound = true, },
|
{ .file = "test_btf_nokv.o", .btf_kv_notfound = true, },
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0 */
|
|
||||||
/* Copyright (c) 2018 Facebook */
|
|
||||||
#include <linux/bpf.h>
|
|
||||||
#include <bpf/bpf_helpers.h>
|
|
||||||
#include "bpf_legacy.h"
|
|
||||||
|
|
||||||
struct ipv_counts {
|
|
||||||
unsigned int v4;
|
|
||||||
unsigned int v6;
|
|
||||||
};
|
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
struct bpf_map_def SEC("maps") btf_map = {
|
|
||||||
.type = BPF_MAP_TYPE_ARRAY,
|
|
||||||
.key_size = sizeof(int),
|
|
||||||
.value_size = sizeof(struct ipv_counts),
|
|
||||||
.max_entries = 4,
|
|
||||||
};
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
BPF_ANNOTATE_KV_PAIR(btf_map, int, struct ipv_counts);
|
|
||||||
|
|
||||||
__attribute__((noinline))
|
|
||||||
int test_long_fname_2(void)
|
|
||||||
{
|
|
||||||
struct ipv_counts *counts;
|
|
||||||
int key = 0;
|
|
||||||
|
|
||||||
counts = bpf_map_lookup_elem(&btf_map, &key);
|
|
||||||
if (!counts)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
counts->v6++;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((noinline))
|
|
||||||
int test_long_fname_1(void)
|
|
||||||
{
|
|
||||||
return test_long_fname_2();
|
|
||||||
}
|
|
||||||
|
|
||||||
SEC("dummy_tracepoint")
|
|
||||||
int _dummy_tracepoint(void *arg)
|
|
||||||
{
|
|
||||||
return test_long_fname_1();
|
|
||||||
}
|
|
||||||
|
|
||||||
char _license[] SEC("license") = "GPL";
|
|
|
@ -9,19 +9,6 @@ struct ipv_counts {
|
||||||
unsigned int v6;
|
unsigned int v6;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
/* just to validate we can handle maps in multiple sections */
|
|
||||||
struct bpf_map_def SEC("maps") btf_map_legacy = {
|
|
||||||
.type = BPF_MAP_TYPE_ARRAY,
|
|
||||||
.key_size = sizeof(int),
|
|
||||||
.value_size = sizeof(long long),
|
|
||||||
.max_entries = 4,
|
|
||||||
};
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
BPF_ANNOTATE_KV_PAIR(btf_map_legacy, int, struct ipv_counts);
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
__uint(type, BPF_MAP_TYPE_ARRAY);
|
__uint(type, BPF_MAP_TYPE_ARRAY);
|
||||||
__uint(max_entries, 4);
|
__uint(max_entries, 4);
|
||||||
|
@ -41,11 +28,6 @@ int test_long_fname_2(void)
|
||||||
|
|
||||||
counts->v6++;
|
counts->v6++;
|
||||||
|
|
||||||
/* just verify we can reference both maps */
|
|
||||||
counts = bpf_map_lookup_elem(&btf_map_legacy, &key);
|
|
||||||
if (!counts)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue