2020-03-27 22:48:50 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <net/ip.h>
|
|
|
|
#include <net/mptcp.h>
|
|
|
|
#include <net/snmp.h>
|
|
|
|
#include <net/net_namespace.h>
|
|
|
|
|
|
|
|
#include "mib.h"
|
|
|
|
|
|
|
|
static const struct snmp_mib mptcp_snmp_list[] = {
|
|
|
|
SNMP_MIB_ITEM("MPCapableSYNRX", MPTCP_MIB_MPCAPABLEPASSIVE),
|
2021-04-02 01:19:42 +02:00
|
|
|
SNMP_MIB_ITEM("MPCapableSYNTX", MPTCP_MIB_MPCAPABLEACTIVE),
|
|
|
|
SNMP_MIB_ITEM("MPCapableSYNACKRX", MPTCP_MIB_MPCAPABLEACTIVEACK),
|
2020-03-27 22:48:50 +01:00
|
|
|
SNMP_MIB_ITEM("MPCapableACKRX", MPTCP_MIB_MPCAPABLEPASSIVEACK),
|
|
|
|
SNMP_MIB_ITEM("MPCapableFallbackACK", MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK),
|
|
|
|
SNMP_MIB_ITEM("MPCapableFallbackSYNACK", MPTCP_MIB_MPCAPABLEACTIVEFALLBACK),
|
2024-09-09 22:09:22 +02:00
|
|
|
SNMP_MIB_ITEM("MPCapableSYNTXDrop", MPTCP_MIB_MPCAPABLEACTIVEDROP),
|
2024-09-09 22:09:23 +02:00
|
|
|
SNMP_MIB_ITEM("MPCapableSYNTXDisabled", MPTCP_MIB_MPCAPABLEACTIVEDISABLED),
|
2021-04-02 01:19:41 +02:00
|
|
|
SNMP_MIB_ITEM("MPFallbackTokenInit", MPTCP_MIB_TOKENFALLBACKINIT),
|
2020-03-27 22:48:50 +01:00
|
|
|
SNMP_MIB_ITEM("MPTCPRetrans", MPTCP_MIB_RETRANSSEGS),
|
|
|
|
SNMP_MIB_ITEM("MPJoinNoTokenFound", MPTCP_MIB_JOINNOTOKEN),
|
|
|
|
SNMP_MIB_ITEM("MPJoinSynRx", MPTCP_MIB_JOINSYNRX),
|
mptcp: mib: count MPJ with backup flag
Without such counters, it is difficult to easily debug issues with MPJ
not having the backup flags on production servers.
This is not strictly a fix, but it eases to validate the following
patches without requiring to take packet traces, to query ongoing
connections with Netlink with admin permissions, or to guess by looking
at the behaviour of the packet scheduler. Also, the modification is self
contained, isolated, well controlled, and the increments are done just
after others, there from the beginning. It looks then safe, and helpful
to backport this.
Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-07-27 12:01:26 +02:00
|
|
|
SNMP_MIB_ITEM("MPJoinSynBackupRx", MPTCP_MIB_JOINSYNBACKUPRX),
|
2020-03-27 22:48:50 +01:00
|
|
|
SNMP_MIB_ITEM("MPJoinSynAckRx", MPTCP_MIB_JOINSYNACKRX),
|
mptcp: mib: count MPJ with backup flag
Without such counters, it is difficult to easily debug issues with MPJ
not having the backup flags on production servers.
This is not strictly a fix, but it eases to validate the following
patches without requiring to take packet traces, to query ongoing
connections with Netlink with admin permissions, or to guess by looking
at the behaviour of the packet scheduler. Also, the modification is self
contained, isolated, well controlled, and the increments are done just
after others, there from the beginning. It looks then safe, and helpful
to backport this.
Fixes: 4596a2c1b7f5 ("mptcp: allow creating non-backup subflows")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-07-27 12:01:26 +02:00
|
|
|
SNMP_MIB_ITEM("MPJoinSynAckBackupRx", MPTCP_MIB_JOINSYNACKBACKUPRX),
|
2020-03-27 22:48:50 +01:00
|
|
|
SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC),
|
|
|
|
SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX),
|
|
|
|
SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC),
|
2024-09-02 12:45:54 +02:00
|
|
|
SNMP_MIB_ITEM("MPJoinSynTx", MPTCP_MIB_JOINSYNTX),
|
|
|
|
SNMP_MIB_ITEM("MPJoinSynTxCreatSkErr", MPTCP_MIB_JOINSYNTXCREATSKERR),
|
|
|
|
SNMP_MIB_ITEM("MPJoinSynTxBindErr", MPTCP_MIB_JOINSYNTXBINDERR),
|
|
|
|
SNMP_MIB_ITEM("MPJoinSynTxConnectErr", MPTCP_MIB_JOINSYNTXCONNECTERR),
|
2020-03-27 22:48:50 +01:00
|
|
|
SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH),
|
2022-04-22 23:55:41 +02:00
|
|
|
SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX),
|
2020-03-27 22:48:50 +01:00
|
|
|
SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX),
|
2021-06-22 00:54:37 +02:00
|
|
|
SNMP_MIB_ITEM("DSSNoMatchTCP", MPTCP_MIB_DSSTCPMISMATCH),
|
2021-06-18 01:46:18 +02:00
|
|
|
SNMP_MIB_ITEM("DataCsumErr", MPTCP_MIB_DATACSUMERR),
|
2020-09-14 10:01:14 +02:00
|
|
|
SNMP_MIB_ITEM("OFOQueueTail", MPTCP_MIB_OFOQUEUETAIL),
|
|
|
|
SNMP_MIB_ITEM("OFOQueue", MPTCP_MIB_OFOQUEUE),
|
|
|
|
SNMP_MIB_ITEM("OFOMerge", MPTCP_MIB_OFOMERGE),
|
|
|
|
SNMP_MIB_ITEM("NoDSSInWindow", MPTCP_MIB_NODSSWINDOW),
|
|
|
|
SNMP_MIB_ITEM("DuplicateData", MPTCP_MIB_DUPDATA),
|
2020-09-24 02:29:51 +02:00
|
|
|
SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR),
|
2023-05-17 21:16:16 +02:00
|
|
|
SNMP_MIB_ITEM("AddAddrTx", MPTCP_MIB_ADDADDRTX),
|
|
|
|
SNMP_MIB_ITEM("AddAddrTxDrop", MPTCP_MIB_ADDADDRTXDROP),
|
2020-09-24 02:29:51 +02:00
|
|
|
SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD),
|
2023-05-17 21:16:16 +02:00
|
|
|
SNMP_MIB_ITEM("EchoAddTx", MPTCP_MIB_ECHOADDTX),
|
|
|
|
SNMP_MIB_ITEM("EchoAddTxDrop", MPTCP_MIB_ECHOADDTXDROP),
|
2021-02-02 00:09:19 +01:00
|
|
|
SNMP_MIB_ITEM("PortAdd", MPTCP_MIB_PORTADD),
|
2022-02-18 22:35:42 +01:00
|
|
|
SNMP_MIB_ITEM("AddAddrDrop", MPTCP_MIB_ADDADDRDROP),
|
2021-02-02 00:09:19 +01:00
|
|
|
SNMP_MIB_ITEM("MPJoinPortSynRx", MPTCP_MIB_JOINPORTSYNRX),
|
|
|
|
SNMP_MIB_ITEM("MPJoinPortSynAckRx", MPTCP_MIB_JOINPORTSYNACKRX),
|
|
|
|
SNMP_MIB_ITEM("MPJoinPortAckRx", MPTCP_MIB_JOINPORTACKRX),
|
|
|
|
SNMP_MIB_ITEM("MismatchPortSynRx", MPTCP_MIB_MISMATCHPORTSYNRX),
|
|
|
|
SNMP_MIB_ITEM("MismatchPortAckRx", MPTCP_MIB_MISMATCHPORTACKRX),
|
2020-09-24 02:29:56 +02:00
|
|
|
SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR),
|
2022-02-18 22:35:42 +01:00
|
|
|
SNMP_MIB_ITEM("RmAddrDrop", MPTCP_MIB_RMADDRDROP),
|
2023-05-17 21:16:16 +02:00
|
|
|
SNMP_MIB_ITEM("RmAddrTx", MPTCP_MIB_RMADDRTX),
|
|
|
|
SNMP_MIB_ITEM("RmAddrTxDrop", MPTCP_MIB_RMADDRTXDROP),
|
2020-09-24 02:29:56 +02:00
|
|
|
SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW),
|
2021-01-09 01:48:01 +01:00
|
|
|
SNMP_MIB_ITEM("MPPrioTx", MPTCP_MIB_MPPRIOTX),
|
|
|
|
SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX),
|
2021-08-25 01:26:18 +02:00
|
|
|
SNMP_MIB_ITEM("MPFailTx", MPTCP_MIB_MPFAILTX),
|
|
|
|
SNMP_MIB_ITEM("MPFailRx", MPTCP_MIB_MPFAILRX),
|
2022-03-04 20:36:27 +01:00
|
|
|
SNMP_MIB_ITEM("MPFastcloseTx", MPTCP_MIB_MPFASTCLOSETX),
|
|
|
|
SNMP_MIB_ITEM("MPFastcloseRx", MPTCP_MIB_MPFASTCLOSERX),
|
2022-03-04 20:36:29 +01:00
|
|
|
SNMP_MIB_ITEM("MPRstTx", MPTCP_MIB_MPRSTTX),
|
|
|
|
SNMP_MIB_ITEM("MPRstRx", MPTCP_MIB_MPRSTRX),
|
2021-07-10 02:20:51 +02:00
|
|
|
SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED),
|
2021-08-14 00:15:46 +02:00
|
|
|
SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE),
|
|
|
|
SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
|
2022-05-04 23:54:05 +02:00
|
|
|
SNMP_MIB_ITEM("SndWndShared", MPTCP_MIB_SNDWNDSHARED),
|
2022-05-04 23:54:08 +02:00
|
|
|
SNMP_MIB_ITEM("RcvWndShared", MPTCP_MIB_RCVWNDSHARED),
|
|
|
|
SNMP_MIB_ITEM("RcvWndConflictUpdate", MPTCP_MIB_RCVWNDCONFLICTUPDATE),
|
|
|
|
SNMP_MIB_ITEM("RcvWndConflict", MPTCP_MIB_RCVWNDCONFLICT),
|
2023-12-22 13:47:22 +01:00
|
|
|
SNMP_MIB_ITEM("MPCurrEstab", MPTCP_MIB_CURRESTAB),
|
2024-09-09 22:09:23 +02:00
|
|
|
SNMP_MIB_ITEM("Blackhole", MPTCP_MIB_BLACKHOLE),
|
2020-03-27 22:48:50 +01:00
|
|
|
SNMP_MIB_SENTINEL
|
|
|
|
};
|
|
|
|
|
|
|
|
/* mptcp_mib_alloc - allocate percpu mib counters
|
|
|
|
*
|
|
|
|
* These are allocated when the first mptcp socket is created so
|
|
|
|
* we do not waste percpu memory if mptcp isn't in use.
|
|
|
|
*/
|
|
|
|
bool mptcp_mib_alloc(struct net *net)
|
|
|
|
{
|
|
|
|
struct mptcp_mib __percpu *mib = alloc_percpu(struct mptcp_mib);
|
|
|
|
|
|
|
|
if (!mib)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (cmpxchg(&net->mib.mptcp_statistics, NULL, mib))
|
|
|
|
free_percpu(mib);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mptcp_seq_show(struct seq_file *seq)
|
|
|
|
{
|
2021-09-30 03:03:33 +02:00
|
|
|
unsigned long sum[ARRAY_SIZE(mptcp_snmp_list) - 1];
|
2020-03-27 22:48:50 +01:00
|
|
|
struct net *net = seq->private;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
seq_puts(seq, "MPTcpExt:");
|
|
|
|
for (i = 0; mptcp_snmp_list[i].name; i++)
|
|
|
|
seq_printf(seq, " %s", mptcp_snmp_list[i].name);
|
|
|
|
|
|
|
|
seq_puts(seq, "\nMPTcpExt:");
|
|
|
|
|
2021-09-30 03:03:33 +02:00
|
|
|
memset(sum, 0, sizeof(sum));
|
|
|
|
if (net->mib.mptcp_statistics)
|
|
|
|
snmp_get_cpu_field_batch(sum, mptcp_snmp_list,
|
|
|
|
net->mib.mptcp_statistics);
|
2020-03-27 22:48:50 +01:00
|
|
|
|
|
|
|
for (i = 0; mptcp_snmp_list[i].name; i++)
|
2021-09-30 03:03:33 +02:00
|
|
|
seq_printf(seq, " %lu", sum[i]);
|
|
|
|
|
2020-03-27 22:48:50 +01:00
|
|
|
seq_putc(seq, '\n');
|
|
|
|
}
|