Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Adopt <net/if_stats.h>.



details:   https://anonhg.NetBSD.org/src/rev/7dcb2aeff720
branches:  trunk
changeset: 744312:7dcb2aeff720
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jan 29 13:54:41 2020 +0000

description:
Adopt <net/if_stats.h>.

diffstat:

 sys/dev/ic/aic6915.c            |  31 +++++++++++++++---------
 sys/dev/ic/an.c                 |  26 ++++++++++----------
 sys/dev/ic/arn5008.c            |  22 +++++++++---------
 sys/dev/ic/arn9003.c            |  18 +++++++-------
 sys/dev/ic/ath.c                |  40 ++++++++++++++++++--------------
 sys/dev/ic/athn.c               |  12 ++++----
 sys/dev/ic/atw.c                |  34 +++++++++++++-------------
 sys/dev/ic/awi.c                |  26 ++++++++++----------
 sys/dev/ic/bwfm.c               |   6 ++--
 sys/dev/ic/bwi.c                |  26 ++++++++++----------
 sys/dev/ic/cs89x0.c             |  29 +++++++++++++----------
 sys/dev/ic/dm9000.c             |  12 ++++----
 sys/dev/ic/dp8390.c             |  24 +++++++++++--------
 sys/dev/ic/dp83932.c            |  20 +++++++++------
 sys/dev/ic/dwc_gmac.c           |  16 ++++++------
 sys/dev/ic/elink3.c             |  21 +++++++++--------
 sys/dev/ic/elinkxl.c            |  50 +++++++++++++++++-----------------------
 sys/dev/ic/tulip.c              |  32 +++++++++++++------------
 sys/dev/pcmcia/if_cnw.c         |  12 ++++----
 sys/dev/pcmcia/if_malo_pcmcia.c |  10 ++++----
 sys/dev/pcmcia/if_ray.c         |  24 +++++++++---------
 21 files changed, 254 insertions(+), 237 deletions(-)

diffs (truncated from 1796 to 300 lines):

