svn commit: r271812 - head/sys/dev/nge

Gleb Smirnoff glebius at FreeBSD.org
Thu Sep 18 20:23:35 UTC 2014


Author: glebius
Date: Thu Sep 18 20:23:34 2014
New Revision: 271812
URL: http://svnweb.freebsd.org/changeset/base/271812

Log:
  Mechanically convert to if_inc_counter().

Modified:
  head/sys/dev/nge/if_nge.c

Modified: head/sys/dev/nge/if_nge.c
==============================================================================
--- head/sys/dev/nge/if_nge.c	Thu Sep 18 20:21:46 2014	(r271811)
+++ head/sys/dev/nge/if_nge.c	Thu Sep 18 20:23:34 2014	(r271812)
@@ -1476,7 +1476,7 @@ nge_rxeof(struct nge_softc *sc)
 
 		if ((cmdsts & NGE_CMDSTS_MORE) != 0) {
 			if (nge_newbuf(sc, cons) != 0) {
-				ifp->if_iqdrops++;
+				if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
 				if (sc->nge_head != NULL) {
 					m_freem(sc->nge_head);
 					sc->nge_head = sc->nge_tail = NULL;
@@ -1526,7 +1526,7 @@ nge_rxeof(struct nge_softc *sc)
 		/* Try conjure up a replacement mbuf. */
 
 		if (nge_newbuf(sc, cons) != 0) {
-			ifp->if_iqdrops++;
+			if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
 			if (sc->nge_head != NULL) {
 				m_freem(sc->nge_head);
 				sc->nge_head = sc->nge_tail = NULL;
@@ -1563,7 +1563,7 @@ nge_rxeof(struct nge_softc *sc)
 		nge_fixup_rx(m);
 #endif
 		m->m_pkthdr.rcvif = ifp;
-		ifp->if_ipackets++;
+		if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 
 		if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) {
 			/* Do IP checksum checking. */
@@ -1650,15 +1650,15 @@ nge_txeof(struct nge_softc *sc)
 		    BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->nge_cdata.nge_tx_tag, txd->tx_dmamap);
 		if ((cmdsts & NGE_CMDSTS_PKT_OK) == 0) {
-			ifp->if_oerrors++;
+			if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 			if ((cmdsts & NGE_TXSTAT_EXCESSCOLLS) != 0)
-				ifp->if_collisions++;
+				if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
 			if ((cmdsts & NGE_TXSTAT_OUTOFWINCOLL) != 0)
-				ifp->if_collisions++;
+				if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
 		} else
-			ifp->if_opackets++;
+			if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 
-		ifp->if_collisions += (cmdsts & NGE_TXSTAT_COLLCNT) >> 16;
+		if_inc_counter(ifp, IFCOUNTER_COLLISIONS, (cmdsts & NGE_TXSTAT_COLLCNT) >> 16);
 		KASSERT(txd->tx_m != NULL, ("%s: freeing NULL mbuf!\n",
 		    __func__));
 		m_freem(txd->tx_m);
@@ -1730,8 +1730,9 @@ nge_stats_update(struct nge_softc *sc)
 	/*
 	 * Since we've accept errored frames exclude Rx length errors.
 	 */
-	ifp->if_ierrors += stats->rx_pkts_errs + stats->rx_crc_errs +
-	    stats->rx_fifo_oflows + stats->rx_sym_errs;
+	if_inc_counter(ifp, IFCOUNTER_IERRORS,
+	    stats->rx_pkts_errs + stats->rx_crc_errs +
+	    stats->rx_fifo_oflows + stats->rx_sym_errs);
 
 	nstats = &sc->nge_stats;
 	nstats->rx_pkts_errs += stats->rx_pkts_errs;
@@ -2435,7 +2436,7 @@ nge_watchdog(struct nge_softc *sc)
 		return;
 
 	ifp = sc->nge_ifp;
-	ifp->if_oerrors++;
+	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	if_printf(ifp, "watchdog timeout\n");
 
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;


More information about the svn-src-head mailing list