From patchwork Thu May 7 13:38:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 26978 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id AF4ECB7063 for ; Thu, 7 May 2009 23:39:01 +1000 (EST) Received: by ozlabs.org (Postfix) id 9F060DDF8A; Thu, 7 May 2009 23:39:01 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 457D2DDF87 for ; Thu, 7 May 2009 23:39:01 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760123AbZEGNid (ORCPT ); Thu, 7 May 2009 09:38:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759251AbZEGNid (ORCPT ); Thu, 7 May 2009 09:38:33 -0400 Received: from lanfw001a.cxnet.dk ([87.72.215.196]:37860 "EHLO lanfw001a.cxnet.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760001AbZEGNic (ORCPT ); Thu, 7 May 2009 09:38:32 -0400 Received: from comxexch02.comx.local (unknown [172.31.1.117]) by lanfw001a.cxnet.dk (Postfix) with ESMTP id 5A96B16374A; Thu, 7 May 2009 15:38:32 +0200 (CEST) Received: from hawk.comx.local ([172.31.4.93]) by comxexch02.comx.local with Microsoft SMTPSVC(6.0.3790.3959); Thu, 7 May 2009 15:38:32 +0200 Subject: [PATCH 2/2] igb: Record host memory receive overflow in net_stats From: Jesper Dangaard Brouer To: "Kirsher, Jeffrey T" Cc: "David S. Miller" , "netdev@vger.kernel.org" , "e1000-devel@lists.sourceforge.net" , "Ronciak, John" , "Waskiewicz Jr, Peter P" In-Reply-To: <1241703346.18487.22.camel@localhost.localdomain> References: <1241703346.18487.22.camel@localhost.localdomain> Organization: ComX Networks A/S Date: Thu, 07 May 2009 15:38:32 +0200 Message-Id: <1241703512.18487.27.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-OriginalArrivalTime: 07 May 2009 13:38:32.0651 (UTC) FILETIME=[1D1F91B0:01C9CF19] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The RNBC (Receive No Buffers Count) register for the 82576, indicate that frames were received when there were no available buffers in host memory to store those frames (receive descriptor head and tail pointers were equal). The packet is still received by the NIC if there is space in the FIFO on the NIC. I have shown that this situation can arise when the kernel is too busy else where. As the the RNBC value is not necessary a packet drop, I choose to store the RNBC value in net_stats.rx_fifo_errors, as its potentically not a true drop. Saving the stats in dev->net_stats makes it visible via /proc/net/dev as "fifo", and thus viewable to ifconfig as "overruns" and 'netstat -i' as "RX-OVR". The Receive No Buffers Count (RNBC) can already be queried by ethtool -S as "rx_no_buffer_count". Signed-off-by: Jesper Dangaard Brouer --- drivers/net/igb/igb_main.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c index 06b01fc..539b9f8 100644 --- a/drivers/net/igb/igb_main.c +++ b/drivers/net/igb/igb_main.c @@ -3496,6 +3496,7 @@ void igb_update_stats(struct igb_adapter *adapter) struct pci_dev *pdev = adapter->pdev; u16 phy_tmp; u32 rqdpc_tmp; + u64 rqdpc_total = 0; int i; #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF @@ -3598,7 +3599,15 @@ void igb_update_stats(struct igb_adapter *adapter) for (i = 0; i < adapter->num_rx_queues; i++) { rqdpc_tmp = rd32(E1000_RQDPC(i)) & 0xFFF; adapter->rx_ring[i].rx_stats.drops += rqdpc_tmp; + rqdpc_total += adapter->rx_ring[i].rx_stats.drops; } + adapter->net_stats.rx_fifo_errors = rqdpc_total; + + /* Note RNBC (Receive No Buffers Count) is an not an exact + * drop count as the hardware FIFO might save the day. Thats + * one of the reason for saving it in rx_fifo_errors, as its + * potentically not a true drop. */ + adapter->net_stats.rx_fifo_errors += adapter->stats.rnbc; /* RLEC on some newer hardware can be incorrect so build * our own version based on RUC and ROC */