diff -r 100cff1f2786 -r 7dcb2aeff720 sys/dev/ic/aic6915.c
--- a/sys/dev/ic/aic6915.c      Wed Jan 29 13:47:31 2020 +0000
+++ b/sys/dev/ic/aic6915.c      Wed Jan 29 13:54:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic6915.c,v 1.40 2019/10/30 07:26:28 msaitoh Exp $     */
+/*     $NetBSD: aic6915.c,v 1.41 2020/01/29 14:09:58 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.40 2019/10/30 07:26:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.41 2020/01/29 14:09:58 thorpej Exp $");
 
 
 #include <sys/param.h>
@@ -502,7 +502,7 @@
        struct sf_softc *sc = ifp->if_softc;
 
        printf("%s: device timeout\n", device_xname(sc->sc_dev));
-       ifp->if_oerrors++;
+       if_statinc(ifp, if_oerrors);
 
        (void) sf_init(ifp);
 
@@ -746,7 +746,7 @@
                 */
                m = ds->ds_mbuf;
                if (sf_add_rxbuf(sc, rxidx) != 0) {
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
                        SF_INIT_RXDESC(sc, rxidx);
                        bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0,
                            ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -762,7 +762,7 @@
                MGETHDR(m, M_DONTWAIT, MT_DATA);
                if (m == NULL) {
  dropit:
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
                        SF_INIT_RXDESC(sc, rxidx);
                        bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0,
                            ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -846,19 +846,26 @@
                sf_genreg_write(sc, SF_STATS_BASE + (i * sizeof(uint32_t)), 0);
        }
 
-       ifp->if_opackets += stats.TransmitOKFrames;
+       net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
+       if_statadd_ref(nsr, if_opackets, stats.TransmitOKFrames);
 
-       ifp->if_collisions += stats.SingleCollisionFrames +
-           stats.MultipleCollisionFrames;
+       if_statadd_ref(nsr, if_collisions,
+           stats.SingleCollisionFrames +
+           stats.MultipleCollisionFrames);
 
-       ifp->if_oerrors += stats.TransmitAbortDueToExcessiveCollisions +
+       if_statadd_ref(nsr, if_oerrors,
+           stats.TransmitAbortDueToExcessiveCollisions +
            stats.TransmitAbortDueToExcessingDeferral +
-           stats.FramesLostDueToInternalTransmitErrors;
+           stats.FramesLostDueToInternalTransmitErrors);
 
-       ifp->if_ierrors += stats.ReceiveCRCErrors + stats.AlignmentErrors +
+       if_statadd_ref(nsr, if_ierrors,
+           stats.ReceiveCRCErrors + stats.AlignmentErrors +
            stats.ReceiveFramesTooLong + stats.ReceiveFramesTooShort +
            stats.ReceiveFramesJabbersError +
-           stats.FramesLostDueToInternalReceiveErrors;
+           stats.FramesLostDueToInternalReceiveErrors);
+
+       IF_STAT_PUTREF(ifp);
 }
 
 /*
diff -r 100cff1f2786 -r 7dcb2aeff720 sys/dev/ic/an.c
--- a/sys/dev/ic/an.c   Wed Jan 29 13:47:31 2020 +0000
+++ b/sys/dev/ic/an.c   Wed Jan 29 13:54:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: an.c,v 1.72 2019/09/23 17:37:04 maxv Exp $     */
+/*     $NetBSD: an.c,v 1.73 2020/01/29 14:09:58 thorpej Exp $  */
 /*
  * Copyright (c) 1997, 1998, 1999
  *     Bill Paul <wpaul%ctr.columbia.edu@localhost>.  All rights reserved.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.72 2019/09/23 17:37:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.73 2020/01/29 14:09:58 thorpej Exp $");
 
 
 #include <sys/param.h>
@@ -755,7 +755,7 @@
                        break;
                }
                IFQ_DEQUEUE(&ifp->if_snd, m);
-               ifp->if_opackets++;
+               if_statinc(ifp, if_opackets);
                bpf_mtap(ifp, m, BPF_D_OUT);
                eh = mtod(m, struct ether_header *);
                ni = ieee80211_find_txnode(ic, eh->ether_dhost);
@@ -853,7 +853,7 @@
                sc->sc_txnext = cur;
                continue;
 bad:
-               ifp->if_oerrors++;
+               if_statinc(ifp, if_oerrors);
                m_freem(m);
        }
 }
@@ -891,7 +891,7 @@
        if (sc->sc_tx_timer) {
                if (--sc->sc_tx_timer == 0) {
                        printf("%s: device timeout\n", ifp->if_xname);
-                       ifp->if_oerrors++;
+                       if_statinc(ifp, if_oerrors);
                        an_init(ifp);
                        return;
                }
@@ -1390,7 +1390,7 @@
        /* First read in the frame header */
        if (an_read_bap(sc, fid, 0, &frmhdr, sizeof(frmhdr)) != 0) {
                CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_RX);
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                DPRINTF(("an_rx_intr: read fid %x failed\n", fid));
                return;
        }
@@ -1414,7 +1414,7 @@
        if ((status & AN_STAT_ERRSTAT) != 0 &&
            ic->ic_opmode != IEEE80211_M_MONITOR) {
                CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_RX);
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                DPRINTF(("an_rx_intr: fid %x status %x\n", fid, status));
                return;
        }
@@ -1426,7 +1426,7 @@
        if (off + len > MCLBYTES) {
                if (ic->ic_opmode != IEEE80211_M_MONITOR) {
                        CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_RX);
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
                        DPRINTF(("an_rx_intr: oversized packet %d\n", len));
                        return;
                }
@@ -1436,7 +1436,7 @@
        MGETHDR(m, M_DONTWAIT, MT_DATA);
        if (m == NULL) {
                CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_RX);
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                DPRINTF(("an_rx_intr: MGET failed\n"));
                return;
        }
@@ -1445,7 +1445,7 @@
                if ((m->m_flags & M_EXT) == 0) {
                        CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_RX);
                        m_freem(m);
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
                        DPRINTF(("an_rx_intr: MCLGET failed\n"));
                        return;
                }
@@ -1457,7 +1457,7 @@
                if (gaplen > AN_GAPLEN_MAX) {
                        CSR_WRITE_2(sc, AN_EVENT_ACK, AN_EV_RX);
                        m_freem(m);
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
                        DPRINTF(("%s: gap too long\n", __func__));
                        return;
                }
@@ -1549,9 +1549,9 @@
        CSR_WRITE_2(sc, AN_EVENT_ACK, status & (AN_EV_TX | AN_EV_TX_EXC));
 
        if (status & AN_EV_TX_EXC)
-               ifp->if_oerrors++;
+               if_statinc(ifp, if_oerrors);
        else
