summaryrefslogtreecommitdiffstats
path: root/net/mptcp/options.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2020-11-16 10:48:13 +0100
committerJakub Kicinski <kuba@kernel.org>2020-11-16 10:46:07 -0800
commit6f8a612a33e426d473f7161d1950dc00a613494b (patch)
tree38d484799e333eea7da33f483219f3d9a3a41760 /net/mptcp/options.c
parent8edf08649eede6e5a3e39a3d38c63f30039a0c1e (diff)
mptcp: keep track of advertised windows right edge
Before sending 'x' new bytes also check that the new snd_una would be within the permitted receive window. For every ACK that also contains a DSS ack, check whether its tcp-level receive window would advance the current mptcp window right edge and update it if so. Signed-off-by: Florian Westphal <fw@strlen.de> Co-developed-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mptcp/options.c')
-rw-r--r--net/mptcp/options.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 1be272d2bd95..f2d1e27a2bc1 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -809,11 +809,14 @@ static u64 expand_ack(u64 old_ack, u64 cur_ack, bool use_64bit)
return cur_ack;
}
-static void update_una(struct mptcp_sock *msk,
- struct mptcp_options_received *mp_opt)
+static void ack_update_msk(struct mptcp_sock *msk,
+ const struct sock *ssk,
+ struct mptcp_options_received *mp_opt)
{
u64 new_snd_una, snd_una, old_snd_una = atomic64_read(&msk->snd_una);
+ u64 new_wnd_end, wnd_end, old_wnd_end = atomic64_read(&msk->wnd_end);
u64 snd_nxt = READ_ONCE(msk->snd_nxt);
+ struct sock *sk = (struct sock *)msk;
/* avoid ack expansion on update conflict, to reduce the risk of
* wrongly expanding to a future ack sequence number, which is way
@@ -825,12 +828,25 @@ static void update_una(struct mptcp_sock *msk,
if (after64(new_snd_una, snd_nxt))
new_snd_una = old_snd_una;
+ new_wnd_end = new_snd_una + tcp_sk(ssk)->snd_wnd;
+
+ while (after64(new_wnd_end, old_wnd_end)) {
+ wnd_end = old_wnd_end;
+ old_wnd_end = atomic64_cmpxchg(&msk->wnd_end, wnd_end,
+ new_wnd_end);
+ if (old_wnd_end == wnd_end) {
+ if (mptcp_send_head(sk))
+ mptcp_schedule_work(sk);
+ break;
+ }
+ }
+
while (after64(new_snd_una, old_snd_una)) {
snd_una = old_snd_una;
old_snd_una = atomic64_cmpxchg(&msk->snd_una, snd_una,
new_snd_una);
if (old_snd_una == snd_una) {
- mptcp_data_acked((struct sock *)msk);
+ mptcp_data_acked(sk);
break;
}
}
@@ -930,7 +946,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
* monodirectional flows will stuck
*/
if (mp_opt.use_ack)
- update_una(msk, &mp_opt);
+ ack_update_msk(msk, sk, &mp_opt);
/* Zero-data-length packets are dropped by the caller and not
* propagated to the MPTCP layer, so the skb extension does not