[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y/LIS3xd1iZRyVGe@lunn.ch>
Date:   Mon, 20 Feb 2023 02:09:31 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Richard Weinberger <richard@....at>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        pabeni@...hat.com, kuba@...nel.org, edumazet@...gle.com,
        davem@...emloft.net, linux-imx@....com, xiaoning.wang@....com,
        shenwei.wang@....com, wei.fang@....com
Subject: Re: [PATCH] [RFC] net: fec: Allow turning off IRQ coalescing
>  /* 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
Powered by blists - more mailing lists