From 8e8f0379718e89b66aaba05d1c2dc8b10b2e0dea Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 26 Nov 2017 22:35:22 +0000 Subject: [PATCH] runtime: print ethmac preamble error count. Also, print total error count, not the difference (but still compute the difference to determine *when* to print). --- artiq/firmware/runtime/ethmac.rs | 22 ++++++++++++++-------- artiq/firmware/runtime/lib.rs | 2 +- conda/artiq-dev/meta.yaml | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/artiq/firmware/runtime/ethmac.rs b/artiq/firmware/runtime/ethmac.rs index 3f9be525b..a19a13933 100644 --- a/artiq/firmware/runtime/ethmac.rs +++ b/artiq/firmware/runtime/ethmac.rs @@ -109,16 +109,18 @@ impl phy::TxToken for EthernetTxSlot { #[derive(Debug, Clone, PartialEq, Eq, Default)] pub struct EthernetStatistics { - rx_errors: u32, - rx_dropped: u32, + rx_preamble_errors: u32, + rx_crc_errors: u32, + rx_dropped: u32, } impl EthernetStatistics { pub fn new() -> Self { unsafe { EthernetStatistics { - rx_errors: csr::ethmac::crc_errors_read(), - rx_dropped: csr::ethmac::sram_writer_errors_read(), + rx_preamble_errors: csr::ethmac::preamble_errors_read(), + rx_crc_errors: csr::ethmac::crc_errors_read(), + rx_dropped: csr::ethmac::sram_writer_errors_read(), } } } @@ -128,8 +130,9 @@ impl EthernetStatistics { *self = Self::new(); let diff = EthernetStatistics { - rx_errors: self.rx_errors.wrapping_sub(old.rx_errors), - rx_dropped: self.rx_dropped.wrapping_sub(old.rx_dropped), + rx_preamble_errors: self.rx_preamble_errors.wrapping_sub(old.rx_preamble_errors), + rx_crc_errors: self.rx_crc_errors.wrapping_sub(old.rx_crc_errors), + rx_dropped: self.rx_dropped.wrapping_sub(old.rx_dropped), }; if diff == EthernetStatistics::default() { None @@ -141,8 +144,11 @@ impl EthernetStatistics { impl fmt::Display for EthernetStatistics { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if self.rx_errors > 0 { - write!(f, " rx crc errors: {}", self.rx_errors)? + if self.rx_preamble_errors > 0 { + write!(f, " rx preamble errors: {}", self.rx_preamble_errors)? + } + if self.rx_crc_errors > 0 { + write!(f, " rx crc errors: {}", self.rx_crc_errors)? } if self.rx_dropped > 0 { write!(f, " rx dropped: {}", self.rx_dropped)? diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index 57d3629a4..fe7d46c43 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -178,7 +178,7 @@ fn startup_ethernet() { } if let Some(net_stats_diff) = net_stats.update() { - warn!("ethernet mac:{}", net_stats_diff); // mac:{} (sic) + warn!("ethernet mac:{}", ethmac::EthernetStatistics::new()); } } } diff --git a/conda/artiq-dev/meta.yaml b/conda/artiq-dev/meta.yaml index 8ba495031..a7628fed4 100644 --- a/conda/artiq-dev/meta.yaml +++ b/conda/artiq-dev/meta.yaml @@ -15,7 +15,7 @@ requirements: - python >=3.5.3,<3.6 - setuptools 33.1.1 - migen 0.5 - - misoc 0.7.dev py35_8+git1ac1d7d9 + - misoc 0.7.dev py35_32+30979b2e - jesd204b 0.4 - binutils-or1k-linux >=2.27 - llvm-or1k