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 v3.19-rc3 40 lines 1.3 kB view raw
1#ifndef __BPF_HELPERS_H 2#define __BPF_HELPERS_H 3 4/* helper macro to place programs, maps, license in 5 * different sections in elf_bpf file. Section names 6 * are interpreted by elf_bpf loader 7 */ 8#define SEC(NAME) __attribute__((section(NAME), used)) 9 10/* helper functions called from eBPF programs written in C */ 11static void *(*bpf_map_lookup_elem)(void *map, void *key) = 12 (void *) BPF_FUNC_map_lookup_elem; 13static int (*bpf_map_update_elem)(void *map, void *key, void *value, 14 unsigned long long flags) = 15 (void *) BPF_FUNC_map_update_elem; 16static int (*bpf_map_delete_elem)(void *map, void *key) = 17 (void *) BPF_FUNC_map_delete_elem; 18 19/* llvm builtin functions that eBPF C program may use to 20 * emit BPF_LD_ABS and BPF_LD_IND instructions 21 */ 22struct sk_buff; 23unsigned long long load_byte(void *skb, 24 unsigned long long off) asm("llvm.bpf.load.byte"); 25unsigned long long load_half(void *skb, 26 unsigned long long off) asm("llvm.bpf.load.half"); 27unsigned long long load_word(void *skb, 28 unsigned long long off) asm("llvm.bpf.load.word"); 29 30/* a helper structure used by eBPF C program 31 * to describe map attributes to elf_bpf loader 32 */ 33struct bpf_map_def { 34 unsigned int type; 35 unsigned int key_size; 36 unsigned int value_size; 37 unsigned int max_entries; 38}; 39 40#endif