Module Name:    src
Committed By:   msaitoh
Date:           Thu Feb  4 09:13:23 UTC 2010

Modified Files:
        src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
- Count Receive error, CRC error, Alignment error, Symbol error, Sequence
  error, Carrier extension error and Receive length error into ierror.
  Fixes PR#30349 reported by UMEZAWA Takeshi.
- Count Missed packet (rx fifo overflow) and Receive no buffers (rx ring full)
  into iqdrops.


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/if_wmreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.195 src/sys/dev/pci/if_wm.c:1.196
--- src/sys/dev/pci/if_wm.c:1.195	Fri Jan 22 08:56:06 2010
+++ src/sys/dev/pci/if_wm.c	Thu Feb  4 09:13:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.195 2010/01/22 08:56:06 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.196 2010/02/04 09:13:23 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.195 2010/01/22 08:56:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.196 2010/02/04 09:13:23 msaitoh Exp $");
 
 #include "rnd.h"
 
@@ -2830,7 +2830,6 @@
 		 */
 		if (errors &
 		     (WRX_ER_CE|WRX_ER_SE|WRX_ER_SEQ|WRX_ER_CXE|WRX_ER_RXE)) {
-			ifp->if_ierrors++;
 			if (errors & WRX_ER_SE)
 				log(LOG_WARNING, "%s: symbol error\n",
 				    device_xname(sc->sc_dev));
@@ -3083,7 +3082,15 @@
 	}
 
 	ifp->if_collisions += CSR_READ(sc, WMREG_COLC);
-	ifp->if_ierrors += CSR_READ(sc, WMREG_RXERRC);
+	ifp->if_ierrors += 0ULL + /* ensure quad_t */
+	    + CSR_READ(sc, WMREG_CRCERRS)
+	    + CSR_READ(sc, WMREG_ALGNERRC)
+	    + CSR_READ(sc, WMREG_SYMERRC)
+	    + CSR_READ(sc, WMREG_RXERRC)
+	    + CSR_READ(sc, WMREG_SEC)
+	    + CSR_READ(sc, WMREG_CEXTERR)
+	    + CSR_READ(sc, WMREG_RLEC);
+	ifp->if_iqdrops += CSR_READ(sc, WMREG_MPC) + CSR_READ(sc, WMREG_RNBC);
 
 	if (sc->sc_flags & WM_F_HAS_MII)
 		mii_tick(&sc->sc_mii);

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.35 src/sys/dev/pci/if_wmreg.h:1.36
--- src/sys/dev/pci/if_wmreg.h:1.35	Thu Jan 14 18:56:02 2010
+++ src/sys/dev/pci/if_wmreg.h	Thu Feb  4 09:13:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.35 2010/01/14 18:56:02 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.36 2010/02/04 09:13:23 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -642,13 +642,21 @@
 #define	RXCSUM_TUOFL	(1U << 9)	/* TCP/UDP checksum offload */
 #define	RXCSUM_IPV6OFL	(1U << 10)	/* IPv6 checksum offload */
 
-#define	WMREG_RXERRC	0x400C	/* receive error Count - R/clr */
+#define	WMREG_CRCERRS	0x4000	/* CRC Error Count */
+#define	WMREG_ALGNERRC	0x4004	/* Alignment Error Count */
+#define	WMREG_SYMERRC	0x4008	/* Symbol Error Count */
+#define	WMREG_RXERRC	0x400c	/* receive error Count - R/clr */
+#define	WMREG_MPC	0x4010	/* Missed Packets Count - R/clr */
 #define	WMREG_COLC	0x4028	/* collision Count - R/clr */
+#define	WMREG_SEC	0x4038	/* Sequence Error Count */
+#define	WMREG_CEXTERR	0x403c	/* Carrier Extension Error Count */
+#define	WMREG_RLEC	0x4040	/* Receive Length Error Count */
 #define	WMREG_XONRXC	0x4048	/* XON Rx Count - R/clr */
 #define	WMREG_XONTXC	0x404c	/* XON Tx Count - R/clr */
 #define	WMREG_XOFFRXC	0x4050	/* XOFF Rx Count - R/clr */
 #define	WMREG_XOFFTXC	0x4054	/* XOFF Tx Count - R/clr */
 #define	WMREG_FCRUC	0x4058	/* Flow Control Rx Unsupported Count - R/clr */
+#define WMREG_RNBC	0x40a0	/* Receive No Buffers Count */
 
 #define	WMREG_KUMCTRLSTA 0x0034	/* MAC-PHY interface - RW */
 #define	KUMCTRLSTA_MASK			0x0000FFFF

Reply via email to