diff options
author | Andrew Morton <akpm@osdl.org> | 2006-03-31 02:09:36 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-31 02:09:36 -0800 |
commit | c08e49611a8b4e38a75bf217e1029a48faf10b82 (patch) | |
tree | 2768e4ff07657422d85d988d0f64f6f2ae8b7305 /net/core | |
parent | 56079431b6ba163df8ba26b3eccc82379f0c0ce4 (diff) |
[NET]: add SO_RCVBUF comment
Put a comment in there explaining why we double the setsockopt()
caller's SO_RCVBUF. People keep wondering.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/sock.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index a96ea7dd0fc..ed2afdb9ea2 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -385,7 +385,21 @@ set_sndbuf: val = sysctl_rmem_max; set_rcvbuf: sk->sk_userlocks |= SOCK_RCVBUF_LOCK; - /* FIXME: is this lower bound the right one? */ + /* + * We double it on the way in to account for + * "struct sk_buff" etc. overhead. Applications + * assume that the SO_RCVBUF setting they make will + * allow that much actual data to be received on that + * socket. + * + * Applications are unaware that "struct sk_buff" and + * other overheads allocate from the receive buffer + * during socket buffer allocation. + * + * And after considering the possible alternatives, + * returning the value we actually used in getsockopt + * is the most desirable behavior. + */ if ((val * 2) < SOCK_MIN_RCVBUF) sk->sk_rcvbuf = SOCK_MIN_RCVBUF; else |