tcp: Add SNMP counter for DEFER_ACCEPT
authorEric Dumazet <eric.dumazet@gmail.com>
Fri, 19 Mar 2010 05:37:18 +0000 (05:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Mar 2010 01:31:35 +0000 (18:31 -0700)
Its currently hard to diagnose when ACK frames are dropped because an
application set TCP_DEFER_ACCEPT on its listening socket.

See http://bugzilla.kernel.org/show_bug.cgi?id=15507

This patch adds a SNMP value, named TCPDeferAcceptDrop

netstat -s | grep TCPDeferAcceptDrop
    TCPDeferAcceptDrop: 0

This counter is incremented every time we drop a pure ACK frame received
by a socket in SYN_RECV state because its SYNACK retrans count is lower
than defer_accept value.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/snmp.h
net/ipv4/proc.c
net/ipv4/tcp_minisocks.c

index 4435d1084755f07a3cbf7439a55d98aa5c0f7b4c..d2a9aa3c6c8807c8f1f348831f694078aac69b5e 100644 (file)
@@ -227,6 +227,7 @@ enum
        LINUX_MIB_SACKSHIFTFALLBACK,
        LINUX_MIB_TCPBACKLOGDROP,
        LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
+       LINUX_MIB_TCPDEFERACCEPTDROP,
        __LINUX_MIB_MAX
 };
 
index 4f1f337f4337836169f19536de6adf4ba7c23064..3dc9914c1dcee4f77faa26b97e5eb8ec3b4243b6 100644 (file)
@@ -251,6 +251,7 @@ static const struct snmp_mib snmp4_net_list[] = {
        SNMP_MIB_ITEM("TCPSackShiftFallback", LINUX_MIB_SACKSHIFTFALLBACK),
        SNMP_MIB_ITEM("TCPBacklogDrop", LINUX_MIB_TCPBACKLOGDROP),
        SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP),
+       SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP),
        SNMP_MIB_SENTINEL
 };
 
index 4199bc6915c549231f481aeef9f3f7fd1f435464..32f96278a24acabf35fd037488b731d5327dd59a 100644 (file)
@@ -671,6 +671,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
        if (req->retrans < inet_csk(sk)->icsk_accept_queue.rskq_defer_accept &&
            TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) {
                inet_rsk(req)->acked = 1;
+               NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPDEFERACCEPTDROP);
                return NULL;
        }