~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/mptcp/mib.c

Version: ~ [ linux-5.17-rc1 ] ~ [ linux-5.16.2 ] ~ [ linux-5.15.16 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.93 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.173 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.225 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.262 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.297 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.299 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-or-later
  2 
  3 #include <linux/seq_file.h>
  4 #include <net/ip.h>
  5 #include <net/mptcp.h>
  6 #include <net/snmp.h>
  7 #include <net/net_namespace.h>
  8 
  9 #include "mib.h"
 10 
 11 static const struct snmp_mib mptcp_snmp_list[] = {
 12         SNMP_MIB_ITEM("MPCapableSYNRX", MPTCP_MIB_MPCAPABLEPASSIVE),
 13         SNMP_MIB_ITEM("MPCapableSYNTX", MPTCP_MIB_MPCAPABLEACTIVE),
 14         SNMP_MIB_ITEM("MPCapableSYNACKRX", MPTCP_MIB_MPCAPABLEACTIVEACK),
 15         SNMP_MIB_ITEM("MPCapableACKRX", MPTCP_MIB_MPCAPABLEPASSIVEACK),
 16         SNMP_MIB_ITEM("MPCapableFallbackACK", MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK),
 17         SNMP_MIB_ITEM("MPCapableFallbackSYNACK", MPTCP_MIB_MPCAPABLEACTIVEFALLBACK),
 18         SNMP_MIB_ITEM("MPFallbackTokenInit", MPTCP_MIB_TOKENFALLBACKINIT),
 19         SNMP_MIB_ITEM("MPTCPRetrans", MPTCP_MIB_RETRANSSEGS),
 20         SNMP_MIB_ITEM("MPJoinNoTokenFound", MPTCP_MIB_JOINNOTOKEN),
 21         SNMP_MIB_ITEM("MPJoinSynRx", MPTCP_MIB_JOINSYNRX),
 22         SNMP_MIB_ITEM("MPJoinSynAckRx", MPTCP_MIB_JOINSYNACKRX),
 23         SNMP_MIB_ITEM("MPJoinSynAckHMacFailure", MPTCP_MIB_JOINSYNACKMAC),
 24         SNMP_MIB_ITEM("MPJoinAckRx", MPTCP_MIB_JOINACKRX),
 25         SNMP_MIB_ITEM("MPJoinAckHMacFailure", MPTCP_MIB_JOINACKMAC),
 26         SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH),
 27         SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX),
 28         SNMP_MIB_ITEM("OFOQueueTail", MPTCP_MIB_OFOQUEUETAIL),
 29         SNMP_MIB_ITEM("OFOQueue", MPTCP_MIB_OFOQUEUE),
 30         SNMP_MIB_ITEM("OFOMerge", MPTCP_MIB_OFOMERGE),
 31         SNMP_MIB_ITEM("NoDSSInWindow", MPTCP_MIB_NODSSWINDOW),
 32         SNMP_MIB_ITEM("DuplicateData", MPTCP_MIB_DUPDATA),
 33         SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR),
 34         SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD),
 35         SNMP_MIB_ITEM("PortAdd", MPTCP_MIB_PORTADD),
 36         SNMP_MIB_ITEM("MPJoinPortSynRx", MPTCP_MIB_JOINPORTSYNRX),
 37         SNMP_MIB_ITEM("MPJoinPortSynAckRx", MPTCP_MIB_JOINPORTSYNACKRX),
 38         SNMP_MIB_ITEM("MPJoinPortAckRx", MPTCP_MIB_JOINPORTACKRX),
 39         SNMP_MIB_ITEM("MismatchPortSynRx", MPTCP_MIB_MISMATCHPORTSYNRX),
 40         SNMP_MIB_ITEM("MismatchPortAckRx", MPTCP_MIB_MISMATCHPORTACKRX),
 41         SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR),
 42         SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW),
 43         SNMP_MIB_ITEM("MPPrioTx", MPTCP_MIB_MPPRIOTX),
 44         SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX),
 45         SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED),
 46         SNMP_MIB_SENTINEL
 47 };
 48 
 49 /* mptcp_mib_alloc - allocate percpu mib counters
 50  *
 51  * These are allocated when the first mptcp socket is created so
 52  * we do not waste percpu memory if mptcp isn't in use.
 53  */
 54 bool mptcp_mib_alloc(struct net *net)
 55 {
 56         struct mptcp_mib __percpu *mib = alloc_percpu(struct mptcp_mib);
 57 
 58         if (!mib)
 59                 return false;
 60 
 61         if (cmpxchg(&net->mib.mptcp_statistics, NULL, mib))
 62                 free_percpu(mib);
 63 
 64         return true;
 65 }
 66 
 67 void mptcp_seq_show(struct seq_file *seq)
 68 {
 69         struct net *net = seq->private;
 70         int i;
 71 
 72         seq_puts(seq, "MPTcpExt:");
 73         for (i = 0; mptcp_snmp_list[i].name; i++)
 74                 seq_printf(seq, " %s", mptcp_snmp_list[i].name);
 75 
 76         seq_puts(seq, "\nMPTcpExt:");
 77 
 78         if (!net->mib.mptcp_statistics) {
 79                 for (i = 0; mptcp_snmp_list[i].name; i++)
 80                         seq_puts(seq, " 0");
 81 
 82                 seq_putc(seq, '\n');
 83                 return;
 84         }
 85 
 86         for (i = 0; mptcp_snmp_list[i].name; i++)
 87                 seq_printf(seq, " %lu",
 88                            snmp_fold_field(net->mib.mptcp_statistics,
 89                                            mptcp_snmp_list[i].entry));
 90         seq_putc(seq, '\n');
 91 }
 92 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp