Re: [PATCH net] tcp: fix tcp_set_congestion_control() use from bpf hook

2019-07-18 Thread Lawrence Brakmo
f: Add support for changing congestion control") Signed-off-by: Eric Dumazet Cc: Lawrence Brakmo Reported-by: Neal Cardwell --- Acked-by: Lawrence Brakmo Thanks, Eric!

Re: [PATCH bpf-next v2 0/8] bpf: TCP RTT sock_ops bpf callback

2019-07-02 Thread Lawrence Brakmo
> Suggested-by: Eric Dumazet > Cc: Eric Dumazet > Cc: Priyaranjan Jha > Cc: Yuchung Cheng > Cc: Soheil Hassas Yeganeh > Acked-by: Soheil Hassas Yeganeh > Acked-by: Yuchung Cheng Ack for the whole series. Acked-by: Yonghong Song Thanks,

Re: [PATCH v2 bpf-next] bpf: Add support for fq's EDT to HBM

2019-07-02 Thread Lawrence Brakmo
4236 0.00 134 305 490 624 1310 10 17 > cubic-edt 5G4 4865 0.00 156 306 425 759 1520 10 16 > dctcp 5G4 4936 0.00 128 485 221 409 148479 > dctcp-edt 5G4 4924 0.00 148 390 392 623 1508

Re: [PATCH bpf-next] bpf: fix precision tracking

2019-06-28 Thread Lawrence Brakmo
v.o 840731904 6801 7002 > bpf_overlay.o 542023569 4754 4858 > bpf_lxc_jit.o 39389 35944550925 69631 > Overall precision tracking is still very effective. > > Fixes: b5dc0163d8fd ("bpf: precise scalar_val

Re: [PATCH v3 bpf-next 1/6] bpf: Create BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY

2019-05-28 Thread Lawrence Brakmo
On 5/28/19, 1:43 PM, "Eric Dumazet" wrote: On 5/28/19 11:54 AM, Lawrence Brakmo wrote: > On 5/28/19, 6:43 AM, "netdev-ow...@vger.kernel.org on behalf of Eric Dumazet" wrote: > > Why are you using preempt_enable_no_resched() here ?

Re: [PATCH v3 bpf-next 1/6] bpf: Create BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY

2019-05-28 Thread Lawrence Brakmo
On 5/28/19, 6:43 AM, "netdev-ow...@vger.kernel.org on behalf of Eric Dumazet" wrote: On 5/27/19 8:49 PM, brakmo wrote: > Create new macro BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY() to be used by > __cgroup_bpf_run_filter_skb for EGRESS BPF progs so BPF programs can > reque

Re: [PATCH v2 bpf-next 5/7] bpf: sysctl for probe_on_drop

2019-05-03 Thread Lawrence Brakmo
On 4/8/19, 10:39 AM, "Yuchung Cheng" wrote: On Mon, Apr 8, 2019 at 10:07 AM Eric Dumazet wrote: > > > > On 04/08/2019 09:16 AM, Neal Cardwell wrote: > > On Wed, Apr 3, 2019 at 8:13 PM brakmo wrote: > >> > >> When a packet is dropped when calling queue_xmit in

Re: [PATCH v2 bpf-next 5/7] bpf: sysctl for probe_on_drop

2019-05-03 Thread Lawrence Brakmo
On 4/8/19, 10:07 AM, "Eric Dumazet" wrote: On 04/08/2019 09:16 AM, Neal Cardwell wrote: > On Wed, Apr 3, 2019 at 8:13 PM brakmo wrote: >> >> When a packet is dropped when calling queue_xmit in __tcp_transmit_skb >> and packets_out is 0, it is beneficial to set a

Re: [PATCH v2 bpf-next 5/7] bpf: sysctl for probe_on_drop

2019-05-03 Thread Lawrence Brakmo
sed to specify the duration of the probe timer for the case described > earlier. The allowed values are between 0 and TCP_RTO_MIN. A value of 0 > disables setting the probe timer with a small value. > > Signed-off-by: Lawrence Brakmo > --- > include/net/ne

Re: [PATCH bpf-next 0/7] bpf: Propagate cn to TCP

2019-03-23 Thread Lawrence Brakmo
On 3/23/19, 10:12 AM, "Eric Dumazet" wrote: On 03/23/2019 01:05 AM, brakmo wrote: > This patchset adds support for propagating congestion notifications (cn) > to TCP from cgroup inet skb egress BPF programs. > > Current cgroup skb BPF programs cannot trigger TCP c

Re: [PATCH bpf-next 3/9] bpf: add bpf helper bpf_skb_set_ecn

2019-02-20 Thread Lawrence Brakmo
On 2/19/19, 10:30 AM, "Eric Dumazet" wrote: On 02/18/2019 09:38 PM, brakmo wrote: > This patch adds a new bpf helper BPF_FUNC_skb_set_ecn > "int bpf_skb_set_Ecn(struct sk_buff *skb)". It is added to > BPF_PROG_TYPE_CGROUP_SKB typed bpf_prog which currently can > be a

Re: [PATCH bpf-next 1/9] bpf: Add bpf helper bpf_tcp_enter_cwr

2019-02-20 Thread Lawrence Brakmo
On 2/19/19, 10:30 AM, "Eric Dumazet" wrote: On 02/18/2019 09:38 PM, brakmo wrote: > This patch adds a new bpf helper BPF_FUNC_tcp_enter_cwr > "int bpf_tcp_enter_cwr(struct bpf_tcp_sock *tp)". > It is added to BPF_PROG_TYPE_CGROUP_SKB typed bpf_prog > which currently

Re: [PATCH bpf-next 3/9] bpf: add bpf helper bpf_skb_set_ecn

2019-02-19 Thread Lawrence Brakmo
by a bpf_prog to manage egress > network bandwdith limit per cgroupv2 by inducing an ECN > response in the TCP sender (when the packet is ECN enabled). > This works best when using DCTCP. > > Signed-off-by: Lawrence Brakmo > --- > include/uapi

Re: [PATCH bpf-next 1/9] bpf: Add bpf helper bpf_tcp_enter_cwr

2019-02-19 Thread Lawrence Brakmo
> show how it can be used to limit bandwidth usage per cgroupv2. > > Signed-off-by: Lawrence Brakmo > Signed-off-by: Martin KaFai Lau > --- > include/linux/bpf.h | 1 + > include/uapi/linux/bpf.h | 9 - >

Re: [PATCH bpf-next 7/9] bpf: Sample NRM BPF program to limit egress bw

2019-02-19 Thread Lawrence Brakmo
On 2/19/19, 10:29 AM, "netdev-ow...@vger.kernel.org on behalf of Eric Dumazet" wrote: On 02/18/2019 09:38 PM, brakmo wrote: > + > +static __always_inline void get_nrm_pkt_info(struct bpf_sock *sk, > + struct nrm_pkt_info *pkti)

Re: [PATCH bpf-next] bpf: support SO_DEBUG in bpf_setsockopt()

2019-02-03 Thread Lawrence Brakmo
On 2/3/19, 12:15 AM, "Yafang Shao" wrote: Then we can enable/disable socket debugging without modifying user code. That is more convenient for debugging. Signed-off-by: Yafang Shao Acked-by: Lawrence Brakmo --- include/net/sock.h | 8 net/cor

Re: [PATCH bpf-next] bpf: use the proper optlen when doing strncpy in bpf_getsockopt()

2019-01-22 Thread Lawrence Brakmo
it will make it more consistent with the bpf_setsockopt() above. Acked-by: Martin KaFai Lau Cc: Lawrence Brakmo Acked-by: Lawrence Brakmo > > Signed-off-by: Yafang Shao > --- > net/core/filter.c | 2 +- > 1 file chan

Re: [PATCH bpf-next] bpf: sock recvbuff must be limited by rmem_max in bpf_setsockopt()

2019-01-22 Thread Lawrence Brakmo
Yafang Shao For bug fixes, please target the bpf branch instead of bpf-next and please also add the Fixes tag: Fixes: 8c4b4c7e9ff0 ("bpf: Add setsockopt helper function to bpf") Patch LGTM, Acked-by: Martin KaFai Lau Cc: Lawrence Brakmo, thought?

Re: [PATCH bpf] bpf: correctly set initial window on active Fast Open sender

2019-01-09 Thread Lawrence Brakmo
t;= 0 || tp->data_segs_out > tp->syn_data) ret = -EINVAL; else tp->snd_cwnd = val; -- 2.20.1.97.g81188d93c3-goog Looks good to me. Acked-by: Lawrence Brakmo

