From owner-svn-src-all@FreeBSD.ORG Thu Sep 18 21:09:25 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ED0B0298; Thu, 18 Sep 2014 21:09:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC411619; Thu, 18 Sep 2014 21:09:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8IL9PFe065267; Thu, 18 Sep 2014 21:09:25 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8IL9M5i065244; Thu, 18 Sep 2014 21:09:22 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201409182109.s8IL9M5i065244@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 18 Sep 2014 21:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271832 - head/sys/dev/usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2014 21:09:26 -0000 Author: glebius Date: Thu Sep 18 21:09:22 2014 New Revision: 271832 URL: http://svnweb.freebsd.org/changeset/base/271832 Log: Mechanically convert to if_inc_counter(). Modified: head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_axge.c head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/net/if_cue.c head/sys/dev/usb/net/if_ipheth.c head/sys/dev/usb/net/if_kue.c head/sys/dev/usb/net/if_mos.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_smsc.c head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/net/if_urndis.c head/sys/dev/usb/net/if_usie.c head/sys/dev/usb/net/uhso.c head/sys/dev/usb/net/usb_ethernet.c Modified: head/sys/dev/usb/net/if_aue.c ============================================================================== --- head/sys/dev/usb/net/if_aue.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_aue.c Thu Sep 18 21:09:22 2014 (r271832) @@ -748,10 +748,10 @@ aue_intr_callback(struct usb_xfer *xfer, usbd_copy_out(pc, 0, &pkt, sizeof(pkt)); if (pkt.aue_txstat0) - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (pkt.aue_txstat0 & (AUE_TXSTAT0_LATECOLL | AUE_TXSTAT0_EXCESSCOLL)) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); } /* FALLTHROUGH */ case USB_ST_SETUP: @@ -790,13 +790,13 @@ aue_bulk_read_callback(struct usb_xfer * if (sc->sc_flags & AUE_FLAG_VER_2) { if (actlen == 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } } else { if (actlen <= (int)(sizeof(stat) + ETHER_CRC_LEN)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } usbd_copy_out(pc, actlen - sizeof(stat), &stat, @@ -808,7 +808,7 @@ aue_bulk_read_callback(struct usb_xfer * */ stat.aue_rxstat &= AUE_RXSTAT_MASK; if (stat.aue_rxstat) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } /* No errors; receive the packet. */ @@ -853,7 +853,7 @@ aue_bulk_write_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer of %d bytes complete\n", actlen); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -910,7 +910,7 @@ tr_setup: DPRINTFN(11, "transfer error, %s\n", usbd_errstr(error)); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_axe.c Thu Sep 18 21:09:22 2014 (r271832) @@ -1097,7 +1097,7 @@ axe_rx_frame(struct usb_ether *ue, struc axe_rxeof(ue, pc, 0, actlen, NULL); if (error != 0) - ue->ue_ifp->if_ierrors++; + if_inc_counter(ue->ue_ifp, IFCOUNTER_IERRORS, 1); return (error); } @@ -1109,13 +1109,13 @@ axe_rxeof(struct usb_ether *ue, struct u struct mbuf *m; if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return (EINVAL); } m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); return (ENOMEM); } m->m_len = m->m_pkthdr.len = MCLBYTES; @@ -1123,7 +1123,7 @@ axe_rxeof(struct usb_ether *ue, struct u usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = len; @@ -1229,7 +1229,7 @@ tr_setup: * multiple writes into single one if there is * room in TX buffer of controller. */ - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* * if there's a BPF listener, bounce a copy @@ -1253,7 +1253,7 @@ tr_setup: DPRINTFN(11, "transfer error, %s\n", usbd_errstr(error)); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (error != USB_ERR_CANCELLED) { Modified: head/sys/dev/usb/net/if_axge.c ============================================================================== --- head/sys/dev/usb/net/if_axge.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_axge.c Thu Sep 18 21:09:22 2014 (r271832) @@ -681,7 +681,7 @@ tr_setup: * multiple writes into single one if there is * room in TX buffer of controller. */ - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* * if there's a BPF listener, bounce a copy @@ -702,7 +702,7 @@ tr_setup: return; /* NOTREACHED */ default: - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (error != USB_ERR_CANCELLED) { @@ -962,7 +962,7 @@ axge_rx_frame(struct usb_ether *ue, stru pktlen = (pkt_hdr >> 16) & 0x1fff; if (pkt_hdr & (AXGE_RXHDR_CRC_ERR | AXGE_RXHDR_DROP_ERR)) { DPRINTF("Dropped a packet\n"); - ue->ue_ifp->if_ierrors++; + if_inc_counter(ue->ue_ifp, IFCOUNTER_IERRORS, 1); } if (pktlen >= 6 && (int)(pos + pktlen) <= actlen) { axge_rxeof(ue, pc, pos + 2, pktlen - 6, pkt_hdr); @@ -984,13 +984,13 @@ axge_rxeof(struct usb_ether *ue, struct ifp = ue->ue_ifp; if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (m == NULL) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); return; } m->m_pkthdr.rcvif = ifp; @@ -999,7 +999,7 @@ axge_rxeof(struct usb_ether *ue, struct usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); if ((pkt_hdr & (AXGE_RXHDR_L4CSUM_ERR | AXGE_RXHDR_L3CSUM_ERR)) == 0) { if ((pkt_hdr & AXGE_RXHDR_L4_TYPE_MASK) == Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_cdce.c Thu Sep 18 21:09:22 2014 (r271832) @@ -788,7 +788,7 @@ cdce_bulk_write_callback(struct usb_xfer DPRINTFN(11, "transfer complete: %u bytes in %u frames\n", actlen, aframes); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* free all previous TX buffers */ cdce_free_queue(sc->sc_tx_buf, CDCE_FRAMES_MAX); @@ -814,7 +814,7 @@ tr_setup: if (!m_append(m, 4, (void *)&crc)) { m_freem(m); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } } @@ -822,7 +822,7 @@ tr_setup: mt = m_defrag(m, M_NOWAIT); if (mt == NULL) { m_freem(m); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); continue; } m = mt; @@ -854,7 +854,7 @@ tr_setup: cdce_free_queue(sc->sc_tx_buf, CDCE_FRAMES_MAX); /* count output errors */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ @@ -1169,7 +1169,7 @@ cdce_ncm_fill_tx_frames(struct usb_xfer /* The frame won't fit in our buffer */ DPRINTFN(1, "Frame too big to be transmitted!\n"); m_freem(m); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); n--; continue; } @@ -1207,7 +1207,7 @@ cdce_ncm_fill_tx_frames(struct usb_xfer /* Pre-increment interface counter */ - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); } if (n == 0) @@ -1310,7 +1310,7 @@ cdce_ncm_bulk_write_callback(struct usb_ usbd_errstr(error)); /* update error counter */ - ifp->if_oerrors += 1; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ @@ -1454,7 +1454,7 @@ cdce_ncm_bulk_read_callback(struct usb_x sumdata += temp; } else { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } } Modified: head/sys/dev/usb/net/if_cue.c ============================================================================== --- head/sys/dev/usb/net/if_cue.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_cue.c Thu Sep 18 21:09:22 2014 (r271832) @@ -462,7 +462,7 @@ cue_bulk_read_callback(struct usb_xfer * case USB_ST_TRANSFERRED: if (actlen <= (int)(2 + sizeof(struct ether_header))) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } pc = usbd_xfer_get_frame(xfer, 0); @@ -506,7 +506,7 @@ cue_bulk_write_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer complete\n"); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -544,7 +544,7 @@ tr_setup: DPRINTFN(11, "transfer error, %s\n", usbd_errstr(error)); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ @@ -563,12 +563,12 @@ cue_tick(struct usb_ether *ue) CUE_LOCK_ASSERT(sc, MA_OWNED); - ifp->if_collisions += cue_csr_read_2(sc, CUE_TX_SINGLECOLL); - ifp->if_collisions += cue_csr_read_2(sc, CUE_TX_MULTICOLL); - ifp->if_collisions += cue_csr_read_2(sc, CUE_TX_EXCESSCOLL); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, cue_csr_read_2(sc, CUE_TX_SINGLECOLL)); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, cue_csr_read_2(sc, CUE_TX_MULTICOLL)); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, cue_csr_read_2(sc, CUE_TX_EXCESSCOLL)); if (cue_csr_read_2(sc, CUE_RX_FRAMEERR)) - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } static void Modified: head/sys/dev/usb/net/if_ipheth.c ============================================================================== --- head/sys/dev/usb/net/if_ipheth.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_ipheth.c Thu Sep 18 21:09:22 2014 (r271832) @@ -400,7 +400,7 @@ ipheth_bulk_write_callback(struct usb_xf DPRINTFN(11, "transfer complete: %u bytes in %u frames\n", actlen, aframes); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* free all previous TX buffers */ ipheth_free_queue(sc->sc_tx_buf, IPHETH_TX_FRAMES_MAX); @@ -455,7 +455,7 @@ tr_setup: ipheth_free_queue(sc->sc_tx_buf, IPHETH_TX_FRAMES_MAX); /* count output errors */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ Modified: head/sys/dev/usb/net/if_kue.c ============================================================================== --- head/sys/dev/usb/net/if_kue.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_kue.c Thu Sep 18 21:09:22 2014 (r271832) @@ -550,7 +550,7 @@ kue_bulk_read_callback(struct usb_xfer * case USB_ST_TRANSFERRED: if (actlen <= (int)(2 + sizeof(struct ether_header))) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } pc = usbd_xfer_get_frame(xfer, 0); @@ -596,7 +596,7 @@ kue_bulk_write_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer complete\n"); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -638,7 +638,7 @@ tr_setup: DPRINTFN(11, "transfer error, %s\n", usbd_errstr(error)); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ Modified: head/sys/dev/usb/net/if_mos.c ============================================================================== --- head/sys/dev/usb/net/if_mos.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_mos.c Thu Sep 18 21:09:22 2014 (r271832) @@ -792,7 +792,7 @@ mos_bulk_read_callback(struct usb_xfer * case USB_ST_TRANSFERRED: MOS_DPRINTFN("actlen : %d", actlen); if (actlen <= 1) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } /* evaluate status byte at the end */ @@ -811,7 +811,7 @@ mos_bulk_read_callback(struct usb_xfer * MOS_DPRINTFN("CRC error"); if (rxstat & MOS_RXSTS_ALIGN_ERROR) MOS_DPRINTFN("alignment error"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } /* Remember the last byte was used for the status fields */ @@ -820,7 +820,7 @@ mos_bulk_read_callback(struct usb_xfer * MOS_DPRINTFN("error: pktlen %d is smaller " "than ether_header %zd", pktlen, sizeof(struct ether_header)); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } uether_rxbuf(ue, pc, 0, actlen); @@ -859,7 +859,7 @@ mos_bulk_write_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: MOS_DPRINTFN("transfer of complete"); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: @@ -886,11 +886,11 @@ tr_setup: usbd_transfer_submit(xfer); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); return; default: MOS_DPRINTFN("usb error on tx: %s\n", usbd_errstr(error)); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { usbd_xfer_set_stall(xfer); goto tr_setup; @@ -981,7 +981,7 @@ mos_intr_callback(struct usb_xfer *xfer, uint32_t pkt; int actlen; - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); MOS_DPRINTFN("actlen %i", actlen); Modified: head/sys/dev/usb/net/if_rue.c ============================================================================== --- head/sys/dev/usb/net/if_rue.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_rue.c Thu Sep 18 21:09:22 2014 (r271832) @@ -648,9 +648,9 @@ rue_intr_callback(struct usb_xfer *xfer, pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, &pkt, sizeof(pkt)); - ifp->if_ierrors += pkt.rue_rxlost_cnt; - ifp->if_ierrors += pkt.rue_crcerr_cnt; - ifp->if_collisions += pkt.rue_col_cnt; + if_inc_counter(ifp, IFCOUNTER_IERRORS, pkt.rue_rxlost_cnt); + if_inc_counter(ifp, IFCOUNTER_IERRORS, pkt.rue_crcerr_cnt); + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, pkt.rue_col_cnt); } /* FALLTHROUGH */ case USB_ST_SETUP: @@ -685,7 +685,7 @@ rue_bulk_read_callback(struct usb_xfer * case USB_ST_TRANSFERRED: if (actlen < 4) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } pc = usbd_xfer_get_frame(xfer, 0); @@ -695,7 +695,7 @@ rue_bulk_read_callback(struct usb_xfer * /* check recieve packet was valid or not */ status = le16toh(status); if ((status & RUE_RXSTAT_VALID) == 0) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } uether_rxbuf(ue, pc, 0, actlen); @@ -732,7 +732,7 @@ rue_bulk_write_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer complete\n"); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -782,7 +782,7 @@ tr_setup: DPRINTFN(11, "transfer error, %s\n", usbd_errstr(error)); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_smsc.c Thu Sep 18 21:09:22 2014 (r271832) @@ -989,9 +989,9 @@ smsc_bulk_read_callback(struct usb_xfer if (rxhdr & SMSC_RX_STAT_ERROR) { smsc_dbg_printf(sc, "rx error (hdr 0x%08x)\n", rxhdr); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); if (rxhdr & SMSC_RX_STAT_COLLISION) - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); } else { /* Check if the ethernet frame is too big or too small */ @@ -1002,7 +1002,7 @@ smsc_bulk_read_callback(struct usb_xfer m = uether_newbuf(); if (m == NULL) { smsc_warn_printf(sc, "failed to create new mbuf\n"); - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); goto tr_setup; } @@ -1158,7 +1158,7 @@ tr_setup: usbd_m_copy_in(pc, frm_len, m, 0, m->m_pkthdr.len); frm_len += m->m_pkthdr.len; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* If there's a BPF listener, bounce a copy of this frame to him */ BPF_MTAP(ifp, m); @@ -1176,7 +1176,7 @@ tr_setup: return; default: - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (error != USB_ERR_CANCELLED) { Modified: head/sys/dev/usb/net/if_udav.c ============================================================================== --- head/sys/dev/usb/net/if_udav.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_udav.c Thu Sep 18 21:09:22 2014 (r271832) @@ -582,7 +582,7 @@ udav_bulk_write_callback(struct usb_xfer switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer complete\n"); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -638,7 +638,7 @@ tr_setup: DPRINTFN(11, "transfer error, %s\n", usbd_errstr(error)); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ @@ -666,7 +666,7 @@ udav_bulk_read_callback(struct usb_xfer case USB_ST_TRANSFERRED: if (actlen < (int)(sizeof(stat) + ETHER_CRC_LEN)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } pc = usbd_xfer_get_frame(xfer, 0); @@ -676,11 +676,11 @@ udav_bulk_read_callback(struct usb_xfer len -= ETHER_CRC_LEN; if (stat.rxstat & UDAV_RSR_LCS) { - ifp->if_collisions++; + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); goto tr_setup; } if (stat.rxstat & UDAV_RSR_ERR) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } uether_rxbuf(ue, pc, sizeof(stat), len); Modified: head/sys/dev/usb/net/if_urndis.c ============================================================================== --- head/sys/dev/usb/net/if_urndis.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_urndis.c Thu Sep 18 21:09:22 2014 (r271832) @@ -844,12 +844,12 @@ urndis_bulk_read_callback(struct usb_xfe rm_dataoffset), actlen); goto tr_setup; } else if (msg.rm_datalen < (uint32_t)sizeof(struct ether_header)) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); DPRINTF("invalid ethernet size " "%u < %u\n", msg.rm_datalen, (unsigned)sizeof(struct ether_header)); goto tr_setup; } else if (msg.rm_datalen > (uint32_t)MCLBYTES) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); DPRINTF("invalid ethernet size " "%u > %u\n", msg.rm_datalen, (unsigned)MCLBYTES); @@ -871,7 +871,7 @@ urndis_bulk_read_callback(struct usb_xfe /* enqueue */ uether_rxmbuf(&sc->sc_ue, m, msg.rm_datalen); } else { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); } offset += msg.rm_len; actlen -= msg.rm_len; @@ -917,7 +917,7 @@ urndis_bulk_write_callback(struct usb_xf case USB_ST_TRANSFERRED: DPRINTFN(11, "%u bytes in %u frames\n", actlen, aframes); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -937,7 +937,7 @@ tr_setup: if ((m->m_pkthdr.len + sizeof(msg)) > RNDIS_TX_MAXLEN) { DPRINTF("Too big packet\n"); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* Free buffer */ m_freem(m); @@ -973,7 +973,7 @@ tr_setup: DPRINTFN(11, "transfer error, %s\n", usbd_errstr(error)); /* count output errors */ - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ Modified: head/sys/dev/usb/net/if_usie.c ============================================================================== --- head/sys/dev/usb/net/if_usie.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/if_usie.c Thu Sep 18 21:09:22 2014 (r271832) @@ -806,7 +806,7 @@ tr_setup: } if (sc->sc_rxm == NULL) { DPRINTF("could not allocate Rx mbuf\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); usbd_xfer_set_stall(xfer); usbd_xfer_set_frames(xfer, 0); } else { @@ -828,7 +828,7 @@ tr_setup: if (error != USB_ERR_CANCELLED) { /* try to clear stall first */ usbd_xfer_set_stall(xfer); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } if (sc->sc_rxm != NULL) { @@ -917,8 +917,8 @@ tr_setup: mtx_lock(&sc->sc_mtx); - ifp->if_ierrors += err; - ifp->if_ipackets += pkt; + if_inc_counter(ifp, IFCOUNTER_IERRORS, err); + if_inc_counter(ifp, IFCOUNTER_IPACKETS, pkt); } static void @@ -934,7 +934,7 @@ usie_if_tx_callback(struct usb_xfer *xfe case USB_ST_TRANSFERRED: DPRINTFN(11, "transfer complete\n"); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* fall though */ case USB_ST_SETUP: @@ -974,11 +974,11 @@ tr_setup: default: /* Error */ DPRINTF("USB transfer error, %s\n", usbd_errstr(error)); - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (error != USB_ERR_CANCELLED) { usbd_xfer_set_stall(xfer); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } break; @@ -1214,10 +1214,10 @@ usie_if_output(struct ifnet *ifp, struct err = (ifp->if_transmit)(ifp, m); if (err) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); return (0); } @@ -1395,7 +1395,7 @@ usie_cns_req(struct usie_softc *sc, uint m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m == NULL)) { DPRINTF("could not allocate mbuf\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); return; } /* to align usie_hip{} on 32 bit */ Modified: head/sys/dev/usb/net/uhso.c ============================================================================== --- head/sys/dev/usb/net/uhso.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/uhso.c Thu Sep 18 21:09:22 2014 (r271832) @@ -1694,7 +1694,7 @@ uhso_if_rxflush(void *arg) m = m_pullup(m0, sizeof(struct ip)); if (m == NULL) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); UHSO_DPRINTF(0, "m_pullup failed\n"); mtx_lock(&sc->sc_mtx); continue; @@ -1724,7 +1724,7 @@ uhso_if_rxflush(void *arg) else { UHSO_DPRINTF(0, "got unexpected ip version %d, " "m=%p, len=%d\n", (*cp & 0xf0) >> 4, m, m->m_len); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); UHSO_HEXDUMP(cp, 4); m_freem(m); m = NULL; @@ -1734,7 +1734,7 @@ uhso_if_rxflush(void *arg) if (iplen == 0) { UHSO_DPRINTF(0, "Zero IP length\n"); - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); m_freem(m); m = NULL; mtx_lock(&sc->sc_mtx); @@ -1775,7 +1775,7 @@ uhso_if_rxflush(void *arg) continue; } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = ifp; /* Dispatch to IP layer */ @@ -1803,7 +1803,7 @@ uhso_ifnet_write_callback(struct usb_xfe switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; case USB_ST_SETUP: tr_setup: @@ -1898,10 +1898,10 @@ uhso_if_output(struct ifnet *ifp, struct error = (ifp->if_transmit)(ifp, m0); if (error) { - ifp->if_oerrors++; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (ENOBUFS); } - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); return (0); } Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Thu Sep 18 21:07:05 2014 (r271831) +++ head/sys/dev/usb/net/usb_ethernet.c Thu Sep 18 21:09:22 2014 (r271832) @@ -580,7 +580,7 @@ uether_rxmbuf(struct usb_ether *ue, stru UE_LOCK_ASSERT(ue, MA_OWNED); /* finalize mbuf */ - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = len; @@ -603,14 +603,14 @@ uether_rxbuf(struct usb_ether *ue, struc m = uether_newbuf(); if (m == NULL) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); return (ENOMEM); } usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); /* finalize mbuf */ - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = len;