diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-06-28 14:41:37 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-07-01 01:01:50 +0200 |
commit | 9aba36139a5f9ee1d11a60d0a3a90944b8d56385 (patch) | |
tree | 5af0a8406c86a3b9c2e494ab1db58bb4456892ed /tools/lib/bpf/libbpf.c | |
parent | d9b683d7464ec9e8298d82c00b9033c96e27a187 (diff) | |
download | linux-9aba36139a5f9ee1d11a60d0a3a90944b8d56385.tar.gz linux-9aba36139a5f9ee1d11a60d0a3a90944b8d56385.tar.bz2 linux-9aba36139a5f9ee1d11a60d0a3a90944b8d56385.zip |
tools: libbpf: allow setting ifindex for programs and maps
Users of bpf_object__open()/bpf_object__load() APIs may want to
load the programs and maps onto a device for offload. Allow
setting ifindex on those sub-objects.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r-- | tools/lib/bpf/libbpf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index a1491e95edd0..7bc02d93e277 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1896,6 +1896,11 @@ void *bpf_program__priv(struct bpf_program *prog) return prog ? prog->priv : ERR_PTR(-EINVAL); } +void bpf_program__set_ifindex(struct bpf_program *prog, __u32 ifindex) +{ + prog->prog_ifindex = ifindex; +} + const char *bpf_program__title(struct bpf_program *prog, bool needs_copy) { const char *title; @@ -2122,6 +2127,11 @@ void *bpf_map__priv(struct bpf_map *map) return map ? map->priv : ERR_PTR(-EINVAL); } +void bpf_map__set_ifindex(struct bpf_map *map, __u32 ifindex) +{ + map->map_ifindex = ifindex; +} + struct bpf_map * bpf_map__next(struct bpf_map *prev, struct bpf_object *obj) { |