]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
samples: bpf: Remove bpf_debug macro in favor of bpf_printk
authorMichal Rostecki <mrostecki@opensuse.org>
Tue, 18 Jun 2019 18:13:18 +0000 (20:13 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 25 Jun 2019 01:18:30 +0000 (18:18 -0700)
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>
samples/bpf/ibumad_kern.c

index 38b2b3f22049a9ca9d0ba77c197b4bb8c72326a8..f281df7e0089d85b285a785c47e22883245a953c 100644 (file)
@@ -31,15 +31,9 @@ struct bpf_map_def SEC("maps") write_count = {
 };
 
 #undef DEBUG
-#ifdef DEBUG
-#define bpf_debug(fmt, ...)                         \
-({                                                  \
-       char ____fmt[] = fmt;                       \
-       bpf_trace_printk(____fmt, sizeof(____fmt),  \
-                        ##__VA_ARGS__);            \
-})
-#else
-#define bpf_debug(fmt, ...)
+#ifndef DEBUG
+#undef bpf_printk
+#define bpf_printk(fmt, ...)
 #endif
 
 /* Taken from the current format defined in
@@ -86,7 +80,7 @@ int on_ib_umad_read_recv(struct ib_umad_rw_args *ctx)
        u64 zero = 0, *val;
        u8 class = ctx->mgmt_class;
 
-       bpf_debug("ib_umad read recv : class 0x%x\n", class);
+       bpf_printk("ib_umad read recv : class 0x%x\n", class);
 
        val = bpf_map_lookup_elem(&read_count, &class);
        if (!val) {
@@ -106,7 +100,7 @@ int on_ib_umad_read_send(struct ib_umad_rw_args *ctx)
        u64 zero = 0, *val;
        u8 class = ctx->mgmt_class;
 
-       bpf_debug("ib_umad read send : class 0x%x\n", class);
+       bpf_printk("ib_umad read send : class 0x%x\n", class);
 
        val = bpf_map_lookup_elem(&read_count, &class);
        if (!val) {
@@ -126,7 +120,7 @@ int on_ib_umad_write(struct ib_umad_rw_args *ctx)
        u64 zero = 0, *val;
        u8 class = ctx->mgmt_class;
 
-       bpf_debug("ib_umad write : class 0x%x\n", class);
+       bpf_printk("ib_umad write : class 0x%x\n", class);
 
        val = bpf_map_lookup_elem(&write_count, &class);
        if (!val) {