Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Add some missing error counters to ierror.



details:   https://anonhg.NetBSD.org/src/rev/6a06498a48ee
branches:  trunk
changeset: 1027638:6a06498a48ee
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Dec 14 05:31:12 2021 +0000

description:
Add some missing error counters to ierror.

  - FreeBSD: afb1aa4e6df245d38fd2ba683fa521d5dabe8392 or ix-ix-3.3.22
  - Note that the checksum error is not added to the ierror.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 629d51f78c19 -r 6a06498a48ee sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue Dec 14 05:28:46 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Tue Dec 14 05:31:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.297 2021/12/10 11:39:48 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.298 2021/12/14 05:31:12 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.297 2021/12/10 11:39:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.298 2021/12/14 05:31:12 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1613,12 +1613,10 @@
        struct ixgbe_hw_stats *stats = &adapter->stats.pf;
        u32                   missed_rx = 0, bprc, lxon, lxoff, total;
        u64                   total_missed_rx = 0;
-       uint64_t              crcerrs, rlec;
        unsigned int          queue_counters;
        int                   i;
 
-       crcerrs = IXGBE_READ_REG(hw, IXGBE_CRCERRS);
-       stats->crcerrs.ev_count += crcerrs;
+       stats->crcerrs.ev_count += IXGBE_READ_REG(hw, IXGBE_CRCERRS);
        stats->illerrc.ev_count += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
        stats->errbc.ev_count += IXGBE_READ_REG(hw, IXGBE_ERRBC);
        stats->mspdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MSPDC);
@@ -1677,8 +1675,7 @@
                stats->mlfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MLFC);
                stats->mrfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MRFC);
        }
-       rlec = IXGBE_READ_REG(hw, IXGBE_RLEC);
-       stats->rlec.ev_count += rlec;
+       stats->rlec.ev_count += IXGBE_READ_REG(hw, IXGBE_RLEC);
 
        /* Hardware workaround, gprc counts missed packets */
        stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx;
@@ -1764,7 +1761,28 @@
         */
        net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
        if_statadd_ref(nsr, if_iqdrops, total_missed_rx);
-       if_statadd_ref(nsr, if_ierrors, crcerrs + rlec);
+
+       /*
+        * Aggregate following types of errors as RX errors:
+        * - CRC error count,
+        * - illegal byte error count,
+        * - length error count,
+        * - undersized packets count,
+        * - fragmented packets count,
+        * - oversized packets count,
+        * - jabber count.
+        */
+#define EVC(x) stats->x.ev_count
+       if_statadd_ref(nsr, if_ierrors,
+           EVC(crcerrs) +
+           EVC(illerrc) +
+           EVC(rlec) +
+           EVC(ruc) +
+           EVC(rfc) +
+           EVC(roc) +
+           EVC(rjc));
+#undef EVC
+
        IF_STAT_PUTREF(ifp);
 } /* ixgbe_update_stats_counters */
 



Home | Main Index | Thread Index | Old Index