From 48c12fa0bb3f4a42ecb815a24c59a440e5d80025 Mon Sep 17 00:00:00 2001 From: logicog Date: Fri, 9 Jan 2026 19:28:51 +0100 Subject: [PATCH] Correct TX and RX good MIB counter The counters for good TX and RX packages were swapped. Fix this and also use propper names for the counters. --- rtl837x_port.c | 16 ++++++++-------- rtl837x_port.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rtl837x_port.c b/rtl837x_port.c index bb96983..08f653c 100644 --- a/rtl837x_port.c +++ b/rtl837x_port.c @@ -400,17 +400,17 @@ void port_stats_print(void) __banked print_string("Up\t"); break; } - STAT_GET(0x2f, i); + STAT_GET(STAT_COUNTER_TX_PKTS, i); print_reg(RTL837X_STAT_V_LOW); write_char('\t'); - STAT_GET(0x30, i); + STAT_GET(STAT_COUNTER_ERR_PKTS, i); + print_reg(RTL837X_STAT_V_LOW); write_char('\t'); + + STAT_GET(STAT_COUNTER_RX_PKTS, i); + print_reg(RTL837X_STAT_V_LOW); write_char('\t'); + + STAT_GET(STAT_COUNTER_ERR_PKTS, i); print_reg(RTL837X_STAT_V_HIGH); write_char('\t'); - - STAT_GET(0x2e, i); - print_reg(RTL837X_STAT_V_LOW); write_char('\t'); - - STAT_GET(0x30, i); - print_reg(RTL837X_STAT_V_LOW); write_char('\t'); print_string("\n"); } } diff --git a/rtl837x_port.h b/rtl837x_port.h index e551c11..22ea1dd 100644 --- a/rtl837x_port.h +++ b/rtl837x_port.h @@ -3,9 +3,9 @@ #include -#define STAT_COUNTER_TX_PKTS 0x2e -#define STAT_COUNTER_RX_PKTS 0x2f -#define STAT_COUNTER_ERR_PKTS 0x30 +#define STAT_COUNTER_TX_PKTS 46 +#define STAT_COUNTER_RX_PKTS 47 +#define STAT_COUNTER_ERR_PKTS 48 #define STAT_GET(cnt, port) \ REG_WRITE(RTL837X_STAT_GET, 0x00, 0x00, cnt >> 3, (cnt << 5) | (port << 1) | 1); \