Message ID | d208e183b50a09efc3e7edf818e9ad9d755056e1.1701256112.git.geliang.tang@suse.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Paolo Abeni |
Headers | show |
Series | add MPTCP_MIB_CURRESTAB | expand |
Context | Check | Description |
---|---|---|
matttbe/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 32 lines checked |
matttbe/build | success | Build and static analysis OK |
matttbe/KVM_Validation__normal__except_selftest_mptcp_join_ | success | Success! ✅ |
matttbe/KVM_Validation__normal__only_selftest_mptcp_join_ | success | Success! ✅ |
matttbe/KVM_Validation__debug__only_selftest_mptcp_join_ | warning | Unstable: 1 failed test(s): selftest_mptcp_join |
matttbe/KVM_Validation__debug__except_selftest_mptcp_join_ | success | Success! ✅ |
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 6956fde61c68..cd0d54d85080 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2885,6 +2885,25 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) release_sock(ssk); } +void mptcp_set_state(struct sock *sk, int state) +{ + int oldstate = sk->sk_state; + + switch (state) { + case TCP_ESTABLISHED: + if (oldstate != TCP_ESTABLISHED) + MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); + break; + + default: + if (oldstate == TCP_ESTABLISHED) + MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); + } + + inet_sk_state_store(sk, state); +} +EXPORT_SYMBOL_GPL(mptcp_set_state); + static const unsigned char new_state[16] = { /* current state: new state: action: */ [0 /* (Invalid) */] = TCP_CLOSE, diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 8529b3ae55e9..a8e558bdc54b 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -643,6 +643,7 @@ bool __mptcp_close(struct sock *sk, long timeout); void mptcp_cancel_work(struct sock *sk); void __mptcp_unaccepted_force_close(struct sock *sk); void mptcp_set_owner_r(struct sk_buff *skb, struct sock *sk); +void mptcp_set_state(struct sock *sk, int state); bool mptcp_addresses_equal(const struct mptcp_addr_info *a, const struct mptcp_addr_info *b, bool use_port);
This patch adds a new function mptcp_set_state(), in it if switch from or to ESTABLISH state, increment or decrement the newly added counter MPTCP_MIB_CURRESTAB. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/460 Signed-off-by: Geliang Tang <geliang.tang@suse.com> --- net/mptcp/protocol.c | 19 +++++++++++++++++++ net/mptcp/protocol.h | 1 + 2 files changed, 20 insertions(+)