netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: wei fang <wei.fang@nxp.com>
Cc: netdev <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	pabeni <pabeni@redhat.com>, kuba <kuba@kernel.org>,
	edumazet <edumazet@google.com>, davem <davem@davemloft.net>,
	linux-imx <linux-imx@nxp.com>,
	xiaoning wang <xiaoning.wang@nxp.com>,
	shenwei wang <shenwei.wang@nxp.com>
Subject: Re: [PATCH] [RFC] net: fec: Allow turning off IRQ coalescing
Date: Mon, 20 Feb 2023 21:15:15 +0100 (CET)	[thread overview]
Message-ID: <1448370281.155186.1676924115387.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <PAXPR04MB81093DB4BF1F6A6B3F8F895088A49@PAXPR04MB8109.eurprd04.prod.outlook.com>

Wei Fang,

----- Ursprüngliche Mail -----
> Von: "wei fang" <wei.fang@nxp.com>
>>  /* 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

  reply	other threads:[~2023-02-20 20:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-18 21:40 [PATCH] [RFC] net: fec: Allow turning off IRQ coalescing Richard Weinberger
2023-02-20  1:09 ` Andrew Lunn
2023-02-20 20:07   ` Richard Weinberger
2023-02-20  2:11 ` Wei Fang
2023-02-20 20:15   ` Richard Weinberger [this message]
2023-02-21  1:40     ` Wei Fang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448370281.155186.1676924115387.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shenwei.wang@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).