aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-03 01:49:12 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-03 01:49:12 -0400
commit8a0427bb688eae86a8bb939b6a74e5aa00aa035a (patch)
treea2c8361f6eba3d97e2053e559c9f6b81693aa9aa /net/8021q
parent6cb6a27c45cec9184302c2e350b3593c64bc7f6c (diff)
vlan: convert VLAN devices to use ndo_fix_features()
Note: get_flags was actually broken, because it should return the flags capped with vlan_features. This is now done implicitly by limiting netdev->hw_features. RX checksumming offload control is (and was) broken, as there was no way before to say whether it's done for tagged packets. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r--net/8021q/vlan.c8
-rw-r--r--net/8021q/vlan_dev.c50
2 files changed, 16 insertions, 42 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 7850412f52b7..e47600b4e2e3 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -327,10 +327,6 @@ static void vlan_sync_address(struct net_device *dev,
327static void vlan_transfer_features(struct net_device *dev, 327static void vlan_transfer_features(struct net_device *dev,
328 struct net_device *vlandev) 328 struct net_device *vlandev)
329{ 329{
330 u32 old_features = vlandev->features;
331
332 vlandev->features &= ~dev->vlan_features;
333 vlandev->features |= dev->features & dev->vlan_features;
334 vlandev->gso_max_size = dev->gso_max_size; 330 vlandev->gso_max_size = dev->gso_max_size;
335 331
336 if (dev->features & NETIF_F_HW_VLAN_TX) 332 if (dev->features & NETIF_F_HW_VLAN_TX)
@@ -341,8 +337,8 @@ static void vlan_transfer_features(struct net_device *dev,
341#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 337#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
342 vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid; 338 vlandev->fcoe_ddp_xid = dev->fcoe_ddp_xid;
343#endif 339#endif
344 if (old_features != vlandev->features) 340
345 netdev_features_change(vlandev); 341 netdev_update_features(vlandev);
346} 342}
347 343
348static void __vlan_device_event(struct net_device *dev, unsigned long event) 344static void __vlan_device_event(struct net_device *dev, unsigned long event)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index e34ea9e5e28b..b84a46b30c0c 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -704,8 +704,8 @@ static int vlan_dev_init(struct net_device *dev)
704 (1<<__LINK_STATE_DORMANT))) | 704 (1<<__LINK_STATE_DORMANT))) |
705 (1<<__LINK_STATE_PRESENT); 705 (1<<__LINK_STATE_PRESENT);
706 706
707 dev->features |= real_dev->features & real_dev->vlan_features; 707 dev->hw_features = real_dev->vlan_features & NETIF_F_ALL_TX_OFFLOADS;
708 dev->features |= NETIF_F_LLTX; 708 dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
709 dev->gso_max_size = real_dev->gso_max_size; 709 dev->gso_max_size = real_dev->gso_max_size;
710 710
711 /* ipv6 shared card related stuff */ 711 /* ipv6 shared card related stuff */
@@ -759,6 +759,17 @@ static void vlan_dev_uninit(struct net_device *dev)
759 } 759 }
760} 760}
761 761
762static u32 vlan_dev_fix_features(struct net_device *dev, u32 features)
763{
764 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
765
766 features &= (real_dev->features | NETIF_F_LLTX);
767 if (dev_ethtool_get_rx_csum(real_dev))
768 features |= NETIF_F_RXCSUM;
769
770 return features;
771}
772
762static int vlan_ethtool_get_settings(struct net_device *dev, 773static int vlan_ethtool_get_settings(struct net_device *dev,
763 struct ethtool_cmd *cmd) 774 struct ethtool_cmd *cmd)
764{ 775{
@@ -774,18 +785,6 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev,
774 strcpy(info->fw_version, "N/A"); 785 strcpy(info->fw_version, "N/A");
775} 786}
776 787
777static u32 vlan_ethtool_get_rx_csum(struct net_device *dev)
778{
779 const struct vlan_dev_info *vlan = vlan_dev_info(dev);
780 return dev_ethtool_get_rx_csum(vlan->real_dev);
781}
782
783static u32 vlan_ethtool_get_flags(struct net_device *dev)
784{
785 const struct vlan_dev_info *vlan = vlan_dev_info(dev);
786 return dev_ethtool_get_flags(vlan->real_dev);
787}
788
789static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) 788static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
790{ 789{
791 790
@@ -823,32 +822,10 @@ static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, st
823 return stats; 822 return stats;
824} 823}
825 824
826static int vlan_ethtool_set_tso(struct net_device *dev, u32 data)
827{
828 if (data) {
829 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
830
831 /* Underlying device must support TSO for VLAN-tagged packets
832 * and must have TSO enabled now.
833 */
834 if (!(real_dev->vlan_features & NETIF_F_TSO))
835 return -EOPNOTSUPP;
836 if (!(real_dev->features & NETIF_F_TSO))
837 return -EINVAL;
838 dev->features |= NETIF_F_TSO;
839 } else {
840 dev->features &= ~NETIF_F_TSO;
841 }
842 return 0;
843}
844
845static const struct ethtool_ops vlan_ethtool_ops = { 825static const struct ethtool_ops vlan_ethtool_ops = {
846 .get_settings = vlan_ethtool_get_settings, 826 .get_settings = vlan_ethtool_get_settings,
847 .get_drvinfo = vlan_ethtool_get_drvinfo, 827 .get_drvinfo = vlan_ethtool_get_drvinfo,
848 .get_link = ethtool_op_get_link, 828 .get_link = ethtool_op_get_link,
849 .get_rx_csum = vlan_ethtool_get_rx_csum,
850 .get_flags = vlan_ethtool_get_flags,
851 .set_tso = vlan_ethtool_set_tso,
852}; 829};
853 830
854static const struct net_device_ops vlan_netdev_ops = { 831static const struct net_device_ops vlan_netdev_ops = {
@@ -874,6 +851,7 @@ static const struct net_device_ops vlan_netdev_ops = {
874 .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn, 851 .ndo_fcoe_get_wwn = vlan_dev_fcoe_get_wwn,
875 .ndo_fcoe_ddp_target = vlan_dev_fcoe_ddp_target, 852 .ndo_fcoe_ddp_target = vlan_dev_fcoe_ddp_target,
876#endif 853#endif
854 .ndo_fix_features = vlan_dev_fix_features,
877}; 855};
878 856
879void vlan_setup(struct net_device *dev) 857void vlan_setup(struct net_device *dev)