diff options
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 549043c078c9..1cac29ebb05b 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -104,6 +104,7 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr, | |||
104 | } | 104 | } |
105 | 105 | ||
106 | NETDEVICE_SHOW_RO(dev_id, fmt_hex); | 106 | NETDEVICE_SHOW_RO(dev_id, fmt_hex); |
107 | NETDEVICE_SHOW_RO(dev_port, fmt_dec); | ||
107 | NETDEVICE_SHOW_RO(addr_assign_type, fmt_dec); | 108 | NETDEVICE_SHOW_RO(addr_assign_type, fmt_dec); |
108 | NETDEVICE_SHOW_RO(addr_len, fmt_dec); | 109 | NETDEVICE_SHOW_RO(addr_len, fmt_dec); |
109 | NETDEVICE_SHOW_RO(iflink, fmt_dec); | 110 | NETDEVICE_SHOW_RO(iflink, fmt_dec); |
@@ -252,6 +253,16 @@ static ssize_t operstate_show(struct device *dev, | |||
252 | } | 253 | } |
253 | static DEVICE_ATTR_RO(operstate); | 254 | static DEVICE_ATTR_RO(operstate); |
254 | 255 | ||
256 | static ssize_t carrier_changes_show(struct device *dev, | ||
257 | struct device_attribute *attr, | ||
258 | char *buf) | ||
259 | { | ||
260 | struct net_device *netdev = to_net_dev(dev); | ||
261 | return sprintf(buf, fmt_dec, | ||
262 | atomic_read(&netdev->carrier_changes)); | ||
263 | } | ||
264 | static DEVICE_ATTR_RO(carrier_changes); | ||
265 | |||
255 | /* read-write attributes */ | 266 | /* read-write attributes */ |
256 | 267 | ||
257 | static int change_mtu(struct net_device *net, unsigned long new_mtu) | 268 | static int change_mtu(struct net_device *net, unsigned long new_mtu) |
@@ -373,6 +384,7 @@ static struct attribute *net_class_attrs[] = { | |||
373 | &dev_attr_netdev_group.attr, | 384 | &dev_attr_netdev_group.attr, |
374 | &dev_attr_type.attr, | 385 | &dev_attr_type.attr, |
375 | &dev_attr_dev_id.attr, | 386 | &dev_attr_dev_id.attr, |
387 | &dev_attr_dev_port.attr, | ||
376 | &dev_attr_iflink.attr, | 388 | &dev_attr_iflink.attr, |
377 | &dev_attr_ifindex.attr, | 389 | &dev_attr_ifindex.attr, |
378 | &dev_attr_addr_assign_type.attr, | 390 | &dev_attr_addr_assign_type.attr, |
@@ -384,6 +396,7 @@ static struct attribute *net_class_attrs[] = { | |||
384 | &dev_attr_duplex.attr, | 396 | &dev_attr_duplex.attr, |
385 | &dev_attr_dormant.attr, | 397 | &dev_attr_dormant.attr, |
386 | &dev_attr_operstate.attr, | 398 | &dev_attr_operstate.attr, |
399 | &dev_attr_carrier_changes.attr, | ||
387 | &dev_attr_ifalias.attr, | 400 | &dev_attr_ifalias.attr, |
388 | &dev_attr_carrier.attr, | 401 | &dev_attr_carrier.attr, |
389 | &dev_attr_mtu.attr, | 402 | &dev_attr_mtu.attr, |
@@ -996,15 +1009,12 @@ static struct attribute_group dql_group = { | |||
996 | #endif /* CONFIG_BQL */ | 1009 | #endif /* CONFIG_BQL */ |
997 | 1010 | ||
998 | #ifdef CONFIG_XPS | 1011 | #ifdef CONFIG_XPS |
999 | static inline unsigned int get_netdev_queue_index(struct netdev_queue *queue) | 1012 | static unsigned int get_netdev_queue_index(struct netdev_queue *queue) |
1000 | { | 1013 | { |
1001 | struct net_device *dev = queue->dev; | 1014 | struct net_device *dev = queue->dev; |
1002 | int i; | 1015 | unsigned int i; |
1003 | |||
1004 | for (i = 0; i < dev->num_tx_queues; i++) | ||
1005 | if (queue == &dev->_tx[i]) | ||
1006 | break; | ||
1007 | 1016 | ||
1017 | i = queue - dev->_tx; | ||
1008 | BUG_ON(i >= dev->num_tx_queues); | 1018 | BUG_ON(i >= dev->num_tx_queues); |
1009 | 1019 | ||
1010 | return i; | 1020 | return i; |