linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: dlink: fix multicast stats being counted incorrectly
@ 2025-08-22 12:02 Yeounsu Moon
  2025-08-22 15:15 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Yeounsu Moon @ 2025-08-22 12:02 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Yeounsu Moon, netdev, linux-kernel

`McstFramesRcvdOk` counts the number of received multicast packets, and
it reports the value correctly.

However, reading `McstFramesRcvdOk` clears the register to zero. As a
result, the driver was reporting only the packets since the last read,
instead of the accumulated total.

Fix this by updating the multicast statistics accumulatively instaed of
instantaneously.

Fixes: 3401299a1b9e747cbf7de2cc0c8f6376c3cbe565 ("de6*/dl2k/sundance: Move the D-Link drivers")
Tested-on: D-Link DGE-550T Rev-A3
Signed-off-by: Yeounsu Moon <yyyynoom@gmail.com>
---
Changelog:
v1: https://lore.kernel.org/netdev/20250821114254.3384-1-yyyynoom@gmail.com/
v2:
- Change subject `net-next` to `net`.
- Add `Fixes:` tag.
---
 drivers/net/ethernet/dlink/dl2k.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c
index cc60ee454bf9..6bbf6e5584e5 100644
--- a/drivers/net/ethernet/dlink/dl2k.c
+++ b/drivers/net/ethernet/dlink/dl2k.c
@@ -1099,7 +1099,7 @@ get_stats (struct net_device *dev)
 	dev->stats.rx_bytes += dr32(OctetRcvOk);
 	dev->stats.tx_bytes += dr32(OctetXmtOk);
 
-	dev->stats.multicast = dr32(McstFramesRcvdOk);
+	dev->stats.multicast += dr32(McstFramesRcvdOk);
 	dev->stats.collisions += dr32(SingleColFrames)
 			     +  dr32(MultiColFrames);
 
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2] net: dlink: fix multicast stats being counted incorrectly
  2025-08-22 12:02 [PATCH net v2] net: dlink: fix multicast stats being counted incorrectly Yeounsu Moon
@ 2025-08-22 15:15 ` Andrew Lunn
  2025-08-23 16:33   ` Yeounsu Moon
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2025-08-22 15:15 UTC (permalink / raw)
  To: Yeounsu Moon
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel

On Fri, Aug 22, 2025 at 09:02:46PM +0900, Yeounsu Moon wrote:
> `McstFramesRcvdOk` counts the number of received multicast packets, and
> it reports the value correctly.
> 
> However, reading `McstFramesRcvdOk` clears the register to zero. As a
> result, the driver was reporting only the packets since the last read,
> instead of the accumulated total.
> 
> Fix this by updating the multicast statistics accumulatively instaed of
> instantaneously.
> 
> Fixes: 3401299a1b9e747cbf7de2cc0c8f6376c3cbe565 ("de6*/dl2k/sundance: Move the D-Link drivers")

The hash for fixes tends to be shorter than that.

Fixes: 3401299a1b9e ("de6*/dl2k/sundance: Move the D-Link drivers")

If you add this to your .git/config

[pretty]
        fixes = Fixes: %h (\"%s\")

You can do

git log --pretty=fixes 3401299a1b9e747cbf7de2cc0c8f6376c3cbe565
Fixes: 3401299a1b9e ("de6*/dl2k/sundance: Move the D-Link drivers")

This problem actually goes back further:

git blame 3401299a1b9e~1 drivers/net/dl2k.c

shows it was broken in the first commit in git.

So the correct Fixes: tag is:

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")

    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2] net: dlink: fix multicast stats being counted incorrectly
  2025-08-22 15:15 ` Andrew Lunn
@ 2025-08-23 16:33   ` Yeounsu Moon
  2025-08-23 17:21     ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Yeounsu Moon @ 2025-08-23 16:33 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel

On Sat Aug 23, 2025 at 12:15 AM KST, Andrew Lunn wrote:
> The hash for fixes tends to be shorter than that.
>
> Fixes: 3401299a1b9e ("de6*/dl2k/sundance: Move the D-Link drivers")
>
> If you add this to your .git/config
>
> [pretty]
>         fixes = Fixes: %h (\"%s\")
>
> You can do
>
> git log --pretty=fixes 3401299a1b9e747cbf7de2cc0c8f6376c3cbe565
> Fixes: 3401299a1b9e ("de6*/dl2k/sundance: Move the D-Link drivers")
>
Thanks for pointing that out.


> This problem actually goes back further:
>
> git blame 3401299a1b9e~1 drivers/net/dl2k.c
>
> shows it was broken in the first commit in git.
>
> So the correct Fixes: tag is:
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>
Regarding the Fixes: tag, I have one question. You suggested
1da177e4c3f4 ("Linux-2.6.12-rc2"), which is indeed the first commit in
the current git history. However, the actual code change seems to go
back further, and I found it in the history.git repository.

In such cases, should the Fixes: tag refer to the first commit in the
mailine git tree, or to the actual commit in history.git where the bug
originated?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v2] net: dlink: fix multicast stats being counted incorrectly
  2025-08-23 16:33   ` Yeounsu Moon
@ 2025-08-23 17:21     ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2025-08-23 17:21 UTC (permalink / raw)
  To: Yeounsu Moon
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel

> Regarding the Fixes: tag, I have one question. You suggested
> 1da177e4c3f4 ("Linux-2.6.12-rc2"), which is indeed the first commit in
> the current git history. However, the actual code change seems to go
> back further, and I found it in the history.git repository.
> 
> In such cases, should the Fixes: tag refer to the first commit in the
> mailine git tree, or to the actual commit in history.git where the bug
> originated?

Nobody except historians care about history.git. In practice, nobody
cares about 2.6 either. https://www.kernel.org/ shows that v5.4 is the
oldest supported kernel. But Linux-2.6.12-rc2 is a convenient
reference point, so that is what is used when it has always been
broken in the git era.

	Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-23 17:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 12:02 [PATCH net v2] net: dlink: fix multicast stats being counted incorrectly Yeounsu Moon
2025-08-22 15:15 ` Andrew Lunn
2025-08-23 16:33   ` Yeounsu Moon
2025-08-23 17:21     ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).