@@ -1,4 +1,4 @@
-/* $NetBSD: be.c,v 1.94 2019/05/29 10:07:30 msaitoh Exp $ */
+/* $NetBSD: be.c,v 1.95 2020/01/29 05:59:06 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.94 2019/05/29 10:07:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.95 2020/01/29 05:59:06 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -550,7 +550,7 @@
printf("%s: invalid packet size %d; dropping\n",
ifp->if_xname, len);
#endif
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
return;
}
@@ -559,7 +559,7 @@
*/
m = be_get(sc, idx, len);
if (m == NULL) {
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
return;
}
@@ -686,7 +686,7 @@
struct be_softc *sc = ifp->if_softc;
log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
- ++sc->sc_ethercom.ec_if.if_oerrors;
+ if_statinc(ifp, if_oerrors);
bereset(sc);
}
@@ -850,11 +850,11 @@
/*
* Unload collision counters
*/
- ifp->if_collisions +=
+ if_statadd(ifp, if_collisions,
bus_space_read_4(t, br, BE_BRI_NCCNT) +
bus_space_read_4(t, br, BE_BRI_FCCNT) +
bus_space_read_4(t, br, BE_BRI_EXCNT) +
- bus_space_read_4(t, br, BE_BRI_LTCNT);
+ bus_space_read_4(t, br, BE_BRI_LTCNT));
/*
* the clear the hardware counters
@@ -876,7 +876,7 @@
break;
ifp->if_flags &= ~IFF_OACTIVE;
- ifp->if_opackets++;
+ if_statinc(ifp, if_opackets);
if (++bix == QEC_XD_RING_MAXSIZE)
bix = 0;
@@ -1,4 +1,4 @@
-/* $NetBSD: qe.c,v 1.75 2019/05/29 10:07:30 msaitoh Exp $ */
+/* $NetBSD: qe.c,v 1.76 2020/01/29 05:59:06 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.75 2019/05/29 10:07:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.76 2020/01/29 05:59:06 thorpej Exp $");
#define QEDEBUG
@@ -406,7 +406,7 @@
printf("%s: invalid packet size %d; dropping\n",
ifp->if_xname, len);
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
return;
}
@@ -415,7 +415,7 @@
*/
m = qe_get(sc, idx, len);
if (m == NULL) {
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
return;
}
@@ -532,7 +532,7 @@
struct qe_softc *sc = ifp->if_softc;
log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
- ifp->if_oerrors++;
+ if_statinc(ifp, if_oerrors);
qereset(sc);
}
@@ -627,7 +627,7 @@
break;
ifp->if_flags &= ~IFF_OACTIVE;
- ifp->if_opackets++;
+ if_statinc(ifp, if_opackets);
if (++bix == QEC_XD_RING_MAXSIZE)
bix = 0;
@@ -705,21 +705,23 @@
const char *xname = device_xname(self);
int r = 0, rst = 0;
+ net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+
if (why & QE_CR_STAT_EDEFER) {
printf("%s: excessive tx defers.\n", xname);
r |= 1;
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
}
if (why & QE_CR_STAT_CLOSS) {
printf("%s: no carrier, link down?\n", xname);
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
r |= 1;
}
if (why & QE_CR_STAT_ERETRIES) {
printf("%s: excessive tx retries\n", xname);
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
r |= 1;
rst = 1;
}
@@ -727,14 +729,14 @@
if (why & QE_CR_STAT_LCOLL) {
printf("%s: late tx transmission\n", xname);
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_FUFLOW) {
printf("%s: tx fifo underflow\n", xname);
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
r |= 1;
rst = 1;
}
@@ -750,8 +752,8 @@
}
if (why & QE_CR_STAT_TCCOFLOW) {
- ifp->if_collisions += 256;
- ifp->if_oerrors += 256;
+ if_statadd_ref(nsr, if_collisions, 256);
+ if_statadd_ref(nsr, if_oerrors, 256);
r |= 1;
}
@@ -763,97 +765,99 @@
if (why & QE_CR_STAT_TXLERR) {
printf("%s: tx late error\n", xname);
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
rst = 1;
r |= 1;
}
if (why & QE_CR_STAT_TXPERR) {
printf("%s: tx DMA parity error\n", xname);
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
rst = 1;
r |= 1;
}
if (why & QE_CR_STAT_TXSERR) {
printf("%s: tx DMA sbus error ack\n", xname);
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
rst = 1;
r |= 1;
}
if (why & QE_CR_STAT_RCCOFLOW) {
- ifp->if_collisions += 256;
- ifp->if_ierrors += 256;
+ if_statadd_ref(nsr, if_collisions, 256);
+ if_statadd_ref(nsr, if_ierrors, 256);
r |= 1;
}
if (why & QE_CR_STAT_RUOFLOW) {
- ifp->if_ierrors += 256;
+ if_statadd_ref(nsr, if_ierrors, 256);
r |= 1;
}
if (why & QE_CR_STAT_MCOFLOW) {
- ifp->if_ierrors += 256;
+ if_statadd_ref(nsr, if_ierrors, 256);
r |= 1;
}
if (why & QE_CR_STAT_RXFOFLOW) {
printf("%s: rx fifo overflow\n", xname);
- ifp->if_ierrors++;
+ if_statinc_ref(nsr, if_ierrors);
r |= 1;
}
if (why & QE_CR_STAT_RLCOLL) {
printf("%s: rx late collision\n", xname);
- ifp->if_ierrors++;
- ifp->if_collisions++;
+ if_statinc_ref(nsr, if_ierrors);
+ if_statinc_ref(nsr, if_collisions);
r |= 1;
}
if (why & QE_CR_STAT_FCOFLOW) {
- ifp->if_ierrors += 256;
+ if_statadd_ref(nsr, if_ierrors, 256);
r |= 1;
}
if (why & QE_CR_STAT_CECOFLOW) {
- ifp->if_ierrors += 256;
+ if_statadd_ref(nsr, if_ierrors, 256);
r |= 1;
}
if (why & QE_CR_STAT_RXDROP) {
printf("%s: rx packet dropped\n", xname);
- ifp->if_ierrors++;
+ if_statinc_ref(nsr, if_ierrors);
r |= 1;
}
if (why & QE_CR_STAT_RXSMALL) {
printf("%s: rx buffer too small\n", xname);
- ifp->if_ierrors++;
+ if_statinc_ref(nsr, if_ierrors);
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_RXLERR) {
printf("%s: rx late error\n", xname);
- ifp->if_ierrors++;
+ if_statinc_ref(nsr, if_ierrors);
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_RXPERR) {
printf("%s: rx DMA parity error\n", xname);
- ifp->if_ierrors++;
+ if_statinc_ref(nsr, if_ierrors);
r |= 1;
rst = 1;
}
if (why & QE_CR_STAT_RXSERR) {
printf("%s: rx DMA sbus error ack\n", xname);
- ifp->if_ierrors++;
+ if_statinc_ref(nsr, if_ierrors);
r |= 1;
rst = 1;
}
+
+ IF_STAT_PUTREF(ifp);
if (r == 0)
aprint_error_dev(self, "unexpected interrupt error: %08x\n",