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;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to