Message ID | 5624c8ee7e6db4c20fa7f0593d2e6cc9be36ca32.1599546158.git.geliangtang@gmail.com |
---|---|
State | Accepted, archived |
Commit | bef7797391292b1210d0ecd4b4a90483e5747e05 |
Delegated to: | Matthieu Baerts |
Headers | show |
Series | Squash-to: "mptcp: implement mptcp_pm_remove_subflow v9" | expand |
Hi Geliang, Paolo, On 08/09/2020 08:32, Geliang Tang wrote: > Commit message should be rewritten enterily: > ''' > This patch implemented the local subflow removing function, > mptcp_pm_remove_subflow, it simply called mptcp_pm_nl_rm_subflow_received > under the PM spin lock. > > We use mptcp_pm_remove_subflow to remove a local subflow, so change it's > argument from remote_id to local_id. > > We check subflow->local_id in mptcp_pm_nl_rm_subflow_received to remove > a subflow. > ''' As described in my previous message, I also applied this patch (without Paolo's ACK) because this was needed for the patch modifying the MIB. Cheers, Matt
Hi Matt, Paolo, Matthieu Baerts <matthieu.baerts@tessares.net> 于2020年9月11日周五 下午2:45写道: > > Hi Geliang, Paolo, > > On 08/09/2020 08:32, Geliang Tang wrote: > > Commit message should be rewritten enterily: > > ''' > > This patch implemented the local subflow removing function, > > mptcp_pm_remove_subflow, it simply called mptcp_pm_nl_rm_subflow_received > > under the PM spin lock. > > > > We use mptcp_pm_remove_subflow to remove a local subflow, so change it's > > argument from remote_id to local_id. > > > > We check subflow->local_id in mptcp_pm_nl_rm_subflow_received to remove > > a subflow. > > ''' > > As described in my previous message, I also applied this patch (without > Paolo's ACK) because this was needed for the patch modifying the MIB. This squash-to patch is fine, and I'm very confident about it. The new function mptcp_pm_nl_rm_subflow_received is copied from mptcp_pm_nl_rm_addr_received, there are only three differences between them: 1. mptcp_pm_nl_rm_subflow_received use rm_id as an input parameter, but mptcp_pm_nl_rm_addr_received get rm_id from msk->pm.rm_id. 2. mptcp_pm_nl_rm_subflow_received check if the rm_id equals subflow's local_id, but mptcp_pm_nl_rm_addr_received check if it equals subflow's remote_id. 3. mptcp_pm_nl_rm_subflow_received reduce local_addr_used number, but mptcp_pm_nl_rm_addr_received reduce add_addr_accepted number and set accept_addr to true. -Geliang > > Cheers, > Matt > -- > Tessares | Belgium | Hybrid Access Solutions > www.tessares.net
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 0dae12862931..c7a7e70ba1cd 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -339,6 +339,39 @@ void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk) } } +void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id) +{ + struct mptcp_subflow_context *subflow, *tmp; + struct sock *sk = (struct sock *)msk; + + pr_debug("subflow rm_id %d", rm_id); + + if (!rm_id) + return; + + if (list_empty(&msk->conn_list)) + return; + + list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) { + struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + int how = RCV_SHUTDOWN | SEND_SHUTDOWN; + long timeout = 0; + + if (rm_id != subflow->local_id) + continue; + + spin_unlock_bh(&msk->pm.lock); + mptcp_subflow_shutdown(sk, ssk, how); + __mptcp_close_ssk(sk, ssk, subflow, timeout); + spin_lock_bh(&msk->pm.lock); + + msk->pm.local_addr_used--; + msk->pm.subflows--; + + break; + } +} + static bool address_use_port(struct mptcp_pm_addr_entry *entry) { return (entry->addr.flags & diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 91a68d7e672a..df6cc94df1f7 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -479,6 +479,7 @@ void mptcp_pm_nl_fully_established(struct mptcp_sock *msk); void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk); void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk); void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk); +void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id); int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc); static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb)
Commit message should be rewritten enterily: ''' This patch implemented the local subflow removing function, mptcp_pm_remove_subflow, it simply called mptcp_pm_nl_rm_subflow_received under the PM spin lock. We use mptcp_pm_remove_subflow to remove a local subflow, so change it's argument from remote_id to local_id. We check subflow->local_id in mptcp_pm_nl_rm_subflow_received to remove a subflow. ''' Signed-off-by: Geliang Tang <geliangtang@gmail.com> --- net/mptcp/pm_netlink.c | 33 +++++++++++++++++++++++++++++++++ net/mptcp/protocol.h | 1 + 2 files changed, 34 insertions(+)