diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-06-29 22:44:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-30 17:09:35 -0400 |
commit | 1437ce3983bcbc0447a0dedcd644c14fe833d266 (patch) | |
tree | 073ba0dc60127b08b65fbcca4d0d7c15318c08f8 /drivers/net/sfc | |
parent | b3003be36a3c9215cd17182349981581de269048 (diff) |
ethtool: Change ethtool_op_set_flags to validate flags
ethtool_op_set_flags() does not check for unsupported flags, and has
no way of doing so. This means it is not suitable for use as a
default implementation of ethtool_ops::set_flags.
Add a 'supported' parameter specifying the flags that the driver and
hardware support, validate the requested flags against this, and
change all current callers to pass this parameter.
Change some other trivial implementations of ethtool_ops::set_flags to
call ethtool_op_set_flags().
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r-- | drivers/net/sfc/ethtool.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index 7693cfbf9cf4..23372bf5cd59 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -551,10 +551,7 @@ static int efx_ethtool_set_flags(struct net_device *net_dev, u32 data) | |||
551 | struct efx_nic *efx = netdev_priv(net_dev); | 551 | struct efx_nic *efx = netdev_priv(net_dev); |
552 | u32 supported = efx->type->offload_features & ETH_FLAG_RXHASH; | 552 | u32 supported = efx->type->offload_features & ETH_FLAG_RXHASH; |
553 | 553 | ||
554 | if (data & ~supported) | 554 | return ethtool_op_set_flags(net_dev, data, supported); |
555 | return -EOPNOTSUPP; | ||
556 | |||
557 | return ethtool_op_set_flags(net_dev, data); | ||
558 | } | 555 | } |
559 | 556 | ||
560 | static void efx_ethtool_self_test(struct net_device *net_dev, | 557 | static void efx_ethtool_self_test(struct net_device *net_dev, |