From: Marc Kleine-Budde <mkl@pengutronix.de>
To: linux-can@vger.kernel.org
Cc: "Manivannan Sadhasivam" <mani@kernel.org>,
"Thomas Kopp" <thomas.kopp@microchip.com>,
"Stefan Althöfer" <Stefan.Althoefer@janztec.com>,
kernel@pengutronix.de
Subject: Re: [PATCH 0/5] can: mcp251xfd: workaround double-RX erratum
Date: Wed, 11 Jan 2023 23:30:04 +0100 [thread overview]
Message-ID: <20230111223004.w7z4ghdahe7jvebe@pengutronix.de> (raw)
In-Reply-To: <20230111222042.1139027-1-mkl@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 3409 bytes --]
On 11.01.2023 23:20:37, Marc Kleine-Budde wrote:
> this is a proof of concept implementation to work around the
> "double-RX" erratum found by Stefan Althöfer.
>
> With the help of Thomas we found out that the chip has a time window
> after receiving a CAN frame where the RX FIFO STA register content is
> not read correctly.
>
> From the driver's point of view, everything looks consistent at first,
> but the head index of the chip is too large. This causes the driver to
> rehandle old CAN frames that have already been processed.
>
> The workaround uses the RX timestamp to distinguish between new and
> old data. As soon as old data is found, processing is stopped.
>
> The series applies against current net/main. The patches lack proper
> descriptions, I'll add them in the next round.
>
> Happy testing,
> Marc
>
> Link: https://lore.kernel.org/all/FR0P281MB1966273C216630B120ABB6E197E89@FR0P281MB1966.DEUP281.PROD.OUTLOOK.COM
If you add a "#define DEBUG" before any #includes in mcp251xfd-rc.c
you'll get a debug message like this if the workaround triggers:
| Jan 11 22:53:10 riot kernel: mcp251xfd spi1.0 mcp251xfd0: mcp251xfd_handle_rxif_one: last_valid=0x17395fba3d56bb9c ts=0x17395fba3d08ee9e d=0xffffffffffb23302 data=00 02 80 fa 24 cc 43 41 - Dropping
You can also have a look at the interface statistics. The "RX errors:
fifo" is incremented if the workaround triggers.
| $ ip --details -s -s link show mcp251xfd0
| 5: mcp251xfd0: <NOARP,UP,LOWER_UP,ECHO> mtu 72 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
| link/can promiscuity 0 minmtu 0 maxmtu 0
| can <LOOPBACK,BERR-REPORTING,FD> state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 1000
| bitrate 1000000 sample-point 0.750
| tq 25 prop-seg 14 phase-seg1 15 phase-seg2 10 sjw 1 brp 1
| mcp251xfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp_inc 1
| dbitrate 4000000 dsample-point 0.700
| dtq 25 dprop-seg 3 dphase-seg1 3 dphase-seg2 3 dsjw 1 dbrp 1
| mcp251xfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp_inc 1
| clock 40000000
| re-started bus-errors arbit-lost error-warn error-pass bus-off
| 0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 parentbus spi parentdev spi1.0
| RX: bytes packets errors dropped missed mcast
| 190713920 9871978 0 0 0 0
| RX errors: length crc frame fifo overrun
| 0 0 0 1 0
^^^^
| TX: bytes packets errors dropped carrier collsns
| 95356960 4935989 0 0 0 0
| TX errors: aborted fifo window heartbt transns
| 0 0 0 0 1
Note: Certain Out-of-Memory situations also increase the fifo error
counter, but I think you'll get a nice OOM error message from the
kernel, too.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-01-11 22:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 22:20 [PATCH 0/5] can: mcp251xfd: workaround double-RX erratum Marc Kleine-Budde
2023-01-11 22:20 ` [PATCH 1/5] can: mcp251xfd: setup cycle counter before mcp251xfd_ring_init() Marc Kleine-Budde
2023-01-11 22:20 ` [PATCH 2/5] can: mcp251xfd: introduce mcp251xfd_skb_set_timestamp_from_tbc() and make use of it Marc Kleine-Budde
2023-01-11 22:20 ` [PATCH 3/5] can: mcp251xfd: mcp251xfd_handle_rxif_ring_uinc(): factor out in separate function Marc Kleine-Budde
2023-01-11 22:20 ` [PATCH 4/5] can: mcp251xfd: rx: mcp251xfd_handle_rxif_ring() Marc Kleine-Budde
2023-01-11 22:20 ` [PATCH 5/5] can: mcp251xfd: implement workaround for double-RX erratum Marc Kleine-Budde
2023-01-11 22:30 ` Marc Kleine-Budde [this message]
2023-01-12 7:54 ` [PATCH 0/5] can: mcp251xfd: workaround " Marc Kleine-Budde
2023-01-13 12:39 ` AW: " Stefan Althöfer
2023-01-13 13:08 ` Marc Kleine-Budde
2023-01-16 7:19 ` Thomas.Kopp
2023-01-25 5:41 ` Tom Evans
2023-01-25 6:59 ` Thomas.Kopp
2023-01-25 7:42 ` Marc Kleine-Budde
2023-01-25 9:21 ` AW: " Stefan Althöfer
2023-01-16 8:43 ` Stefan Althöfer
2023-01-18 23:11 ` Marc Kleine-Budde
2023-01-16 19:49 ` Stefan Althöfer
2023-01-16 22:15 ` Marc Kleine-Budde
2023-01-19 7:47 ` AW: " Stefan Althöfer
2023-01-19 12:02 ` 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=20230111223004.w7z4ghdahe7jvebe@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=Stefan.Althoefer@janztec.com \
--cc=kernel@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=mani@kernel.org \
--cc=thomas.kopp@microchip.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