Skip to content

Commit 6d4e8fd

Browse files
committed
tgupdate: merge t/DO-NOT-MERGE-mptcp-enabled-by-default base into t/DO-NOT-MERGE-mptcp-enabled-by-default
2 parents 02ea629 + 3a665a0 commit 6d4e8fd

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

Documentation/networking/mptcp-sysctl.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ MPTCP Sysfs variables
88
===============================
99

1010
add_addr_timeout - INTEGER (seconds)
11-
Set the timeout after which an ADD_ADDR control message will be
12-
resent to an MPTCP peer that has not acknowledged a previous
13-
ADD_ADDR message.
11+
Set the maximum value of timeout after which an ADD_ADDR control message
12+
will be resent to an MPTCP peer that has not acknowledged a previous
13+
ADD_ADDR message. A dynamically estimated retransmission timeout based
14+
on the estimated connection round-trip-time is used if this value is
15+
lower than the maximum one.
1416

1517
Do not retransmit if set to 0.
1618

net/mptcp/pm.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,27 @@ int mptcp_pm_mp_prio_send_ack(struct mptcp_sock *msk,
268268
return -EINVAL;
269269
}
270270

271+
static unsigned int mptcp_adjust_add_addr_timeout(struct mptcp_sock *msk)
272+
{
273+
const struct net *net = sock_net((struct sock *)msk);
274+
unsigned int rto = mptcp_get_add_addr_timeout(net);
275+
struct mptcp_subflow_context *subflow;
276+
unsigned int max = 0;
277+
278+
mptcp_for_each_subflow(msk, subflow) {
279+
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
280+
struct inet_connection_sock *icsk = inet_csk(ssk);
281+
282+
if (icsk->icsk_rto > max)
283+
max = icsk->icsk_rto;
284+
}
285+
286+
if (max && max < rto)
287+
rto = max;
288+
289+
return rto;
290+
}
291+
271292
static void mptcp_pm_add_timer(struct timer_list *timer)
272293
{
273294
struct mptcp_pm_add_entry *entry = timer_container_of(entry, timer,
@@ -292,7 +313,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
292313
goto out;
293314
}
294315

295-
timeout = mptcp_get_add_addr_timeout(sock_net(sk));
316+
timeout = mptcp_adjust_add_addr_timeout(msk);
296317
if (!timeout)
297318
goto out;
298319

@@ -307,7 +328,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
307328

308329
if (entry->retrans_times < ADD_ADDR_RETRANS_MAX)
309330
sk_reset_timer(sk, timer,
310-
jiffies + timeout);
331+
jiffies + (timeout << entry->retrans_times));
311332

312333
spin_unlock_bh(&msk->pm.lock);
313334

@@ -348,7 +369,6 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
348369
{
349370
struct mptcp_pm_add_entry *add_entry = NULL;
350371
struct sock *sk = (struct sock *)msk;
351-
struct net *net = sock_net(sk);
352372
unsigned int timeout;
353373

354374
lockdep_assert_held(&msk->pm.lock);
@@ -374,7 +394,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
374394

375395
timer_setup(&add_entry->add_timer, mptcp_pm_add_timer, 0);
376396
reset_timer:
377-
timeout = mptcp_get_add_addr_timeout(net);
397+
timeout = mptcp_adjust_add_addr_timeout(msk);
378398
if (timeout)
379399
sk_reset_timer(sk, &add_entry->add_timer, jiffies + timeout);
380400

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,6 @@ reset_with_add_addr_timeout()
347347
tables="${ip6tables}"
348348
fi
349349

350-
ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
351-
352350
if ! ip netns exec $ns2 $tables -A OUTPUT -p tcp \
353351
-m tcp --tcp-option 30 \
354352
-m bpf --bytecode \
@@ -2183,7 +2181,6 @@ signal_address_tests()
21832181
pm_nl_add_endpoint $ns2 10.0.4.2 flags signal
21842182

21852183
# the peer could possibly miss some addr notification, allow retransmission
2186-
ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
21872184
speed=slow \
21882185
run_tests $ns1 $ns2 10.0.1.1
21892186

0 commit comments

Comments
 (0)