forked from Minki/linux
ethtool: Move n-tuple capability check into set_flags
set_flags should check if the underlying device supports n-tuple filter programming before setting the device flags on the netdevice. Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e858911804
commit
0d643e1fb4
@ -134,15 +134,21 @@ u32 ethtool_op_get_flags(struct net_device *dev)
|
|||||||
|
|
||||||
int ethtool_op_set_flags(struct net_device *dev, u32 data)
|
int ethtool_op_set_flags(struct net_device *dev, u32 data)
|
||||||
{
|
{
|
||||||
|
const struct ethtool_ops *ops = dev->ethtool_ops;
|
||||||
|
|
||||||
if (data & ETH_FLAG_LRO)
|
if (data & ETH_FLAG_LRO)
|
||||||
dev->features |= NETIF_F_LRO;
|
dev->features |= NETIF_F_LRO;
|
||||||
else
|
else
|
||||||
dev->features &= ~NETIF_F_LRO;
|
dev->features &= ~NETIF_F_LRO;
|
||||||
|
|
||||||
if (data & ETH_FLAG_NTUPLE)
|
if (data & ETH_FLAG_NTUPLE) {
|
||||||
|
if (!ops->set_rx_ntuple)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
dev->features |= NETIF_F_NTUPLE;
|
dev->features |= NETIF_F_NTUPLE;
|
||||||
else
|
} else {
|
||||||
|
/* safe to clear regardless */
|
||||||
dev->features &= ~NETIF_F_NTUPLE;
|
dev->features &= ~NETIF_F_NTUPLE;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -318,9 +324,6 @@ static int ethtool_set_rx_ntuple(struct net_device *dev, void __user *useraddr)
|
|||||||
struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL;
|
struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!ops->set_rx_ntuple)
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
|
|
||||||
if (!(dev->features & NETIF_F_NTUPLE))
|
if (!(dev->features & NETIF_F_NTUPLE))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user