Commit 8fffa0e3 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov
Browse files

selftests/bpf: Normalize XDP section names in selftests



Convert almost all SEC("xdp_blah") uses to strict SEC("xdp") to comply
with strict libbpf 1.0 logic of exact section name match for XDP program
types. There is only one exception, which is only tested through
iproute2 and defines multiple XDP programs within the same BPF object.
Given iproute2 still works in non-strict libbpf mode and it doesn't have
means to specify XDP programs by its name (not section name/title),
leave that single file alone for now until iproute2 gains lookup by
function/program name.

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarDave Marchevsky <davemarchevsky@fb.com>
Link: https://lore.kernel.org/bpf/20210928161946.2512801-3-andrii@kernel.org
parent 9673268f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ struct {
	__uint(value_size, sizeof(__u32));
} mim_hash SEC(".maps");

SEC("xdp_mimtest")
SEC("xdp")
int xdp_mimtest0(struct xdp_md *ctx)
{
	int value = 123;
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ int check_syncookie_clsact(struct __sk_buff *skb)
	return TC_ACT_OK;
}

SEC("xdp/check_syncookie")
SEC("xdp")
int check_syncookie_xdp(struct xdp_md *ctx)
{
	check_syncookie(ctx, (void *)(long)ctx->data,
+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ static __always_inline int handle_ipv6(struct xdp_md *xdp)
	return XDP_TX;
}

SEC("xdp_tx_iptunnel")
SEC("xdp")
int _xdp_tx_iptunnel(struct xdp_md *xdp)
{
	void *data_end = (void *)(long)xdp->data_end;
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>

SEC("xdp_adjust_tail_grow")
SEC("xdp")
int _xdp_adjust_tail_grow(struct xdp_md *xdp)
{
	void *data_end = (void *)(long)xdp->data_end;
+1 −3
Original line number Diff line number Diff line
@@ -9,9 +9,7 @@
#include <linux/if_ether.h>
#include <bpf/bpf_helpers.h>

int _version SEC("version") = 1;

SEC("xdp_adjust_tail_shrink")
SEC("xdp")
int _xdp_adjust_tail_shrink(struct xdp_md *xdp)
{
	void *data_end = (void *)(long)xdp->data_end;
Loading