diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-07-09 02:12:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-09 02:12:21 -0400 |
commit | a204b48ed4dc31acf61090e530430ce3272b6aab (patch) | |
tree | 1c7615f3483720a79b83f03bc4d14f2dad622744 /net/8021q | |
parent | dd4ba83dc1becbb3bb383851381c10c372e47247 (diff) |
vlan: allow TSO setting on vlan interfaces
When we need to shape traffic using low speeds, we need to
disable tso on network interface :
ethtool -K eth0.2240 tso off
It seems vlan interfaces miss the set_tso() ethtool method.
Before enabling TSO, we must check real device supports
TSO for VLAN-tagged packets and enables TSO.
Note that a TSO change on real device propagates TSO setting
on all vlans, even if admin selected a different TSO setting.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r-- | net/8021q/vlan_dev.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 7865a4ce5250..a1b8171cfa7b 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -836,12 +836,32 @@ static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, st | |||
836 | return stats; | 836 | return stats; |
837 | } | 837 | } |
838 | 838 | ||
839 | static int vlan_ethtool_set_tso(struct net_device *dev, u32 data) | ||
840 | { | ||
841 | if (data) { | ||
842 | struct net_device *real_dev = vlan_dev_info(dev)->real_dev; | ||
843 | |||
844 | /* Underlying device must support TSO for VLAN-tagged packets | ||
845 | * and must have TSO enabled now. | ||
846 | */ | ||
847 | if (!(real_dev->vlan_features & NETIF_F_TSO)) | ||
848 | return -EOPNOTSUPP; | ||
849 | if (!(real_dev->features & NETIF_F_TSO)) | ||
850 | return -EINVAL; | ||
851 | dev->features |= NETIF_F_TSO; | ||
852 | } else { | ||
853 | dev->features &= ~NETIF_F_TSO; | ||
854 | } | ||
855 | return 0; | ||
856 | } | ||
857 | |||
839 | static const struct ethtool_ops vlan_ethtool_ops = { | 858 | static const struct ethtool_ops vlan_ethtool_ops = { |
840 | .get_settings = vlan_ethtool_get_settings, | 859 | .get_settings = vlan_ethtool_get_settings, |
841 | .get_drvinfo = vlan_ethtool_get_drvinfo, | 860 | .get_drvinfo = vlan_ethtool_get_drvinfo, |
842 | .get_link = ethtool_op_get_link, | 861 | .get_link = ethtool_op_get_link, |
843 | .get_rx_csum = vlan_ethtool_get_rx_csum, | 862 | .get_rx_csum = vlan_ethtool_get_rx_csum, |
844 | .get_flags = vlan_ethtool_get_flags, | 863 | .get_flags = vlan_ethtool_get_flags, |
864 | .set_tso = vlan_ethtool_set_tso, | ||
845 | }; | 865 | }; |
846 | 866 | ||
847 | static const struct net_device_ops vlan_netdev_ops = { | 867 | static const struct net_device_ops vlan_netdev_ops = { |