[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c97cf296-f947-40d5-a4bc-6c30c2ba753b@mailbox.org>
Date: Sun, 2 Nov 2025 00:15:35 +0100
From: Marek Vasut <marek.vasut@...lbox.org>
To: vtpieter@...il.com, tristram.ha@...rochip.com
Cc: Arun.Ramadoss@...rochip.com, UNGLinuxDriver@...rochip.com,
Woojung.Huh@...rochip.com, andrew@...n.ch, edumazet@...gle.com,
kuba@...nel.org, netdev@...r.kernel.org, olteanv@...il.com, pabeni@...hat.com
Subject: Re: [net-next,PATCH] net: dsa: microchip: Do not count RX/TX Bytes
and discards on KSZ87xx
On 8/13/25 9:03 AM, vtpieter@...il.com wrote:
>>>> 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.
>>
>> 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.
>
> 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 !
Powered by blists - more mailing lists