All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: don't count arbitration lose as an error
@ 2020-11-27  9:59 ` Jeroen Hofstee
  0 siblings, 0 replies; 21+ messages in thread
From: Jeroen Hofstee @ 2020-11-27  9:59 UTC (permalink / raw)
  To: linux-can
  Cc: Jeroen Hofstee, Wolfgang Grandegger, Marc Kleine-Budde,
	David S. Miller, Jakub Kicinski, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, open list:NETWORKING DRIVERS, open list,
	moderated list:ARM/Allwinner sunXi SoC support

Losing arbitration is normal in a CAN-bus network, it means that a
higher priority frame is being send and the pending message will be
retried later. Hence most driver only increment arbitration_lost, but
the sja1000 and sun4i driver also incremeant tx_error, causing errors
to be reported on a normal functioning CAN-bus. So stop counting them
as errors.

For completeness, the Kvaser USB hybra also increments the tx_error
on arbitration lose, but it does so in single shot. Since in that
case the message is not retried, that behaviour is kept.

Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
---
 drivers/net/can/sja1000/sja1000.c | 1 -
 drivers/net/can/sun4i_can.c       | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 9f107798f904..25a4d7d0b349 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -474,7 +474,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
 		netdev_dbg(dev, "arbitration lost interrupt\n");
 		alc = priv->read_reg(priv, SJA1000_ALC);
 		priv->can.can_stats.arbitration_lost++;
-		stats->tx_errors++;
 		cf->can_id |= CAN_ERR_LOSTARB;
 		cf->data[0] = alc & 0x1f;
 	}
diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c
index e2c6cf4b2228..b3f2f4fe5ee0 100644
--- a/drivers/net/can/sun4i_can.c
+++ b/drivers/net/can/sun4i_can.c
@@ -604,7 +604,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
 		netdev_dbg(dev, "arbitration lost interrupt\n");
 		alc = readl(priv->base + SUN4I_REG_STA_ADDR);
 		priv->can.can_stats.arbitration_lost++;
-		stats->tx_errors++;
 		if (likely(skb)) {
 			cf->can_id |= CAN_ERR_LOSTARB;
 			cf->data[0] = (alc >> 8) & 0x1f;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-12-02 16:33 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27  9:59 [PATCH] can: don't count arbitration lose as an error Jeroen Hofstee
2020-11-27  9:59 ` Jeroen Hofstee
2020-11-27 10:30 ` Marc Kleine-Budde
2020-11-27 10:30   ` Marc Kleine-Budde
2020-11-27 11:09   ` Jeroen Hofstee
2020-11-27 11:09     ` Jeroen Hofstee
2020-11-27 16:02     ` Jeroen Hofstee
2020-11-28 17:23     ` Oliver Hartkopp
2020-11-28 17:23       ` Oliver Hartkopp
2020-11-29 15:52       ` Jeroen Hofstee
2020-11-29 15:52         ` Jeroen Hofstee
2020-12-02 14:35     ` Oliver Hartkopp
2020-12-02 14:35       ` Oliver Hartkopp
2020-12-02 15:37       ` Jeroen Hofstee
2020-12-02 15:37         ` Jeroen Hofstee
2020-12-02 16:22         ` Oliver Hartkopp
2020-12-02 16:22           ` Oliver Hartkopp
2020-12-02 16:31           ` Jeroen Hofstee
2020-12-02 16:31             ` Jeroen Hofstee
2020-11-30 11:50   ` Marc Kleine-Budde
2020-11-30 11:50     ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.