diff options
author | Mitchell Horne <mhorne@FreeBSD.org> | 2022-06-21 13:24:25 +0000 |
---|---|---|
committer | Mitchell Horne <mhorne@FreeBSD.org> | 2022-07-04 16:34:57 +0000 |
commit | 3a72965a25f96e0719fef098c6c78c3d34a6e808 (patch) | |
tree | 7ee483bd2a9d3c1676b58ad13e95f9efb0a13a67 | |
parent | 5dec16de37f5f1d9650525b3ee5d476b453ef184 (diff) | |
download | src-3a72965a25f96e0719fef098c6c78c3d34a6e808.tar.gz src-3a72965a25f96e0719fef098c6c78c3d34a6e808.zip |
if_dwc: avoid duplicate packet counts
We already increment the unicast IPACKETS and OPACKETS counters in the
rx/tx paths, respectively. Multicast packets are counted in the generic
ethernet code. Therefore, we shouldn't increment these counters in
dwc_harvest_stats().
Drop the early return from dwc_rxfinish_one() so that we still count
received packets with e.g. a checksum error.
PR: 263817
Reported by: Jiahao LI <jiahali@blackberry.com>
Reviewed by: manu
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35499
(cherry picked from commit 9718759043ec2ef36f12b15963194b866d731b5b)
-rw-r--r-- | sys/dev/dwc/if_dwc.c | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index e32ac20f5749..761f4a33ab43 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -824,14 +824,6 @@ dwc_rxfinish_one(struct dwc_softc *sc, struct dwc_hwdesc *desc, m = map->mbuf; ifp = sc->ifp; rdesc0 = desc ->desc0; - /* Validate descriptor. */ - if (rdesc0 & RDESC0_ES) { - /* - * Errored packet. Statistic counters are updated - * globally, so do nothing - */ - return (NULL); - } if ((rdesc0 & (RDESC0_FS | RDESC0_LS)) != (RDESC0_FS | RDESC0_LS)) { @@ -1441,16 +1433,12 @@ dwc_harvest_stats(struct dwc_softc *sc) sc->stats_harvest_count = 0; ifp = sc->ifp; - if_inc_counter(ifp, IFCOUNTER_IPACKETS, READ4(sc, RXFRAMECOUNT_GB)); - if_inc_counter(ifp, IFCOUNTER_IMCASTS, READ4(sc, RXMULTICASTFRAMES_G)); if_inc_counter(ifp, IFCOUNTER_IERRORS, READ4(sc, RXOVERSIZE_G) + READ4(sc, RXUNDERSIZE_G) + READ4(sc, RXCRCERROR) + READ4(sc, RXALIGNMENTERROR) + READ4(sc, RXRUNTERROR) + READ4(sc, RXJABBERERROR) + READ4(sc, RXLENGTHERROR)); - if_inc_counter(ifp, IFCOUNTER_OPACKETS, READ4(sc, TXFRAMECOUNT_G)); - if_inc_counter(ifp, IFCOUNTER_OMCASTS, READ4(sc, TXMULTICASTFRAMES_G)); if_inc_counter(ifp, IFCOUNTER_OERRORS, READ4(sc, TXOVERSIZE_G) + READ4(sc, TXEXCESSDEF) + READ4(sc, TXCARRIERERR) + READ4(sc, TXUNDERFLOWERROR)); |