linux-stable/tools/bpf/bpftool
Larysa Zaremba f46392ee3d bpftool: Specify XDP Hints ifname when loading program
Add ability to specify a network interface used to resolve XDP hints
kfuncs when loading program through bpftool.

Usage:

  bpftool prog load [...] xdpmeta_dev <ifname>

Writing just 'dev <ifname>' instead of 'xdpmeta_dev' is a very probable
mistake that results in not very descriptive errors,
so 'bpftool prog load [...] dev <ifname>' syntax becomes deprecated,
followed by 'bpftool map create [...] dev <ifname>' for consistency.

Now, to offload program, execute:

  bpftool prog load [...] offload_dev <ifname>

To offload map:

  bpftool map create [...] offload_dev <ifname>

'dev <ifname>' still performs offloading in the commands above, but now
triggers a warning and is excluded from bash completion.

'xdpmeta_dev' and 'offload_dev' are mutually exclusive options, because
'xdpmeta_dev' basically makes a program device-bound without loading it
onto the said device. For now, offloaded programs cannot use XDP hints [0],
but if this changes, using 'offload_dev <ifname>' should cover this case.

  [0] https://lore.kernel.org/bpf/a5a636cc-5b03-686f-4be0-000383b05cfc@linux.dev

Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20230517160103.1088185-1-larysa.zaremba@intel.com
2023-05-23 16:55:06 +02:00
..
bash-completion bpftool: Specify XDP Hints ifname when loading program 2023-05-23 16:55:06 +02:00
Documentation bpftool: Specify XDP Hints ifname when loading program 2023-05-23 16:55:06 +02:00
skeleton bpftool: Add bpf_cookie to link output 2022-03-15 15:07:27 -07:00
.gitignore bpftool: Fix SPDX tag for Makefiles and .gitignore 2021-11-10 09:00:52 -08:00
btf.c bpftool: Use bpf_{btf,link,map,prog}_get_info_by_fd() 2023-02-16 15:32:45 -08:00
btf_dumper.c bpftool: Replace "__fallthrough" by a comment to address merge conflict 2023-04-20 16:38:10 -07:00
cfg.c bpftool: Support printing opcodes and source file references in CFG 2023-04-05 21:27:27 -07:00
cfg.h bpftool: Support printing opcodes and source file references in CFG 2023-04-05 21:27:27 -07:00
cgroup.c bpftool: Use bpf_{btf,link,map,prog}_get_info_by_fd() 2023-02-16 15:32:45 -08:00
common.c bpftool: Support bpffs mountpoint as pin path for prog loadall 2023-05-17 15:58:18 +02:00
feature.c bpftool: JIT limited misreported as negative value on aarch64 2023-05-15 21:14:48 +02:00
gen.c bpftool: clean-up usage of libbpf_get_error() 2022-11-20 16:17:46 -08:00
iter.c bpftool: Support bpffs mountpoint as pin path for prog loadall 2023-05-17 15:58:18 +02:00
jit_disasm.c bpftool: Fix spelling mistake "disasembler" -> "disassembler" 2022-10-26 18:20:22 -07:00
json_writer.c tools: bpftool: json: Fix backslash escape typo in jsonw_puts 2023-03-29 09:48:45 -07:00
json_writer.h tools: bpftool: json: Fix backslash escape typo in jsonw_puts 2023-03-29 09:48:45 -07:00
link.c bpftool: Show target_{obj,btf}_id in tracing link info 2023-05-19 10:06:45 -07:00
main.c bpftool: clean-up usage of libbpf_get_error() 2022-11-20 16:17:46 -08:00
main.h bpftool: Support bpffs mountpoint as pin path for prog loadall 2023-05-17 15:58:18 +02:00
Makefile bpftool: Always disable stack protection for BPF objects 2023-01-13 16:44:21 +01:00
map.c bpftool: Specify XDP Hints ifname when loading program 2023-05-23 16:55:06 +02:00
map_perf_ring.c bpftool: Fix error message of strerror 2022-09-30 15:40:46 -07:00
net.c tools: bpftool: print netfilter link info 2023-04-21 11:34:49 -07:00
netlink_dumper.c
netlink_dumper.h
perf.c bpftool: Define _GNU_SOURCE only once 2022-10-25 10:11:56 -07:00
pids.c libbpf: Hashmap interface update to allow both long and void* keys/values 2022-11-09 20:45:14 -08:00
prog.c bpftool: Specify XDP Hints ifname when loading program 2023-05-23 16:55:06 +02:00
struct_ops.c bpftool: Support bpffs mountpoint as pin path for prog loadall 2023-05-17 15:58:18 +02:00
tracelog.c bpftool, musl compat: Replace sys/fcntl.h by fcntl.h 2022-04-25 23:24:28 +02:00
xlated_dumper.c bpftool: Support printing opcodes and source file references in CFG 2023-04-05 21:27:27 -07:00
xlated_dumper.h bpftool: Support printing opcodes and source file references in CFG 2023-04-05 21:27:27 -07:00