Skip to contentSkip to conversation

net: dsa: microchip: Do not count RX/TX Bytes and discards on KSZ87xx

PATCH In review Marek Vasut 3 participants 6 messages Aug 10, 2025 – Nov 1, 2025

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

PATCH 1/1 net: dsa: microchip: Do not count RX/TX Bytes and discards on KSZ87xx

Unlike KSZ94xx, the KSZ87xx is missing the last four MIB counters at address 0x20..0x23, namely rx_total, tx_total, rx_discards, tx_discards.

Using values from rx_total / tx_total in rx_bytes / tx_bytes calculation results in an underflow, because rx_total / tx_total returns values 0, and the "raw->rx_total - stats->rx_packets * ETH_FCS_LEN;" calculation undeflows if rx_packets / tx_packets is > 0 .

Stop using the missing MIB counters on KSZ87xx .

Fixes c6101dd7ffb8 ("net: dsa: ksz9477: move get_stats64 to ksz_common.c")

---
Cc: Andrew Lunn <[email protected]>
Cc: Arun Ramadoss <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Tristram Ha <[email protected]>
Cc: [email protected]
Cc: Vladimir Oltean <[email protected]>
Cc: Woojung Huh <[email protected]>
Cc: [email protected]

---
 drivers/net/dsa/microchip/ksz_common.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +8 -5
index 7292bfe2f7cac..9c01526779a6d 100644
@@ -2239,20 +2239,23 @@ void ksz_r_mib_stats64(struct ksz_device *dev, int port)
 	/* HW counters are counting bytes + FCS which is not acceptable
 	 * for rtnl_link_stats64 interface
 	 */
-	stats->rx_bytes = raw->rx_total - stats->rx_packets * ETH_FCS_LEN;
-	stats->tx_bytes = raw->tx_total - stats->tx_packets * ETH_FCS_LEN;
-
+	if (!ksz_is_ksz87xx(dev)) {
+		stats->rx_bytes = raw->rx_total - stats->rx_packets * ETH_FCS_LEN;
+		stats->tx_bytes = raw->tx_total - stats->tx_packets * ETH_FCS_LEN;
+	}
 	stats->rx_length_errors = raw->rx_undersize + raw->rx_fragments +
 		raw->rx_oversize;
 
 	stats->rx_crc_errors = raw->rx_crc_err;
 	stats->rx_frame_errors = raw->rx_align_err;
-	stats->rx_dropped = raw->rx_discards;
+	if (!ksz_is_ksz87xx(dev))
+		stats->rx_dropped = raw->rx_discards;
 	stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
 		stats->rx_frame_errors  + stats->rx_dropped;
 
 	stats->tx_window_errors = raw->tx_late_col;
-	stats->tx_fifo_errors = raw->tx_discards;
+	if (!ksz_is_ksz87xx(dev))
+		stats->tx_fifo_errors = raw->tx_discards;
 	stats->tx_aborted_errors = raw->tx_exc_col;
 	stats->tx_errors = stats->tx_window_errors + stats->tx_fifo_errors +
 		stats->tx_aborted_errors;
Signature · 1 line
2.47.2
#1 lore raw
Quoted 51 lines

Unlike KSZ94xx, the KSZ87xx is missing the last four MIB counters at address 0x20..0x23, namely rx_total, tx_total, rx_discards, tx_discards.

Using values from rx_total / tx_total in rx_bytes / tx_bytes calculation results in an underflow, because rx_total / tx_total returns values 0, and the "raw->rx_total - stats->rx_packets * ETH_FCS_LEN;" calculation undeflows if rx_packets / tx_packets is > 0 .

Stop using the missing MIB counters on KSZ87xx .

Fixes c6101dd7ffb8 ("net: dsa: ksz9477: move get_stats64 to ksz_common.c")

---
Cc: Andrew Lunn <[email protected]>
Cc: Arun Ramadoss <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Tristram Ha <[email protected]>
Cc: [email protected]
Cc: Vladimir Oltean <[email protected]>
Cc: Woojung Huh <[email protected]>
Cc: [email protected]

