]> www.infradead.org Git - users/dwmw2/linux.git/commit
net: enetc: correct the statistics of rx bytes
authorWei Fang <wei.fang@nxp.com>
Fri, 2 Jun 2023 09:46:58 +0000 (17:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2023 09:15:17 +0000 (11:15 +0200)
commitb3fc768a746bf5da0bffe9a1d525c61a3208b56c
tree57cbd0c46ac883b1c3faa770a86e4e98b4cd3371
parent7a5cdd4bc1c3e53b101a0cfa949a30bc7582e6c6
net: enetc: correct the statistics of rx bytes

[ Upstream commit 7190d0ff0e17690a9b1279d84a06473600ba2060 ]

The rx_bytes of struct net_device_stats should count the length of
ethernet frames excluding the FCS. However, there are two problems
with the rx_bytes statistics of the current enetc driver. one is
that the length of VLAN header is not counted if the VLAN extraction
feature is enabled. The other is that the length of L2 header is not
counted, because eth_type_trans() is invoked before updating rx_bytes
which will subtract the length of L2 header from skb->len.
BTW, the rx_bytes statistics of XDP path also have similar problem,
I will fix it in another patch.

Fixes: a800abd3ecb9 ("net: enetc: move skb creation into enetc_build_skb")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc.c