aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/niu.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-06-29 22:44:32 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-30 17:09:35 -0400
commit1437ce3983bcbc0447a0dedcd644c14fe833d266 (patch)
tree073ba0dc60127b08b65fbcca4d0d7c15318c08f8 /drivers/net/niu.c
parentb3003be36a3c9215cd17182349981581de269048 (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/niu.c')
-rw-r--r--drivers/net/niu.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 63e8e3893bd6..3d523cb7975a 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -7920,14 +7920,7 @@ static int niu_phys_id(struct net_device *dev, u32 data)
7920 7920
7921static int niu_set_flags(struct net_device *dev, u32 data) 7921static int niu_set_flags(struct net_device *dev, u32 data)
7922{ 7922{
7923 if (data & (ETH_FLAG_LRO | ETH_FLAG_NTUPLE)) 7923 return ethtool_op_set_flags(dev, data, ETH_FLAG_RXHASH);
7924 return -EOPNOTSUPP;
7925
7926 if (data & ETH_FLAG_RXHASH)
7927 dev->features |= NETIF_F_RXHASH;
7928 else
7929 dev->features &= ~NETIF_F_RXHASH;
7930 return 0;
7931} 7924}
7932 7925
7933static const struct ethtool_ops niu_ethtool_ops = { 7926static const struct ethtool_ops niu_ethtool_ops = {