linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Stefan Mätje" <stefan.maetje@esd.eu>
To: linux-can@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>,
	Wolfgang Grandegger <wg@grandegger.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] can: esd_402_pci: do not increase rx statistics when generating a CAN rx error message frame
Date: Wed,  1 Dec 2021 23:03:27 +0100	[thread overview]
Message-ID: <20211201220328.3079270-4-stefan.maetje@esd.eu> (raw)
In-Reply-To: <20211201220328.3079270-1-stefan.maetje@esd.eu>

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 <mailhol.vincent@wanadoo.fr>
Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
---
 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


  parent reply	other threads:[~2021-12-01 22:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 22:03 [PATCH 0/4] can: esd: add support for esd GmbH PCIe/402 CAN interface Stefan Mätje
2021-12-01 22:03 ` [PATCH 1/4] MAINTAINERS: add Stefan Mätje as maintainer for the esd electronics GmbH CAN drivers Stefan Mätje
2021-12-01 22:03 ` [PATCH 2/4] can: esd: add support for esd GmbH PCIe/402 CAN interface family Stefan Mätje
2022-02-01 17:25   ` [PATCH v6 " Marc Kleine-Budde
2022-09-30 22:15     ` Stefan Mätje
2022-10-05 16:04       ` Marc Kleine-Budde
2021-12-01 22:03 ` Stefan Mätje [this message]
2021-12-01 22:03 ` [PATCH 4/4] can: esd_402_pci: do not increase rx_bytes statistics for RTR frames Stefan Mätje
2021-12-01 22:09 ` [PATCH v6 0/4] can: esd: add support for esd GmbH PCIe/402 CAN interface Stefan Mätje
2022-01-07 13:40   ` Stefan Mätje
2022-01-25 16:25 ` Marc Kleine-Budde
2022-01-27 19:14   ` Stefan Mätje
2022-01-28  8:11     ` Marc Kleine-Budde
2022-02-01 17:27 ` Marc Kleine-Budde
2022-02-02 12:21 ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211201220328.3079270-4-stefan.maetje@esd.eu \
    --to=stefan.maetje@esd.eu \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).