---
 drivers/net/dsa/microchip/ksz_common.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +6 -4
index 7292bfe2f7cac..9c01526779a6d 100644
@@ -2239,20 +2239,23 @@ void ksz_r_mib_stats64(struct ksz_device *dev, int port)
        /* HW counters are counting bytes + FCS which is not acceptable
         * for rtnl_link_stats64 interface
         */
-       stats->rx_bytes = raw->rx_total - stats->rx_packets * ETH_FCS_LEN;
-       stats->tx_bytes = raw->tx_total - stats->tx_packets * ETH_FCS_LEN;
-
+       if (!ksz_is_ksz87xx(dev)) {
+               stats->rx_bytes = raw->rx_total - stats->rx_packets * ETH_FCS_LEN;
+               stats->tx_bytes = raw->tx_total - stats->tx_packets * ETH_FCS_LEN;
+       }
        stats->rx_length_errors = raw->rx_undersize + raw->rx_fragments +
                raw->rx_oversize;
 
        stats->rx_crc_errors = raw->rx_crc_err;
        stats->rx_frame_errors = raw->rx_align_err;
-       stats->rx_dropped = raw->rx_discards;
+       if (!ksz_is_ksz87xx(dev))
+               stats->rx_dropped = raw->rx_discards;

drivers/net/dsa/microchip/ksz_common.c void ksz_r_mib_stats64(struct ksz_device *dev, int port) · line 2261

Quoted 10 lines
drivers/net/dsa/microchip/ksz_common.c +2 -1
        stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
                stats->rx_frame_errors  + stats->rx_dropped;
 
        stats->tx_window_errors = raw->tx_late_col;
-       stats->tx_fifo_errors = raw->tx_discards;
+       if (!ksz_is_ksz87xx(dev))
+               stats->tx_fifo_errors = raw->tx_discards;
        stats->tx_aborted_errors = raw->tx_exc_col;
        stats->tx_errors = stats->tx_window_errors + stats->tx_fifo_errors +
                stats->tx_aborted_errors;

I am not sure why you have that problem. In my KSZ8795 board running in kernel 6.16 those counters are working. Using "ethtool -S lan3" or "ethtool -S eth0" shows rx_total and tx_total. The "rx_discards" and "tx_discards" are hard to get. In KSZ8863 the "tx_discards" counter is incremented when the port does not have link and a packet is sent to that port. In newer switches that behavior was changed. Occasionally you may get 1 or 2 at the beginning when the tail tagging function is not enabled yet but the MAC sends out packets. The "rx_discards" count typically seldom happens, but somehow in my first bootup there are many from my KSZ8795 board.

Actually that many rx_discards may be a problem I need to find out.

I think you are confused about how those MIB counters are read from KSZ8795. They are not using the code in ksz9477.c but in ksz8.c.

#2 lore raw
Quoted 73 lines · On 8/11/25 10:47 PM, [email protected] wrote:
Quoted 51 lines

Unlike KSZ94xx, the KSZ87xx is missing the last four MIB counters at address 0x20..0x23, namely rx_total, tx_total, rx_discards, tx_discards.

Using values from rx_total / tx_total in rx_bytes / tx_bytes calculation results in an underflow, because rx_total / tx_total returns values 0, and the "raw->rx_total - stats->rx_packets * ETH_FCS_LEN;" calculation undeflows if rx_packets / tx_packets is > 0 .

Stop using the missing MIB counters on KSZ87xx .

Fixes c6101dd7ffb8 ("net: dsa: ksz9477: move get_stats64 to ksz_common.c")

---
Cc: Andrew Lunn <[email protected]>
Cc: Arun Ramadoss <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Tristram Ha <[email protected]>
Cc: [email protected]
Cc: Vladimir Oltean <[email protected]>
Cc: Woojung Huh <[email protected]>
Cc: [email protected]

---
  drivers/net/dsa/microchip/ksz_common.c | 13 ++++++++-----
  1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +6 -4
