Date: Mon, 4 Jul 2022 16:40:04 GMT From: Mitchell Horne <mhorne@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 3a72965a25f9 - stable/13 - if_dwc: avoid duplicate packet counts Message-ID: <202207041640.264Ge4PG043303@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=3a72965a25f96e0719fef098c6c78c3d34a6e808 commit 3a72965a25f96e0719fef098c6c78c3d34a6e808 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2022-06-21 13:24:25 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2022-07-04 16:34:57 +0000 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) --- sys/dev/dwc/if_dwc.c | 12 ------------ 1 file changed, 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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207041640.264Ge4PG043303>