Skip to content

Commit c87f60a

Browse files
vadorovskyAlexei Starovoitov
authored andcommitted
samples: bpf: Do not define bpf_printk macro
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>
1 parent 37739d1 commit c87f60a

File tree

10 files changed

+2
-72
lines changed

10 files changed

+2
-72
lines changed

samples/bpf/hbm_kern.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,8 @@
3030
#define ALLOW_PKT 1
3131
#define TCP_ECN_OK 1
3232

33-
#define HBM_DEBUG 0 // Set to 1 to enable debugging
34-
#if HBM_DEBUG
35-
#define bpf_printk(fmt, ...) \
36-
({ \
37-
char ____fmt[] = fmt; \
38-
bpf_trace_printk(____fmt, sizeof(____fmt), \
39-
##__VA_ARGS__); \
40-
})
41-
#else
33+
#ifndef HBM_DEBUG // Define HBM_DEBUG to enable debugging
34+
#undef bpf_printk
4235
#define bpf_printk(fmt, ...)
4336
#endif
4437

samples/bpf/tcp_basertt_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121

2222
#define DEBUG 1
2323

24-
#define bpf_printk(fmt, ...) \
25-
({ \
26-
char ____fmt[] = fmt; \
27-
bpf_trace_printk(____fmt, sizeof(____fmt), \
28-
##__VA_ARGS__); \
29-
})
30-
3124
SEC("sockops")
3225
int bpf_basertt(struct bpf_sock_ops *skops)
3326
{

samples/bpf/tcp_bufs_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222

2323
#define DEBUG 1
2424

25-
#define bpf_printk(fmt, ...) \
26-
({ \
27-
char ____fmt[] = fmt; \
28-
bpf_trace_printk(____fmt, sizeof(____fmt), \
29-
##__VA_ARGS__); \
30-
})
31-
3225
SEC("sockops")
3326
int bpf_bufs(struct bpf_sock_ops *skops)
3427
{

samples/bpf/tcp_clamp_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222

2323
#define DEBUG 1
2424

25-
#define bpf_printk(fmt, ...) \
26-
({ \
27-
char ____fmt[] = fmt; \
28-
bpf_trace_printk(____fmt, sizeof(____fmt), \
29-
##__VA_ARGS__); \
30-
})
31-
3225
SEC("sockops")
3326
int bpf_clamp(struct bpf_sock_ops *skops)
3427
{

samples/bpf/tcp_cong_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121

2222
#define DEBUG 1
2323

24-
#define bpf_printk(fmt, ...) \
25-
({ \
26-
char ____fmt[] = fmt; \
27-
bpf_trace_printk(____fmt, sizeof(____fmt), \
28-
##__VA_ARGS__); \
29-
})
30-
3124
SEC("sockops")
3225
int bpf_cong(struct bpf_sock_ops *skops)
3326
{

samples/bpf/tcp_iw_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222

2323
#define DEBUG 1
2424

25-
#define bpf_printk(fmt, ...) \
26-
({ \
27-
char ____fmt[] = fmt; \
28-
bpf_trace_printk(____fmt, sizeof(____fmt), \
29-
##__VA_ARGS__); \
30-
})
31-
3225
SEC("sockops")
3326
int bpf_iw(struct bpf_sock_ops *skops)
3427
{

samples/bpf/tcp_rwnd_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121

2222
#define DEBUG 1
2323

24-
#define bpf_printk(fmt, ...) \
25-
({ \
26-
char ____fmt[] = fmt; \
27-
bpf_trace_printk(____fmt, sizeof(____fmt), \
28-
##__VA_ARGS__); \
29-
})
30-
3124
SEC("sockops")
3225
int bpf_rwnd(struct bpf_sock_ops *skops)
3326
{

samples/bpf/tcp_synrto_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121

2222
#define DEBUG 1
2323

24-
#define bpf_printk(fmt, ...) \
25-
({ \
26-
char ____fmt[] = fmt; \
27-
bpf_trace_printk(____fmt, sizeof(____fmt), \
28-
##__VA_ARGS__); \
29-
})
30-
3124
SEC("sockops")
3225
int bpf_synrto(struct bpf_sock_ops *skops)
3326
{

samples/bpf/tcp_tos_reflect_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@
2020

2121
#define DEBUG 1
2222

23-
#define bpf_printk(fmt, ...) \
24-
({ \
25-
char ____fmt[] = fmt; \
26-
bpf_trace_printk(____fmt, sizeof(____fmt), \
27-
##__VA_ARGS__); \
28-
})
29-
3023
SEC("sockops")
3124
int bpf_basertt(struct bpf_sock_ops *skops)
3225
{

samples/bpf/xdp_sample_pkts_kern.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77
#define SAMPLE_SIZE 64ul
88
#define MAX_CPUS 128
99

10-
#define bpf_printk(fmt, ...) \
11-
({ \
12-
char ____fmt[] = fmt; \
13-
bpf_trace_printk(____fmt, sizeof(____fmt), \
14-
##__VA_ARGS__); \
15-
})
16-
1710
struct bpf_map_def SEC("maps") my_map = {
1811
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
1912
.key_size = sizeof(int),

0 commit comments

Comments
 (0)