forked from M-Labs/artiq
runtime: print ethmac preamble error count.
Also, print total error count, not the difference (but still compute the difference to determine *when* to print).
This commit is contained in:
parent
e5995794be
commit
8e8f037971
|
@ -109,16 +109,18 @@ impl phy::TxToken for EthernetTxSlot {
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, Default)]
|
||||||
pub struct EthernetStatistics {
|
pub struct EthernetStatistics {
|
||||||
rx_errors: u32,
|
rx_preamble_errors: u32,
|
||||||
rx_dropped: u32,
|
rx_crc_errors: u32,
|
||||||
|
rx_dropped: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EthernetStatistics {
|
impl EthernetStatistics {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
EthernetStatistics {
|
EthernetStatistics {
|
||||||
rx_errors: csr::ethmac::crc_errors_read(),
|
rx_preamble_errors: csr::ethmac::preamble_errors_read(),
|
||||||
rx_dropped: csr::ethmac::sram_writer_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();
|
*self = Self::new();
|
||||||
|
|
||||||
let diff = EthernetStatistics {
|
let diff = EthernetStatistics {
|
||||||
rx_errors: self.rx_errors.wrapping_sub(old.rx_errors),
|
rx_preamble_errors: self.rx_preamble_errors.wrapping_sub(old.rx_preamble_errors),
|
||||||
rx_dropped: self.rx_dropped.wrapping_sub(old.rx_dropped),
|
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() {
|
if diff == EthernetStatistics::default() {
|
||||||
None
|
None
|
||||||
|
@ -141,8 +144,11 @@ impl EthernetStatistics {
|
||||||
|
|
||||||
impl fmt::Display for EthernetStatistics {
|
impl fmt::Display for EthernetStatistics {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
if self.rx_errors > 0 {
|
if self.rx_preamble_errors > 0 {
|
||||||
write!(f, " rx crc errors: {}", self.rx_errors)?
|
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 {
|
if self.rx_dropped > 0 {
|
||||||
write!(f, " rx dropped: {}", self.rx_dropped)?
|
write!(f, " rx dropped: {}", self.rx_dropped)?
|
||||||
|
|
|
@ -178,7 +178,7 @@ fn startup_ethernet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(net_stats_diff) = net_stats.update() {
|
if let Some(net_stats_diff) = net_stats.update() {
|
||||||
warn!("ethernet mac:{}", net_stats_diff); // mac:{} (sic)
|
warn!("ethernet mac:{}", ethmac::EthernetStatistics::new());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ requirements:
|
||||||
- python >=3.5.3,<3.6
|
- python >=3.5.3,<3.6
|
||||||
- setuptools 33.1.1
|
- setuptools 33.1.1
|
||||||
- migen 0.5
|
- migen 0.5
|
||||||
- misoc 0.7.dev py35_8+git1ac1d7d9
|
- misoc 0.7.dev py35_32+30979b2e
|
||||||
- jesd204b 0.4
|
- jesd204b 0.4
|
||||||
- binutils-or1k-linux >=2.27
|
- binutils-or1k-linux >=2.27
|
||||||
- llvm-or1k
|
- llvm-or1k
|
||||||
|
|
Loading…
Reference in New Issue