* [PATCH iproute2-next] bpf: don't offload perf array maps
@ 2018-05-05 0:37 Jakub Kicinski
2018-05-05 0:48 ` Daniel Borkmann
2018-05-05 18:23 ` David Ahern
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2018-05-05 0:37 UTC (permalink / raw)
To: dsahern, alexei.starovoitov, daniel
Cc: stephen, netdev, oss-drivers, Jakub Kicinski
Perf arrays are handled specially by the kernel, don't request
offload even when used by an offloaded program.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
lib/bpf.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/bpf.c b/lib/bpf.c
index d9a406bf55f2..4e26c0df76c5 100644
--- a/lib/bpf.c
+++ b/lib/bpf.c
@@ -97,6 +97,11 @@ static const struct bpf_prog_meta __bpf_prog_meta[] = {
},
};
+static bool bpf_map_offload_neutral(enum bpf_map_type type)
+{
+ return type == BPF_MAP_TYPE_PERF_EVENT_ARRAY;
+}
+
static const char *bpf_prog_to_subdir(enum bpf_prog_type type)
{
assert(type < ARRAY_SIZE(__bpf_prog_meta) &&
@@ -1594,7 +1599,7 @@ static int bpf_map_attach(const char *name, struct bpf_elf_ctx *ctx,
const struct bpf_elf_map *map, struct bpf_map_ext *ext,
int *have_map_in_map)
{
- int fd, ret, map_inner_fd = 0;
+ int fd, ifindex, ret, map_inner_fd = 0;
fd = bpf_probe_pinned(name, ctx, map->pinning);
if (fd > 0) {
@@ -1631,10 +1636,10 @@ static int bpf_map_attach(const char *name, struct bpf_elf_ctx *ctx,
}
}
+ ifindex = bpf_map_offload_neutral(map->type) ? 0 : ctx->ifindex;
errno = 0;
fd = bpf_map_create(map->type, map->size_key, map->size_value,
- map->max_elem, map->flags, map_inner_fd,
- ctx->ifindex);
+ map->max_elem, map->flags, map_inner_fd, ifindex);
if (fd < 0 || ctx->verbose) {
bpf_map_report(fd, name, map, ctx, map_inner_fd);
--
2.17.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH iproute2-next] bpf: don't offload perf array maps
2018-05-05 0:37 [PATCH iproute2-next] bpf: don't offload perf array maps Jakub Kicinski
@ 2018-05-05 0:48 ` Daniel Borkmann
2018-05-05 18:23 ` David Ahern
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2018-05-05 0:48 UTC (permalink / raw)
To: Jakub Kicinski, dsahern, alexei.starovoitov; +Cc: stephen, netdev, oss-drivers
On 05/05/2018 02:37 AM, Jakub Kicinski wrote:
> Perf arrays are handled specially by the kernel, don't request
> offload even when used by an offloaded program.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iproute2-next] bpf: don't offload perf array maps
2018-05-05 0:37 [PATCH iproute2-next] bpf: don't offload perf array maps Jakub Kicinski
2018-05-05 0:48 ` Daniel Borkmann
@ 2018-05-05 18:23 ` David Ahern
1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2018-05-05 18:23 UTC (permalink / raw)
To: Jakub Kicinski, alexei.starovoitov, daniel; +Cc: stephen, netdev, oss-drivers
On 5/4/18 6:37 PM, Jakub Kicinski wrote:
> Perf arrays are handled specially by the kernel, don't request
> offload even when used by an offloaded program.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
> ---
> lib/bpf.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
applied to iproute2-next.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-05 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-05 0:37 [PATCH iproute2-next] bpf: don't offload perf array maps Jakub Kicinski
2018-05-05 0:48 ` Daniel Borkmann
2018-05-05 18:23 ` David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox