netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] net: Fix rxq ref counting
@ 2010-10-07 20:09 Tom Herbert
  2010-10-07 20:56 ` Eric Dumazet
  2010-10-07 20:59 ` Eric Dumazet
  0 siblings, 2 replies; 4+ messages in thread
From: Tom Herbert @ 2010-10-07 20:09 UTC (permalink / raw)
  To: davem, netdev

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>
---
diff --git a/net/core/dev.c b/net/core/dev.c
index 7d14955..58b31d1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5026,7 +5026,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
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index fa81fd0..b143173 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -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;
 }

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] net: Fix rxq ref counting
  2010-10-07 20:09 [PATCH net-next-2.6] net: Fix rxq ref counting Tom Herbert
@ 2010-10-07 20:56 ` Eric Dumazet
  2010-10-07 20:59 ` Eric Dumazet
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2010-10-07 20:56 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, netdev

Le jeudi 07 octobre 2010 à 13:09 -0700, Tom Herbert a écrit :
> 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>
> ---
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 7d14955..58b31d1 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5026,7 +5026,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
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index fa81fd0..b143173 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -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;
>  }

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] net: Fix rxq ref counting
  2010-10-07 20:09 [PATCH net-next-2.6] net: Fix rxq ref counting Tom Herbert
  2010-10-07 20:56 ` Eric Dumazet
@ 2010-10-07 20:59 ` Eric Dumazet
  2010-10-08 21:35   ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2010-10-07 20:59 UTC (permalink / raw)
  To: Tom Herbert; +Cc: davem, netdev

Le jeudi 07 octobre 2010 à 13:09 -0700, Tom Herbert a écrit :
> 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>
> ---
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 7d14955..58b31d1 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5026,7 +5026,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
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index fa81fd0..b143173 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -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;
>  }

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] net: Fix rxq ref counting
  2010-10-07 20:59 ` Eric Dumazet
@ 2010-10-08 21:35   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-10-08 21:35 UTC (permalink / raw)
  To: eric.dumazet; +Cc: therbert, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 07 Oct 2010 22:59:09 +0200

> Le jeudi 07 octobre 2010 à 13:09 -0700, Tom Herbert a écrit :
>> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-08 21:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-07 20:09 [PATCH net-next-2.6] net: Fix rxq ref counting Tom Herbert
2010-10-07 20:56 ` Eric Dumazet
2010-10-07 20:59 ` Eric Dumazet
2010-10-08 21:35   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).