Expose the Symbol Error Count (SYMERRS) register to ethtool statistics.

The SYMERRS register (0x04008) tracks physical layer symbol errors. Define
the register, clear it during hardware counters reset, update it in adapter
stats, and export "rx_symbol_errors" in igc_gstrings_stats so it can be
retrieved via `ethtool --statistics`.

Signed-off-by: Sasha Neftin <[email protected]>
---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 1 +
 drivers/net/ethernet/intel/igc/igc_mac.c     | 1 +
 drivers/net/ethernet/intel/igc/igc_main.c    | 1 +
 drivers/net/ethernet/intel/igc/igc_regs.h    | 1 +
 4 files changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c 
b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 4ebc0c7f5fc4..dead327baa17 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -35,6 +35,7 @@ static const struct igc_stats igc_gstrings_stats[] = {
        IGC_STAT("multicast", stats.mprc),
        IGC_STAT("collisions", stats.colc),
        IGC_STAT("rx_crc_errors", stats.crcerrs),
+       IGC_STAT("rx_symbol_errors", stats.symerrs),
        IGC_STAT("rx_no_buffer_count", stats.rnbc),
        IGC_STAT("rx_missed_errors", stats.mpc),
        IGC_STAT("tx_aborted_errors", stats.ecol),
diff --git a/drivers/net/ethernet/intel/igc/igc_mac.c 
b/drivers/net/ethernet/intel/igc/igc_mac.c
index d6f3f6618469..db28f1c2f24a 100644
--- a/drivers/net/ethernet/intel/igc/igc_mac.c
+++ b/drivers/net/ethernet/intel/igc/igc_mac.c
@@ -235,6 +235,7 @@ s32 igc_force_mac_fc(struct igc_hw *hw)
 void igc_clear_hw_cntrs_base(struct igc_hw *hw)
 {
        rd32(IGC_CRCERRS);
+       rd32(IGC_SYMERRS);
        rd32(IGC_MPC);
        rd32(IGC_SCC);
        rd32(IGC_ECOL);
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c 
b/drivers/net/ethernet/intel/igc/igc_main.c
index e36d6761a0be..dbebdb0d15b8 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -5237,6 +5237,7 @@ void igc_update_stats(struct igc_adapter *adapter)
 
        /* read stats registers */
        adapter->stats.crcerrs += rd32(IGC_CRCERRS);
+       adapter->stats.symerrs += rd32(IGC_SYMERRS);
        adapter->stats.gprc += rd32(IGC_GPRC);
        adapter->stats.gorc += rd32(IGC_GORCL);
        rd32(IGC_GORCH); /* clear GORCL */
diff --git a/drivers/net/ethernet/intel/igc/igc_regs.h 
b/drivers/net/ethernet/intel/igc/igc_regs.h
index f343c6bfc6be..89f146d88d04 100644
--- a/drivers/net/ethernet/intel/igc/igc_regs.h
+++ b/drivers/net/ethernet/intel/igc/igc_regs.h
@@ -132,6 +132,7 @@
 /* Statistics Register Descriptions */
 #define IGC_CRCERRS    0x04000  /* CRC Error Count - R/clr */
 #define IGC_ALGNERRC   0x04004  /* Alignment Error Count - R/clr */
+#define IGC_SYMERRS    0x04008  /* Symbol Error Count - R/clr */
 #define IGC_RXERRC     0x0400C  /* Receive Error Count - R/clr */
 #define IGC_MPC                0x04010  /* Missed Packet Count - R/clr */
 #define IGC_SCC                0x04014  /* Single Collision Count - R/clr */
-- 
2.53.0

Reply via email to