]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: stmmac: dwmac4: fix RX FIFO fill statistics
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 8 Jan 2026 17:36:14 +0000 (17:36 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 13 Jan 2026 02:02:10 +0000 (18:02 -0800)
commit65b21a7d4de48f5fede3c78495b4fdf61762005e
tree8a0b43ed335758a96b0dcc30af3cd0e4743414d3
parent1fd3b573713a91bc65cb90b919f17786fe7f147a
net: stmmac: dwmac4: fix RX FIFO fill statistics

In dwmac4_debug(), the wrong shift is used with the RXFSTS mask:

 #define MTL_DEBUG_RXFSTS_MASK          GENMASK(5, 4)
 #define MTL_DEBUG_RXFSTS_SHIFT         4
 #define MTL_DEBUG_RRCSTS_SHIFT         1

                       u32 rxfsts = (value & MTL_DEBUG_RXFSTS_MASK)
                                    >> MTL_DEBUG_RRCSTS_SHIFT;

where rxfsts is tested against small integers 1 .. 3. This results in
the tests always failing, causing the "mtl_rx_fifo__fill_level_empty"
statistic counter to always be incremented no matter what the fill
level actually is.

Fix this by using FIELD_GET() and remove the unnecessary
MTL_DEBUG_RXFSTS_SHIFT definition as FIELD_GET() will shift according
to the least siginificant set bit in the supplied field mask.

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vdtvi-00000002GtP-1Os1@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac4.h
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c