aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2010-11-09 05:47:38 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-15 13:57:28 -0500
commitfe8222406c8277a21172479d3a8283d31c209028 (patch)
tree89876457391fba73e3c2c9fdbf9c28a980ad4ffc /net/core/net-sysfs.c
parented9af2e839c06c18f721da2c768fbb444c4a10e5 (diff)
net: Simplify RX queue allocation
This patch move RX queue allocation to alloc_netdev_mq and freeing of the queues to free_netdev (symmetric to TX queue allocation). Each kobject RX queue takes a reference to the queue's device so that the device can't be freed before all the kobjects have been released-- this obviates the need for reference counts specific to RX queues. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index a5ff5a89f376..3ba526b56fe3 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -706,7 +706,6 @@ static struct attribute *rx_queue_default_attrs[] = {
706static void rx_queue_release(struct kobject *kobj) 706static void rx_queue_release(struct kobject *kobj)
707{ 707{
708 struct netdev_rx_queue *queue = to_rx_queue(kobj); 708 struct netdev_rx_queue *queue = to_rx_queue(kobj);
709 struct netdev_rx_queue *first = queue->first;
710 struct rps_map *map; 709 struct rps_map *map;
711 struct rps_dev_flow_table *flow_table; 710 struct rps_dev_flow_table *flow_table;
712 711
@@ -719,8 +718,7 @@ static void rx_queue_release(struct kobject *kobj)
719 if (flow_table) 718 if (flow_table)
720 call_rcu(&flow_table->rcu, rps_dev_flow_table_release); 719 call_rcu(&flow_table->rcu, rps_dev_flow_table_release);
721 720
722 if (atomic_dec_and_test(&first->count)) 721 dev_put(queue->dev);
723 kfree(first);
724} 722}
725 723
726static struct kobj_type rx_queue_ktype = { 724static struct kobj_type rx_queue_ktype = {
@@ -732,7 +730,6 @@ static struct kobj_type rx_queue_ktype = {
732static int rx_queue_add_kobject(struct net_device *net, int index) 730static int rx_queue_add_kobject(struct net_device *net, int index)
733{ 731{
734 struct netdev_rx_queue *queue = net->_rx + index; 732 struct netdev_rx_queue *queue = net->_rx + index;
735 struct netdev_rx_queue *first = queue->first;
736 struct kobject *kobj = &queue->kobj; 733 struct kobject *kobj = &queue->kobj;
737 int error = 0; 734 int error = 0;
738 735
@@ -745,7 +742,7 @@ static int rx_queue_add_kobject(struct net_device *net, int index)
745 } 742 }
746 743
747 kobject_uevent(kobj, KOBJ_ADD); 744 kobject_uevent(kobj, KOBJ_ADD);
748 atomic_inc(&first->count); 745 dev_hold(queue->dev);
749 746
750 return error; 747 return error;
751} 748}