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

Geliang Tang posted 2 patches 1 year, 5 months ago
[PATCH mptcp-next 1/2] mptcp: implement mptcp_pm_connection_closed
Posted by Geliang Tang 1 year, 5 months ago
From: Geliang Tang <tanggeliang@kylinos.cn>

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.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/pm.c       | 3 +++
 net/mptcp/protocol.c | 6 ++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index 620264c75dc2..16c336c51940 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -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)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 7ef59e17d03a..a12149d8f718 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -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
-- 
2.43.0
Re: [PATCH mptcp-next 1/2] mptcp: implement mptcp_pm_connection_closed
Posted by Matthieu Baerts 1 year, 5 months ago
Hi Geliang,

Thank you for the patch.

On 09/09/2024 05:45, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> 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.

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

Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.