Re: [PATCH] [RFC] net: fec: Allow turning off IRQ coalescing
From: Andrew Lunn
Date: Sun Feb 19 2023 - 20:09:37 EST
> /* Set threshold for interrupt coalescing */
> -static void fec_enet_itr_coal_set(struct net_device *ndev)
> +static int fec_enet_itr_coal_set(struct net_device *ndev)
> {
> + bool disable_rx_itr = false, disable_tx_itr = false;
> struct fec_enet_private *fep = netdev_priv(ndev);
> - int rx_itr, tx_itr;
> + struct device *dev = &fep->pdev->dev;
> + int rx_itr = 0, tx_itr = 0;
>
> - /* Must be greater than zero to avoid unpredictable behavior */
> - if (!fep->rx_time_itr || !fep->rx_pkts_itr ||
> - !fep->tx_time_itr || !fep->tx_pkts_itr)
> - return;
> + if (!fep->rx_time_itr || !fep->rx_pkts_itr) {
> + if (fep->rx_time_itr || fep->rx_pkts_itr) {
> + dev_warn(dev, "Rx coalesced frames and usec have to be "
> + "both positive or both zero to disable Rx "
> + "coalescence completely\n");
> + return -EINVAL;
> + }
Hi Richard
Why do this validation here, and not in fec_enet_set_coalesce() where
there are already checks? fec_enet_set_coalesce() also has extack, so
you can return useful messages to user space, not just the kernel log.
Andrew