summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/bpf_helpers.h
diff options
context:
space:
mode:
authorDaniel T. Lee <danieltimlee@gmail.com>2019-10-07 20:21:17 +0300
committerAlexei Starovoitov <ast@kernel.org>2019-10-08 06:22:27 +0300
commit8fdf5b780a148c4a7490c211acad3c01b4dde6ac (patch)
treea7e9a4d1bae271f7eaeafecf501f75355525e2d6 /tools/testing/selftests/bpf/bpf_helpers.h
parent72ccd9200f218a7eb2933a93e69a79a1ac984d83 (diff)
downloadlinux-8fdf5b780a148c4a7490c211acad3c01b4dde6ac.tar.xz
samples: bpf: Add max_pckt_size option at xdp_adjust_tail
Currently, at xdp_adjust_tail_kern.c, MAX_PCKT_SIZE is limited to 600. To make this size flexible, static global variable 'max_pcktsz' is added. By updating new packet size from the user space, xdp_adjust_tail_kern.o will use this value as a new max packet size. This static global variable can be accesible from .data section with bpf_object__find_map* from user space, since it is considered as internal map (accessible with .bss/.data/.rodata suffix). If no '-P <MAX_PCKT_SIZE>' option is used, the size of maximum packet will be 600 as a default. For clarity, change the helper to fetch map from 'bpf_map__next' to 'bpf_object__find_map_fd_by_name'. Also, changed the way to test prog_fd, map_fd from '!= 0' to '< 0', since fd could be 0 when stdin is closed. Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20191007172117.3916-1-danieltimlee@gmail.com
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_helpers.h')
0 files changed, 0 insertions, 0 deletions