Skip to content

Commit

Permalink
samples: bpf: Do not define bpf_printk macro
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michal Rostecki authored and Alexei Starovoitov committed May 24, 2019
1 parent 37739d1 commit c87f60a
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 72 deletions.
11 changes: 2 additions & 9 deletions samples/bpf/hbm_kern.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@
#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

Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/tcp_basertt_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

#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)
{
Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/tcp_bufs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@

#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)
{
Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/tcp_clamp_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@

#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)
{
Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/tcp_cong_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

#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)
{
Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/tcp_iw_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@

#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)
{
Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/tcp_rwnd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

#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)
{
Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/tcp_synrto_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

#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)
{
Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/tcp_tos_reflect_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@

#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)
{
Expand Down
7 changes: 0 additions & 7 deletions samples/bpf/xdp_sample_pkts_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit c87f60a

Please sign in to comment.