kern/127834: [patch] [ixgbe] wrong error counting

Dmitry Tejblum tejblum at yandex-team.ru
Fri Oct 3 22:30:07 UTC 2008


>Number:         127834
>Category:       kern
>Synopsis:       [patch] [ixgbe] wrong error counting
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 03 22:30:05 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Tejblum
>Release:        FreeBSD 7.1-PRERELEASE amd64
>Organization:
OOO Yandex
>Environment:
7.1-PRERELEASE 


>Description:

1. In one place, the driver do if_ierrors++. The increase get lost, since
the driver recompute if_ierrors from scratch in ixgbe_update_stats_counters()

2. "Missed Packed Counter" (MPC) registers reset to 0 after reading. The code in
ixgbe_update_stats_counters() does not correctly account for it. 
For this reason, netstat -i usually show 0 errors on 'ix' interfaces, even 
though there were missed packets some time ago.

>How-To-Repeat:

>Fix:



--- ixgbe.c	2008-07-01 04:33:19.000000000 +0400
+++ ixgbe.c	2008-10-04 01:45:53.000000000 +0400
@@ -3337,7 +3337,7 @@ ixgbe_rxeof(struct rx_ring *rxr, int cou
 				rxr->lmp = NULL;
 			}
 		} else {
-			ifp->if_ierrors++;
+			adapter->dropped_pkts++;
 discard:
 			/* Reuse loaded DMA map and just update mbuf chain */
 			mp = rxr->rx_buffers[i].m_head;
@@ -3553,6 +3553,7 @@ ixgbe_update_stats_counters(struct adapt
 	struct ifnet   *ifp = adapter->ifp;;
 	struct ixgbe_hw *hw = &adapter->hw;
 	u32  missed_rx = 0, bprc, lxon, lxoff, total;
+	u64  missed_rx_total = 0;
 
 	adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS);
 
@@ -3561,6 +3562,7 @@ ixgbe_update_stats_counters(struct adapt
 		mp = IXGBE_READ_REG(hw, IXGBE_MPC(i));
 		missed_rx += mp;
         	adapter->stats.mpc[i] += mp;
+        	missed_rx_total += adapter->stats.mpc[i];
 		adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i));
 	}
 
@@ -3628,8 +3630,8 @@ ixgbe_update_stats_counters(struct adapt
 	ifp->if_collisions = 0;
 
 	/* Rx Errors */
-	ifp->if_ierrors = missed_rx + adapter->stats.crcerrs +
-		adapter->stats.rlec;
+	ifp->if_ierrors = missed_rx_total + adapter->stats.crcerrs +
+		adapter->stats.rlec + adapter->dropped_pkts;
 }
 
 
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list