diff mbox series

[iproute2-next,v2,1/2] libbpf: set kernel_log_level when available

Message ID 20231027085706.25718-2-shung-hsi.yu@suse.com (mailing list archive)
State Accepted
Commit 73284227f7a0078a05d4c9825f972039d80d7c93
Delegated to: David Ahern
Headers show
Series Increase BPF verifier verbosity when in verbose mode | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Shung-Hsi Yu Oct. 27, 2023, 8:57 a.m. UTC
libbpf allows setting the log_level in struct bpf_object_open_opts
through the kernel_log_level field since v0.7, use it to set log level
to align with bpf_prog_load_dev() and bpf_btf_load().

Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
 lib/bpf_libbpf.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c
index e1c211a1..4a8a2032 100644
--- a/lib/bpf_libbpf.c
+++ b/lib/bpf_libbpf.c
@@ -287,6 +287,10 @@  static int load_bpf_object(struct bpf_cfg_in *cfg)
 			.pin_root_path = root_path,
 	);
 
+#if (LIBBPF_MAJOR_VERSION > 0) || (LIBBPF_MINOR_VERSION >= 7)
+	open_opts.kernel_log_level = 1;
+#endif
+
 	obj = bpf_object__open_file(cfg->object, &open_opts);
 	if (libbpf_get_error(obj)) {
 		fprintf(stderr, "ERROR: opening BPF object file failed\n");