From b3b337a80e78f4cc2d0c75f98e4685bee9c749c9 Mon Sep 17 00:00:00 2001 From: glebius Date: Fri, 19 Sep 2014 03:51:26 +0000 Subject: Mechanically convert to if_inc_counter(). --- sys/dev/ae/if_ae.c | 14 +++++----- sys/dev/altera/atse/if_atse.c | 18 ++++++------ sys/dev/an/if_an.c | 40 +++++++++++++-------------- sys/dev/bwi/if_bwi.c | 16 +++++------ sys/dev/bwn/if_bwn.c | 22 +++++++-------- sys/dev/cadence/if_cgem.c | 16 +++++------ sys/dev/ce/if_ce.c | 18 ++++++------ sys/dev/cm/smc90cx6.c | 14 +++++----- sys/dev/cp/if_cp.c | 18 ++++++------ sys/dev/ctau/if_ct.c | 18 ++++++------ sys/dev/cx/if_cx.c | 20 +++++++------- sys/dev/dc/if_dc.c | 26 ++++++++--------- sys/dev/de/if_de.c | 12 ++++---- sys/dev/ed/if_ed.c | 16 +++++------ sys/dev/en/midway.c | 8 +++--- sys/dev/ex/if_ex.c | 20 +++++++------- sys/dev/fatm/if_fatm.c | 6 ++-- sys/dev/firewire/if_fwe.c | 12 ++++---- sys/dev/firewire/if_fwip.c | 20 +++++++------- sys/dev/gxemul/ether/if_gx.c | 10 +++---- sys/dev/hatm/if_hatm_rx.c | 8 +++--- sys/dev/hatm/if_hatm_tx.c | 10 +++---- sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 6 ++-- sys/dev/if_ndis/if_ndis.c | 10 +++---- sys/dev/iicbus/if_ic.c | 16 +++++------ sys/dev/ipw/if_ipw.c | 10 +++---- sys/dev/iwi/if_iwi.c | 12 ++++---- sys/dev/iwn/if_iwn.c | 20 +++++++------- sys/dev/le/am7990.c | 28 +++++++++---------- sys/dev/le/am79900.c | 28 +++++++++---------- sys/dev/le/lance.c | 2 +- sys/dev/lge/if_lge.c | 14 +++++----- sys/dev/malo/if_malo.c | 14 +++++----- sys/dev/mge/if_mge.c | 10 +++---- sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c | 8 +++--- sys/dev/netmap/if_lem_netmap.h | 2 +- sys/dev/netmap/if_re_netmap.h | 2 +- sys/dev/oce/oce_if.c | 10 +++---- sys/dev/patm/if_patm_rx.c | 10 +++---- sys/dev/patm/if_patm_tx.c | 28 +++++++++---------- sys/dev/ppbus/if_plip.c | 22 +++++++-------- sys/dev/qlxgbe/ql_hw.c | 2 +- sys/dev/qlxgbe/ql_isr.c | 4 +-- sys/dev/qlxge/qls_isr.c | 4 +-- sys/dev/ral/rt2560.c | 24 ++++++++-------- sys/dev/ral/rt2661.c | 22 +++++++-------- sys/dev/ral/rt2860.c | 18 ++++++------ sys/dev/re/if_re.c | 14 +++++----- sys/dev/rt/if_rt.c | 14 +++++----- sys/dev/sbni/if_sbni.c | 12 ++++---- sys/dev/sge/if_sge.c | 16 +++++------ sys/dev/sk/if_sk.c | 16 +++++------ sys/dev/sn/if_sn.c | 24 ++++++++-------- sys/dev/ste/if_ste.c | 18 ++++++------ sys/dev/tsec/if_tsec.c | 20 +++++++------- sys/dev/vx/if_vx.c | 18 ++++++------ sys/dev/vxge/vxge.c | 10 +++---- sys/dev/wb/if_wb.c | 24 ++++++++-------- sys/dev/wl/if_wl.c | 20 +++++++------- sys/dev/wpi/if_wpi.c | 22 +++++++-------- sys/dev/wtap/if_wtap.c | 10 +++---- sys/dev/xe/if_xe.c | 34 +++++++++++------------ sys/dev/xen/netback/netback.c | 10 +++---- sys/dev/xen/netfront/netfront.c | 4 +-- 64 files changed, 487 insertions(+), 487 deletions(-) diff --git a/sys/dev/ae/if_ae.c b/sys/dev/ae/if_ae.c index ec17409..6108f81 100644 --- a/sys/dev/ae/if_ae.c +++ b/sys/dev/ae/if_ae.c @@ -1852,9 +1852,9 @@ ae_tx_intr(ae_softc_t *sc) sizeof(ae_txs_t) + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT; if ((flags & AE_TXS_SUCCESS) != 0) - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); else - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); sc->tx_inproc--; } @@ -1897,13 +1897,13 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd) size = le16toh(rxd->len) - ETHER_CRC_LEN; if (size < (ETHER_MIN_LEN - ETHER_CRC_LEN - ETHER_VLAN_ENCAP_LEN)) { if_printf(ifp, "Runt frame received."); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } m = m_devget(&rxd->data[0], size, ETHER_ALIGN, ifp, NULL); if (m == NULL) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); return; } @@ -1913,7 +1913,7 @@ ae_rxeof(ae_softc_t *sc, ae_rxd_t *rxd) m->m_flags |= M_VLANTAG; } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); /* * Pass it through. */ @@ -1959,7 +1959,7 @@ ae_rx_intr(ae_softc_t *sc) if ((flags & AE_RXD_SUCCESS) != 0) ae_rxeof(sc, rxd); else - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } if (count > 0) { @@ -1989,7 +1989,7 @@ ae_watchdog(ae_softc_t *sc) else if_printf(ifp, "watchdog timeout - resetting.\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ae_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) diff --git a/sys/dev/altera/atse/if_atse.c b/sys/dev/altera/atse/if_atse.c index c370891..1c55fbc 100644 --- a/sys/dev/altera/atse/if_atse.c +++ b/sys/dev/altera/atse/if_atse.c @@ -1159,7 +1159,7 @@ atse_watchdog(struct atse_softc *sc) return; device_printf(sc->atse_dev, "watchdog timeout\n"); - sc->atse_ifp->if_oerrors++; + if_inc_counter(sc->atse_ifp, IFCOUNTER_OERRORS, 1); atse_intr_debug(sc, "poll"); @@ -1263,7 +1263,7 @@ outer: atse_update_rx_err(sc, ((meta & A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) >> A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT) & 0xff); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); sc->atse_rx_buf_len = 0; /* * Should still read till EOP or next SOP. @@ -1292,7 +1292,7 @@ outer: "without empty buffer: %u\n", __func__, sc->atse_rx_buf_len); /* XXX-BZ any better counter? */ - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } if ((sc->atse_flags & ATSE_FLAGS_SOP_SEEN) == 0) @@ -1311,7 +1311,7 @@ outer: * XXX-BZ Error. We need more mbufs and are * not setup for this yet. */ - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); sc->atse_flags |= ATSE_FLAGS_ERROR; } if ((sc->atse_flags & ATSE_FLAGS_ERROR) == 0) @@ -1330,7 +1330,7 @@ outer: A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT; sc->atse_rx_buf_len += (4 - empty); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); rx_npkts++; m = sc->atse_rx_m; @@ -1414,7 +1414,7 @@ atse_rx_intr(void *arg) atse_update_rx_err(sc, ((rxe & A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) >> A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT) & 0xff); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } /* @@ -1469,7 +1469,7 @@ atse_tx_intr(void *arg) if (txe & (A_ONCHIP_FIFO_MEM_CORE_EVENT_OVERFLOW| A_ONCHIP_FIFO_MEM_CORE_EVENT_UNDERFLOW)) { /* XXX-BZ ERROR HANDLING. */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } /* @@ -1527,12 +1527,12 @@ atse_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) atse_update_rx_err(sc, ((rx & A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) >> A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT) & 0xff); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } if (tx & (A_ONCHIP_FIFO_MEM_CORE_EVENT_OVERFLOW| A_ONCHIP_FIFO_MEM_CORE_EVENT_UNDERFLOW)) { /* XXX-BZ ERROR HANDLING. */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } if (ATSE_TX_READ_FILL_LEVEL(sc) == 0) sc->atse_watchdog_timer = 0; diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index 7067520..bee2a0c 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -872,7 +872,7 @@ an_rxeof(struct an_softc *sc) /* read header */ if (an_read_data(sc, id, 0x0, (caddr_t)&rx_frame, sizeof(rx_frame))) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -895,7 +895,7 @@ an_rxeof(struct an_softc *sc) if_printf(ifp, "oversized packet " "received (%d, %d)\n", len, MCLBYTES); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -921,7 +921,7 @@ an_rxeof(struct an_softc *sc) if_printf(ifp, "oversized packet " "received (%d, %d)\n", len, MCLBYTES); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -940,13 +940,13 @@ an_rxeof(struct an_softc *sc) } else { MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } MCLGET(m, M_NOWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } m->m_pkthdr.rcvif = ifp; @@ -957,7 +957,7 @@ an_rxeof(struct an_softc *sc) if (an_read_data(sc, id, 0, (caddr_t)&rx_frame, sizeof(rx_frame))) { m_freem(m); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } #endif @@ -966,12 +966,12 @@ an_rxeof(struct an_softc *sc) (caddr_t)&rx_frame_802_3, sizeof(rx_frame_802_3))) { m_freem(m); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } if (rx_frame_802_3.an_rx_802_3_status != 0) { m_freem(m); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } /* Check for insane frame length */ @@ -981,7 +981,7 @@ an_rxeof(struct an_softc *sc) if_printf(ifp, "oversized packet " "received (%d, %d)\n", len, MCLBYTES); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } m->m_pkthdr.len = m->m_len = @@ -1001,10 +1001,10 @@ an_rxeof(struct an_softc *sc) if (error) { m_freem(m); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); /* Receive packet. */ #ifdef ANCACHE @@ -1031,13 +1031,13 @@ an_rxeof(struct an_softc *sc) MGETHDR(m, M_NOWAIT, MT_DATA); if (m == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } MCLGET(m, M_NOWAIT); if (!(m->m_flags & M_EXT)) { m_freem(m); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } m->m_pkthdr.rcvif = ifp; @@ -1061,7 +1061,7 @@ an_rxeof(struct an_softc *sc) if_printf(ifp, "oversized packet " "received (%d, %d)\n", len, MCLBYTES); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -1073,7 +1073,7 @@ an_rxeof(struct an_softc *sc) bcopy(buf, (char *)eh, m->m_pkthdr.len); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); /* Receive packet. */ #if 0 @@ -1126,9 +1126,9 @@ an_txeof(struct an_softc *sc, int status) id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350)); if (status & AN_EV_TX_EXC) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } else - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); for (i = 0; i < AN_TX_RING_CNT; i++) { if (id == sc->an_rdata.an_tx_ring[i]) { @@ -1142,9 +1142,9 @@ an_txeof(struct an_softc *sc, int status) id = CSR_READ_2(sc, AN_TX_CMP_FID(sc->mpi350)); if (!sc->an_rdata.an_tx_empty){ if (status & AN_EV_TX_EXC) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } else - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); AN_INC(sc->an_rdata.an_tx_cons, AN_MAX_TX_DESC); if (sc->an_rdata.an_tx_prod == sc->an_rdata.an_tx_cons) @@ -2962,7 +2962,7 @@ an_watchdog(struct an_softc *sc) an_init_mpi350_desc(sc); an_init_locked(sc); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } int diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c index ca9612e..9e915aa 100644 --- a/sys/dev/bwi/if_bwi.c +++ b/sys/dev/bwi/if_bwi.c @@ -1401,7 +1401,7 @@ bwi_start_locked(struct ifnet *ifp) if (k == NULL) { ieee80211_free_node(ni); m_freem(m); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } } @@ -1411,7 +1411,7 @@ bwi_start_locked(struct ifnet *ifp) /* 'm' is freed in bwi_encap() if we reach here */ if (ni != NULL) ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } @@ -1419,7 +1419,7 @@ bwi_start_locked(struct ifnet *ifp) tbd->tbd_used++; idx = (idx + 1) % BWI_TX_NDESC; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if (tbd->tbd_used + BWI_TX_NSPRDESC >= BWI_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -1466,7 +1466,7 @@ bwi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, error = bwi_encap_raw(sc, idx, m, ni, params); } if (error == 0) { - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if (++tbd->tbd_used + BWI_TX_NSPRDESC >= BWI_TX_NDESC) ifp->if_drv_flags |= IFF_DRV_OACTIVE; tbd->tbd_idx = (idx + 1) % BWI_TX_NDESC; @@ -1474,7 +1474,7 @@ bwi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, } else { /* NB: m is reclaimed on encap failure */ ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } BWI_UNLOCK(sc); return error; @@ -1491,7 +1491,7 @@ bwi_watchdog(void *arg) BWI_ASSERT_LOCKED(sc); if (sc->sc_tx_timer != 0 && --sc->sc_tx_timer == 0) { if_printf(ifp, "watchdog timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); taskqueue_enqueue(sc->sc_tq, &sc->sc_restart_task); } callout_reset(&sc->sc_watchdog_timer, hz, bwi_watchdog, sc); @@ -2639,7 +2639,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_idx) BUS_DMASYNC_POSTREAD); if (bwi_newbuf(sc, idx, 0)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto next; } @@ -2655,7 +2655,7 @@ bwi_rxeof(struct bwi_softc *sc, int end_idx) if (buflen < BWI_FRAME_MIN_LEN(wh_ofs)) { if_printf(ifp, "%s: zero length data, hdr_extra %d\n", __func__, hdr_extra); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); m_freem(m); goto next; } diff --git a/sys/dev/bwn/if_bwn.c b/sys/dev/bwn/if_bwn.c index 4e9a8d9..6c5b8fd 100644 --- a/sys/dev/bwn/if_bwn.c +++ b/sys/dev/bwn/if_bwn.c @@ -1311,7 +1311,7 @@ bwn_start_locked(struct ifnet *ifp) if (ni == NULL) { device_printf(sc->sc_dev, "unexpected NULL ni\n"); m_freem(m); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } KASSERT(ni != NULL, ("%s:%d: fail", __func__, __LINE__)); @@ -1321,7 +1321,7 @@ bwn_start_locked(struct ifnet *ifp) if (k == NULL) { ieee80211_free_node(ni); m_freem(m); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } } @@ -1330,7 +1330,7 @@ bwn_start_locked(struct ifnet *ifp) if (bwn_tx_start(sc, ni, m) != 0) { if (ni != NULL) ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } @@ -1587,7 +1587,7 @@ bwn_watchdog(void *arg) if (sc->sc_watchdog_timer != 0 && --sc->sc_watchdog_timer == 0) { if_printf(ifp, "device timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } callout_schedule(&sc->sc_watchdog_ch, hz); } @@ -2748,7 +2748,7 @@ bwn_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, if (bwn_tx_isfull(sc, m)) { ieee80211_free_node(ni); m_freem(m); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); BWN_UNLOCK(sc); return (ENOBUFS); } @@ -2756,7 +2756,7 @@ bwn_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, if (bwn_tx_start(sc, ni, m) != 0) { if (ni != NULL) ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } sc->sc_watchdog_timer = 5; BWN_UNLOCK(sc); @@ -8929,14 +8929,14 @@ bwn_dma_rxeof(struct bwn_dma_ring *dr, int *slot) m = meta->mt_m; if (bwn_dma_newbuf(dr, desc, meta, 0)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } rxhdr = mtod(m, struct bwn_rxhdr4 *); len = le16toh(rxhdr->frame_len); if (len <= 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } if (bwn_dma_check_redzone(dr, m)) { @@ -9366,7 +9366,7 @@ bwn_rxeof(struct bwn_mac *mac, struct mbuf *m, const void *_rxhdr) rssi = rxhdr->phy.abg.rssi; /* XXX incorrect RSSI calculation? */ noise = mac->mac_stats.link_noise; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); BWN_UNLOCK(sc); @@ -9441,7 +9441,7 @@ bwn_dma_handle_txeof(struct bwn_mac *mac, dr->dr_usedslot--; if (meta->mt_islast) { - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); break; } slot = bwn_dma_nextslot(dr, slot); @@ -9487,7 +9487,7 @@ bwn_pio_handle_txeof(struct bwn_mac *mac, tp->tp_m = NULL; TAILQ_INSERT_TAIL(&tq->tq_pktlist, tp, tp_list); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); sc->sc_watchdog_timer = 0; if (tq->tq_stop) { diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c index 9837e7e..84b947d 100644 --- a/sys/dev/cadence/if_cgem.c +++ b/sys/dev/cadence/if_cgem.c @@ -558,7 +558,7 @@ cgem_recv(struct cgem_softc *sc) (CGEM_RXDESC_SOF | CGEM_RXDESC_EOF)) { /* discard. */ m_free(m); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); continue; } @@ -604,7 +604,7 @@ cgem_recv(struct cgem_softc *sc) m = m_hd; m_hd = m_hd->m_next; m->m_next = NULL; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); (*ifp->if_input)(ifp, m); } CGEM_LOCK(sc); @@ -646,9 +646,9 @@ cgem_clean_tx(struct cgem_softc *sc) sc->txring[sc->txring_tl_ptr].addr); } else if ((ctl & (CGEM_TXDESC_RETRY_ERR | CGEM_TXDESC_LATE_COLL)) != 0) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); } else - sc->ifp->if_opackets++; + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); /* If the packet spanned more than one tx descriptor, * skip descriptors until we find the end so that only @@ -821,16 +821,16 @@ cgem_poll_hw_stats(struct cgem_softc *sc) n = RD4(sc, CGEM_SINGLE_COLL_FRAMES); sc->stats.tx_single_collisn += n; - sc->ifp->if_collisions += n; + if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, n); n = RD4(sc, CGEM_MULTI_COLL_FRAMES); sc->stats.tx_multi_collisn += n; - sc->ifp->if_collisions += n; + if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, n); n = RD4(sc, CGEM_EXCESSIVE_COLL_FRAMES); sc->stats.tx_excsv_collisn += n; - sc->ifp->if_collisions += n; + if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, n); n = RD4(sc, CGEM_LATE_COLL); sc->stats.tx_late_collisn += n; - sc->ifp->if_collisions += n; + if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, n); sc->stats.tx_deferred_frames += RD4(sc, CGEM_DEFERRED_TX_FRAMES); sc->stats.tx_carrier_sense_errs += RD4(sc, CGEM_CARRIER_SENSE_ERRS); diff --git a/sys/dev/ce/if_ce.c b/sys/dev/ce/if_ce.c index 6d77a1c..6c5b7bb 100644 --- a/sys/dev/ce/if_ce.c +++ b/sys/dev/ce/if_ce.c @@ -1097,7 +1097,7 @@ static void ce_transmit (ce_chan_t *c, void *attachment, int len) d->timeout = 0; #ifndef NETGRAPH - ++d->ifp->if_opackets; + if_inc_counter(d->ifp, IFCOUNTER_OPACKETS, 1); #if __FreeBSD_version >= 600034 d->ifp->if_flags &= ~IFF_DRV_OACTIVE; #else @@ -1119,7 +1119,7 @@ static void ce_receive (ce_chan_t *c, unsigned char *data, int len) if (! m) { CE_DEBUG (d, ("no memory for packet\n")); #ifndef NETGRAPH - ++d->ifp->if_iqdrops; + if_inc_counter(d->ifp, IFCOUNTER_IQDROPS, 1); #endif return; } @@ -1129,7 +1129,7 @@ static void ce_receive (ce_chan_t *c, unsigned char *data, int len) m->m_pkthdr.rcvif = 0; IF_ENQUEUE(&d->rqueue, m); #else - ++d->ifp->if_ipackets; + if_inc_counter(d->ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = d->ifp; /* Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ @@ -1151,33 +1151,33 @@ static void ce_error (ce_chan_t *c, int data) case CE_FRAME: CE_DEBUG (d, ("frame error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CE_CRC: CE_DEBUG (d, ("crc error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CE_OVERRUN: CE_DEBUG (d, ("overrun error\n")); #ifndef NETGRAPH - ++d->ifp->if_collisions; - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_COLLISIONS, 1); + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CE_OVERFLOW: CE_DEBUG (d, ("overflow error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CE_UNDERRUN: CE_DEBUG (d, ("underrun error\n")); d->timeout = 0; #ifndef NETGRAPH - ++d->ifp->if_oerrors; + if_inc_counter(d->ifp, IFCOUNTER_OERRORS, 1); #if __FreeBSD_version >= 600034 d->ifp->if_flags &= ~IFF_DRV_OACTIVE; #else diff --git a/sys/dev/cm/smc90cx6.c b/sys/dev/cm/smc90cx6.c index e0e8e42..a1932ad 100644 --- a/sys/dev/cm/smc90cx6.c +++ b/sys/dev/cm/smc90cx6.c @@ -512,7 +512,7 @@ cm_srint_locked(vsc) * count it as input error (we dont have any other * detectable) */ - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto cleanup; } @@ -544,13 +544,13 @@ cm_srint_locked(vsc) /* Insist on getting a cluster */ if ((m->m_flags & M_EXT) == 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto cleanup; } } if (m == 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto cleanup; } @@ -572,7 +572,7 @@ cm_srint_locked(vsc) CM_LOCK(sc); m = NULL; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); cleanup: @@ -620,7 +620,7 @@ cm_tint_locked(sc, isr) */ if (isr & CM_TMA || sc->sc_broadcast[buffer]) - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); #ifdef CMRETRANSMIT else if (ifp->if_flags & IFF_LINK2 && sc->sc_timer > 0 && --sc->sc_retransmits[buffer] > 0) { @@ -630,7 +630,7 @@ cm_tint_locked(sc, isr) } #endif else - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* We know we can accept another buffer at this point. */ @@ -730,7 +730,7 @@ cmintr(arg) * PUTREG(CMCMD, CM_CONF(CONF_LONG)); */ PUTREG(CMCMD, CM_CLR(CLR_RECONFIG)); - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); /* * If less than 2 seconds per reconfig: diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c index 4c728fc..59f06a9 100644 --- a/sys/dev/cp/if_cp.c +++ b/sys/dev/cp/if_cp.c @@ -867,7 +867,7 @@ static void cp_transmit (cp_chan_t *c, void *attachment, int len) d->timeout = 0; #ifndef NETGRAPH - ++d->ifp->if_opackets; + if_inc_counter(d->ifp, IFCOUNTER_OPACKETS, 1); d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; #endif cp_start (d); @@ -888,7 +888,7 @@ static void cp_receive (cp_chan_t *c, unsigned char *data, int len) if (! m) { CP_DEBUG (d, ("no memory for packet\n")); #ifndef NETGRAPH - ++d->ifp->if_iqdrops; + if_inc_counter(d->ifp, IFCOUNTER_IQDROPS, 1); #endif return; } @@ -898,7 +898,7 @@ static void cp_receive (cp_chan_t *c, unsigned char *data, int len) m->m_pkthdr.rcvif = 0; NG_SEND_DATA_ONLY (error, d->hook, m); #else - ++d->ifp->if_ipackets; + if_inc_counter(d->ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = d->ifp; /* Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ @@ -915,33 +915,33 @@ static void cp_error (cp_chan_t *c, int data) case CP_FRAME: CP_DEBUG (d, ("frame error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CP_CRC: CP_DEBUG (d, ("crc error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CP_OVERRUN: CP_DEBUG (d, ("overrun error\n")); #ifndef NETGRAPH - ++d->ifp->if_collisions; - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_COLLISIONS, 1); + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CP_OVERFLOW: CP_DEBUG (d, ("overflow error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CP_UNDERRUN: CP_DEBUG (d, ("underrun error\n")); d->timeout = 0; #ifndef NETGRAPH - ++d->ifp->if_oerrors; + if_inc_counter(d->ifp, IFCOUNTER_OERRORS, 1); d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; #endif cp_start (d); diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c index 43ea974..5041f7e 100644 --- a/sys/dev/ctau/if_ct.c +++ b/sys/dev/ctau/if_ct.c @@ -1082,7 +1082,7 @@ static void ct_transmit (ct_chan_t *c, void *attachment, int len) return; d->timeout = 0; #ifndef NETGRAPH - ++d->ifp->if_opackets; + if_inc_counter(d->ifp, IFCOUNTER_OPACKETS, 1); d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; #endif ct_start (d); @@ -1106,7 +1106,7 @@ static void ct_receive (ct_chan_t *c, char *data, int len) if (! m) { CT_DEBUG (d, ("no memory for packet\n")); #ifndef NETGRAPH - ++d->ifp->if_iqdrops; + if_inc_counter(d->ifp, IFCOUNTER_IQDROPS, 1); #endif return; } @@ -1116,7 +1116,7 @@ static void ct_receive (ct_chan_t *c, char *data, int len) m->m_pkthdr.rcvif = 0; NG_SEND_DATA_ONLY (error, d->hook, m); #else - ++d->ifp->if_ipackets; + if_inc_counter(d->ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = d->ifp; /* Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ @@ -1139,33 +1139,33 @@ static void ct_error (ct_chan_t *c, int data) case CT_FRAME: CT_DEBUG (d, ("frame error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CT_CRC: CT_DEBUG (d, ("crc error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CT_OVERRUN: CT_DEBUG (d, ("overrun error\n")); #ifndef NETGRAPH - ++d->ifp->if_collisions; - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_COLLISIONS, 1); + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CT_OVERFLOW: CT_DEBUG (d, ("overflow error\n")); #ifndef NETGRAPH - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CT_UNDERRUN: CT_DEBUG (d, ("underrun error\n")); d->timeout = 0; #ifndef NETGRAPH - ++d->ifp->if_oerrors; + if_inc_counter(d->ifp, IFCOUNTER_OERRORS, 1); d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; #endif ct_start (d); diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c index 83cac32..5ec4b8e 100644 --- a/sys/dev/cx/if_cx.c +++ b/sys/dev/cx/if_cx.c @@ -1251,7 +1251,7 @@ static void cx_transmit (cx_chan_t *c, void *attachment, int len) } d->timeout = 0; #ifndef NETGRAPH - ++d->ifp->if_opackets; + if_inc_counter(d->ifp, IFCOUNTER_OPACKETS, 1); d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; #endif cx_start (d); @@ -1304,7 +1304,7 @@ static void cx_receive (cx_chan_t *c, char *data, int len) if (! m) { CX_DEBUG (d, ("no memory for packet\n")); #ifndef NETGRAPH - ++d->ifp->if_iqdrops; + if_inc_counter(d->ifp, IFCOUNTER_IQDROPS, 1); #endif return; } @@ -1314,7 +1314,7 @@ static void cx_receive (cx_chan_t *c, char *data, int len) m->m_pkthdr.rcvif = 0; NG_SEND_DATA_ONLY (error, d->hook, m); #else - ++d->ifp->if_ipackets; + if_inc_counter(d->ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = d->ifp; /* Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ @@ -1357,7 +1357,7 @@ static void cx_error (cx_chan_t *c, int data) } #ifndef NETGRAPH else - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CX_CRC: @@ -1374,7 +1374,7 @@ static void cx_error (cx_chan_t *c, int data) } #ifndef NETGRAPH else - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CX_OVERRUN: @@ -1391,8 +1391,8 @@ static void cx_error (cx_chan_t *c, int data) #endif #ifndef NETGRAPH else { - ++d->ifp->if_collisions; - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_COLLISIONS, 1); + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); } #endif break; @@ -1400,7 +1400,7 @@ static void cx_error (cx_chan_t *c, int data) CX_DEBUG (d, ("overflow error\n")); #ifndef NETGRAPH if (c->mode != M_ASYNC) - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; case CX_UNDERRUN: @@ -1408,7 +1408,7 @@ static void cx_error (cx_chan_t *c, int data) if (c->mode != M_ASYNC) { d->timeout = 0; #ifndef NETGRAPH - ++d->ifp->if_oerrors; + if_inc_counter(d->ifp, IFCOUNTER_OERRORS, 1); d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; #endif cx_start (d); @@ -1427,7 +1427,7 @@ static void cx_error (cx_chan_t *c, int data) } #ifndef NETGRAPH else - ++d->ifp->if_ierrors; + if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); #endif break; default: diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index e3ce9da..9458a44 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -2915,9 +2915,9 @@ dc_rxeof(struct dc_softc *sc) (rxstat & (DC_RXSTAT_CRCERR | DC_RXSTAT_DRIBBLE | DC_RXSTAT_MIIERE | DC_RXSTAT_COLLSEEN | DC_RXSTAT_RUNT | DC_RXSTAT_DE))) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); if (rxstat & DC_RXSTAT_COLLSEEN) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); dc_discard_rxbuf(sc, i); if (rxstat & DC_RXSTAT_CRCERR) continue; @@ -2943,7 +2943,7 @@ dc_rxeof(struct dc_softc *sc) */ if (dc_newbuf(sc, i) != 0) { dc_discard_rxbuf(sc, i); - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); continue; } m->m_pkthdr.rcvif = ifp; @@ -2956,14 +2956,14 @@ dc_rxeof(struct dc_softc *sc) ETHER_ALIGN, ifp, NULL); dc_discard_rxbuf(sc, i); if (m0 == NULL) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); continue; } m = m0; } #endif - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); DC_UNLOCK(sc); (*ifp->if_input)(ifp, m); DC_LOCK(sc); @@ -3054,19 +3054,19 @@ dc_txeof(struct dc_softc *sc) } if (txstat & DC_TXSTAT_ERRSUM) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (txstat & DC_TXSTAT_EXCESSCOLL) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); if (txstat & DC_TXSTAT_LATECOLL) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); if (!(txstat & DC_TXSTAT_UNDERRUN)) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; dc_init_locked(sc); return; } } else - ifp->if_opackets++; - ifp->if_collisions += (txstat & DC_TXSTAT_COLLCNT) >> 3; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, (txstat & DC_TXSTAT_COLLCNT) >> 3); bus_dmamap_sync(sc->dc_tx_mtag, sc->dc_cdata.dc_tx_map[idx], BUS_DMASYNC_POSTWRITE); @@ -3261,7 +3261,7 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) if (status & (DC_ISR_RX_WATDOGTIMEO | DC_ISR_RX_NOBUF)) { uint32_t r = CSR_READ_4(sc, DC_FRAMESDISCARDED); - ifp->if_ierrors += (r & 0xffff) + ((r >> 17) & 0x7ff); + if_inc_counter(ifp, IFCOUNTER_IERRORS, (r & 0xffff) + ((r >> 17) & 0x7ff)); if (dc_rx_resync(sc)) dc_rxeof(sc); @@ -3343,7 +3343,7 @@ dc_intr(void *arg) if ((status & DC_ISR_RX_WATDOGTIMEO) || (status & DC_ISR_RX_NOBUF)) { r = CSR_READ_4(sc, DC_FRAMESDISCARDED); - ifp->if_ierrors += (r & 0xffff) + ((r >> 17) & 0x7ff); + if_inc_counter(ifp, IFCOUNTER_IERRORS, (r & 0xffff) + ((r >> 17) & 0x7ff)); if (dc_rxeof(sc) == 0) { while (dc_rx_resync(sc)) dc_rxeof(sc); @@ -3941,7 +3941,7 @@ dc_watchdog(void *xsc) } ifp = sc->dc_ifp; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); device_printf(sc->dc_dev, "watchdog timeout\n"); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index 147b404..6700fab 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -3439,7 +3439,7 @@ tulip_rx_intr(tulip_softc_t * const sc) } else { CTR1(KTR_TULIP, "tulip_rx_intr: bad packet; status %08x", DESC_STATUS(eop)); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); if (DESC_STATUS(eop) & (TULIP_DSTS_RxBADLENGTH|TULIP_DSTS_RxOVERFLOW|TULIP_DSTS_RxWATCHDOG)) { sc->tulip_dot3stats.dot3StatsInternalMacReceiveErrors++; } else { @@ -3479,7 +3479,7 @@ tulip_rx_intr(tulip_softc_t * const sc) #if defined(TULIP_DEBUG) cnt++; #endif - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); if (++eop == ri->ri_last) eop = ri->ri_first; ri->ri_nextin = eop; @@ -3501,7 +3501,7 @@ tulip_rx_intr(tulip_softc_t * const sc) */ m0 = m_devget(mtod(ms, caddr_t), total_len, ETHER_ALIGN, ifp, NULL); if (m0 == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip_input; } #else @@ -3675,7 +3675,7 @@ tulip_tx_intr(tulip_softc_t * const sc) if (d_status & TULIP_DSTS_ERRSUM) { CTR1(KTR_TULIP, "tulip_tx_intr: output error: %08x", d_status); - sc->tulip_ifp->if_oerrors++; + if_inc_counter(sc->tulip_ifp, IFCOUNTER_OERRORS, 1); if (d_status & TULIP_DSTS_TxEXCCOLL) sc->tulip_dot3stats.dot3StatsExcessiveCollisions++; if (d_status & TULIP_DSTS_TxLATECOLL) @@ -3696,7 +3696,7 @@ tulip_tx_intr(tulip_softc_t * const sc) CTR2(KTR_TULIP, "tulip_tx_intr: output ok, collisions %d, status %08x", collisions, d_status); - sc->tulip_ifp->if_collisions += collisions; + if_inc_counter(sc->tulip_ifp, IFCOUNTER_COLLISIONS, collisions); if (collisions == 1) sc->tulip_dot3stats.dot3StatsSingleCollisionFrames++; else if (collisions > 1) @@ -3730,7 +3730,7 @@ tulip_tx_intr(tulip_softc_t * const sc) sc->tulip_txtimer = 0; else if (xmits > 0) sc->tulip_txtimer = TULIP_TXTIMER; - sc->tulip_ifp->if_opackets += xmits; + if_inc_counter(sc->tulip_ifp, IFCOUNTER_OPACKETS, xmits); TULIP_PERFEND(txintr); return descs; } diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index eec8954..46524dd 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -485,7 +485,7 @@ ed_watchdog(struct ed_softc *sc) ifp = sc->ifp; log(LOG_ERR, "%s: device timeout\n", ifp->if_xname); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ed_reset(ifp); } @@ -900,7 +900,7 @@ ed_rint(struct ed_softc *sc) */ ed_get_packet(sc, packet_ptr + sizeof(struct ed_ring), len - sizeof(struct ed_ring)); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); } else { /* * Really BAD. The ring pointers are corrupted. @@ -908,7 +908,7 @@ ed_rint(struct ed_softc *sc) log(LOG_ERR, "%s: NIC memory corrupt - invalid packet length %d\n", ifp->if_xname, len); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); ed_reset(ifp); return; } @@ -1055,14 +1055,14 @@ edintr(void *arg) /* * update output errors counter */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } else { /* * Update total number of successfully * transmitted packets. */ - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } /* @@ -1080,7 +1080,7 @@ edintr(void *arg) * Add in total number of collisions on last * transmission. */ - ifp->if_collisions += collisions; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, collisions); switch(collisions) { case 0: case 16: @@ -1123,7 +1123,7 @@ edintr(void *arg) * fixed in later revs. -DG */ if (isr & ED_ISR_OVW) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); #ifdef DIAGNOSTIC log(LOG_WARNING, "%s: warning - receiver ring buffer overrun\n", @@ -1150,7 +1150,7 @@ edintr(void *arg) sc->mibdata.dot3StatsAlignmentErrors++; if (rsr & ED_RSR_FO) sc->mibdata.dot3StatsInternalMacReceiveErrors++; - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); #ifdef ED_DEBUG if_printf(ifp, "receive error %x\n", ed_nic_inb(sc, ED_P0_RSR)); diff --git a/sys/dev/en/midway.c b/sys/dev/en/midway.c index a2aed43..3175d61 100644 --- a/sys/dev/en/midway.c +++ b/sys/dev/en/midway.c @@ -774,7 +774,7 @@ en_txdma(struct en_softc *sc, struct en_txslot *slot) } EN_COUNT(sc->stats.launch); - sc->ifp->if_opackets++; + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); sc->vccs[tx.vci]->opackets++; sc->vccs[tx.vci]->obytes += tx.datalen; @@ -1851,7 +1851,7 @@ en_rx_drain(struct en_softc *sc, u_int drq) EN_DQ_LEN(drq), vc->rxhand)); m->m_pkthdr.rcvif = sc->ifp; - sc->ifp->if_ipackets++; + if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); vc->ipackets++; vc->ibytes += m->m_pkthdr.len; @@ -2249,13 +2249,13 @@ en_service(struct en_softc *sc) device_printf(sc->dev, "invalid AAL5 length\n"); rx.post_skip = MID_RBD_CNT(rbd) * MID_ATMDATASZ; mlen = 0; - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); } else if (rbd & MID_RBD_CRCERR) { device_printf(sc->dev, "CRC error\n"); rx.post_skip = MID_RBD_CNT(rbd) * MID_ATMDATASZ; mlen = 0; - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); } else { mlen = MID_PDU_LEN(pdu); diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c index e85ee5f..4072351 100644 --- a/sys/dev/ex/if_ex.c +++ b/sys/dev/ex/if_ex.c @@ -571,7 +571,7 @@ ex_start_locked(struct ifnet *ifp) BPF_MTAP(ifp, opkt); sc->tx_timeout = 2; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); m_freem(opkt); } else { ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -684,12 +684,12 @@ ex_tx_intr(struct ex_softc *sc) sc->tx_head = CSR_READ_2(sc, IO_PORT_REG); if (tx_status & TX_OK_bit) { - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } else { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } - ifp->if_collisions += tx_status & No_Collisions_bits; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, tx_status & No_Collisions_bits); } /* @@ -737,7 +737,7 @@ ex_rx_intr(struct ex_softc *sc) MGETHDR(m, M_NOWAIT, MT_DATA); ipkt = m; if (ipkt == NULL) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); } else { ipkt->m_pkthdr.rcvif = ifp; ipkt->m_pkthdr.len = pkt_len; @@ -750,7 +750,7 @@ ex_rx_intr(struct ex_softc *sc) m->m_len = MCLBYTES; } else { m_freem(ipkt); - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); goto rx_another; } } @@ -773,7 +773,7 @@ ex_rx_intr(struct ex_softc *sc) MGET(m->m_next, M_NOWAIT, MT_DATA); if (m->m_next == NULL) { m_freem(ipkt); - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); goto rx_another; } m = m->m_next; @@ -792,10 +792,10 @@ ex_rx_intr(struct ex_softc *sc) EX_UNLOCK(sc); (*ifp->if_input)(ifp, ipkt); EX_LOCK(sc); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); } } else { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } CSR_WRITE_2(sc, HOST_ADDR_REG, sc->rx_head); rx_another: ; @@ -983,7 +983,7 @@ ex_watchdog(void *arg) DODEBUG(Status, printf("OIDLE watchdog\n");); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ex_reset(sc); ex_start_locked(ifp); diff --git a/sys/dev/fatm/if_fatm.c b/sys/dev/fatm/if_fatm.c index b6b4e13d..b3281fe 100644 --- a/sys/dev/fatm/if_fatm.c +++ b/sys/dev/fatm/if_fatm.c @@ -1564,7 +1564,7 @@ fatm_intr_drain_rx(struct fatm_softc *sc) ATM_PH_SETVCI(&aph, vci); ifp = sc->ifp; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); vc->ipackets++; vc->ibytes += m0->m_pkthdr.len; @@ -1974,7 +1974,7 @@ fatm_tx(struct fatm_softc *sc, struct mbuf *m, struct card_vcc *vc, u_int mlen) error = bus_dmamap_load_mbuf(sc->tx_tag, q->map, m, fatm_tpd_load, tpd, BUS_DMA_NOWAIT); if(error) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); if_printf(sc->ifp, "mbuf loaded error=%d\n", error); m_freem(m); return (0); @@ -2025,7 +2025,7 @@ fatm_tx(struct fatm_softc *sc, struct mbuf *m, struct card_vcc *vc, u_int mlen) BARRIER_W(sc); sc->txcnt++; - sc->ifp->if_opackets++; + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); vc->obytes += m->m_pkthdr.len; vc->opackets++; diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index d6db477..f43fccb 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -434,7 +434,7 @@ fwe_output_callback(struct fw_xfer *xfer) /* XXX error check */ FWEDEBUG(ifp, "resp = %d\n", xfer->resp); if (xfer->resp != 0) - ifp->if_oerrors ++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); m_freem(xfer->mbuf); fw_xfer_unload(xfer); @@ -468,7 +468,7 @@ fwe_start(struct ifnet *ifp) IF_DEQUEUE(&ifp->if_snd, m); if (m != NULL) m_freem(m); - ifp->if_oerrors ++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } while (m != NULL); splx(s); @@ -534,11 +534,11 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) if (fw_asyreq(fwe->fd.fc, -1, xfer) != 0) { /* error */ - ifp->if_oerrors ++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* XXX set error code */ fwe_output_callback(xfer); } else { - ifp->if_opackets ++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); i++; } } @@ -583,7 +583,7 @@ fwe_as_input(struct fw_xferq *xferq) if (sxfer->resp != 0 || fp->mode.stream.len < ETHER_ALIGN + sizeof(struct ether_header)) { m_freem(m); - ifp->if_ierrors ++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); continue; } @@ -607,7 +607,7 @@ fwe_as_input(struct fw_xferq *xferq) ); #endif (*ifp->if_input)(ifp, m); - ifp->if_ipackets ++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); } if (STAILQ_FIRST(&xferq->stfree) != NULL) fwe->fd.fc->irx_enable(fwe->fd.fc, fwe->dma_ch); diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c index 8928ee4..b88bf77 100644 --- a/sys/dev/firewire/if_fwip.c +++ b/sys/dev/firewire/if_fwip.c @@ -484,7 +484,7 @@ fwip_output_callback(struct fw_xfer *xfer) /* XXX error check */ FWIPDEBUG(ifp, "resp = %d\n", xfer->resp); if (xfer->resp != 0) - ifp->if_oerrors ++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); m_freem(xfer->mbuf); fw_xfer_unload(xfer); @@ -519,7 +519,7 @@ fwip_start(struct ifnet *ifp) IF_DEQUEUE(&ifp->if_snd, m); if (m != NULL) m_freem(m); - ifp->if_oerrors ++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } while (m != NULL); splx(s); @@ -646,7 +646,7 @@ fwip_async_output(struct fwip_softc *fwip, struct ifnet *ifp) fd = fw_noderesolve_eui64(fc, &eui); if (!fd) { /* error */ - ifp->if_oerrors ++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* XXX set error code */ fwip_output_callback(xfer); continue; @@ -687,12 +687,12 @@ fwip_async_output(struct fwip_softc *fwip, struct ifnet *ifp) } if (error) { /* error */ - ifp->if_oerrors ++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* XXX set error code */ fwip_output_callback(xfer); continue; } else { - ifp->if_opackets ++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); i++; } } @@ -754,7 +754,7 @@ fwip_stream_input(struct fw_xferq *xferq) if (sxfer->resp != 0 || fp->mode.stream.len < 2*sizeof(uint32_t)) { m_freem(m); - ifp->if_ierrors ++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); continue; } m->m_len = m->m_pkthdr.len = fp->mode.stream.len @@ -780,7 +780,7 @@ fwip_stream_input(struct fw_xferq *xferq) FWIPDEBUG(ifp, "Unrecognised GASP header %#08x %#08x\n", ntohl(p[1]), ntohl(p[2])); m_freem(m); - ifp->if_ierrors ++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); continue; } @@ -815,7 +815,7 @@ fwip_stream_input(struct fw_xferq *xferq) m_adj(m, 3*sizeof(uint32_t)); m->m_pkthdr.rcvif = ifp; firewire_input(ifp, m, src); - ifp->if_ipackets ++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); } if (STAILQ_FIRST(&xferq->stfree) != NULL) fwip->fd.fc->irx_enable(fwip->fd.fc, fwip->dma_ch); @@ -881,7 +881,7 @@ fwip_unicast_input(struct fw_xfer *xfer) */ if (rtcode != FWRCODE_COMPLETE) { m_freem(m); - ifp->if_ierrors ++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -916,7 +916,7 @@ fwip_unicast_input(struct fw_xfer *xfer) m->m_len = m->m_pkthdr.len = fp->mode.wreqb.len; m->m_pkthdr.rcvif = ifp; firewire_input(ifp, m, fp->mode.wreqb.src); - ifp->if_ipackets ++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); } static devclass_t fwip_devclass; diff --git a/sys/dev/gxemul/ether/if_gx.c b/sys/dev/gxemul/ether/if_gx.c index 63483f8..886fb59 100644 --- a/sys/dev/gxemul/ether/if_gx.c +++ b/sys/dev/gxemul/ether/if_gx.c @@ -248,8 +248,8 @@ gx_transmit(struct ifnet *ifp, struct mbuf *m) ETHER_BPF_MTAP(ifp, m); - ifp->if_opackets++; - ifp->if_obytes += m->m_pkthdr.len; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); m_freem(m); @@ -366,14 +366,14 @@ gx_rx_intr(void *arg) break; length = GXEMUL_ETHER_DEV_READ(GXEMUL_ETHER_DEV_LENGTH); if (length > MCLBYTES - ETHER_ALIGN) { - sc->sc_ifp->if_ierrors++; + if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); continue; } m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { device_printf(sc->sc_dev, "no memory for receive mbuf.\n"); - sc->sc_ifp->if_iqdrops++; + if_inc_counter(sc->sc_ifp, IFCOUNTER_IQDROPS, 1); GXEMUL_ETHER_UNLOCK(sc); return; } @@ -386,7 +386,7 @@ gx_rx_intr(void *arg) m->m_pkthdr.rcvif = sc->sc_ifp; m->m_pkthdr.len = m->m_len = length; - sc->sc_ifp->if_ipackets++; + if_inc_counter(sc->sc_ifp, IFCOUNTER_IPACKETS, 1); GXEMUL_ETHER_UNLOCK(sc); diff --git a/sys/dev/hatm/if_hatm_rx.c b/sys/dev/hatm/if_hatm_rx.c index bf17294..af0b925 100644 --- a/sys/dev/hatm/if_hatm_rx.c +++ b/sys/dev/hatm/if_hatm_rx.c @@ -149,7 +149,7 @@ hatm_rx(struct hatm_softc *sc, u_int cid, u_int flags, struct mbuf *m0, m_freem(vcc->chain); vcc->chain = vcc->last = NULL; sc->istats.crc_error++; - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); return; } if (flags & HE_REGM_RBRQ_LEN_ERROR) { @@ -157,7 +157,7 @@ hatm_rx(struct hatm_softc *sc, u_int cid, u_int flags, struct mbuf *m0, m_freem(vcc->chain); vcc->chain = vcc->last = NULL; sc->istats.len_error++; - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); return; } @@ -240,9 +240,9 @@ hatm_rx(struct hatm_softc *sc, u_int cid, u_int flags, struct mbuf *m0, ATM_PH_VPI(&aph) = vpi; ATM_PH_SETVCI(&aph, vci); - sc->ifp->if_ipackets++; + if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); /* this is in if_atmsubr.c */ - /* sc->ifp->if_ibytes += len; */ + /* if_inc_counter(sc->ifp, IFCOUNTER_IBYTES, len); */ vcc->ibytes += len; vcc->ipackets++; diff --git a/sys/dev/hatm/if_hatm_tx.c b/sys/dev/hatm/if_hatm_tx.c index 8e03e9d..d0a28ba 100644 --- a/sys/dev/hatm/if_hatm_tx.c +++ b/sys/dev/hatm/if_hatm_tx.c @@ -452,7 +452,7 @@ hatm_start(struct ifnet *ifp) if ((tpd = hatm_alloc_tpd(sc, M_NOWAIT)) == NULL) { hatm_free_txmbuf(sc); m_freem(m); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } tpd->cid = cid; @@ -472,7 +472,7 @@ hatm_start(struct ifnet *ifp) tpd->mbuf = NULL; hatm_free_txmbuf(sc); hatm_free_tpd(sc, tpd); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } arg.mbuf = m; @@ -484,17 +484,17 @@ hatm_start(struct ifnet *ifp) if_printf(sc->ifp, "mbuf loaded error=%d\n", error); hatm_free_tpd(sc, tpd); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } if (arg.error) { hatm_free_tpd(sc, tpd); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } arg.vcc->opackets++; arg.vcc->obytes += len; - sc->ifp->if_opackets++; + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); } mtx_unlock(&sc->mtx); } diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index 3b60c3f..41d869f 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -500,7 +500,7 @@ retry_send: ret = hv_rf_on_send(device_ctx, packet); if (ret == 0) { - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* if bpf && mc_head, call bpf_mtap code */ if (mc_head) { ETHER_BPF_MTAP(ifp, mc_head); @@ -702,7 +702,7 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet) * messages (not just data messages) will trigger a response. */ - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); /* We're not holding the lock here, so don't release it */ (*ifp->if_input)(ifp, m_new); @@ -988,7 +988,7 @@ hn_watchdog(struct ifnet *ifp) printf("hn%d: watchdog timeout -- resetting\n", sc->hn_unit); hn_ifinit(sc); /*???*/ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } #endif diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index f9ed3d0..8f23527 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -1431,7 +1431,7 @@ ndis_rxeof(adapter, packets, pktcnt) p->np_refcnt++; m_freem(m0); if (m == NULL) - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); else m0 = m; } else @@ -1444,7 +1444,7 @@ ndis_rxeof(adapter, packets, pktcnt) p->np_oob.npo_status = NDIS_STATUS_PENDING; m_freem(m0); if (m == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); continue; } m0 = m; @@ -1554,9 +1554,9 @@ ndis_txeof(adapter, packet, status) sc->ndis_txpending++; if (status == NDIS_STATUS_SUCCESS) - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); else - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); sc->ndis_tx_timer = 0; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1659,7 +1659,7 @@ ndis_tick(xsc) } if (sc->ndis_tx_timer && --sc->ndis_tx_timer == 0) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); device_printf(sc->ndis_dev, "watchdog timeout\n"); IoQueueWorkItem(sc->ndis_resetitem, diff --git a/sys/dev/iicbus/if_ic.c b/sys/dev/iicbus/if_ic.c index 644a12c..7a4e2b1 100644 --- a/sys/dev/iicbus/if_ic.c +++ b/sys/dev/iicbus/if_ic.c @@ -302,8 +302,8 @@ icintr(device_t dev, int event, char *ptr) if (len <= ICHDRLEN) goto err; len -= ICHDRLEN; - sc->ic_ifp->if_ipackets++; - sc->ic_ifp->if_ibytes += len; + if_inc_counter(sc->ic_ifp, IFCOUNTER_IPACKETS, 1); + if_inc_counter(sc->ic_ifp, IFCOUNTER_IBYTES, len); BPF_TAP(sc->ic_ifp, sc->ic_ifbuf, len + ICHDRLEN); top = m_devget(sc->ic_ifbuf + ICHDRLEN, len, 0, sc->ic_ifp, 0); if (top) { @@ -316,7 +316,7 @@ icintr(device_t dev, int event, char *ptr) err: if_printf(sc->ic_ifp, "errors (%d)!\n", sc->ic_iferrs); sc->ic_iferrs = 0; /* reset error count */ - sc->ic_ifp->if_ierrors++; + if_inc_counter(sc->ic_ifp, IFCOUNTER_IERRORS, 1); break; case INTR_RECEIVE: @@ -373,7 +373,7 @@ icoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, /* already sending? */ if (sc->ic_flags & IC_SENDING) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); goto error; } @@ -386,7 +386,7 @@ icoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, do { if (len + mm->m_len > sc->ic_ifp->if_mtu) { /* packet too large */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); goto error; } @@ -407,10 +407,10 @@ icoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (iicbus_block_write(parent, sc->ic_addr, sc->ic_obuf, len + ICHDRLEN, &sent)) - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); else { - ifp->if_opackets++; - ifp->if_obytes += len; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + if_inc_counter(ifp, IFCOUNTER_OBYTES, len); } mtx_lock(&sc->ic_lock); diff --git a/sys/dev/ipw/if_ipw.c b/sys/dev/ipw/if_ipw.c index fe693eb..04c3363 100644 --- a/sys/dev/ipw/if_ipw.c +++ b/sys/dev/ipw/if_ipw.c @@ -1202,7 +1202,7 @@ ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status, */ mnew = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (mnew == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -1223,7 +1223,7 @@ ipw_rx_data_intr(struct ipw_softc *sc, struct ipw_status *status, panic("%s: could not load old rx mbuf", device_get_name(sc->sc_dev)); } - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -1378,7 +1378,7 @@ ipw_tx_intr(struct ipw_softc *sc) sbd = &sc->stbd_list[i]; if (sbd->type == IPW_SBD_TYPE_DATA) - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); ipw_release_sbd(sc, sbd); sc->txfree++; @@ -1768,7 +1768,7 @@ ipw_start_locked(struct ifnet *ifp) ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; if (ipw_tx_start(ifp, m, ni) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); break; } /* start watchdog timer */ @@ -1788,7 +1788,7 @@ ipw_watchdog(void *arg) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { if_printf(ifp, "device timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); taskqueue_enqueue(taskqueue_swi, &sc->sc_init_task); } } diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index 412d709..b6de4b6 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -1235,7 +1235,7 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, int i, */ mnew = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (mnew == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -1256,7 +1256,7 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, int i, panic("%s: could not load old rx mbuf", device_get_name(sc->sc_dev)); } - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -1651,7 +1651,7 @@ iwi_tx_intr(struct iwi_softc *sc, struct iwi_tx_ring *txq) DPRINTFN(15, ("tx done idx=%u\n", txq->next)); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); txq->queued--; txq->next = (txq->next + 1) % IWI_TX_RING_COUNT; @@ -1852,7 +1852,7 @@ iwi_tx_start(struct ifnet *ifp, struct mbuf *m0, struct ieee80211_node *ni, /* h/w table is full */ m_freem(m0); ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return 0; } iwi_write_ibssnode(sc, @@ -2007,7 +2007,7 @@ iwi_start_locked(struct ifnet *ifp) ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; if (iwi_tx_start(ifp, m, ni, ac) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); break; } @@ -2038,7 +2038,7 @@ iwi_watchdog(void *arg) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { if_printf(ifp, "device timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ieee80211_runtask(ic, &sc->sc_restarttask); } } diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index 6fc86bc..bf8c98d 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -2966,14 +2966,14 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, if ((flags & IWN_RX_NOERROR) != IWN_RX_NOERROR) { DPRINTF(sc, IWN_DEBUG_RECV, "%s: RX flags error %x\n", __func__, flags); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } /* Discard frames that are too short. */ if (len < sizeof (*wh)) { DPRINTF(sc, IWN_DEBUG_RECV, "%s: frame too short: %d\n", __func__, len); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -2981,7 +2981,7 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, if (m1 == NULL) { DPRINTF(sc, IWN_DEBUG_ANY, "%s: no mbuf to restock ring\n", __func__); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } bus_dmamap_unload(ring->data_dmat, data->map); @@ -3004,7 +3004,7 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, ring->desc[ring->cur] = htole32(paddr >> 8); bus_dmamap_sync(ring->data_dmat, ring->desc_dma.map, BUS_DMASYNC_PREWRITE); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -3162,12 +3162,12 @@ iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc, bitmap = (le64toh(ba->bitmap) >> shift) & wn->agg[tid].bitmap; for (i = 0; bitmap; i++) { if ((bitmap & 1) == 0) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); tx_err ++; ieee80211_ratectl_tx_complete(ni->ni_vap, ni, IEEE80211_RATECTL_TX_FAILURE, &ackfailcnt, NULL); } else { - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); tx_ok ++; ieee80211_ratectl_tx_complete(ni->ni_vap, ni, IEEE80211_RATECTL_TX_SUCCESS, &ackfailcnt, NULL); @@ -3509,11 +3509,11 @@ iwn_tx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc, int ackfailcnt, * Update rate control statistics for the node. */ if (status & IWN_TX_FAIL) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_FAILURE, &ackfailcnt, NULL); } else { - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_SUCCESS, &ackfailcnt, NULL); } @@ -4825,7 +4825,7 @@ iwn_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, if (error != 0) { /* NB: m is reclaimed on tx failure */ ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } sc->sc_tx_timer = 5; @@ -4872,7 +4872,7 @@ iwn_start_locked(struct ifnet *ifp) ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; if (iwn_tx_data(sc, m, ni) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } sc->sc_tx_timer = 5; diff --git a/sys/dev/le/am7990.c b/sys/dev/le/am7990.c index d74d3b8..a21be28 100644 --- a/sys/dev/le/am7990.c +++ b/sys/dev/le/am7990.c @@ -272,7 +272,7 @@ am7990_rint(struct lance_softc *sc) bix = 0; if (m != NULL) { - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); #ifdef LANCE_REVC_BUG /* @@ -296,7 +296,7 @@ am7990_rint(struct lance_softc *sc) (*ifp->if_input)(ifp, m); LE_LOCK(sc); } else - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } sc->sc_last_rd = bix; @@ -352,22 +352,22 @@ am7990_tint(struct lance_softc *sc) if_printf(ifp, "lost carrier\n"); } if (tmd.tmd3 & LE_T3_LCOL) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); if (tmd.tmd3 & LE_T3_RTRY) { #ifdef LEDEBUG if_printf(ifp, "excessive collisions, tdr %d\n", tmd.tmd3 & LE_T3_TDR_MASK); #endif - ifp->if_collisions += 16; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16); } - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } else { if (tmd.tmd1_bits & LE_T1_ONE) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); else if (tmd.tmd1_bits & LE_T1_MORE) /* Real number is unknown. */ - ifp->if_collisions += 2; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 2); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } if (++bix == sc->sc_ntbuf) @@ -394,7 +394,7 @@ am7990_intr(void *arg) LE_LOCK(sc); if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); lance_init_locked(sc); LE_UNLOCK(sc); return; @@ -426,19 +426,19 @@ am7990_intr(void *arg) #ifdef LEDEBUG if_printf(ifp, "babble\n"); #endif - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } #if 0 if (isr & LE_C0_CERR) { if_printf(ifp, "collision error\n"); - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); } #endif if (isr & LE_C0_MISS) { #ifdef LEDEBUG if_printf(ifp, "missed packet\n"); #endif - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } if (isr & LE_C0_MERR) { if_printf(ifp, "memory error\n"); @@ -450,14 +450,14 @@ am7990_intr(void *arg) if ((isr & LE_C0_RXON) == 0) { if_printf(ifp, "receiver disabled\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); lance_init_locked(sc); LE_UNLOCK(sc); return; } if ((isr & LE_C0_TXON) == 0) { if_printf(ifp, "transmitter disabled\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); lance_init_locked(sc); LE_UNLOCK(sc); return; diff --git a/sys/dev/le/am79900.c b/sys/dev/le/am79900.c index 08449e5..5ea8228 100644 --- a/sys/dev/le/am79900.c +++ b/sys/dev/le/am79900.c @@ -313,7 +313,7 @@ am79900_rint(struct lance_softc *sc) bix = 0; if (m != NULL) { - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); #if defined(__i386__) && !defined(PC98) /* @@ -333,7 +333,7 @@ am79900_rint(struct lance_softc *sc) (*ifp->if_input)(ifp, m); LE_LOCK(sc); } else - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } sc->sc_last_rd = bix; @@ -391,21 +391,21 @@ am79900_tint(struct lance_softc *sc) if_printf(ifp, "lost carrier\n"); } if (tmd2 & LE_T2_LCOL) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); if (tmd2 & LE_T2_RTRY) { #ifdef LEDEBUG if_printf(ifp, "excessive collisions\n"); #endif - ifp->if_collisions += 16; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16); } - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } else { if (tmd1 & LE_T1_ONE) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); else if (tmd1 & LE_T1_MORE) /* Real number is unknown. */ - ifp->if_collisions += 2; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 2); + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } if (++bix == sc->sc_ntbuf) @@ -432,7 +432,7 @@ am79900_intr(void *arg) LE_LOCK(sc); if (sc->sc_hwintr && (*sc->sc_hwintr)(sc) == -1) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); lance_init_locked(sc); LE_UNLOCK(sc); return; @@ -464,19 +464,19 @@ am79900_intr(void *arg) #ifdef LEDEBUG if_printf(ifp, "babble\n"); #endif - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } #if 0 if (isr & LE_C0_CERR) { if_printf(ifp, "collision error\n"); - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); } #endif if (isr & LE_C0_MISS) { #ifdef LEDEBUG if_printf(ifp, "missed packet\n"); #endif - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } if (isr & LE_C0_MERR) { if_printf(ifp, "memory error\n"); @@ -488,14 +488,14 @@ am79900_intr(void *arg) if ((isr & LE_C0_RXON) == 0) { if_printf(ifp, "receiver disabled\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); lance_init_locked(sc); LE_UNLOCK(sc); return; } if ((isr & LE_C0_TXON) == 0) { if_printf(ifp, "transmitter disabled\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); lance_init_locked(sc); LE_UNLOCK(sc); return; diff --git a/sys/dev/le/lance.c b/sys/dev/le/lance.c index 2a2b0e0..38be317 100644 --- a/sys/dev/le/lance.c +++ b/sys/dev/le/lance.c @@ -446,7 +446,7 @@ lance_watchdog(void *xsc) } if_printf(ifp, "device timeout\n"); - ++ifp->if_oerrors; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); lance_init_locked(sc); } diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c index 94f326f..9aef131 100644 --- a/sys/dev/lge/if_lge.c +++ b/sys/dev/lge/if_lge.c @@ -916,7 +916,7 @@ lge_rxeof(sc, cnt) * comes up in the ring. */ if (rxctl & LGE_RXCTL_ERRMASK) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); lge_newbuf(sc, &LGE_RXTAIL(sc), m); continue; } @@ -928,7 +928,7 @@ lge_rxeof(sc, cnt) if (m0 == NULL) { device_printf(sc->lge_dev, "no receive buffers " "available -- packet dropped!\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); continue; } m = m0; @@ -937,7 +937,7 @@ lge_rxeof(sc, cnt) m->m_pkthdr.len = m->m_len = total_len; } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); /* Do IP checksum checking. */ if (rxsts & LGE_RXSTS_ISIP) @@ -1003,7 +1003,7 @@ lge_txeof(sc) while (idx != sc->lge_cdata.lge_tx_prod && txdone) { cur_tx = &sc->lge_ldata->lge_tx_list[idx]; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if (cur_tx->lge_mbuf != NULL) { m_freem(cur_tx->lge_mbuf); cur_tx->lge_mbuf = NULL; @@ -1036,9 +1036,9 @@ lge_tick(xsc) LGE_LOCK_ASSERT(sc); CSR_WRITE_4(sc, LGE_STATSIDX, LGE_STATS_SINGLE_COLL_PKTS); - ifp->if_collisions += CSR_READ_4(sc, LGE_STATSVAL); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, CSR_READ_4(sc, LGE_STATSVAL)); CSR_WRITE_4(sc, LGE_STATSIDX, LGE_STATS_MULTI_COLL_PKTS); - ifp->if_collisions += CSR_READ_4(sc, LGE_STATSVAL); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, CSR_READ_4(sc, LGE_STATSVAL)); if (!sc->lge_link) { mii = device_get_softc(sc->lge_miibus); @@ -1504,7 +1504,7 @@ lge_watchdog(sc) LGE_LOCK_ASSERT(sc); ifp = sc->lge_ifp; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if_printf(ifp, "watchdog timeout\n"); lge_stop(sc); diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c index 1e879ba..b7e90e9 100644 --- a/sys/dev/malo/if_malo.c +++ b/sys/dev/malo/if_malo.c @@ -1245,7 +1245,7 @@ malo_tx_start(struct malo_softc *sc, struct ieee80211_node *ni, STAILQ_INSERT_TAIL(&txq->active, bf, bf_list); MALO_TXDESC_SYNC(txq, ds, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); sc->malo_timer = 5; MALO_TXQ_UNLOCK(txq); return 0; @@ -1283,7 +1283,7 @@ malo_start(struct ifnet *ifp) * Pass the frame to the h/w for transmission. */ if (malo_tx_start(sc, ni, bf, m)) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (bf != NULL) { bf->bf_m = NULL; bf->bf_node = NULL; @@ -1341,7 +1341,7 @@ malo_watchdog(void *arg) /* XXX no way to reset h/w. now */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); sc->malo_stats.mst_watchdog++; } } @@ -1870,7 +1870,7 @@ malo_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, * Pass the frame to the h/w for transmission. */ if (malo_tx_start(sc, ni, bf, m) != 0) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); bf->bf_m = NULL; bf->bf_node = NULL; MALO_TXQ_LOCK(txq); @@ -2078,7 +2078,7 @@ malo_rx_proc(void *arg, int npending) #endif status = ds->status; if (status & MALO_RXD_STATUS_DECRYPT_ERR_MASK) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto rx_next; } /* @@ -2117,7 +2117,7 @@ malo_rx_proc(void *arg, int npending) /* XXX don't need mbuf, just dma buffer */ mnew = malo_getrxmbuf(sc, bf); if (mnew == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto rx_next; } /* @@ -2158,7 +2158,7 @@ malo_rx_proc(void *arg, int npending) len, ds->rate, rssi); } #endif - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); /* dispatch */ ni = ieee80211_find_rxnode(ic, diff --git a/sys/dev/mge/if_mge.c b/sys/dev/mge/if_mge.c index d479aa2..c35dd04 100644 --- a/sys/dev/mge/if_mge.c +++ b/sys/dev/mge/if_mge.c @@ -1161,7 +1161,7 @@ mge_intr_rx_locked(struct mge_softc *sc, int count) count -= 1; } - ifp->if_ipackets += rx_npkts; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, rx_npkts); return (rx_npkts); } @@ -1236,9 +1236,9 @@ mge_intr_tx_locked(struct mge_softc *sc) /* Update collision statistics */ if (status & MGE_ERR_SUMMARY) { if ((status & MGE_ERR_MASK) == MGE_TX_ERROR_LC) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); if ((status & MGE_ERR_MASK) == MGE_TX_ERROR_RL) - ifp->if_collisions += 16; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16); } bus_dmamap_sync(sc->mge_tx_dtag, dw->buffer_dmap, @@ -1248,7 +1248,7 @@ mge_intr_tx_locked(struct mge_softc *sc) dw->buffer = (struct mbuf*)NULL; send++; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } if (send) { @@ -1516,7 +1516,7 @@ mge_watchdog(struct mge_softc *sc) return; } - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if_printf(ifp, "watchdog timeout\n"); mge_stop(sc); diff --git a/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c b/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c index e8e8777..2f864ab 100644 --- a/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c +++ b/sys/dev/netfpga10g/nf10bmac/if_nf10bmac.c @@ -414,7 +414,7 @@ nf10bmac_rx_locked(struct nf10bmac_softc *sc) * packet on the floor and count the error. */ nf10bmac_eat_packet_munch_munch(sc); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); m_freem(m); return (0); } else if ((len - l) <= sizeof(val)) { @@ -445,14 +445,14 @@ nf10bmac_rx_locked(struct nf10bmac_softc *sc) if ((md & NF10BMAC_DATA_LAST) == 0 || (md & NF10BMAC_DATA_STRB) == 0) { device_printf(sc->nf10bmac_dev, "Unexpected rx loop end state: " "md=0x%08jx len=%d l=%d\n", (uintmax_t)md, len, l); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); m_freem(m); return (0); } m->m_pkthdr.len = m->m_len = len; m->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); NF10BMAC_UNLOCK(sc); (*ifp->if_input)(ifp, m); @@ -584,7 +584,7 @@ nf10bmac_watchdog(struct nf10bmac_softc *sc) return; device_printf(sc->nf10bmac_dev, "watchdog timeout\n"); - sc->nf10bmac_ifp->if_oerrors++; + sc->nf10if_inc_counter(bmac_ifp, IFCOUNTER_OERRORS, 1); sc->nf10bmac_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; nf10bmac_init_locked(sc); diff --git a/sys/dev/netmap/if_lem_netmap.h b/sys/dev/netmap/if_lem_netmap.h index 272f02c..50eb1f7 100644 --- a/sys/dev/netmap/if_lem_netmap.h +++ b/sys/dev/netmap/if_lem_netmap.h @@ -410,7 +410,7 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flags) netmap_idx_n2k(kring, adapter->next_rx_desc_to_check), kring->nr_hwtail); adapter->next_rx_desc_to_check = nic_i; - // ifp->if_ipackets += n; + // if_inc_counter(ifp, IFCOUNTER_IPACKETS, n); kring->nr_hwtail = nm_i; } kring->nr_kflags &= ~NKR_PENDINTR; diff --git a/sys/dev/netmap/if_re_netmap.h b/sys/dev/netmap/if_re_netmap.h index 98f6143..354f14d 100644 --- a/sys/dev/netmap/if_re_netmap.h +++ b/sys/dev/netmap/if_re_netmap.h @@ -222,7 +222,7 @@ re_netmap_rxsync(struct netmap_kring *kring, int flags) /* sync was in re_newbuf() */ bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, rxd[nic_i].rx_dmamap, BUS_DMASYNC_POSTREAD); - // sc->rl_ifp->if_ipackets++; + // if_inc_counter(sc->rl_ifp, IFCOUNTER_IPACKETS, 1); nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); } diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index af57491..3348efc 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -989,7 +989,7 @@ retry: pd->nsegs++; } - sc->ifp->if_opackets++; + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); wq->tx_stats.tx_reqs++; wq->tx_stats.tx_wrbs += num_wqes; wq->tx_stats.tx_bytes += m->m_pkthdr.len; @@ -1275,9 +1275,9 @@ oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq) break; } drbr_advance(ifp, br); - ifp->if_obytes += next->m_pkthdr.len; + if_inc_counter(ifp, IFCOUNTER_OBYTES, next->m_pkthdr.len); if (next->m_flags & M_MCAST) - ifp->if_omcasts++; + if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); ETHER_BPF_MTAP(ifp, next); } @@ -1394,7 +1394,7 @@ oce_rx(struct oce_rq *rq, uint32_t rqe_idx, struct oce_nic_rx_cqe *cqe) } } - sc->ifp->if_ipackets++; + if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); #if defined(INET6) || defined(INET) /* Try to queue to LRO */ if (IF_LRO_ENABLED(sc) && @@ -1637,7 +1637,7 @@ oce_rq_handler(void *arg) oce_rx(rq, cqe->u0.s.frag_index, cqe); } else { rq->rx_stats.rxcp_err++; - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); /* Post L3/L4 errors to stack.*/ oce_rx(rq, cqe->u0.s.frag_index, cqe); } diff --git a/sys/dev/patm/if_patm_rx.c b/sys/dev/patm/if_patm_rx.c index 06a58c3..3df4d6a 100644 --- a/sys/dev/patm/if_patm_rx.c +++ b/sys/dev/patm/if_patm_rx.c @@ -254,7 +254,7 @@ patm_rx(struct patm_softc *sc, struct idt_rsqe *rsqe) } else if (vcc->vcc.aal == ATMIO_AAL_5) { if (stat & IDT_RSQE_CRC) { - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); if (vcc->chain != NULL) { m_freem(vcc->chain); vcc->chain = vcc->last = NULL; @@ -312,9 +312,9 @@ patm_rx(struct patm_softc *sc, struct idt_rsqe *rsqe) } #endif - sc->ifp->if_ipackets++; + if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); /* this is in if_atmsubr.c */ - /* sc->ifp->if_ibytes += m->m_pkthdr.len; */ + /* if_inc_counter(sc->ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); */ vcc->ibytes += m->m_pkthdr.len; vcc->ipackets++; @@ -511,9 +511,9 @@ patm_rx_raw(struct patm_softc *sc, u_char *cell) break; } - sc->ifp->if_ipackets++; + if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); /* this is in if_atmsubr.c */ - /* sc->ifp->if_ibytes += m->m_pkthdr.len; */ + /* if_inc_counter(sc->ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len); */ vcc->ibytes += m->m_pkthdr.len; vcc->ipackets++; diff --git a/sys/dev/patm/if_patm_tx.c b/sys/dev/patm/if_patm_tx.c index 1b43844..d38d078 100644 --- a/sys/dev/patm/if_patm_tx.c +++ b/sys/dev/patm/if_patm_tx.c @@ -304,7 +304,7 @@ patm_start(struct ifnet *ifp) /* split of pseudo header */ if (m->m_len < sizeof(*aph) && (m = m_pullup(m, sizeof(*aph))) == NULL) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } @@ -316,21 +316,21 @@ patm_start(struct ifnet *ifp) /* reject empty packets */ if (m->m_pkthdr.len == 0) { m_freem(m); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } /* check whether this is a legal vcc */ if (!LEGAL_VPI(sc, vpi) || !LEGAL_VCI(sc, vci) || vci == 0) { m_freem(m); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } cid = PATM_CID(sc, vpi, vci); vcc = sc->vccs[cid]; if (vcc == NULL) { m_freem(m); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } @@ -340,7 +340,7 @@ patm_start(struct ifnet *ifp) /* XXX AAL3/4 format? */ if (m->m_pkthdr.len % 48 != 0 && (m = patm_tx_pad(sc, m)) == NULL) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } } else if (vcc->vcc.aal == ATMIO_AAL_RAW) { @@ -349,7 +349,7 @@ patm_start(struct ifnet *ifp) default: case PATM_RAW_CELL: if (m->m_pkthdr.len != 53) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); m_freem(m); continue; } @@ -357,7 +357,7 @@ patm_start(struct ifnet *ifp) case PATM_RAW_NOHEC: if (m->m_pkthdr.len != 52) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); m_freem(m); continue; } @@ -365,7 +365,7 @@ patm_start(struct ifnet *ifp) case PATM_RAW_CS: if (m->m_pkthdr.len != 64) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); m_freem(m); continue; } @@ -378,7 +378,7 @@ patm_start(struct ifnet *ifp) /* try to put it on the channels queue */ if (_IF_QFULL(&vcc->scd->q)) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); sc->stats.tx_qfull++; m_freem(m); continue; @@ -416,7 +416,7 @@ patm_tx_pad(struct patm_softc *sc, struct mbuf *m0) m0->m_pkthdr.len = plen; if (plen == 0) { m_freem(m0); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); return (NULL); } if (plen % 48 == 0) @@ -442,7 +442,7 @@ patm_tx_pad(struct patm_softc *sc, struct mbuf *m0) MGET(m, M_NOWAIT, MT_DATA); if (m == 0) { m_freem(m0); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); return (NULL); } bzero(mtod(m, u_char *), pad); @@ -534,7 +534,7 @@ patm_launch(struct patm_softc *sc, struct patm_scd *scd) patm_load_txbuf, &a, BUS_DMA_NOWAIT); if (error == EFBIG) { if ((m = m_defrag(m, M_NOWAIT)) == NULL) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); continue; } error = bus_dmamap_load_mbuf(sc->tx_tag, map->map, m, @@ -542,13 +542,13 @@ patm_launch(struct patm_softc *sc, struct patm_scd *scd) } if (error != 0) { sc->stats.tx_load_err++; - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); SLIST_INSERT_HEAD(&sc->tx_maps_free, map, link); m_freem(m); continue; } - sc->ifp->if_opackets++; + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); } } diff --git a/sys/dev/ppbus/if_plip.c b/sys/dev/ppbus/if_plip.c index dbc5183..93a0da1 100644 --- a/sys/dev/ppbus/if_plip.c +++ b/sys/dev/ppbus/if_plip.c @@ -576,8 +576,8 @@ lp_intr(void *arg) sc->sc_iferrs = 0; len -= CLPIPHDRLEN; - sc->sc_ifp->if_ipackets++; - sc->sc_ifp->if_ibytes += len; + if_inc_counter(sc->sc_ifp, IFCOUNTER_IPACKETS, 1); + if_inc_counter(sc->sc_ifp, IFCOUNTER_IBYTES, len); top = m_devget(sc->sc_ifbuf + CLPIPHDRLEN, len, 0, sc->sc_ifp, 0); if (top) { @@ -630,8 +630,8 @@ lp_intr(void *arg) sc->sc_iferrs = 0; len -= LPIPHDRLEN; - sc->sc_ifp->if_ipackets++; - sc->sc_ifp->if_ibytes += len; + if_inc_counter(sc->sc_ifp, IFCOUNTER_IPACKETS, 1); + if_inc_counter(sc->sc_ifp, IFCOUNTER_IBYTES, len); top = m_devget(sc->sc_ifbuf + LPIPHDRLEN, len, 0, sc->sc_ifp, 0); if (top) { @@ -651,7 +651,7 @@ lp_intr(void *arg) err: ppb_wdtr(ppbus, 0); lprintf("R"); - sc->sc_ifp->if_ierrors++; + if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); sc->sc_iferrs++; /* @@ -768,11 +768,11 @@ lpoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, nend: ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (err) { /* if we didn't timeout... */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); lprintf("X"); } else { - ifp->if_opackets++; - ifp->if_obytes += m->m_pkthdr.len; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); if (bpf_peers_present(ifp->if_bpf)) lptap(ifp, m); } @@ -814,11 +814,11 @@ end: ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (err) { /* if we didn't timeout... */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); lprintf("X"); } else { - ifp->if_opackets++; - ifp->if_obytes += m->m_pkthdr.len; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); + if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len); if (bpf_peers_present(ifp->if_bpf)) lptap(ifp, m); } diff --git a/sys/dev/qlxgbe/ql_hw.c b/sys/dev/qlxgbe/ql_hw.c index 1d1e3f1..f282159 100644 --- a/sys/dev/qlxgbe/ql_hw.c +++ b/sys/dev/qlxgbe/ql_hw.c @@ -2566,7 +2566,7 @@ qla_hw_tx_done_locked(qla_host_t *ha, uint32_t txr_idx) comp_count++; if (txb->m_head) { - ha->ifp->if_opackets++; + if_inc_counter(ha->ifp, IFCOUNTER_OPACKETS, 1); bus_dmamap_sync(ha->tx_tag, txb->map, BUS_DMASYNC_POSTWRITE); diff --git a/sys/dev/qlxgbe/ql_isr.c b/sys/dev/qlxgbe/ql_isr.c index c11e986..db00298 100644 --- a/sys/dev/qlxgbe/ql_isr.c +++ b/sys/dev/qlxgbe/ql_isr.c @@ -156,7 +156,7 @@ qla_rx_intr(qla_host_t *ha, qla_sgl_rcv_t *sgc, uint32_t sds_idx) mpf->m_pkthdr.csum_flags = 0; } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); mpf->m_pkthdr.flowid = sgc->rss_hash; mpf->m_flags |= M_FLOWID; @@ -326,7 +326,7 @@ qla_lro_intr(qla_host_t *ha, qla_sgl_lro_t *sgc, uint32_t sds_idx) mpf->m_pkthdr.flowid = sgc->rss_hash; mpf->m_flags |= M_FLOWID; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); (*ifp->if_input)(ifp, mpf); diff --git a/sys/dev/qlxge/qls_isr.c b/sys/dev/qlxge/qls_isr.c index 26e431e..14b4839 100644 --- a/sys/dev/qlxge/qls_isr.c +++ b/sys/dev/qlxge/qls_isr.c @@ -57,7 +57,7 @@ qls_tx_comp(qla_host_t *ha, uint32_t txr_idx, q81_tx_mac_comp_t *tx_comp) txb = &ha->tx_ring[txr_idx].tx_buf[tx_idx]; if (txb->m_head) { - ha->ifp->if_opackets++; + if_inc_counter(ha->ifp, IFCOUNTER_OPACKETS, 1); bus_dmamap_sync(ha->tx_tag, txb->map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(ha->tx_tag, txb->map); @@ -201,7 +201,7 @@ qls_rx_comp(qla_host_t *ha, uint32_t rxr_idx, uint32_t cq_idx, q81_rx_t *cq_e) CSUM_PSEUDO_HDR; mp->m_pkthdr.csum_data = 0xFFFF; } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); if (lro->lro_cnt && (tcp_lro_rx(lro, mp, 0) == 0)) { /* LRO packet has been successfuly queued */ diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index 475544d..02c9310 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -959,7 +959,7 @@ rt2560_tx_intr(struct rt2560_softc *sc) ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_SUCCESS, &retrycnt, NULL); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); break; case RT2560_TX_SUCCESS_RETRY: @@ -971,7 +971,7 @@ rt2560_tx_intr(struct rt2560_softc *sc) ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_SUCCESS, &retrycnt, NULL); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); break; case RT2560_TX_FAIL_RETRY: @@ -983,7 +983,7 @@ rt2560_tx_intr(struct rt2560_softc *sc) ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_FAILURE, &retrycnt, NULL); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); break; case RT2560_TX_FAIL_INVALID: @@ -991,7 +991,7 @@ rt2560_tx_intr(struct rt2560_softc *sc) default: device_printf(sc->sc_dev, "sending data frame failed " "0x%08x\n", flags); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } bus_dmamap_sync(sc->txq.data_dmat, data->map, @@ -1144,13 +1144,13 @@ rt2560_decryption_intr(struct rt2560_softc *sc) break; if (data->drop) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } if ((le32toh(desc->flags) & RT2560_RX_CIPHER_MASK) != 0 && (le32toh(desc->flags) & RT2560_RX_ICV_ERROR)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1163,7 +1163,7 @@ rt2560_decryption_intr(struct rt2560_softc *sc) */ mnew = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (mnew == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1186,7 +1186,7 @@ rt2560_decryption_intr(struct rt2560_softc *sc) panic("%s: could not load old rx mbuf", device_get_name(sc->sc_dev)); } - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1936,7 +1936,7 @@ rt2560_start_locked(struct ifnet *ifp) ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; if (rt2560_tx_data(sc, m, ni) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); break; } @@ -1973,7 +1973,7 @@ rt2560_watchdog(void *arg) if (sc->sc_tx_timer > 0 && --sc->sc_tx_timer == 0) { if_printf(ifp, "device timeout\n"); rt2560_init_locked(sc); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* NB: callout is reset in rt2560_init() */ return; } @@ -2796,7 +2796,7 @@ rt2560_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, return ENOBUFS; /* XXX */ } - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if (params == NULL) { /* @@ -2819,7 +2819,7 @@ rt2560_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, return 0; bad: - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ieee80211_free_node(ni); RAL_UNLOCK(sc); return EIO; /* XXX */ diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c index 7b621d7..448ba57 100644 --- a/sys/dev/ral/rt2661.c +++ b/sys/dev/ral/rt2661.c @@ -909,7 +909,7 @@ rt2661_tx_intr(struct rt2661_softc *sc) ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_SUCCESS, &retrycnt, NULL); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); break; case RT2661_TX_RETRY_FAIL: @@ -921,14 +921,14 @@ rt2661_tx_intr(struct rt2661_softc *sc) ieee80211_ratectl_tx_complete(vap, ni, IEEE80211_RATECTL_TX_FAILURE, &retrycnt, NULL); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); break; default: /* other failure */ device_printf(sc->sc_dev, "sending data frame failed 0x%08x\n", val); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } DPRINTFN(sc, 15, "tx done q=%d idx=%u\n", qid, txq->stat); @@ -1015,12 +1015,12 @@ rt2661_rx_intr(struct rt2661_softc *sc) */ DPRINTFN(sc, 5, "PHY or CRC error flags 0x%08x\n", le32toh(desc->flags)); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } if ((le32toh(desc->flags) & RT2661_RX_CIPHER_MASK) != 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1033,7 +1033,7 @@ rt2661_rx_intr(struct rt2661_softc *sc) */ mnew = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (mnew == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1056,7 +1056,7 @@ rt2661_rx_intr(struct rt2661_softc *sc) panic("%s: could not load old rx mbuf", device_get_name(sc->sc_dev)); } - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1631,7 +1631,7 @@ rt2661_start_locked(struct ifnet *ifp) ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; if (rt2661_tx_data(sc, m, ni, ac) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); break; } @@ -1674,7 +1674,7 @@ rt2661_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, return ENOBUFS; /* XXX */ } - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* * Legacy path; interpret frame contents to decide @@ -1689,7 +1689,7 @@ rt2661_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, return 0; bad: - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ieee80211_free_node(ni); RAL_UNLOCK(sc); return EIO; /* XXX */ @@ -1711,7 +1711,7 @@ rt2661_watchdog(void *arg) if (sc->sc_tx_timer > 0 && --sc->sc_tx_timer == 0) { if_printf(ifp, "device timeout\n"); rt2661_init_locked(sc); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* NB: callout is reset in rt2661_init() */ return; } diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c index e37f820..2e68c2e 100644 --- a/sys/dev/ral/rt2860.c +++ b/sys/dev/ral/rt2860.c @@ -1127,7 +1127,7 @@ rt2860_drain_stats_fifo(struct rt2860_softc *sc) } else { ieee80211_ratectl_tx_complete(ni->ni_vap, ni, IEEE80211_RATECTL_TX_FAILURE, &retrycnt, NULL); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } } } @@ -1161,7 +1161,7 @@ rt2860_tx_intr(struct rt2860_softc *sc, int qid) SLIST_INSERT_HEAD(&sc->data_pool, data, next); ring->data[ring->next] = NULL; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } ring->queued--; ring->next = (ring->next + 1) % RT2860_TX_RING_COUNT; @@ -1224,7 +1224,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) if (__predict_false(rxd->flags & htole32(RT2860_RX_CRCERR | RT2860_RX_ICVERR))) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1233,14 +1233,14 @@ rt2860_rx_intr(struct rt2860_softc *sc) /* report MIC failures to net80211 for TKIP */ ic->ic_stats.is_rx_locmicfail++; ieee80211_michael_mic_failure(ic, 0/* XXX */); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } #endif m1 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m1 == NULL)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1264,7 +1264,7 @@ rt2860_rx_intr(struct rt2860_softc *sc) } /* physical address may have changed */ rxd->sdp0 = htole32(physaddr); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1744,7 +1744,7 @@ rt2860_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, if (error != 0) { /* NB: m is reclaimed on tx failure */ ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } sc->sc_tx_timer = 5; RAL_UNLOCK(sc); @@ -1997,7 +1997,7 @@ rt2860_start_locked(struct ifnet *ifp) ni = (struct ieee80211_node *)m->m_pkthdr.rcvif; if (rt2860_tx(sc, m, ni) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } sc->sc_tx_timer = 5; @@ -2021,7 +2021,7 @@ rt2860_watchdog(void *arg) if_printf(ifp, "device timeout\n"); rt2860_stop_locked(sc); rt2860_init_locked(sc); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return; } callout_reset(&sc->watchdog_ch, hz, rt2860_watchdog, sc); diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index e7f1361..7068e6f 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -2241,7 +2241,7 @@ re_rxeof(struct rl_softc *sc, int *rx_npktsp) (rxstat & RL_RDESC_STAT_ERRS) == RL_RDESC_STAT_GIANT) rxerr = 0; if (rxerr != 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); /* * If this is part of a multi-fragment packet, * discard all the pieces. @@ -2264,7 +2264,7 @@ re_rxeof(struct rl_softc *sc, int *rx_npktsp) else rxerr = re_newbuf(sc, i); if (rxerr != 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); if (sc->rl_head != NULL) { m_freem(sc->rl_head); sc->rl_head = sc->rl_tail = NULL; @@ -2306,7 +2306,7 @@ re_rxeof(struct rl_softc *sc, int *rx_npktsp) #ifdef RE_FIXUP_RX re_fixup_rx(m); #endif - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = ifp; /* Do RX checksumming if enabled */ @@ -2425,11 +2425,11 @@ re_txeof(struct rl_softc *sc) txd->tx_m = NULL; if (txstat & (RL_TDESC_STAT_EXCESSCOL| RL_TDESC_STAT_COLCNT)) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); if (txstat & RL_TDESC_STAT_TXERRSUM) - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); else - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } sc->rl_ldata.rl_tx_free++; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -3539,7 +3539,7 @@ re_watchdog(struct rl_softc *sc) } if_printf(ifp, "watchdog timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); re_rxeof(sc, NULL); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; diff --git a/sys/dev/rt/if_rt.c b/sys/dev/rt/if_rt.c index 3d936b5..910276f 100644 --- a/sys/dev/rt/if_rt.c +++ b/sys/dev/rt/if_rt.c @@ -1025,7 +1025,7 @@ rt_start(struct ifnet *ifp) m_freem(m); ifp->if_drv_flags |= IFF_DRV_OACTIVE; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); sc->tx_data_queue_full[qid]++; @@ -1035,7 +1035,7 @@ rt_start(struct ifnet *ifp) if (rt_tx_data(sc, m, qid) != 0) { RT_SOFTC_TX_RING_UNLOCK(&sc->tx_ring[qid]); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); break; } @@ -1152,7 +1152,7 @@ rt_tx_watchdog(void *arg) rt_stop_locked(sc); rt_init_locked(sc); #endif - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); sc->tx_watchdog_timeouts++; } callout_reset(&sc->tx_watchdog_ch, hz, rt_tx_watchdog, sc); @@ -1637,7 +1637,7 @@ rt_rx_eof(struct rt_softc *sc, int limit) MJUMPAGESIZE); if (mnew == NULL) { sc->rx_mbuf_alloc_errors++; - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1654,7 +1654,7 @@ rt_rx_eof(struct rt_softc *sc, int limit) m_freem(mnew); sc->rx_mbuf_dmamap_errors++; - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto skip; } @@ -1700,7 +1700,7 @@ rt_rx_eof(struct rt_softc *sc, int limit) RT_DPRINTF(sc, RT_DEBUG_RX, "rxdesc: crc error\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); if (!(ifp->if_flags & IFF_PROMISC)) { m_freem(m); @@ -1785,7 +1785,7 @@ rt_tx_eof(struct rt_softc *sc, struct rt_softc_tx_ring *ring) data->m = NULL; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); RT_SOFTC_TX_RING_LOCK(ring); ring->data_queued--; diff --git a/sys/dev/sbni/if_sbni.c b/sys/dev/sbni/if_sbni.c index 8a4ce2e..c459ded 100644 --- a/sys/dev/sbni/if_sbni.c +++ b/sys/dev/sbni/if_sbni.c @@ -612,7 +612,7 @@ upload_data(struct sbni_softc *sc, u_int framelen, u_int frameno, } else if ((frame_ok = skip_tail(sc, framelen, crc)) != 0) { sc->wait_frameno = 0; sc->inppos = 0; - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); /* now skip all frames until is_first != 0 */ } } else @@ -624,7 +624,7 @@ upload_data(struct sbni_softc *sc, u_int framelen, u_int frameno, * is_first already... Drop entire packet. */ sc->wait_frameno = 0; - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); } return (frame_ok); @@ -638,7 +638,7 @@ send_complete(struct sbni_softc *sc) { m_freem(sc->tx_buf_p); sc->tx_buf_p = NULL; - sc->ifp->if_opackets++; + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); } @@ -689,7 +689,7 @@ append_frame_to_pkt(struct sbni_softc *sc, u_int framelen, u_int32_t crc) sc->inppos += framelen - 4; if (--sc->wait_frameno == 0) { /* last frame received */ indicate_pkt(sc); - sc->ifp->if_ipackets++; + if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); } return (1); @@ -755,7 +755,7 @@ drop_xmit_queue(struct sbni_softc *sc) if (sc->tx_buf_p) { m_freem(sc->tx_buf_p); sc->tx_buf_p = NULL; - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); } for (;;) { @@ -763,7 +763,7 @@ drop_xmit_queue(struct sbni_softc *sc) if (m == NULL) break; m_freem(m); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); } sc->tx_frameno = 0; diff --git a/sys/dev/sge/if_sge.c b/sys/dev/sge/if_sge.c index 32773fd..f0ef07f 100644 --- a/sys/dev/sge/if_sge.c +++ b/sys/dev/sge/if_sge.c @@ -1171,13 +1171,13 @@ sge_rxeof(struct sge_softc *sc) RX_ERR_BITS); #endif sge_discard_rxbuf(sc, cons); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); continue; } m = cd->sge_rxdesc[cons].rx_m; if (sge_newbuf(sc, cons) != 0) { sge_discard_rxbuf(sc, cons); - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); continue; } if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) { @@ -1210,7 +1210,7 @@ sge_rxeof(struct sge_softc *sc) m->m_pkthdr.len = m->m_len = SGE_RX_BYTES(rxstat) - SGE_RX_PAD_BYTES; m->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); SGE_UNLOCK(sc); (*ifp->if_input)(ifp, m); SGE_LOCK(sc); @@ -1265,12 +1265,12 @@ sge_txeof(struct sge_softc *sc) device_printf(sc->sge_dev, "Tx error : 0x%b\n", txstat, TX_ERR_BITS); #endif - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } else { #ifdef notyet - ifp->if_collisions += (txstat & 0xFFFF) - 1; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, (txstat & 0xFFFF) - 1); #endif - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } txd = &cd->sge_txdesc[cons]; for (nsegs = 0; nsegs < txd->tx_ndesc; nsegs++) { @@ -1856,13 +1856,13 @@ sge_watchdog(struct sge_softc *sc) if (1 || bootverbose) device_printf(sc->sge_dev, "watchdog timeout (lost link)\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sge_init_locked(sc); return; } device_printf(sc->sge_dev, "watchdog timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sge_init_locked(sc); diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index c4eb2d6..9898370 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -2556,7 +2556,7 @@ sk_watchdog(arg) sk_txeof(sc_if); if (sc_if->sk_cdata.sk_tx_cnt != 0) { if_printf(sc_if->sk_ifp, "watchdog timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sk_init_locked(sc_if); } @@ -2771,7 +2771,7 @@ sk_rxeof(sc_if) SK_RXBYTES(sk_ctl) < SK_MIN_FRAMELEN || SK_RXBYTES(sk_ctl) > SK_MAX_FRAMELEN || sk_rxvalid(sc, rxstat, SK_RXBYTES(sk_ctl)) == 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); sk_discard_rxbuf(sc_if, cons); continue; } @@ -2779,14 +2779,14 @@ sk_rxeof(sc_if) m = rxd->rx_m; csum = le32toh(cur_rx->sk_csum); if (sk_newbuf(sc_if, cons) != 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); /* reuse old buffer */ sk_discard_rxbuf(sc_if, cons); continue; } m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = SK_RXBYTES(sk_ctl); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) sk_rxcksum(ifp, m, csum); SK_IF_UNLOCK(sc_if); @@ -2839,7 +2839,7 @@ sk_jumbo_rxeof(sc_if) SK_RXBYTES(sk_ctl) < SK_MIN_FRAMELEN || SK_RXBYTES(sk_ctl) > SK_JUMBO_FRAMELEN || sk_rxvalid(sc, rxstat, SK_RXBYTES(sk_ctl)) == 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); sk_discard_jumbo_rxbuf(sc_if, cons); continue; } @@ -2847,14 +2847,14 @@ sk_jumbo_rxeof(sc_if) m = jrxd->rx_m; csum = le32toh(cur_rx->sk_csum); if (sk_jumbo_newbuf(sc_if, cons) != 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); /* reuse old buffer */ sk_discard_jumbo_rxbuf(sc_if, cons); continue; } m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = SK_RXBYTES(sk_ctl); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) sk_rxcksum(ifp, m, csum); SK_IF_UNLOCK(sc_if); @@ -2905,7 +2905,7 @@ sk_txeof(sc_if) BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc_if->sk_cdata.sk_tx_tag, txd->tx_dmamap); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); m_freem(txd->tx_m); txd->tx_m = NULL; STAILQ_REMOVE_HEAD(&sc_if->sk_cdata.sk_txbusyq, tx_q); diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index 7cc8564..7350537 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -409,7 +409,7 @@ startagain: */ if (len + pad > ETHER_MAX_LEN - ETHER_CRC_LEN) { if_printf(ifp, "large packet discarded (A)\n"); - ++ifp->if_oerrors; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); IFQ_DRV_DEQUEUE(&ifp->if_snd, m); m_freem(m); goto readcheck; @@ -556,7 +556,7 @@ startagain: BPF_MTAP(ifp, top); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); m_freem(top); @@ -625,7 +625,7 @@ snresume(struct ifnet *ifp) */ if (len + pad > ETHER_MAX_LEN - ETHER_CRC_LEN) { if_printf(ifp, "large packet discarded (B)\n"); - ++ifp->if_oerrors; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); IFQ_DRV_DEQUEUE(&ifp->if_snd, m); m_freem(m); return; @@ -750,7 +750,7 @@ snresume(struct ifnet *ifp) BPF_MTAP(ifp, top); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); m_freem(top); try_start: @@ -830,7 +830,7 @@ snintr_locked(struct sn_softc *sc) SMC_SELECT_BANK(sc, 2); CSR_WRITE_1(sc, INTR_ACK_REG_B, IM_RX_OVRN_INT); - ++ifp->if_ierrors; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } /* * Got a packet. @@ -896,11 +896,11 @@ snintr_locked(struct sn_softc *sc) device_printf(sc->dev, "Successful packet caused interrupt\n"); } else { - ++ifp->if_oerrors; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); } if (tx_status & EPHSR_LATCOL) - ++ifp->if_collisions; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); /* * Some of these errors will have disabled transmit. @@ -951,12 +951,12 @@ snintr_locked(struct sn_softc *sc) /* * Single collisions */ - ifp->if_collisions += card_stats & ECR_COLN_MASK; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, card_stats & ECR_COLN_MASK); /* * Multiple collisions */ - ifp->if_collisions += (card_stats & ECR_MCOLN_MASK) >> 4; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, (card_stats & ECR_MCOLN_MASK) >> 4); SMC_SELECT_BANK(sc, 2); @@ -1041,7 +1041,7 @@ read_another: * Account for receive errors and discard. */ if (status & RS_ERRORS) { - ++ifp->if_ierrors; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto out; } /* @@ -1074,7 +1074,7 @@ read_another: */ if ((m->m_flags & M_EXT) == 0) { m_freem(m); - ++ifp->if_ierrors; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); printf("sn: snread() kernel memory allocation problem\n"); goto out; } @@ -1089,7 +1089,7 @@ read_another: data += packet_length & ~1; *data = CSR_READ_1(sc, DATA_REG_B); } - ++ifp->if_ipackets; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); /* * Remove link layer addresses and whatnot. diff --git a/sys/dev/ste/if_ste.c b/sys/dev/ste/if_ste.c index edc173b..e6cffb3 100644 --- a/sys/dev/ste/if_ste.c +++ b/sys/dev/ste/if_ste.c @@ -622,7 +622,7 @@ ste_rxeof(struct ste_softc *sc, int count) * comes up in the ring. */ if (rxstat & STE_RXSTAT_FRAME_ERR) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); cur_rx->ste_ptr->ste_status = 0; continue; } @@ -639,7 +639,7 @@ ste_rxeof(struct ste_softc *sc, int count) * can do in this situation. */ if (ste_newbuf(sc, cur_rx) != 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); cur_rx->ste_ptr->ste_status = 0; continue; } @@ -647,7 +647,7 @@ ste_rxeof(struct ste_softc *sc, int count) m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = total_len; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); STE_UNLOCK(sc); (*ifp->if_input)(ifp, m); STE_LOCK(sc); @@ -690,7 +690,7 @@ ste_txeoc(struct ste_softc *sc) if ((txstat & (STE_TXSTATUS_UNDERRUN | STE_TXSTATUS_EXCESSCOLLS | STE_TXSTATUS_RECLAIMERR | STE_TXSTATUS_STATSOFLOW)) != 0) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); #ifdef STE_SHOW_TXERRORS device_printf(sc->ste_dev, "TX error : 0x%b\n", txstat & 0xFF, STE_ERR_BITS); @@ -791,7 +791,7 @@ ste_txeof(struct ste_softc *sc) m_freem(cur_tx->ste_mbuf); cur_tx->ste_mbuf = NULL; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); sc->ste_cdata.ste_tx_cnt--; STE_INC(idx, STE_TX_LIST_CNT); } @@ -860,13 +860,13 @@ ste_stats_update(struct ste_softc *sc) stats->tx_carrsense_errs += CSR_READ_1(sc, STE_STAT_CARRIER_ERR); val = CSR_READ_1(sc, STE_STAT_SINGLE_COLLS); stats->tx_single_colls += val; - ifp->if_collisions += val; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, val); val = CSR_READ_1(sc, STE_STAT_MULTI_COLLS); stats->tx_multi_colls += val; - ifp->if_collisions += val; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, val); val += CSR_READ_1(sc, STE_STAT_LATE_COLLS); stats->tx_late_colls += val; - ifp->if_collisions += val; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, val); stats->tx_frames_defered += CSR_READ_1(sc, STE_STAT_TX_DEFER); stats->tx_excess_defers += CSR_READ_1(sc, STE_STAT_TX_EXDEFER); stats->tx_abort += CSR_READ_1(sc, STE_STAT_TX_ABORT); @@ -1960,7 +1960,7 @@ ste_watchdog(struct ste_softc *sc) if (sc->ste_timer == 0 || --sc->ste_timer) return; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if_printf(ifp, "watchdog timeout\n"); ste_txeof(sc); diff --git a/sys/dev/tsec/if_tsec.c b/sys/dev/tsec/if_tsec.c index c6e57e9..7ec2f98 100644 --- a/sys/dev/tsec/if_tsec.c +++ b/sys/dev/tsec/if_tsec.c @@ -687,7 +687,7 @@ tsec_watchdog(struct tsec_softc *sc) return; ifp = sc->tsec_ifp; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if_printf(ifp, "watchdog timeout\n"); tsec_stop(sc); @@ -1349,7 +1349,7 @@ tsec_receive_intr_locked(struct tsec_softc *sc, int count) if (tsec_new_rxbuf(sc->tsec_rx_mtag, rx_data[i].map, &rx_data[i].mbuf, &rx_data[i].paddr)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); /* * We ran out of mbufs; didn't consume current * descriptor and have to return it to the queue. @@ -1430,7 +1430,7 @@ tsec_transmit_intr_locked(struct tsec_softc *sc) ifp = sc->tsec_ifp; /* Update collision statistics */ - ifp->if_collisions += TSEC_READ(sc, TSEC_REG_MON_TNCL); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, TSEC_READ(sc, TSEC_REG_MON_TNCL)); /* Reset collision counters in hardware */ TSEC_WRITE(sc, TSEC_REG_MON_TSCL, 0); @@ -1465,7 +1465,7 @@ tsec_transmit_intr_locked(struct tsec_softc *sc) TSEC_FREE_TX_MAP(sc, mapp); m_freem(m0); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); send = 1; } bus_dmamap_sync(sc->tsec_tx_dtag, sc->tsec_tx_dmap, @@ -1522,18 +1522,18 @@ tsec_error_intr_locked(struct tsec_softc *sc, int count) /* Check transmitter errors */ if (eflags & TSEC_IEVENT_TXE) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (eflags & TSEC_IEVENT_LC) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); TSEC_WRITE(sc, TSEC_REG_TSTAT, TSEC_TSTAT_THLT); } /* Check receiver errors */ if (eflags & TSEC_IEVENT_BSY) { - ifp->if_ierrors++; - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); /* Get data from RX buffers */ tsec_receive_intr_locked(sc, count); @@ -1550,10 +1550,10 @@ tsec_error_intr_locked(struct tsec_softc *sc, int count) } if (eflags & TSEC_IEVENT_BABT) - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (eflags & TSEC_IEVENT_BABR) - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } void diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c index afbaee7..7d852e9 100644 --- a/sys/dev/vx/if_vx.c +++ b/sys/dev/vx/if_vx.c @@ -463,7 +463,7 @@ startagain: */ if (len + pad > ETHER_MAX_LEN) { /* packet is obviously too large: toss it */ - ++ifp->if_oerrors; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); IF_DEQUEUE(&ifp->if_snd, m); m_freem(m); goto readcheck; @@ -513,7 +513,7 @@ startagain: while (pad--) CSR_WRITE_1(sc, VX_W1_TX_PIO_WR_1, 0); /* Padding */ - ++ifp->if_opackets; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); sc->vx_timer = 1; readcheck: @@ -610,12 +610,12 @@ vx_txstat(struct vx_softc *sc) CSR_WRITE_1(sc, VX_W1_TX_STATUS, 0x0); if (i & TXS_JABBER) { - ++ifp->if_oerrors; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (ifp->if_flags & IFF_DEBUG) if_printf(ifp, "jabber (%x)\n", i); vx_reset(sc); } else if (i & TXS_UNDERRUN) { - ++ifp->if_oerrors; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (ifp->if_flags & IFF_DEBUG) if_printf(ifp, "fifo underrun (%x) @%d\n", i, sc->vx_tx_start_thresh); @@ -626,7 +626,7 @@ vx_txstat(struct vx_softc *sc) sc->vx_tx_succ_ok = 0; vx_reset(sc); } else if (i & TXS_MAX_COLLISION) { - ++ifp->if_collisions; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); CSR_WRITE_2(sc, VX_COMMAND, TX_ENABLE); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } else @@ -722,7 +722,7 @@ again: return; if (len & ERR_RX) { - ++ifp->if_ierrors; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto abort; } len &= RX_BYTES_MASK; /* Lower 11 bits = RX bytes. */ @@ -730,10 +730,10 @@ again: /* Pull packet off interface. */ m = vx_get(sc, len); if (m == 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto abort; } - ++ifp->if_ipackets; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); { struct mbuf *m0; @@ -741,7 +741,7 @@ again: m0 = m_devget(mtod(m, char *), m->m_pkthdr.len, ETHER_ALIGN, ifp, NULL); if (m0 == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto abort; } m_freem(m); diff --git a/sys/dev/vxge/vxge.c b/sys/dev/vxge/vxge.c index 037b481..e23e701 100644 --- a/sys/dev/vxge/vxge.c +++ b/sys/dev/vxge/vxge.c @@ -709,9 +709,9 @@ vxge_mq_send_locked(ifnet_t ifp, vxge_vpath_t *vpath, mbuf_t m_head) VXGE_DRV_STATS(vpath, tx_again); break; } - ifp->if_obytes += next->m_pkthdr.len; + if_inc_counter(ifp, IFCOUNTER_OBYTES, next->m_pkthdr.len); if (next->m_flags & M_MCAST) - ifp->if_omcasts++; + if_inc_counter(ifp, IFCOUNTER_OMCASTS, 1); /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); @@ -904,11 +904,11 @@ vxge_tx_compl(vxge_hal_vpath_h vpath_handle, vxge_hal_txdl_h txdlh, device_printf(vdev->ndev, "tx transfer code %d\n", t_code); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); VXGE_DRV_STATS(vpath, tx_tcode); vxge_hal_fifo_handle_tcode(vpath_handle, txdlh, t_code); } - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); txdl_priv = (vxge_txdl_priv_t *) dtr_priv; bus_dmamap_unload(vpath->dma_tag_tx, txdl_priv->dma_map); @@ -1024,7 +1024,7 @@ vxge_rx_compl(vxge_hal_vpath_h vpath_handle, vxge_hal_rxd_h rxdh, mbuf_up = rxd_priv->mbuf_pkt; if (t_code != VXGE_HAL_RING_RXD_T_CODE_OK) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); VXGE_DRV_STATS(vpath, rx_tcode); status = vxge_hal_ring_handle_tcode(vpath_handle, rxdh, t_code); diff --git a/sys/dev/wb/if_wb.c b/sys/dev/wb/if_wb.c index dd087a9..01090aa 100644 --- a/sys/dev/wb/if_wb.c +++ b/sys/dev/wb/if_wb.c @@ -895,7 +895,7 @@ wb_rxeof(sc) (WB_RXBYTES(cur_rx->wb_ptr->wb_status) > 1536) || !(rxstat & WB_RXSTAT_LASTFRAG) || !(rxstat & WB_RXSTAT_RXCMP)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); wb_newbuf(sc, cur_rx, m); device_printf(sc->wb_dev, "receiver babbling: possible chip bug," @@ -907,7 +907,7 @@ wb_rxeof(sc) } if (rxstat & WB_RXSTAT_RXERR) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); wb_newbuf(sc, cur_rx, m); break; } @@ -928,12 +928,12 @@ wb_rxeof(sc) NULL); wb_newbuf(sc, cur_rx, m); if (m0 == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); break; } m = m0; - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); WB_UNLOCK(sc); (*ifp->if_input)(ifp, m); WB_LOCK(sc); @@ -986,16 +986,16 @@ wb_txeof(sc) break; if (txstat & WB_TXSTAT_TXERR) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (txstat & WB_TXSTAT_ABORT) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); if (txstat & WB_TXSTAT_LATECOLL) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); } - ifp->if_collisions += (txstat & WB_TXSTAT_COLLCNT) >> 3; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, (txstat & WB_TXSTAT_COLLCNT) >> 3); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); m_freem(cur_tx->wb_mbuf); cur_tx->wb_mbuf = NULL; @@ -1064,7 +1064,7 @@ wb_intr(arg) break; if ((status & WB_ISR_RX_NOBUF) || (status & WB_ISR_RX_ERR)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); wb_reset(sc); if (status & WB_ISR_RX_ERR) wb_fixmedia(sc); @@ -1093,7 +1093,7 @@ wb_intr(arg) } if (status & WB_ISR_TX_UNDERRUN) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); wb_txeof(sc); WB_CLRBIT(sc, WB_NETCFG, WB_NETCFG_TX_ON); /* Jack up TX threshold */ @@ -1553,7 +1553,7 @@ wb_watchdog(sc) WB_LOCK_ASSERT(sc); ifp = sc->wb_ifp; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if_printf(ifp, "watchdog timeout\n"); #ifdef foo if (!(wb_phy_readreg(sc, PHY_BMSR) & PHY_BMSR_LINKSTAT)) diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index 303e57f..9780007 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -1022,7 +1022,7 @@ wlstart(struct ifnet *ifp) /* try 10 ticks, not very long */ sc->watchdog_ch = timeout(wlwatchdog, sc, 10); sc->ifp->if_drv_flags |= IFF_DRV_OACTIVE; - sc->ifp->if_opackets++; + if_inc_counter(sc->ifp, IFCOUNTER_OPACKETS, 1); wlxmt(sc, m); } else { sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1478,7 +1478,7 @@ wlwatchdog(void *vsc) log(LOG_ERR, "wl%d: wavelan device timeout on xmit\n", unit); WL_LOCK(sc); - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); wlinit(sc); WL_UNLOCK(sc); } @@ -1542,14 +1542,14 @@ wlintr(void *arg) * incoming packet */ if (int_type & SCB_SW_FR) { - sc->ifp->if_ipackets++; + if_inc_counter(sc->ifp, IFCOUNTER_IPACKETS, 1); wlrcv(sc); } /* * receiver not ready */ if (int_type & SCB_SW_RNR) { - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); #ifdef WLDEBUG if (sc->ifp->if_flags & IFF_DEBUG) printf("wl%d intr(): receiver overrun! begin_fd = %x\n", @@ -1610,13 +1610,13 @@ wlintr(void *arg) /* if the transmit actually failed, or returned some status */ if ((!(ac_status & AC_SW_OK)) || (ac_status & 0xfff)) { if (ac_status & (TC_COLLISION | TC_CLS | TC_DMA)) { - sc->ifp->if_oerrors++; + if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); } /* count collisions */ - sc->ifp->if_collisions += (ac_status & 0xf); + if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, (ac_status & 0xf)); /* if TC_COLLISION set and collision count zero, 16 collisions */ if ((ac_status & 0x20) == 0x20) { - sc->ifp->if_collisions += 0x10; + if_inc_counter(sc->ifp, IFCOUNTER_COLLISIONS, 0x10); } } sc->tbusy = 0; @@ -1671,13 +1671,13 @@ wlrcv(struct wl_softc *sc) if (sc->ifp->if_flags & IFF_DEBUG) printf("wl%d RCV: RSC %x\n", sc->unit, status); #endif - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); } else if (!(status & RFD_OK)) { printf("wl%d RCV: !OK %x\n", sc->unit, status); - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); } else if (status & 0xfff) { /* can't happen */ printf("wl%d RCV: ERRs %x\n", sc->unit, status); - sc->ifp->if_ierrors++; + if_inc_counter(sc->ifp, IFCOUNTER_IERRORS, 1); } else if (!wlread(sc, fd_p)) return; diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index 6e4428b..e94fa74 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -1460,7 +1460,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc, if (stat->len > WPI_STAT_MAXLEN) { device_printf(sc->sc_dev, "invalid rx statistic header\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -1477,13 +1477,13 @@ wpi_rx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc, if ((le32toh(tail->flags) & WPI_RX_NOERROR) != WPI_RX_NOERROR) { DPRINTFN(WPI_DEBUG_RX, ("%s: rx flags error %x\n", __func__, le32toh(tail->flags))); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } if (le16toh(head->len) < sizeof (struct ieee80211_frame)) { DPRINTFN(WPI_DEBUG_RX, ("%s: frame too short: %d\n", __func__, le16toh(head->len))); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } @@ -1492,7 +1492,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc, if (mnew == NULL) { DPRINTFN(WPI_DEBUG_RX, ("%s: no mbuf to restock ring\n", __func__)); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } bus_dmamap_unload(ring->data_dmat, data->map); @@ -1504,7 +1504,7 @@ wpi_rx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc, device_printf(sc->sc_dev, "%s: bus_dmamap_load failed, error %d\n", __func__, error); m_freem(mnew); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } bus_dmamap_sync(ring->data_dmat, data->map, BUS_DMASYNC_PREWRITE); @@ -1596,9 +1596,9 @@ wpi_tx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc) /* XXX oerrors should only count errors !maxtries */ if ((le32toh(stat->status) & 0xff) != 1) - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); else - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); bus_dmamap_sync(ring->data_dmat, txdata->map, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(ring->data_dmat, txdata->map); @@ -2059,7 +2059,7 @@ wpi_start_locked(struct ifnet *ifp) ni = (struct ieee80211_node *) m->m_pkthdr.rcvif; if (wpi_tx_data(sc, m, ni, ac) != 0) { ieee80211_free_node(ni); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); break; } sc->sc_tx_timer = 5; @@ -2091,7 +2091,7 @@ wpi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, return ENOBUFS; /* XXX */ } - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if (wpi_tx_data(sc, m, ni, 0) != 0) goto bad; sc->sc_tx_timer = 5; @@ -2100,7 +2100,7 @@ wpi_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, WPI_UNLOCK(sc); return 0; bad: - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); WPI_UNLOCK(sc); ieee80211_free_node(ni); return EIO; /* XXX */ @@ -3667,7 +3667,7 @@ wpi_watchdog(void *arg) if (sc->sc_tx_timer > 0) { if (--sc->sc_tx_timer == 0) { device_printf(sc->sc_dev,"device timeout\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ieee80211_runtask(ic, &sc->sc_restarttask); } } diff --git a/sys/dev/wtap/if_wtap.c b/sys/dev/wtap/if_wtap.c index 6bc8e6b..3c64085 100644 --- a/sys/dev/wtap/if_wtap.c +++ b/sys/dev/wtap/if_wtap.c @@ -421,13 +421,13 @@ wtap_start(struct ifnet *ifp) #endif if ((m->m_flags & M_FRAG)){ printf("dont support frags\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return; } - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if(wtap_raw_xmit(ni, m, NULL) < 0){ printf("error raw_xmiting\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return; } } @@ -594,7 +594,7 @@ wtap_rx_deliver(struct wtap_softc *sc, struct mbuf *m) if_printf(ifp, "%s: no mbuf!\n", __func__); } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); ieee80211_dump_pkt(ic, mtod(m, caddr_t), 0,0,0); @@ -649,7 +649,7 @@ wtap_rx_proc(void *arg, int npending) return; } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); #if 0 ieee80211_dump_pkt(ic, mtod(m, caddr_t), 0,0,0); #endif diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index 5399d28..bcde27f 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -614,8 +614,8 @@ xe_txintr(struct xe_softc *scp, uint8_t txst1) coll = txst1 & XE_TXST1_RETRY_COUNT; scp->tx_tpr = tpr; scp->tx_queued -= sent; - ifp->if_opackets += sent; - ifp->if_collisions += coll; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, sent); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, coll); /* * According to the Xircom manual, Dingo will @@ -656,14 +656,14 @@ xe_macintr(struct xe_softc *scp, uint8_t rst0, uint8_t txst0, uint8_t txst1) if (txst0 & XE_TXST0_NO_CARRIER || !(txst1 & XE_TXST1_LINK_STATUS)) { /* XXX - Need to update media status here */ device_printf(scp->dev, "no carrier\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); scp->mibdata.dot3StatsCarrierSenseErrors++; } #endif /* Excessive collisions -- try sending again */ if (txst0 & XE_TXST0_16_COLLISIONS) { - ifp->if_collisions += 16; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 16); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); scp->mibdata.dot3StatsExcessiveCollisions++; scp->mibdata.dot3StatsMultipleCollisionFrames++; scp->mibdata.dot3StatsCollFrequencies[15]++; @@ -683,35 +683,35 @@ xe_macintr(struct xe_softc *scp, uint8_t rst0, uint8_t txst0, uint8_t txst1) XE_SELECT_PAGE(0x0); } DPRINTF(1, ("\n")); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); scp->mibdata.dot3StatsInternalMacTransmitErrors++; } /* Late collision -- just complain about it */ if (txst0 & XE_TXST0_LATE_COLLISION) { device_printf(scp->dev, "late collision\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); scp->mibdata.dot3StatsLateCollisions++; } /* SQE test failure -- just complain about it */ if (txst0 & XE_TXST0_SQE_FAIL) { device_printf(scp->dev, "SQE test failure\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); scp->mibdata.dot3StatsSQETestErrors++; } /* Packet too long -- what happens to these */ if (rst0 & XE_RST0_LONG_PACKET) { device_printf(scp->dev, "received giant packet\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); scp->mibdata.dot3StatsFrameTooLongs++; } /* CRC error -- packet dropped */ if (rst0 & XE_RST0_CRC_ERROR) { device_printf(scp->dev, "CRC error\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); scp->mibdata.dot3StatsFCSErrors++; } } @@ -743,7 +743,7 @@ xe_rxintr(struct xe_softc *scp, uint8_t rst0) len)); if (len == 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); continue; } @@ -760,7 +760,7 @@ xe_rxintr(struct xe_softc *scp, uint8_t rst0) */ MGETHDR(mbp, M_NOWAIT, MT_DATA); if (mbp == NULL) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); continue; } @@ -768,7 +768,7 @@ xe_rxintr(struct xe_softc *scp, uint8_t rst0) MCLGET(mbp, M_NOWAIT); if ((mbp->m_flags & M_EXT) == 0) { m_freem(mbp); - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); continue; } } @@ -826,13 +826,13 @@ xe_rxintr(struct xe_softc *scp, uint8_t rst0) XE_UNLOCK(scp); (*ifp->if_input)(ifp, mbp); XE_LOCK(scp); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); } else if (rsr & XE_RSR_ALIGN_ERROR) { /* Packet alignment error -- drop packet */ device_printf(scp->dev, "alignment error\n"); scp->mibdata.dot3StatsAlignmentErrors++; - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } /* Skip to next packet, if there is one */ @@ -842,7 +842,7 @@ xe_rxintr(struct xe_softc *scp, uint8_t rst0) /* Clear receiver overruns now we have some free buffer space */ if (rst0 & XE_RST0_RX_OVERRUN) { DEVPRINTF(1, (scp->dev, "receive overrun\n")); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); scp->mibdata.dot3StatsInternalMacReceiveErrors++; XE_OUTB(XE_CR, XE_CR_CLEAR_OVERRUN); } @@ -923,7 +923,7 @@ xe_watchdog(void *arg) if (scp->tx_timeout && --scp->tx_timeout == 0) { device_printf(scp->dev, "watchdog timeout: resetting card\n"); scp->tx_timeouts++; - scp->ifp->if_oerrors += scp->tx_queued; + if_inc_counter(scp->ifp, IFCOUNTER_OERRORS, scp->tx_queued); xe_stop(scp); xe_reset(scp); xe_init_locked(scp); diff --git a/sys/dev/xen/netback/netback.c b/sys/dev/xen/netback/netback.c index b0f206e..e9d3dc1 100644 --- a/sys/dev/xen/netback/netback.c +++ b/sys/dev/xen/netback/netback.c @@ -1829,7 +1829,7 @@ xnb_recv(netif_tx_back_ring_t *txb, domid_t otherend, struct mbuf **mbufc, return 0; /* Nothing to receive */ /* update statistics independent of errors */ - ifnet->if_ipackets++; + if_inc_counter(ifnet, IFCOUNTER_IPACKETS, 1); /* * if we got here, then 1 or more requests was consumed, but the packet @@ -1841,7 +1841,7 @@ xnb_recv(netif_tx_back_ring_t *txb, domid_t otherend, struct mbuf **mbufc, txb->req_cons += num_consumed; DPRINTF("xnb_intr: garbage packet, num_consumed=%d\n", num_consumed); - ifnet->if_ierrors++; + if_inc_counter(ifnet, IFCOUNTER_IERRORS, 1); return EINVAL; } @@ -1855,7 +1855,7 @@ xnb_recv(netif_tx_back_ring_t *txb, domid_t otherend, struct mbuf **mbufc, xnb_txpkt2rsp(&pkt, txb, 1); DPRINTF("xnb_intr: Couldn't allocate mbufs, num_consumed=%d\n", num_consumed); - ifnet->if_iqdrops++; + if_inc_counter(ifnet, IFCOUNTER_IQDROPS, 1); return ENOMEM; } @@ -2364,12 +2364,12 @@ xnb_start_locked(struct ifnet *ifp) case EINVAL: /* OS gave a corrupt packet. Drop it.*/ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* FALLTHROUGH */ default: /* Send succeeded, or packet had error. * Free the packet */ - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if (mbufc) m_freem(mbufc); break; diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index 9ff872c..568511b 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -1056,7 +1056,7 @@ xn_rxeof(struct netfront_info *np) * Break the mbuf chain first though. */ while ((m = mbufq_dequeue(&rxq)) != NULL) { - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); /* * Do we really need to drop the rx lock? @@ -1147,7 +1147,7 @@ xn_txeof(struct netfront_info *np) * mbuf of the chain. */ if (!m->m_next) - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); if (__predict_false(gnttab_query_foreign_access( np->grant_tx_ref[id]) != 0)) { panic("%s: grant id %u still in use by the " -- cgit v1.1