|
@@ -218,6 +218,10 @@ enum bpf_attach_type {
|
|
|
|
|
|
#define BPF_OBJ_NAME_LEN 16U
|
|
|
|
|
|
+/* Flags for accessing BPF object */
|
|
|
+#define BPF_F_RDONLY (1U << 3)
|
|
|
+#define BPF_F_WRONLY (1U << 4)
|
|
|
+
|
|
|
union bpf_attr {
|
|
|
struct { /* anonymous struct used by BPF_MAP_CREATE command */
|
|
|
__u32 map_type; /* one of enum bpf_map_type */
|
|
@@ -260,6 +264,7 @@ union bpf_attr {
|
|
|
struct { /* anonymous struct used by BPF_OBJ_* commands */
|
|
|
__aligned_u64 pathname;
|
|
|
__u32 bpf_fd;
|
|
|
+ __u32 file_flags;
|
|
|
};
|
|
|
|
|
|
struct { /* anonymous struct used by BPF_PROG_ATTACH/DETACH commands */
|
|
@@ -287,6 +292,7 @@ union bpf_attr {
|
|
|
__u32 map_id;
|
|
|
};
|
|
|
__u32 next_id;
|
|
|
+ __u32 open_flags;
|
|
|
};
|
|
|
|
|
|
struct { /* anonymous struct used by BPF_OBJ_GET_INFO_BY_FD */
|
|
@@ -607,12 +613,22 @@ union bpf_attr {
|
|
|
* int bpf_setsockopt(bpf_socket, level, optname, optval, optlen)
|
|
|
* Calls setsockopt. Not all opts are available, only those with
|
|
|
* integer optvals plus TCP_CONGESTION.
|
|
|
- * Supported levels: SOL_SOCKET and IPROTO_TCP
|
|
|
+ * Supported levels: SOL_SOCKET and IPPROTO_TCP
|
|
|
* @bpf_socket: pointer to bpf_socket
|
|
|
- * @level: SOL_SOCKET or IPROTO_TCP
|
|
|
+ * @level: SOL_SOCKET or IPPROTO_TCP
|
|
|
* @optname: option name
|
|
|
* @optval: pointer to option value
|
|
|
- * @optlen: length of optval in byes
|
|
|
+ * @optlen: length of optval in bytes
|
|
|
+ * Return: 0 or negative error
|
|
|
+ *
|
|
|
+ * int bpf_getsockopt(bpf_socket, level, optname, optval, optlen)
|
|
|
+ * Calls getsockopt. Not all opts are available.
|
|
|
+ * Supported levels: IPPROTO_TCP
|
|
|
+ * @bpf_socket: pointer to bpf_socket
|
|
|
+ * @level: IPPROTO_TCP
|
|
|
+ * @optname: option name
|
|
|
+ * @optval: pointer to option value
|
|
|
+ * @optlen: length of optval in bytes
|
|
|
* Return: 0 or negative error
|
|
|
*
|
|
|
* int bpf_skb_adjust_room(skb, len_diff, mode, flags)
|
|
@@ -623,10 +639,9 @@ union bpf_attr {
|
|
|
* @flags: reserved for future use
|
|
|
* Return: 0 on success or negative error code
|
|
|
*
|
|
|
- * int bpf_sk_redirect_map(skb, map, key, flags)
|
|
|
+ * int bpf_sk_redirect_map(map, key, flags)
|
|
|
* Redirect skb to a sock in map using key as a lookup key for the
|
|
|
* sock in map.
|
|
|
- * @skb: pointer to skb
|
|
|
* @map: pointer to sockmap
|
|
|
* @key: key to lookup sock in map
|
|
|
* @flags: reserved for future use
|
|
@@ -643,6 +658,21 @@ union bpf_attr {
|
|
|
* @xdp_md: pointer to xdp_md
|
|
|
* @delta: An positive/negative integer to be added to xdp_md.data_meta
|
|
|
* Return: 0 on success or negative on error
|
|
|
+ *
|
|
|
+ * int bpf_perf_event_read_value(map, flags, buf, buf_size)
|
|
|
+ * read perf event counter value and perf event enabled/running time
|
|
|
+ * @map: pointer to perf_event_array map
|
|
|
+ * @flags: index of event in the map or bitmask flags
|
|
|
+ * @buf: buf to fill
|
|
|
+ * @buf_size: size of the buf
|
|
|
+ * Return: 0 on success or negative error code
|
|
|
+ *
|
|
|
+ * int bpf_perf_prog_read_value(ctx, buf, buf_size)
|
|
|
+ * read perf prog attached perf event counter and enabled/running time
|
|
|
+ * @ctx: pointer to ctx
|
|
|
+ * @buf: buf to fill
|
|
|
+ * @buf_size: size of the buf
|
|
|
+ * Return : 0 on success or negative error code
|
|
|
*/
|
|
|
#define __BPF_FUNC_MAPPER(FN) \
|
|
|
FN(unspec), \
|
|
@@ -701,7 +731,8 @@ union bpf_attr {
|
|
|
FN(sock_map_update), \
|
|
|
FN(xdp_adjust_meta), \
|
|
|
FN(perf_event_read_value), \
|
|
|
- FN(perf_prog_read_value),
|
|
|
+ FN(perf_prog_read_value), \
|
|
|
+ FN(getsockopt),
|
|
|
|
|
|
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
|
|
* function eBPF program intends to call
|
|
@@ -745,7 +776,9 @@ enum bpf_func_id {
|
|
|
#define BPF_F_ZERO_CSUM_TX (1ULL << 1)
|
|
|
#define BPF_F_DONT_FRAGMENT (1ULL << 2)
|
|
|
|
|
|
-/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */
|
|
|
+/* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and
|
|
|
+ * BPF_FUNC_perf_event_read_value flags.
|
|
|
+ */
|
|
|
#define BPF_F_INDEX_MASK 0xffffffffULL
|
|
|
#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK
|
|
|
/* BPF_FUNC_perf_event_output for sk_buff input context. */
|
|
@@ -873,7 +906,7 @@ struct bpf_prog_info {
|
|
|
__u32 created_by_uid;
|
|
|
__u32 nr_map_ids;
|
|
|
__aligned_u64 map_ids;
|
|
|
- char name[BPF_OBJ_NAME_LEN];
|
|
|
+ char name[BPF_OBJ_NAME_LEN];
|
|
|
} __attribute__((aligned(8)));
|
|
|
|
|
|
struct bpf_map_info {
|
|
@@ -933,9 +966,22 @@ enum {
|
|
|
BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control
|
|
|
* needs ECN
|
|
|
*/
|
|
|
+ BPF_SOCK_OPS_BASE_RTT, /* Get base RTT. The correct value is
|
|
|
+ * based on the path and may be
|
|
|
+ * dependent on the congestion control
|
|
|
+ * algorithm. In general it indicates
|
|
|
+ * a congestion threshold. RTTs above
|
|
|
+ * this indicate congestion
|
|
|
+ */
|
|
|
};
|
|
|
|
|
|
#define TCP_BPF_IW 1001 /* Set TCP initial congestion window */
|
|
|
#define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */
|
|
|
|
|
|
+struct bpf_perf_event_value {
|
|
|
+ __u64 counter;
|
|
|
+ __u64 enabled;
|
|
|
+ __u64 running;
|
|
|
+};
|
|
|
+
|
|
|
#endif /* _UAPI__LINUX_BPF_H__ */
|