aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vmxnet3
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2010-06-27 19:29:42 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-29 03:53:26 -0400
commitd92be4b1661be0cef5f277f10078c71c166f16ad (patch)
tree0f14bef6119ef4e36e581fe155a7f557c653c8db /drivers/net/vmxnet3
parent52b6dcfe59d73347a598ba0826a6191a1e497679 (diff)
vmxnet3: fail when try to setup unsupported features
Return EOPNOTSUPP in ethtool_ops->set_flags. Fix coding style while at it. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vmxnet3')
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 3935c4493fb..8a71a21d53e 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -276,16 +276,21 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
276} 276}
277 277
278static u32 278static u32
279vmxnet3_get_flags(struct net_device *netdev) { 279vmxnet3_get_flags(struct net_device *netdev)
280{
280 return netdev->features; 281 return netdev->features;
281} 282}
282 283
283static int 284static int
284vmxnet3_set_flags(struct net_device *netdev, u32 data) { 285vmxnet3_set_flags(struct net_device *netdev, u32 data)
286{
285 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 287 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
286 u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1; 288 u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
287 u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1; 289 u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
288 290
291 if (data & ~ETH_FLAG_LRO)
292 return -EOPNOTSUPP;
293
289 if (lro_requested ^ lro_present) { 294 if (lro_requested ^ lro_present) {
290 /* toggle the LRO feature*/ 295 /* toggle the LRO feature*/
291 netdev->features ^= NETIF_F_LRO; 296 netdev->features ^= NETIF_F_LRO;