Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/c097d0555cdd
branches:  trunk
changeset: 744296:c097d0555cdd
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jan 29 05:52:27 2020 +0000

description:
Adopt <net/if_stats.h>.

diffstat:

 sys/arch/arm/imx/if_enet.c          |  23 ++++++------
 sys/arch/arm/sunxi/sun4i_emac.c     |  10 ++--
 sys/arch/arm/sunxi/sunxi_can.c      |  21 +++++------
 sys/arch/arm/sunxi/sunxi_emac.c     |   8 ++--
 sys/arch/arm/ti/if_cpsw.c           |  12 +++---
 sys/arch/arm/xscale/ixp425_if_npe.c |  29 +++++++++-------
 sys/dev/cadence/if_cemac.c          |  23 ++++++++-----
 sys/dev/hyperv/if_hvn.c             |  12 +++---
 sys/dev/qbus/if_de.c                |  18 +++++-----
 sys/dev/qbus/if_qt.c                |  44 +++++++++++-------------
 sys/dev/sbus/be.c                   |  16 ++++----
 sys/dev/sbus/qe.c                   |  64 +++++++++++++++++++-----------------
 sys/dev/scsipi/if_se.c              |  14 ++++----
 sys/dev/sdmmc/if_bwfm_sdio.c        |   4 +-
 sys/dist/pf/net/if_pflog.c          |   8 +++-
 sys/dist/pf/net/if_pfsync.c         |  12 +++++-
 16 files changed, 169 insertions(+), 149 deletions(-)

diffs (truncated from 1138 to 300 lines):

diff -r d5541d39e3a3 -r c097d0555cdd sys/arch/arm/imx/if_enet.c
--- a/sys/arch/arm/imx/if_enet.c        Wed Jan 29 05:50:34 2020 +0000
+++ b/sys/arch/arm/imx/if_enet.c        Wed Jan 29 05:52:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet.c,v 1.30 2020/01/15 01:09:56 jmcneill Exp $    */
+/*     $NetBSD: if_enet.c,v 1.31 2020/01/29 06:05:31 thorpej Exp $     */
 
 /*
  * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.30 2020/01/15 01:09:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.31 2020/01/29 06:05:31 thorpej Exp $");
 
 #include "vlan.h"
 
@@ -381,9 +381,10 @@
 #endif
 
        /* update counters */
-       ifp->if_ierrors += ENET_REG_READ(sc, ENET_RMON_R_UNDERSIZE);
-       ifp->if_ierrors += ENET_REG_READ(sc, ENET_RMON_R_FRAG);
-       ifp->if_ierrors += ENET_REG_READ(sc, ENET_RMON_R_JAB);
+       if_statadd(ifp, if_ierrors,
+           (uint64_t)ENET_REG_READ(sc, ENET_RMON_R_UNDERSIZE) +
+           (uint64_t)ENET_REG_READ(sc, ENET_RMON_R_FRAG) +
+           (uint64_t)ENET_REG_READ(sc, ENET_RMON_R_JAB));
 
        /* clear counters */
        ENET_REG_WRITE(sc, ENET_MIBC, ENET_MIBC_MIB_CLEAR);
@@ -461,7 +462,7 @@
                        bus_dmamap_unload(sc->sc_dmat,
                            txs->txs_dmamap);
                        m_freem(txs->txs_mbuf);
-                       ifp->if_opackets++;
+                       if_statinc(ifp, if_opackets);
                }
 
                /* checking error */
@@ -488,7 +489,7 @@
                                            "flags2=%s\n", idx, flagsbuf);
                                }
 #endif /* DEBUG_ENET */
-                               ifp->if_oerrors++;
+                               if_statinc(ifp, if_oerrors);
                        }
                }
 
@@ -589,7 +590,7 @@
                                            idx, flags1buf, flags2buf, amount);
                                }
 #endif /* DEBUG_ENET */
-                               ifp->if_ierrors++;
+                               if_statinc(ifp, if_ierrors);
                                m_freem(m0);
 
                        } else {
@@ -873,7 +874,7 @@
                        DEVICE_DPRINTF(
                            "TX descriptor is full. dropping packet\n");
                        m_freem(m);
-                       ifp->if_oerrors++;
+                       if_statinc(ifp, if_oerrors);
                        break;
                }
 
