Re: [PATCH] can: m_can: reset IR_RF0L in message reception loop

Torin Cooper-Bennun
2021-03-04T00:23:59Z

On Mon, Mar 01, 2021 at 10:21:27PM +0100, Mariusz Madej wrote:
> Message lost warning is reported in loop without interrupt reset. Besides
> redundant log messages it may lead to serious performance problem, where
> fifo gets full faster than next reception is scheduled by NAPI. This
> patch fixes it.

Looking at the flow in m_can_rx_handler, it looks as though
m_can_handle_bus_errors -> m_can_handle_lost_msg already handles message
loss properly, and issues a netdev_err. I wonder whether we can remove
the warning from m_can_do_rx_poll entirely:

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 3752520a7d4b..d783c46cac16 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -501,9 +501,6 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota)
}

while ((rxfs & RXFS_FFL_MASK) && (quota > 0)) {
- if (rxfs & RXFS_RFL)
- netdev_warn(dev, "Rx FIFO 0 Message Lost\n");
-
m_can_read_fifo(dev, rxfs);

quota--;

---
Regards,

Torin Cooper-Bennun
Software Engineer | maxiluxsystems.com