On 21.01.2022 00:35:43, Angelo Dureghello wrote:
Please apply appropriate change and check if the driver still works if you RX with full CAN bus load. Please also test if you can still receive RTR frames.I tested this patch: -------------------- drivers/net/can/flexcan/flexcan-core.c index 0bff1884d5cc..daeeb6250347 100644 @@ -296,7 +296,10 @@ static_assert(sizeof(struct flexcan_regs) == 0x4 * 18 + 0xfb8); static const struct flexcan_devtype_data fsl_mcf5441x_devtype_data = { .quirks = FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_NR_IRQ_3 | FLEXCAN_QUIRK_NR_MB_16 | - FLEXCAN_QUIRK_SUPPPORT_RX_FIFO, + FLEXCAN_QUIRK_USE_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_FIFO | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR, }; static const struct flexcan_devtype_data fsl_p1010_devtype_data = { Bus load PC -> mcf5441x tested by ip link set can0 type can bitrate 1000000 ip link set can0 up cangen can0 -g 0 On target (mcf54415) candump can0 It works, even better then FIFO mode.
What's the difference, does it produce less overruns?
While unfortunately, RTR rx does not work. Tested it by putting a trace in flexcan_mailbox_read() if (reg_ctrl & FLEXCAN_MB_CNT_RTR) { printk("%s() RX RTR frame\n", __func__); cfd->can_id |= CAN_RTR_FLAG; } on host pc i used: cangen can0 -R No sign of RTR in rx. While in FIFO mode i can see it.
Ok, then I enable the mailbox support for the mcf5441x and fix the note that the IP core doesn't support RTR reception via mailboxes. See the following patch: | https://lore.kernel.org/all/20220121084425.3141218-1-mkl@xxxxxxxxxxxxxx If you have time, please test and add your Tested-by. You can switch to mailbox mode during runtime, if the interface is down: | ethtool --set-priv-flags can0 rx-rtr off With ethtool you can query the number of used RX and TX buffers: | ethtool --show-ring can0 The FIFO mode uses 6 RX buffers, while mailbox mode will probably use 14. 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:
signature.asc
Description: PGP signature