public inbox for linux-can@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] dummy_can: fix packet statistics
@ 2026-01-26 10:45 Oliver Hartkopp
  2026-01-26 18:39 ` Vincent Mailhol
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Oliver Hartkopp @ 2026-01-26 10:45 UTC (permalink / raw)
  To: linux-can; +Cc: Oliver Hartkopp, Vincent Mailhol

The former implementation was only counting the tx_packets value but not
the tx_bytes as the skb was dropped on driver layer.
By enabling the CAN echo support (IFF_ECHO) in dummy_can_init() the code
to put and get the echo skb is activated and the tx_bytes are counted
correctly.

Fixes: 816cf430e84b ("can: add dummy_can driver")
Cc: Vincent Mailhol <mailhol@kernel.org>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
 drivers/net/can/dummy_can.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/dummy_can.c b/drivers/net/can/dummy_can.c
index 41953655e3d3..cd23de488edc 100644
--- a/drivers/net/can/dummy_can.c
+++ b/drivers/net/can/dummy_can.c
@@ -239,10 +239,11 @@ static int __init dummy_can_init(void)
 	if (!dev)
 		return -ENOMEM;
 
 	dev->netdev_ops = &dummy_can_netdev_ops;
 	dev->ethtool_ops = &dummy_can_ethtool_ops;
+	dev->flags |= IFF_ECHO; /* enable echo handling */
 	priv = netdev_priv(dev);
 	priv->can.bittiming_const = &dummy_can_bittiming_const;
 	priv->can.bitrate_max = 20 * MEGA /* BPS */;
 	priv->can.clock.freq = 160 * MEGA /* Hz */;
 	priv->can.fd.data_bittiming_const = &dummy_can_fd_databittiming_const;
-- 
2.47.3


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

end of thread, other threads:[~2026-01-27 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26 10:45 [PATCH v2] dummy_can: fix packet statistics Oliver Hartkopp
2026-01-26 18:39 ` Vincent Mailhol
2026-01-27 15:25 ` Marc Kleine-Budde
2026-01-27 15:34 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox