brintos

brintos / linux-shallow public Read only

0
0
Text · 606 B · c87f9ca Raw
36 lines · c
1// SPDX-License-Identifier: GPL-2.02/* 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 __noinline18int 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";36