Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

samples: bpf: Remove bpf_debug macro in favor of bpf_printk

ibumad example was implementing the bpf_debug macro which is exactly the
same as the bpf_printk macro available in bpf_helpers.h. This change
makes use of bpf_printk instead of bpf_debug.

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Michal Rostecki and committed by
Alexei Starovoitov
7ae9f281 7d30a7f6

+6 -12
+6 -12
samples/bpf/ibumad_kern.c
··· 31 31 }; 32 32 33 33 #undef DEBUG 34 - #ifdef DEBUG 35 - #define bpf_debug(fmt, ...) \ 36 - ({ \ 37 - char ____fmt[] = fmt; \ 38 - bpf_trace_printk(____fmt, sizeof(____fmt), \ 39 - ##__VA_ARGS__); \ 40 - }) 41 - #else 42 - #define bpf_debug(fmt, ...) 34 + #ifndef DEBUG 35 + #undef bpf_printk 36 + #define bpf_printk(fmt, ...) 43 37 #endif 44 38 45 39 /* Taken from the current format defined in ··· 80 86 u64 zero = 0, *val; 81 87 u8 class = ctx->mgmt_class; 82 88 83 - bpf_debug("ib_umad read recv : class 0x%x\n", class); 89 + bpf_printk("ib_umad read recv : class 0x%x\n", class); 84 90 85 91 val = bpf_map_lookup_elem(&read_count, &class); 86 92 if (!val) { ··· 100 106 u64 zero = 0, *val; 101 107 u8 class = ctx->mgmt_class; 102 108 103 - bpf_debug("ib_umad read send : class 0x%x\n", class); 109 + bpf_printk("ib_umad read send : class 0x%x\n", class); 104 110 105 111 val = bpf_map_lookup_elem(&read_count, &class); 106 112 if (!val) { ··· 120 126 u64 zero = 0, *val; 121 127 u8 class = ctx->mgmt_class; 122 128 123 - bpf_debug("ib_umad write : class 0x%x\n", class); 129 + bpf_printk("ib_umad write : class 0x%x\n", class); 124 130 125 131 val = bpf_map_lookup_elem(&write_count, &class); 126 132 if (!val) {