11 #include <satcat5/cfgbus_stats.h>
13 namespace cfg = satcat5::cfg;
26 : m_traffic(cfg->get_register(devaddr))
37 cfg::TrafficStats stats = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
38 unsigned reg = 16 * idx;
47 u32 errct_word = m_traffic[reg+6];
48 u32 errct_ptp = m_traffic[reg+7];
49 u32 status_word = m_traffic[reg+8];
60 stats.
rate_mbps = (u16)(status_word >> 16);
61 stats.
status = (u8)(status_word & 0xFF);
const unsigned REGS_PER_DEVICE
Fixed ConfigBus gateware interface parameters.
NetworkStats(satcat5::cfg::ConfigBus *cfg, unsigned devaddr)
Construct a memory-map for the designated ConfigBus device.
satcat5::cfg::TrafficStats get_port(unsigned idx)
Read most recent statistics for the Nth port.
void refresh_now()
Immediately refresh statistics for every port.
Data structure for reading per-port traffic statistics.
s32 delta_freq
Net frequency offset (see above)
u8 errct_ovr_rx
Rx-FIFO overflow (rare)
u32 bcast_frames
Broadcast frames received from device.
u32 sent_frames
Total frames sent from switch to device.
u32 bcast_bytes
Broadcast bytes received from device.
u8 errct_ptp_tx
TX PTP packets with bad tstamps.
u8 errct_mac
MAC/PHY errors.
u16 rate_mbps
Link rate in Mbps.
u32 errct_total() const
Total errors across all types.
u8 errct_ovr_tx
Tx-FIFO overflow (common)
u8 errct_pkt
Packet errors (bad checksum, length, etc.)
u32 rcvd_bytes
Total bytes received from device.
u32 sent_bytes
Total bytes sent from switch to device.
u8 status
Port status (Varies by port)
u32 rcvd_frames
Total frames received from device.
u8 errct_ptp_rx
RX PTP packets with bad tstamps.