Skip to contentSkip to conversation

dummy_can: fix packet statistics

PATCH Applied Oliver Hartkopp 3 participants 4 messages Jan 26 – Jan 27 CAN network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dummy_can: 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.
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 <[email protected]>
---
 drivers/net/can/dummy_can.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/can/dummy_can.c +1 -0
index 41953655e3d3..cd23de488edc 100644
@@ -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;
Signature · 1 line
2.47.3
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Oliver Hartkopp

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 <[email protected]>

Yours sincerely,
Vincent Mailhol

maintainer Applied
#2 lore raw
In reply to Oliver Hartkopp
Quoted 9 lines · Oliver Hartkopp

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 <[email protected]>

Applied to linux-can.

Thanks,
Marc

Signature · 4 lines
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   |
#3 lore raw
In reply to Oliver Hartkopp
Quoted 5 lines · Oliver Hartkopp

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

Signature · 4 lines
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   |