@@ -929,7 +930,7 @@
        s = splnet();
 
        device_printf(sc->sc_dev, "watchdog timeout\n");
-       ifp->if_oerrors++;
+       if_statinc(ifp, if_oerrors);
 
        /* salvage packets left in descriptors */
        enet_tx_intr(sc);
@@ -1322,7 +1323,7 @@
                            txs->txs_dmamap);
                        m_freem(txs->txs_mbuf);
 
-                       ifp->if_oerrors++;
+                       if_statinc(ifp, if_oerrors);
                }
                sc->sc_tx_free++;
        }
diff -r d5541d39e3a3 -r c097d0555cdd sys/arch/arm/sunxi/sun4i_emac.c
--- a/sys/arch/arm/sunxi/sun4i_emac.c   Wed Jan 29 05:50:34 2020 +0000
+++ b/sys/arch/arm/sunxi/sun4i_emac.c   Wed Jan 29 05:52:27 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun4i_emac.c,v 1.11 2019/05/28 07:41:46 msaitoh Exp $ */
+/* $NetBSD: sun4i_emac.c,v 1.12 2020/01/29 06:05:31 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2013-2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.11 2019/05/28 07:41:46 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.12 2020/01/29 06:05:31 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -569,13 +569,13 @@
                uint32_t rxsts = __SHIFTOUT(rxhdr, EMAC_RXHDR_STS);
 
                if (rxlen < ETHER_MIN_LEN || (rxsts & EMAC_RX_STA_PKTOK) == 0) {
-                       sc->sc_ec.ec_if.if_ierrors++;
+                       if_statinc(&sc->sc_ec.ec_if, if_ierrors);
                        continue;
                }
 
                m = sun4i_emac_mgethdr(sc, rxlen);
                if (m == NULL) {
-                       sc->sc_ec.ec_if.if_ierrors++;
+                       if_statinc(&sc->sc_ec.ec_if, if_ierrors);
                        sun4i_emac_rxfifo_consume(sc, rxlen);
                        return;
                }
@@ -831,7 +831,7 @@
 
        device_printf(sc->sc_dev, "device timeout\n");
 
-       ifp->if_oerrors++;
+       if_statinc(ifp, if_oerrors);
        sun4i_emac_ifinit(ifp);
        sun4i_emac_ifstart(ifp);
 }
diff -r d5541d39e3a3 -r c097d0555cdd sys/arch/arm/sunxi/sunxi_can.c
--- a/sys/arch/arm/sunxi/sunxi_can.c    Wed Jan 29 05:50:34 2020 +0000
+++ b/sys/arch/arm/sunxi/sunxi_can.c    Wed Jan 29 05:52:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sunxi_can.c,v 1.2 2019/10/21 08:00:58 msaitoh Exp $    */
+/*     $NetBSD: sunxi_can.c,v 1.3 2020/01/29 06:05:31 thorpej Exp $    */
 
 /*-
  * Copyright (c) 2017,2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.2 2019/10/21 08:00:58 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.3 2020/01/29 06:05:31 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -253,14 +253,14 @@
        dlc = reg0v & SUNXI_CAN_TXBUF0_DL;
 
        if (dlc > CAN_MAX_DLC) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                sunxi_can_write(sc, SUNXI_CAN_CMD_REG, SUNXI_CAN_CMD_REL_RX_BUF);
                return;
        }
                
        m = m_gethdr(M_NOWAIT, MT_HEADER);
        if (m == NULL) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                sunxi_can_write(sc, SUNXI_CAN_CMD_REG, SUNXI_CAN_CMD_REL_RX_BUF);
                return;
        }
@@ -292,7 +292,7 @@
        }
        sunxi_can_write(sc, SUNXI_CAN_CMD_REG, SUNXI_CAN_CMD_REL_RX_BUF);
        m->m_len = m->m_pkthdr.len = CAN_MTU;
-       ifp->if_ibytes += m->m_len;
+       if_statadd(ifp, if_ibytes, m->m_len);
        m_set_rcvif(m, ifp);
        can_bpf_mtap(ifp, m, 1);
        can_input(ifp, m);
@@ -306,8 +306,7 @@
 
        KASSERT(mutex_owned(&sc->sc_intr_lock));
        if ((m = sc->sc_m_transmit) != NULL) {
-               ifp->if_obytes += m->m_len;
-               ifp->if_opackets++;
+               if_statadd2(ifp, if_obytes, m->m_len, if_opackets, 1);
                can_mbuf_tag_clean(m);
                m_set_rcvif(m, ifp);
                can_input(ifp, m); /* loopback */
