Skip to contentSkip to conversation

mptcp: some cleanups

PATCH In review Paolo Abeni 3 participants 8 messages Nov 11, 2019 – Nov 13, 2019

Subsystems (2)
lore
Share & tools
lore

Paolo Abeni

author
#0 lore raw

cover mptcp: some cleanups

This address the build issue we currently have on patch "mptcp: Add key generation and token tree", plus move around some related code for consistency.

No differences in the resulting code vs current git tree. The tree should build on each patch now.

Paolo Abeni (1):
1/4 mptcp: drop most of mptcp_init_sock() impl
2/4 mptcp: use customary name for tcp_sock variable 3/4 mptcp: init ctx->icsk_af_ops in subflow_ulp_init() 4/4 mptcp: init new_ctx->icsk_af_ops() in subflow_ulp_clone()

 net/mptcp/protocol.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
Signature · 1 line
2.21.0
author
#1 lore raw

PATCH 1/4 mptcp: drop most of mptcp_init_sock() impl

Will be dropped anyway by laters patches and apparently introduces a mem leak (currently plugged by "mptcp: new sysctl to control the activation per NS")

Squash-to: "mptcp: Add MPTCP socket stubs"
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>

---
 net/mptcp/protocol.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/mptcp/protocol.c +1 -12
index a4efa06e43d2..40290bfd0717 100644
@@ -39,18 +39,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
 
 static int mptcp_init_sock(struct sock *sk)
 {
-	struct mptcp_sock *msk = mptcp_sk(sk);
-	struct net *net = sock_net(sk);
-	struct socket *sf;
-	int err;
-
-	err = sock_create_kern(net, PF_INET, SOCK_STREAM, IPPROTO_TCP, &sf);
-	if (!err) {
-		pr_debug("subflow=%p", sf->sk);
-		msk->subflow = sf;
-	}
-
-	return err;
+	return 0;
 }
 
 static void mptcp_close(struct sock *sk, long timeout)
Signature · 1 line
2.21.0
author
#2 lore raw

PATCH 2/4 mptcp: use customary name for tcp_sock variable

In reply to Paolo Abeni

The variable is currently renamed in later patch "mptcp: Handle MP_CAPABLE options for outgoing connections", let's do it here instead

Squash-to: mptcp: Associate MPTCP context with TCP socket
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>

---
 net/mptcp/subflow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/subflow.c +2 -2
