diff options
-rw-r--r-- | drivers/net/macvlan.c | 22 | ||||
-rw-r--r-- | include/linux/netdevice.h | 24 | ||||
-rw-r--r-- | net/8021q/vlan_dev.c | 23 |
3 files changed, 29 insertions, 40 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 214a8cf2b708..329cd50d0e29 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -374,36 +374,20 @@ static void macvlan_ethtool_get_drvinfo(struct net_device *dev, | |||
374 | static u32 macvlan_ethtool_get_rx_csum(struct net_device *dev) | 374 | static u32 macvlan_ethtool_get_rx_csum(struct net_device *dev) |
375 | { | 375 | { |
376 | const struct macvlan_dev *vlan = netdev_priv(dev); | 376 | const struct macvlan_dev *vlan = netdev_priv(dev); |
377 | struct net_device *lowerdev = vlan->lowerdev; | 377 | return dev_ethtool_get_rx_csum(vlan->lowerdev); |
378 | |||
379 | if (lowerdev->ethtool_ops == NULL || | ||
380 | lowerdev->ethtool_ops->get_rx_csum == NULL) | ||
381 | return 0; | ||
382 | return lowerdev->ethtool_ops->get_rx_csum(lowerdev); | ||
383 | } | 378 | } |
384 | 379 | ||
385 | static int macvlan_ethtool_get_settings(struct net_device *dev, | 380 | static int macvlan_ethtool_get_settings(struct net_device *dev, |
386 | struct ethtool_cmd *cmd) | 381 | struct ethtool_cmd *cmd) |
387 | { | 382 | { |
388 | const struct macvlan_dev *vlan = netdev_priv(dev); | 383 | const struct macvlan_dev *vlan = netdev_priv(dev); |
389 | struct net_device *lowerdev = vlan->lowerdev; | 384 | return dev_ethtool_get_settings(vlan->lowerdev, cmd); |
390 | |||
391 | if (!lowerdev->ethtool_ops || | ||
392 | !lowerdev->ethtool_ops->get_settings) | ||
393 | return -EOPNOTSUPP; | ||
394 | |||
395 | return lowerdev->ethtool_ops->get_settings(lowerdev, cmd); | ||
396 | } | 385 | } |
397 | 386 | ||
398 | static u32 macvlan_ethtool_get_flags(struct net_device *dev) | 387 | static u32 macvlan_ethtool_get_flags(struct net_device *dev) |
399 | { | 388 | { |
400 | const struct macvlan_dev *vlan = netdev_priv(dev); | 389 | const struct macvlan_dev *vlan = netdev_priv(dev); |
401 | struct net_device *lowerdev = vlan->lowerdev; | 390 | return dev_ethtool_get_flags(vlan->lowerdev); |
402 | |||
403 | if (!lowerdev->ethtool_ops || | ||
404 | !lowerdev->ethtool_ops->get_flags) | ||
405 | return 0; | ||
406 | return lowerdev->ethtool_ops->get_flags(lowerdev); | ||
407 | } | 391 | } |
408 | 392 | ||
409 | static const struct ethtool_ops macvlan_ethtool_ops = { | 393 | static const struct ethtool_ops macvlan_ethtool_ops = { |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 54db3ebf2193..31167451d08d 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/dmaengine.h> | 42 | #include <linux/dmaengine.h> |
43 | #include <linux/workqueue.h> | 43 | #include <linux/workqueue.h> |
44 | 44 | ||
45 | #include <linux/ethtool.h> | ||
45 | #include <net/net_namespace.h> | 46 | #include <net/net_namespace.h> |
46 | #include <net/dsa.h> | 47 | #include <net/dsa.h> |
47 | #ifdef CONFIG_DCB | 48 | #ifdef CONFIG_DCB |
@@ -49,7 +50,6 @@ | |||
49 | #endif | 50 | #endif |
50 | 51 | ||
51 | struct vlan_group; | 52 | struct vlan_group; |
52 | struct ethtool_ops; | ||
53 | struct netpoll_info; | 53 | struct netpoll_info; |
54 | /* 802.11 specific */ | 54 | /* 802.11 specific */ |
55 | struct wireless_dev; | 55 | struct wireless_dev; |
@@ -1906,6 +1906,28 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |||
1906 | } | 1906 | } |
1907 | 1907 | ||
1908 | extern struct pernet_operations __net_initdata loopback_net_ops; | 1908 | extern struct pernet_operations __net_initdata loopback_net_ops; |
1909 | |||
1910 | static inline int dev_ethtool_get_settings(struct net_device *dev, | ||
1911 | struct ethtool_cmd *cmd) | ||
1912 | { | ||
1913 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings) | ||
1914 | return -EOPNOTSUPP; | ||
1915 | return dev->ethtool_ops->get_settings(dev, cmd); | ||
1916 | } | ||
1917 | |||
1918 | static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) | ||
1919 | { | ||
1920 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) | ||
1921 | return 0; | ||
1922 | return dev->ethtool_ops->get_rx_csum(dev); | ||
1923 | } | ||
1924 | |||
1925 | static inline u32 dev_ethtool_get_flags(struct net_device *dev) | ||
1926 | { | ||
1927 | if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags) | ||
1928 | return 0; | ||
1929 | return dev->ethtool_ops->get_flags(dev); | ||
1930 | } | ||
1909 | #endif /* __KERNEL__ */ | 1931 | #endif /* __KERNEL__ */ |
1910 | 1932 | ||
1911 | #endif /* _LINUX_DEV_H */ | 1933 | #endif /* _LINUX_DEV_H */ |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 6b0921364014..04dc8c8a6854 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -666,13 +666,7 @@ static int vlan_ethtool_get_settings(struct net_device *dev, | |||
666 | struct ethtool_cmd *cmd) | 666 | struct ethtool_cmd *cmd) |
667 | { | 667 | { |
668 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); | 668 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); |
669 | struct net_device *real_dev = vlan->real_dev; | 669 | return dev_ethtool_get_settings(vlan->real_dev, cmd); |
670 | |||
671 | if (!real_dev->ethtool_ops || | ||
672 | !real_dev->ethtool_ops->get_settings) | ||
673 | return -EOPNOTSUPP; | ||
674 | |||
675 | return real_dev->ethtool_ops->get_settings(real_dev, cmd); | ||
676 | } | 670 | } |
677 | 671 | ||
678 | static void vlan_ethtool_get_drvinfo(struct net_device *dev, | 672 | static void vlan_ethtool_get_drvinfo(struct net_device *dev, |
@@ -686,24 +680,13 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev, | |||
686 | static u32 vlan_ethtool_get_rx_csum(struct net_device *dev) | 680 | static u32 vlan_ethtool_get_rx_csum(struct net_device *dev) |
687 | { | 681 | { |
688 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); | 682 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); |
689 | struct net_device *real_dev = vlan->real_dev; | 683 | return dev_ethtool_get_rx_csum(vlan->real_dev); |
690 | |||
691 | if (real_dev->ethtool_ops == NULL || | ||
692 | real_dev->ethtool_ops->get_rx_csum == NULL) | ||
693 | return 0; | ||
694 | return real_dev->ethtool_ops->get_rx_csum(real_dev); | ||
695 | } | 684 | } |
696 | 685 | ||
697 | static u32 vlan_ethtool_get_flags(struct net_device *dev) | 686 | static u32 vlan_ethtool_get_flags(struct net_device *dev) |
698 | { | 687 | { |
699 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); | 688 | const struct vlan_dev_info *vlan = vlan_dev_info(dev); |
700 | struct net_device *real_dev = vlan->real_dev; | 689 | return dev_ethtool_get_flags(vlan->real_dev); |
701 | |||
702 | if (!(real_dev->features & NETIF_F_HW_VLAN_RX) || | ||
703 | real_dev->ethtool_ops == NULL || | ||
704 | real_dev->ethtool_ops->get_flags == NULL) | ||
705 | return 0; | ||
706 | return real_dev->ethtool_ops->get_flags(real_dev); | ||
707 | } | 690 | } |
708 | 691 | ||
709 | static const struct ethtool_ops vlan_ethtool_ops = { | 692 | static const struct ethtool_ops vlan_ethtool_ops = { |