]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: fec: correct rx_bytes statistic for the case SHIFT16 is set
authorWei Fang <wei.fang@nxp.com>
Thu, 6 Nov 2025 02:14:21 +0000 (10:14 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 8 Nov 2025 02:55:27 +0000 (18:55 -0800)
Two additional bytes in front of each frame received into the RX FIFO if
SHIFT16 is set, so we need to subtract the extra two bytes from pkt_len
to correct the statistic of rx_bytes.

Fixes: 3ac72b7b63d5 ("net: fec: align IP header in hardware")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20251106021421.2096585-1-wei.fang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fec_main.c

index 1edcfaee6819e02d44f6eb51baaef0d43db69de6..3222359ac15b7745270c066b0a2de5eb19135024 100644 (file)
@@ -1835,6 +1835,8 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
                ndev->stats.rx_packets++;
                pkt_len = fec16_to_cpu(bdp->cbd_datlen);
                ndev->stats.rx_bytes += pkt_len;
+               if (fep->quirks & FEC_QUIRK_HAS_RACC)
+                       ndev->stats.rx_bytes -= 2;
 
                index = fec_enet_get_bd_index(bdp, &rxq->bd);
                page = rxq->rx_skb_info[index].page;