summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2008-05-09 21:22:45 +0000
committerBrad Smith <brad@cvs.openbsd.org>2008-05-09 21:22:45 +0000
commitf47b82f2a8d5e2fa67e242d96198f7c383682735 (patch)
tree9125eac27e6c8855941cd43f5c144eefc2a0ce12 /sys
parent0e4e0b76e372b2ea52ebce81f4498bc0eba9045b (diff)
- Count excess and late collisions as output errors.
- Count receive errors as input errors. Based on similar change to the gem(4) driver from NetBSD. ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/gem.c23
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);