aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Mullins <mmullins@fb.com>2019-04-26 14:49:50 -0400
committerAlexei Starovoitov <ast@kernel.org>2019-04-26 22:04:19 -0400
commit4635b0ae4d26f87cf68dbab6740955dd1ad67cf4 (patch)
tree3622175df191cd2da9839c68170c9af3c0d9e4fa
parent2abd2de712cd891321a06b0890a85aef1e506cb5 (diff)
tools: sync bpf.h
This adds BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE, and fixes up the error: enumeration value ‘BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE’ not handled in switch [-Werror=switch-enum] build errors it would otherwise cause in libbpf. Signed-off-by: Matt Mullins <mmullins@fb.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r--tools/include/uapi/linux/bpf.h10
-rw-r--r--tools/lib/bpf/libbpf.c1
-rw-r--r--tools/lib/bpf/libbpf_probes.c1
3 files changed, 11 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 704bb69514a2..f7fa7a34a62d 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -168,6 +168,7 @@ enum bpf_prog_type {
168 BPF_PROG_TYPE_SK_REUSEPORT, 168 BPF_PROG_TYPE_SK_REUSEPORT,
169 BPF_PROG_TYPE_FLOW_DISSECTOR, 169 BPF_PROG_TYPE_FLOW_DISSECTOR,
170 BPF_PROG_TYPE_CGROUP_SYSCTL, 170 BPF_PROG_TYPE_CGROUP_SYSCTL,
171 BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
171}; 172};
172 173
173enum bpf_attach_type { 174enum bpf_attach_type {
@@ -1737,12 +1738,19 @@ union bpf_attr {
1737 * error if an eBPF program tries to set a callback that is not 1738 * error if an eBPF program tries to set a callback that is not
1738 * supported in the current kernel. 1739 * supported in the current kernel.
1739 * 1740 *
1740 * The supported callback values that *argval* can combine are: 1741 * *argval* is a flag array which can combine these flags:
1741 * 1742 *
1742 * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out) 1743 * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out)
1743 * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission) 1744 * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission)
1744 * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change) 1745 * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change)
1745 * 1746 *
1747 * Therefore, this function can be used to clear a callback flag by
1748 * setting the appropriate bit to zero. e.g. to disable the RTO
1749 * callback:
1750 *
1751 * **bpf_sock_ops_cb_flags_set(bpf_sock,**
1752 * **bpf_sock->bpf_sock_ops_cb_flags & ~BPF_SOCK_OPS_RTO_CB_FLAG)**
1753 *
1746 * Here are some examples of where one could call such eBPF 1754 * Here are some examples of where one could call such eBPF
1747 * program: 1755 * program:
1748 * 1756 *
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 9052061ba7fc..11a65db4b93f 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -2136,6 +2136,7 @@ static bool bpf_prog_type__needs_kver(enum bpf_prog_type type)
2136 case BPF_PROG_TYPE_UNSPEC: 2136 case BPF_PROG_TYPE_UNSPEC:
2137 case BPF_PROG_TYPE_TRACEPOINT: 2137 case BPF_PROG_TYPE_TRACEPOINT:
2138 case BPF_PROG_TYPE_RAW_TRACEPOINT: 2138 case BPF_PROG_TYPE_RAW_TRACEPOINT:
2139 case BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE:
2139 case BPF_PROG_TYPE_PERF_EVENT: 2140 case BPF_PROG_TYPE_PERF_EVENT:
2140 case BPF_PROG_TYPE_CGROUP_SYSCTL: 2141 case BPF_PROG_TYPE_CGROUP_SYSCTL:
2141 return false; 2142 return false;
diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
index 0f25541632e3..80ee922f290c 100644
--- a/tools/lib/bpf/libbpf_probes.c
+++ b/tools/lib/bpf/libbpf_probes.c
@@ -93,6 +93,7 @@ probe_load(enum bpf_prog_type prog_type, const struct bpf_insn *insns,
93 case BPF_PROG_TYPE_CGROUP_DEVICE: 93 case BPF_PROG_TYPE_CGROUP_DEVICE:
94 case BPF_PROG_TYPE_SK_MSG: 94 case BPF_PROG_TYPE_SK_MSG:
95 case BPF_PROG_TYPE_RAW_TRACEPOINT: 95 case BPF_PROG_TYPE_RAW_TRACEPOINT:
96 case BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE:
96 case BPF_PROG_TYPE_LWT_SEG6LOCAL: 97 case BPF_PROG_TYPE_LWT_SEG6LOCAL:
97 case BPF_PROG_TYPE_LIRC_MODE2: 98 case BPF_PROG_TYPE_LIRC_MODE2:
98 case BPF_PROG_TYPE_SK_REUSEPORT: 99 case BPF_PROG_TYPE_SK_REUSEPORT: