From a06be607d2e9367fc7e2f957de9de393070735b7 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Wed, 1 May 2024 21:54:52 +0800 Subject: [PATCH] mptcp: fix the max value of scaling_ratio BPF tests fail sometimes (a probability of approximately 1%) with "bytes != total_bytes" errors: test_burst:PASS:open_and_load:burst 0 nsec test_bpf_sched:PASS:Scheduler name too long 0 nsec test_bpf_sched:PASS:burst 0 nsec create_netns:PASS:ip netns add mptcp_ns 0 nsec create_netns:PASS:ip -net mptcp_ns link set dev lo up 0 nsec sched_init:PASS:create_netns 0 nsec endpoint_init:PASS:ip -net mptcp_ns link add veth1 type veth peer name endpoint_init:PASS:ip -net mptcp_ns addr add 10.0.1.1/24 dev veth1 0 nsec endpoint_init:PASS:ip -net mptcp_ns link set dev veth1 up 0 nsec endpoint_init:PASS:ip -net mptcp_ns addr add 10.0.1.2/24 dev veth2 0 nsec endpoint_init:PASS:ip -net mptcp_ns link set dev veth2 up 0 nsec endpoint_init:PASS:ip -net mptcp_ns mptcp endpoint add 10.0.1.2 subflow sched_init:PASS:endpoint_init 0 nsec test_bpf_sched:PASS:burst 0 nsec send_data_and_verify:PASS:burst 0 nsec send_data_and_verify:PASS:burst 0 nsec (network_helpers.c:613: errno: Resource temporarily unavailable) \ send 5608500 expected 10485760 (network_helpers.c:661: errno: None) recv 2755984 expected 10485760 (network_helpers.c:669: errno: None) Failed in thread_ret -11 send_data_and_verify:FAIL:send_recv_data unexpected error: -4 (errno 0) #162/9 mptcp/burst:FAIL #162 mptcp:FAIL In this case, mptcp_recvmsg() gets EAGAIN errors. This issue introduces by commit b8dc6d6ce931 ("mptcp: fix rcv buffer auto-tuning"). The max value of scaling_ratio should be TCP_DEFAULT_SCALING_RATIO (128), not U8_MAX (255). Otherwise, scaling_ratio is assigned to a too high value. Fixes: b8dc6d6ce931 ("mptcp: fix rcv buffer auto-tuning") Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/487 Signed-off-by: Geliang Tang --- net/mptcp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 579031c609372..d00cd21e8d3fc 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1981,9 +1981,9 @@ static int __mptcp_recvmsg_mskq(struct mptcp_sock *msk, */ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied) { + u8 scaling_ratio = TCP_DEFAULT_SCALING_RATIO; struct mptcp_subflow_context *subflow; struct sock *sk = (struct sock *)msk; - u8 scaling_ratio = U8_MAX; u32 time, advmss = 1; u64 rtt_us, mstamp;