Module Name: src
Committed By: thorpej
Date: Wed Jan 29 05:37:08 UTC 2020
Modified Files:
src/sys/arch/sgimips/hpc: if_sq.c
src/sys/arch/sgimips/mace: if_mec.c
Log Message:
Adopt <net/if_stats.h>.
To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sgimips/hpc/if_sq.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/sgimips/mace/if_mec.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/sgimips/hpc/if_sq.c
diff -u src/sys/arch/sgimips/hpc/if_sq.c:1.52 src/sys/arch/sgimips/hpc/if_sq.c:1.53
--- src/sys/arch/sgimips/hpc/if_sq.c:1.52 Thu May 23 13:10:51 2019
+++ src/sys/arch/sgimips/hpc/if_sq.c Wed Jan 29 05:37:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sq.c,v 1.52 2019/05/23 13:10:51 msaitoh Exp $ */
+/* $NetBSD: if_sq.c,v 1.53 2020/01/29 05:37:08 thorpej Exp $ */
/*
* Copyright (c) 2001 Rafal K. Boni
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.52 2019/05/23 13:10:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.53 2020/01/29 05:37:08 thorpej Exp $");
#include <sys/param.h>
@@ -860,7 +860,7 @@ sq_watchdog(struct ifnet *ifp)
memset(&sc->sq_trace, 0, sizeof(sc->sq_trace));
sc->sq_trace_idx = 0;
- ++ifp->if_oerrors;
+ if_statinc(ifp, if_oerrors);
sq_init(ifp);
}
@@ -988,7 +988,7 @@ sq_rxintr(struct sq_softc *sc)
pktstat = *((uint8_t *)m->m_data + framelen + 2);
if ((pktstat & RXSTAT_GOOD) == 0) {
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
if (pktstat & RXSTAT_OFLOW)
printf("%s: receive FIFO overflow\n",
@@ -1003,7 +1003,7 @@ sq_rxintr(struct sq_softc *sc)
}
if (sq_add_rxbuf(sc, i) != 0) {
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
bus_dmamap_sync(sc->sc_dmat, sc->sc_rxmap[i], 0,
sc->sc_rxmap[i]->dm_mapsize, BUS_DMASYNC_PREREAD);
SQ_INIT_RXDESC(sc, i);
@@ -1074,24 +1074,26 @@ sq_txintr(struct sq_softc *sc)
SQ_TRACE(SQ_TXINTR_ENTER, sc, sc->sc_prevtx, status);
+ net_stats_ref_t nsr = IF_STAT_GETREF(ifp);
tmp = (sc->hpc_regs->enetx_ctl_active >> shift) | TXSTAT_GOOD;
if ((status & tmp) == 0) {
if (status & TXSTAT_COLL)
- ifp->if_collisions++;
+ if_statinc_ref(nsr, if_collisions);
if (status & TXSTAT_UFLOW) {
printf("%s: transmit underflow\n",
device_xname(sc->sc_dev));
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
}
if (status & TXSTAT_16COLL) {
printf("%s: max collisions reached\n",
device_xname(sc->sc_dev));
- ifp->if_oerrors++;
- ifp->if_collisions += 16;
+ if_statinc_ref(nsr, if_oerrors);
+ if_statadd_ref(nsr, if_collisions, 16);
}
}
+ IF_STAT_PUTREF(ifp);
/* prevtx now points to next xmit packet not yet finished */
if (sc->hpc_regs->revision == 3)
@@ -1161,7 +1163,7 @@ sq_txring_hpc1(struct sq_softc *sc)
m_freem(sc->sc_txmbuf[i]);
sc->sc_txmbuf[i] = NULL;
- ifp->if_opackets++;
+ if_statinc(ifp, if_opackets);
sc->sc_nfreetx++;
SQ_TRACE(SQ_DONE_DMA, sc, i, status);
@@ -1249,7 +1251,7 @@ sq_txring_hpc3(struct sq_softc *sc)
m_freem(sc->sc_txmbuf[i]);
sc->sc_txmbuf[i] = NULL;
- ifp->if_opackets++;
+ if_statinc(ifp, if_opackets);
sc->sc_nfreetx++;
SQ_TRACE(SQ_DONE_DMA, sc, i, status);
Index: src/sys/arch/sgimips/mace/if_mec.c
diff -u src/sys/arch/sgimips/mace/if_mec.c:1.62 src/sys/arch/sgimips/mace/if_mec.c:1.63
--- src/sys/arch/sgimips/mace/if_mec.c:1.62 Thu Dec 26 04:53:11 2019
+++ src/sys/arch/sgimips/mace/if_mec.c Wed Jan 29 05:37:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mec.c,v 1.62 2019/12/26 04:53:11 msaitoh Exp $ */
+/* $NetBSD: if_mec.c,v 1.63 2020/01/29 05:37:08 thorpej Exp $ */
/*-
* Copyright (c) 2004, 2008 Izumi Tsutsui. All rights reserved.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.62 2019/12/26 04:53:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.63 2020/01/29 05:37:08 thorpej Exp $");
#include "opt_ddb.h"
@@ -1470,7 +1470,7 @@ mec_watchdog(struct ifnet *ifp)
struct mec_softc *sc = ifp->if_softc;
printf("%s: device timeout\n", device_xname(sc->sc_dev));
- ifp->if_oerrors++;
+ if_statinc(ifp, if_oerrors);
mec_init(ifp);
}
@@ -1665,7 +1665,7 @@ mec_rxintr(struct mec_softc *sc)
DPRINTF(MEC_DEBUG_RXINTR,
("%s: wrong packet\n", __func__));
dropit:
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
rxd->rxd_stat = 0;
MEC_RXSTATSYNC(sc, i, BUS_DMASYNC_PREREAD);
bus_space_write_8(st, sh, MEC_MCL_RX_FIFO,
@@ -1880,14 +1880,15 @@ mec_txintr(struct mec_softc *sc, uint32_
}
col = (txstat & MEC_TXSTAT_COLCNT) >> MEC_TXSTAT_COLCNT_SHIFT;
- ifp->if_collisions += col;
+ if (col)
+ if_statadd(ifp, if_collisions, col);
if ((txstat & MEC_TXSTAT_SUCCESS) == 0) {
printf("%s: TX error: txstat = 0x%016"PRIx64"\n",
device_xname(sc->sc_dev), txstat);
- ifp->if_oerrors++;
+ if_statinc(ifp, if_oerrors);
} else
- ifp->if_opackets++;
+ if_statinc(ifp, if_opackets);
}
/* update the dirty TX buffer pointer */