Skip to content

Commit 165a7f5

Browse files
triha2workkuba-moo
authored andcommitted
net: dsa: microchip: Fix wrong rx drop MIB counter for KSZ8863
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: 4b20a07 ("net: dsa: microchip: ksz8795: add support for ksz88xx chips") Signed-off-by: Tristram Ha <[email protected]> Reviewed-by: Oleksij Rempel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0d9cfc9 commit 165a7f5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

drivers/net/dsa/microchip/ksz8.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ static void ksz8863_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
371371
addr -= dev->info->reg_mib_cnt;
372372
ctrl_addr = addr ? KSZ8863_MIB_PACKET_DROPPED_TX_0 :
373373
KSZ8863_MIB_PACKET_DROPPED_RX_0;
374+
if (ksz_is_8895_family(dev) &&
375+
ctrl_addr == KSZ8863_MIB_PACKET_DROPPED_RX_0)
376+
ctrl_addr = KSZ8895_MIB_PACKET_DROPPED_RX_0;
374377
ctrl_addr += port;
375378
ctrl_addr |= IND_ACC_TABLE(TABLE_MIB | TABLE_READ);
376379

drivers/net/dsa/microchip/ksz8_reg.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,9 @@
784784
#define KSZ8795_MIB_TOTAL_TX_1 0x105
785785

786786
#define KSZ8863_MIB_PACKET_DROPPED_TX_0 0x100
787-
#define KSZ8863_MIB_PACKET_DROPPED_RX_0 0x105
787+
#define KSZ8863_MIB_PACKET_DROPPED_RX_0 0x103
788+
789+
#define KSZ8895_MIB_PACKET_DROPPED_RX_0 0x105
788790

789791
#define MIB_PACKET_DROPPED 0x0000FFFF
790792

0 commit comments

Comments
 (0)