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 c5635d92419386e51199f939f2de70cf53df46a3..41384be233b9b84d247e0f8c1a119b4513a73303 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 6ef1625e8b2cfcd7f838d67408e03e237b86d2b9..9dba48c2b92074130c12fd3423c52a4dd6c48f30 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 e03e204739fafd6476338b3c76b57c0e9dd240bc..af8486f33771ccb8ddbbb3834a26126a31579ca9 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 a0dc2d254aca6616f7cd7fc2a1aea927986e5416..26c0fd091f3cf2fa567595dde3ef2fa16c38878d 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 4fd3ca979a0665f52415d697097d42d6d57514c8..6d4dc4c7dd1e4a32fe5cf927b14093c2c8243403 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 9b139ec6956036a668608e5974080c8b760042ef..da61d53378b377895a1f56f73022b99c3accaa3a 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 cc71ee96e044fd9ce7179ac7dec8ff37ca009ca3..d011e38b80d298b39346fb5fcb36a80f82d95c87 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 ca87ed34f896f361d7084bc5f8ff64533bce5544..720d1950322d20d8c9fcd4fdf3f8e4ccad84ae8b 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 de788be6f862025cf3f8078439af2bb2b668daff..369faca70a15d40a8a600d223ec802b9706d2e9e 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 f7ca8b850978b55257b837ca27a7ed6550f217d3..6c7c7e0aaedacdd3f7967778a96a7aaab8d7d29b 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),