diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-02-20 12:17:26 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-02-20 12:17:26 +0000 |
commit | 32dfee5240805e27a6753ae4bfca0403ffa58bbf (patch) | |
tree | 2894add4f64baded341901289d502acd06699119 /sys/dev/pci | |
parent | dde0c99ae283c1cfe336d9c50cf9d2e6899b9ce7 (diff) |
When collecting the hardware statistics add the interfaces input errors
counter and out of receive buffer descriptors counter to the network stacks
input errors counter.
Based on a diff from mickey@ though updated for -current and added support
for BCM5705 or newer chipsets from brad@.
Tested it with BCM5704 on i386/amd64, BCM5700 on sparc64, BCM5701/BCM5751M
on i386 and BCM5721/BCM5780 on amd64.
ok krw@ sthen@ dlg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_bge.c | 20 | ||||
-rw-r--r-- | sys/dev/pci/if_bgereg.h | 4 |
2 files changed, 21 insertions, 3 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index feeb3ecfe21..110dfe25791 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.221 2008/02/20 10:26:53 sthen Exp $ */ +/* $OpenBSD: if_bge.c,v 1.222 2008/02/20 12:17:25 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2718,6 +2718,10 @@ bge_stats_update_regs(struct bge_softc *sc) offsetof(struct bge_mac_stats_regs, etherStatsCollisions)); ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + + ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); + + ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); } void @@ -2738,6 +2742,14 @@ bge_stats_update(struct bge_softc *sc) ifp->if_ierrors += (u_int32_t)(cnt - sc->bge_rx_discards); sc->bge_rx_discards = cnt; + cnt = READ_STAT(sc, stats, ifInErrors.bge_addr_lo); + ifp->if_ierrors += (u_int32_t)(cnt - sc->bge_rx_inerrors); + sc->bge_rx_inerrors = cnt; + + cnt = READ_STAT(sc, stats, nicNoMoreRxBDs.bge_addr_lo); + ifp->if_ierrors += (u_int32_t)(cnt - sc->bge_rx_overruns); + sc->bge_rx_overruns = cnt; + cnt = READ_STAT(sc, stats, txstats.ifOutDiscards.bge_addr_lo); ifp->if_oerrors += (u_int32_t)(cnt - sc->bge_tx_discards); sc->bge_tx_discards = cnt; @@ -3103,7 +3115,11 @@ bge_init(void *xsc) sc->bge_rx_saved_considx = 0; /* Init our RX/TX stat counters. */ - sc->bge_rx_discards = sc->bge_tx_discards = sc->bge_tx_collisions = 0; + sc->bge_tx_collisions = 0; + sc->bge_rx_discards = 0; + sc->bge_rx_inerrors = 0; + sc->bge_rx_overruns = 0; + sc->bge_tx_discards = 0; /* Init TX ring. */ bge_init_tx_ring(sc); diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h index 078d6de392b..8dc13611545 100644 --- a/sys/dev/pci/if_bgereg.h +++ b/sys/dev/pci/if_bgereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bgereg.h,v 1.79 2008/02/20 10:26:53 sthen Exp $ */ +/* $OpenBSD: if_bgereg.h,v 1.80 2008/02/20 12:17:25 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2480,6 +2480,8 @@ struct bge_softc { void *sc_shutdownhook; u_int32_t bge_rx_discards; u_int32_t bge_tx_discards; + u_int32_t bge_rx_inerrors; + u_int32_t bge_rx_overruns; u_int32_t bge_tx_collisions; SLIST_HEAD(, txdmamap_pool_entry) txdma_list; struct txdmamap_pool_entry *txdma[BGE_TX_RING_CNT]; |