[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250711-astonishing-tentacled-tench-9fe229-mkl@pengutronix.de>
Date: Fri, 11 Jul 2025 11:33:35 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Sean Nyekjaer <sean@...nix.com>
Cc: Chandrasekar Ramakrishnan <rcsekar@...sung.com>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>, Fengguang Wu <fengguang.wu@...el.com>,
Varka Bhadram <varkabhadram@...il.com>, Dong Aisheng <b29396@...escale.com>, linux-can@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] can: m_can: apply rate-limiting to lost msg in rx
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@...adoo.fr>
> Signed-off-by: Sean Nyekjaer <sean@...nix.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 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists