diff options
author | Lawrence Brakmo <brakmo@fb.com> | 2018-01-25 16:14:11 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2018-01-25 16:41:14 -0800 |
commit | f89013f66d0f1a0dad44c513318efb706399a36b (patch) | |
tree | 7589bf9c59c29c7fef4bfb2a7f7d98f679715a42 /net/ipv4/tcp_timer.c | |
parent | b13d880721729384757f235166068c315326f4a1 (diff) | |
download | linux-f89013f66d0f1a0dad44c513318efb706399a36b.tar.gz linux-f89013f66d0f1a0dad44c513318efb706399a36b.tar.bz2 linux-f89013f66d0f1a0dad44c513318efb706399a36b.zip |
bpf: Add sock_ops RTO callback
Adds an optional call to sock_ops BPF program based on whether the
BPF_SOCK_OPS_RTO_CB_FLAG is set in bpf_sock_ops_flags.
The BPF program is passed 2 arguments: icsk_retransmits and whether the
RTO has expired.
Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/ipv4/tcp_timer.c')
-rw-r--r-- | net/ipv4/tcp_timer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 6db3124cdbda..257abdde23b0 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -213,11 +213,18 @@ static int tcp_write_timeout(struct sock *sk) icsk->icsk_user_timeout); } tcp_fastopen_active_detect_blackhole(sk, expired); + + if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_RTO_CB_FLAG)) + tcp_call_bpf_3arg(sk, BPF_SOCK_OPS_RTO_CB, + icsk->icsk_retransmits, + icsk->icsk_rto, (int)expired); + if (expired) { /* Has it gone just too far? */ tcp_write_err(sk); return 1; } + return 0; } |