index 7292bfe2f7cac..9c01526779a6d 100644
@@ -2239,20 +2239,23 @@ void ksz_r_mib_stats64(struct ksz_device *dev, int port)
         /* HW counters are counting bytes + FCS which is not acceptable
          * for rtnl_link_stats64 interface
          */
-       stats->rx_bytes = raw->rx_total - stats->rx_packets * ETH_FCS_LEN;
-       stats->tx_bytes = raw->tx_total - stats->tx_packets * ETH_FCS_LEN;
-
+       if (!ksz_is_ksz87xx(dev)) {
+               stats->rx_bytes = raw->rx_total - stats->rx_packets * ETH_FCS_LEN;
+               stats->tx_bytes = raw->tx_total - stats->tx_packets * ETH_FCS_LEN;
+       }
         stats->rx_length_errors = raw->rx_undersize + raw->rx_fragments +
                 raw->rx_oversize;
 
         stats->rx_crc_errors = raw->rx_crc_err;
         stats->rx_frame_errors = raw->rx_align_err;
-       stats->rx_dropped = raw->rx_discards;
+       if (!ksz_is_ksz87xx(dev))
+               stats->rx_dropped = raw->rx_discards;

drivers/net/dsa/microchip/ksz_common.c void ksz_r_mib_stats64(struct ksz_device *dev, int port) · line 2261

Quoted 10 lines
drivers/net/dsa/microchip/ksz_common.c +2 -1
         stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
                 stats->rx_frame_errors  + stats->rx_dropped;
 
         stats->tx_window_errors = raw->tx_late_col;
-       stats->tx_fifo_errors = raw->tx_discards;
+       if (!ksz_is_ksz87xx(dev))
+               stats->tx_fifo_errors = raw->tx_discards;
         stats->tx_aborted_errors = raw->tx_exc_col;
         stats->tx_errors = stats->tx_window_errors + stats->tx_fifo_errors +
                 stats->tx_aborted_errors;

I am not sure why you have that problem. In my KSZ8795 board running in kernel 6.16 those counters are working. Using "ethtool -S lan3" or "ethtool -S eth0" shows rx_total and tx_total. The "rx_discards" and "tx_discards" are hard to get. In KSZ8863 the "tx_discards" counter is incremented when the port does not have link and a packet is sent to that port. In newer switches that behavior was changed. Occasionally you may get 1 or 2 at the beginning when the tail tagging function is not enabled yet but the MAC sends out packets. The "rx_discards" count typically seldom happens, but somehow in my first bootup there are many from my KSZ8795 board.

Quoted 4 lines

Actually that many rx_discards may be a problem I need to find out.

I think you are confused about how those MIB counters are read from KSZ8795. They are not using the code in ksz9477.c but in ksz8.c.

See [1] TABLE 4-26: PORT MIB COUNTER INDIRECT MEMORY OFFSETS (CONTINUED) , page 108 at the very end . Notice the table ends at 0x1F TxMultipleCollision .

See [2] TABLE 5-6: MIB COUNTERS (CONTINUED) , page 219 at the end of the table . Notice the table contains four extra entries , 0x80 RxByteCnt , 0x81 TxByteCnt , 0x82 RxDropPackets , 0x83 TXDropPackets .

These entries are present on KSZ9477 and missing on KSZ8795 .

This is what this patch attempts to address.

[1] https://ww1.microchip.com/downloads/aemDocuments/documents/UNG/ProductDocuments/DataSheets/KSZ8795CLX-Data-Sheet-DS00002112.pdf
[2] https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/KSZ9477S-Data-Sheet-DS00002392C.pdf

Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw
Quoted 84 lines · On 8/11/25 10:47 PM, [email protected] wrote:
Quoted 27 lines
Quoted 27 lines

Unlike KSZ94xx, the KSZ87xx is missing the last four MIB counters at address 0x20..0x23, namely rx_total, tx_total, rx_discards, tx_discards.

Using values from rx_total / tx_total in rx_bytes / tx_bytes calculation results in an underflow, because rx_total / tx_total returns values 0, and the "raw->rx_total - stats->rx_packets * ETH_FCS_LEN;" calculation undeflows if rx_packets / tx_packets is > 0 .

