diff options
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 060f703659e8..e2137f3e489d 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 */ |
@@ -184,6 +185,22 @@ static ssize_t store_tx_queue_len(struct class_device *dev, const char *buf, siz | |||
184 | static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, | 185 | static CLASS_DEVICE_ATTR(tx_queue_len, S_IRUGO | S_IWUSR, show_tx_queue_len, |
185 | store_tx_queue_len); | 186 | store_tx_queue_len); |
186 | 187 | ||
188 | NETDEVICE_SHOW(weight, fmt_dec); | ||
189 | |||
190 | static int change_weight(struct net_device *net, unsigned long new_weight) | ||
191 | { | ||
192 | net->weight = new_weight; | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | static ssize_t store_weight(struct class_device *dev, const char *buf, size_t len) | ||
197 | { | ||
198 | return netdev_store(dev, buf, len, change_weight); | ||
199 | } | ||
200 | |||
201 | static CLASS_DEVICE_ATTR(weight, S_IRUGO | S_IWUSR, show_weight, | ||
202 | store_weight); | ||
203 | |||
187 | 204 | ||
188 | static struct class_device_attribute *net_class_attributes[] = { | 205 | static struct class_device_attribute *net_class_attributes[] = { |
189 | &class_device_attr_ifindex, | 206 | &class_device_attr_ifindex, |
@@ -193,6 +210,7 @@ static struct class_device_attribute *net_class_attributes[] = { | |||
193 | &class_device_attr_features, | 210 | &class_device_attr_features, |
194 | &class_device_attr_mtu, | 211 | &class_device_attr_mtu, |
195 | &class_device_attr_flags, | 212 | &class_device_attr_flags, |
213 | &class_device_attr_weight, | ||
196 | &class_device_attr_type, | 214 | &class_device_attr_type, |
197 | &class_device_attr_address, | 215 | &class_device_attr_address, |
198 | &class_device_attr_broadcast, | 216 | &class_device_attr_broadcast, |