The branch main has been updated by mhorne:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9718759043ec2ef36f12b15963194b866d731b5b

commit 9718759043ec2ef36f12b15963194b866d731b5b
Author:     Mitchell Horne <mho...@freebsd.org>
AuthorDate: 2022-06-21 13:24:25 +0000
Commit:     Mitchell Horne <mho...@freebsd.org>
CommitDate: 2022-06-23 18:15:10 +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 <jiah...@blackberry.com>
    Reviewed by:    manu
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D35499
---
 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 1685866ad9ad..5ec115f7081b 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));

Reply via email to