[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47398655.4060400@cosmosbay.com>
Date: Tue, 13 Nov 2007 12:11:17 +0100
From: Eric Dumazet <dada1@...mosbay.com>
To: Wang Chen <wangchen@...fujitsu.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] IPV4: add raw drops counter
Wang Chen a écrit :
> Add raw drops counter for IPv4 in /proc/net/raw .
>
> Signed-off-by: Wang Chen <wangchen@...fujitsu.com>
> ---
> include/net/sock.h | 2 ++
> net/core/sock.c | 1 +
> net/ipv4/raw.c | 16 +++++++++-------
> 3 files changed, 12 insertions(+), 7 deletions(-)
>
> diff -Nurp linux-2.6.24-rc2.org/include/net/sock.h linux-2.6.24-rc2/include/net/sock.h
> --- linux-2.6.24-rc2.org/include/net/sock.h 2007-11-09 16:37:08.000000000 +0800
> +++ linux-2.6.24-rc2/include/net/sock.h 2007-11-13 15:19:20.000000000 +0800
> @@ -156,6 +156,7 @@ struct sock_common {
> * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt, IPV6_ADDRFORM for instance)
> * @sk_err: last error
> * @sk_err_soft: errors that don't cause failure but are the cause of a persistent failure not just 'timed out'
> + * @sk_drops: raw drops counter
> * @sk_ack_backlog: current listen backlog
> * @sk_max_ack_backlog: listen backlog set in listen()
> * @sk_priority: %SO_PRIORITY setting
> @@ -239,6 +240,7 @@ struct sock {
> rwlock_t sk_callback_lock;
> int sk_err,
> sk_err_soft;
> + atomic_t sk_drops;
>
This doesnt need an atomic_t , just an 'unsigned int' is OK, since
sock_queue_rcv_skb() is called on a locked socket.
Also, I suggest doing the sk_drops increment in sock_queue_rcv_skb() so
that it can be used for other sockets as well ?
I like having this counter per socket, but only if an application can
retrieve its value with a getsockopt() call, dont you think ?
getsockopt(sock, SOL_SOCKET, SO_DROPSCNT, &val, &vallen);
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists