History

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.

Matt Mullins committed 7 years ago

Commit 4635b0a1 parent 2abd2de3 files · +11 −1Browse files

Unified · Split

3 files
  1. tools/include/uapi/linux/bpf.h +9 −1
  2. tools/lib/bpf/libbpf.c +1 −0
  3. tools/lib/bpf/libbpf_probes.c +1 −0
tools/include/uapi/linux/bpf.h+9−1
@@ -168,6 +168,7 @@ enum bpf_prog_type { · 167 unmodified lines
168168 BPF_PROG_TYPE_SK_REUSEPORT,
169169 BPF_PROG_TYPE_FLOW_DISSECTOR,
170170 BPF_PROG_TYPE_CGROUP_SYSCTL,
171+ BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
171172 };
172173
173174 enum bpf_attach_type {
@@ -1737,12 +1738,19 @@ union bpf_attr { · 1563 unmodified lines
17371738 * error if an eBPF program tries to set a callback that is not
17381739 * supported in the current kernel.
17391740 *
1740− * The supported callback values that *argval* can combine are:
1741+ * *argval* is a flag array which can combine these flags:
17411742 *
17421743 * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out)
17431744 * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission)
17441745 * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change)
17451746 *
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+ *
17461754 * Here are some examples of where one could call such eBPF
17471755 * program:
17481756 *
tools/lib/bpf/libbpf.c+1−0
@@ -2136,6 +2136,7 @@ static bool bpf_prog_type__needs_kver(enum bpf_prog_type type) · 2135 unmodified lines
21362136 case BPF_PROG_TYPE_UNSPEC:
21372137 case BPF_PROG_TYPE_TRACEPOINT:
21382138 case BPF_PROG_TYPE_RAW_TRACEPOINT:
2139+ case BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE:
21392140 case BPF_PROG_TYPE_PERF_EVENT:
21402141 case BPF_PROG_TYPE_CGROUP_SYSCTL:
21412142 return false;
tools/lib/bpf/libbpf_probes.c+1−0
@@ -93,6 +93,7 @@ probe_load(enum bpf_prog_type prog_type, const struct bpf_insn *insns, · 92 unmodified lines
9393 case BPF_PROG_TYPE_CGROUP_DEVICE:
9494 case BPF_PROG_TYPE_SK_MSG:
9595 case BPF_PROG_TYPE_RAW_TRACEPOINT:
96+ case BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE:
9697 case BPF_PROG_TYPE_LWT_SEG6LOCAL:
9798 case BPF_PROG_TYPE_LIRC_MODE2:
9899 case BPF_PROG_TYPE_SK_REUSEPORT: