Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277588
b: refs/heads/master
c: ccf5ff6
h: refs/heads/master
v: v3
  • Loading branch information
david decotigny authored and David S. Miller committed Nov 17, 2011
1 parent ab40b1d commit 1bfca87
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 19b05f811341aaef3e5e22d2832aa2d8e0bad5ab
refs/heads/master: ccf5ff69fbbd8d877377f5786369cf5aa78a15fc
12 changes: 10 additions & 2 deletions trunk/include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ struct netdev_queue {
struct Qdisc *qdisc;
unsigned long state;
struct Qdisc *qdisc_sleeping;
#if defined(CONFIG_RPS) || defined(CONFIG_XPS)
#ifdef CONFIG_SYSFS
struct kobject kobj;
#endif
#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
Expand All @@ -547,6 +547,12 @@ struct netdev_queue {
* please use this field instead of dev->trans_start
*/
unsigned long trans_start;

/*
* Number of TX timeouts for this queue
* (/sys/class/net/DEV/Q/trans_timeout)
*/
unsigned long trans_timeout;
} ____cacheline_aligned_in_smp;

static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
Expand Down Expand Up @@ -1109,9 +1115,11 @@ struct net_device {

unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */

#if defined(CONFIG_RPS) || defined(CONFIG_XPS)
#ifdef CONFIG_SYSFS
struct kset *queues_kset;
#endif

#ifdef CONFIG_RPS
struct netdev_rx_queue *_rx;

/* Number of RX queues allocated at register_netdev() time */
Expand Down
37 changes: 31 additions & 6 deletions trunk/net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ net_rx_queue_update_kobjects(struct net_device *net, int old_num, int new_num)
#endif
}

#ifdef CONFIG_XPS
#ifdef CONFIG_SYSFS
/*
* netdev_queue sysfs structures and functions.
*/
Expand Down Expand Up @@ -826,6 +826,23 @@ static const struct sysfs_ops netdev_queue_sysfs_ops = {
.store = netdev_queue_attr_store,
};

static ssize_t show_trans_timeout(struct netdev_queue *queue,
struct netdev_queue_attribute *attribute,
char *buf)
{
unsigned long trans_timeout;

spin_lock_irq(&queue->_xmit_lock);
trans_timeout = queue->trans_timeout;
spin_unlock_irq(&queue->_xmit_lock);

return sprintf(buf, "%lu", trans_timeout);
}

static struct netdev_queue_attribute queue_trans_timeout =
__ATTR(tx_timeout, S_IRUGO, show_trans_timeout, NULL);

#ifdef CONFIG_XPS
static inline unsigned int get_netdev_queue_index(struct netdev_queue *queue)
{
struct net_device *dev = queue->dev;
Expand Down Expand Up @@ -1020,12 +1037,17 @@ static ssize_t store_xps_map(struct netdev_queue *queue,

static struct netdev_queue_attribute xps_cpus_attribute =
__ATTR(xps_cpus, S_IRUGO | S_IWUSR, show_xps_map, store_xps_map);
#endif /* CONFIG_XPS */

static struct attribute *netdev_queue_default_attrs[] = {
&queue_trans_timeout.attr,
#ifdef CONFIG_XPS
&xps_cpus_attribute.attr,
#endif
NULL
};

#ifdef CONFIG_XPS
static void netdev_queue_release(struct kobject *kobj)
{
struct netdev_queue *queue = to_netdev_queue(kobj);
Expand Down Expand Up @@ -1076,10 +1098,13 @@ static void netdev_queue_release(struct kobject *kobj)
memset(kobj, 0, sizeof(*kobj));
dev_put(queue->dev);
}
#endif /* CONFIG_XPS */

static struct kobj_type netdev_queue_ktype = {
.sysfs_ops = &netdev_queue_sysfs_ops,
#ifdef CONFIG_XPS
.release = netdev_queue_release,
#endif
.default_attrs = netdev_queue_default_attrs,
};

Expand All @@ -1102,12 +1127,12 @@ static int netdev_queue_add_kobject(struct net_device *net, int index)

return error;
}
#endif /* CONFIG_XPS */
#endif /* CONFIG_SYSFS */

int
netdev_queue_update_kobjects(struct net_device *net, int old_num, int new_num)
{
#ifdef CONFIG_XPS
#ifdef CONFIG_SYSFS
int i;
int error = 0;

Expand All @@ -1125,14 +1150,14 @@ netdev_queue_update_kobjects(struct net_device *net, int old_num, int new_num)
return error;
#else
return 0;
#endif
#endif /* CONFIG_SYSFS */
}

static int register_queue_kobjects(struct net_device *net)
{
int error = 0, txq = 0, rxq = 0, real_rx = 0, real_tx = 0;

#if defined(CONFIG_RPS) || defined(CONFIG_XPS)
#ifdef CONFIG_SYSFS
net->queues_kset = kset_create_and_add("queues",
NULL, &net->dev.kobj);
if (!net->queues_kset)
Expand Down Expand Up @@ -1173,7 +1198,7 @@ static void remove_queue_kobjects(struct net_device *net)

net_rx_queue_update_kobjects(net, real_rx, 0);
netdev_queue_update_kobjects(net, real_tx, 0);
#if defined(CONFIG_RPS) || defined(CONFIG_XPS)
#ifdef CONFIG_SYSFS
kset_unregister(net->queues_kset);
#endif
}
Expand Down
1 change: 1 addition & 0 deletions trunk/net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ static void dev_watchdog(unsigned long arg)
time_after(jiffies, (trans_start +
dev->watchdog_timeo))) {
some_queue_timedout = 1;
txq->trans_timeout++;
break;
}
}
Expand Down

0 comments on commit 1bfca87

Please sign in to comment.