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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230622090206.qkzts2qlbqeiukhs@blmsp>
Date: Thu, 22 Jun 2023 11:02:06 +0200
From: Markus Schneider-Pargmann <msp@...libre.com>
To: Simon Horman <simon.horman@...igine.com>
Cc: Marc Kleine-Budde <mkl@...gutronix.de>,
	Chandrasekar Ramakrishnan <rcsekar@...sung.com>,
	Wolfgang Grandegger <wg@...ndegger.com>,
	Vincent MAILHOL <mailhol.vincent@...adoo.fr>,
	"David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	linux-can@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, Julien Panis <jpanis@...libre.com>
Subject: Re: [PATCH v4 04/12] can: m_can: Add rx coalescing ethtool support

Hi Simon,

On Wed, Jun 21, 2023 at 04:22:12PM +0200, Simon Horman wrote:
> On Wed, Jun 21, 2023 at 11:23:42AM +0200, Markus Schneider-Pargmann wrote:
> 
> ...
> 
> > +static int m_can_set_coalesce(struct net_device *dev,
> > +			      struct ethtool_coalesce *ec,
> > +			      struct kernel_ethtool_coalesce *kec,
> > +			      struct netlink_ext_ack *ext_ack)
> > +{
> > +	struct m_can_classdev *cdev = netdev_priv(dev);
> > +
> > +	if (cdev->can.state != CAN_STATE_STOPPED) {
> > +		netdev_err(dev, "Device is in use, please shut it down first\n");
> > +		return -EBUSY;
> > +	}
> > +
> > +	if (ec->rx_max_coalesced_frames_irq > cdev->mcfg[MRAM_RXF0].num) {
> > +		netdev_err(dev, "rx-frames-irq %u greater than the RX FIFO %u\n",
> > +			   ec->rx_max_coalesced_frames_irq,
> > +			   cdev->mcfg[MRAM_RXF0].num);
> > +		return -EINVAL;
> > +	}
> > +	if (ec->rx_max_coalesced_frames_irq == 0 != ec->rx_coalesce_usecs_irq == 0) {
> 
> Hi Markus,
> 
> For a W=1 build GCC 12.3.0 suggests, rather forcefully, that it would like
> some more parentheses here.
> 
>  drivers/net/can/m_can/m_can.c: In function 'm_can_set_coalesce':
>  drivers/net/can/m_can/m_can.c:1978:45: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
>   1978 |         if (ec->rx_max_coalesced_frames_irq == 0 != ec->rx_coalesce_usecs_irq == 0) {
>        |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
>  drivers/net/can/m_can/m_can.c:1978:50: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
>   1978 |         if (ec->rx_max_coalesced_frames_irq == 0 != ec->rx_coalesce_usecs_irq == 0) {
>        |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks, yes I just changed it because checkpatch doesn't like it the
other way. I am going to change it back. Also I am wondering why clang
doesn't complain at this point.

Best,
Markus

> 
> > +		netdev_err(dev, "rx-frames-irq and rx-usecs-irq can only be set together\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	cdev->rx_max_coalesced_frames_irq = ec->rx_max_coalesced_frames_irq;
> > +	cdev->rx_coalesce_usecs_irq = ec->rx_coalesce_usecs_irq;
> > +
> > +	return 0;
> > +}
> 
> ...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