linux/drivers/net/can
Marc Kleine-Budde 9933c2d216 can: mcp251xfd: rx: add workaround for erratum DS80000789E 6 of mcp2518fd
[ Upstream commit 24436be590 ]

This patch tries to works around erratum DS80000789E 6 of the
mcp2518fd, the other variants of the chip family (mcp2517fd and
mcp251863) are probably also affected.

In the bad case, the driver reads a too large head index. In the
original code, the driver always trusted the read value, which caused
old, already processed CAN frames or new, incompletely written CAN
frames to be (re-)processed.

To work around this issue, keep a per FIFO timestamp [1] of the last
valid received CAN frame and compare against the timestamp of every
received CAN frame. If an old CAN frame is detected, abort the
iteration and mark the number of valid CAN frames as processed in the
chip by incrementing the FIFO's tail index.

Further tests showed that this workaround can recognize old CAN
frames, but a small time window remains in which partially written CAN
frames [2] are not recognized but then processed. These CAN frames
have the correct data and time stamps, but the DLC has not yet been
updated.

[1] As the raw timestamp overflows every 107 seconds (at the usual
    clock rate of 40 MHz) convert it to nanoseconds with the
    timecounter framework and use this to detect stale CAN frames.

Link: https://lore.kernel.org/all/BL3PR11MB64844C1C95CA3BDADAE4D8CCFBC99@BL3PR11MB6484.namprd11.prod.outlook.com [2]
Reported-by: Stefan Althöfer <Stefan.Althoefer@janztec.com>
Closes: https://lore.kernel.org/all/FR0P281MB1966273C216630B120ABB6E197E89@FR0P281MB1966.DEUP281.PROD.OUTLOOK.COM
Tested-by: Stefan Althöfer <Stefan.Althoefer@janztec.com>
Tested-by: Thomas Kopp <thomas.kopp@microchip.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-09-12 11:10:28 +02:00
..
c_can can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
cc770 can: cc770: cc770_isa_probe(): add missing free_cc770dev() 2022-11-24 16:09:53 +01:00
ctucanfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
dev can: netlink: Fix TDCO calculation using the old data bittiming 2024-02-23 09:12:47 +01:00
flexcan can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
ifi_canfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
m_can can: m_can: Release irq on error in m_can_open 2024-09-12 11:10:21 +02:00
mscan can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
peak_canfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
rcar can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses 2023-03-10 09:32:58 +01:00
sja1000 can: sja1000_isa: sja1000_isa_probe(): add missing free_sja1000dev() 2022-11-24 16:09:39 +01:00
slcan can: slcan: fix freed work crash 2022-12-07 10:32:24 +01:00
softing can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
spi can: mcp251xfd: rx: add workaround for erratum DS80000789E 6 of mcp2518fd 2024-09-12 11:10:28 +02:00
usb can: kvaser_usb: fix return value for hif_usb_send_regout 2024-07-25 09:49:15 +02:00
at91_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
can327.c can: can327: flush TX_work on ldisc .close() 2022-12-07 10:32:36 +01:00
grcan.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
janz-ican3.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
Kconfig can: sun4i_can: Only show Kconfig if ARCH_SUNXI is set 2023-10-19 23:08:52 +02:00
kvaser_pciefd.c can: kvaser_pciefd: Set hardware timestamp on transmitted packets 2023-07-19 16:21:11 +02:00
Makefile can: slcan: move driver into separate sub directory 2022-07-03 11:34:44 +02:00
pch_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
sun4i_can.c can: sun4i_can: Add support for the Allwinner D1 2023-09-23 11:11:02 +02:00
ti_hecc.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
vcan.c can: dev: add CAN XL support to virtual CAN 2022-09-15 09:08:09 +02:00
vxcan.c net: validate veth and vxcan peer ifindexes 2023-08-30 16:11:02 +02:00
xilinx_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00