Re: [PATCH net-next] tcp: ack immediately when a cwr packet arrives

2018-07-24 Thread Lawrence Brakmo
Note that without this fix the 99% latencies when doing 10KB RPCs in a congested network using DCTCP are 40ms vs. 190us with the patch. Also note that these 40ms high tail latencies started after commit 3759824da87b30ce7a35b4873b62b0ba38905ef5 in Jul 2015, which triggered the bugs/features we a

[PATCH net-next] tcp: ack immediately when a cwr packet arrives

2018-07-23 Thread Lawrence Brakmo
01(0) ack 4 win 257 Modified based on comments by Neal Cardwell Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_input.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 91dbb9afb950..2370fd79c5c5 100644 --- a/net/ipv4/tcp_inp

Re: [PATCH bpf-next 0/6] TCP-BPF callback for listening sockets

2018-07-12 Thread Lawrence Brakmo
LGTM. Thank you for adding the listen callback and cleaning up the test. Acked-by: Lawrence Brakmo On 7/11/18, 8:34 PM, "Andrey Ignatov" wrote: This patchset adds TCP-BPF callback for listening sockets. Patch 0001 provides more details and is the main patch

Re: [PATCH net 1/2] tcp: fix dctcp delayed ACK schedule

2018-07-12 Thread Lawrence Brakmo
mp; + inet_csk(sk)->icsk_ack.pending & ICSK_ACK_TIMER) { u32 tmp_rcv_nxt; /* Save current rcv_nxt. */ -- 2.18.0.203.gfac676dfb9-goog LGTM. Thanks for the patch. Acked-by: Lawrence Brakmo

Re: [PATCH net 2/2] tcp: remove DELAYED ACK events in DCTCP

2018-07-12 Thread Lawrence Brakmo
LGTM. Thanks for the patch. Acked-by: Lawrence Brakmo On 7/12/18, 9:05 AM, "Yuchung Cheng" wrote: After fixing the way DCTCP tracking delayed ACKs, the delayed-ACK related callbacks are no longer needed Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet

Re: [PATCH net-next v3 0/2] tcp: fix high tail latencies in DCTCP

2018-07-09 Thread Lawrence Brakmo
On 7/9/18, 12:32 PM, "Yuchung Cheng" wrote: On Sat, Jul 7, 2018 at 7:07 AM, Neal Cardwell wrote: > On Sat, Jul 7, 2018 at 7:15 AM David Miller wrote: >> >> From: Lawrence Brakmo >> Date: Tue, 3 Jul 2018 09:26:13 -0700 >> >&g

Re: [PATCH net-next v2 1/2] tcp: notify when a delayed ack is sent

2018-07-03 Thread Lawrence Brakmo
On 7/3/18, 6:15 AM, "Neal Cardwell" wrote: On Mon, Jul 2, 2018 at 7:49 PM Yuchung Cheng wrote: > > On Mon, Jul 2, 2018 at 2:39 PM, Lawrence Brakmo wrote: > > > > DCTCP depends on the CA_EVENT_NON_DELAYED_ACK and CA_EVENT_DELAYED_ACK > >

[PATCH net-next v3 1/2] tcp: notify when a delayed ack is sent

2018-07-03 Thread Lawrence Brakmo
roved based on comments from Neal Cardwell . Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index f8f6129160dd..acefb64e8280 100644 --- a/net/ipv4/tcp_output.c +++ b/net

[PATCH net-next v3 2/2] tcp: ack immediately when a cwr packet arrives

2018-07-03 Thread Lawrence Brakmo
arrives, the ACK was sometimes delayed even though it is CWR marked, adding up to 40ms to the RPC latency. This patch insures that CWR makred data packets arriving will be acked immediately. Modified based on comments by Neal Cardwell Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_input.c | 9

[PATCH net-next v3 0/2] tcp: fix high tail latencies in DCTCP

2018-07-03 Thread Lawrence Brakmo
When have observed high tail latencies when using DCTCP for RPCs as compared to using Cubic. For example, in one setup there are 2 hosts sending to a 3rd one, with each sender having 3 flows (1 stream, 1 1MB back-to-back RPCs and 1 10KB back-to-back RPCs). The following table shows the 99% and 99.9

Re: [PATCH net-next v2 1/2] tcp: notify when a delayed ack is sent

2018-07-03 Thread Lawrence Brakmo
On 7/2/18, 4:50 PM, "Yuchung Cheng" wrote: On Mon, Jul 2, 2018 at 2:39 PM, Lawrence Brakmo wrote: > > DCTCP depends on the CA_EVENT_NON_DELAYED_ACK and CA_EVENT_DELAYED_ACK > notifications to keep track if it needs to send an ACK for packets that >

Re: [PATCH net-next v2 0/2] tcp: fix high tail latencies in DCTCP

2018-07-03 Thread Lawrence Brakmo
On 7/2/18, 5:52 PM, "netdev-ow...@vger.kernel.org on behalf of Neal Cardwell" wrote: On Mon, Jul 2, 2018 at 5:39 PM Lawrence Brakmo wrote: > > When have observed high tail latencies when using DCTCP for RPCs as > compared to using Cubic. For example, in on

[PATCH net-next v2 0/2] tcp: fix high tail latencies in DCTCP

2018-07-02 Thread Lawrence Brakmo
When have observed high tail latencies when using DCTCP for RPCs as compared to using Cubic. For example, in one setup there are 2 hosts sending to a 3rd one, with each sender having 3 flows (1 stream, 1 1MB back-to-back RPCs and 1 10KB back-to-back RPCs). The following table shows the 99% and 99.9

[PATCH net-next v2 2/2] tcp: ack immediately when a cwr packet arrives

2018-07-02 Thread Lawrence Brakmo
arrives, the ACK was sometimes delayed even though it is CWR marked, adding up to 40ms to the RPC latency. This patch insures that CWR makred data packets arriving will be acked immediately. Modified based on comments by Neal Cardwell Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_input.c

[PATCH net-next v2 1/2] tcp: notify when a delayed ack is sent

2018-07-02 Thread Lawrence Brakmo
roved based on comments from Neal Cardwell . Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index f8f6129160dd..acefb64e8280 100644 --- a/net/ipv4/tcp_output.c +++ b/net

Re: [PATCH net-next 2/2] tcp: ack immediately when a cwr packet arrives

2018-07-02 Thread Lawrence Brakmo
On 7/2/18, 7:57 AM, "Neal Cardwell" wrote: On Sat, Jun 30, 2018 at 9:47 PM Lawrence Brakmo wrote: > I see two issues, one is that entering quickack mode as you > mentioned does not insure that it will still be on when the CWR > arrives. The second issue

Re: [PATCH net-next 1/2] tcp: notify when a delayed ack is sent

2018-07-02 Thread Lawrence Brakmo
On 7/2/18, 8:18 AM, "netdev-ow...@vger.kernel.org on behalf of Neal Cardwell" wrote: On Fri, Jun 29, 2018 at 9:48 PM Lawrence Brakmo wrote: > > DCTCP depends on the CA_EVENT_NON_DELAYED_ACK and CA_EVENT_DELAYED_ACK > notifications to keep track if it needs

Re: [PATCH net-next 0/2] tcp: fix high tail latencies in DCTCP

2018-06-30 Thread Lawrence Brakmo
On 6/30/18, 5:26 PM, "netdev-ow...@vger.kernel.org on behalf of Neal Cardwell" wrote: On Fri, Jun 29, 2018 at 9:48 PM Lawrence Brakmo wrote: > > When have observed high tail latencies when using DCTCP for RPCs as > compared to using Cubic. For example, in on

Re: [PATCH net-next 2/2] tcp: ack immediately when a cwr packet arrives

2018-06-30 Thread Lawrence Brakmo
On 6/30/18, 11:23 AM, "Neal Cardwell" wrote: On Fri, Jun 29, 2018 at 9:48 PM Lawrence Brakmo wrote: > > We observed high 99 and 99.9% latencies when doing RPCs with DCTCP. The > problem is triggered when the last packet of a request arrives CE > marked

[PATCH net-next 2/2] tcp: ack immediately when a cwr packet arrives

2018-06-29 Thread Lawrence Brakmo
arrives it was sometimes delayed adding up to 40ms to the latency. This patch insures that CWR makred data packets arriving will be acked immediately. Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_input.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff

[PATCH net-next 1/2] tcp: notify when a delayed ack is sent

2018-06-29 Thread Lawrence Brakmo
igned-off-by: Lawrence Brakmo --- net/ipv4/tcp_output.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index f8f6129160dd..41f6ad7a21e4 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -172,6 +172,8 @@ static inline

[PATCH net-next 0/2] tcp: fix high tail latencies in DCTCP

2018-06-29 Thread Lawrence Brakmo
When have observed high tail latencies when using DCTCP for RPCs as compared to using Cubic. For example, in one setup there are 2 hosts sending to a 3rd one, with each sender having 3 flows (1 stream, 1 1MB back-to-back RPCs and 1 10KB back-to-back RPCs). The following table shows the 99% and 99.9

Re: [PATCH net-next v2] tcp: force cwnd at least 2 in tcp_cwnd_reduction

2018-06-29 Thread Lawrence Brakmo
On 6/28/18, 1:48 PM, "netdev-ow...@vger.kernel.org on behalf of Neal Cardwell" wrote: On Thu, Jun 28, 2018 at 4:20 PM Lawrence Brakmo wrote: > > I just looked at 4.18 traces and the behavior is as follows: > >Host A sends the last

Re: [PATCH net-next v2] tcp: force cwnd at least 2 in tcp_cwnd_reduction

2018-06-28 Thread Lawrence Brakmo
On 6/28/18, 1:48 PM, "netdev-ow...@vger.kernel.org on behalf of Neal Cardwell" wrote: On Thu, Jun 28, 2018 at 4:20 PM Lawrence Brakmo wrote: > > I just looked at 4.18 traces and the behavior is as follows: > >Host A sends the last

Re: [PATCH net-next v2] tcp: force cwnd at least 2 in tcp_cwnd_reduction

2018-06-28 Thread Lawrence Brakmo
On 6/28/18, 1:48 PM, "netdev-ow...@vger.kernel.org on behalf of Neal Cardwell" wrote: On Thu, Jun 28, 2018 at 4:20 PM Lawrence Brakmo wrote: > > I just looked at 4.18 traces and the behavior is as follows: > >Host A sends the last

[PATCH net-next v2] tcp: force cwnd at least 2 in tcp_cwnd_reduction

2018-06-26 Thread Lawrence Brakmo
r the problem). v2: fixed compiler warning in max function arguments Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 76ca88f63b70..282bd85322b0 100644 --- a/net/ipv4/tcp_in