@@ -346,7 +345,7 @@
        uint32_t reg;
 
        if (irq & SUNXI_CAN_INT_DATA_OR) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                sunxi_can_write(sc, SUNXI_CAN_CMD_REG, SUNXI_CAN_CMD_CLR_OR);
        }
        if (irq & SUNXI_CAN_INT_ERR) {
@@ -359,7 +358,7 @@
                if (sts & SUNXI_CAN_STA_TX)
                        txerr++;
                if (sts & SUNXI_CAN_STA_RX)
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
        }
        if (irq & SUNXI_CAN_INT_ERR_PASSIVE) {
                printf("%s: PASSV interrupt status 0x%x\n",
@@ -369,7 +368,7 @@
                txerr++;
        }
        if (txerr) {
-               ifp->if_oerrors += txerr;
+               if_statadd(ifp, if_oerrors, txerr);
                (void) sunxi_can_tx_abort(sc);
        }
 }
@@ -603,7 +602,7 @@
            sunxi_can_read(sc, SUNXI_CAN_REC_REG));
        /* if there is a transmit in progress abort */
        if (sunxi_can_tx_abort(sc)) {
-               ifp->if_oerrors++;
+               if_statinc(ifp, if_oerrors);
        }
        mutex_exit(&sc->sc_intr_lock);
 }
diff -r d5541d39e3a3 -r c097d0555cdd sys/arch/arm/sunxi/sunxi_emac.c
--- a/sys/arch/arm/sunxi/sunxi_emac.c   Wed Jan 29 05:50:34 2020 +0000
+++ b/sys/arch/arm/sunxi/sunxi_emac.c   Wed Jan 29 05:52:27 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.28 2019/07/13 21:56:23 thorpej Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.29 2020/01/29 06:05:31 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.28 2019/07/13 21:56:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.29 2020/01/29 06:05:31 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -828,7 +828,7 @@
                                /* XXX hole in RX ring */
                        }
                } else
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
 
                sunxi_emac_dma_sync(sc, sc->rx.desc_tag, sc->rx.desc_map,
                    index, index + 1,
@@ -876,7 +876,7 @@
                    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
                ifp->if_flags &= ~IFF_OACTIVE;
-               ifp->if_opackets++;
+               if_statinc(ifp, if_opackets);
        }
 
        sc->tx.next = i;
diff -r d5541d39e3a3 -r c097d0555cdd sys/arch/arm/ti/if_cpsw.c
--- a/sys/arch/arm/ti/if_cpsw.c Wed Jan 29 05:50:34 2020 +0000
+++ b/sys/arch/arm/ti/if_cpsw.c Wed Jan 29 05:52:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cpsw.c,v 1.10 2020/01/06 06:50:00 msaitoh Exp $     */
+/*     $NetBSD: if_cpsw.c,v 1.11 2020/01/29 06:05:31 thorpej Exp $     */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.10 2020/01/06 06:50:00 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: if_cpsw.c,v 1.11 2020/01/29 06:05:31 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -629,7 +629,7 @@
                        device_printf(sc->sc_dev, "won't fit\n");
                        IFQ_DEQUEUE(&ifp->if_snd, m);
                        m_freem(m);
-                       ifp->if_oerrors++;
+                       if_statinc(ifp, if_oerrors);
                        continue;
                } else if (error != 0) {
                        device_printf(sc->sc_dev, "error\n");
@@ -739,7 +739,7 @@
 
        device_printf(sc->sc_dev, "device timeout\n");
 
-       ifp->if_oerrors++;
+       if_statinc(ifp, if_oerrors);
        cpsw_init(ifp);
        cpsw_start(ifp);
 }
@@ -1169,7 +1169,7 @@
 
                if (cpsw_new_rxbuf(sc, i) != 0) {
                        /* drop current packet, reuse buffer for new */
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
                        goto next;
                }
 



Home | Main Index | Thread Index | Old Index