svn commit: r271827 - head/sys/dev/my

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


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

Log:
  Mechanically convert to if_inc_counter().

Modified:
  head/sys/dev/my/if_my.c

Modified: head/sys/dev/my/if_my.c
==============================================================================
--- head/sys/dev/my/if_my.c	Thu Sep 18 20:58:04 2014	(r271826)
+++ head/sys/dev/my/if_my.c	Thu Sep 18 20:59:59 2014	(r271827)
@@ -1121,7 +1121,7 @@ my_rxeof(struct my_softc * sc)
 		sc->my_cdata.my_rx_head = cur_rx->my_nextdesc;
 
 		if (rxstat & MY_ES) {	/* error summary: give up this rx pkt */
-			ifp->if_ierrors++;
+			if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 			cur_rx->my_ptr->my_status = MY_OWNByNIC;
 			continue;
 		}
@@ -1134,7 +1134,7 @@ my_rxeof(struct my_softc * sc)
 			    total_len, 0, ifp, NULL);
 			cur_rx->my_ptr->my_status = MY_OWNByNIC;
 			if (m == NULL) {
-				ifp->if_ierrors++;
+				if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 				continue;
 			}
 		} else {
@@ -1147,14 +1147,14 @@ my_rxeof(struct my_softc * sc)
 			 * little else we can do in this situation.
 			 */
 			if (my_newbuf(sc, cur_rx) == ENOBUFS) {
-				ifp->if_ierrors++;
+				if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 				cur_rx->my_ptr->my_status = MY_OWNByNIC;
 				continue;
 			}
 			m->m_pkthdr.rcvif = ifp;
 			m->m_pkthdr.len = m->m_len = total_len;
 		}
-		ifp->if_ipackets++;
+		if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 		eh = mtod(m, struct ether_header *);
 #if NBPFILTER > 0
 		/*
@@ -1212,16 +1212,16 @@ my_txeof(struct my_softc * sc)
 			break;
 		if (!(CSR_READ_4(sc, MY_TCRRCR) & MY_Enhanced)) {
 			if (txstat & MY_TXERR) {
-				ifp->if_oerrors++;
+				if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 				if (txstat & MY_EC) /* excessive collision */
-					ifp->if_collisions++;
+					if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
 				if (txstat & MY_LC)	/* late collision */
-					ifp->if_collisions++;
+					if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1);
 			}
-			ifp->if_collisions += (txstat & MY_NCRMASK) >>
-			    MY_NCRShift;
+			if_inc_counter(ifp, IFCOUNTER_COLLISIONS,
+			    (txstat & MY_NCRMASK) >> MY_NCRShift);
 		}
-		ifp->if_opackets++;
+		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 		m_freem(cur_tx->my_mbuf);
 		cur_tx->my_mbuf = NULL;
 		if (sc->my_cdata.my_tx_head == sc->my_cdata.my_tx_tail) {
@@ -1232,7 +1232,7 @@ my_txeof(struct my_softc * sc)
 		sc->my_cdata.my_tx_head = cur_tx->my_nextdesc;
 	}
 	if (CSR_READ_4(sc, MY_TCRRCR) & MY_Enhanced) {
-		ifp->if_collisions += (CSR_READ_4(sc, MY_TSR) & MY_NCRMask);
+		if_inc_counter(ifp, IFCOUNTER_COLLISIONS, (CSR_READ_4(sc, MY_TSR) & MY_NCRMask));
 	}
 	return;
 }
@@ -1293,7 +1293,7 @@ my_intr(void *arg)
 
 		if ((status & MY_RBU) || (status & MY_RxErr)) {
 			/* rx buffer unavailable or rx error */
-			ifp->if_ierrors++;
+			if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 #ifdef foo
 			my_stop(sc);
 			my_reset(sc);
@@ -1701,7 +1701,7 @@ my_watchdog(void *arg)
 		return;
 
 	ifp = sc->my_ifp;
-	ifp->if_oerrors++;
+	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	if_printf(ifp, "watchdog timeout\n");
 	if (!(my_phy_readreg(sc, PHY_BMSR) & PHY_BMSR_LINKSTAT))
 		if_printf(ifp, "no carrier - transceiver cable problem?\n");


More information about the svn-src-all mailing list