From owner-svn-src-all@FreeBSD.ORG Thu Sep 18 20:21:47 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72486C0C; Thu, 18 Sep 2014 20:21:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D1F7E91; Thu, 18 Sep 2014 20:21:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8IKLlfa041279; Thu, 18 Sep 2014 20:21:47 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8IKLlMV041278; Thu, 18 Sep 2014 20:21:47 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201409182021.s8IKLlMV041278@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 18 Sep 2014 20:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271811 - head/sys/dev/gem X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2014 20:21:47 -0000 Author: glebius Date: Thu Sep 18 20:21:46 2014 New Revision: 271811 URL: http://svnweb.freebsd.org/changeset/base/271811 Log: Mechanically convert to if_inc_counter(). Modified: head/sys/dev/gem/if_gem.c Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Thu Sep 18 20:18:55 2014 (r271810) +++ head/sys/dev/gem/if_gem.c Thu Sep 18 20:21:46 2014 (r271811) @@ -568,18 +568,18 @@ gem_tick(void *arg) /* * Unload collision and error counters. */ - ifp->if_collisions += + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, GEM_BANK1_READ_4(sc, GEM_MAC_NORM_COLL_CNT) + - GEM_BANK1_READ_4(sc, GEM_MAC_FIRST_COLL_CNT); + GEM_BANK1_READ_4(sc, GEM_MAC_FIRST_COLL_CNT)); v = GEM_BANK1_READ_4(sc, GEM_MAC_EXCESS_COLL_CNT) + GEM_BANK1_READ_4(sc, GEM_MAC_LATE_COLL_CNT); - ifp->if_collisions += v; - ifp->if_oerrors += v; - ifp->if_ierrors += + if_inc_counter(ifp, IFCOUNTER_COLLISIONS, v); + if_inc_counter(ifp, IFCOUNTER_OERRORS, v); + if_inc_counter(ifp, IFCOUNTER_IERRORS, GEM_BANK1_READ_4(sc, GEM_MAC_RX_LEN_ERR_CNT) + GEM_BANK1_READ_4(sc, GEM_MAC_RX_ALIGN_ERR) + GEM_BANK1_READ_4(sc, GEM_MAC_RX_CRC_ERR_CNT) + - GEM_BANK1_READ_4(sc, GEM_MAC_RX_CODE_VIOL); + GEM_BANK1_READ_4(sc, GEM_MAC_RX_CODE_VIOL)); /* * Then clear the hardware counters. @@ -1485,7 +1485,7 @@ gem_tint(struct gem_softc *sc) STAILQ_INSERT_TAIL(&sc->sc_txfreeq, txs, txs_q); - ifp->if_opackets++; + if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); progress = 1; } @@ -1580,7 +1580,7 @@ gem_rint(struct gem_softc *sc) } if (rxstat & GEM_RD_BAD_CRC) { - ifp->if_ierrors++; + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); device_printf(sc->sc_dev, "receive error: CRC error\n"); GEM_INIT_RXDESC(sc, sc->sc_rxptr); m = NULL; @@ -1606,7 +1606,7 @@ gem_rint(struct gem_softc *sc) * the buffer that's already attached to this descriptor. */ if (gem_add_rxbuf(sc, sc->sc_rxptr) != 0) { - ifp->if_iqdrops++; + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); GEM_INIT_RXDESC(sc, sc->sc_rxptr); m = NULL; } @@ -1634,7 +1634,7 @@ gem_rint(struct gem_softc *sc) continue; } - ifp->if_ipackets++; + if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); m->m_data += ETHER_ALIGN; /* first byte offset */ m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = GEM_RD_BUFLEN(rxstat); @@ -1706,7 +1706,7 @@ static void gem_eint(struct gem_softc *sc, u_int status) { - sc->sc_ifp->if_ierrors++; + if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); if ((status & GEM_INTR_RX_TAG_ERR) != 0) { gem_reset_rxdma(sc); return; @@ -1784,7 +1784,7 @@ gem_intr(void *v) "MAC TX fault, status %x\n", status2); if ((status2 & (GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG)) != 0) { - sc->sc_ifp->if_oerrors++; + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; gem_init_locked(sc); } @@ -1798,7 +1798,7 @@ gem_intr(void *v) * likely that the receiver has hung so we reset it. */ if ((status2 & GEM_MAC_RX_OVERFLOW) != 0) { - sc->sc_ifp->if_ierrors++; + if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); gem_reset_rxdma(sc); } else if ((status2 & ~(GEM_MAC_RX_DONE | GEM_MAC_RX_FRAME_CNT)) != 0) @@ -1835,7 +1835,7 @@ gem_watchdog(struct gem_softc *sc) device_printf(sc->sc_dev, "device timeout\n"); else if (bootverbose) device_printf(sc->sc_dev, "device timeout (no link)\n"); - ++ifp->if_oerrors; + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); /* Try to get more packets going. */ ifp->if_drv_flags &= ~IFF_DRV_RUNNING;