Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/9a40fcc7132c
branches:  trunk
changeset: 968950:9a40fcc7132c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Feb 01 21:45:11 2020 +0000

description:
Adopt <net/if_stats.h>.

diffstat:

 sys/arch/arm/gemini/if_gmc.c |   8 ++++----
 sys/arch/arm/gemini/if_gpn.c |  24 ++++++++++++------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diffs (133 lines):

diff -r 183403f0ad33 -r 9a40fcc7132c sys/arch/arm/gemini/if_gmc.c
--- a/sys/arch/arm/gemini/if_gmc.c      Sat Feb 01 21:14:44 2020 +0000
+++ b/sys/arch/arm/gemini/if_gmc.c      Sat Feb 01 21:45:11 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gmc.c,v 1.12 2019/05/28 08:59:33 msaitoh Exp $ */
+/* $NetBSD: if_gmc.c,v 1.13 2020/02/01 21:46:49 thorpej Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,7 +47,7 @@
 #include <net/if_ether.h>
 #include <net/if_dl.h>
 
-__KERNEL_RCSID(0, "$NetBSD: if_gmc.c,v 1.12 2019/05/28 08:59:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gmc.c,v 1.13 2020/02/01 21:46:49 thorpej Exp $");
 
 #define        MAX_TXSEG       32
 
@@ -134,7 +134,7 @@
                    error);
                gmac_mapcache_put(hwq->hwq_hqm->hqm_mc, map);
                m_freem(m);
-               sc->sc_if.if_oerrors++;
+               if_statinc(&sc->sc_if, if_oerrors);
                return true;
        }
        KASSERT(map->dm_nsegs > 0);
@@ -702,7 +702,7 @@
                        gmac_swfree_min_update(psc);
                }
 #endif
-               sc->sc_if.if_ierrors++;
+               if_statinc(&sc->sc_if, if_ierrors);
        }
        if (status & INT4_RGMII_STSCHG) {
                mii_pollstat(&sc->sc_mii);
diff -r 183403f0ad33 -r 9a40fcc7132c sys/arch/arm/gemini/if_gpn.c
--- a/sys/arch/arm/gemini/if_gpn.c      Sat Feb 01 21:14:44 2020 +0000
+++ b/sys/arch/arm/gemini/if_gpn.c      Sat Feb 01 21:45:11 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gpn.c,v 1.13 2019/10/30 10:12:37 msaitoh Exp $ */
+/* $NetBSD: if_gpn.c,v 1.14 2020/02/01 21:45:11 thorpej Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include "opt_gemini.h"
 
-__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.13 2019/10/30 10:12:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.14 2020/02/01 21:45:11 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -252,12 +252,12 @@
        bool ok;
 
        if ((subtype & GPN_SOF) == 0 && sc->sc_rxmbuf == NULL) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                goto out;
        }
 
        if ((subtype & GPN_SOF) && sc->sc_rxmbuf != NULL) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                m_freem(sc->sc_rxmbuf);
                sc->sc_rxmbuf = NULL;
        }
@@ -266,13 +266,13 @@
                struct mbuf *m;
                MGETHDR(m, M_DONTWAIT, MT_DATA);
                if (m == NULL) {
-                       ifp->if_ierrors++;
+                       if_statinc(ifp, if_ierrors);
                        goto out;
                }
                if (pktlen > MHLEN - 2) {
                        MCLGET(m, M_DONTWAIT);
                        if ((m->m_flags & M_EXT) == 0) {
-                               ifp->if_ierrors++;
+                               if_statinc(ifp, if_ierrors);
                                m_free(m);
                                goto out;
                        }
@@ -287,7 +287,7 @@
        if (ok && gd->gd_addr2 && gd->gd_len2)
                ok = gpn_add_data(sc, gd->gd_addr2, gd->gd_len2);
        if (!ok) {
-               ifp->if_ierrors++;
+               if_statinc(ifp, if_ierrors);
                m_freem(sc->sc_rxmbuf);
                sc->sc_rxmbuf = NULL;
                goto out;
@@ -411,6 +411,7 @@
                gd.gd_tag = IPM_TAG_GPN;
                gd.gd_subtype = GPN_SOF;
                gd.gd_pktlen64 = (m->m_pkthdr.len + 63) >> 6;
+               net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
                for (; m != NULL; m = m0) {
                        struct gpn_txinfo *ti;
                        bus_dmamap_t map;
@@ -442,7 +443,7 @@
                            mtod(m, void *), m->m_len, NULL,
                            BUS_DMA_READ | BUS_DMA_NOWAIT);
                        if (error) {
-                               ifp->if_oerrors++;
+                               if_statinc_ref(nsr, if_oerrors);
                                m_freem(m);
                                break;
                        }
@@ -465,9 +466,10 @@
                        gd.gd_txid = id;
                        ti->ti_mbuf = m;
                        last_gd = &gd;
-                       ifp->if_obytes += m->m_len;
+                       if_statadd_ref(nsr, if_obytes, m->m_len);
                }
-               ifp->if_opackets++;
+               if_statinc_ref(nsr, if_opackets);
+               IF_STAT_PUTREF(ifp);
 
                /*
                 * XXX XXX 'last_gd' could be NULL
@@ -608,8 +610,6 @@
 static int
 gpn_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
-       struct gpn_softc * const sc = ifp->if_softc;
-       struct ifreq * const ifr = data;
        struct ifaliasreq * const ifra = data;
        int s, error;
 



Home | Main Index | Thread Index | Old Index