Skip to contentSkip to conversation

net: dsa: realtek: rtl8365mb: Do not subtract ifOutDiscards from rx_packets

PATCH Superseded Mieczyslaw Nalewaj 2 participants 4 messages Nov 18, 2025 1 message not in the archive

Subsystems (4)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 net: dsa: realtek: rtl8365mb: Do not subtract ifOutDiscards from rx_packets

In reply to a message not in the archive

rx_packets should report the number of frames successfully received:
unicast + multicast + broadcast. Subtracting ifOutDiscards (a TX counter) is incorrect and can undercount RX packets. RX drops are already reported via rx_dropped (e.g. etherStatsDropEvents), so there is no need to adjust rx_packets.

This patch removes the subtraction of ifOutDiscards from rx_packets in rtl8365mb_stats_update().

---
 drivers/net/dsa/realtek/rtl8365mb.c | 3 +--

 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/dsa/realtek/rtl8365mb.c +0 -0
index 964a56e..af0d84d 100644
@@ -1480,8 +1480,7 @@ static void rtl8365mb_stats_update(struct realtek_priv *priv, int port)


     stats->rx_packets = cnt[RTL8365MB_MIB_ifInUcastPkts] + cnt[RTL8365MB_MIB_ifInMulticastPkts] + -                cnt[RTL8365MB_MIB_ifInBroadcastPkts] - -                cnt[RTL8365MB_MIB_ifOutDiscards]; +                cnt[RTL8365MB_MIB_ifInBroadcastPkts];
     stats->tx_packets = cnt[RTL8365MB_MIB_ifOutUcastPkts] + cnt[RTL8365MB_MIB_ifOutMulticastPkts] + --
2.46.0

maintainer
#2 lore raw
Quoted 8 lines · Mieczyslaw Nalewaj

rx_packets should report the number of frames successfully received:
unicast + multicast + broadcast. Subtracting ifOutDiscards (a TX counter) is incorrect and can undercount RX packets. RX drops are already reported via rx_dropped (e.g. etherStatsDropEvents), so there is no need to adjust rx_packets.

This patch removes the subtraction of ifOutDiscards from rx_packets in rtl8365mb_stats_update().

It does look like a cut/paste error of some sort.

Please could you figure out a Fixes: tag, and submit this to net.

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

Andrew

---
pw-bot: cr

#3 lore raw

I can't pinpoint the commit that caused this error. The file's history on GitHub starts on October 18, 2021, and this error is already occurring.

W wtorek, 18 listopada 2025 17:55:26 CET, Andrew Lunn <[email protected]> napisał(-a):

Quoted 8 lines · Mieczyslaw Nalewaj

rx_packets should report the number of frames successfully received:
unicast + multicast + broadcast. Subtracting ifOutDiscards (a TX counter) is incorrect and can undercount RX packets. RX drops are already reported via rx_dropped (e.g. etherStatsDropEvents), so there is no need to adjust rx_packets.

This patch removes the subtraction of ifOutDiscards from rx_packets in rtl8365mb_stats_update().

It does look like a cut/paste error of some sort.

Please could you figure out a Fixes: tag, and submit this to net.

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

    Andrew

---
pw-bot: cr

maintainer
#4 lore raw
Quoted 1 line · Mieczyslaw Nalewaj

I can't pinpoint the commit that caused this error. The file's history on GitHub starts on October 18, 2021, and this error is already occurring.

Please don't top post.

commit 4af2950c50c8634ed2865cf81e607034f78b84aa

Author: Alvin Šipraga <[email protected]>
Date:   Mon Oct 18 11:38:01 2021 +0200

net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC

Does appear to suggest it was always broken. So use that for the
Fixes: tag.

Andrew