netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] bpf: correctly set initial window on active Fast Open sender
@ 2019-01-09  2:12 Yuchung Cheng
  2019-01-09 23:06 ` Lawrence Brakmo
  2019-01-09 23:21 ` Alexei Starovoitov
  0 siblings, 2 replies; 3+ messages in thread
From: Yuchung Cheng @ 2019-01-09  2:12 UTC (permalink / raw)
  To: ast, daniel; +Cc: netdev, brakmo, ncardwell, edumazet, Yuchung Cheng

The existing BPF TCP initial congestion window (TCP_BPF_IW) does not
to work on (active) Fast Open sender. This is because it changes the
(initial) window only if data_segs_out is zero -- but data_segs_out
is also incremented on SYN-data.  This patch fixes the issue by
proerly accounting for SYN-data additionally.

Fixes: fc7478103c84 ("bpf: Adds support for setting initial cwnd")
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
---
 net/core/filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 447dd1bad31f..2b3b436ef545 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4203,7 +4203,7 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
 			/* Only some options are supported */
 			switch (optname) {
 			case TCP_BPF_IW:
-				if (val <= 0 || tp->data_segs_out > 0)
+				if (val <= 0 || tp->data_segs_out > tp->syn_data)
 					ret = -EINVAL;
 				else
 					tp->snd_cwnd = val;
-- 
2.20.1.97.g81188d93c3-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf] bpf: correctly set initial window on active Fast Open sender
  2019-01-09  2:12 [PATCH bpf] bpf: correctly set initial window on active Fast Open sender Yuchung Cheng
@ 2019-01-09 23:06 ` Lawrence Brakmo
  2019-01-09 23:21 ` Alexei Starovoitov
  1 sibling, 0 replies; 3+ messages in thread
From: Lawrence Brakmo @ 2019-01-09 23:06 UTC (permalink / raw)
  To: Yuchung Cheng, ast@kernel.org, daniel@iogearbox.net
  Cc: netdev@vger.kernel.org, ncardwell@google.com, edumazet@google.com

On 1/8/19, 6:13 PM, "netdev-owner@vger.kernel.org on behalf of Yuchung Cheng" <netdev-owner@vger.kernel.org on behalf of ycheng@google.com> wrote:

    The existing BPF TCP initial congestion window (TCP_BPF_IW) does not
    to work on (active) Fast Open sender. This is because it changes the
    (initial) window only if data_segs_out is zero -- but data_segs_out
    is also incremented on SYN-data.  This patch fixes the issue by
    proerly accounting for SYN-data additionally.
    
    Fixes: fc7478103c84 ("bpf: Adds support for setting initial cwnd")
    Signed-off-by: Yuchung Cheng <ycheng@google.com>
    Reviewed-by: Neal Cardwell <ncardwell@google.com>
    ---
     net/core/filter.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/net/core/filter.c b/net/core/filter.c
    index 447dd1bad31f..2b3b436ef545 100644
    --- a/net/core/filter.c
    +++ b/net/core/filter.c
    @@ -4203,7 +4203,7 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
     			/* Only some options are supported */
     			switch (optname) {
     			case TCP_BPF_IW:
    -				if (val <= 0 || tp->data_segs_out > 0)
    +				if (val <= 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 <brakmo@fb.com>
   

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf] bpf: correctly set initial window on active Fast Open sender
  2019-01-09  2:12 [PATCH bpf] bpf: correctly set initial window on active Fast Open sender Yuchung Cheng
  2019-01-09 23:06 ` Lawrence Brakmo
@ 2019-01-09 23:21 ` Alexei Starovoitov
  1 sibling, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2019-01-09 23:21 UTC (permalink / raw)
  To: Yuchung Cheng; +Cc: ast, daniel, netdev, brakmo, ncardwell, edumazet

On Tue, Jan 08, 2019 at 06:12:24PM -0800, Yuchung Cheng wrote:
> The existing BPF TCP initial congestion window (TCP_BPF_IW) does not
> to work on (active) Fast Open sender. This is because it changes the
> (initial) window only if data_segs_out is zero -- but data_segs_out
> is also incremented on SYN-data.  This patch fixes the issue by
> proerly accounting for SYN-data additionally.
> 
> Fixes: fc7478103c84 ("bpf: Adds support for setting initial cwnd")
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Reviewed-by: Neal Cardwell <ncardwell@google.com>

Applied, Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-09 23:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-09  2:12 [PATCH bpf] bpf: correctly set initial window on active Fast Open sender Yuchung Cheng
2019-01-09 23:06 ` Lawrence Brakmo
2019-01-09 23:21 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).