[PATCH net-next] tcp: force cwnd at least 2 in tcp_cwnd_reduction

2018-06-26 Thread Lawrence Brakmo
r the problem). Signed-off-by: Lawrence Brakmo --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 76ca88f63b70..a9255c424761 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2477,7 +2477,7 @@

[PATCH bpf-next] bpf: clean up from test_tcpbpf_kern.c

2018-01-26 Thread Lawrence Brakmo
Removed commented lines from test_tcpbpf_kern.c Fixes: d6d4f60c3a09 bpf: add selftest for tcpbpf Signed-off-by: Lawrence Brakmo --- tools/testing/selftests/bpf/test_tcpbpf_kern.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/testing/selftests/bpf/test_tcpbpf_kern.c b/tools

[PATCH bpf-next v10 09/12] bpf: Add sock_ops R/W access to tclass

2018-01-25 Thread Lawrence Brakmo
Adds direct write access to sk_txhash and access to tclass for ipv6 flows through getsockopt and setsockopt. Sample usage for tclass: bpf_getsockopt(skops, SOL_IPV6, IPV6_TCLASS, &v, sizeof(v)) where skops is a pointer to the ctx (struct bpf_sock_ops). Signed-off-by: Lawrence Brakmo ---

[PATCH bpf-next v10 00/12] bpf: More sock_ops callbacks

