Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp777740imm; Wed, 25 Jul 2018 06:08:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpccrE43XhfNR+fVVOGj+NLckrOy5KW6ePfmxcG0vcEtPjNOWVHFaVg0xZMf7wObBqBhOLe5 X-Received: by 2002:a62:9cd7:: with SMTP id u84-v6mr22232664pfk.90.1532524112186; Wed, 25 Jul 2018 06:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532524112; cv=none; d=google.com; s=arc-20160816; b=oJXRQeqcWbU6fcTj7iYIQQGvqPj768ViA2Q0YeNYIDYX0eHdgiEeRx07nvubfB72wq uMoR54bshct//H6vMrHSsupbeORS1pZ/1DAmUrDUZnduLyOClWs6oJz+e6+FWkkT9oA6 9s9sf4yFE8cHQuKi09ep/nO5lqkNcOXSm+mjhnBxPCyfgcx3vJ1l/hkQM3/NiwU+O/wv Kwa/K7I6An3kPog2U0BLkcFM3fy4/sHcW3tPdR1Z4I/wRAt9oGueksb42kgbnDlFvqE+ np9+HpDCDT75iW/+yyW0qNuMVRysvOiGHjrgJbkYodHaakC9mJeY+DNPvFK0OgUsWdig rg0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=C4q2bG+uix1L0g40LFcxQdc8z2a4Mz/bpvjhD03gNBE=; b=Ip1Aan6/+JkzAeubSkTaZRD8FTXQ+TjQhR9R4mSrWKEm2IVz2YL0vh0inGLLSot9+8 1CeL7h3BW8BZOGXlAsGJb6xuVQALtWVnxE4xPG9H+r3v9nW2IIZ3s1ZmgpWnS0aAR0m8 Q62LZEFJKQ9oWqMztK2F9mmbv+VtSoujJfCRGYjPMtp29CpmW8sLhbFqvIkPNyzIJJMF +Pp0BGEROgiaVaxsml1w2j3nkZT0+7dSrlotcM6yrPl00jAdy7WB5SYaHxGyqwRJqotd Qkk8FXA9rWnRZX9t7/3eb/BlRsQgK3kSB9iR4vAdQCEmUgfAm5UuFp4Ls6AA8O9k2Go/ Gw4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MUSothco; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u134-v6si15275276pfc.244.2018.07.25.06.08.17; Wed, 25 Jul 2018 06:08:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MUSothco; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729082AbeGYOTC (ORCPT + 99 others); Wed, 25 Jul 2018 10:19:02 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33775 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728927AbeGYOTC (ORCPT ); Wed, 25 Jul 2018 10:19:02 -0400 Received: by mail-pf1-f193.google.com with SMTP id b17-v6so1753493pfi.0; Wed, 25 Jul 2018 06:07:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=C4q2bG+uix1L0g40LFcxQdc8z2a4Mz/bpvjhD03gNBE=; b=MUSothco94eLD0/sQC0cKqLjqxrs15wNkbczonRGtZaoOLN33S2iOYoD7KYuVGzWog pHfm2BYCdZb72TOtDVaio8u6dxADyQmrGW5P2iVhOe2M1Vq7Q3U6kKFKo5N3bjTYZka2 C0v5qFw4ZR+AMkXHIZxvO9Uet2CwMYq5EdEm0fvOvqoR8o5Tj5tFBfVXEIOjF0lvmcXy mqCt1z9efGBdpEbrl5l498lO2ZYCIO58ZIgc5rpa3XzBnoYQdFtBUda0mEjKjWDsuovH XuoBK+exmGSLF1NFioohG8ZDt0eltB4TJktoDE3KOHIZlfmiaIARMPBgZM1mqcxqTKrk TjHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=C4q2bG+uix1L0g40LFcxQdc8z2a4Mz/bpvjhD03gNBE=; b=RMRvDSQnWC9U/j4a/7NTltci7ghAqfatiFoibkZWmAv4WpPk7WPR4a1bL4enwtROv4 xX4kvh+4r4xWavkRuHeBxJnvUbdx8O0s/QEwGJggG+65L9Q5wzGOXnNp1pjmw5XSA+f8 xQJ4KKHEjmfF6MImTd4aVI3uNRsEv00krVgCizWQ5i8X0ziSYwpLYVUv5+MtaWsMPQu/ CeW1eFwQ2I9RGmVv374RZHV1/HBlH3pRkv50pkko+urWh2NYgvHIR348vHnX9HGZmZN1 6RlusM3MR2dNiLcJpVMDH+Me3g3KjvRXbNBllfDZxHL3NSDncFW3InYABaXWZe608j6x v8Qg== X-Gm-Message-State: AOUpUlFT9GuVekS5ZqTfYFjfY7o9zs+UON65k5uomGMhM40+DtOjG+cu 4NCRiAeqZvIisEPZHMOhS2BJuws+BvY= X-Received: by 2002:a62:aa02:: with SMTP id e2-v6mr21866149pff.211.1532524045694; Wed, 25 Jul 2018 06:07:25 -0700 (PDT) Received: from bogon.didichuxing.com ([168.63.150.120]) by smtp.gmail.com with ESMTPSA id z4-v6sm25887696pfl.11.2018.07.25.06.07.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 06:07:24 -0700 (PDT) From: Yafang Shao To: davem@davemloft.net, edumazet@google.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH net-next] tcp: add SNMP counter for the number of packets pruned from ofo queue Date: Wed, 25 Jul 2018 21:06:50 +0800 Message-Id: <1532524010-11855-1-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org LINUX_MIB_OFOPRUNED is used to count how many times ofo queue is pruned, but sometimes we want to know how many packets are pruned from this queue, that could help us to track the dropped packets. As LINUX_MIB_OFOPRUNED is a useful event for us, so I introduce a new SNMP counter LINUX_MIB_OFOPRUNEDROP, which could be showed in netstat as OfoPruneDrop. Signed-off-by: Yafang Shao --- include/uapi/linux/snmp.h | 1 + net/ipv4/proc.c | 1 + net/ipv4/tcp_input.c | 1 + 3 files changed, 3 insertions(+) diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h index e5ebc83..c996fba 100644 --- a/include/uapi/linux/snmp.h +++ b/include/uapi/linux/snmp.h @@ -172,6 +172,7 @@ enum LINUX_MIB_PRUNECALLED, /* PruneCalled */ LINUX_MIB_RCVPRUNED, /* RcvPruned */ LINUX_MIB_OFOPRUNED, /* OfoPruned */ + LINUX_MIB_OFOPRUNEDROP, /* OfoPruneDrop */ LINUX_MIB_OUTOFWINDOWICMPS, /* OutOfWindowIcmps */ LINUX_MIB_LOCKDROPPEDICMPS, /* LockDroppedIcmps */ LINUX_MIB_ARPFILTER, /* ArpFilter */ diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index b46e4cf..c718295 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -180,6 +180,7 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) SNMP_MIB_ITEM("PruneCalled", LINUX_MIB_PRUNECALLED), SNMP_MIB_ITEM("RcvPruned", LINUX_MIB_RCVPRUNED), SNMP_MIB_ITEM("OfoPruned", LINUX_MIB_OFOPRUNED), + SNMP_MIB_ITEM("OfoPruneDrop", LINUX_MIB_OFOPRUNEDROP), SNMP_MIB_ITEM("OutOfWindowIcmps", LINUX_MIB_OUTOFWINDOWICMPS), SNMP_MIB_ITEM("LockDroppedIcmps", LINUX_MIB_LOCKDROPPEDICMPS), SNMP_MIB_ITEM("ArpFilter", LINUX_MIB_ARPFILTER), diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 91dbb9a..5267121 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4980,6 +4980,7 @@ static bool tcp_prune_ofo_queue(struct sock *sk) do { prev = rb_prev(node); rb_erase(node, &tp->out_of_order_queue); + NET_INC_STATS(sock_net(sk), LINUX_MIB_OFOPRUNEDROP); tcp_drop(sk, rb_to_skb(node)); sk_mem_reclaim(sk); if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf && -- 1.8.3.1