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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html