[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <473A4EF2.5090507@cn.fujitsu.com>
Date: Wed, 14 Nov 2007 09:27:14 +0800
From: Wang Chen <wangchen@...fujitsu.com>
To: Eric Dumazet <dada1@...mosbay.com>
CC: netdev@...r.kernel.org
Subject: Re: [PATCH] IPV4: add raw drops counter
Eric Dumazet said the following on 2007-11-13 19:11:
> Wang Chen a écrit :
>> Add raw drops counter for IPv4 in /proc/net/raw .
>>
>> + 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.
>
Yes, sock_queue_rcv_skb() is called on a locked socket. But sk_drops
will not only used with sock_queue_rcv_skb(), but also with
xfrm4_policy_check(), skb_checksum_complete(), skb_kill_datagram(),etc.
So, atomic_t ensure sk_drops will be atomic increment.
> Also, I suggest doing the sk_drops increment in sock_queue_rcv_skb() so
> that it can be used for other sockets as well ?
>
As I described before, sk_drops will be used on different conditions,
on which the raw drop happens.
So doing sk_drops increment in upper caller is better than in
sock_queue_rcv_skb().
Thank you for your suggestion, I will make a new patch to add sk_drops
increment in other places.
> 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);
>
>
Yes. I agree.
How do other people think about it?
-
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