diff mbox series

[mptcp-next,v1,3/9] mptcp: pm: in-kernel: address_removed interface

Message ID 294f452c959c08593649eacfe77783cff96c0807.1740047738.git.tanggeliang@kylinos.cn (mailing list archive)
State New
Delegated to: Matthieu Baerts
Headers show
Series BPF path manager, part 5 | expand

Checks

Context Check Description
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 34 lines checked
matttbe/shellcheck success MPTCP selftests files have not been modified
matttbe/build success Build and static analysis OK
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf-normal__only_bpftest_all_ success Success! ✅
matttbe/KVM_Validation__btf-debug__only_bpftest_all_ success Success! ✅

Commit Message

Geliang Tang Feb. 20, 2025, 10:36 a.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

Update the 2nd parameter of mptcp_pm_nl_address_removed(), and define it
as the address_removed() interface of the in-kernel netlink PM.

This interface is invoked under holding the msk socket lock.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 net/mptcp/pm_netlink.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 107f13560202..53246a3a1b09 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -1522,8 +1522,9 @@  static void __mark_subflow_endp_available(struct mptcp_sock *msk, u8 id)
 }
 
 static int mptcp_pm_nl_address_removed(struct mptcp_sock *msk,
-				       const struct mptcp_pm_addr_entry *local)
+				       struct mptcp_pm_param *param)
 {
+	struct mptcp_pm_addr_entry *local = &param->entry;
 	bool remove_subflow;
 
 	remove_subflow = mptcp_lookup_subflow_by_saddr(&msk->conn_list, &local->addr);
@@ -1569,12 +1570,16 @@  static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net,
 
 	while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) {
 		struct sock *sk = (struct sock *)msk;
+		struct mptcp_pm_param param;
 
 		if (mptcp_pm_is_userspace(msk))
 			goto next;
 
 		lock_sock(sk);
-		mptcp_pm_nl_address_removed(msk, entry);
+		mptcp_pm_param_set_contexts(&param, entry, NULL);
+		msk->pm.ops && msk->pm.ops->address_removed ?
+			msk->pm.ops->address_removed(msk, &param) :
+			mptcp_pm_nl_address_removed(msk, &param);
 		mptcp_pm_nl_subflow_closed(msk, entry);
 		release_sock(sk);
 
@@ -2410,6 +2415,7 @@  static struct pernet_operations mptcp_pm_pernet_ops = {
 
 static struct mptcp_pm_ops mptcp_netlink_pm = {
 	.address_announced	= mptcp_pm_nl_address_announced,
+	.address_removed	= mptcp_pm_nl_address_removed,
 	.get_local_id		= mptcp_pm_nl_get_local_id,
 	.get_priority		= mptcp_pm_nl_get_priority,
 	.type			= MPTCP_PM_TYPE_KERNEL,