dummy_can: fix packet statistics
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.
--- drivers/net/can/dummy_can.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/can/dummy_can.c +1 -0
@@ -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
Quoted 9 lines · Oliver Hartkopp
The former implementation was only counting the
tx_packetsvalue but not thetx_bytesas the skb was dropped on driver layer.
By enabling the CAN echo support (IFF_ECHO) indummy_can_init()the code to put and get the echo skb is activated and thetx_bytesare counted correctly.Fixes 816cf430e84b ("can: add dummy_can driver")Cc Vincent Mailhol <[email protected]>Signed-off-by Oliver Hartkopp <[email protected]>
Yours sincerely,
Vincent Mailhol
Quoted 9 lines · Oliver Hartkopp
The former implementation was only counting the
tx_packetsvalue but not thetx_bytesas the skb was dropped on driver layer.
By enabling the CAN echo support (IFF_ECHO) indummy_can_init()the code to put and get the echo skb is activated and thetx_bytesare counted correctly.Fixes 816cf430e84b ("can: add dummy_can driver")Cc Vincent Mailhol <[email protected]>Signed-off-by Oliver Hartkopp <[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 |
Marc Kleine-Budde
maintainerQuoted 5 lines · Oliver Hartkopp
The former implementation was only counting the
tx_packetsvalue but not thetx_bytesas the skb was dropped on driver layer.
By enabling the CAN echo support (IFF_ECHO) indummy_can_init()the code to put and get the echo skb is activated and thetx_bytesare 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 |