samples: bpf: Do not define bpf_printk macro
authorMichal Rostecki <mrostecki@opensuse.org>
Thu, 23 May 2019 12:53:55 +0000 (14:53 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 24 May 2019 20:47:17 +0000 (13:47 -0700)
The bpf_printk macro was moved to bpf_helpers.h which is included in all
example programs.

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
samples/bpf/hbm_kern.h
samples/bpf/tcp_basertt_kern.c
samples/bpf/tcp_bufs_kern.c
samples/bpf/tcp_clamp_kern.c
samples/bpf/tcp_cong_kern.c
samples/bpf/tcp_iw_kern.c
samples/bpf/tcp_rwnd_kern.c
samples/bpf/tcp_synrto_kern.c
samples/bpf/tcp_tos_reflect_kern.c
samples/bpf/xdp_sample_pkts_kern.c

index c5635d9..41384be 100644 (file)
 #define ALLOW_PKT      1
 #define TCP_ECN_OK     1
 
-#define HBM_DEBUG 0  // Set to 1 to enable debugging
-#if HBM_DEBUG
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-       char ____fmt[] = fmt;                                   \
-       bpf_trace_printk(____fmt, sizeof(____fmt),              \
-                        ##__VA_ARGS__);                        \
-})
-#else
+#ifndef HBM_DEBUG  // Define HBM_DEBUG to enable debugging
+#undef bpf_printk
 #define bpf_printk(fmt, ...)
 #endif
 
index 6ef1625..9dba48c 100644 (file)
 
 #define DEBUG 1
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 SEC("sockops")
 int bpf_basertt(struct bpf_sock_ops *skops)
 {
index e03e204..af8486f 100644 (file)
 
 #define DEBUG 1
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 SEC("sockops")
 int bpf_bufs(struct bpf_sock_ops *skops)
 {
index a0dc2d2..26c0fd0 100644 (file)
 
 #define DEBUG 1
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 SEC("sockops")
 int bpf_clamp(struct bpf_sock_ops *skops)
 {
index 4fd3ca9..6d4dc4c 100644 (file)
 
 #define DEBUG 1
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 SEC("sockops")
 int bpf_cong(struct bpf_sock_ops *skops)
 {
index 9b139ec..da61d53 100644 (file)
 
 #define DEBUG 1
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 SEC("sockops")
 int bpf_iw(struct bpf_sock_ops *skops)
 {
index cc71ee9..d011e38 100644 (file)
 
 #define DEBUG 1
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 SEC("sockops")
 int bpf_rwnd(struct bpf_sock_ops *skops)
 {
index ca87ed3..720d195 100644 (file)
 
 #define DEBUG 1
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 SEC("sockops")
 int bpf_synrto(struct bpf_sock_ops *skops)
 {
index de788be..369faca 100644 (file)
 
 #define DEBUG 1
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 SEC("sockops")
 int bpf_basertt(struct bpf_sock_ops *skops)
 {
index f7ca8b8..6c7c7e0 100644 (file)
@@ -7,13 +7,6 @@
 #define SAMPLE_SIZE 64ul
 #define MAX_CPUS 128
 
-#define bpf_printk(fmt, ...)                                   \
-({                                                             \
-              char ____fmt[] = fmt;                            \
-              bpf_trace_printk(____fmt, sizeof(____fmt),       \
-                               ##__VA_ARGS__);                 \
-})
-
 struct bpf_map_def SEC("maps") my_map = {
        .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
        .key_size = sizeof(int),