From patchwork Mon May 12 03:19:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yanjun X-Patchwork-Id: 347871 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4405014007E for ; Mon, 12 May 2014 13:19:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751197AbaELDTg (ORCPT ); Sun, 11 May 2014 23:19:36 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:63481 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750944AbaELDTf (ORCPT ); Sun, 11 May 2014 23:19:35 -0400 Received: by mail-pa0-f54.google.com with SMTP id bj1so6148061pad.13 for ; Sun, 11 May 2014 20:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type; bh=ESeCrJU2KUoetaWHY7jPW6WZIfCuh/KyNjIHOkNZblA=; b=UhzFXzkRZ/0/KVWd/hnYkQlujPzPdhJ3fvh6TBda6lzm7REIeX5SAS/lxSa/zi5l9q +vZ97mm5KnETBsRaT/Jga7HY+tfOawCBZvE7ZEb25EzvRbLhi8F3JYM4jZ+9evtC24f9 B/zsE1X/S88m53riMklOMvNs3qYq/87neLPS7BmVunvze8LEClJkOeFDo9IJmcrcyWJg +F8ZgN0QY70WYSVPR1V2Af8lYMOeThpcdS6TY7ehBSdgsUhE7Yo/HJY3/kzyB4gB2xi6 nUURALXpT/e1ttIfoQkGz+nfcRbd+ekI43lmNbR2ClAnr4Bir5d7ayG9tP05hqyGdnFP MSRA== X-Received: by 10.66.120.201 with SMTP id le9mr48529976pab.98.1399864774610; Sun, 11 May 2014 20:19:34 -0700 (PDT) Received: from [128.224.162.201] ([1.202.252.122]) by mx.google.com with ESMTPSA id xk3sm20047540pbb.65.2014.05.11.20.19.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 11 May 2014 20:19:33 -0700 (PDT) Message-ID: <53703DC0.2070204@gmail.com> Date: Mon, 12 May 2014 11:19:28 +0800 From: zhuyj User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: eric.dumazet@gmail.com, "David S. Miller" CC: "Tao, Yue" , zhuyj , linux-kernel@vger.kernel.org, netdev Subject: icmp: account for ICMP out errors because of socket limit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, Eric && David ____ ______________ | | | | | PC |<------->| MIPS 32 core | |____| |______________| When ping from a PC to a board (MIPS 32 core), because of socket limit, ping echo will fail. But ICMP_MIB_OUTERRORS counter is not incremented. In this case, "netstat -s" can not report these errors. This patch will fix this problem. Now it is in the attachment. Please check it. Best Regards! Zhu Yanjun From af800d0f123cf9c66a9ae167baa7dc1d25d0cd1f Mon Sep 17 00:00:00 2001 From: Zhu Yanjun Date: Mon, 12 May 2014 11:07:20 +0800 Subject: [PATCH 1/1] icmp: account for ICMP out errors because of socket limit When icmp_xmit_lock fails because of socket limit or memory shortage, increment ICMP_MIB_OUTERRORS counter, so that "netstat -s" can report these errors. netstat -s | grep "ICMP messages failed" 0 ICMP messages failed Signed-off-by: Zhu Yanjun --- net/ipv4/icmp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 0134663..9a0bd7c 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -342,8 +342,10 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) return; sk = icmp_xmit_lock(net); - if (sk == NULL) + if (sk == NULL){ + ICMP_INC_STATS_BH(net, ICMP_MIB_OUTERRORS); return; + } inet = inet_sk(sk); icmp_param->data.icmph.checksum = 0; -- 1.7.9.5