Skip to contentSkip to conversation

net: dsa: microchip: Fix wrong rx drop MIB counter for KSZ8863

PATCH Applied [email protected] 3 participants 3 messages Jul 23, 2025 – Jul 25, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: microchip: Fix wrong rx drop MIB counter for KSZ8863

From: Tristram Ha <[email protected]>

When KSZ8863 support was first added to KSZ driver the RX drop MIB counter was somehow defined as 0x105. The TX drop MIB counter starts at 0x100 for port 1, 0x101 for port 2, and 0x102 for port 3, so the RX drop MIB counter should start at 0x103 for port 1, 0x104 for port 2, and 0x105 for port 3.

There are 5 ports for KSZ8895, so its RX drop MIB counter starts at 0x105.

Fixes 4b20a07e103f ("net: dsa: microchip: ksz8795: add support for ksz88xx chips")
---
 drivers/net/dsa/microchip/ksz8.c     | 3 +++
 drivers/net/dsa/microchip/ksz8_reg.h | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/dsa/microchip/ksz8.c +3 -0
index be433b4e2b1c..8f55be89f8bf 100644
@@ -371,6 +371,9 @@ static void ksz8863_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
 	addr -= dev->info->reg_mib_cnt;
 	ctrl_addr = addr ? KSZ8863_MIB_PACKET_DROPPED_TX_0 :
 			   KSZ8863_MIB_PACKET_DROPPED_RX_0;
+	if (ksz_is_8895_family(dev) &&
+	    ctrl_addr == KSZ8863_MIB_PACKET_DROPPED_RX_0)
+		ctrl_addr = KSZ8895_MIB_PACKET_DROPPED_RX_0;
 	ctrl_addr += port;
 	ctrl_addr |= IND_ACC_TABLE(TABLE_MIB | TABLE_READ);
 
drivers/net/dsa/microchip/ksz8_reg.h +3 -1
index 329688603a58..da80e659c648 100644
@@ -784,7 +784,9 @@
 #define KSZ8795_MIB_TOTAL_TX_1		0x105
 
 #define KSZ8863_MIB_PACKET_DROPPED_TX_0 0x100
-#define KSZ8863_MIB_PACKET_DROPPED_RX_0 0x105
+#define KSZ8863_MIB_PACKET_DROPPED_RX_0 0x103
+
+#define KSZ8895_MIB_PACKET_DROPPED_RX_0 0x105
 
 #define MIB_PACKET_DROPPED		0x0000FFFF
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Tristram,

Quoted 8 lines · On Tue, Jul 22, 2025 at 08:04:03PM -0700, [email protected] wrote:

From: Tristram Ha <[email protected]>

When KSZ8863 support was first added to KSZ driver the RX drop MIB counter was somehow defined as 0x105. The TX drop MIB counter starts at 0x100 for port 1, 0x101 for port 2, and 0x102 for port 3, so the RX drop MIB counter should start at 0x103 for port 1, 0x104 for port 2, and 0x105 for port 3.

Quoted 5 lines

There are 5 ports for KSZ8895, so its RX drop MIB counter starts at 0x105.

Fixes 4b20a07e103f ("net: dsa: microchip: ksz8795: add support for ksz88xx chips")

Thank you for your patch!

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw
In reply to [email protected]
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Tue, 22 Jul 2025 20:04:03 -0700 you wrote:

From: Tristram Ha <[email protected]>

When KSZ8863 support was first added to KSZ driver the RX drop MIB counter was somehow defined as 0x105. The TX drop MIB counter starts at 0x100 for port 1, 0x101 for port 2, and 0x102 for port 3, so the RX drop MIB counter should start at 0x103 for port 1, 0x104 for port 2, and 0x105 for port 3.

[...]

Here is the summary with links:
- [net] net: dsa: microchip: Fix wrong rx drop MIB counter for KSZ8863

    https://git.kernel.org/netdev/net/c/165a7f5db919

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html