Skip to contentSkip to conversation

bpf: correctly set initial window on active Fast Open sender

PATCH Applied Yuchung Cheng 3 participants 3 messages Jan 9, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: correctly set initial window on active Fast Open sender

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")
---
 net/core/filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
index 447dd1bad31f..2b3b436ef545 100644
@@ -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;
Signature · 1 line
2.20.1.97.g81188d93c3-goog
Acked-by on v1 1/1
#1 lore raw

On 1/8/19, 6:13 PM, "[email protected] on behalf of Yuchung Cheng" <[email protected] on behalf of [email protected]> 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 <[email protected]>
    Reviewed-by: Neal Cardwell <[email protected]>
    ---
     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.

#2 lore raw
In reply to Yuchung Cheng
Quoted 9 lines · 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")

Applied, Thanks