diff options
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
-rw-r--r-- | tools/lib/bpf/libbpf.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 42f31eff5f3f..30992305f4c1 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c | |||
@@ -2154,6 +2154,11 @@ void *bpf_map__priv(struct bpf_map *map) | |||
2154 | return map ? map->priv : ERR_PTR(-EINVAL); | 2154 | return map ? map->priv : ERR_PTR(-EINVAL); |
2155 | } | 2155 | } |
2156 | 2156 | ||
2157 | bool bpf_map__is_offload_neutral(struct bpf_map *map) | ||
2158 | { | ||
2159 | return map->def.type == BPF_MAP_TYPE_PERF_EVENT_ARRAY; | ||
2160 | } | ||
2161 | |||
2157 | void bpf_map__set_ifindex(struct bpf_map *map, __u32 ifindex) | 2162 | void bpf_map__set_ifindex(struct bpf_map *map, __u32 ifindex) |
2158 | { | 2163 | { |
2159 | map->map_ifindex = ifindex; | 2164 | map->map_ifindex = ifindex; |
@@ -2278,7 +2283,8 @@ int bpf_prog_load_xattr(const struct bpf_prog_load_attr *attr, | |||
2278 | } | 2283 | } |
2279 | 2284 | ||
2280 | bpf_map__for_each(map, obj) { | 2285 | bpf_map__for_each(map, obj) { |
2281 | map->map_ifindex = attr->ifindex; | 2286 | if (!bpf_map__is_offload_neutral(map)) |
2287 | map->map_ifindex = attr->ifindex; | ||
2282 | } | 2288 | } |
2283 | 2289 | ||
2284 | if (!first_prog) { | 2290 | if (!first_prog) { |