Adopt <net/if_stats.h>.

This commit is contained in:
thorpej 2020-01-29 15:00:39 +00:00
parent 1f99bccc85
commit 10ca93f873
10 changed files with 127 additions and 119 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: malo.c,v 1.17 2019/11/10 21:16:35 chs Exp $ */
/* $NetBSD: malo.c,v 1.18 2020/01/29 15:00:39 thorpej Exp $ */
/* $OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */
/*
@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.17 2019/11/10 21:16:35 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.18 2020/01/29 15:00:39 thorpej Exp $");
#include <sys/param.h>
#include <sys/types.h>
@ -1043,14 +1043,14 @@ malo_start(struct ifnet *ifp)
if (m0->m_len < sizeof (*eh) &&
(m0 = m_pullup(m0, sizeof (*eh))) == NULL) {
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
eh = mtod(m0, struct ether_header *);
ni = ieee80211_find_txnode(ic, eh->ether_dhost);
if (ni == NULL) {
m_freem(m0);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
@ -1066,7 +1066,7 @@ malo_start(struct ifnet *ifp)
if (malo_tx_data(sc, m0, ni) != 0) {
ieee80211_free_node(ni);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
break;
}
}
@ -1352,12 +1352,12 @@ malo_tx_intr(struct malo_softc *sc)
case MALO_TXD_STATUS_OK:
DPRINTF(2, "%s: data frame was sent successfully\n",
device_xname(sc->sc_dev));
ifp->if_opackets++;
if_statinc(ifp, if_opackets);
break;
default:
DPRINTF(1, "%s: data frame sending error\n",
device_xname(sc->sc_dev));
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
break;
}
@ -1415,7 +1415,7 @@ malo_tx_data(struct malo_softc *sc, struct mbuf *m0,
if (m0->m_len < sizeof(struct ieee80211_frame)) {
m0 = m_pullup(m0, sizeof(struct ieee80211_frame));
if (m0 == NULL) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
return (ENOBUFS);
}
}
@ -1555,14 +1555,14 @@ malo_rx_intr(struct malo_softc *sc)
MGETHDR(mnew, M_DONTWAIT, MT_DATA);
if (mnew == NULL) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
MCLGET(mnew, M_DONTWAIT);
if (!(mnew->m_flags & M_EXT)) {
m_freem(mnew);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1582,7 +1582,7 @@ malo_rx_intr(struct malo_softc *sc)
panic("%s: could not load old rx mbuf",
device_xname(sc->sc_dev));
}
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb86950.c,v 1.32 2019/05/29 10:07:29 msaitoh Exp $ */
/* $NetBSD: mb86950.c,v 1.33 2020/01/29 15:00:39 thorpej Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.32 2019/05/29 10:07:29 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.33 2020/01/29 15:00:39 thorpej Exp $");
/*
* Device driver for Fujitsu mb86950 based Ethernet cards.
@ -415,7 +415,7 @@ mb86950_watchdog(struct ifnet *ifp)
* Don't know how many packets are lost by this accident.
* ... So just errors = errors + 1
*/
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
mb86950_reset(sc);
}
@ -735,12 +735,12 @@ mb86950_tint(struct mb86950_softc *sc, u_int8_t tstat)
if (tstat & (TX_UNDERFLO | TX_BUS_WR_ERR)) {
/* XXX What do we need to do here? reset ? */
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
}
/* Excessive collision */
if (tstat & TX_16COL) {
ifp->if_collisions += 16;
if_statadd(ifp, if_collisions, 16);
/* 16 collisions means that the packet has been thrown away. */
if (sc->txb_sched > 0)
sc->txb_sched--;
@ -749,7 +749,7 @@ mb86950_tint(struct mb86950_softc *sc, u_int8_t tstat)
/* Transmission complete. */
if (tstat & TX_DONE) {
/* Successfully transmitted packets ++. */
ifp->if_opackets++;
if_statinc(ifp, if_opackets);
if (sc->txb_sched > 0)
sc->txb_sched--;
@ -757,7 +757,7 @@ mb86950_tint(struct mb86950_softc *sc, u_int8_t tstat)
if (tstat & TX_COL) {
col = (bus_space_read_1(bst, bsh, DLCR_TX_MODE)
& COL_MASK) >> 4;
ifp->if_collisions = ifp->if_collisions + col;
if_statadd(ifp, if_collisions, col);
}
}
@ -786,7 +786,7 @@ mb86950_rint(struct mb86950_softc *sc, u_int8_t rstat)
* count everything else
*/
if ((rstat & RX_BUS_RD_ERR) == 0) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
}
}
@ -810,7 +810,7 @@ mb86950_rint(struct mb86950_softc *sc, u_int8_t rstat)
/* Bad packet? */
if ((status & GOOD_PKT) == 0) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
mb86950_drain_fifo(sc);
continue;
}
@ -820,14 +820,14 @@ mb86950_rint(struct mb86950_softc *sc, u_int8_t rstat)
if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN)
|| len < ETHER_HDR_LEN) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
mb86950_drain_fifo(sc);
continue;
}
if (mb86950_get_fifo(sc, len) != 0) {
/* No mbufs? Drop packet. */
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
mb86950_drain_fifo(sc);
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb86960.c,v 1.93 2019/05/29 10:07:29 msaitoh Exp $ */
/* $NetBSD: mb86960.c,v 1.94 2020/01/29 15:00:39 thorpej Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.93 2019/05/29 10:07:29 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.94 2020/01/29 15:00:39 thorpej Exp $");
/*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
@ -427,7 +427,7 @@ mb86960_watchdog(struct ifnet *ifp)
#endif
/* Record how many packets are lost by this accident. */
sc->sc_ec.ec_if.if_oerrors += sc->txb_sched + sc->txb_count;
if_statadd(ifp, if_oerrors, sc->txb_sched + sc->txb_count);
mb86960_reset(sc);
}
@ -818,9 +818,11 @@ mb86960_tint(struct mb86960_softc *sc, uint8_t tstat)
/*
* Update statistics.
*/
ifp->if_collisions += 16;
ifp->if_oerrors++;
ifp->if_opackets += sc->txb_sched - left;
net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
if_statadd_ref(nsr, if_collisions, 16);
if_statinc_ref(nsr, if_oerrors);
if_statadd_ref(nsr, if_opackets, sc->txb_sched - left);
IF_STAT_PUTREF(ifp);
/*
* Collision statistics has been updated.
@ -889,7 +891,7 @@ mb86960_tint(struct mb86960_softc *sc, uint8_t tstat)
col = 1;
} else
col >>= FE_D4_COL_SHIFT;
ifp->if_collisions += col;
if_statadd(ifp, if_collisions, col);
#if FE_DEBUG >= 4
log(LOG_WARNING, "%s: %d collision%s (%d)\n",
device_xname(sc->sc_dev), col, col == 1 ? "" : "s",
@ -901,7 +903,7 @@ mb86960_tint(struct mb86960_softc *sc, uint8_t tstat)
* Update total number of successfully
* transmitted packets.
*/
ifp->if_opackets += sc->txb_sched;
if_statadd(ifp, if_opackets, sc->txb_sched);
sc->txb_sched = 0;
}
@ -948,7 +950,7 @@ mb86960_rint(struct mb86960_softc *sc, uint8_t rstat)
log(LOG_WARNING, "%s: receive error: %s\n",
device_xname(sc->sc_dev), sbuf);
#endif
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
}
/*
@ -988,7 +990,7 @@ mb86960_rint(struct mb86960_softc *sc, uint8_t rstat)
*/
if ((status & FE_RXSTAT_GOODPKT) == 0) {
if ((ifp->if_flags & IFF_PROMISC) == 0) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
mb86960_droppacket(sc);
continue;
}
@ -1022,7 +1024,7 @@ mb86960_rint(struct mb86960_softc *sc, uint8_t rstat)
device_xname(sc->sc_dev),
len < ETHER_HDR_LEN ? "partial" : "big", len);
#endif
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
mb86960_droppacket(sc);
continue;
}
@ -1051,7 +1053,7 @@ mb86960_rint(struct mb86960_softc *sc, uint8_t rstat)
"%s: out of mbufs; dropping packet (%u bytes)\n",
device_xname(sc->sc_dev), len);
#endif
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
mb86960_droppacket(sc);
/*
@ -1391,7 +1393,7 @@ mb86960_write_mbufs(struct mb86960_softc *sc, struct mbuf *m)
log(LOG_ERR, "%s: got a %s packet (%u bytes) to send\n",
device_xname(sc->sc_dev),
totlen < ETHER_HDR_LEN ? "partial" : "big", totlen);
sc->sc_ec.ec_if.if_oerrors++;
if_statinc(&sc->sc_ec.ec_if, if_oerrors);
return;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: mtd803.c,v 1.40 2019/05/30 02:32:18 msaitoh Exp $ */
/* $NetBSD: mtd803.c,v 1.41 2020/01/29 15:00:39 thorpej Exp $ */
/*-
*
@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.40 2019/05/30 02:32:18 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.41 2020/01/29 15:00:39 thorpej Exp $");
#include <sys/param.h>
@ -539,7 +539,7 @@ mtd_watchdog(struct ifnet *ifp)
int s;
log(LOG_ERR, "%s: device timeout\n", device_xname(sc->dev));
++sc->ethercom.ec_if.if_oerrors;
if_statinc(ifp, if_oerrors);
mtd_stop(ifp, 0);
@ -645,7 +645,7 @@ mtd_rxirq(struct mtd_softc *sc)
sc->desc[sc->cur_rx].stat = MTD_RXD_OWNER;
sc->desc[sc->cur_rx].conf = MTD_RXBUF_SIZE &
MTD_RXD_CONF_BUFS;
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
if (++sc->cur_rx >= MTD_NUM_RXD)
sc->cur_rx = 0;
continue;
@ -662,7 +662,7 @@ mtd_rxirq(struct mtd_softc *sc)
sc->desc[sc->cur_rx].stat = MTD_RXD_OWNER;
sc->desc[sc->cur_rx].conf = MTD_RXBUF_SIZE &
MTD_RXD_CONF_BUFS;
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
if (++sc->cur_rx >= MTD_NUM_RXD)
sc->cur_rx = 0;
continue;
@ -680,7 +680,7 @@ mtd_rxirq(struct mtd_softc *sc)
if (m == NULL) {
aprint_error_dev(sc->dev,
"error pulling packet off interface\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
continue;
}
@ -701,7 +701,7 @@ mtd_txirq(struct mtd_softc *sc)
ifp->if_timer = 0;
ifp->if_flags &= ~IFF_OACTIVE;
++ifp->if_opackets;
if_statinc(ifp, if_opackets);
/* XXX FIXME If there is some queued, do an mtd_start? */
@ -755,44 +755,44 @@ mtd_irq_h(void *args)
if (status & MTD_ISR_RXBUN) {
aprint_error_dev(sc->dev,
"receive buffer unavailable\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
}
if (status & MTD_ISR_RXERR) {
aprint_error_dev(sc->dev, "receive error\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
}
if (status & MTD_ISR_TXBUN) {
aprint_error_dev(sc->dev,
"transmit buffer unavailable\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
}
if ((status & MTD_ISR_PDF)) {
aprint_error_dev(sc->dev,
"parallel detection fault\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
}
if (status & MTD_ISR_FBUSERR) {
aprint_error_dev(sc->dev, "fatal bus error\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
}
if (status & MTD_ISR_TARERR) {
aprint_error_dev(sc->dev, "target error\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
}
if (status & MTD_ISR_MASTERR) {
aprint_error_dev(sc->dev, "master error\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
}
if (status & MTD_ISR_PARERR) {
aprint_error_dev(sc->dev, "parity error\n");
++ifp->if_ierrors;
if_statinc(ifp, if_ierrors);
}
if (status & MTD_ISR_RXIRQ) /* Receive interrupt */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rt2560.c,v 1.37 2019/11/10 21:16:35 chs Exp $ */
/* $NetBSD: rt2560.c,v 1.38 2020/01/29 15:06:12 thorpej Exp $ */
/* $OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $ */
/* $FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/
@ -24,7 +24,7 @@
* http://www.ralinktech.com/
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.37 2019/11/10 21:16:35 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.38 2020/01/29 15:06:12 thorpej Exp $");
#include <sys/param.h>
@ -1098,13 +1098,13 @@ rt2560_tx_intr(struct rt2560_softc *sc)
ieee80211_rssadapt_raise_rate(ic,
&rn->rssadapt, &data->id);
}
ifp->if_opackets++;
if_statinc(ifp, if_opackets);
break;
case RT2560_TX_SUCCESS_RETRY:
DPRINTFN(9, ("data frame sent after %u retries\n",
(le32toh(desc->flags) >> 5) & 0x7));
ifp->if_opackets++;
if_statinc(ifp, if_opackets);
break;
case RT2560_TX_FAIL_RETRY:
@ -1114,7 +1114,7 @@ rt2560_tx_intr(struct rt2560_softc *sc)
ieee80211_rssadapt_lower_rate(ic, data->ni,
&rn->rssadapt, &data->id);
}
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
break;
case RT2560_TX_FAIL_INVALID:
@ -1123,7 +1123,7 @@ rt2560_tx_intr(struct rt2560_softc *sc)
aprint_error_dev(sc->sc_dev,
"sending data frame failed 0x%08x\n",
le32toh(desc->flags));
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
}
bus_dmamap_sync(sc->sc_dmat, data->map, 0,
@ -1261,13 +1261,13 @@ rt2560_decryption_intr(struct rt2560_softc *sc)
break;
if (data->drop) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
if ((le32toh(desc->flags) & RT2560_RX_CIPHER_MASK) != 0 &&
(le32toh(desc->flags) & RT2560_RX_ICV_ERROR)) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1280,14 +1280,14 @@ rt2560_decryption_intr(struct rt2560_softc *sc)
*/
MGETHDR(mnew, M_DONTWAIT, MT_DATA);
if (mnew == NULL) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
MCLGET(mnew, M_DONTWAIT);
if (!(mnew->m_flags & M_EXT)) {
m_freem(mnew);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1311,7 +1311,7 @@ rt2560_decryption_intr(struct rt2560_softc *sc)
}
/* physical address may have changed */
desc->physaddr = htole32(data->map->dm_segs->ds_addr);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -2150,7 +2150,7 @@ rt2560_start(struct ifnet *ifp)
if (rt2560_tx_data(sc, m0, ni) != 0) {
ieee80211_free_node(ni);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
break;
}
}
@ -2171,7 +2171,7 @@ rt2560_watchdog(struct ifnet *ifp)
if (--sc->sc_tx_timer == 0) {
aprint_error_dev(sc->sc_dev, "device timeout\n");
rt2560_init(ifp);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
return;
}
ifp->if_timer = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rt2661.c,v 1.42 2019/11/10 21:16:35 chs Exp $ */
/* $NetBSD: rt2661.c,v 1.43 2020/01/29 15:06:12 thorpej Exp $ */
/* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */
/* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.42 2019/11/10 21:16:35 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.43 2020/01/29 15:06:12 thorpej Exp $");
#include <sys/param.h>
@ -946,7 +946,7 @@ rt2661_tx_intr(struct rt2661_softc *sc)
rn->amn.amn_txcnt++;
if (retrycnt > 0)
rn->amn.amn_retrycnt++;
ifp->if_opackets++;
if_statinc(ifp, if_opackets);
break;
case RT2661_TX_RETRY_FAIL:
@ -954,13 +954,13 @@ rt2661_tx_intr(struct rt2661_softc *sc)
"retries)\n"));
rn->amn.amn_txcnt++;
rn->amn.amn_retrycnt++;
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
break;
default:
/* other failure */
aprint_error_dev(sc->sc_dev, "sending data frame failed 0x%08x\n", val);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
}
ieee80211_free_node(data->ni);
@ -1050,12 +1050,12 @@ rt2661_rx_intr(struct rt2661_softc *sc)
*/
DPRINTFN(5, ("PHY or CRC error flags 0x%08x\n",
le32toh(desc->flags)));
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
if ((le32toh(desc->flags) & RT2661_RX_CIPHER_MASK) != 0) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1068,14 +1068,14 @@ rt2661_rx_intr(struct rt2661_softc *sc)
*/
MGETHDR(mnew, M_DONTWAIT, MT_DATA);
if (mnew == NULL) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
MCLGET(mnew, M_DONTWAIT);
if (!(mnew->m_flags & M_EXT)) {
m_freem(mnew);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1099,7 +1099,7 @@ rt2661_rx_intr(struct rt2661_softc *sc)
}
/* physical address may have changed */
desc->physaddr = htole32(data->map->dm_segs->ds_addr);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1863,7 +1863,7 @@ rt2661_start(struct ifnet *ifp)
ni = ieee80211_find_txnode(ic, eh->ether_dhost);
if (ni == NULL) {
m_freem(m0);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
@ -1871,14 +1871,14 @@ rt2661_start(struct ifnet *ifp)
m0 = ieee80211_encap(ic, m0, ni);
if (m0 == NULL) {
ieee80211_free_node(ni);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
bpf_mtap3(ic->ic_rawbpf, m0, BPF_D_OUT);
if (rt2661_tx_data(sc, m0, ni, 0) != 0) {
if (ni != NULL)
ieee80211_free_node(ni);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
break;
}
}
@ -1899,7 +1899,7 @@ rt2661_watchdog(struct ifnet *ifp)
if (--sc->sc_tx_timer == 0) {
aprint_error_dev(sc->sc_dev, "device timeout\n");
rt2661_init(ifp);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
return;
}
ifp->if_timer = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rt2860.c,v 1.34 2019/09/03 14:26:55 msaitoh Exp $ */
/* $NetBSD: rt2860.c,v 1.35 2020/01/29 15:06:12 thorpej Exp $ */
/* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */
/* $FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.34 2019/09/03 14:26:55 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.35 2020/01/29 15:06:12 thorpej Exp $");
#include <sys/param.h>
#include <sys/sockio.h>
@ -1266,7 +1266,7 @@ rt2860_drain_stats_fifo(struct rt2860_softc *sc)
amn->amn_retrycnt++;
} else {
amn->amn_retrycnt++;
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
}
}
}
@ -1300,7 +1300,7 @@ rt2860_tx_intr(struct rt2860_softc *sc, int qid)
SLIST_INSERT_HEAD(&sc->data_pool, data, next);
ring->data[ring->next] = NULL;
ifp->if_opackets++;
if_statinc(ifp, if_opackets);
}
ring->queued--;
ring->next = (ring->next + 1) % RT2860_TX_RING_COUNT;
@ -1366,7 +1366,7 @@ rt2860_rx_intr(struct rt2860_softc *sc)
if (__predict_false(rxd->flags &
htole32(RT2860_RX_CRCERR | RT2860_RX_ICVERR))) {
DPRINTF(("error %#x\n", rxd->flags));
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1374,14 +1374,14 @@ rt2860_rx_intr(struct rt2860_softc *sc)
MGETHDR(m1, M_DONTWAIT, MT_DATA);
if (__predict_false(m1 == NULL)) {
DPRINTF(("error2 %#x\n", rxd->flags));
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
MCLGET(m1, M_DONTWAIT);
if (__predict_false((m1->m_flags & M_EXT) == 0)) {
DPRINTF(("no mbuf\n"));
m_freem(m1);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1406,7 +1406,7 @@ rt2860_rx_intr(struct rt2860_softc *sc)
}
/* physical address may have changed */
rxd->sdp0 = htole32(data->map->dm_segs[0].ds_addr);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
@ -1446,7 +1446,7 @@ rt2860_rx_intr(struct rt2860_softc *sc)
/* report MIC failures to net80211 for TKIP */
ieee80211_notify_michael_failure(ic, wh, 0/* XXX */);
DPRINTF(("error2 %#x\n", rxd->flags));
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto skip;
}
#endif
@ -1906,7 +1906,7 @@ rt2860_start(struct ifnet *ifp)
if (m->m_len < (int)sizeof(*eh) &&
(m = m_pullup(m, sizeof(*eh))) == NULL) {
DPRINTF(("%s: nothing to send\n", __func__));
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
@ -1916,7 +1916,7 @@ rt2860_start(struct ifnet *ifp)
if (ni == NULL) {
DPRINTF(("%s: can't find tx node\n", __func__));
m_freem(m);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
@ -1925,7 +1925,7 @@ rt2860_start(struct ifnet *ifp)
if ((m = ieee80211_encap(ic, m, ni)) == NULL) {
DPRINTF(("%s: can't encap\n", __func__));
ieee80211_free_node(ni);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
sendit:
@ -1935,7 +1935,7 @@ sendit:
DPRINTF(("%s: can't tx\n", __func__));
m_freem(m);
ieee80211_free_node(ni);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
@ -1957,7 +1957,7 @@ rt2860_watchdog(struct ifnet *ifp)
aprint_error_dev(sc->sc_dev, "device timeout\n");
rt2860_stop(ifp, 0);
rt2860_init(ifp);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
return;
}
ifp->if_timer = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl8169.c,v 1.161 2019/12/17 10:42:06 msaitoh Exp $ */
/* $NetBSD: rtl8169.c,v 1.162 2020/01/29 15:06:12 thorpej Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.161 2019/12/17 10:42:06 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.162 2020/01/29 15:06:12 thorpej Exp $");
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
/*
@ -1263,7 +1263,7 @@ re_rxeof(struct rtk_softc *sc)
printf(", CRC error");
printf("\n");
#endif
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
/*
* If this is part of a multi-fragment packet,
* discard all the pieces.
@ -1282,7 +1282,7 @@ re_rxeof(struct rtk_softc *sc)
*/
if (__predict_false(re_newbuf(sc, i, NULL) != 0)) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
if (sc->re_head != NULL) {
m_freem(sc->re_head);
sc->re_head = sc->re_tail = NULL;
@ -1418,12 +1418,14 @@ re_txeof(struct rtk_softc *sc)
m_freem(txq->txq_mbuf);
txq->txq_mbuf = NULL;
net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
if (txstat & (RE_TDESC_STAT_EXCESSCOL | RE_TDESC_STAT_COLCNT))
ifp->if_collisions++;
if_statinc_ref(nsr, if_collisions);
if (txstat & RE_TDESC_STAT_TXERRSUM)
ifp->if_oerrors++;
if_statinc_ref(nsr, if_oerrors);
else
ifp->if_opackets++;
if_statinc_ref(nsr, if_opackets);
IF_STAT_PUTREF(ifp);
}
sc->re_ldata.re_txq_considx = idx;
@ -1631,7 +1633,7 @@ re_start(struct ifnet *ifp)
IFQ_DEQUEUE(&ifp->if_snd, m);
m_freem(m);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
continue;
}
@ -2097,7 +2099,7 @@ re_watchdog(struct ifnet *ifp)
sc = ifp->if_softc;
s = splnet();
printf("%s: watchdog timeout\n", device_xname(sc->sc_dev));
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
re_txeof(sc);
re_rxeof(sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtl81x9.c,v 1.107 2019/08/01 15:21:50 msaitoh Exp $ */
/* $NetBSD: rtl81x9.c,v 1.108 2020/01/29 15:06:12 thorpej Exp $ */
/*
* Copyright (c) 1997, 1998
@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.107 2019/08/01 15:21:50 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.108 2020/01/29 15:06:12 thorpej Exp $");
#include <sys/param.h>
@ -954,7 +954,7 @@ rtk_rxeof(struct rtk_softc *sc)
if ((rxstat & RTK_RXSTAT_RXOK) == 0 ||
total_len < ETHER_MIN_LEN ||
total_len > (MCLBYTES - RTK_ETHER_ALIGN)) {
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
/*
* submitted by:[netbsd-pcmcia:00484]
@ -1030,7 +1030,7 @@ rtk_rxeof(struct rtk_softc *sc)
if (m == NULL) {
printf("%s: unable to allocate Rx mbuf\n",
device_xname(sc->sc_dev));
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto next_packet;
}
if (total_len > (MHLEN - RTK_ETHER_ALIGN)) {
@ -1038,7 +1038,7 @@ rtk_rxeof(struct rtk_softc *sc)
if ((m->m_flags & M_EXT) == 0) {
printf("%s: unable to allocate Rx cluster\n",
device_xname(sc->sc_dev));
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
m_freem(m);
m = NULL;
goto next_packet;
@ -1116,12 +1116,14 @@ rtk_txeof(struct rtk_softc *sc)
m_freem(txd->txd_mbuf);
txd->txd_mbuf = NULL;
ifp->if_collisions += (txstat & RTK_TXSTAT_COLLCNT) >> 24;
net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
if_statadd_ref(nsr, if_collisions,
(txstat & RTK_TXSTAT_COLLCNT) >> 24);
if (txstat & RTK_TXSTAT_TX_OK)
ifp->if_opackets++;
if_statinc_ref(nsr, if_opackets);
else {
ifp->if_oerrors++;
if_statinc_ref(nsr, if_oerrors);
/*
* Increase Early TX threshold if underrun occurred.
@ -1146,6 +1148,7 @@ rtk_txeof(struct rtk_softc *sc)
if (txstat & (RTK_TXSTAT_TXABRT | RTK_TXSTAT_OUTOFWIN))
CSR_WRITE_4(sc, RTK_TXCFG, RTK_TXCFG_CONFIG);
}
IF_STAT_PUTREF(ifp);
SIMPLEQ_INSERT_TAIL(&sc->rtk_tx_free, txd, txd_q);
ifp->if_flags &= ~IFF_OACTIVE;
}
@ -1460,7 +1463,7 @@ rtk_watchdog(struct ifnet *ifp)
sc = ifp->if_softc;
printf("%s: watchdog timeout\n", device_xname(sc->sc_dev));
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
rtk_txeof(sc);
rtk_rxeof(sc);
rtk_init(ifp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtw.c,v 1.134 2019/11/10 21:16:35 chs Exp $ */
/* $NetBSD: rtw.c,v 1.135 2020/01/29 15:06:12 thorpej Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 David Young. All rights
* reserved.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.134 2019/11/10 21:16:35 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtw.c,v 1.135 2020/01/29 15:06:12 thorpej Exp $");
#include <sys/param.h>
@ -1523,7 +1523,7 @@ rtw_intr_rx(struct rtw_softc *sc, uint16_t isr)
aprint_error_dev(sc->sc_dev,
"DMA error/FIFO overflow %08" PRIx32 ", "
"rx descriptor %d\n", hstat, next);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto next;
}
@ -1537,7 +1537,7 @@ rtw_intr_rx(struct rtw_softc *sc, uint16_t isr)
"rx frame too long, %d > %d, %08" PRIx32
", desc %d\n",
len, rs->rs_mbuf->m_len, hstat, next);
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto next;
}
@ -1546,7 +1546,7 @@ rtw_intr_rx(struct rtw_softc *sc, uint16_t isr)
aprint_error_dev(sc->sc_dev,
"unknown rate #%" __PRIuBITS "\n",
__SHIFTOUT(hstat, RTW_RXSTAT_RATE_MASK));
ifp->if_ierrors++;
if_statinc(ifp, if_ierrors);
goto next;
}
rate = ratetbl[hwrate];
@ -1722,12 +1722,13 @@ rtw_collect_txpkt(struct rtw_softc *sc, struct rtw_txdesc_blk *tdb,
rts_retry = __SHIFTOUT(hstat, RTW_TXSTAT_RTSRETRY_MASK);
data_retry = __SHIFTOUT(hstat, RTW_TXSTAT_DRC_MASK);
ifp->if_collisions += rts_retry + data_retry;
if (rts_retry + data_retry)
if_statadd(ifp, if_collisions, rts_retry + data_retry);
if ((hstat & RTW_TXSTAT_TOK) != 0)
condstring = "ok";
else {
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
condstring = "error";
}
@ -3184,7 +3185,7 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp,
return 0;
}
DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: dequeue data frame\n", __func__));
ifp->if_opackets++;
if_statinc(ifp, if_opackets);
bpf_mtap(ifp, m0, BPF_D_OUT);
eh = mtod(m0, struct ether_header *);
*nip = ieee80211_find_txnode(&sc->sc_ic, eh->ether_dhost);
@ -3195,7 +3196,7 @@ rtw_dequeue(struct ifnet *ifp, struct rtw_txsoft_blk **tsbp,
}
if ((m0 = ieee80211_encap(&sc->sc_ic, m0, *nip)) == NULL) {
DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: encap error\n", __func__));
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
return -1;
}
DPRINTF(sc, RTW_DEBUG_XMIT, ("%s: leave\n", __func__));
@ -3580,7 +3581,7 @@ rtw_watchdog(struct ifnet *ifp)
continue;
printf("%s: transmit timeout, priority %d\n",
ifp->if_xname, pri);
ifp->if_oerrors++;
if_statinc(ifp, if_oerrors);
if (pri != RTW_TXPRIBCN)
tx_timeouts++;
} else