FILE
tailcall_bpf2bpf_hierarchy1.c
File preview with syntax highlighting.
linux-6.19.14/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy1.c
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/bpf.h> 3#include <bpf/bpf_helpers.h> 4#include "bpf_legacy.h" 5#include "bpf_test_utils.h" 6 7struct { 8 __uint(type, BPF_MAP_TYPE_PROG_ARRAY); 9 __uint(max_entries, 1); 10 __uint(key_size, sizeof(__u32)); 11 __uint(value_size, sizeof(__u32)); 12} jmp_table SEC(".maps"); 13 14int count = 0; 15 16static __noinline 17int subprog_tail(struct __sk_buff *skb) 18{ 19 bpf_tail_call_static(skb, &jmp_table, 0); 20 return 0; 21} 22 23SEC("tc") 24int entry(struct __sk_buff *skb) 25{ 26 int ret = 1; 27 28 clobber_regs_stack(); 29 30 count++; 31 subprog_tail(skb); 32 subprog_tail(skb); 33 34 return ret; 35} 36 37char __license[] SEC("license") = "GPL";
~/
Read-only file preview.