netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next PATCH] ip_tunnel: Report Rx dropped in ip_tunnel_get_stats64
@ 2015-05-14 20:04 Alexander Duyck
  2015-05-14 20:56 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Duyck @ 2015-05-14 20:04 UTC (permalink / raw)
  To: netdev; +Cc: davem

The rx_dropped stat wasn't being reported when ip_tunnel_get_stats64 was
called.  This was leading to some confusing results in my debug as I was
seeing rx_errors increment but no other value which pointed me toward the
type of error being seen.

This change corrects that by copying the value over from
dev->stats.rx_dropped inot tot->rx_dropped.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
---
 net/ipv4/ip_tunnel_core.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 3998b1822d85..a6a980680b8a 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -191,6 +191,7 @@ struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
 	tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
 	tot->rx_length_errors = dev->stats.rx_length_errors;
 	tot->rx_frame_errors = dev->stats.rx_frame_errors;
+	tot->rx_dropped = dev->stats.rx_dropped;
 	tot->rx_errors = dev->stats.rx_errors;
 
 	tot->tx_fifo_errors = dev->stats.tx_fifo_errors;

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

* Re: [net-next PATCH] ip_tunnel: Report Rx dropped in ip_tunnel_get_stats64
  2015-05-14 20:04 [net-next PATCH] ip_tunnel: Report Rx dropped in ip_tunnel_get_stats64 Alexander Duyck
@ 2015-05-14 20:56 ` Eric Dumazet
  2015-05-14 21:01   ` Eric Dumazet
  2015-05-14 21:07   ` Alexander Duyck
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2015-05-14 20:56 UTC (permalink / raw)
  To: Alexander Duyck; +Cc: netdev, davem

On Thu, 2015-05-14 at 13:04 -0700, Alexander Duyck wrote:
> The rx_dropped stat wasn't being reported when ip_tunnel_get_stats64 was
> called.  This was leading to some confusing results in my debug as I was
> seeing rx_errors increment but no other value which pointed me toward the
> type of error being seen.
> 
> This change corrects that by copying the value over from
> dev->stats.rx_dropped inot tot->rx_dropped.
> 
> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
> ---
>  net/ipv4/ip_tunnel_core.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
> index 3998b1822d85..a6a980680b8a 100644
> --- a/net/ipv4/ip_tunnel_core.c
> +++ b/net/ipv4/ip_tunnel_core.c
> @@ -191,6 +191,7 @@ struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
>  	tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
>  	tot->rx_length_errors = dev->stats.rx_length_errors;
>  	tot->rx_frame_errors = dev->stats.rx_frame_errors;
> +	tot->rx_dropped = dev->stats.rx_dropped;
>  	tot->rx_errors = dev->stats.rx_errors;
>  
>  	tot->tx_fifo_errors = dev->stats.tx_fifo_errors;

Or use netdev_stats_to_stats64() to remove all these copies, as we
obviously can miss some of them.

-> reduce code size.

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

* Re: [net-next PATCH] ip_tunnel: Report Rx dropped in ip_tunnel_get_stats64
  2015-05-14 20:56 ` Eric Dumazet
@ 2015-05-14 21:01   ` Eric Dumazet
  2015-05-14 21:21     ` Alexander Duyck
  2015-05-14 21:07   ` Alexander Duyck
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-05-14 21:01 UTC (permalink / raw)
  To: Alexander Duyck; +Cc: netdev, davem

On Thu, 2015-05-14 at 13:56 -0700, Eric Dumazet wrote:

> 
> Or use netdev_stats_to_stats64() to remove all these copies, as we
> obviously can miss some of them.

Something like following untested patch :

diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 3998b1822d8521ad391ac26db1e694a3cd7ad011..3f298193d19ffc3a9e57fac4654c59bbe65545e1 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -165,6 +165,7 @@ struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
 {
 	int i;
 
+	netdev_stats_to_stats64(tot, &dev->stats);
 	for_each_possible_cpu(i) {
 		const struct pcpu_sw_netstats *tstats =
 						   per_cpu_ptr(dev->tstats, i);
@@ -184,23 +185,6 @@ struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
 		tot->rx_bytes   += rx_bytes;
 		tot->tx_bytes   += tx_bytes;
 	}
-
-	tot->multicast = dev->stats.multicast;
-
-	tot->rx_crc_errors = dev->stats.rx_crc_errors;
-	tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
-	tot->rx_length_errors = dev->stats.rx_length_errors;
-	tot->rx_frame_errors = dev->stats.rx_frame_errors;
-	tot->rx_errors = dev->stats.rx_errors;
-
-	tot->tx_fifo_errors = dev->stats.tx_fifo_errors;
-	tot->tx_carrier_errors = dev->stats.tx_carrier_errors;
-	tot->tx_dropped = dev->stats.tx_dropped;
-	tot->tx_aborted_errors = dev->stats.tx_aborted_errors;
-	tot->tx_errors = dev->stats.tx_errors;
-
-	tot->collisions  = dev->stats.collisions;
-
 	return tot;
 }
 EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64);

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

* Re: [net-next PATCH] ip_tunnel: Report Rx dropped in ip_tunnel_get_stats64
  2015-05-14 20:56 ` Eric Dumazet
  2015-05-14 21:01   ` Eric Dumazet
@ 2015-05-14 21:07   ` Alexander Duyck
  1 sibling, 0 replies; 5+ messages in thread
