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>
This commit is contained in:
committed by
David S. Miller
parent
b3003be36a
commit
1437ce3983
@@ -7920,14 +7920,7 @@ static int niu_phys_id(struct net_device *dev, u32 data)
|
||||
|
||||
static int niu_set_flags(struct net_device *dev, u32 data)
|
||||
{
|
||||
if (data & (ETH_FLAG_LRO | ETH_FLAG_NTUPLE))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (data & ETH_FLAG_RXHASH)
|
||||
dev->features |= NETIF_F_RXHASH;
|
||||
else
|
||||
dev->features &= ~NETIF_F_RXHASH;
|
||||
return 0;
|
||||
return ethtool_op_set_flags(dev, data, ETH_FLAG_RXHASH);
|
||||
}
|
||||
|
||||
static const struct ethtool_ops niu_ethtool_ops = {
|
||||
|
Reference in New Issue
Block a user