Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4315d834 authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller
Browse files

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: default avatarTom Herbert <therbert@google.com>
Acked-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a131d822
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -5024,7 +5024,6 @@ static int netif_alloc_rx_queues(struct net_device *dev)
			return -ENOMEM;
		}
		dev->_rx = rx;
		atomic_set(&rx->count, count);

		/*
		 * Set a pointer to first element in the array which holds the
+2 −0
Original line number Diff line number Diff line
@@ -726,6 +726,7 @@ static struct kobj_type rx_queue_ktype = {
static int rx_queue_add_kobject(struct net_device *net, int index)
{
	struct netdev_rx_queue *queue = net->_rx + index;
	struct netdev_rx_queue *first = queue->first;
	struct kobject *kobj = &queue->kobj;
	int error = 0;

@@ -738,6 +739,7 @@ static int rx_queue_add_kobject(struct net_device *net, int index)
	}

	kobject_uevent(kobj, KOBJ_ADD);
	atomic_inc(&first->count);

	return error;
}