diff options
author | Geliang Tang <geliang.tang@linux.dev> | 2023-12-22 13:47:22 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-01-02 13:32:45 +0000 |
commit | d9cd27b8cd191133e287e5de107f971136abe8a2 (patch) | |
tree | 5c82e7c92609049718e153e9b7ffac43a553bc6c /net/mptcp/mib.h | |
parent | 42a7889a1931a07a04a64c8cd72f41a4ba78a1d9 (diff) | |
download | lwn-d9cd27b8cd191133e287e5de107f971136abe8a2.tar.gz lwn-d9cd27b8cd191133e287e5de107f971136abe8a2.zip |
mptcp: add CurrEstab MIB counter support
Add a new MIB counter named MPTCP_MIB_CURRESTAB to count current
established MPTCP connections, similar to TCP_MIB_CURRESTAB. This is
useful to quickly list the number of MPTCP connections without having to
iterate over all of them.
This patch adds a new helper function mptcp_set_state(): if the state
switches from or to ESTABLISHED state, this newly added counter is
incremented. This helper is going to be used in the following patch.
Similar to MPTCP_INC_STATS(), a new helper called MPTCP_DEC_STATS() is
also needed to decrement a MIB counter.
Signed-off-by: Geliang Tang <geliang.tang@linux.dev>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mptcp/mib.h')
-rw-r--r-- | net/mptcp/mib.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/mptcp/mib.h b/net/mptcp/mib.h index cae71d947252..dd7fd1f246b5 100644 --- a/net/mptcp/mib.h +++ b/net/mptcp/mib.h @@ -65,6 +65,7 @@ enum linux_mptcp_mib_field { * conflict with another subflow while updating msk rcv wnd */ MPTCP_MIB_RCVWNDCONFLICT, /* Conflict with while updating msk rcv wnd */ + MPTCP_MIB_CURRESTAB, /* Current established MPTCP connections */ __MPTCP_MIB_MAX }; @@ -95,4 +96,11 @@ static inline void __MPTCP_INC_STATS(struct net *net, __SNMP_INC_STATS(net->mib.mptcp_statistics, field); } +static inline void MPTCP_DEC_STATS(struct net *net, + enum linux_mptcp_mib_field field) +{ + if (likely(net->mib.mptcp_statistics)) + SNMP_DEC_STATS(net->mib.mptcp_statistics, field); +} + bool mptcp_mib_alloc(struct net *net); |