lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DB9PR04MB81060AB7E965446151C0F20E88A59@DB9PR04MB8106.eurprd04.prod.outlook.com>
Date:   Tue, 21 Feb 2023 01:40:38 +0000
From:   Wei Fang <wei.fang@....com>
To:     Richard Weinberger <richard@....at>
CC:     netdev <netdev@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        pabeni <pabeni@...hat.com>, kuba <kuba@...nel.org>,
        edumazet <edumazet@...gle.com>, davem <davem@...emloft.net>,
        dl-linux-imx <linux-imx@....com>,
        Clark Wang <xiaoning.wang@....com>,
        Shenwei Wang <shenwei.wang@....com>
Subject: RE: [PATCH] [RFC] net: fec: Allow turning off IRQ coalescing

> -----Original Message-----
> From: Richard Weinberger <richard@....at>
> Sent: 2023年2月21日 4:15
> To: Wei Fang <wei.fang@....com>
> Cc: netdev <netdev@...r.kernel.org>; linux-kernel
> <linux-kernel@...r.kernel.org>; pabeni <pabeni@...hat.com>; kuba
> <kuba@...nel.org>; edumazet <edumazet@...gle.com>; davem
> <davem@...emloft.net>; dl-linux-imx <linux-imx@....com>; Clark Wang
> <xiaoning.wang@....com>; Shenwei Wang <shenwei.wang@....com>
> Subject: Re: [PATCH] [RFC] net: fec: Allow turning off IRQ coalescing
> 
> Wei Fang,
> 
> ----- Ursprüngliche Mail -----
> > Von: "wei fang" <wei.fang@....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.
> 
I think it's fine to return -EINVAL. For hardware, one of the two parameters
is 0 is an invalid value with the interrupt coalescing enabled, and the behavior
of hardware is unpredictable.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