Skip to contentSkip to conversation

update PM event CLOSED handlers

PATCH In review Geliang Tang 3 participants 8 messages Sep 9, 2024

Subsystems (2)
lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

cover update PM event CLOSED handlers

From: Geliang Tang <[email protected]>

Update two MPTCP PM event handlers: mptcp_pm_connection_closed and mptcp_pm_subflow_closed.

Geliang Tang (2):
mptcp: implement mptcp_pm_connection_closed
mptcp: add back mptcp_pm_subflow_closed

 net/mptcp/pm.c       | 10 ++++++++++
 net/mptcp/protocol.c |  8 +++-----
 net/mptcp/protocol.h |  1 +
 3 files changed, 14 insertions(+), 5 deletions(-)
Signature · 1 line
2.43.0
author reviewer
#1 lore raw

PATCH 1/2 mptcp: implement mptcp_pm_connection_closed

From: Geliang Tang <[email protected]>

The MPTCP path manager event handler mptcp_pm_connection_closed interface is added in the commit "mptcp: Add path manager interface", but it was an empty function from then on. It makes sense to invoke mptcp_event with the MPTCP_EVENT_CLOSED event type in it.

---
 net/mptcp/pm.c       | 3 +++
 net/mptcp/protocol.c | 6 ++----
 2 files changed, 5 insertions(+), 4 deletions(-)
net/mptcp/pm.c +3 -0
index 620264c75dc2..16c336c51940 100644
@@ -154,6 +154,9 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk)
 void mptcp_pm_connection_closed(struct mptcp_sock *msk)
 {
 	pr_debug("msk=%p\n", msk);
+
+	if (msk->token)
+		mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL);
 }
 
 void mptcp_pm_subflow_established(struct mptcp_sock *msk)
net/mptcp/protocol.c +2 -4
index 7ef59e17d03a..a12149d8f718 100644
@@ -3121,8 +3121,7 @@ bool __mptcp_close(struct sock *sk, long timeout)
 
 	sock_hold(sk);
 	pr_debug("msk=%p state=%d\n", sk, sk->sk_state);
