PERFORCE change 109011 for review
Warner Losh
imp at FreeBSD.org
Thu Nov 2 07:15:58 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=109011
Change 109011 by imp at imp_lighthouse on 2006/11/02 07:15:29
Properly account for tx and rx packets, as well as collisions.
Affected files ...
.. //depot/projects/arm/src/sys/arm/at91/if_ate.c#58 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#58 (text+ko) ====
@@ -492,8 +492,10 @@
ate_tick(void *xsc)
{
struct ate_softc *sc = xsc;
+ struct ifnet *ifp = sc->ifp;
struct mii_data *mii;
int active;
+ uint32_t c;
/*
* The KB920x boot loader tests ETH_SR & ETH_SR_LINK and will ask
@@ -535,16 +537,25 @@
* the dot3Stats mib, so for those we just count them as general
* errors. Stats for iframes, ibutes, oframes and obytes are
* collected elsewhere. These registers zero on a read to prevent
- * races.
+ * races. For all the collision stats, also update the collision
+ * stats for the interface.
*/
sc->mibdata.dot3StatsAlignmentErrors += RD4(sc, ETH_ALE);
sc->mibdata.dot3StatsFCSErrors += RD4(sc, ETH_SEQE);
- sc->mibdata.dot3StatsSingleCollisionFrames += RD4(sc, ETH_SCOL);
- sc->mibdata.dot3StatsMultipleCollisionFrames += RD4(sc, ETH_MCOL);
+ c = RD4(sc, ETH_SCOL);
+ ifp->if_collisions += c;
+ sc->mibdata.dot3StatsSingleCollisionFrames += c;
+ c = RD4(sc, ETH_MCOL);
+ sc->mibdata.dot3StatsMultipleCollisionFrames += c;
+ ifp->if_collisions += c;
sc->mibdata.dot3StatsSQETestErrors += RD4(sc, ETH_SQEE);
sc->mibdata.dot3StatsDeferredTransmissions += RD4(sc, ETH_DTE);
- sc->mibdata.dot3StatsLateCollisions += RD4(sc, ETH_LCOL);
- sc->mibdata.dot3StatsExcessiveCollisions += RD4(sc, ETH_ECOL);
+ c = RD4(sc, ETH_LCOL);
+ sc->mibdata.dot3StatsLateCollisions += c;
+ ifp->if_collisions += c;
+ c = RD4(sc, ETH_ECOL);
+ sc->mibdata.dot3StatsExcessiveCollisions += c;
+ ifp->if_collisions += c;
sc->mibdata.dot3StatsCarrierSenseErrors += RD4(sc, ETH_CSE);
sc->mibdata.dot3StatsFrameTooLongs += RD4(sc, ETH_ELR);
sc->mibdata.dot3StatsInternalMacReceiveErrors += RD4(sc, ETH_DRFC);
@@ -552,7 +563,7 @@
* not sure where to lump these, so count them against the errors
* for the interface.
*/
- sc->ifp->if_oerrors += RD4(sc, ETH_CSE) + RD4(sc, ETH_TUE);
+ sc->ifp->if_oerrors += RD4(sc, ETH_TUE);
sc->ifp->if_ierrors += RD4(sc, ETH_CDE) + RD4(sc, ETH_RJB) +
RD4(sc, ETH_USF);
@@ -595,6 +606,7 @@
ate_intr(void *xsc)
{
struct ate_softc *sc = xsc;
+ struct ifnet *ifp = sc->ifp;
int status;
int i;
void *bp;
@@ -630,25 +642,30 @@
*/
mb = m_devget(sc->rx_buf[i],
(rx_stat & ETH_LEN_MASK) - ETHER_CRC_LEN,
- ETHER_ALIGN, sc->ifp, NULL);
+ ETHER_ALIGN, ifp, NULL);
sc->rx_descs[i].addr &= ~ETH_CPU_OWNER;
bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map,
BUS_DMASYNC_PREWRITE);
bus_dmamap_sync(sc->rxtag, sc->rx_map[i],
BUS_DMASYNC_PREREAD);
- if (mb != NULL)
- (*sc->ifp->if_input)(sc->ifp, mb);
+ if (mb != NULL) {
+ ifp->if_ipackets++;
+ (*ifp->if_input)(ifp, mb);
+ }
+
}
}
if (status & ETH_ISR_TCOM) {
ATE_LOCK(sc);
if (sc->sent_mbuf[0]) {
m_freem(sc->sent_mbuf[0]);
+ ifp->if_opackets++;
sc->sent_mbuf[0] = NULL;
}
if (sc->sent_mbuf[1]) {
if (RD4(sc, ETH_TSR) & ETH_TSR_IDLE) {
m_freem(sc->sent_mbuf[1]);
+ ifp->if_opackets++;
sc->txcur = 0;
sc->sent_mbuf[0] = sc->sent_mbuf[1] = NULL;
} else {
More information about the p4-projects
mailing list