mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
- Correct collision counter for BCM5705+. This register is read/clear.
- Correct RX packet drop counter for BCM5705+. This register is read/clear and it wraps very quickly under heavy packet drops because only the lower ten bits are valid according to the documentation. However, it seems few more bits are actually valid and the rest bits are always zeros[1]. Therefore, we don't mask them off here. To get accurate packet drop count, we need to check the register from bge_rxeof(). It is commented out for now, not to penalize normal operation. Actual performance impact should be measured later. - Correct integer casting from u_long to uint32_t. Casting is not really needed for all supported platforms but we better do this correctly[2]. Tested by: bde[1] Suggested by: bde[2]
This commit is contained in:
parent
353067fc31
commit
6b037352d0
1 changed files with 13 additions and 10 deletions
|
|
@ -2755,6 +2755,14 @@ bge_rxeof(struct bge_softc *sc)
|
|||
CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std);
|
||||
if (jumbocnt)
|
||||
CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo);
|
||||
#ifdef notyet
|
||||
/*
|
||||
* This register wraps very quickly under heavy packet drops.
|
||||
* If you need correct statistics, you can enable this check.
|
||||
*/
|
||||
if (BGE_IS_5705_PLUS(sc))
|
||||
ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2967,18 +2975,13 @@ static void
|
|||
bge_stats_update_regs(struct bge_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
uint32_t cnt; /* current register value */
|
||||
|
||||
ifp = sc->bge_ifp;
|
||||
|
||||
cnt = CSR_READ_4(sc, BGE_MAC_STATS +
|
||||
ifp->if_collisions += CSR_READ_4(sc, BGE_MAC_STATS +
|
||||
offsetof(struct bge_mac_stats_regs, etherStatsCollisions));
|
||||
ifp->if_collisions += (u_long)(cnt - sc->bge_tx_collisions);
|
||||
sc->bge_tx_collisions = cnt;
|
||||
|
||||
cnt = CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
|
||||
ifp->if_ierrors += (u_long)(cnt - sc->bge_rx_discards);
|
||||
sc->bge_rx_discards = cnt;
|
||||
ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -3003,15 +3006,15 @@ bge_stats_update(struct bge_softc *sc)
|
|||
txstats.dot3StatsExcessiveCollisions.bge_addr_lo);
|
||||
cnt += READ_STAT(sc, stats,
|
||||
txstats.dot3StatsLateCollisions.bge_addr_lo);
|
||||
ifp->if_collisions += (u_long)(cnt - sc->bge_tx_collisions);
|
||||
ifp->if_collisions += (uint32_t)(cnt - sc->bge_tx_collisions);
|
||||
sc->bge_tx_collisions = cnt;
|
||||
|
||||
cnt = READ_STAT(sc, stats, ifInDiscards.bge_addr_lo);
|
||||
ifp->if_ierrors += (u_long)(cnt - sc->bge_rx_discards);
|
||||
ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_discards);
|
||||
sc->bge_rx_discards = cnt;
|
||||
|
||||
cnt = READ_STAT(sc, stats, txstats.ifOutDiscards.bge_addr_lo);
|
||||
ifp->if_oerrors += (u_long)(cnt - sc->bge_tx_discards);
|
||||
ifp->if_oerrors += (uint32_t)(cnt - sc->bge_tx_discards);
|
||||
sc->bge_tx_discards = cnt;
|
||||
|
||||
#undef READ_STAT
|
||||
|
|
|
|||
Loading…
Reference in a new issue