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] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 01 Nov 2010 21:25:54 +0000
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc:	netdev@...r.kernel.org, e1000-devel@...ts.sourceforge.net,
	Steve Glendinning <steve.glendinning@...c.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Rasesh Mody <rmody@...cade.com>,
	Debashis Dutt <ddutt@...cade.com>,
	Kristoffer Glembo <kristoffer@...sler.com>,
	linux-driver@...gic.com, linux-net-drivers@...arflare.com
Subject: Re: [PATCH 3/4] Ethtool: convert get_tso/set_tso calls to
 hw_features flags

On Sat, 2010-10-30 at 10:44 +0200, Michał Mirosław wrote:
[...]
> @@ -1670,7 +1668,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
>  	netdev->type = ARPHRD_ETHER;
>  	netdev->features = NETIF_F_HIGHDMA;
>  	netdev->netdev_ops = &nes_netdev_ops;
> -	netdev->hw_features |= NETIF_F_SG;
> +	netdev->hw_features |= NETIF_F_SG|NETIF_F_TSO;

There should be spaces on either side of the '|' operator.

[...]
> diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
> index 9e27bd6..814a06c 100644
> --- a/drivers/net/atlx/atl1.c
> +++ b/drivers/net/atlx/atl1.c
> @@ -2992,6 +2992,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
>  	netdev->watchdog_timeo = 5 * HZ;
>  
>  	netdev->hw_features |= NETIF_F_SG;
> +	netdev->hw_features |= NETIF_F_TSO;

Why not set both flags in the same statement?  You might as well make
the drivers consistent in this regard.

[...]
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 017667c..9b0e598 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
[...]
> @@ -1065,10 +1048,13 @@ static int __ethtool_set_sg(struct net_device *dev, u32 data)
>  {
>  	int err;
>  
> -	if (!data && dev->ethtool_ops->set_tso) {
> -		err = dev->ethtool_ops->set_tso(dev, 0);
> -		if (err)
> -			return err;
> +	if (!data && (dev->hw_features & NETIF_F_ALL_TSO)) {
> +		if (dev->ethtool_ops->hw_set_tso) {
> +			err = dev->ethtool_ops->hw_set_tso(dev, 0);
> +			if (err < 0)
> +				return err;
> +		}
> +		dev->features &= dev->hw_features & NETIF_F_ALL_TSO;

Surely this should be:
		dev->features &= ~NETIF_F_ALL_TSO;

[...]
> @@ -1158,7 +1149,18 @@ static int ethtool_set_tso(struct net_device *dev, char __user *useraddr)
>  	if (edata.data && !(dev->features & NETIF_F_SG))
>  		return -EINVAL;
>  
> -	return dev->ethtool_ops->set_tso(dev, edata.data);
> +	if (dev->ethtool_ops->hw_set_tso) {
> +		int err = dev->ethtool_ops->hw_set_tso(dev, edata.data);
> +		if (err)
> +			return min(err, 0);
[...]

Again, the odd semantics of a positive value need to be documented.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