Stop using the missing MIB counters on KSZ87xx .

Fixes c6101dd7ffb8 ("net: dsa: ksz9477: move get_stats64 to ksz_common.c")

---
Cc: Andrew Lunn <[email protected]>
Cc: Arun Ramadoss <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Tristram Ha <[email protected]>
Cc: [email protected]
Cc: Vladimir Oltean <[email protected]>
Cc: Woojung Huh <[email protected]>
Cc: [email protected]

---
  drivers/net/dsa/microchip/ksz_common.c | 13 ++++++++-----
  1 file changed, 8 insertions(+), 5 deletions(-)
Quoted 6 lines

drivers/net/dsa/microchip/ksz_common.c void ksz_r_mib_stats64(struct ksz_device *dev, int

Quoted 6 lines
drivers/net/dsa/microchip/ksz_common.c +0 -0
index 7292bfe2f7cac..9c01526779a6d 100644
@@ -2239,20 +2239,23 @@ void ksz_r_mib_stats64(struct ksz_device *dev, int

port)

Quoted 40 lines
Quoted 18 lines
drivers/net/dsa/microchip/ksz_common.c +6 -4
         /* HW counters are counting bytes + FCS which is not acceptable
          * for rtnl_link_stats64 interface
          */
-       stats->rx_bytes = raw->rx_total - stats->rx_packets * ETH_FCS_LEN;
-       stats->tx_bytes = raw->tx_total - stats->tx_packets * ETH_FCS_LEN;
-
+       if (!ksz_is_ksz87xx(dev)) {
+               stats->rx_bytes = raw->rx_total - stats->rx_packets * ETH_FCS_LEN;
+               stats->tx_bytes = raw->tx_total - stats->tx_packets * ETH_FCS_LEN;
+       }
         stats->rx_length_errors = raw->rx_undersize + raw->rx_fragments +
                 raw->rx_oversize;
 
         stats->rx_crc_errors = raw->rx_crc_err;
         stats->rx_frame_errors = raw->rx_align_err;
-       stats->rx_dropped = raw->rx_discards;
+       if (!ksz_is_ksz87xx(dev))
+               stats->rx_dropped = raw->rx_discards;

drivers/net/dsa/microchip/ksz_common.c void ksz_r_mib_stats64(struct ksz_device *dev, int port) · line 2261

Quoted 10 lines
drivers/net/dsa/microchip/ksz_common.c +2 -1
         stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
                 stats->rx_frame_errors  + stats->rx_dropped;
 
         stats->tx_window_errors = raw->tx_late_col;
-       stats->tx_fifo_errors = raw->tx_discards;
+       if (!ksz_is_ksz87xx(dev))
+               stats->tx_fifo_errors = raw->tx_discards;
         stats->tx_aborted_errors = raw->tx_exc_col;
         stats->tx_errors = stats->tx_window_errors + stats->tx_fifo_errors +
                 stats->tx_aborted_errors;

I am not sure why you have that problem. In my KSZ8795 board running in kernel 6.16 those counters are working. Using "ethtool -S lan3" or "ethtool -S eth0" shows rx_total and tx_total. The "rx_discards" and "tx_discards" are hard to get. In KSZ8863 the "tx_discards" counter is incremented when the port does not have link and a packet is sent to that port. In newer switches that behavior was changed. Occasionally you may get 1 or 2 at the beginning when the tail tagging function is not enabled yet but the MAC sends out packets. The "rx_discards" count typically seldom happens, but somehow in my first bootup there are many from my KSZ8795 board.

Quoted 4 lines

Actually that many rx_discards may be a problem I need to find out.

I think you are confused about how those MIB counters are read from KSZ8795. They are not using the code in ksz9477.c but in ksz8.c.

See [1] TABLE 4-26: PORT MIB COUNTER INDIRECT MEMORY OFFSETS (CONTINUED) , page 108 at the very end . Notice the table ends at 0x1F TxMultipleCollision .

Quoted 7 lines

See [2] TABLE 5-6: MIB COUNTERS (CONTINUED) , page 219 at the end of the table . Notice the table contains four extra entries , 0x80 RxByteCnt , 0x81 TxByteCnt , 0x82 RxDropPackets , 0x83 TXDropPackets .

These entries are present on KSZ9477 and missing on KSZ8795 .

This is what this patch attempts to address.

As I said KSZ8795 MIB counters are not using the code in ksz9477.c and their last counter locations are not the same as KSZ9477. KSZ9477 uses ksz9477_r_mib_pkt while KSZ8795 uses ksz8795_r_mib_pkt. The other KSZ8895 and KSZ8863 switches uses ksz8863_r_mib_pkt.

The 0x80 and such registers are not used in KSZ8795. Its registers start at 0x100, 0x101, ...

They are in table 4-28.

#4 lore raw
Quoted 22 lines
Quoted 9 lines
Quoted 4 lines

Actually that many rx_discards may be a problem I need to find out.

I think you are confused about how those MIB counters are read from KSZ8795. They are not using the code in ksz9477.c but in ksz8.c.

See [1] TABLE 4-26: PORT MIB COUNTER INDIRECT MEMORY OFFSETS (CONTINUED) , page 108 at the very end . Notice the table ends at 0x1F TxMultipleCollision .

Quoted 7 lines

See [2] TABLE 5-6: MIB COUNTERS (CONTINUED) , page 219 at the end of the table . Notice the table contains four extra entries , 0x80 RxByteCnt , 0x81 TxByteCnt , 0x82 RxDropPackets , 0x83 TXDropPackets .

These entries are present on KSZ9477 and missing on KSZ8795 .

This is what this patch attempts to address.

As I said KSZ8795 MIB counters are not using the code in ksz9477.c and their last counter locations are not the same as KSZ9477. KSZ9477 uses ksz9477_r_mib_pkt while KSZ8795 uses ksz8795_r_mib_pkt. The other KSZ8895 and KSZ8863 switches uses ksz8863_r_mib_pkt.

Quoted 4 lines

The 0x80 and such registers are not used in KSZ8795. Its registers start at 0x100, 0x101, ...

They are in table 4-28.

Just wanted to chip in that for me, with a KSZ8794, the iproute2 statistics work as expected as well after commit 0d3edc90c4a0 ("net:
dsa: microchip: fix KSZ87xx family structure wrt the datasheet"). I'm on a 6.12 kernel and I see the following:

ip -s -h a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1501 qdisc pfifo_fast state UP group default qlen 1000

    link/ether 08:d3:36:00:38:06 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::ad3:36ff:fe00:3806/64 scope link 
       valid_lft forever preferred_lft forever
    RX:  bytes packets errors dropped  missed   mcast           
         2.22G   30.3M      0       0       0    922k 
    TX:  bytes packets errors dropped carrier collsns           
         3.70G   19.3M      0       0       0       0 

4: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN group default qlen 1000
link/ether 08:d3:36:00:38:06 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped missed mcast
0 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 0 0 0
5: lan2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP group default qlen 1000

    link/ether 08:d3:36:00:38:06 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::ad3:36ff:fe00:3806/64 scope link 
       valid_lft forever preferred_lft forever
    RX:  bytes packets errors dropped  missed   mcast           
         2.62G   30.3M    250     247       0    922k 
    TX:  bytes packets errors dropped carrier collsns           
         3.61G   19.3M      0       0       0       0 
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 08:d3:36:00:38:06 brd ff:ff:ff:ff:ff:ff
    inet 172.18.210.112/26 brd 172.18.210.127 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::ad3:36ff:fe00:3806/64 scope link 
       valid_lft forever preferred_lft forever
    RX:  bytes packets errors dropped  missed   mcast           
         2.19G   30.3M      0    252k       0    922k 
    TX:  bytes packets errors dropped carrier collsns           
         3.60G   19.3M      0       0       0       0 

ethtool -S lan2
NIC statistics:

     tx_packets: 19385247
     tx_bytes: 3615291269
     rx_packets: 30391568
     rx_bytes: 2623613208
     rx_hi: 0
     rx_undersize: 0
     rx_fragments: 0
     rx_oversize: 0
     rx_jabbers: 0
     rx_symbol_err: 3
     rx_crc_err: 3
     rx_align_err: 0
     rx_mac_ctrl: 0
     rx_pause: 0
     rx_bcast: 3985303
     rx_mcast: 924951
     rx_ucast: 25481561
     rx_64_or_less: 5781438
     rx_65_127: 24601395
     rx_128_255: 8744
     rx_256_511: 231
     rx_512_1023: 10
     rx_1024_1522: 3
     rx_1523_2000: 0
     rx_2001: 0
     tx_hi: 0
     tx_late_col: 0
     tx_pause: 0
     tx_bcast: 3
     tx_mcast: 5128
     tx_ucast: 19380278
     tx_deferred: 0
     tx_total_col: 0
     tx_exc_col: 0
     tx_single_col: 0
     tx_mult_col: 0
     rx_total: 2745200072
     tx_total: 3693245281
     rx_discards: 247
     tx_discards: 0
#5 lore raw
Quoted 25 lines · On 8/13/25 9:03 AM, [email protected] wrote:
Quoted 25 lines
Quoted 9 lines
Quoted 4 lines

Actually that many rx_discards may be a problem I need to find out.

I think you are confused about how those MIB counters are read from KSZ8795. They are not using the code in ksz9477.c but in ksz8.c.

See [1] TABLE 4-26: PORT MIB COUNTER INDIRECT MEMORY OFFSETS (CONTINUED) , page 108 at the very end . Notice the table ends at 0x1F TxMultipleCollision .

Quoted 7 lines

See [2] TABLE 5-6: MIB COUNTERS (CONTINUED) , page 219 at the end of the table . Notice the table contains four extra entries , 0x80 RxByteCnt , 0x81 TxByteCnt , 0x82 RxDropPackets , 0x83 TXDropPackets .

These entries are present on KSZ9477 and missing on KSZ8795 .

This is what this patch attempts to address.

As I said KSZ8795 MIB counters are not using the code in ksz9477.c and their last counter locations are not the same as KSZ9477. KSZ9477 uses ksz9477_r_mib_pkt while KSZ8795 uses ksz8795_r_mib_pkt. The other KSZ8895 and KSZ8863 switches uses ksz8863_r_mib_pkt.

The 0x80 and such registers are not used in KSZ8795. Its registers start at 0x100, 0x101, ...

Quoted 6 lines
Quoted 1 line

They are in table 4-28.

Just wanted to chip in that for me, with a KSZ8794, the iproute2 statistics work as expected as well after commit 0d3edc90c4a0 ("net:
dsa: microchip: fix KSZ87xx family structure wrt the datasheet"). I'm on a 6.12 kernel and I see the following:

I'm sorry for my late reply, and yes, I got the versions mixed up.

The problem is still present in 6.6.115 , it is fixed in 6.12.y :

I can confirm 0d3edc90c4a0 ("net: dsa: microchip: fix KSZ87xx family structure wrt the datasheet") fixes the problem, thank you for that!

It would be good to backport this to 6.6.y LTS I think ?

The issue looks like this:

v6.11# cat /proc/net/dev

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes 

packets errs drop fifo colls carrier compressed
eth0: 14818693 10334 0 0 0 0 0 0
335961 2859 0 0 0 0 0 0
lan1: 18446744073709510320 10324 14786075 14786075 0 0
0 10323 18446744073709540220 2849 342812 0 342812 0
0 0

v6.12.56# cat /proc/net/dev

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes 
   packets errs drop fifo colls carrier compressed
  eth0: 14707237   10296    0    0    0     0          0         0 
340493    2889    0    0    0     0       0          0
  lan1: 14632865   10281    0    0    0     0          0         0 
335126    2875    0    0    0     0       0          0

Thank you for your help !