Re: RE: mcp251xfd: rx frame truncation (1/2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19.01.2023 13:05:02, Thomas.Kopp@xxxxxxxxxxxxx wrote:
> Are you interrested in analyzing what's going on at those times?

Sure.

> If so, what to do in the driver to stop operation after the message
> has been issued so I can stop the analyzer and sample the chip
> registers?

If you return with an error value, the driver will dump the registers
with devcoredump and disable the IRQs and timestamping:

diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
index 0c89e4f33976..8f821ecde69b 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c
@@ -79,6 +79,8 @@ mcp251xfd_handle_tefif_recover(const struct mcp251xfd_priv *priv, const u32 seq)
                     "not empty" : "empty",
                     seq, priv->tef->tail, priv->tef->head, tx_ring->head);
 
+        return -EINVAL;
+
         /* The Sequence Number in the TEF doesn't match our tef_tail. */
         return -EAGAIN;
 }

Copy
https://github.com/linux-can/can-utils/blob/master/mcp251xfd/99-devcoredump.rules
to /etc/udev/rules.d and
https://github.com/linux-can/can-utils/blob/master/mcp251xfd/devcoredump
to /usr/sbin/

You'll find a coredump in /var/log/

> Absolutely interested, yes. I see the not empty cases pretty often as
> well and they shouldn't be an issue. I still can't reproduce the
> buffer full though. I pretty much only look at the raw SPI
> communication when analyzing this. So whatever you can capture on the
> SPI traces for SPI6 would be interesting for me to look at. If
> possible it would be great to capture either CANL or CANH as well.
> Yes, a full dump of the chip registers and RAM help to correlate
> things but in the end it's the pure SPI traces that help find
> problematic timings.
>
> Not sure how much you can log at a time but maybe it's possible to
> check the dmesg log and then kill your testscript and set a GPIO on
> the pi to trigger your logic analyzer to stop acquiring data? That
> would work if the analyzer can keep a couple seconds in a Ringbuffer
> or something.

If you don't want the devcoredump (which reads all chip registers)
comment it out in
https://elixir.bootlin.com/linux/v6.1.7/source/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c#L1578

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: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux