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 /include/linux/skbuff.h | |
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 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 17b3f70fbbc3..c618fbf7d173 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -288,6 +288,7 @@ struct sk_buff { | |||
288 | __u8 pkt_type:3, | 288 | __u8 pkt_type:3, |
289 | fclone:2, | 289 | fclone:2, |
290 | ipvs_property:1, | 290 | ipvs_property:1, |
291 | peeked:1, | ||
291 | nf_trace:1; | 292 | nf_trace:1; |
292 | __be16 protocol; | 293 | __be16 protocol; |
293 | 294 | ||
@@ -1538,6 +1539,8 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | |||
1538 | skb = skb->prev) | 1539 | skb = skb->prev) |
1539 | 1540 | ||
1540 | 1541 | ||
1542 | extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, | ||
1543 | int *peeked, int *err); | ||
1541 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, | 1544 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, |
1542 | int noblock, int *err); | 1545 | int noblock, int *err); |
1543 | extern unsigned int datagram_poll(struct file *file, struct socket *sock, | 1546 | extern unsigned int datagram_poll(struct file *file, struct socket *sock, |