1
linux/kernel/bpf
Alexei Starovoitov 0f8e4bd8a1 bpf: add hashtable type of eBPF maps
add new map type BPF_MAP_TYPE_HASH and its implementation

- maps are created/destroyed by userspace. Both userspace and eBPF programs
  can lookup/update/delete elements from the map

- eBPF programs can be called in_irq(), so use spin_lock_irqsave() mechanism
  for concurrent updates

- key/value are opaque range of bytes (aligned to 8 bytes)

- user space provides 3 configuration attributes via BPF syscall:
  key_size, value_size, max_entries

- map takes care of allocating/freeing key/value pairs

- map_update_elem() must fail to insert new element when max_entries
  limit is reached to make sure that eBPF programs cannot exhaust memory

- map_update_elem() replaces elements in an atomic way

- optimized for speed of lookup() which can be called multiple times from
  eBPF program which itself is triggered by high volume of events
  . in the future JIT compiler may recognize lookup() call and optimize it
    further, since key_size is constant for life of eBPF program

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-11-18 13:43:25 -05:00
..
core.c bpf: split eBPF out of NET 2014-10-27 19:09:59 -04:00
hashtab.c bpf: add hashtable type of eBPF maps 2014-11-18 13:43:25 -05:00
Makefile bpf: add hashtable type of eBPF maps 2014-11-18 13:43:25 -05:00
syscall.c bpf: add 'flags' attribute to BPF_MAP_UPDATE_ELEM command 2014-11-18 13:43:25 -05:00
test_stub.c bpf: mini eBPF library, test stubs and verifier testsuite 2014-09-26 15:05:15 -04:00
verifier.c bpf: reduce verifier memory consumption 2014-10-30 15:44:37 -04:00