[PATCH v1 2/2] can: do not increase rx_bytes statistics for RTR frames

Vincent MAILHOL mailhol.vincent at wanadoo.fr
Tue Nov 23 10:10:50 PST 2021


On Tue. 23 Nov. 2021 at 20:53, Vincent Mailhol
<mailhol.vincent at wanadoo.fr> wrote:
> The actual payload length of the CAN Remote Transmission Request (RTR)
> frames is always 0, i.e. nothing is transmitted on the wire. However,
> those RTR frames still uses the DLC to indicate the length of the
> requested frame.
>
> As such, net_device_stats:rx_bytes should not be increased for the RTR
> frames.
>
> This patch fixes all the CAN drivers.

Actually, I just realized that we also need to fix the tx path.

Since [1], can_get_echo_skb() returns the correct length (even
for RTR frames). So as long as the drivers use this function,
everything should be fine. But the fact is that the majority do
not (probably for historical reasons).  Long story short, I will
send a v2 in which there will be an additional third patch to
address the tx_bytes statistics of the RTR frames in the tx
path.

[1] commit 59d24425c93d ("can: dev: replace can_priv::ctrlmode_static
by can_get_static_ctrlmode()")
https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/commit/?h=testing&id=ed3320cec279407a86bc4c72edc4a39eb49165ec

Yours sincerely,
Vincent Mailhol



More information about the linux-arm-kernel mailing list