2018-01-25 Thread Lawrence Brakmo
This patchset adds support for: - direct R or R/W access to many tcp_sock fields - passing up to 4 arguments to sock_ops BPF functions - tcp_sock field bpf_sock_ops_cb_flags for controlling callbacks - optionally calling sock_ops BPF program when RTO fires - optionally calling sock_ops BPF program

[PATCH bpf-next v10 04/12] bpf: Add write access to tcp_sock and sock fields

2018-01-25 Thread Lawrence Brakmo
the macro SOCK_OPS_GET_OR_SET_FIELD that calls one of the GET or SET macros depending on the value of the TYPE field. Signed-off-by: Lawrence Brakmo Acked-by: Alexei Starovoitov --- include/linux/filter.h | 9 + include/net/tcp.h | 2 +- net/core/filter.c

[PATCH bpf-next v10 02/12] bpf: Make SOCK_OPS_GET_TCP size independent

2018-01-25 Thread Lawrence Brakmo
Make SOCK_OPS_GET_TCP helper macro size independent (before only worked with 4-byte fields. Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index bf9bb75..62e7874 100644

[PATCH bpf-next v10 03/12] bpf: Make SOCK_OPS_GET_TCP struct independent

2018-01-25 Thread Lawrence Brakmo
Return a fixed value (e.x. 0 or 0x), or 2) Make the verifier fail if that field is accessed (i.e. program fails to load) so the user will know that field is no longer supported. Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 20 ++-- 1 file changed,

[PATCH bpf-next v10 11/12] bpf: Add BPF_SOCK_OPS_STATE_CB

2018-01-25 Thread Lawrence Brakmo
BPF values differ so we can make the necessary fixes. New op: BPF_SOCK_OPS_STATE_CB. Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 29 - net/ipv4/tcp.c | 24 2 files changed, 52 insertions(+), 1 deletion(-) diff

[PATCH bpf-next v10 05/12] bpf: Support passing args to sock_ops bpf function

2018-01-25 Thread Lawrence Brakmo
Adds support for passing up to 4 arguments to sock_ops bpf functions. It reusues the reply union, so the bpf_sock_ops structures are not increased in size. Signed-off-by: Lawrence Brakmo --- include/linux/filter.h | 1 + include/net/tcp.h| 40

[PATCH bpf-next v10 12/12] bpf: add selftest for tcpbpf

2018-01-25 Thread Lawrence Brakmo
Added a selftest for tcpbpf (sock_ops) that checks that the appropriate callbacks occured and that it can access tcp_sock fields and that their values are correct. Run with command: ./test_tcpbpf_user Adding the flag "-d" will show why it did not pass. Signed-off-by: Lawrence Brakmo

[PATCH bpf-next v10 01/12] bpf: Only reply field should be writeable

2018-01-25 Thread Lawrence Brakmo
als replylong[0]) is writeable. Fixes: 40304b2a1567 ("bpf: BPF support for sock_ops") Signed-off-by: Lawrence Brakmo Acked-by: Yuchung Cheng --- net/core/filter.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 18da42a..b

[PATCH bpf-next v10 10/12] bpf: Add BPF_SOCK_OPS_RETRANS_CB

2018-01-25 Thread Lawrence Brakmo
ons. New op: BPF_SOCK_OPS_RETRANS_CB. Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 9 - net/ipv4/tcp_output.c| 4 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 46520ea..31c93a0b 100644 --

[PATCH bpf-next v10 06/12] bpf: Adds field bpf_sock_ops_cb_flags to tcp_sock

2018-01-25 Thread Lawrence Brakmo
socket. Examples of where one could call the bpf program: 1) When RTO fires 2) When a packet is retransmitted 3) When the connection terminates 4) When a packet is sent 5) When a packet is received Signed-off-by: Lawrence Brakmo Acked-by: Alexei Starovoitov --- include/linux/tcp.h | 11

[PATCH bpf-next v10 08/12] bpf: Add support for reading sk_state and more

2018-01-25 Thread Lawrence Brakmo
etrans segs_in data_segs_in segs_out data_segs_out lost_out sacked_out sk_txhash bytes_received (__u64) bytes_acked(__u64) Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 22 net/core/filter.c| 143 +++-

[PATCH bpf-next v10 07/12] bpf: Add sock_ops RTO callback

2018-01-25 Thread Lawrence Brakmo
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 --- include/uapi/linux/bpf.h | 8 +++- net/ipv4

[PATCH bpf-next v9 11/12] bpf: Add BPF_SOCK_OPS_STATE_CB

2018-01-24 Thread Lawrence Brakmo
BPF values differ so we can make the necessary fixes. New op: BPF_SOCK_OPS_STATE_CB. Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 26 ++ include/uapi/linux/tcp.h | 3 ++- net/ipv4/tcp.c | 24 3 files changed, 52

[PATCH bpf-next v9 01/12] bpf: Only reply field should be writeable

