mptcp: add the mibs for MP_FASTCLOSE
authorGeliang Tang <geliang.tang@suse.com>
Fri, 4 Mar 2022 19:36:27 +0000 (11:36 -0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 5 Mar 2022 05:54:29 +0000 (21:54 -0800)
This patch added two more mibs for MP_FASTCLOSE, MPTCP_MIB_MPFASTCLOSETX
for the MP_FASTCLOSE sending and MPTCP_MIB_MPFASTCLOSERX for receiving.

Also added a debug log for MP_FASTCLOSE receiving, printed out the recv_key
of MP_FASTCLOSE in mptcp_parse_option to show that MP_RST is received.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/mib.c
net/mptcp/mib.h
net/mptcp/options.c

index 7558802a14350a6a4cf59a0e22611ab54ec3eae1..975d17118bfef7e07a241b2f347603364f9b3bd0 100644 (file)
@@ -48,6 +48,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {
        SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX),
        SNMP_MIB_ITEM("MPFailTx", MPTCP_MIB_MPFAILTX),
        SNMP_MIB_ITEM("MPFailRx", MPTCP_MIB_MPFAILRX),
+       SNMP_MIB_ITEM("MPFastcloseTx", MPTCP_MIB_MPFASTCLOSETX),
+       SNMP_MIB_ITEM("MPFastcloseRx", MPTCP_MIB_MPFASTCLOSERX),
        SNMP_MIB_ITEM("RcvPruned", MPTCP_MIB_RCVPRUNED),
        SNMP_MIB_ITEM("SubflowStale", MPTCP_MIB_SUBFLOWSTALE),
        SNMP_MIB_ITEM("SubflowRecover", MPTCP_MIB_SUBFLOWRECOVER),
index 2966fcb6548bac6ba539183c428ec16e9b77a896..8206c65297e0b51ae987281a923a7a6faec93137 100644 (file)
@@ -41,6 +41,8 @@ enum linux_mptcp_mib_field {
        MPTCP_MIB_MPPRIORX,             /* Received a MP_PRIO */
        MPTCP_MIB_MPFAILTX,             /* Transmit a MP_FAIL */
        MPTCP_MIB_MPFAILRX,             /* Received a MP_FAIL */
+       MPTCP_MIB_MPFASTCLOSETX,        /* Transmit a MP_FASTCLOSE */
+       MPTCP_MIB_MPFASTCLOSERX,        /* Received a MP_FASTCLOSE */
        MPTCP_MIB_RCVPRUNED,            /* Incoming packet dropped due to memory limit */
        MPTCP_MIB_SUBFLOWSTALE,         /* Subflows entered 'stale' status */
        MPTCP_MIB_SUBFLOWRECOVER,       /* Subflows returned to active status after being stale */
index ac10a04ccd7ccbc1a0e65f3a21c6f34583b821df..c3697f06faf9c63159972cbb70b400ad486346ff 100644 (file)
@@ -323,6 +323,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
                mp_opt->rcvr_key = get_unaligned_be64(ptr);
                ptr += 8;
                mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE;
+               pr_debug("MP_FASTCLOSE: recv_key=%llu", mp_opt->rcvr_key);
                break;
 
        case MPTCPOPT_RST:
@@ -832,6 +833,7 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,
                    mptcp_established_options_mp_fail(sk, &opt_size, remaining, opts)) {
                        *size += opt_size;
                        remaining -= opt_size;
+                       MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX);
                }
                /* MP_RST can be used with MP_FASTCLOSE and MP_FAIL if there is room */
                if (mptcp_established_options_rst(sk, skb, &opt_size, remaining, opts)) {
@@ -1124,6 +1126,7 @@ bool mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
                    msk->local_key == mp_opt.rcvr_key) {
                        WRITE_ONCE(msk->rcv_fastclose, true);
                        mptcp_schedule_work((struct sock *)msk);
+                       MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSERX);
                }
 
                if ((mp_opt.suboptions & OPTION_MPTCP_ADD_ADDR) &&