index c1800f94437d..29d4d1cb284e 100644
@@ -63,8 +63,8 @@ static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk,
 
 static int subflow_ulp_init(struct sock *sk)
 {
-	struct tcp_sock *tsk = tcp_sk(sk);
 	struct mptcp_subflow_context *ctx;
+	struct tcp_sock *tp = tcp_sk(sk);
 	int err = 0;
 
 	/* disallow attaching ULP to a socket unless it has been
@@ -83,7 +83,7 @@ static int subflow_ulp_init(struct sock *sk)
 
 	pr_debug("subflow=%p", ctx);
 
-	tsk->is_mptcp = 1;
+	tp->is_mptcp = 1;
 out:
 	return err;
 }
Signature · 1 line
2.21.0
author
#3 lore raw

PATCH 3/4 mptcp: init ctx->icsk_af_ops in subflow_ulp_init()

In reply to Paolo Abeni

Currently inited in "mptcp: Add key generation and token tree", better move initializiation here, where we already init icsk->icsk_af_ops

Squash-to: "mptcp: Handle MP_CAPABLE options for outgoing connections"
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>

---
 net/mptcp/subflow.c | 1 +
 1 file changed, 1 insertion(+)
net/mptcp/subflow.c +1 -0
index 10ec2bcb9807..de10f7f9740c 100644
@@ -101,6 +101,7 @@ static int subflow_ulp_init(struct sock *sk)
 	pr_debug("subflow=%p", ctx);
 
 	tp->is_mptcp = 1;
+	ctx->icsk_af_ops = icsk->icsk_af_ops;
 	icsk->icsk_af_ops = &subflow_specific;
 out:
 	return err;
Signature · 1 line
2.21.0
author
#4 lore raw

PATCH 4/4 mptcp: init new_ctx->icsk_af_ops() in subflow_ulp_clone()

In reply to Paolo Abeni

Currently inited in "mptcp: Add key generation and token tree", causing transient build failure, move here for consistency and fix build issue

Squash-to: "mptcp: Create SUBFLOW socket for incoming connections"
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>

---
 net/mptcp/subflow.c | 2 ++
 1 file changed, 2 insertions(+)
net/mptcp/subflow.c +2 -0
index 5c0594d09cc5..869010587df4 100644
@@ -212,6 +212,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
 			      const gfp_t priority)
 {
 	struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
+	struct mptcp_subflow_context *old_ctx = mptcp_subflow_ctx(newsk);
 	struct mptcp_subflow_context *new_ctx;
 
 	/* newsk->sk_socket is NULL at this point */
@@ -221,6 +222,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
 
 	new_ctx->conn = NULL;
 	new_ctx->conn_finished = 1;
+	new_ctx->icsk_af_ops = old_ctx->icsk_af_ops;
 
 	if (subflow_req->mp_capable) {
 		new_ctx->mp_capable = 1;
Signature · 1 line
2.21.0
#5 lore raw
In reply to Paolo Abeni
Quoted 7 lines · Paolo Abeni

This address the build issue we currently have on patch "mptcp: Add key generation and token tree", plus move around some related code for consistency.

No differences in the resulting code vs current git tree. The tree should build on each patch now.

Quoted 9 lines

Paolo Abeni (1):
1/4 mptcp: drop most of mptcp_init_sock() impl
2/4 mptcp: use customary name for tcp_sock variable 3/4 mptcp: init ctx->icsk_af_ops in subflow_ulp_init() 4/4 mptcp: init new_ctx->icsk_af_ops() in subflow_ulp_clone()

net/mptcp/protocol.c | 13 +------------

1 file changed, 1 insertion(+), 12 deletions(-)

Paolo -

The series looks good to me. Thank you.

--
Mat Martineau
Intel

#6 lore raw

Hi Paolo, Mat,

Quoted 16 lines · Mat Martineau
Quoted 13 lines · Paolo Abeni

This address the build issue we currently have on patch "mptcp: Add key generation and token tree", plus move around some related code for consistency.

No differences in the resulting code vs current git tree. The tree should build on each patch now.

Paolo Abeni (1):
 1/4 mptcp: drop most of mptcp_init_sock() impl
 2/4 mptcp: use customary name for tcp_sock variable 3/4 mptcp: init ctx->icsk_af_ops in subflow_ulp_init() 4/4 mptcp: init new_ctx->icsk_af_ops() in subflow_ulp_clone()

Quoted 7 lines
Quoted 3 lines

net/mptcp/protocol.c | 13 +------------

1 file changed, 1 insertion(+), 12 deletions(-)

Paolo -

The series looks good to me. Thank you.

Thank you for the patches and the review!

- cc05c38b4573: "squashed" patch 1/4 in "mptcp: Add MPTCP socket stubs"
- ecede607a17a: "Signed-off-by" + "Co-developed-by"
- 7c82356afd6f: "squashed" patch 2/4 in "mptcp: Associate MPTCP context with TCP socket"
- 202c54a08e5e: "Signed-off-by" + "Co-developed-by"
- 5d2b86be05bb: conflict in t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
- c7525f68d8a7: "squashed" patch 3/4 in "mptcp: Handle MP_CAPABLE options for outgoing connections"
- 929b8bea462e: "Signed-off-by" + "Co-developed-by"
- 66b67498f31c: "squashed" patch 4/4 in "mptcp: Create SUBFLOW socket for incoming connections"
- 21a15201f708: conflict in t/mptcp-new-sysctl-to-control-the-activation-per-NS
- ca62776f7f0d..e225da73a467: result (empty, as expected)

Please see the different conflict resolutions.

Tests are in progress.

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
#7 lore raw

Hi Paolo,

Quoted 46 lines · Matthieu Baerts

Hi Paolo, Mat,

Quoted 17 lines · Mat Martineau
Quoted 14 lines · Paolo Abeni

This address the build issue we currently have on patch "mptcp: Add key generation and token tree", plus move around some related
code for consistency.

No differences in the resulting code vs current git tree. The tree should build on each patch now.

Paolo Abeni (1):
 1/4 mptcp: drop most of mptcp_init_sock() impl
 2/4 mptcp: use customary name for tcp_sock variable 3/4 mptcp: init ctx->icsk_af_ops in subflow_ulp_init() 4/4 mptcp: init new_ctx->icsk_af_ops() in subflow_ulp_clone()

Quoted 7 lines
Quoted 3 lines

net/mptcp/protocol.c | 13 +------------

1 file changed, 1 insertion(+), 12 deletions(-)

Paolo -

The series looks good to me. Thank you.

Thank you for the patches and the review!

- cc05c38b4573: "squashed" patch 1/4 in "mptcp: Add MPTCP socket stubs"
- ecede607a17a: "Signed-off-by" + "Co-developed-by"
- 7c82356afd6f: "squashed" patch 2/4 in "mptcp: Associate MPTCP context with TCP socket"
- 202c54a08e5e: "Signed-off-by" + "Co-developed-by"
- 5d2b86be05bb: conflict in t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
- c7525f68d8a7: "squashed" patch 3/4 in "mptcp: Handle MP_CAPABLE options for outgoing connections"
- 929b8bea462e: "Signed-off-by" + "Co-developed-by"
- 66b67498f31c: "squashed" patch 4/4 in "mptcp: Create SUBFLOW socket for incoming connections"
- 21a15201f708: conflict in t/mptcp-new-sysctl-to-control-the-activation-per-NS
- ca62776f7f0d..e225da73a467: result (empty, as expected)

Quoted 1 line

Please see the different conflict resolutions.

I missed something when resolving conflicts. Here are the fixes:

- a52b7bb7b026: fix in t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
- f3e04ebb0c5a..023d3b14d1b5: still empty, as expected!

I just relaunched the tests.

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium