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