git: 5574b12aac2b - stable/12 - ix(4): Report RX errors as sum of all RX error counters

Eric Joyner erj at FreeBSD.org
Mon Sep 20 23:22:31 UTC 2021


The branch stable/12 has been updated by erj:

URL: https://cgit.FreeBSD.org/src/commit/?id=5574b12aac2bdfe66ec1d9564f932eeec9ac213c

commit 5574b12aac2bdfe66ec1d9564f932eeec9ac213c
Author:     Piotr Pietruszewski <piotr.pietruszewski at intel.com>
AuthorDate: 2021-03-03 01:21:58 +0000
Commit:     Eric Joyner <erj at FreeBSD.org>
CommitDate: 2021-09-20 21:31:33 +0000

    ix(4): Report RX errors as sum of all RX error counters
    
    HW keeps track of RX errors using several counters, each for
    specific type of errors. Report RX errors to OS as sum
    of all those counters: CRC errors, illegal bytes, checksum,
    length, undersize, fragment, oversize and jabber errors.
    
    Also, add new "rx_errs" sysctl in the dev.ix.N.mac_stats tree. This is
    to provide an another way to display the sum of RX errors.
    
    Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski at intel.com>
    
    Reviewed By: erj
    Tested By: gowtham.kumar.ks at intel.com
    Sponsored By: Intel Corporation
    Differential Revision: https://reviews.freebsd.org/D27191
    
    (cherry picked from commit afb1aa4e6df245d38fd2ba683fa521d5dabe8392)
---
 sys/dev/ixgbe/if_ix.c | 19 ++++++++++++++++++-
 sys/dev/ixgbe/ixgbe.h | 12 ++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index 655f9a0b52b4..362bb7fe0cbc 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -1535,7 +1535,22 @@ ixgbe_update_stats_counters(struct adapter *adapter)
 	IXGBE_SET_OMCASTS(adapter, stats->mptc);
 	IXGBE_SET_COLLISIONS(adapter, 0);
 	IXGBE_SET_IQDROPS(adapter, total_missed_rx);
-	IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->rlec);
+
+	/*
+	 * Aggregate following types of errors as RX errors:
+	 * - CRC error count,
+	 * - illegal byte error count,
+	 * - checksum error count,
+	 * - missed packets count,
+	 * - length error count,
+	 * - undersized packets count,
+	 * - fragmented packets count,
+	 * - oversized packets count,
+	 * - jabber count.
+	 */
+	IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->illerrc + stats->xec +
+	    stats->mpc[0] + stats->rlec + stats->ruc + stats->rfc + stats->roc +
+	    stats->rjc);
 } /* ixgbe_update_stats_counters */
 
 /************************************************************************
@@ -1625,6 +1640,8 @@ ixgbe_add_hw_stats(struct adapter *adapter)
 	    CTLFLAG_RD, NULL, "MAC Statistics");
 	stat_list = SYSCTL_CHILDREN(stat_node);
 
+	SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "rx_errs",
+	    CTLFLAG_RD, &adapter->ierrors, IXGBE_SYSCTL_DESC_RX_ERRS);
 	SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "crc_errs",
 	    CTLFLAG_RD, &stats->crcerrs, "CRC Errors");
 	SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "ill_errs",
diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h
index 63aa2047cc1e..3403e0ba6ed2 100644
--- a/sys/dev/ixgbe/ixgbe.h
+++ b/sys/dev/ixgbe/ixgbe.h
@@ -538,6 +538,18 @@ struct adapter {
         "\t2 - tx pause\n" \
         "\t3 - tx and rx pause"
 
+#define IXGBE_SYSCTL_DESC_RX_ERRS \
+		"\nSum of the following RX errors counters:\n" \
+		" * CRC errors,\n" \
+		" * illegal byte error count,\n" \
+		" * checksum error count,\n" \
+		" * missed packet count,\n" \
+		" * length error count,\n" \
+		" * undersized packets count,\n" \
+		" * fragmented packets count,\n" \
+		" * oversized packets count,\n" \
+		" * jabber count."
+
 /* Workaround to make 8.0 buildable */
 #if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504
 static __inline int


More information about the dev-commits-src-branches mailing list