* [PATCH bpf-next] samples: bpf: Remove bpf_debug macro in favor of bpf_printk
@ 2019-06-18 18:13 Michal Rostecki
2019-06-18 23:14 ` Andrii Nakryiko
2019-06-24 14:59 ` Daniel Borkmann
0 siblings, 2 replies; 3+ messages in thread
From: Michal Rostecki @ 2019-06-18 18:13 UTC (permalink / raw)
Cc: Michal Rostecki, Doug Ledford, Jason Gunthorpe,
Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, linux-rdma, netdev, bpf, linux-kernel
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>
---
samples/bpf/ibumad_kern.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/samples/bpf/ibumad_kern.c b/samples/bpf/ibumad_kern.c
index 38b2b3f22049..f281df7e0089 100644
--- a/samples/bpf/ibumad_kern.c
+++ b/samples/bpf/ibumad_kern.c
@@ -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) {
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] samples: bpf: Remove bpf_debug macro in favor of bpf_printk
2019-06-18 18:13 [PATCH bpf-next] samples: bpf: Remove bpf_debug macro in favor of bpf_printk Michal Rostecki
@ 2019-06-18 23:14 ` Andrii Nakryiko
2019-06-24 14:59 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2019-06-18 23:14 UTC (permalink / raw)
To: Michal Rostecki
Cc: Doug Ledford, Jason Gunthorpe, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
linux-rdma, Networking, bpf, open list
On Tue, Jun 18, 2019 at 11:13 AM Michal Rostecki <mrostecki@opensuse.org> wrote:
>
> 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>
> samples/bpf/ibumad_kern.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
<snip>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] samples: bpf: Remove bpf_debug macro in favor of bpf_printk
2019-06-18 18:13 [PATCH bpf-next] samples: bpf: Remove bpf_debug macro in favor of bpf_printk Michal Rostecki
2019-06-18 23:14 ` Andrii Nakryiko
@ 2019-06-24 14:59 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-06-24 14:59 UTC (permalink / raw)
To: Michal Rostecki
Cc: Doug Ledford, Jason Gunthorpe, Alexei Starovoitov,
Martin KaFai Lau, Song Liu, Yonghong Song, linux-rdma, netdev,
bpf, linux-kernel
On 06/18/2019 08:13 PM, Michal Rostecki wrote:
> 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>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-24 14:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 18:13 [PATCH bpf-next] samples: bpf: Remove bpf_debug macro in favor of bpf_printk Michal Rostecki
2019-06-18 23:14 ` Andrii Nakryiko
2019-06-24 14:59 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).