[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250813070321.1608086-1-vtpieter@gmail.com>
Date: Wed, 13 Aug 2025 09:03:21 +0200
From: vtpieter@...il.com
To: 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,
marek.vasut@...lbox.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
> > > 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:
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@...0: <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@...0: <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
Powered by blists - more mailing lists