-	if (msk->token)
-		mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL);
+	mptcp_pm_connection_closed(msk);
 
 	if (sk->sk_state == TCP_CLOSE) {
 		__mptcp_destroy_sock(sk);
@@ -3188,8 +3187,7 @@ static int mptcp_disconnect(struct sock *sk, int flags)
 	mptcp_stop_rtx_timer(sk);
 	mptcp_stop_tout_timer(sk);
 
-	if (msk->token)
-		mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL);
+	mptcp_pm_connection_closed(msk);
 
 	/* msk->subflow is still intact, the following will not free the first
 	 * subflow
Signature · 1 line
2.43.0
author reviewer
#3 lore raw

PATCH 2/2 mptcp: add back mptcp_pm_subflow_closed

In reply to Geliang Tang

From: Geliang Tang <[email protected]>

The MPTCP path manager event handler mptcp_pm_subflow_closed interface is added in the commit "mptcp: Add path manager interface", but removed in the commit "mptcp: do not block subflows creation on errors".

This patch adds it back and changes its 2nd parameter from "u8 id" to "struct sock *ssk". Invoke mptcp_event with the MPTCP_EVENT_SUB_CLOSED event type in it.

---
 net/mptcp/pm.c       | 7 +++++++
 net/mptcp/protocol.c | 2 +-
 net/mptcp/protocol.h | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)
net/mptcp/pm.c +7 -0
index 16c336c51940..23f73f07a9e7 100644
@@ -176,6 +176,13 @@ void mptcp_pm_subflow_established(struct mptcp_sock *msk)
 	spin_unlock_bh(&pm->lock);
 }
 
+void mptcp_pm_subflow_closed(struct mptcp_sock *msk, struct sock *ssk)
+{
+	pr_debug("msk=%p", msk);
+
+	mptcp_event(MPTCP_EVENT_SUB_CLOSED, msk, ssk, GFP_KERNEL);
+}
+
 void mptcp_pm_subflow_check_next(struct mptcp_sock *msk,
 				 const struct mptcp_subflow_context *subflow)
 {
net/mptcp/protocol.c +1 -1
index a12149d8f718..69859eb2d891 100644
@@ -2515,7 +2515,7 @@ void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
 	subflow->close_event_done = true;
 
 	if (sk->sk_state == TCP_ESTABLISHED)
-		mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk), ssk, GFP_KERNEL);
+		mptcp_pm_subflow_closed(mptcp_sk(sk), ssk);
 
 	/* subflow aborted before reaching the fully_established status
 	 * attempt the creation of the next subflow
net/mptcp/protocol.h +1 -0
index d25d2dac88a5..0c8ab6071a3f 100644
@@ -996,6 +996,7 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk);
 bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk);
 void mptcp_pm_connection_closed(struct mptcp_sock *msk);
 void mptcp_pm_subflow_established(struct mptcp_sock *msk);
+void mptcp_pm_subflow_closed(struct mptcp_sock *msk, struct sock *ssk);
 bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk);
 void mptcp_pm_subflow_check_next(struct mptcp_sock *msk,
 				 const struct mptcp_subflow_context *subflow);
Signature · 1 line
2.43.0
#6 lore raw
In reply to Geliang Tang

Hi Geliang,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/10766245271

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/81049f6b01c7
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=888215

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)

author reviewer
#4 lore raw

Re: [PATCH mptcp-next 2/2] mptcp: add back mptcp_pm_subflow_closed

In reply to Geliang Tang
Quoted 31 lines · Geliang Tang

From: Geliang Tang <[email protected]>

The MPTCP path manager event handler mptcp_pm_subflow_closed interface
is added in the commit "mptcp: Add path manager interface", but removed
in the commit "mptcp: do not block subflows creation on errors".

This patch adds it back and changes its 2nd parameter from "u8 id" to "struct sock *ssk". Invoke mptcp_event with the MPTCP_EVENT_SUB_CLOSED
event type in it.

---
 net/mptcp/pm.c       | 7 +++++++
 net/mptcp/protocol.c | 2 +-
 net/mptcp/protocol.h | 1 +

 3 files changed, 9 insertions(+), 1 deletion(-)
net/mptcp/pm.c +0 -0
index 16c336c51940..23f73f07a9e7 100644
@@ -176,6 +176,13 @@ void mptcp_pm_subflow_established(struct
 mptcp_sock *msk)
  	spin_unlock_bh(&pm->lock);
  }


+void mptcp_pm_subflow_closed(struct mptcp_sock *msk, struct sock *ssk)

net/mptcp/pm.c void mptcp_pm_subflow_established(struct mptcp_sock *msk) · line 181

Quoted 2 lines
net/mptcp/pm.c +2 -0
+{
+	pr_debug("msk=%p", msk);

"\n" is missing, should be:

	pr_debug("msk=%p\n", msk);

Thanks,
-Geliang

Quoted 39 lines
net/mptcp/pm.c +4 -0
+
+	mptcp_event(MPTCP_EVENT_SUB_CLOSED, msk, ssk, GFP_KERNEL);
+}
+

 void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, const struct mptcp_subflow_context *subflow)
 {

net/mptcp/protocol.c +0 -0
index a12149d8f718..69859eb2d891 100644
@@ -2515,7 +2515,7 @@ void mptcp_close_ssk(struct sock *sk, struct
 sock *ssk,
  	subflow->close_event_done = true;


  if (sk->sk_state == TCP_ESTABLISHED)

net/mptcp/protocol.c +0 -1
-		mptcp_event(MPTCP_EVENT_SUB_CLOSED, mptcp_sk(sk),

ssk, GFP_KERNEL);

net/mptcp/protocol.c +1 -0
+		mptcp_pm_subflow_closed(mptcp_sk(sk), ssk);


  /* subflow aborted before reaching the fully_established status
  * attempt the creation of the next subflow

net/mptcp/protocol.h +1 -0
index d25d2dac88a5..0c8ab6071a3f 100644
@@ -996,6 +996,7 @@ void mptcp_pm_fully_established(struct mptcp_sock
 *msk, const struct sock *ssk);
  bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk);
  void mptcp_pm_connection_closed(struct mptcp_sock *msk);
  void mptcp_pm_subflow_established(struct mptcp_sock *msk);
+void mptcp_pm_subflow_closed(struct mptcp_sock *msk, struct sock
 *ssk);
  bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk);

 void mptcp_pm_subflow_check_next(struct mptcp_sock *msk, const struct mptcp_subflow_context *subflow);

maintainer
#5 lore raw

Re: [PATCH mptcp-next 2/2] mptcp: add back mptcp_pm_subflow_closed

In reply to Geliang Tang

Hi Geliang,

Quoted 9 lines · Geliang Tang

From: Geliang Tang <[email protected]>

The MPTCP path manager event handler mptcp_pm_subflow_closed interface is added in the commit "mptcp: Add path manager interface", but removed in the commit "mptcp: do not block subflows creation on errors".

This patch adds it back and changes its 2nd parameter from "u8 id" to "struct sock *ssk". Invoke mptcp_event with the MPTCP_EVENT_SUB_CLOSED event type in it.

Please *always* add a reason: why is better to add it back? Is it to avoid duplicated code? To move have all the event triggered from pm.c? etc.

Also, I'm less sure about that one: mptcp_pm_subflow_check_next() is called just after. Why not having only one call to the PM side and handle both? (or leave it as it is for the moment if you don't need to change stuff around)

I'm then going to apply only the first patch if that's OK.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH mptcp-next 1/2] mptcp: implement mptcp_pm_connection_closed

In reply to Geliang Tang

Hi Geliang,

Thank you for the patch.

Quoted 4 lines · Geliang Tang

From: Geliang Tang <[email protected]>

The MPTCP path manager event handler mptcp_pm_connection_closed interface is added in the commit "mptcp: Add path manager interface", but it was an

I think it is better to add the SHA:

in the commit 1b1c7a0ef7f3 ("mptcp: Add path manager interface"), but

I can fix that when applying the patch.

Quoted 2 lines

empty function from then on. It makes sense to invoke mptcp_event with the MPTCP_EVENT_CLOSED event type in it.

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.
maintainer
#7 lore raw
In reply to Geliang Tang

Hi Geliang,

Quoted 7 lines · Geliang Tang

From: Geliang Tang <[email protected]>

Update two MPTCP PM event handlers: mptcp_pm_connection_closed and mptcp_pm_subflow_closed.

Geliang Tang (2):
mptcp: implement mptcp_pm_connection_closed

As mentioned in the individual reviews, I only applied the first patch:

New patches for t/upstream:
- 272ee90e0bd8: mptcp: implement mptcp_pm_connection_closed
- Results: 42ffd3cd6ef4..2e425b685ff0 (export)

Tests are now in progress:

- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/3073eb594e0b71e81f2e6db6b883a9baca2c9d86/checks

Quoted 1 line

mptcp: add back mptcp_pm_subflow_closed

Cheers,
Matt

Signature · 1 line
Sponsored by the NGI0 Core fund.