From: Alexander Duyck @ 2015-05-14 21:07 UTC (permalink / raw)
  To: Eric Dumazet, Alexander Duyck; +Cc: netdev, davem

On 05/14/2015 01:56 PM, Eric Dumazet wrote:
> On Thu, 2015-05-14 at 13:04 -0700, Alexander Duyck wrote:
>> The rx_dropped stat wasn't being reported when ip_tunnel_get_stats64 was
>> called.  This was leading to some confusing results in my debug as I was
>> seeing rx_errors increment but no other value which pointed me toward the
>> type of error being seen.
>>
>> This change corrects that by copying the value over from
>> dev->stats.rx_dropped inot tot->rx_dropped.
>>
>> Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
>> ---
>>   net/ipv4/ip_tunnel_core.c |    1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
>> index 3998b1822d85..a6a980680b8a 100644
>> --- a/net/ipv4/ip_tunnel_core.c
>> +++ b/net/ipv4/ip_tunnel_core.c
>> @@ -191,6 +191,7 @@ struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
>>   	tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
>>   	tot->rx_length_errors = dev->stats.rx_length_errors;
>>   	tot->rx_frame_errors = dev->stats.rx_frame_errors;
>> +	tot->rx_dropped = dev->stats.rx_dropped;
>>   	tot->rx_errors = dev->stats.rx_errors;
>>   
>>   	tot->tx_fifo_errors = dev->stats.tx_fifo_errors;
> Or use netdev_stats_to_stats64() to remove all these copies, as we
> obviously can miss some of them.
>
> -> reduce code size.

Good point.  I'll clean this up and submit a v2.

Thanks.

- Alex

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

* Re: [net-next PATCH] ip_tunnel: Report Rx dropped in ip_tunnel_get_stats64
  2015-05-14 21:01   ` Eric Dumazet
@ 2015-05-14 21:21     ` Alexander Duyck
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Duyck @ 2015-05-14 21:21 UTC (permalink / raw)
  To: Eric Dumazet, Alexander Duyck; +Cc: netdev, davem

On 05/14/2015 02:01 PM, Eric Dumazet wrote:
> On Thu, 2015-05-14 at 13:56 -0700, Eric Dumazet wrote:
>
>> Or use netdev_stats_to_stats64() to remove all these copies, as we
>> obviously can miss some of them.
> Something like following untested patch :
>
> diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
> index 3998b1822d8521ad391ac26db1e694a3cd7ad011..3f298193d19ffc3a9e57fac4654c59bbe65545e1 100644
> --- a/net/ipv4/ip_tunnel_core.c
> +++ b/net/ipv4/ip_tunnel_core.c
> @@ -165,6 +165,7 @@ struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
>   {
>   	int i;
>   
> +	netdev_stats_to_stats64(tot, &dev->stats);
>   	for_each_possible_cpu(i) {
>   		const struct pcpu_sw_netstats *tstats =
>   						   per_cpu_ptr(dev->tstats, i);
> @@ -184,23 +185,6 @@ struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev,
>   		tot->rx_bytes   += rx_bytes;
>   		tot->tx_bytes   += tx_bytes;
>   	}
> -
> -	tot->multicast = dev->stats.multicast;
> -
> -	tot->rx_crc_errors = dev->stats.rx_crc_errors;
> -	tot->rx_fifo_errors = dev->stats.rx_fifo_errors;
> -	tot->rx_length_errors = dev->stats.rx_length_errors;
> -	tot->rx_frame_errors = dev->stats.rx_frame_errors;
> -	tot->rx_errors = dev->stats.rx_errors;
> -
> -	tot->tx_fifo_errors = dev->stats.tx_fifo_errors;
> -	tot->tx_carrier_errors = dev->stats.tx_carrier_errors;
> -	tot->tx_dropped = dev->stats.tx_dropped;
> -	tot->tx_aborted_errors = dev->stats.tx_aborted_errors;
> -	tot->tx_errors = dev->stats.tx_errors;
> -
> -	tot->collisions  = dev->stats.collisions;
> -
>   	return tot;
>   }
>   EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64);
>

Yeah, I just submitted v2 and realized I needed to have the call before 
looping through the percpu stats.  I will have v3 ready shortly based on 
your suggestion.

- Alex

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

end of thread, other threads:[~2015-05-14 21:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-14 20:04 [net-next PATCH] ip_tunnel: Report Rx dropped in ip_tunnel_get_stats64 Alexander Duyck
2015-05-14 20:56 ` Eric Dumazet
2015-05-14 21:01   ` Eric Dumazet
2015-05-14 21:21     ` Alexander Duyck
2015-05-14 21:07   ` Alexander Duyck

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).