-               ifp->if_opackets++;
+               if_statinc(ifp, if_opackets);
 
        cur = sc->sc_txcur;
        if (sc->sc_txd[cur].d_fid == fid) {
diff -r 100cff1f2786 -r 7dcb2aeff720 sys/dev/ic/arn5008.c
--- a/sys/dev/ic/arn5008.c      Wed Jan 29 13:47:31 2020 +0000
+++ b/sys/dev/ic/arn5008.c      Wed Jan 29 13:54:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arn5008.c,v 1.16 2019/11/10 21:16:35 chs Exp $ */
+/*     $NetBSD: arn5008.c,v 1.17 2020/01/29 14:09:58 thorpej Exp $     */
 /*     $OpenBSD: ar5008.c,v 1.21 2012/08/25 12:14:31 kettenis Exp $    */
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.16 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arn5008.c,v 1.17 2020/01/29 14:09:58 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/sockio.h>
@@ -822,7 +822,7 @@
                        /* HW will not "move" RXDP in this case, so do it. */
                        AR_WRITE(sc, AR_RXDP, nbf->bf_daddr);
                        AR_WRITE_BARRIER(sc);
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
                        goto skip;
                }
                return EBUSY;
@@ -831,7 +831,7 @@
        if (__predict_false(ds->ds_status1 & AR_RXS1_MORE)) {
                /* Drop frames that span multiple Rx descriptors. */
                DPRINTFN(DBG_RX, sc, "dropping split frame\n");
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                goto skip;
        }
        if (!(ds->ds_status8 & AR_RXS8_FRAME_OK)) {
@@ -854,14 +854,14 @@
                        /* Report Michael MIC failures to net80211. */
                        ieee80211_notify_michael_failure(ic, wh, 0 /* XXX: keyix */);
                }
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                goto skip;
        }
 
        len = MS(ds->ds_status1, AR_RXS1_DATA_LEN);
        if (__predict_false(len < (int)IEEE80211_MIN_LEN || len > ATHN_RXBUFSZ)) {
                DPRINTFN(DBG_RX, sc, "corrupted descriptor length=%d\n", len);
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                goto skip;
        }
 
@@ -869,7 +869,7 @@
        m1 = MCLGETI(NULL, M_DONTWAIT, NULL, ATHN_RXBUFSZ);
        if (__predict_false(m1 == NULL)) {
                ic->ic_stats.is_rx_nobuf++;
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                goto skip;
        }
 
@@ -889,7 +889,7 @@
                    mtod(bf->bf_m, void *), ATHN_RXBUFSZ, NULL,
                    BUS_DMA_NOWAIT | BUS_DMA_READ);
                KASSERT(error != 0);
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                goto skip;
        }
 
@@ -985,12 +985,12 @@
                return EBUSY;
 
        SIMPLEQ_REMOVE_HEAD(&txq->head, bf_list);
-       ifp->if_opackets++;
+       if_statinc(ifp, if_opackets);
 
        sc->sc_tx_timer = 0;
 
        if (ds->ds_status1 & AR_TXS1_EXCESSIVE_RETRIES)
-               ifp->if_oerrors++;
+               if_statinc(ifp, if_oerrors);
 
        if (ds->ds_status1 & AR_TXS1_UNDERRUN)
                athn_inc_tx_trigger_level(sc);
@@ -1171,7 +1171,7 @@
 
                if (sc->sc_ops.tx(sc, m, ni, ATHN_TXFLAG_CAB) != 0) {
                        ieee80211_free_node(ni);
-                       ifp->if_oerrors++;
+                       if_statinc(ifp, if_oerrors);
                        break;
                }
        }
diff -r 100cff1f2786 -r 7dcb2aeff720 sys/dev/ic/arn9003.c
--- a/sys/dev/ic/arn9003.c      Wed Jan 29 13:47:31 2020 +0000
+++ b/sys/dev/ic/arn9003.c      Wed Jan 29 13:54:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arn9003.c,v 1.14 2019/11/10 21:16:35 chs Exp $ */
+/*     $NetBSD: arn9003.c,v 1.15 2020/01/29 14:09:58 thorpej Exp $     */
 /*     $OpenBSD: ar9003.c,v 1.25 2012/10/20 09:53:32 stsp Exp $        */
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.14 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arn9003.c,v 1.15 2020/01/29 14:09:58 thorpej Exp $");



Home | Main Index | Thread Index | Old Index