Commit d92be4b1 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by David S. Miller

vmxnet3: fail when try to setup unsupported features

Return EOPNOTSUPP in ethtool_ops->set_flags.

Fix coding style while at it.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 52b6dcfe
...@@ -276,16 +276,21 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) ...@@ -276,16 +276,21 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
} }
static u32 static u32
vmxnet3_get_flags(struct net_device *netdev) { vmxnet3_get_flags(struct net_device *netdev)
{
return netdev->features; return netdev->features;
} }
static int static int
vmxnet3_set_flags(struct net_device *netdev, u32 data) { vmxnet3_set_flags(struct net_device *netdev, u32 data)
{
struct vmxnet3_adapter *adapter = netdev_priv(netdev); struct vmxnet3_adapter *adapter = netdev_priv(netdev);
u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1; u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1; u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
if (data & ~ETH_FLAG_LRO)
return -EOPNOTSUPP;
if (lro_requested ^ lro_present) { if (lro_requested ^ lro_present) {
/* toggle the LRO feature*/ /* toggle the LRO feature*/
netdev->features ^= NETIF_F_LRO; netdev->features ^= NETIF_F_LRO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment