diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/gem.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index aea5eb45d27..62bca4962df 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gem.c,v 1.73 2008/02/10 16:54:23 kettenis Exp $ */ +/* $OpenBSD: gem.c,v 1.74 2008/05/09 21:22:44 brad Exp $ */ /* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */ /* @@ -387,19 +387,32 @@ gem_tick(void *arg) bus_space_tag_t t = sc->sc_bustag; bus_space_handle_t mac = sc->sc_h1; int s; + u_int32_t v; /* unload collisions counters */ - ifp->if_collisions += - bus_space_read_4(t, mac, GEM_MAC_NORM_COLL_CNT) + - bus_space_read_4(t, mac, GEM_MAC_FIRST_COLL_CNT) + - bus_space_read_4(t, mac, GEM_MAC_EXCESS_COLL_CNT) + + v = bus_space_read_4(t, mac, GEM_MAC_EXCESS_COLL_CNT) + bus_space_read_4(t, mac, GEM_MAC_LATE_COLL_CNT); + ifp->if_collisions += v + + bus_space_read_4(t, mac, GEM_MAC_NORM_COLL_CNT) + + bus_space_read_4(t, mac, GEM_MAC_FIRST_COLL_CNT); + ifp->if_oerrors += v; + + /* read error counters */ + ifp->if_ierrors += + bus_space_read_4(t, mac, GEM_MAC_RX_LEN_ERR_CNT) + + bus_space_read_4(t, mac, GEM_MAC_RX_ALIGN_ERR) + + bus_space_read_4(t, mac, GEM_MAC_RX_CRC_ERR_CNT) + + bus_space_read_4(t, mac, GEM_MAC_RX_CODE_VIOL); /* clear the hardware counters */ bus_space_write_4(t, mac, GEM_MAC_NORM_COLL_CNT, 0); bus_space_write_4(t, mac, GEM_MAC_FIRST_COLL_CNT, 0); bus_space_write_4(t, mac, GEM_MAC_EXCESS_COLL_CNT, 0); bus_space_write_4(t, mac, GEM_MAC_LATE_COLL_CNT, 0); + bus_space_write_4(t, mac, GEM_MAC_RX_LEN_ERR_CNT, 0); + bus_space_write_4(t, mac, GEM_MAC_RX_ALIGN_ERR, 0); + bus_space_write_4(t, mac, GEM_MAC_RX_CRC_ERR_CNT, 0); + bus_space_write_4(t, mac, GEM_MAC_RX_CODE_VIOL, 0); s = splnet(); mii_tick(&sc->sc_mii); |