diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-04-08 23:41:57 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-04-08 23:41:57 +0000 |
commit | bc5de14653d56c8b6ff079e7290f53330cf142cf (patch) | |
tree | 6ded4f3cf4156f58f9b46ab4379868d9889b0938 | |
parent | 93f7ed0a87c6a75e23037fcafd0fe610bdba32a8 (diff) |
- Count excess and late collisions as output errors.
- Count receive errors as input errors.
ok kettenis@
-rw-r--r-- | sys/dev/pci/if_cas.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index aef2ae73a52..522aa4cae6f 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.15 2008/04/02 22:26:16 kettenis Exp $ */ +/* $OpenBSD: if_cas.c,v 1.16 2008/04/08 23:41:56 brad Exp $ */ /* * @@ -630,19 +630,32 @@ cas_tick(void *arg) bus_space_tag_t t = sc->sc_memt; bus_space_handle_t mac = sc->sc_memh; int s; + u_int32_t v; /* unload collisions counters */ - ifp->if_collisions += - bus_space_read_4(t, mac, CAS_MAC_NORM_COLL_CNT) + - bus_space_read_4(t, mac, CAS_MAC_FIRST_COLL_CNT) + - bus_space_read_4(t, mac, CAS_MAC_EXCESS_COLL_CNT) + + v = bus_space_read_4(t, mac, CAS_MAC_EXCESS_COLL_CNT) + bus_space_read_4(t, mac, CAS_MAC_LATE_COLL_CNT); + ifp->if_collisions += v + + bus_space_read_4(t, mac, CAS_MAC_NORM_COLL_CNT) + + bus_space_read_4(t, mac, CAS_MAC_FIRST_COLL_CNT); + ifp->if_oerrors += v; + + /* read error counters */ + ifp->if_ierrors += + bus_space_read_4(t, mac, CAS_MAC_RX_LEN_ERR_CNT) + + bus_space_read_4(t, mac, CAS_MAC_RX_ALIGN_ERR) + + bus_space_read_4(t, mac, CAS_MAC_RX_CRC_ERR_CNT) + + bus_space_read_4(t, mac, CAS_MAC_RX_CODE_VIOL); /* clear the hardware counters */ bus_space_write_4(t, mac, CAS_MAC_NORM_COLL_CNT, 0); bus_space_write_4(t, mac, CAS_MAC_FIRST_COLL_CNT, 0); bus_space_write_4(t, mac, CAS_MAC_EXCESS_COLL_CNT, 0); bus_space_write_4(t, mac, CAS_MAC_LATE_COLL_CNT, 0); + bus_space_write_4(t, mac, CAS_MAC_RX_LEN_ERR_CNT, 0); + bus_space_write_4(t, mac, CAS_MAC_RX_ALIGN_ERR, 0); + bus_space_write_4(t, mac, CAS_MAC_RX_CRC_ERR_CNT, 0); + bus_space_write_4(t, mac, CAS_MAC_RX_CODE_VIOL, 0); s = splnet(); mii_tick(&sc->sc_mii); |