Skip to contentSkip to conversation

mptcp: copy mptcp receive buffer setting to subflow

PATCH In review Florian Westphal 2 participants 2 messages Mar 12, 2020 – Mar 13, 2020

Subsystems (2)
lore
Share & tools
lore

Florian Westphal

author
#0 lore raw

PATCH 1/1 mptcp: copy mptcp receive buffer setting to subflow

For incoming/outgoing connections, initial window is chosen based om the subflow receive buffer size.

In case mptcp socket has a fixed buffer size, we should copy it to the subflow/tcp socket as well.

Signed-off-by Florian Westphal <fw(a)strlen.de>

---
I'll pass this to netdev@ unless there are objections.

 net/mptcp/protocol.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
net/mptcp/protocol.c +10 -0
index ddfd02ab6e31..a65cedcb905f 100644
@@ -89,6 +89,15 @@ static bool __mptcp_can_create_subflow(const struct mptcp_sock *msk)
 	return !msk->first;
 }
 
+static void sync_rcvbuf(const struct sock *msk, struct sock *ssk)
+{
+	if (unlikely((msk->sk_userlocks & SOCK_RCVBUF_LOCK) &&
+	     ssk->sk_rcvbuf != msk->sk_rcvbuf)) {
+		ssk->sk_userlocks |= SOCK_RCVBUF_LOCK;
+		WRITE_ONCE(ssk->sk_rcvbuf, msk->sk_rcvbuf);
+	}
+}
+
 static struct socket *__mptcp_socket_create(struct mptcp_sock *msk, int state)
 {
 	struct mptcp_subflow_context *subflow;
@@ -107,6 +116,7 @@ static struct socket *__mptcp_socket_create(struct mptcp_sock *msk, int state)
 	if (err)
 		return ERR_PTR(err);
 
+	sync_rcvbuf(sk, ssock->sk);
 	msk->first = ssock->sk;
 	msk->subflow = ssock;
 	subflow = mptcp_subflow_ctx(ssock->sk);
Signature · 1 line
2.24.1
#1 lore raw
Quoted 5 lines · Florian Westphal

For incoming/outgoing connections, initial window is chosen based om the subflow receive buffer size.

In case mptcp socket has a fixed buffer size, we should copy it to the subflow/tcp socket as well.

Does this need to be synced later in the connection when SO_RECVBUF is changed? If it does, this patch is not really blocked: copying the value at subflow creation time allows initial window tuning that isn't currently possible.

Mat

Quoted 42 lines
Signed-off-by Florian Westphal <fw(a)strlen.de>

---
I'll pass this to netdev@ unless there are objections.

net/mptcp/protocol.c | 10 ++++++++++

1 file changed, 10 insertions(+)
net/mptcp/protocol.c +10 -0
index ddfd02ab6e31..a65cedcb905f 100644
@@ -89,6 +89,15 @@ static bool __mptcp_can_create_subflow(const struct mptcp_sock *msk)
 	return !msk->first;
 }
 
+static void sync_rcvbuf(const struct sock *msk, struct sock *ssk)
+{
+	if (unlikely((msk->sk_userlocks & SOCK_RCVBUF_LOCK) &&
+	     ssk->sk_rcvbuf != msk->sk_rcvbuf)) {
+		ssk->sk_userlocks |= SOCK_RCVBUF_LOCK;
+		WRITE_ONCE(ssk->sk_rcvbuf, msk->sk_rcvbuf);
+	}
+}
+
 static struct socket *__mptcp_socket_create(struct mptcp_sock *msk, int state)
 {
 	struct mptcp_subflow_context *subflow;
@@ -107,6 +116,7 @@ static struct socket *__mptcp_socket_create(struct mptcp_sock *msk, int state)
 	if (err)
 		return ERR_PTR(err);
 
+	sync_rcvbuf(sk, ssock->sk);
 	msk->first = ssock->sk;
 	msk->subflow = ssock;
 	subflow = mptcp_subflow_ctx(ssock->sk);
Signature · 4 lines
2.24.1
_______________________________________________
mptcp mailing list -- mptcp(a)lists.01.org
To unsubscribe send an email to mptcp-leave(a)lists.01.org

--
Mat Martineau
Intel