All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: m_can: reset IR_RF0L in message reception loop
@ 2021-03-01 21:21 Mariusz Madej
  2021-03-03  8:08 ` Torin Cooper-Bennun
  0 siblings, 1 reply; 4+ messages in thread
From: Mariusz Madej @ 2021-03-01 21:21 UTC (permalink / raw)
  To: linux-can; +Cc: Wolfgang Grandegger, Marc Kleine-Budde

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.

Signed-off-by: Mariusz Madej <mariusz.madej@xtrack.com>
---
  drivers/net/can/m_can/m_can.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 3752520a7..bd5539435 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -501,8 +501,10 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota)
  	}
  
  	while ((rxfs & RXFS_FFL_MASK) && (quota > 0)) {
-		if (rxfs & RXFS_RFL)
+		if (rxfs & RXFS_RFL) {
  			netdev_warn(dev, "Rx FIFO 0 Message Lost\n");
+			m_can_write(cdev, M_CAN_IR, IR_RF0L);	
+		}
  
  		m_can_read_fifo(dev, rxfs);
  
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: m_can: reset IR_RF0L in message reception loop
  2021-03-01 21:21 [PATCH] can: m_can: reset IR_RF0L in message reception loop Mariusz Madej
@ 2021-03-03  8:08 ` Torin Cooper-Bennun
  2021-03-03  8:31   ` Marc Kleine-Budde
  0 siblings, 1 reply; 4+ messages in thread
From: Torin Cooper-Bennun @ 2021-03-03  8:08 UTC (permalink / raw)
  To: Mariusz Madej; +Cc: linux-can, Wolfgang Grandegger, Marc Kleine-Budde

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: m_can: reset IR_RF0L in message reception loop
  2021-03-03  8:08 ` Torin Cooper-Bennun
@ 2021-03-03  8:31   ` Marc Kleine-Budde
  2021-03-03 10:20     ` Torin Cooper-Bennun
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-03-03  8:31 UTC (permalink / raw)
  To: Torin Cooper-Bennun; +Cc: Mariusz Madej, linux-can, Wolfgang Grandegger

[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]

On 03.03.2021 08:08:09, Torin Cooper-Bennun wrote:
> 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--;
> 

Looks good to me. Can you send a proper patch?

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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] can: m_can: reset IR_RF0L in message reception loop
  2021-03-03  8:31   ` Marc Kleine-Budde
@ 2021-03-03 10:20     ` Torin Cooper-Bennun
  0 siblings, 0 replies; 4+ messages in thread
From: Torin Cooper-Bennun @ 2021-03-03 10:20 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: Mariusz Madej, linux-can, Wolfgang Grandegger

On Wed, Mar 03, 2021 at 09:31:36AM +0100, Marc Kleine-Budde wrote:
> > 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--;
> > 
> 
> Looks good to me. Can you send a proper patch?

Of course, will do shortly.

--
Regards,

Torin Cooper-Bennun
Software Engineer | maxiluxsystems.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-04  0:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 21:21 [PATCH] can: m_can: reset IR_RF0L in message reception loop Mariusz Madej
2021-03-03  8:08 ` Torin Cooper-Bennun
2021-03-03  8:31   ` Marc Kleine-Budde
2021-03-03 10:20     ` Torin Cooper-Bennun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.