Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp535677imm; Wed, 13 Jun 2018 04:39:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKkTnDupFjaQVuKtBkEItBUnIpzidjt2r5h86PeDJ2A6LFdNiCfsMbKMsic36gUfZZsQ1Wc X-Received: by 2002:a17:902:2d24:: with SMTP id o33-v6mr4860285plb.14.1528889966363; Wed, 13 Jun 2018 04:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528889966; cv=none; d=google.com; s=arc-20160816; b=f3J2Xiz71/54420j2by8GQLecWu9hzj3+1Iznf5fRdba1z2VvBcodSuS/Nd3al6Rb1 Cno+8NOEs+TzfioCZxFtefMwB6m1czmC1v8qIIxMuxA3/ORmOx78JEK28/cC3JFhqATu vgdUqlxovr/Xh9AIu5SpkIZ78JKSN17BcSQfy04a2G8qSZk4IdYN6kBTcJRmRHjclVqU +l6G/YgWhYgHZvSG3xiLir4WH205EMpthI5fs8shIRc+ygcpN2mybDtfnAJ1cKmBBiQc BemSX1Opvb3O2BI2u8lQT5GW8ohgKwHINFOHGtJ1r7qiC7lALt+o8fmyUAsnUF48S0li yNhQ== 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=AiAOhGc6/btvEwpfqfojLO2Bvebug21a4REIZ6DvWHs=; b=vQ0G4Vx4I4YLmMuuFNqqQIu/UIvAGT0bV/7+BdHcGgQ0fM8oh/J0VYPUMfVzRFHUrB /qusZWPf9WROXyn/9+e/ewJxzHSXC/pWIbIpZe+OWoFCbR3sp14MUmY03Sz0oM2c1/wT qtcIb71XrIGO6A77VCcktc7PgjPzF3Pi7j3YM6LBQgJN2VPTvITNk2TOAm89m2A8sOs2 BXB7y1rQqKNFoiTrgPJcdiuHXveQAag7k3b8MH0oB2rdWMdZXedICiUaPP6m+cn3KxvZ Yb5+4qrfErRTCnh+kD3DrxrszvGMwuSSj/a7rwp6O4tOhLVu1KOvTb9lu5OsYe4PMfaE p84Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WuFXeFJI; 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 f10-v6si2256492pgn.0.2018.06.13.04.39.11; Wed, 13 Jun 2018 04:39:26 -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=WuFXeFJI; 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 S935385AbeFMLip (ORCPT + 99 others); Wed, 13 Jun 2018 07:38:45 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:37289 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935188AbeFMLin (ORCPT ); Wed, 13 Jun 2018 07:38:43 -0400 Received: by mail-pg0-f68.google.com with SMTP id r21-v6so1153594pgv.4; Wed, 13 Jun 2018 04:38:43 -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=AiAOhGc6/btvEwpfqfojLO2Bvebug21a4REIZ6DvWHs=; b=WuFXeFJIhVhYGnw9wltCVZ3+ir7Pne2E+urNplZlpd7lpQizusf+ryFxLUbLune134 QEwE13utjH4NCZG/wHMIGoEUjFFKawDjLXAKJc5oMDGIk7ZgOofDwEKpV6BqQxXGX/lE kNPNolq9YjO9CllMgVPFERZIapPljtx28+9adbjdcTTIdL577eVHoj/FtAbDM4Q0OH2b kzQJHwayli8EMip0Qoe4aeJpISiBqFk+EDA3ZW1DKJEe+3mrHC4x+Q7XbNOau95aGhNm P6ASh2cYPHyrxzYkWuyxsIKNOAuq2He2w4o2IKQqMkYrn0+hkcOif2gP1mnfwAtmpPXv PWZw== 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=AiAOhGc6/btvEwpfqfojLO2Bvebug21a4REIZ6DvWHs=; b=BFOIOBed3826s11ovebaCnJ9PIKBkJn5RoTq+ITegLUbR6WNu7cdsnV4ZKI+ahqka8 rxp1S60SRhEJv1H8O8ujpiSmFgSpSDVh4yyZorCZiUwnD34gxGVM4VnKFt72nLw4mVAG MpboofObFK5nL3gaYBRK+7Cce7ZQ94YEZzo7MHrdO1I/jO8dzh9O+b02TacPOfJnTjzn KTIVAO1XuBryn0kFRD3QednGWP9fdSmfDq0bDzyHm9eOCYu69nvsEwU0QlqEgaFd30me tjTbs5edWHhotfCv+4iYS7Zyz00ZIHVhhgT98XU6JBNGErOOpmzZZ3RxiSAy7g6ydsNc xuMg== X-Gm-Message-State: APt69E2BH0nsMJkv79F43qjc7rJgOkUqCYT6V04m2Ibb1DkEHBHHXWRp 2pUTwLTc+eU6LId0rWpGbk4= X-Received: by 2002:a62:fb05:: with SMTP id x5-v6mr4601869pfm.210.1528889922839; Wed, 13 Jun 2018 04:38:42 -0700 (PDT) Received: from bogon.didichuxing.com ([52.229.160.192]) by smtp.gmail.com with ESMTPSA id h16-v6sm3625321pfn.80.2018.06.13.04.38.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 04:38:42 -0700 (PDT) From: Yafang Shao To: edumazet@google.com, davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH net-next] tcp: add SNMP counter for zero-window drops Date: Wed, 13 Jun 2018 07:38:28 -0400 Message-Id: <1528889908-15980-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 It will be helpful if we could display the drops due to zero window or no enough window space. So a new SNMP MIB entry is added to track this behavior. This entry is named LINUX_MIB_TCPZEROWINDOWDROP and published in /proc/net/netstat in TcpExt line as TCPZeroWindowDrop. Signed-off-by: Yafang Shao --- include/uapi/linux/snmp.h | 1 + net/ipv4/proc.c | 1 + net/ipv4/tcp_input.c | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h index 750d891..97517f3 100644 --- a/include/uapi/linux/snmp.h +++ b/include/uapi/linux/snmp.h @@ -279,6 +279,7 @@ enum LINUX_MIB_TCPDELIVERED, /* TCPDelivered */ LINUX_MIB_TCPDELIVEREDCE, /* TCPDeliveredCE */ LINUX_MIB_TCPACKCOMPRESSED, /* TCPAckCompressed */ + LINUX_MIB_TCPZEROWINDOWDROP, /* TCPZeroWindowDrop */ __LINUX_MIB_MAX }; diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 77350c1..225ef34 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -287,6 +287,7 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) SNMP_MIB_ITEM("TCPDelivered", LINUX_MIB_TCPDELIVERED), SNMP_MIB_ITEM("TCPDeliveredCE", LINUX_MIB_TCPDELIVEREDCE), SNMP_MIB_ITEM("TCPAckCompressed", LINUX_MIB_TCPACKCOMPRESSED), + SNMP_MIB_ITEM("TCPZeroWindowDrop", LINUX_MIB_TCPZEROWINDOWDROP), SNMP_MIB_SENTINEL }; diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 355d3df..b0482b1 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4665,8 +4665,10 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) * Out of sequence packets to the out_of_order_queue. */ if (TCP_SKB_CB(skb)->seq == tp->rcv_nxt) { - if (tcp_receive_window(tp) == 0) + if (tcp_receive_window(tp) == 0) { + NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPZEROWINDOWDROP); goto out_of_window; + } /* Ok. In sequence. In window. */ queue_and_out: @@ -4732,8 +4734,10 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) /* If window is closed, drop tail of packet. But after * remembering D-SACK for its head made in previous line. */ - if (!tcp_receive_window(tp)) + if (!tcp_receive_window(tp)) { + NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPZEROWINDOWDROP); goto out_of_window; + } goto queue_and_out; } -- 1.8.3.1