svn commit: r271838 - head/sys/dev/sf

Gleb Smirnoff glebius at FreeBSD.org
Thu Sep 18 21:19:22 UTC 2014


Author: glebius
Date: Thu Sep 18 21:19:21 2014
New Revision: 271838
URL: http://svnweb.freebsd.org/changeset/base/271838

Log:
  Mechanically convert to if_inc_counter().

Modified:
  head/sys/dev/sf/if_sf.c

Modified: head/sys/dev/sf/if_sf.c
==============================================================================
--- head/sys/dev/sf/if_sf.c	Thu Sep 18 21:16:05 2014	(r271837)
+++ head/sys/dev/sf/if_sf.c	Thu Sep 18 21:19:21 2014	(r271838)
@@ -1566,7 +1566,7 @@ sf_rxeof(struct sf_softc *sc)
 		m = rxd->rx_m;
 
 		/*
-		 * Note, if_ipackets and if_ierrors counters
+		 * Note, IFCOUNTER_IPACKETS and ICOUNTER_IERRORS
 		 * are handled in sf_stats_update().
 		 */
 		if ((status & SF_RXSTAT1_OK) == 0) {
@@ -1575,7 +1575,7 @@ sf_rxeof(struct sf_softc *sc)
 		}
 
 		if (sf_newbuf(sc, eidx) != 0) {
-			ifp->if_iqdrops++;
+			if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
 			cur_cmp->sf_rx_status1 = 0;
 			continue;
 		}
@@ -1720,8 +1720,9 @@ sf_txeof(struct sf_softc *sc)
 			/*
 			 * We don't need to check Tx status here.
 			 * SF_ISR_TX_LOFIFO intr would handle this.
-			 * Note, if_opackets, if_collisions and if_oerrors
-			 * counters are handled in sf_stats_update().
+			 * Note, IFCOUNTER_OPACKETS, IFCOUNTER_COLLISIONS
+			 * and IFCOUNTER_OERROR are handled in
+			 * sf_stats_update().
 			 */
 			txd = &sc->sf_cdata.sf_txdesc[idx];
 			if (txd->tx_m != NULL) {
@@ -2479,23 +2480,26 @@ sf_stats_update(struct sf_softc *sc)
 	for (i = SF_STATS_BASE; i < (SF_STATS_END + 1); i += sizeof(uint32_t))
 		csr_write_4(sc, i, 0);
 
-	ifp->if_opackets += (u_long)stats->sf_tx_frames;
+	if_inc_counter(ifp, IFCOUNTER_OPACKETS, (u_long)stats->sf_tx_frames);
 
-	ifp->if_collisions += (u_long)stats->sf_tx_single_colls +
-	    (u_long)stats->sf_tx_multi_colls;
+	if_inc_counter(ifp, IFCOUNTER_COLLISIONS,
+	    (u_long)stats->sf_tx_single_colls +
+	    (u_long)stats->sf_tx_multi_colls);
 
-	ifp->if_oerrors += (u_long)stats->sf_tx_excess_colls +
+	if_inc_counter(ifp, IFCOUNTER_OERRORS,
+	    (u_long)stats->sf_tx_excess_colls +
 	    (u_long)stats->sf_tx_excess_defer +
-	    (u_long)stats->sf_tx_frames_lost;
+	    (u_long)stats->sf_tx_frames_lost);
 
-	ifp->if_ipackets += (u_long)stats->sf_rx_frames;
+	if_inc_counter(ifp, IFCOUNTER_IPACKETS, (u_long)stats->sf_rx_frames);
 
-	ifp->if_ierrors += (u_long)stats->sf_rx_crcerrs +
+	if_inc_counter(ifp, IFCOUNTER_IERRORS,
+	    (u_long)stats->sf_rx_crcerrs +
 	    (u_long)stats->sf_rx_alignerrs +
 	    (u_long)stats->sf_rx_giants +
 	    (u_long)stats->sf_rx_runts +
 	    (u_long)stats->sf_rx_jabbererrs +
-	    (u_long)stats->sf_rx_frames_lost;
+	    (u_long)stats->sf_rx_frames_lost);
 
 	nstats = &sc->sf_statistics;
 
@@ -2546,7 +2550,7 @@ sf_watchdog(struct sf_softc *sc)
 
 	ifp = sc->sf_ifp;
 
-	ifp->if_oerrors++;
+	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	if (sc->sf_link == 0) {
 		if (bootverbose)
 			if_printf(sc->sf_ifp, "watchdog timeout "


More information about the svn-src-all mailing list