aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-03-22 19:54:49 -0400
committerDavid S. Miller <davem@davemloft.net>2011-03-28 02:35:24 -0400
commit673e63c688f43104c73aad8ea4237f7ad41fa14d (patch)
tree3d11c6f74a5d0823020db8642c3f2cf062347afb /drivers
parentb5845f9834d8f4c79d324bc59b99dbcf0a40f428 (diff)
net: fix ethtool->set_flags not intended -EINVAL return value
After commit d5dbda23804156ae6f35025ade5307a49d1db6d7 "ethtool: Add support for vlan accleration.", drivers that have NETIF_F_HW_VLAN_TX, and/or NETIF_F_HW_VLAN_RX feature, but do not allow enable/disable vlan acceleration via ethtool set_flags, always return -EINVAL from that function. Fix by returning -EINVAL only if requested features do not match current settings and can not be changed by driver. Change any driver that define ethtool->set_flags to use ethtool_invalid_flags() to avoid similar problems in the future (also on drivers that do not have the problem). Tested with modified (to reproduce this bug) myri10ge driver. Cc: stable@kernel.org # 2.6.37+ Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c2
-rw-r--r--drivers/net/qlcnic/qlcnic_ethtool.c2
-rw-r--r--drivers/net/s2io.c2
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c4
-rw-r--r--drivers/net/vxge/vxge-ethtool.c4
5 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 653d308e0f5d..3bdcc803ec68 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -871,7 +871,7 @@ static int netxen_nic_set_flags(struct net_device *netdev, u32 data)
871 struct netxen_adapter *adapter = netdev_priv(netdev); 871 struct netxen_adapter *adapter = netdev_priv(netdev);
872 int hw_lro; 872 int hw_lro;
873 873
874 if (data & ~ETH_FLAG_LRO) 874 if (ethtool_invalid_flags(netdev, data, ETH_FLAG_LRO))
875 return -EINVAL; 875 return -EINVAL;
876 876
877 if (!(adapter->capabilities & NX_FW_CAPABILITY_HW_LRO)) 877 if (!(adapter->capabilities & NX_FW_CAPABILITY_HW_LRO))
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 4c14510e2a87..45b2755d6cba 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -1003,7 +1003,7 @@ static int qlcnic_set_flags(struct net_device *netdev, u32 data)
1003 struct qlcnic_adapter *adapter = netdev_priv(netdev); 1003 struct qlcnic_adapter *adapter = netdev_priv(netdev);
1004 int hw_lro; 1004 int hw_lro;
1005 1005
1006 if (data & ~ETH_FLAG_LRO) 1006 if (ethtool_invalid_flags(netdev, data, ETH_FLAG_LRO))
1007 return -EINVAL; 1007 return -EINVAL;
1008 1008
1009 if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO)) 1009 if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO))
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 2ad6364103ea..356e74d20b80 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -6726,7 +6726,7 @@ static int s2io_ethtool_set_flags(struct net_device *dev, u32 data)
6726 int rc = 0; 6726 int rc = 0;
6727 int changed = 0; 6727 int changed = 0;
6728 6728
6729 if (data & ~ETH_FLAG_LRO) 6729 if (ethtool_invalid_flags(dev, data, ETH_FLAG_LRO))
6730 return -EINVAL; 6730 return -EINVAL;
6731 6731
6732 if (data & ETH_FLAG_LRO) { 6732 if (data & ETH_FLAG_LRO) {
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 81254be85b92..51f2ef142a5b 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -304,8 +304,8 @@ vmxnet3_set_flags(struct net_device *netdev, u32 data)
304 u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1; 304 u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
305 unsigned long flags; 305 unsigned long flags;
306 306
307 if (data & ~ETH_FLAG_LRO) 307 if (ethtool_invalid_flags(netdev, data, ETH_FLAG_LRO))
308 return -EOPNOTSUPP; 308 return -EINVAL;
309 309
310 if (lro_requested ^ lro_present) { 310 if (lro_requested ^ lro_present) {
311 /* toggle the LRO feature*/ 311 /* toggle the LRO feature*/
diff --git a/drivers/net/vxge/vxge-ethtool.c b/drivers/net/vxge/vxge-ethtool.c
index 1dd3a21b3a43..c5eb034107fd 100644
--- a/drivers/net/vxge/vxge-ethtool.c
+++ b/drivers/net/vxge/vxge-ethtool.c
@@ -1117,8 +1117,8 @@ static int vxge_set_flags(struct net_device *dev, u32 data)
1117 struct vxgedev *vdev = netdev_priv(dev); 1117 struct vxgedev *vdev = netdev_priv(dev);
1118 enum vxge_hw_status status; 1118 enum vxge_hw_status status;
1119 1119
1120 if (data & ~ETH_FLAG_RXHASH) 1120 if (ethtool_invalid_flags(dev, data, ETH_FLAG_RXHASH))
1121 return -EOPNOTSUPP; 1121 return -EINVAL;
1122 1122
1123 if (!!(data & ETH_FLAG_RXHASH) == vdev->devh->config.rth_en) 1123 if (!!(data & ETH_FLAG_RXHASH) == vdev->devh->config.rth_en)
1124 return 0; 1124 return 0;