netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v4 3/5] net: use ndo_fix_features for ethtool_ops->set_flags
Date: Mon, 07 Feb 2011 19:46:12 +0000	[thread overview]
Message-ID: <1297107972.4077.11.camel@bwh-desktop> (raw)
In-Reply-To: <bbe7e5742ffe44fb2938b7b6c2c656395fc361ac.1296741562.git.mirq-linux@rere.qmqm.pl>

On Thu, 2011-02-03 at 15:21 +0100, Michał Mirosław wrote:
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
>  net/core/ethtool.c |   31 +++++++++++++++++++++++++++++--
>  1 files changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 555accf..6e7c6f2 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -240,6 +240,34 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
>  	return ret;
>  }
>  
> +static int __ethtool_set_flags(struct net_device *dev, u32 data)
> +{
> +	u32 changed;
> +
> +	if (data & ~flags_dup_features)
> +		return -EINVAL;
> +
> +	/* legacy set_flags() op */
> +	if (dev->ethtool_ops->set_flags) {
> +		if (unlikely(dev->hw_features & flags_dup_features))
> +			netdev_warn(dev,
> +				"driver BUG: mixed hw_features and set_flags()\n");
> +		return dev->ethtool_ops->set_flags(dev, data);
> +	}
> +
> +	/* allow changing only bits set in hw_features */
> +	changed = (data ^ dev->wanted_features) & flags_dup_features;
> +	if (changed & ~dev->hw_features)
> +		return -EOPNOTSUPP;
[...]

The error code should only be EOPNOTSUPP if (dev->hw_features &
flags_dup_features) == 0.  Otherwise it should be EINVAL.

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.


  reply	other threads:[~2011-02-07 19:46 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 14:21 [PATCH v4 0/5] net: Unified offload configuration Michał Mirosław
2011-02-03 14:21 ` [PATCH v4 1/5] net: Introduce new feature setting ops Michał Mirosław
2011-02-07 19:39   ` Ben Hutchings
2011-02-07 20:51     ` David Miller
2011-02-07 20:55       ` David Miller
2012-01-24 13:54     ` Eric Dumazet
2012-01-24 15:30       ` Ben Hutchings
2012-01-24 15:47         ` Eric Dumazet
2012-01-24 19:05         ` Michał Mirosław
2012-01-28  8:30           ` [RFC PATCH] ethtool: implement [GS]FEATURES handling Michał Mirosław
2012-01-28  8:37             ` [RFC PATCH v2] " Michał Mirosław
2012-01-28 10:02               ` Eric Dumazet
2011-02-03 14:21 ` [PATCH v4 3/5] net: use ndo_fix_features for ethtool_ops->set_flags Michał Mirosław
2011-02-07 19:46   ` Ben Hutchings [this message]
2011-02-07 21:03     ` David Miller
2011-02-03 14:21 ` [PATCH v4 2/5] net: ethtool: use ndo_fix_features for offload setting Michał Mirosław
2011-02-07 21:01   ` David Miller
2011-02-03 14:21 ` [PATCH v2] ethtool: implement G/SFEATURES calls Michał Mirosław
2011-02-03 14:21 ` [PATCH v4 4/5] net: introduce NETIF_F_RXCSUM Michał Mirosław
2011-02-07 21:12   ` David Miller
2011-02-03 14:21 ` [PATCH v4 5/5] loopback: convert to hw_features Michał Mirosław
2011-02-07 21:18   ` David Miller
2011-02-07 21:37 ` [PATCH v4 0/5] net: Unified offload configuration David Miller
2011-02-07 22:49   ` Michał Mirosław
2011-02-07 22:52     ` David Miller
2011-02-07 23:12       ` Michał Mirosław
2011-02-08 19:40   ` David Miller
2011-02-08 23:55     ` Michał Mirosław
2011-02-08 23:58       ` David Miller

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=1297107972.4077.11.camel@bwh-desktop \
    --to=bhutchings@solarflare.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=netdev@vger.kernel.org \
    /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).