Re: [PATCH 3/3] can: peak_usb: fix potential kernel log flooding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16.02.2024 10:37:48, Vincent Mailhol wrote:
> > +static void pcan_usb_fd_handle_rx_cache_warn(struct peak_usb_device *dev,
> > +                                            struct pucan_msg *rx_msg)
> > +{
> > +       struct pcan_usb_fd_device *pdev =
> > +                       container_of(dev, struct pcan_usb_fd_device, dev);
> > +
> > +       if (pdev->rx_cache_warn_handled)
> > +               return;
> > +
> > +       netdev_warn(dev->netdev,
> > +                   "Rx cache size warning! Possible loss of frames\n");
> 
> Did you consider using netdev_warn_once?
> 
>   https://elixir.bootlin.com/linux/v6.7/source/include/net/net_debug.h#L46
> 
> This seems to do pretty much what you want.
> 
> FYI, the net_ratelimit() may also be helpful here:
> 
>         if (net_ratelimit())
>                 netdev_warn(...);

There is also dev_warn_ratelimited(), but this does not output the
associated netdev. This could be useful if an error occurs on USB
devices with multiple network devices and the error cannot be linked to
a network device. But AFAICS there is no netdev_warn_ratelimited().

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   |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux