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

From: Vincent MAILHOL
Date: Tue Nov 23 2021 - 13:11:06 EST

On Tue. 23 Nov. 2021 at 20:53, Vincent Mailhol
<mailhol.vincent@xxxxxxxxxx> 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

[1] commit 59d24425c93d ("can: dev: replace can_priv::ctrlmode_static
by can_get_static_ctrlmode()")

Yours sincerely,
Vincent Mailhol