2021-12-01 22:04:08

by Stefan Mätje

[permalink] [raw]
Subject: [PATCH 3/4] can: esd_402_pci: do not increase rx statistics when generating a CAN rx error message frame

The CAN error message frames (i.e. error skb) are an interface
specific to socket CAN. The payload of the CAN error message frames
does not correspond to any actual data sent on the wire. Only an error
flag and a delimiter are transmitted when an error occurs (c.f. ISO
11898-1 section 10.4.4.2 "Error flag").

For this reason, it makes no sense to increment the rx_packets and
rx_bytes fields of struct net_device_stats because no actual payload
were transmitted on the wire.

This patch brings the esd_402_pci driver in line with the other CAN
drivers which have been changed after a suggestion of Vincent Mailhol.

Suggested-by: Vincent Mailhol <[email protected]>
Signed-off-by: Stefan Mätje <[email protected]>
---
drivers/net/can/esd/esdacc.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/net/can/esd/esdacc.c b/drivers/net/can/esd/esdacc.c
index 13f7397dfc4e..f74248662cd6 100644
--- a/drivers/net/can/esd/esdacc.c
+++ b/drivers/net/can/esd/esdacc.c
@@ -555,8 +555,6 @@ static void handle_core_msg_overrun(struct acc_core *core,

skb_hwtstamps(skb)->hwtstamp = acc_ts2ktime(priv->ov, msg->ts);

- stats->rx_packets++;
- stats->rx_bytes += cf->len;
netif_rx(skb);
}

@@ -613,8 +611,6 @@ static void handle_core_msg_buserr(struct acc_core *core,

skb_hwtstamps(skb)->hwtstamp = acc_ts2ktime(priv->ov, msg->ts);

- stats->rx_packets++;
- stats->rx_bytes += cf->len;
netif_rx(skb);
}

@@ -668,8 +664,6 @@ handle_core_msg_errstatechange(struct acc_core *core,

skb_hwtstamps(skb)->hwtstamp = acc_ts2ktime(priv->ov, msg->ts);

- stats->rx_packets++;
- stats->rx_bytes += cf->len;
netif_rx(skb);
} else {
stats->rx_dropped++;
--
2.25.1