History

bpf: add BPF_CGROUP_SOCK_OPS callback that is executed on every RTT

Performance impact should be minimal because it's under a new BPF_SOCK_OPS_RTT_CB_FLAG flag that has to be explicitly enabled.

Stanislav Fomichev committed 7 years ago

Commit 23729ff1 parent d2f5bbb3 files · +17 −1Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/bpf.h+5−1
@@ -1770,6 +1770,7 @@ union bpf_attr { · 1769 unmodified lines
1770 * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out)1770 * * **BPF_SOCK_OPS_RTO_CB_FLAG** (retransmission time out)
1771 * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission)1771 * * **BPF_SOCK_OPS_RETRANS_CB_FLAG** (retransmission)
1772 * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change)1772 * * **BPF_SOCK_OPS_STATE_CB_FLAG** (TCP state change)
1773 * * **BPF_SOCK_OPS_RTT_CB_FLAG** (every RTT)
1773 *1774 *
1774 * Therefore, this function can be used to clear a callback flag by1775 * Therefore, this function can be used to clear a callback flag by
1775 * setting the appropriate bit to zero. e.g. to disable the RTO1776 * setting the appropriate bit to zero. e.g. to disable the RTO
@@ -3314,7 +3315,8 @@ struct bpf_sock_ops { · 1538 unmodified lines
3314#define BPF_SOCK_OPS_RTO_CB_FLAG (1<<0)3315#define BPF_SOCK_OPS_RTO_CB_FLAG (1<<0)
3315#define BPF_SOCK_OPS_RETRANS_CB_FLAG (1<<1)3316#define BPF_SOCK_OPS_RETRANS_CB_FLAG (1<<1)
3316#define BPF_SOCK_OPS_STATE_CB_FLAG (1<<2)3317#define BPF_SOCK_OPS_STATE_CB_FLAG (1<<2)
3317#define BPF_SOCK_OPS_ALL_CB_FLAGS 0x7 /* Mask of all currently3318#define BPF_SOCK_OPS_RTT_CB_FLAG (1<<3)
3319#define BPF_SOCK_OPS_ALL_CB_FLAGS 0xF /* Mask of all currently
3318 * supported cb flags3320 * supported cb flags
3319 */3321 */
3320 3322
@@ -3369,6 +3371,8 @@ enum { · 48 unmodified lines
3369 BPF_SOCK_OPS_TCP_LISTEN_CB, /* Called on listen(2), right after3371 BPF_SOCK_OPS_TCP_LISTEN_CB, /* Called on listen(2), right after
3370 * socket transition to LISTEN state.3372 * socket transition to LISTEN state.
3371 */3373 */
3374 BPF_SOCK_OPS_RTT_CB, /* Called on every RTT.
3375 */
3372};3376};
3373 3377
3374/* List of TCP states. There is a build check in net/ipv4/tcp.c to detect3378/* List of TCP states. There is a build check in net/ipv4/tcp.c to detect