From: Wang Chen <wangchen@cn•fujitsu.com>
To: Eric Dumazet <dada1@cosmosbay•com>
Cc: netdev@vger•kernel.org
Subject: Re: [PATCH] IPV4: add raw drops counter
Date: Wed, 14 Nov 2007 09:27:14 +0800 [thread overview]
Message-ID: <473A4EF2.5090507@cn.fujitsu.com> (raw)
In-Reply-To: <47398655.4060400@cosmosbay.com>
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?
next prev parent reply other threads:[~2007-11-14 1:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-13 9:57 [PATCH] IPV4: add raw drops counter Wang Chen
2007-11-13 11:11 ` Eric Dumazet
2007-11-14 1:27 ` Wang Chen [this message]
2007-11-14 6:00 ` Eric Dumazet
2007-11-14 3:12 ` [PATCH 1/2] SOCK: " Wang Chen
2007-11-14 3:15 ` [PATCH 2/2] SOCK: add raw6 " Wang Chen
2007-11-14 4:31 ` David Miller
2007-11-14 4:50 ` Wang Chen
2007-11-14 5:48 ` Eric Dumazet
2007-11-14 6:45 ` Wang Chen
2007-11-14 4:30 ` [PATCH 1/2] SOCK: add raw " 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=473A4EF2.5090507@cn.fujitsu.com \
--to=wangchen@cn$(echo .)fujitsu.com \
--cc=dada1@cosmosbay$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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