diff options
author | Alexei Starovoitov <ast@fb.com> | 2016-08-11 18:17:16 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-08-12 21:56:18 -0700 |
commit | 6841de8b0d03cc9a4e0e928453623c13ee754f77 (patch) | |
tree | 2a35b03ce74494ad8772ed66f4e32a1e3a25a383 /samples/bpf | |
parent | 03ff4979345110d30ecdeab2ae9cb2f451f158bf (diff) | |
download | linux-6841de8b0d03cc9a4e0e928453623c13ee754f77.tar.gz linux-6841de8b0d03cc9a4e0e928453623c13ee754f77.tar.bz2 linux-6841de8b0d03cc9a4e0e928453623c13ee754f77.zip |
bpf: allow helpers access the packet directly
The helper functions like bpf_map_lookup_elem(map, key) were only
allowing 'key' to point to the initialized stack area.
That is causing performance degradation when programs need to process
millions of packets per second and need to copy contents of the packet
into the stack just to pass the stack pointer into the lookup() function.
Allow such helpers read from the packet directly.
All helpers that expect ARG_PTR_TO_MAP_KEY, ARG_PTR_TO_MAP_VALUE,
ARG_PTR_TO_STACK assume byte aligned pointer, so no alignment concerns,
only need to check that helper will not be accessing beyond
the packet range verified by the prior 'if (ptr < data_end)' condition.
For now allow this feature for XDP programs only. Later it can be
relaxed for the clsact programs as well.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf')
0 files changed, 0 insertions, 0 deletions