Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 29 lines 508 B view raw
1// SPDX-License-Identifier: GPL-2.0 2 3#include "vmlinux.h" 4#include <bpf/bpf_helpers.h> 5#include <bpf/bpf_tracing.h> 6 7SEC("xdp") 8int xdp_devmap(struct xdp_md *ctx) 9{ 10 return ctx->egress_ifindex; 11} 12 13struct { 14 __uint(type, BPF_MAP_TYPE_PROG_ARRAY); 15 __uint(max_entries, 1); 16 __uint(key_size, sizeof(__u32)); 17 __array(values, int (void *)); 18} xdp_map SEC(".maps") = { 19 .values = { 20 [0] = (void *)&xdp_devmap, 21 }, 22}; 23 24SEC("xdp") 25int xdp_entry(struct xdp_md *ctx) 26{ 27 bpf_tail_call(ctx, &xdp_map, 0); 28 return 0; 29}