public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hong zhi guo <honkiko@gmail.com>
Cc: davem@davemloft.net, Denys Fedoryshchenko <denys@visp.net.lb>,
	Benjamin LaHaise <bcrl@kvack.org>,
	Francois Romieu <romieu@fr.zoreil.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Deadlock, L2TP over IP are not working, 3.4.1
Date: Sun, 10 Jun 2012 15:38:17 +0200	[thread overview]
Message-ID: <1339335497.6001.478.camel@edumazet-glaptop> (raw)
In-Reply-To: <1339335061.6001.466.camel@edumazet-glaptop>

On Sun, 2012-06-10 at 15:31 +0200, Eric Dumazet wrote:

>  include/linux/netdevice.h |   40 ++++++++++++++++++++++++++++--------
>  net/l2tp/l2tp_eth.c       |   29 +++++++++++++-------------
>  2 files changed, 47 insertions(+), 22 deletions(-)
> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index d94cb14..1dee75a 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -171,14 +171,38 @@ static inline bool dev_xmit_complete(int rc)
>   */
>  
>  struct net_device_stats {
> -	unsigned long	rx_packets;
> -	unsigned long	tx_packets;
> -	unsigned long	rx_bytes;
> -	unsigned long	tx_bytes;
> -	unsigned long	rx_errors;
> -	unsigned long	tx_errors;
> -	unsigned long	rx_dropped;
> -	unsigned long	tx_dropped;
> +	union {
> +		unsigned long	rx_packets;
> +		atomic_long_t   rx_packets_atomic;
> +	};
> +	union {
> +		unsigned long	tx_packets;
> +		atomic_long_t	tx_packets_atomic;
> +	};
> +	union {
> +		unsigned long	rx_bytes;
> +		atomic_long_t	rx_bytes_atomic;
> +	};
> +	union {
> +		unsigned long	tx_bytes;
> +		atomic_long_t	tx_bytes_atomic;
> +	};
> +	union {
> +		unsigned long	rx_errors;
> +		atomic_long_t	rx_errors_atomic;
> +	};
> +	union {
> +		unsigned long	tx_errors;
> +		atomic_long_t	tx_errors_atomic;
> +	};
> +	union {
> +		unsigned long	rx_dropped;
> +		atomic_long_t	rx_dropped_atomic;
> +	};
> +	union {
> +		unsigned long	tx_dropped;
> +		atomic_long_t	tx_dropped_atomic;
> +	};

Other choice would be to have a new structure

struct net_device_atomic_stats {
	atomic_long_t rx_packets;
	atomic_long_t tx_packets;
	atomic_long_t rx_bytes;
	atomic_long_t tx_bytes;
	atomic_long_t rx_errors;
	atomic_long_t tx_errors;
	atomic_long_t rx_dropped;
	atomic_long_t tx_dropped;
...
};

and to union it in :

struct net_device {
	...
	union {
		struct net_device_stats	       stats;
		struct net_device_atomic_stats atom_stats;
	};
	...
};

  reply	other threads:[~2012-06-10 13:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06  9:54 Deadlock, L2TP over IP are not working, 3.4.1 Denys Fedoryshchenko
2012-06-07 20:53 ` Francois Romieu
2012-06-07 21:30   ` Eric Dumazet
2012-06-07 22:37     ` Francois Romieu
2012-06-08  5:47       ` Eric Dumazet
2012-06-08 15:41         ` Benjamin LaHaise
2012-06-08 15:56           ` Denys Fedoryshchenko
2012-06-08 16:04             ` Eric Dumazet
2012-06-10 12:14               ` Hong zhi guo
2012-06-10 13:31                 ` Eric Dumazet
2012-06-10 13:38                   ` Eric Dumazet [this message]
2012-06-25 15:35 ` [PATCH] net: l2tp_eth: use LLTX to avoid LOCKDEP splats Eric Dumazet
2012-06-26 23:43   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339335497.6001.478.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=bcrl@kvack.org \
    --cc=davem@davemloft.net \
    --cc=denys@visp.net.lb \
    --cc=honkiko@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox