Commit 4315d834c1496ddca977e9e22002b77c85bfec2c

Authored by Tom Herbert
Committed by David S. Miller
1 parent a131d82266

net: Fix rxq ref counting

The rx->count reference is used to track reference counts to the
number of rx-queue kobjects created for the device.  This patch
eliminates initialization of the counter in netif_alloc_rx_queues
and instead increments the counter each time a kobject is created.
This is now symmetric with the decrement that is done when an object is
released.

Signed-off-by: Tom Herbert <therbert@google.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 2 additions and 1 deletions Side-by-side Diff

... ... @@ -5024,7 +5024,6 @@
5024 5024 return -ENOMEM;
5025 5025 }
5026 5026 dev->_rx = rx;
5027   - atomic_set(&rx->count, count);
5028 5027  
5029 5028 /*
5030 5029 * Set a pointer to first element in the array which holds the
net/core/net-sysfs.c
... ... @@ -726,6 +726,7 @@
726 726 static int rx_queue_add_kobject(struct net_device *net, int index)
727 727 {
728 728 struct netdev_rx_queue *queue = net->_rx + index;
  729 + struct netdev_rx_queue *first = queue->first;
729 730 struct kobject *kobj = &queue->kobj;
730 731 int error = 0;
731 732  
... ... @@ -738,6 +739,7 @@
738 739 }
739 740  
740 741 kobject_uevent(kobj, KOBJ_ADD);
  742 + atomic_inc(&first->count);
741 743  
742 744 return error;
743 745 }