Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Feb 2011 03:01:24 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218833 - head/sys/dev/dc
Message-ID:  <201102190301.p1J31O3g081740@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Sat Feb 19 03:01:24 2011
New Revision: 218833
URL: http://svn.freebsd.org/changeset/base/218833

Log:
  Count how many frames driver lost in interrupt handler. This
  register is cleared on read so make sure to clear it in driver
  initialization phase.

Modified:
  head/sys/dev/dc/if_dc.c

Modified: head/sys/dev/dc/if_dc.c
==============================================================================
--- head/sys/dev/dc/if_dc.c	Sat Feb 19 02:47:10 2011	(r218832)
+++ head/sys/dev/dc/if_dc.c	Sat Feb 19 03:01:24 2011	(r218833)
@@ -3250,7 +3250,7 @@ dc_intr(void *arg)
 {
 	struct dc_softc *sc;
 	struct ifnet *ifp;
-	u_int32_t status;
+	u_int32_t r, status;
 	int curpkts, n;
 
 	sc = arg;
@@ -3305,6 +3305,8 @@ dc_intr(void *arg)
 
 		if ((status & DC_ISR_RX_WATDOGTIMEO)
 		    || (status & DC_ISR_RX_NOBUF)) {
+			r = CSR_READ_4(sc, DC_FRAMESDISCARDED);
+			ifp->if_ierrors += (r & 0xffff) + ((r >> 17) & 0x7ff);
 			curpkts = ifp->if_ipackets;
 			dc_rxeof(sc);
 			if (curpkts == ifp->if_ipackets) {
@@ -3723,6 +3725,9 @@ dc_init_locked(struct dc_softc *sc)
 	mii_mediachg(mii);
 	dc_setcfg(sc, sc->dc_if_media);
 
+	/* Clear missed frames and overflow counter. */
+	CSR_READ_4(sc, DC_FRAMESDISCARDED);
+
 	/* Don't start the ticker if this is a homePNA link. */
 	if (IFM_SUBTYPE(mii->mii_media.ifm_media) == IFM_HPNA_1)
 		sc->dc_link = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102190301.p1J31O3g081740>