diff --git a/sys/dev/ffec/if_ffec.c b/sys/dev/ffec/if_ffec.c index ce8b43537b13..b8230164367d 100644 --- a/sys/dev/ffec/if_ffec.c +++ b/sys/dev/ffec/if_ffec.c @@ -499,23 +499,21 @@ ffec_harvest_stats(struct ffec_softc *sc) sc->stats_harvest_count = 0; ifp = sc->ifp; - ifp->if_ipackets += RD4(sc, FEC_RMON_R_PACKETS); - ifp->if_imcasts += RD4(sc, FEC_RMON_R_MC_PKT); - ifp->if_ierrors += RD4(sc, FEC_RMON_R_CRC_ALIGN); - ifp->if_ierrors += RD4(sc, FEC_RMON_R_UNDERSIZE); - ifp->if_ierrors += RD4(sc, FEC_RMON_R_OVERSIZE); - ifp->if_ierrors += RD4(sc, FEC_RMON_R_FRAG); - ifp->if_ierrors += RD4(sc, FEC_RMON_R_JAB); + if_inc_counter(ifp, IFCOUNTER_IPACKETS, RD4(sc, FEC_RMON_R_PACKETS)); + if_inc_counter(ifp, IFCOUNTER_IMCASTS, RD4(sc, FEC_RMON_R_MC_PKT)); + if_inc_counter(ifp, IFCOUNTER_IERRORS, + RD4(sc, FEC_RMON_R_CRC_ALIGN) + RD4(sc, FEC_RMON_R_UNDERSIZE) + + RD4(sc, FEC_RMON_R_OVERSIZE) + RD4(sc, FEC_RMON_R_FRAG) + + RD4(sc, FEC_RMON_R_JAB)); - ifp->if_opackets += RD4(sc, FEC_RMON_T_PACKETS); - ifp->if_omcasts += RD4(sc, FEC_RMON_T_MC_PKT); - ifp->if_oerrors += RD4(sc, FEC_RMON_T_CRC_ALIGN); - ifp->if_oerrors += RD4(sc, FEC_RMON_T_UNDERSIZE); - ifp->if_oerrors += RD4(sc, FEC_RMON_T_OVERSIZE ); - ifp->if_oerrors += RD4(sc, FEC_RMON_T_FRAG); - ifp->if_oerrors += RD4(sc, FEC_RMON_T_JAB); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, RD4(sc, FEC_RMON_T_PACKETS)); + if_inc_counter(ifp, IFCOUNTER_OMCASTS, RD4(sc, FEC_RMON_T_MC_PKT)); + if_inc_counter(ifp, IFCOUNTER_OERRORS, + RD4(sc, FEC_RMON_T_CRC_ALIGN) + RD4(sc, FEC_RMON_T_UNDERSIZE) + + RD4(sc, FEC_RMON_T_OVERSIZE) + RD4(sc, FEC_RMON_T_FRAG) + + RD4(sc, FEC_RMON_T_JAB)); - ifp->if_collisions += RD4(sc, FEC_RMON_T_COL); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, RD4(sc, FEC_RMON_T_COL)); ffec_clear_stats(sc); } @@ -784,7 +782,7 @@ ffec_rxfinish_onebuf(struct ffec_softc *sc, int len) * mbuf, which is still mapped and loaded. */ if ((newmbuf = ffec_alloc_mbufcl(sc)) == NULL) { - ++sc->ifp->if_iqdrops; + if_inc_counter(sc->ifp, IFCOUNTER_IQDROPS, 1); ffec_setup_rxdesc(sc, sc->rx_idx, sc->rxdesc_ring[sc->rx_idx].buf_paddr); return;