ext4: fix some nonstandard indentation in extents.c
[linux/fpc-iii.git] / samples / bpf / xdpsock_kern.c
bloba06177c262cd691d7682e8c694b5b691cda330a5
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/bpf.h>
3 #include "bpf_helpers.h"
4 #include "xdpsock.h"
6 /* This XDP program is only needed for the XDP_SHARED_UMEM mode.
7 * If you do not use this mode, libbpf can supply an XDP program for you.
8 */
10 struct {
11 __uint(type, BPF_MAP_TYPE_XSKMAP);
12 __uint(max_entries, MAX_SOCKS);
13 __uint(key_size, sizeof(int));
14 __uint(value_size, sizeof(int));
15 } xsks_map SEC(".maps");
17 static unsigned int rr;
19 SEC("xdp_sock") int xdp_sock_prog(struct xdp_md *ctx)
21 rr = (rr + 1) & (MAX_SOCKS - 1);
23 return bpf_redirect_map(&xsks_map, rr, XDP_DROP);