diff mbox

[2/2] igb: Record host memory receive overflow in net_stats

Message ID 1241703512.18487.27.camel@localhost.localdomain
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Jesper Dangaard Brouer May 7, 2009, 1:38 p.m. UTC
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 <hawk@comx.dk>
---

 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 mbox

Patch

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 */