aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLawrence Brakmo <brakmo@fb.com>2017-06-30 23:02:55 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-01 19:15:14 -0400
commit04df41e343db9ca91a278ea14606bbaaf0491f2e (patch)
treead0fd4f7f553d2665852019acb9f7fedbef0616d
parent6c4a01b27852347cd3c4d2bf0dadf157ea6c3c40 (diff)
bpf: update tools/include/uapi/linux/bpf.h
Update tools/include/uapi/linux/bpf.h to include changes related to new bpf sock_ops program type. Signed-off-by: Lawrence Brakmo <brakmo@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--tools/include/uapi/linux/bpf.h66
1 files changed, 65 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index f94b48b168dc..284b3661f1df 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -120,12 +120,14 @@ enum bpf_prog_type {
120 BPF_PROG_TYPE_LWT_IN, 120 BPF_PROG_TYPE_LWT_IN,
121 BPF_PROG_TYPE_LWT_OUT, 121 BPF_PROG_TYPE_LWT_OUT,
122 BPF_PROG_TYPE_LWT_XMIT, 122 BPF_PROG_TYPE_LWT_XMIT,
123 BPF_PROG_TYPE_SOCK_OPS,
123}; 124};
124 125
125enum bpf_attach_type { 126enum bpf_attach_type {
126 BPF_CGROUP_INET_INGRESS, 127 BPF_CGROUP_INET_INGRESS,
127 BPF_CGROUP_INET_EGRESS, 128 BPF_CGROUP_INET_EGRESS,
128 BPF_CGROUP_INET_SOCK_CREATE, 129 BPF_CGROUP_INET_SOCK_CREATE,
130 BPF_CGROUP_SOCK_OPS,
129 __MAX_BPF_ATTACH_TYPE 131 __MAX_BPF_ATTACH_TYPE
130}; 132};
131 133
@@ -518,6 +520,17 @@ union bpf_attr {
518 * Set full skb->hash. 520 * Set full skb->hash.
519 * @skb: pointer to skb 521 * @skb: pointer to skb
520 * @hash: hash to set 522 * @hash: hash to set
523 *
524 * int bpf_setsockopt(bpf_socket, level, optname, optval, optlen)
525 * Calls setsockopt. Not all opts are available, only those with
526 * integer optvals plus TCP_CONGESTION.
527 * Supported levels: SOL_SOCKET and IPROTO_TCP
528 * @bpf_socket: pointer to bpf_socket
529 * @level: SOL_SOCKET or IPROTO_TCP
530 * @optname: option name
531 * @optval: pointer to option value
532 * @optlen: length of optval in byes
533 * Return: 0 or negative error
521 */ 534 */
522#define __BPF_FUNC_MAPPER(FN) \ 535#define __BPF_FUNC_MAPPER(FN) \
523 FN(unspec), \ 536 FN(unspec), \
@@ -568,7 +581,8 @@ union bpf_attr {
568 FN(probe_read_str), \ 581 FN(probe_read_str), \
569 FN(get_socket_cookie), \ 582 FN(get_socket_cookie), \
570 FN(get_socket_uid), \ 583 FN(get_socket_uid), \
571 FN(set_hash), 584 FN(set_hash), \
585 FN(setsockopt),
572 586
573/* integer value in 'imm' field of BPF_CALL instruction selects which helper 587/* integer value in 'imm' field of BPF_CALL instruction selects which helper
574 * function eBPF program intends to call 588 * function eBPF program intends to call
@@ -720,4 +734,54 @@ struct bpf_map_info {
720 __u32 map_flags; 734 __u32 map_flags;
721} __attribute__((aligned(8))); 735} __attribute__((aligned(8)));
722 736
737/* User bpf_sock_ops struct to access socket values and specify request ops
738 * and their replies.
739 * New fields can only be added at the end of this structure
740 */
741struct bpf_sock_ops {
742 __u32 op;
743 union {
744 __u32 reply;
745 __u32 replylong[4];
746 };
747 __u32 family;
748 __u32 remote_ip4;
749 __u32 local_ip4;
750 __u32 remote_ip6[4];
751 __u32 local_ip6[4];
752 __u32 remote_port;
753 __u32 local_port;
754};
755
756/* List of known BPF sock_ops operators.
757 * New entries can only be added at the end
758 */
759enum {
760 BPF_SOCK_OPS_VOID,
761 BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or
762 * -1 if default value should be used
763 */
764 BPF_SOCK_OPS_RWND_INIT, /* Should return initial advertized
765 * window (in packets) or -1 if default
766 * value should be used
767 */
768 BPF_SOCK_OPS_TCP_CONNECT_CB, /* Calls BPF program right before an
769 * active connection is initialized
770 */
771 BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB, /* Calls BPF program when an
772 * active connection is
773 * established
774 */
775 BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, /* Calls BPF program when a
776 * passive connection is
777 * established
778 */
779 BPF_SOCK_OPS_NEEDS_ECN, /* If connection's congestion control
780 * needs ECN
781 */
782};
783
784#define TCP_BPF_IW 1001 /* Set TCP initial congestion window */
785#define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */
786
723#endif /* _UAPI__LINUX_BPF_H__ */ 787#endif /* _UAPI__LINUX_BPF_H__ */