From: brad Date: Sat, 30 Aug 2008 07:39:12 +0000 (+0000) Subject: Fix an issue initially reported by drahn@ with gem(4) where these X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b081b93164b2fbffdd0b23fed9f434ebb94020a1;p=openbsd Fix an issue initially reported by drahn@ with gem(4) where these drivers can report 2-3x times the number of actual packets being transmitted by only incrementing the counter for descriptors with buffers being freed. ok kettenis@ --- diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index d5d17fb68b0..31a16ba0009 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gem.c,v 1.76 2008/08/26 21:06:29 kettenis Exp $ */ +/* $OpenBSD: gem.c,v 1.77 2008/08/30 07:39:12 brad Exp $ */ /* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */ /* @@ -1619,9 +1619,9 @@ gem_tint(struct gem_softc *sc, u_int32_t status) bus_dmamap_unload(sc->sc_dmatag, sd->sd_map); m_freem(sd->sd_mbuf); sd->sd_mbuf = NULL; + ifp->if_opackets++; } sc->sc_tx_cnt--; - ifp->if_opackets++; if (++cons == GEM_NTXDESC) cons = 0; } diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 35b09af3c41..cc37c7c4f54 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.19 2008/05/31 22:49:03 kettenis Exp $ */ +/* $OpenBSD: if_cas.c,v 1.20 2008/08/30 07:39:12 brad Exp $ */ /* * @@ -1937,9 +1937,9 @@ cas_tint(struct cas_softc *sc, u_int32_t status) bus_dmamap_unload(sc->sc_dmatag, sd->sd_map); m_freem(sd->sd_mbuf); sd->sd_mbuf = NULL; + ifp->if_opackets++; } sc->sc_tx_cnt--; - ifp->if_opackets++; if (++cons == CAS_NTXDESC) cons = 0; }