* [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
* Re: [PATCH v2] dummy_can: fix packet statistics
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
2 siblings, 0 replies; 4+ messages in thread
From: Vincent Mailhol @ 2026-01-26 18:39 UTC (permalink / raw)
To: Oliver Hartkopp, linux-can
On 26/01/2026 at 11:45, Oliver Hartkopp wrote:
> 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>
Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
Yours sincerely,
Vincent Mailhol
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] dummy_can: fix packet statistics
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
2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2026-01-27 15:25 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: linux-can, Vincent Mailhol
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
On 26.01.2026 11:45:40, Oliver Hartkopp wrote:
> 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>
Applied to linux-can.
Thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] dummy_can: fix packet statistics
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
2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2026-01-27 15:34 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: linux-can, Vincent Mailhol
[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]
On 26.01.2026 11:45:40, Oliver Hartkopp wrote:
> 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.
Re-phrased the commit message to make it more imperative:
can: dummy_can: dummy_can_init(): fix packet statistics
The former implementation was only counting the tx_packets value but not
the tx_bytes as the skb was dropped on driver layer.
Enable CAN echo support (IFF_ECHO) in dummy_can_init(), which activates the
code for setting and retrieving the echo SKB and counts the tx_bytes
correctly.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [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