drivers/net/can/m_can/m_can.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Wrap the "msg lost in rxf0" error in m_can_handle_lost_msg() with
a call to net_ratelimit() to prevent flooding the kernel log
with repeated debug messages.
Fixes: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support")
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
---
Changes in v2:
- Changed to dbg msg
- Link to v1: https://lore.kernel.org/r/20250620-mcan_ratelimit-v1-1-e747ee30f71f@geanix.com
---
drivers/net/can/m_can/m_can.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 6c656bfdb3235e1f5d6405c49b07b821ddacc1b9..9f43111609d364c01c6df10489fc4708deab9fbb 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -665,7 +665,8 @@ static int m_can_handle_lost_msg(struct net_device *dev)
struct can_frame *frame;
u32 timestamp = 0;
- netdev_err(dev, "msg lost in rxf0\n");
+ if (net_ratelimit())
+ netdev_dbg(dev, "msg lost in rxf0\n");
stats->rx_errors++;
stats->rx_over_errors++;
---
base-commit: db22720545207f734aaa9d9f71637bfc8b0155e0
change-id: 20250620-mcan_ratelimit-e7e1f9d8fa9c
Best regards,
--
Sean Nyekjaer <sean@geanix.com>
On 30.06.2025 09:52:44, Sean Nyekjaer wrote:
> Wrap the "msg lost in rxf0" error in m_can_handle_lost_msg() with
> a call to net_ratelimit() to prevent flooding the kernel log
> with repeated debug messages.
>
> Fixes: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support")
> Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
> Changes in v2:
> - Changed to dbg msg
> - Link to v1: https://lore.kernel.org/r/20250620-mcan_ratelimit-v1-1-e747ee30f71f@geanix.com
> ---
> drivers/net/can/m_can/m_can.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index 6c656bfdb3235e1f5d6405c49b07b821ddacc1b9..9f43111609d364c01c6df10489fc4708deab9fbb 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -665,7 +665,8 @@ static int m_can_handle_lost_msg(struct net_device *dev)
> struct can_frame *frame;
> u32 timestamp = 0;
>
> - netdev_err(dev, "msg lost in rxf0\n");
> + if (net_ratelimit())
> + netdev_dbg(dev, "msg lost in rxf0\n");
This has some subtle side effects. Even if debugging is not enabled, you
will still get the "... output lines suppressed due to ratelimiting"
message, which is IMHO very confusing :)
What about replacing the netdev_err() by netdev_dbg()?
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -665,7 +665,7 @@ static int m_can_handle_lost_msg(struct net_device *dev)
struct can_frame *frame;
u32 timestamp = 0;
- netdev_err(dev, "msg lost in rxf0\n");
+ netdev_dbg(dev, "msg lost in rxf0\n");
stats->rx_errors++;
stats->rx_over_errors++;
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Hi,
On Fri, Jul 11, 2025 at 11:33:35AM +0100, Marc Kleine-Budde wrote:
> On 30.06.2025 09:52:44, Sean Nyekjaer wrote:
> > Wrap the "msg lost in rxf0" error in m_can_handle_lost_msg() with
> > a call to net_ratelimit() to prevent flooding the kernel log
> > with repeated debug messages.
> >
> > Fixes: e0d1f4816f2a ("can: m_can: add Bosch M_CAN controller support")
> > Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > ---
> > Changes in v2:
> > - Changed to dbg msg
> > - Link to v1: https://lore.kernel.org/r/20250620-mcan_ratelimit-v1-1-e747ee30f71f@geanix.com
> > ---
> > drivers/net/can/m_can/m_can.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> > index 6c656bfdb3235e1f5d6405c49b07b821ddacc1b9..9f43111609d364c01c6df10489fc4708deab9fbb 100644
> > --- a/drivers/net/can/m_can/m_can.c
> > +++ b/drivers/net/can/m_can/m_can.c
> > @@ -665,7 +665,8 @@ static int m_can_handle_lost_msg(struct net_device *dev)
> > struct can_frame *frame;
> > u32 timestamp = 0;
> >
> > - netdev_err(dev, "msg lost in rxf0\n");
> > + if (net_ratelimit())
> > + netdev_dbg(dev, "msg lost in rxf0\n");
>
> This has some subtle side effects. Even if debugging is not enabled, you
> will still get the "... output lines suppressed due to ratelimiting"
> message, which is IMHO very confusing :)
Indeed yes :)
>
> What about replacing the netdev_err() by netdev_dbg()?
>
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -665,7 +665,7 @@ static int m_can_handle_lost_msg(struct net_device *dev)
> struct can_frame *frame;
> u32 timestamp = 0;
>
> - netdev_err(dev, "msg lost in rxf0\n");
> + netdev_dbg(dev, "msg lost in rxf0\n");
>
> stats->rx_errors++;
> stats->rx_over_errors++;
>
Yeah that will do. V3 or?
/Sean
On 11.07.2025 09:58:53, Sean Nyekjaer wrote: > > What about replacing the netdev_err() by netdev_dbg()? > > > > --- a/drivers/net/can/m_can/m_can.c > > +++ b/drivers/net/can/m_can/m_can.c > > @@ -665,7 +665,7 @@ static int m_can_handle_lost_msg(struct net_device *dev) > > struct can_frame *frame; > > u32 timestamp = 0; > > > > - netdev_err(dev, "msg lost in rxf0\n"); > > + netdev_dbg(dev, "msg lost in rxf0\n"); > > > > stats->rx_errors++; > > stats->rx_over_errors++; > > > > Yeah that will do. V3 or? Yes, please. Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
© 2016 - 2026 Red Hat, Inc.