mptcp: add RM_ADDR related mibs
authorGeliang Tang <geliangtang@gmail.com>
Thu, 24 Sep 2020 00:29:56 +0000 (08:29 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Sep 2020 02:58:34 +0000 (19:58 -0700)
This patch added two new mibs for RM_ADDR, named MPTCP_MIB_RMADDR and
MPTCP_MIB_RMSUBFLOW, when the RM_ADDR suboption is received, increase
the first mib counter, when the local subflow is removed, increase the
second mib counter.

Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mptcp/mib.c
net/mptcp/mib.h
net/mptcp/pm_netlink.c

index a33bf719ce6f470988bc836de6ec9f2ee92de738..84d119436b22d8af38661146700e1e043ed15256 100644 (file)
@@ -29,6 +29,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {
        SNMP_MIB_ITEM("DuplicateData", MPTCP_MIB_DUPDATA),
        SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR),
        SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD),
+       SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR),
+       SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW),
        SNMP_MIB_SENTINEL
 };
 
index cdeea3732ddffc0361c5f00ec6387e1cac55d4b6..47bcecce1106ea63d5f2e9b8883d5c937a8c2738 100644 (file)
@@ -22,6 +22,8 @@ enum linux_mptcp_mib_field {
        MPTCP_MIB_DUPDATA,              /* Segments discarded due to duplicate DSS */
        MPTCP_MIB_ADDADDR,              /* Received ADD_ADDR with echo-flag=0 */
        MPTCP_MIB_ECHOADD,              /* Received ADD_ADDR with echo-flag=1 */
+       MPTCP_MIB_RMADDR,               /* Received RM_ADDR */
+       MPTCP_MIB_RMSUBFLOW,            /* Remove a subflow */
        __MPTCP_MIB_MAX
 };
 
index 9064c809852124f82a116a8ac7f50cc277ccaec0..b33aebd85bd54f59310a6fbc084847902c2961a4 100644 (file)
@@ -15,6 +15,7 @@
 #include <uapi/linux/mptcp.h>
 
 #include "protocol.h"
+#include "mib.h"
 
 /* forward declaration */
 static struct genl_family mptcp_genl_family;
@@ -346,6 +347,8 @@ void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
                msk->pm.subflows--;
                WRITE_ONCE(msk->pm.accept_addr, true);
 
+               __MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMADDR);
+
                break;
        }
 }
@@ -379,6 +382,8 @@ void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id)
                msk->pm.local_addr_used--;
                msk->pm.subflows--;
 
+               __MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMSUBFLOW);
+
                break;
        }
 }