Loading...
Note: File does not exist in v4.6.
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright Leon Hwang */
3
4#include "vmlinux.h"
5#include <bpf/bpf_helpers.h>
6#include <bpf/bpf_tracing.h>
7
8struct {
9 __uint(type, BPF_MAP_TYPE_PROG_ARRAY);
10 __uint(max_entries, 1);
11 __uint(key_size, sizeof(__u32));
12 __uint(value_size, sizeof(__u32));
13} jmp_table SEC(".maps");
14
15int count = 0;
16
17static __noinline
18int subprog_tail(void *ctx)
19{
20 bpf_tail_call_static(ctx, &jmp_table, 0);
21 return 0;
22}
23
24SEC("fentry/dummy")
25int BPF_PROG(fentry, struct sk_buff *skb)
26{
27 count++;
28 subprog_tail(ctx);
29 subprog_tail(ctx);
30
31 return 0;
32}
33
34
35char _license[] SEC("license") = "GPL";