aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authorPeter Waskiewicz <peter.p.waskiewicz.jr@intel.com>2010-02-12 08:48:25 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-16 00:49:47 -0500
commit0d643e1fb4207711d9c148b5c6a2820550a4a154 (patch)
treecc4c838eddb7d9b8e72c216a9556f9fba0153c87 /net/core/ethtool.c
parente858911804f5ecadb41afd61582a11f68d416328 (diff)
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>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index fbbe4b49116b..794cf57078cd 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -134,15 +134,21 @@ u32 ethtool_op_get_flags(struct net_device *dev)
134 134
135int ethtool_op_set_flags(struct net_device *dev, u32 data) 135int ethtool_op_set_flags(struct net_device *dev, u32 data)
136{ 136{
137 const struct ethtool_ops *ops = dev->ethtool_ops;
138
137 if (data & ETH_FLAG_LRO) 139 if (data & ETH_FLAG_LRO)
138 dev->features |= NETIF_F_LRO; 140 dev->features |= NETIF_F_LRO;
139 else 141 else
140 dev->features &= ~NETIF_F_LRO; 142 dev->features &= ~NETIF_F_LRO;
141 143
142 if (data & ETH_FLAG_NTUPLE) 144 if (data & ETH_FLAG_NTUPLE) {
145 if (!ops->set_rx_ntuple)
146 return -EOPNOTSUPP;
143 dev->features |= NETIF_F_NTUPLE; 147 dev->features |= NETIF_F_NTUPLE;
144 else 148 } else {
149 /* safe to clear regardless */
145 dev->features &= ~NETIF_F_NTUPLE; 150 dev->features &= ~NETIF_F_NTUPLE;
151 }
146 152
147 return 0; 153 return 0;
148} 154}
@@ -318,9 +324,6 @@ static int ethtool_set_rx_ntuple(struct net_device *dev, void __user *useraddr)
318 struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL; 324 struct ethtool_rx_ntuple_flow_spec_container *fsc = NULL;
319 int ret; 325 int ret;
320 326
321 if (!ops->set_rx_ntuple)
322 return -EOPNOTSUPP;
323
324 if (!(dev->features & NETIF_F_NTUPLE)) 327 if (!(dev->features & NETIF_F_NTUPLE))
325 return -EINVAL; 328 return -EINVAL;
326 329