From: Stanislav Fomichev <sdf@google•com>
To: netdev@vger•kernel.org, ast@kernel•org, daniel@iogearbox•net
Cc: Stanislav Fomichev <sdf@google•com>
Subject: [PATCH bpf-next v3 3/3] bpf: libbpf: don't specify prog name if kernel doesn't support it
Date: Tue, 20 Nov 2018 17:11:21 -0800 [thread overview]
Message-ID: <20181121011121.159355-3-sdf@google.com> (raw)
In-Reply-To: <20181121011121.159355-1-sdf@google.com>
Use recently added capability check.
See commit 23499442c319 ("bpf: libbpf: retry map creation without the
name") for rationale.
Signed-off-by: Stanislav Fomichev <sdf@google•com>
---
tools/lib/bpf/libbpf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index bf45f285d0a0..a080aeff7e2e 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1439,7 +1439,8 @@ load_program(struct bpf_program *prog, struct bpf_insn *insns, int insns_cnt,
memset(&load_attr, 0, sizeof(struct bpf_load_program_attr));
load_attr.prog_type = prog->type;
load_attr.expected_attach_type = prog->expected_attach_type;
- load_attr.name = prog->name;
+ if (prog->caps->name)
+ load_attr.name = prog->name;
load_attr.insns = insns;
load_attr.insns_cnt = insns_cnt;
load_attr.license = license;
--
2.19.1.1215.g8438c0b245-goog
next prev parent reply other threads:[~2018-11-21 11:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 1:11 [PATCH bpf-next v3 1/3] bpf, libbpf: introduce bpf_object__probe_caps to test BPF capabilities Stanislav Fomichev
2018-11-21 1:11 ` [PATCH bpf-next v3 2/3] bpf: libbpf: remove map name retry from bpf_create_map_xattr Stanislav Fomichev
2018-11-21 1:11 ` Stanislav Fomichev [this message]
2018-11-21 22:30 ` [PATCH bpf-next v3 1/3] bpf, libbpf: introduce bpf_object__probe_caps to test BPF capabilities Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181121011121.159355-3-sdf@google.com \
--to=sdf@google$(echo .)com \
--cc=ast@kernel$(echo .)org \
--cc=daniel@iogearbox$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox