vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Please test the following diff with any bge(4) adapters. Please send me a dmesg. - Simplify statistics updates and remove redundant register reads. - Add discarded RX packets to input errors for the BCM5705 or newer chipsets. Unfortunately output errors cannot be added because the equivalent to the ifOutDiscards register does not exist. - Replace misleading and wrong BGE_RX_STATS/BGE_TX_STATS with BGE_MAC_STATS. They were reversed but just happened to work. FreeBSD Index: if_bge.c ================================================== ================= RCS file: /cvs/src/sys/dev/pci/if_bge.c,v retrieving revision 1.213 diff -u -p -r1.213 if_bge.c --- if_bge.c 21 Jun 2007 01:11:50 -0000 1.213 +++ if_bge.c 5 Sep 2007 21:21:54 -0000 @@ -2565,26 +2565,13 @@ void bge_stats_update_regs(struct bge_softc *sc) { struct ifnet *ifp; - struct bge_mac_stats_regs stats; - u_int32_t *s; - u_long cnt; - int i; ifp = &sc->arpcom.ac_if; - s = (u_int32_t *)&stats; - for (i = 0; i < sizeof(struct bge_mac_stats_regs); i += 4) { - *s = CSR_READ_4(sc, BGE_RX_STATS + i); - s++; - } + ifp->if_collisions += CSR_READ_4(sc, BGE_MAC_STATS + + offsetof(struct bge_mac_stats_regs, etherStatsCollisions)); - cnt = stats.dot3StatsSingleCollisionFrames + - stats.dot3StatsMultipleCollisionFrames + - stats.dot3StatsExcessiveCollisions + - stats.dot3StatsLateCollisions; - ifp->if_collisions += cnt >= sc->bge_tx_collisions ? - cnt - sc->bge_tx_collisions : cnt; - sc->bge_tx_collisions = cnt; + ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); } void @@ -2592,31 +2579,21 @@ bge_stats_update(struct bge_softc *sc) { struct ifnet *ifp = &sc->arpcom.ac_if; bus_size_t stats = BGE_MEMWIN_START + BGE_STATS_BLOCK; - u_long cnt; + u_int32_t cnt; #define READ_STAT(sc, stats, stat) \ CSR_READ_4(sc, stats + offsetof(struct bge_stats, stat)) - cnt = READ_STAT(sc, stats, - txstats.dot3StatsSingleCollisionFrames.bge_addr_lo ); - cnt += READ_STAT(sc, stats, - txstats.dot3StatsMultipleCollisionFrames.bge_addr_ lo); - cnt += READ_STAT(sc, stats, - txstats.dot3StatsExcessiveCollisions.bge_addr_lo); - cnt += READ_STAT(sc, stats, - txstats.dot3StatsLateCollisions.bge_addr_lo); - ifp->if_collisions += cnt >= sc->bge_tx_collisions ? - cnt - sc->bge_tx_collisions : cnt; + cnt = READ_STAT(sc, stats, txstats.etherStatsCollisions.bge_addr_lo); + ifp->if_collisions += (u_int32_t)(cnt - sc->bge_tx_collisions); sc->bge_tx_collisions = cnt; cnt = READ_STAT(sc, stats, ifInDiscards.bge_addr_lo); - ifp->if_ierrors += cnt >= sc->bge_rx_discards ? - cnt - sc->bge_rx_discards : cnt; + ifp->if_ierrors += (u_int32_t)(cnt - sc->bge_rx_discards); sc->bge_rx_discards = cnt; cnt = READ_STAT(sc, stats, txstats.ifOutDiscards.bge_addr_lo); - ifp->if_oerrors += cnt >= sc->bge_tx_discards ? - cnt - sc->bge_tx_discards : cnt; + ifp->if_oerrors += (u_int32_t)(cnt - sc->bge_tx_discards); sc->bge_tx_discards = cnt; #undef READ_STAT @@ -2974,6 +2951,9 @@ bge_init(void *xsc) /* Init our RX return ring index */ 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; /* Init TX ring. */ bge_init_tx_ring(sc); Index: if_bgereg.h ================================================== ================= RCS file: /cvs/src/sys/dev/pci/if_bgereg.h,v retrieving revision 1.72 diff -u -p -r1.72 if_bgereg.h --- if_bgereg.h 10 Feb 2007 01:23:19 -0000 1.72 +++ if_bgereg.h 4 Sep 2007 18:53:02 -0000 @@ -602,8 +602,7 @@ #define BGE_SERDES_STS 0x0594 #define BGE_SGDIG_CFG 0x05B0 #define BGE_SGDIG_STS 0x05B4 -#define BGE_RX_STATS 0x0800 -#define BGE_TX_STATS 0x0880 +#define BGE_MAC_STATS 0x0800 /* Ethernet MAC Mode register */ #define BGE_MACMODE_RESET 0x00000001 @@ -2405,9 +2404,9 @@ struct bge_softc { struct timeout bge_timeout; void *sc_powerhook; void *sc_shutdownhook; - u_long bge_rx_discards; - u_long bge_tx_discards; - u_long bge_tx_collisions; + u_int32_t bge_rx_discards; + u_int32_t bge_tx_discards; + u_int32_t bge_tx_collisions; SLIST_HEAD(, txdmamap_pool_entry) txdma_list; struct txdmamap_pool_entry *txdma[BGE_TX_RING_CNT]; }; -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. |