xref: /linux/tools/testing/selftests/bpf/progs/tc_bpf2bpf.c (revision 643e2e259c2b25a2af0ae4c23c6e16586d9fd19c)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 #include "bpf_misc.h"
6 
7 __noinline
8 int subprog_tc(struct __sk_buff *skb)
9 {
10 	int ret = 1;
11 
12 	__sink(skb);
13 	__sink(ret);
14 	/* let verifier know that 'subprog_tc' can change pointers to skb->data */
15 	bpf_skb_change_proto(skb, 0, 0);
16 	return ret;
17 }
18 
19 SEC("tc")
20 int entry_tc(struct __sk_buff *skb)
21 {
22 	return subprog_tc(skb);
23 }
24 
25 char __license[] SEC("license") = "GPL";
26