Message ID | 8206a3d8e4a1e2b93362e2a7c7e23adc15194544.1701180969.git.geliang.tang@suse.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | userspace pm enhancements | expand |
Context | Check | Description |
---|---|---|
matttbe/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 41 lines checked |
matttbe/build | success | Build and static analysis OK |
matttbe/KVM_Validation__normal__except_selftest_mptcp_join_ | success | Success! ✅ |
matttbe/KVM_Validation__debug__only_selftest_mptcp_join_ | success | Success! ✅ |
matttbe/KVM_Validation__normal__only_selftest_mptcp_join_ | success | Success! ✅ |
matttbe/KVM_Validation__debug__except_selftest_mptcp_join_ | success | Success! ✅ |
On Tue, 28 Nov 2023, Geliang Tang wrote: > This patch adds a new function mptcp_userspace_pm_flush_addrs_list() > to free the userspace local addresses list. Invoke it when flushing > addresses from netlink commands. > > Signed-off-by: Geliang Tang <geliang.tang@suse.com> > --- > net/mptcp/pm_netlink.c | 2 ++ > net/mptcp/pm_userspace.c | 23 +++++++++++++++++++++++ > net/mptcp/protocol.h | 1 + > 3 files changed, 26 insertions(+) Hi Geliang - Do you have a use case in mind for the userspace flush operation? I think this functionality should be implemented by the userspace PM, which can list the subflows and then disconnect them as needed. Thanks, Mat
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index a4dc2bc8fb55..6bc1a6b5b4f0 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1587,6 +1587,8 @@ int mptcp_pm_nl_flush_addrs_doit(struct sk_buff *skb, struct genl_info *info) mptcp_nl_remove_addrs_list(sock_net(skb->sk), &free_list); synchronize_rcu(); __flush_addrs(&free_list); + + mptcp_userspace_pm_flush_addrs_list(sock_net(skb->sk)); return 0; } diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 674262face65..8494d6df866a 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -597,3 +597,26 @@ __userspace_pm_lookup_addr_by_id(struct net *net, unsigned int id) return entry; } + +void mptcp_userspace_pm_flush_addrs_list(struct net *net) +{ + long s_slot = 0, s_num = 0; + struct mptcp_sock *msk; + + while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) { + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + struct sock *sk = (struct sock *)msk; + + if (mptcp_pm_is_userspace(msk)) { + lock_sock(sk); + spin_lock_bh(&pernet->lock); + bitmap_zero(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + spin_unlock_bh(&pernet->lock); + mptcp_userspace_pm_free_local_addr_list(msk); + release_sock(sk); + } + + sock_put(sk); + cond_resched(); + } +} diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index efb24c05a7e2..7441e3b9443d 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -944,6 +944,7 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list); void mptcp_pm_remove_subflows(struct mptcp_sock *msk, struct list_head *rm_list); void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk); +void mptcp_userspace_pm_flush_addrs_list(struct net *net); void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, const struct sock *ssk, gfp_t gfp);
This patch adds a new function mptcp_userspace_pm_flush_addrs_list() to free the userspace local addresses list. Invoke it when flushing addresses from netlink commands. Signed-off-by: Geliang Tang <geliang.tang@suse.com> --- net/mptcp/pm_netlink.c | 2 ++ net/mptcp/pm_userspace.c | 23 +++++++++++++++++++++++ net/mptcp/protocol.h | 1 + 3 files changed, 26 insertions(+)