diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-12-05 04:53:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:56:34 -0500 |
commit | a59322be07c964e916d15be3df473fb7ba20c41e (patch) | |
tree | 16d4caa41c1fd6c3fb907ce792202b157e6c9a1e /net/ipv6/udp.c | |
parent | 1781f7f5804e52ee2d35328b129602146a8d8254 (diff) |
[UDP]: Only increment counter on first peek/recv
The previous move of the the UDP inDatagrams counter caused each
peek of the same packet to be counted separately. This may be
undesirable.
This patch fixes this by adding a bit to sk_buff to record whether
this packet has already been seen through skb_recv_datagram. We
then only increment the counter when the packet is seen for the
first time.
The only dodgy part is the fact that skb_recv_datagram doesn't have
a good way of returning this new bit of information. So I've added
a new function __skb_recv_datagram that does return this and made
skb_recv_datagram a wrapper around it.
The plan is to eventually replace all uses of skb_recv_datagram with
this new function at which time it can be renamed its proper name.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 36bdcd2e1b52..fa640765385e 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -123,6 +123,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
123 | struct inet_sock *inet = inet_sk(sk); | 123 | struct inet_sock *inet = inet_sk(sk); |
124 | struct sk_buff *skb; | 124 | struct sk_buff *skb; |
125 | unsigned int ulen, copied; | 125 | unsigned int ulen, copied; |
126 | int peeked; | ||
126 | int err; | 127 | int err; |
127 | int is_udplite = IS_UDPLITE(sk); | 128 | int is_udplite = IS_UDPLITE(sk); |
128 | 129 | ||
@@ -133,7 +134,8 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
133 | return ipv6_recv_error(sk, msg, len); | 134 | return ipv6_recv_error(sk, msg, len); |
134 | 135 | ||
135 | try_again: | 136 | try_again: |
136 | skb = skb_recv_datagram(sk, flags, noblock, &err); | 137 | skb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0), |
138 | &peeked, &err); | ||
137 | if (!skb) | 139 | if (!skb) |
138 | goto out; | 140 | goto out; |
139 | 141 | ||
@@ -166,7 +168,8 @@ try_again: | |||
166 | if (err) | 168 | if (err) |
167 | goto out_free; | 169 | goto out_free; |
168 | 170 | ||
169 | UDP6_INC_STATS_USER(UDP_MIB_INDATAGRAMS, is_udplite); | 171 | if (!peeked) |
172 | UDP6_INC_STATS_USER(UDP_MIB_INDATAGRAMS, is_udplite); | ||
170 | 173 | ||
171 | sock_recv_timestamp(msg, sk, skb); | 174 | sock_recv_timestamp(msg, sk, skb); |
172 | 175 | ||