xref: /linux/tools/testing/selftests/bpf/progs/test_global_func7.c (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (c) 2020 Facebook */
3 #include <stddef.h>
4 #include <linux/bpf.h>
5 #include <bpf/bpf_helpers.h>
6 #include "bpf_misc.h"
7 
8 __attribute__ ((noinline))
foo(struct __sk_buff * skb)9 void foo(struct __sk_buff *skb)
10 {
11 	skb->tc_index = 0;
12 }
13 
14 SEC("tc")
15 __failure __msg("foo() doesn't return scalar")
global_func7(struct __sk_buff * skb)16 int global_func7(struct __sk_buff *skb)
17 {
18 	foo(skb);
19 	return 0;
20 }
21