2018-01-24 Thread Lawrence Brakmo
als replylong[0]) is writeable. Fixes: 40304b2a1567 ("bpf: BPF support for sock_ops") Signed-off-by: Lawrence Brakmo Acked-by: Yuchung Cheng --- net/core/filter.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 18da42a..b

[PATCH bpf-next v9 07/12] bpf: Add sock_ops RTO callback

2018-01-24 Thread Lawrence Brakmo
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 --- include/uapi/linux/bpf.h | 5 + include/uapi

[PATCH bpf-next v9 06/12] bpf: Adds field bpf_sock_ops_cb_flags to tcp_sock

2018-01-24 Thread Lawrence Brakmo
socket. Examples of where one could call the bpf program: 1) When RTO fires 2) When a packet is retransmitted 3) When the connection terminates 4) When a packet is sent 5) When a packet is received Signed-off-by: Lawrence Brakmo Acked-by: Alexei Starovoitov --- include/linux/tcp.h | 11

[PATCH bpf-next v9 04/12] bpf: Add write access to tcp_sock and sock fields

2018-01-24 Thread Lawrence Brakmo
the macro SOCK_OPS_GET_OR_SET_FIELD that calls one of the GET or SET macros depending on the value of the TYPE field. Signed-off-by: Lawrence Brakmo Acked-by: Alexei Starovoitov --- include/linux/filter.h | 9 + include/net/tcp.h | 2 +- net/core/filter.c

[PATCH bpf-next v9 03/12] bpf: Make SOCK_OPS_GET_TCP struct independent

2018-01-24 Thread Lawrence Brakmo
Return a fixed value (e.x. 0 or 0x), or 2) Make the verifier fail if that field is accessed (i.e. program fails to load) so the user will know that field is no longer supported. Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 20 ++-- 1 file changed,

[PATCH bpf-next v9 08/12] bpf: Add support for reading sk_state and more

2018-01-24 Thread Lawrence Brakmo
etrans segs_in data_segs_in segs_out data_segs_out lost_out sacked_out sk_txhash bytes_received (__u64) bytes_acked(__u64) Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 22 net/core/filter.c| 143 +++-

[PATCH bpf-next v9 00/12] bpf: More sock_ops callbacks

2018-01-24 Thread Lawrence Brakmo
This patchset adds support for: - direct R or R/W access to many tcp_sock fields - passing up to 4 arguments to sock_ops BPF functions - tcp_sock field bpf_sock_ops_cb_flags for controlling callbacks - optionally calling sock_ops BPF program when RTO fires - optionally calling sock_ops BPF program

[PATCH bpf-next v9 05/12] bpf: Support passing args to sock_ops bpf function

2018-01-24 Thread Lawrence Brakmo
Adds support for passing up to 4 arguments to sock_ops bpf functions. It reusues the reply union, so the bpf_sock_ops structures are not increased in size. Signed-off-by: Lawrence Brakmo --- include/linux/filter.h | 1 + include/net/tcp.h| 40

[PATCH bpf-next v9 10/12] bpf: Add BPF_SOCK_OPS_RETRANS_CB

2018-01-24 Thread Lawrence Brakmo
ons. New op: BPF_SOCK_OPS_RETRANS_CB. Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 6 ++ include/uapi/linux/tcp.h | 3 ++- net/ipv4/tcp_output.c| 4 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h in

[PATCH bpf-next v9 12/12] bpf: add selftest for tcpbpf

2018-01-24 Thread Lawrence Brakmo
Added a selftest for tcpbpf (sock_ops) that checks that the appropriate callbacks occured and that it can access tcp_sock fields and that their values are correct. Run with command: ./test_tcpbpf_user Signed-off-by: Lawrence Brakmo Acked-by: Alexei Starovoitov --- tools/include/uapi/linux

[PATCH bpf-next v9 09/12] bpf: Add sock_ops R/W access to tclass

2018-01-24 Thread Lawrence Brakmo
Adds direct write access to sk_txhash and access to tclass for ipv6 flows through getsockopt and setsockopt. Sample usage for tclass: bpf_getsockopt(skops, SOL_IPV6, IPV6_TCLASS, &v, sizeof(v)) where skops is a pointer to the ctx (struct bpf_sock_ops). Signed-off-by: Lawrence Brakmo ---

[PATCH bpf-next v9 02/12] bpf: Make SOCK_OPS_GET_TCP size independent

