Re: [PATCH] [RFC] net: fec: Allow turning off IRQ coalescing

From: Richard Weinberger
Date: Mon Feb 20 2023 - 15:15:22 EST


Wei Fang,

----- Ursprüngliche Mail -----
> Von: "wei fang" <wei.fang@xxxxxxx>
>> /* 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);
> disable_rx_itr should be defined below fep to follow the style of the reverse
> Christmas tree.

Of course, will fix in v2.

>> - 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) {
>
> I think the below should be better:
> if (!!fep->rx_time_itr == ! fep->rx_pkts_itr)

At least it's shorter. :-)
I'm not sure which variant is easier to understand, though.

But in general you are fine with returning -EINVAL in this case?
I'm asking because that a userspace visible change.

Thanks,
//richard