diff options
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 12 | ||||
-rw-r--r-- | net/core/ethtool.c | 20 | ||||
-rw-r--r-- | net/core/net-sysfs.c | 3 |
3 files changed, 32 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d4d9e2680adb..f15a3ffff635 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -761,6 +761,18 @@ int dev_change_name(struct net_device *dev, char *newname) | |||
761 | } | 761 | } |
762 | 762 | ||
763 | /** | 763 | /** |
764 | * netdev_features_change - device changes fatures | ||
765 | * @dev: device to cause notification | ||
766 | * | ||
767 | * Called to indicate a device has changed features. | ||
768 | */ | ||
769 | void netdev_features_change(struct net_device *dev) | ||
770 | { | ||
771 | notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev); | ||
772 | } | ||
773 | EXPORT_SYMBOL(netdev_features_change); | ||
774 | |||
775 | /** | ||
764 | * netdev_state_change - device changes state | 776 | * netdev_state_change - device changes state |
765 | * @dev: device to cause notification | 777 | * @dev: device to cause notification |
766 | * | 778 | * |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index f05fde97c43d..8ec484894d68 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -29,7 +29,7 @@ u32 ethtool_op_get_link(struct net_device *dev) | |||
29 | 29 | ||
30 | u32 ethtool_op_get_tx_csum(struct net_device *dev) | 30 | u32 ethtool_op_get_tx_csum(struct net_device *dev) |
31 | { | 31 | { |
32 | return (dev->features & NETIF_F_IP_CSUM) != 0; | 32 | return (dev->features & (NETIF_F_IP_CSUM | NETIF_F_HW_CSUM)) != 0; |
33 | } | 33 | } |
34 | 34 | ||
35 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) | 35 | int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) |
@@ -42,6 +42,15 @@ int ethtool_op_set_tx_csum(struct net_device *dev, u32 data) | |||
42 | return 0; | 42 | return 0; |
43 | } | 43 | } |
44 | 44 | ||
45 | int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data) | ||
46 | { | ||
47 | if (data) | ||
48 | dev->features |= NETIF_F_HW_CSUM; | ||
49 | else | ||
50 | dev->features &= ~NETIF_F_HW_CSUM; | ||
51 | |||
52 | return 0; | ||
53 | } | ||
45 | u32 ethtool_op_get_sg(struct net_device *dev) | 54 | u32 ethtool_op_get_sg(struct net_device *dev) |
46 | { | 55 | { |
47 | return (dev->features & NETIF_F_SG) != 0; | 56 | return (dev->features & NETIF_F_SG) != 0; |
@@ -682,6 +691,7 @@ int dev_ethtool(struct ifreq *ifr) | |||
682 | void __user *useraddr = ifr->ifr_data; | 691 | void __user *useraddr = ifr->ifr_data; |
683 | u32 ethcmd; | 692 | u32 ethcmd; |
684 | int rc; | 693 | int rc; |
694 | unsigned long old_features; | ||
685 | 695 | ||
686 | /* | 696 | /* |
687 | * XXX: This can be pushed down into the ethtool_* handlers that | 697 | * XXX: This can be pushed down into the ethtool_* handlers that |
@@ -703,6 +713,8 @@ int dev_ethtool(struct ifreq *ifr) | |||
703 | if ((rc = dev->ethtool_ops->begin(dev)) < 0) | 713 | if ((rc = dev->ethtool_ops->begin(dev)) < 0) |
704 | return rc; | 714 | return rc; |
705 | 715 | ||
716 | old_features = dev->features; | ||
717 | |||
706 | switch (ethcmd) { | 718 | switch (ethcmd) { |
707 | case ETHTOOL_GSET: | 719 | case ETHTOOL_GSET: |
708 | rc = ethtool_get_settings(dev, useraddr); | 720 | rc = ethtool_get_settings(dev, useraddr); |
@@ -712,7 +724,6 @@ int dev_ethtool(struct ifreq *ifr) | |||
712 | break; | 724 | break; |
713 | case ETHTOOL_GDRVINFO: | 725 | case ETHTOOL_GDRVINFO: |
714 | rc = ethtool_get_drvinfo(dev, useraddr); | 726 | rc = ethtool_get_drvinfo(dev, useraddr); |
715 | |||
716 | break; | 727 | break; |
717 | case ETHTOOL_GREGS: | 728 | case ETHTOOL_GREGS: |
718 | rc = ethtool_get_regs(dev, useraddr); | 729 | rc = ethtool_get_regs(dev, useraddr); |
@@ -801,6 +812,10 @@ int dev_ethtool(struct ifreq *ifr) | |||
801 | 812 | ||
802 | if(dev->ethtool_ops->complete) | 813 | if(dev->ethtool_ops->complete) |
803 | dev->ethtool_ops->complete(dev); | 814 | dev->ethtool_ops->complete(dev); |
815 | |||
816 | if (old_features != dev->features) | ||
817 | netdev_features_change(dev); | ||
818 | |||
804 | return rc; | 819 | return rc; |
805 | 820 | ||
806 | ioctl: | 821 | ioctl: |
@@ -817,3 +832,4 @@ EXPORT_SYMBOL(ethtool_op_get_tx_csum); | |||
817 | EXPORT_SYMBOL(ethtool_op_set_sg); | 832 | EXPORT_SYMBOL(ethtool_op_set_sg); |
818 | EXPORT_SYMBOL(ethtool_op_set_tso); | 833 | EXPORT_SYMBOL(ethtool_op_set_tso); |
819 | EXPORT_SYMBOL(ethtool_op_set_tx_csum); | 834 | EXPORT_SYMBOL(ethtool_op_set_tx_csum); |
835 | EXPORT_SYMBOL(ethtool_op_set_tx_hw_csum); | ||
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 060f703659e8..910eb4c05a47 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #define to_net_dev(class) container_of(class, struct net_device, class_dev) | 21 | #define to_net_dev(class) container_of(class, struct net_device, class_dev) |
22 | 22 | ||
23 | static const char fmt_hex[] = "%#x\n"; | 23 | static const char fmt_hex[] = "%#x\n"; |
24 | static const char fmt_long_hex[] = "%#lx\n"; | ||
24 | static const char fmt_dec[] = "%d\n"; | 25 | static const char fmt_dec[] = "%d\n"; |
25 | static const char fmt_ulong[] = "%lu\n"; | 26 | static const char fmt_ulong[] = "%lu\n"; |
26 | 27 | ||
@@ -91,7 +92,7 @@ static CLASS_DEVICE_ATTR(field, S_IRUGO, show_##field, NULL) \ | |||
91 | NETDEVICE_ATTR(addr_len, fmt_dec); | 92 | NETDEVICE_ATTR(addr_len, fmt_dec); |
92 | NETDEVICE_ATTR(iflink, fmt_dec); | 93 | NETDEVICE_ATTR(iflink, fmt_dec); |
93 | NETDEVICE_ATTR(ifindex, fmt_dec); | 94 | NETDEVICE_ATTR(ifindex, fmt_dec); |
94 | NETDEVICE_ATTR(features, fmt_hex); | 95 | NETDEVICE_ATTR(features, fmt_long_hex); |
95 | NETDEVICE_ATTR(type, fmt_dec); | 96 | NETDEVICE_ATTR(type, fmt_dec); |
96 | 97 | ||
97 | /* use same locking rules as GIFHWADDR ioctl's */ | 98 | /* use same locking rules as GIFHWADDR ioctl's */ |