2018-01-24 Thread Lawrence Brakmo
Make SOCK_OPS_GET_TCP helper macro size independent (before only worked with 4-byte fields. Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index bf9bb75..62e7874 100644

Re: [PATCH bpf-next v8 08/12] bpf: Add support for reading sk_state and more

2018-01-24 Thread Lawrence Brakmo
On 1/24/18, 12:07 PM, "netdev-ow...@vger.kernel.org on behalf of Yuchung Cheng" wrote: On Tue, Jan 23, 2018 at 11:57 PM, Lawrence Brakmo wrote: > Add support for reading many more tcp_sock fields > > state,same as sk->sk_state >

Re: [PATCH bpf-next v8 10/12] bpf: Add BPF_SOCK_OPS_RETRANS_CB

2018-01-24 Thread Lawrence Brakmo
On 1/24/18, 12:02 PM, "netdev-ow...@vger.kernel.org on behalf of Yuchung Cheng" wrote: On Tue, Jan 23, 2018 at 11:58 PM, Lawrence Brakmo wrote: > Adds support for calling sock_ops BPF program when there is a > retransmission. Two arguments are used; one for the seq

[PATCH bpf-next v8 06/12] bpf: Adds field bpf_sock_ops_cb_flags to tcp_sock

2018-01-23 Thread Lawrence Brakmo
socket. Examples of where one could call the bpf program: 1) When RTO fires 2) When a packet is retransmitted 3) When the connection terminates 4) When a packet is sent 5) When a packet is received Signed-off-by: Lawrence Brakmo Acked-by: Alexei Starovoitov --- include/linux/tcp.h | 11

[PATCH bpf-next v8 01/12] bpf: Make SOCK_OPS_GET_TCP size independent

2018-01-23 Thread Lawrence Brakmo
Make SOCK_OPS_GET_TCP helper macro size independent (before only worked with 4-byte fields. Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 18da42a..31c10a4 100644

[PATCH bpf-next v8 04/12] bpf: Only reply field should be writeable

2018-01-23 Thread Lawrence Brakmo
als replylong[0]) is writeable. Fixes: 40304b2a1567 ("bpf: BPF support for sock_ops") Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 0cf170f..c356ec0 100644 --- a/net/

[PATCH bpf-next v8 03/12] bpf: Add write access to tcp_sock and sock fields

2018-01-23 Thread Lawrence Brakmo
the macro SOCK_OPS_GET_OR_SET_FIELD that calls one of the GET or SET macros depending on the value of the TYPE field. Signed-off-by: Lawrence Brakmo Acked-by: Alexei Starovoitov --- include/linux/filter.h | 9 + include/net/tcp.h | 2 +- net/core/filter.c

[PATCH bpf-next v8 08/12] bpf: Add support for reading sk_state and more

2018-01-23 Thread Lawrence Brakmo
etrans segs_in data_segs_in segs_out data_segs_out sk_txhash bytes_received (__u64) bytes_acked(__u64) Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 20 +++ net/core/filter.c| 135 +++ 2 files change

[PATCH bpf-next v8 12/12] bpf: add selftest for tcpbpf

2018-01-23 Thread Lawrence Brakmo
Added a selftest for tcpbpf (sock_ops) that checks that the appropriate callbacks occured and that it can access tcp_sock fields and that their values are correct. Run with command: ./test_tcpbpf_user Signed-off-by: Lawrence Brakmo Acked-by: Alexei Starovoitov --- tools/include/uapi/linux

[PATCH bpf-next v8 11/12] bpf: Add BPF_SOCK_OPS_STATE_CB

2018-01-23 Thread Lawrence Brakmo
BPF values differ so we can make the necessary fixes. New op: BPF_SOCK_OPS_STATE_CB. Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 26 ++ include/uapi/linux/tcp.h | 3 ++- net/ipv4/tcp.c | 24 3 files changed, 52

[PATCH bpf-next v8 10/12] bpf: Add BPF_SOCK_OPS_RETRANS_CB

2018-01-23 Thread Lawrence Brakmo
Adds support for calling sock_ops BPF program when there is a retransmission. Two arguments are used; one for the sequence number and other for the number of segments retransmitted. Does not include syn-ack retransmissions. New op: BPF_SOCK_OPS_RETRANS_CB. Signed-off-by: Lawrence Brakmo

[PATCH bpf-next v8 05/12] bpf: Support passing args to sock_ops bpf function

2018-01-23 Thread Lawrence Brakmo
Adds support for passing up to 4 arguments to sock_ops bpf functions. It reusues the reply union, so the bpf_sock_ops structures are not increased in size. Signed-off-by: Lawrence Brakmo --- include/linux/filter.h | 1 + include/net/tcp.h| 40

[PATCH bpf-next v8 09/12] bpf: Add sock_ops R/W access to tclass

2018-01-23 Thread Lawrence Brakmo
Adds direct write access to sk_txhash and access to tclass for ipv6 flows through getsockopt and setsockopt. Sample usage for tclass: bpf_getsockopt(skops, SOL_IPV6, IPV6_TCLASS, &v, sizeof(v)) where skops is a pointer to the ctx (struct bpf_sock_ops). Signed-off-by: Lawrence Brakmo ---

[PATCH bpf-next v8 07/12] bpf: Add sock_ops RTO callback

2018-01-23 Thread Lawrence Brakmo
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 --- include/uapi/linux/bpf.h | 5 + include/uapi

[PATCH bpf-next v8 00/12] bpf: More sock_ops callbacks

2018-01-23 Thread Lawrence Brakmo
all_bpf_4arg) based on comments from Daniel Borkmann. v8: Add commit message 00/12 Add Acked-by as appropriate Signed-off-by: Lawrence Brakmo Consists of the following patches: [PATCH bpf-next v8 01/12] bpf: Make SOCK_OPS_GET_TCP size independent [PATCH bpf-next v8 02/12] bpf: Make SOCK_O

