All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] [RFC 1/5] mptcp: perform mptcp ack update during read operations
@ 2020-02-13 10:27 Florian Westphal
  0 siblings, 0 replies; only message in thread
From: Florian Westphal @ 2020-02-13 10:27 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 1939 bytes --]

tcp_read_sock() will drain the receive queue, i.e. it frees memory.
Therefore, at the end of the function it can generate ACKs to open
up the tcp receive window.

Unfortunately, the MPTCP ack sequence was updated later, i.e. those
ACKs carry an outdated mptcp ack sequence.

This isn't a bug per se, but we can improve this and update the
mptcp ack in the read actor callback, thus allowing the acks sent
by tcp_read_sock() to include the most recent mptcp ack sequence.

Suggested-by: Paolo Abeni <pabeni(a)redhat.com>
Signed-off-by: Florian Westphal <fw(a)strlen.de>
---
 net/mptcp/protocol.c | 4 +++-
 net/mptcp/protocol.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 1f405b812243..f68ee86376f0 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -608,6 +608,8 @@ int mptcp_read_actor(read_descriptor_t *desc, struct sk_buff *skb,
 			desc->error = err;
 			return err;
 		}
+
+		arg->msk->ack_seq += copy_len;
 	} else {
 		pr_debug("Flushing skb payload");
 	}
@@ -664,6 +666,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 	}
 
 	arg.msg = msg;
+	arg.msk = msk;
 	desc.arg.data = &arg;
 	desc.error = 0;
 
@@ -704,7 +707,6 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 
 			pr_debug("msk ack_seq=%llx -> %llx", msk->ack_seq,
 				 msk->ack_seq + bytes_read);
-			msk->ack_seq += bytes_read;
 			copied += bytes_read;
 			if (copied >= len) {
 				done = true;
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 3fbb33deb764..06a57bf6d5f0 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -305,6 +305,7 @@ int mptcp_proto_v6_init(void);
 
 struct mptcp_read_arg {
 	struct msghdr *msg;
+	struct mptcp_sock *msk;
 };
 
 int mptcp_read_actor(read_descriptor_t *desc, struct sk_buff *skb,
-- 
2.24.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-13 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 10:27 [MPTCP] [RFC 1/5] mptcp: perform mptcp ack update during read operations Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.