.. | .. |
---|
7 | 7 | * BPF program to set base_rtt to 80us when host is running TCP-NV and |
---|
8 | 8 | * both hosts are in the same datacenter (as determined by IPv6 prefix). |
---|
9 | 9 | * |
---|
10 | | - * Use load_sock_ops to load this BPF program. |
---|
| 10 | + * Use "bpftool cgroup attach $cg sock_ops $prog" to load this BPF program. |
---|
11 | 11 | */ |
---|
12 | 12 | |
---|
13 | 13 | #include <uapi/linux/bpf.h> |
---|
.. | .. |
---|
16 | 16 | #include <uapi/linux/if_packet.h> |
---|
17 | 17 | #include <uapi/linux/ip.h> |
---|
18 | 18 | #include <linux/socket.h> |
---|
19 | | -#include "bpf_helpers.h" |
---|
20 | | -#include "bpf_endian.h" |
---|
| 19 | +#include <bpf/bpf_helpers.h> |
---|
| 20 | +#include <bpf/bpf_endian.h> |
---|
21 | 21 | |
---|
22 | 22 | #define DEBUG 1 |
---|
23 | | - |
---|
24 | | -#define bpf_printk(fmt, ...) \ |
---|
25 | | -({ \ |
---|
26 | | - char ____fmt[] = fmt; \ |
---|
27 | | - bpf_trace_printk(____fmt, sizeof(____fmt), \ |
---|
28 | | - ##__VA_ARGS__); \ |
---|
29 | | -}) |
---|
30 | 23 | |
---|
31 | 24 | SEC("sockops") |
---|
32 | 25 | int bpf_basertt(struct bpf_sock_ops *skops) |
---|
.. | .. |
---|
54 | 47 | case BPF_SOCK_OPS_BASE_RTT: |
---|
55 | 48 | n = bpf_getsockopt(skops, SOL_TCP, TCP_CONGESTION, |
---|
56 | 49 | cong, sizeof(cong)); |
---|
57 | | - if (!n && !__builtin_memcmp(cong, nv, sizeof(nv)+1)) { |
---|
| 50 | + if (!n && !__builtin_memcmp(cong, nv, sizeof(nv))) { |
---|
58 | 51 | /* Set base_rtt to 80us */ |
---|
59 | 52 | rv = 80; |
---|
60 | 53 | } else if (n) { |
---|