xref: /linux/tools/testing/selftests/bpf/progs/changes_pkt_data.c (revision cf8b876363da4fccdcc4ba209d4d098ec0f1ffac)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 __noinline
7 long changes_pkt_data(struct __sk_buff *sk, __u32 len)
8 {
9 	return bpf_skb_pull_data(sk, len);
10 }
11 
12 __noinline __weak
13 long does_not_change_pkt_data(struct __sk_buff *sk, __u32 len)
14 {
15 	return 0;
16 }
17 
18 SEC("tc")
19 int dummy(struct __sk_buff *sk)
20 {
21 	changes_pkt_data(sk, 0);
22 	does_not_change_pkt_data(sk, 0);
23 	return 0;
24 }
25 
26 char _license[] SEC("license") = "GPL";
27