[PATCH bpf-next v8 02/12] bpf: Make SOCK_OPS_GET_TCP struct independent

2018-01-23 Thread Lawrence Brakmo
Return a fixed value (e.x. 0 or 0x), or 2) Make the verifier fail if that field is accessed (i.e. program fails to load) so the user will know that field is no longer supported. Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 20 ++-- 1 file changed,

[PATCH bpf-next v7 12/12] bpf: add selftest for tcpbpf callbacks

2018-01-23 Thread Lawrence Brakmo
Added a selftest for tcpbpf (sock_ops) that checks that the appropriate callbacks occured and that it can access tcp_sock fields and that their values are correct. Run with command: ./test_tcpbpf_user Signed-off-by: Lawrence Brakmo --- tools/include/uapi/linux/bpf.h | 74

[PATCH bpf-next v7 07/12] bpf: Add sock_ops RTO callback

2018-01-23 Thread Lawrence Brakmo
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 --- include/uapi/linux/bpf.h | 5 + include/uapi

[PATCH bpf-next v7 09/12] bpf: Add sock_ops R/W access to tclass

2018-01-23 Thread Lawrence Brakmo
Adds direct write access to sk_txhash and access to tclass for ipv6 flows through getsockopt and setsockopt. Sample usage for tclass: bpf_getsockopt(skops, SOL_IPV6, IPV6_TCLASS, &v, sizeof(v)) where skops is a pointer to the ctx (struct bpf_sock_ops). Signed-off-by: Lawrence Brakmo ---

[PATCH bpf-next v7 02/12] bpf: Make SOCK_OPS_GET_TCP struct independent

2018-01-23 Thread Lawrence Brakmo
Return a fixed value (e.x. 0 or 0x), or 2) Make the verifier fail if that field is accessed (i.e. program fails to load) so the user will know that field is no longer supported. Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 20 ++-- 1 file changed,

[PATCH bpf-next v7 03/12] bpf: Add write access to tcp_sock and sock fields

2018-01-23 Thread Lawrence Brakmo
the macro SOCK_OPS_GET_OR_SET_FIELD that calls one of the GET or SET macros depending on the value of the TYPE field. Signed-off-by: Lawrence Brakmo --- include/linux/filter.h | 9 + include/net/tcp.h | 2 +- net/core/filter.c | 48 3 files c

[PATCH bpf-next v7 01/12] bpf: Make SOCK_OPS_GET_TCP size independent

2018-01-23 Thread Lawrence Brakmo
Make SOCK_OPS_GET_TCP helper macro size independent (before only worked with 4-byte fields. Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 18da42a..31c10a4 100644

[PATCH bpf-next v7 10/12] bpf: Add BPF_SOCK_OPS_RETRANS_CB

2018-01-23 Thread Lawrence Brakmo
Adds support for calling sock_ops BPF program when there is a retransmission. Two arguments are used; one for the sequence number and other for the number of segments retransmitted. Does not include syn-ack retransmissions. New op: BPF_SOCK_OPS_RETRANS_CB. Signed-off-by: Lawrence Brakmo

[PATCH bpf-next v7 08/12] bpf: Add support for reading sk_state and more

2018-01-23 Thread Lawrence Brakmo
etrans segs_in data_segs_in segs_out data_segs_out sk_txhash bytes_received (__u64) bytes_acked(__u64) Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 20 +++ net/core/filter.c| 135 +++ 2 files change

[PATCH bpf-next v7 06/12] bpf: Adds field bpf_sock_ops_cb_flags to tcp_sock

2018-01-23 Thread Lawrence Brakmo
socket. Examples of where one could call the bpf program: 1) When RTO fires 2) When a packet is retransmitted 3) When the connection terminates 4) When a packet is sent 5) When a packet is received Signed-off-by: Lawrence Brakmo --- include/linux/tcp.h | 11 +++ include/uapi/linux

[PATCH bpf-next v7 11/12] bpf: Add BPF_SOCK_OPS_STATE_CB

2018-01-23 Thread Lawrence Brakmo
BPF values differ so we can make the necessary fixes. New op: BPF_SOCK_OPS_STATE_CB. Signed-off-by: Lawrence Brakmo --- include/uapi/linux/bpf.h | 26 ++ include/uapi/linux/tcp.h | 3 ++- net/ipv4/tcp.c | 24 3 files changed, 52

[PATCH bpf-next v7 05/12] bpf: Support passing args to sock_ops bpf function

2018-01-23 Thread Lawrence Brakmo
Adds support for passing up to 4 arguments to sock_ops bpf functions. It reusues the reply union, so the bpf_sock_ops structures are not increased in size. Signed-off-by: Lawrence Brakmo --- include/linux/filter.h | 1 + include/net/tcp.h| 40

[PATCH bpf-next v7 04/12] bpf: Only reply field should be writeable

2018-01-23 Thread Lawrence Brakmo
als replylong[0]) is writeable. Fixes: 40304b2a1567 ("bpf: BPF support for sock_ops") Signed-off-by: Lawrence Brakmo --- net/core/filter.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 0cf170f..c356ec0 100644 --- a/net/

  1   2   3   4   5   >