Fix all selftests to include libbpf header files with the bpf/ prefix, to
be consistent with external users of the library. Also ensure that all
includes of exported libbpf header files (those that are exported on 'make
install' of the library) use bracketed includes instead of quoted.
To not break the build, keep the old include path until everything has been
changed to the new one; a subsequent patch will remove that.
Fixes: 6910d7d386
("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/157952560568.1683545.9649335788846513446.stgit@toke.dk
45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/bpf.h>
|
|
#include <bpf/bpf_helpers.h>
|
|
#include "bpf_trace_helpers.h"
|
|
|
|
struct net_device {
|
|
/* Structure does not need to contain all entries,
|
|
* as "preserve_access_index" will use BTF to fix this...
|
|
*/
|
|
int ifindex;
|
|
} __attribute__((preserve_access_index));
|
|
|
|
struct xdp_rxq_info {
|
|
/* Structure does not need to contain all entries,
|
|
* as "preserve_access_index" will use BTF to fix this...
|
|
*/
|
|
struct net_device *dev;
|
|
__u32 queue_index;
|
|
} __attribute__((preserve_access_index));
|
|
|
|
struct xdp_buff {
|
|
void *data;
|
|
void *data_end;
|
|
void *data_meta;
|
|
void *data_hard_start;
|
|
unsigned long handle;
|
|
struct xdp_rxq_info *rxq;
|
|
} __attribute__((preserve_access_index));
|
|
|
|
__u64 test_result_fentry = 0;
|
|
SEC("fentry/_xdp_tx_iptunnel")
|
|
int BPF_PROG(trace_on_entry, struct xdp_buff *xdp)
|
|
{
|
|
test_result_fentry = xdp->rxq->dev->ifindex;
|
|
return 0;
|
|
}
|
|
|
|
__u64 test_result_fexit = 0;
|
|
SEC("fexit/_xdp_tx_iptunnel")
|
|
int BPF_PROG(trace_on_exit, struct xdp_buff *xdp, int ret)
|
|
{
|
|
test_result_fexit = ret;
|
|
return 0;
|
|
}
|