Module Name: src
Committed By: thorpej
Date: Sat Feb 1 21:45:11 UTC 2020
Modified Files:
src/sys/arch/arm/gemini: if_gpn.c
Log Message:
Adopt <net/if_stats.h>.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/gemini/if_gpn.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/gemini/if_gpn.c
diff -u src/sys/arch/arm/gemini/if_gpn.c:1.13 src/sys/arch/arm/gemini/if_gpn.c:1.14
--- src/sys/arch/arm/gemini/if_gpn.c:1.13 Wed Oct 30 10:12:37 2019
+++ src/sys/arch/arm/gemini/if_gpn.c Sat Feb 1 21:45:11 2020
@@ -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 @@ gpn_process_data(struct gpn_softc *sc, c
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 @@ gpn_process_data(struct gpn_softc *sc, c
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 @@ gpn_process_data(struct gpn_softc *sc, c
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 @@ gpn_ifstart(struct ifnet *ifp)
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 @@ gpn_ifstart(struct ifnet *ifp)
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 @@ gpn_ifstart(struct ifnet *ifp)
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 @@ gpn_ifstop(struct ifnet *ifp, int disabl
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;