Skip to content

Commit

Permalink
mptcp: update userspace pm subflows info
Browse files Browse the repository at this point in the history
Increase pm subflows counter when userspace pm creates a new subflow,
and decrease the counter when it closes a subflow.

Closes: multipath-tcp/mptcp_net-next#329
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
  • Loading branch information
geliangtang authored and intel-lab-lkp committed Jan 13, 2023
1 parent a39f247 commit 423e20b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/mptcp/pm_userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
goto create_err;
}

spin_lock_bh(&msk->pm.lock);
msk->pm.subflows++;
spin_unlock_bh(&msk->pm.lock);

lock_sock(sk);

err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
Expand Down Expand Up @@ -424,6 +428,9 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struct genl_info *info)
mptcp_subflow_shutdown(sk, ssk, RCV_SHUTDOWN | SEND_SHUTDOWN);
mptcp_close_ssk(sk, ssk, subflow);
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMSUBFLOW);
spin_lock_bh(&msk->pm.lock);
msk->pm.subflows--;
spin_unlock_bh(&msk->pm.lock);
err = 0;
} else {
err = -ESRCH;
Expand Down

0 comments on commit 423e20b

Please sign in to comment.