File tree Expand file tree Collapse file tree 3 files changed +26
-14
lines changed
tools/testing/selftests/bpf Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 39
39
#include "verifier_value_or_null.skel.h"
40
40
#include "verifier_var_off.skel.h"
41
41
#include "verifier_xadd.skel.h"
42
+ #include "verifier_xdp.skel.h"
42
43
43
44
__maybe_unused
44
45
static void run_tests_aux (const char * skel_name , skel_elf_bytes_fn elf_bytes_factory )
@@ -100,3 +101,4 @@ void test_verifier_value(void) { RUN(verifier_value); }
100
101
void test_verifier_value_or_null (void ) { RUN (verifier_value_or_null ); }
101
102
void test_verifier_var_off (void ) { RUN (verifier_var_off ); }
102
103
void test_verifier_xadd (void ) { RUN (verifier_xadd ); }
104
+ void test_verifier_xdp (void ) { RUN (verifier_xdp ); }
Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: GPL-2.0
2
+ /* 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
+
8
+ SEC ("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; \
18
+ l0_%=: exit; \
19
+ " :
20
+ : __imm_const (xdp_md_ingress_ifindex , offsetof(struct xdp_md , ingress_ifindex ))
21
+ : __clobber_all );
22
+ }
23
+
24
+ char _license [] SEC ("license" ) = "GPL" ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments