brintos

brintos / linux-shallow public Read only

0
0
Text · 607 B · 50768ed Raw
25 lines · c
1// SPDX-License-Identifier: GPL-2.02/* Converted from tools/testing/selftests/bpf/verifier/xdp.c */3 4#include <linux/bpf.h>5#include <bpf/bpf_helpers.h>6#include "bpf_misc.h"7 8SEC("xdp")9__description("XDP, using ifindex from netdev")10__success __retval(1)11__naked void xdp_using_ifindex_from_netdev(void)12{13	asm volatile ("					\14	r0 = 0;						\15	r2 = *(u32*)(r1 + %[xdp_md_ingress_ifindex]);	\16	if r2 < 1 goto l0_%=;				\17	r0 = 1;						\18l0_%=:	exit;						\19"	:20	: __imm_const(xdp_md_ingress_ifindex, offsetof(struct xdp_md, ingress_ifindex))21	: __clobber_all);22}23 24char _license[] SEC("license") = "GPL";25