Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Adopt <net/if_stats.h>.
details: https://anonhg.NetBSD.org/src/rev/f371be46c6f2
branches: trunk
changeset: 744292:f371be46c6f2
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Jan 29 05:30:14 2020 +0000
description:
Adopt <net/if_stats.h>.
diffstat:
sys/arch/mips/adm5120/dev/if_admsw.c | 8 ++++----
sys/arch/mips/alchemy/dev/if_aumac.c | 18 ++++++++++--------
sys/arch/mips/atheros/dev/if_ae.c | 29 ++++++++++++++++-------------
sys/arch/mips/cavium/dev/if_cnmac.c | 8 ++++----
sys/arch/mips/cavium/dev/octeon_gmx.c | 26 ++++++++++++++------------
sys/arch/mips/cavium/dev/octeon_pip.c | 6 +++---
sys/arch/mips/ralink/ralink_eth.c | 8 ++++----
sys/arch/mips/sibyte/dev/sbmac.c | 6 +++---
sys/arch/next68k/dev/mb8795.c | 23 ++++++++++-------------
sys/arch/playstation2/dev/if_smap.c | 18 +++++++++---------
sys/arch/powerpc/booke/dev/pq3etsec.c | 16 +++++++++-------
sys/arch/powerpc/ibm4xx/dev/if_emac.c | 22 +++++++++++-----------
sys/arch/sgimips/hpc/if_sq.c | 24 +++++++++++++-----------
sys/arch/sgimips/mace/if_mec.c | 15 ++++++++-------
sys/arch/sun2/dev/if_ec.c | 14 +++++++-------
sys/arch/sun3/dev/if_ie.c | 22 +++++++++++-----------
16 files changed, 136 insertions(+), 127 deletions(-)
diffs (truncated from 909 to 300 lines):
diff -r 759bb254a7f2 -r f371be46c6f2 sys/arch/mips/adm5120/dev/if_admsw.c
--- a/sys/arch/mips/adm5120/dev/if_admsw.c Wed Jan 29 05:27:05 2020 +0000
+++ b/sys/arch/mips/adm5120/dev/if_admsw.c Wed Jan 29 05:30:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_admsw.c,v 1.27 2019/12/05 06:25:33 msaitoh Exp $ */
+/* $NetBSD: if_admsw.c,v 1.28 2020/01/29 05:30:14 thorpej Exp $ */
/*-
* Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.27 2019/12/05 06:25:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_admsw.c,v 1.28 2020/01/29 05:30:14 thorpej Exp $");
#include <sys/param.h>
@@ -871,7 +871,7 @@
gotone = 1;
/* printf("clear tx slot %d\n", i); */
- ifp->if_opackets++;
+ if_statinc(ifp, if_opackets);
sc->sc_txfree++;
}
@@ -995,7 +995,7 @@
m = ds->ds_mbuf;
if (admsw_add_rxlbuf(sc, i) != 0) {
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
ADMSW_INIT_RXLDESC(sc, i);
bus_dmamap_sync(sc->sc_dmat, ds->ds_dmamap, 0,
ds->ds_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
diff -r 759bb254a7f2 -r f371be46c6f2 sys/arch/mips/alchemy/dev/if_aumac.c
--- a/sys/arch/mips/alchemy/dev/if_aumac.c Wed Jan 29 05:27:05 2020 +0000
+++ b/sys/arch/mips/alchemy/dev/if_aumac.c Wed Jan 29 05:30:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aumac.c,v 1.47 2019/05/28 07:41:47 msaitoh Exp $ */
+/* $NetBSD: if_aumac.c,v 1.48 2020/01/29 05:30:14 thorpej Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.47 2019/05/28 07:41:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.48 2020/01/29 05:30:14 thorpej Exp $");
@@ -565,16 +565,18 @@
stat = bus_space_read_4(sc->sc_st, sc->sc_dma_sh,
MACDMA_TX_STAT(i));
+ net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
if (stat & TX_STAT_FA) {
/* XXX STATS */
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
} else
- ifp->if_opackets++;
+ if_statinc_ref(nsr, if_opackets);
if (stat & TX_STAT_EC)
- ifp->if_collisions += 16;
- else
- ifp->if_collisions += TX_STAT_CC(stat);
+ if_statadd_ref(nsr, if_collisions, 16);
+ else if (TX_STAT_CC(stat))
+ if_statadd_ref(nsr, if_collisions, TX_STAT_CC(stat));
+ IF_STAT_PUTREF(ifp);
sc->sc_txfree++;
ifp->if_flags &= ~IFF_OACTIVE;
@@ -670,7 +672,7 @@
PRINTERR("dribbling bit");
}
#undef PRINTERR
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
dropit:
/* reuse the current descriptor */
diff -r 759bb254a7f2 -r f371be46c6f2 sys/arch/mips/atheros/dev/if_ae.c
--- a/sys/arch/mips/atheros/dev/if_ae.c Wed Jan 29 05:27:05 2020 +0000
+++ b/sys/arch/mips/atheros/dev/if_ae.c Wed Jan 29 05:30:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $Id: if_ae.c,v 1.37 2019/09/13 07:55:06 msaitoh Exp $ */
+/* $Id: if_ae.c,v 1.38 2020/01/29 05:30:14 thorpej Exp $ */
/*-
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
* Copyright (c) 2006 Garrett D'Amore.
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.37 2019/09/13 07:55:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.38 2020/01/29 05:30:14 thorpej Exp $");
#include <sys/param.h>
@@ -784,7 +784,7 @@
if (doing_transmit) {
printf("%s: transmit timeout\n", device_xname(sc->sc_dev));
- ifp->if_oerrors++;
+ if_statinc(ifp, if_oerrors);
}
else
printf("%s: spurious watchdog timeout\n", device_xname(sc->sc_dev));
@@ -1033,7 +1033,7 @@
* If any collisions were seen on the wire, count one.
*/
if (rxstat & ADSTAT_Rx_CS)
- ifp->if_collisions++;
+ if_statinc(ifp, if_collisions);
/*
* If an error occurred, update stats, clear the status
@@ -1050,7 +1050,7 @@
if (rxstat & (bit)) \
printf("%s: receive error: %s\n", \
device_xname(sc->sc_dev), str)
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
PRINTERR(ADSTAT_Rx_DE, "descriptor error");
PRINTERR(ADSTAT_Rx_RF, "runt frame");
PRINTERR(ADSTAT_Rx_TL, "frame too long");
@@ -1084,7 +1084,7 @@
*/
m = rxs->rxs_mbuf;
if (ae_add_rxbuf(sc, i) != 0) {
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
AE_INIT_RXDESC(sc, i);
bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0,
rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -1100,7 +1100,7 @@
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
dropit:
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
AE_INIT_RXDESC(sc, i);
bus_dmamap_sync(sc->sc_dmat, rxs->rxs_dmamap, 0,
rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -1216,17 +1216,20 @@
sc->sc_stats.ts_tx_lc++;
#endif
+ net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
if (txstat & (ADSTAT_Tx_UF | ADSTAT_Tx_TO))
- ifp->if_oerrors++;
+ if_statinc_ref(nsr, if_oerrors);
if (txstat & ADSTAT_Tx_EC)
- ifp->if_collisions += 16;
- else
- ifp->if_collisions += ADSTAT_Tx_COLLISIONS(txstat);
+ if_statadd_ref(nsr, if_collisions, 16);
+ else if (ADSTAT_Tx_COLLISIONS(txstat))
+ if_statadd_ref(nsr, if_collisions,
+ ADSTAT_Tx_COLLISIONS(txstat));
if (txstat & ADSTAT_Tx_LC)
- ifp->if_collisions++;
+ if_statinc_ref(nsr, if_collisions);
- ifp->if_opackets++;
+ if_statinc_ref(nsr, if_opackets);
+ IF_STAT_PUTREF(ifp);
}
/*
diff -r 759bb254a7f2 -r f371be46c6f2 sys/arch/mips/cavium/dev/if_cnmac.c
--- a/sys/arch/mips/cavium/dev/if_cnmac.c Wed Jan 29 05:27:05 2020 +0000
+++ b/sys/arch/mips/cavium/dev/if_cnmac.c Wed Jan 29 05:30:14 2020 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: if_cnmac.c,v 1.15 2019/12/28 02:58:59 gutteridge Exp $ */
+/* $NetBSD: if_cnmac.c,v 1.16 2020/01/29 05:30:14 thorpej Exp $ */
#include <sys/cdefs.h>
#if 0
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.15 2019/12/28 02:58:59 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.16 2020/01/29 05:30:14 thorpej Exp $");
#endif
#include "opt_octeon.h"
@@ -1487,14 +1487,14 @@
OCTEON_ETH_KASSERT(ifp != NULL);
if (__predict_false(octeon_eth_recv_check(sc, word2) != 0)) {
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
result = 1;
octeon_eth_buf_free_work(sc, work, word2);
goto drop;
}
if (__predict_false(octeon_eth_recv_mbuf(sc, work, &m) != 0)) {
- ifp->if_ierrors++;
+ if_statinc(ifp, if_ierrors);
result = 1;
octeon_eth_buf_free_work(sc, work, word2);
goto drop;
diff -r 759bb254a7f2 -r f371be46c6f2 sys/arch/mips/cavium/dev/octeon_gmx.c
--- a/sys/arch/mips/cavium/dev/octeon_gmx.c Wed Jan 29 05:27:05 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_gmx.c Wed Jan 29 05:30:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_gmx.c,v 1.7 2020/01/25 19:20:24 thorpej Exp $ */
+/* $NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.7 2020/01/25 19:20:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $");
#include "opt_octeon.h"
@@ -1071,22 +1071,24 @@
* receive error of work queue entry.
* this is not add to input packet errors of interface.
*/
- ifp->if_iqdrops +=
- (uint32_t)_GMX_PORT_RD8(sc, GMX0_RX0_STATS_PKTS_DRP);
- ifp->if_opackets +=
- (uint32_t)_GMX_PORT_RD8(sc, GMX0_TX0_STAT3);
+ net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
+ if_statadd_ref(nsr, if_iqdrops,
+ (uint32_t)_GMX_PORT_RD8(sc, GMX0_RX0_STATS_PKTS_DRP));
+ if_statadd_ref(nsr, if_opackets,
+ (uint32_t)_GMX_PORT_RD8(sc, GMX0_TX0_STAT3));
tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT0);
- ifp->if_oerrors +=
- (uint32_t)tmp + ((uint32_t)(tmp >> 32) * 16);
- ifp->if_collisions += (uint32_t)tmp;
+ if_statadd_ref(nsr, if_oerrors,
+ (uint32_t)tmp + ((uint32_t)(tmp >> 32) * 16));
+ if_statadd_ref(nsr, if_collisions, (uint32_t)tmp);
tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT1);
- ifp->if_collisions +=
- (uint32_t)tmp + (uint32_t)(tmp >> 32);
+ if_statadd_ref(nsr, if_collisions,
+ (uint32_t)tmp + (uint32_t)(tmp >> 32));
tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT9);
- ifp->if_oerrors += (uint32_t)(tmp >> 32);
+ if_statadd_ref(nsr, if_oerrors, (uint32_t)(tmp >> 32));
+ IF_STAT_PUTREF(ifp);
}
/* ---- DMAC filter */
diff -r 759bb254a7f2 -r f371be46c6f2 sys/arch/mips/cavium/dev/octeon_pip.c
--- a/sys/arch/mips/cavium/dev/octeon_pip.c Wed Jan 29 05:27:05 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_pip.c Wed Jan 29 05:30:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_pip.c,v 1.2 2018/02/06 09:33:45 mrg Exp $ */
+/* $NetBSD: octeon_pip.c,v 1.3 2020/01/29 05:30:14 thorpej Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_pip.c,v 1.2 2018/02/06 09:33:45 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_pip.c,v 1.3 2020/01/29 05:30:14 thorpej Exp $");
#include "opt_octeon.h"
@@ -245,7 +245,7 @@
reg = &octeon_pip_dump_stats_[gmx_port];
tmp = _PIP_RD8(sc, reg->offset);
pkts = (tmp & 0xffffffff00000000ULL) >> 32;
- ifp->if_iqdrops += pkts;
+ if_statadd(ifp, if_iqdrops, pkts);
_PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl);
}
diff -r 759bb254a7f2 -r f371be46c6f2 sys/arch/mips/ralink/ralink_eth.c
--- a/sys/arch/mips/ralink/ralink_eth.c Wed Jan 29 05:27:05 2020 +0000
+++ b/sys/arch/mips/ralink/ralink_eth.c Wed Jan 29 05:30:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ralink_eth.c,v 1.19 2019/06/03 06:04:20 msaitoh Exp $ */
+/* $NetBSD: ralink_eth.c,v 1.20 2020/01/29 05:30:14 thorpej Exp $ */
/*-
* Copyright (c) 2011 CradlePoint Technology, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
/* ralink_eth.c -- Ralink Ethernet Driver */
Home |
Main Index |
Thread Index |
Old Index