diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-12-11 14:30:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:56:33 -0500 |
commit | 1781f7f5804e52ee2d35328b129602146a8d8254 (patch) | |
tree | dc67102f480e59d87859c50392452be4f41487bd | |
parent | 27ab2568649d5ba6c5a20212079b7c4f6da4ca0d (diff) |
[UDP]: Restore missing inDatagrams increments
The previous move of the the UDP inDatagrams counter caused the
counting of encapsulated packets, SUNRPC data (as opposed to call)
packets and RXRPC packets to go missing.
This patch restores all of these.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/ipv6.h | 9 | ||||
-rw-r--r-- | include/net/udp.h | 25 | ||||
-rw-r--r-- | include/net/udplite.h | 3 | ||||
-rw-r--r-- | net/ipv4/udp.c | 6 | ||||
-rw-r--r-- | net/ipv6/proc.c | 1 | ||||
-rw-r--r-- | net/ipv6/udp.c | 2 | ||||
-rw-r--r-- | net/rxrpc/ar-input.c | 4 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 6 |
8 files changed, 42 insertions, 14 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index e90f9625cb1b..a84f3f697a34 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -164,15 +164,6 @@ DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); | |||
164 | #define ICMP6MSGIN_INC_STATS_USER(idev, field) \ | 164 | #define ICMP6MSGIN_INC_STATS_USER(idev, field) \ |
165 | _DEVINC(icmpv6msg, _USER, idev, field) | 165 | _DEVINC(icmpv6msg, _USER, idev, field) |
166 | 166 | ||
167 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | ||
168 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | ||
169 | #define UDP6_INC_STATS_BH(field, is_udplite) do { \ | ||
170 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ | ||
171 | else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) | ||
172 | #define UDP6_INC_STATS_USER(field, is_udplite) do { \ | ||
173 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | ||
174 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | ||
175 | |||
176 | struct ip6_ra_chain | 167 | struct ip6_ra_chain |
177 | { | 168 | { |
178 | struct ip6_ra_chain *next; | 169 | struct ip6_ra_chain *next; |
diff --git a/include/net/udp.h b/include/net/udp.h index 98755ebaf163..98cb09ca3a27 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -139,6 +139,12 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
139 | int (*push_pending_frames)(struct sock *)); | 139 | int (*push_pending_frames)(struct sock *)); |
140 | 140 | ||
141 | DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); | 141 | DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); |
142 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | ||
143 | |||
144 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | ||
145 | DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics); | ||
146 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | ||
147 | |||
142 | /* | 148 | /* |
143 | * SNMP statistics for UDP and UDP-Lite | 149 | * SNMP statistics for UDP and UDP-Lite |
144 | */ | 150 | */ |
@@ -149,6 +155,25 @@ DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); | |||
149 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ | 155 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ |
150 | else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) | 156 | else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) |
151 | 157 | ||
158 | #define UDP6_INC_STATS_BH(field, is_udplite) do { \ | ||
159 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ | ||
160 | else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) | ||
161 | #define UDP6_INC_STATS_USER(field, is_udplite) do { \ | ||
162 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | ||
163 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | ||
164 | |||
165 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
166 | #define UDPX_INC_STATS_BH(sk, field) \ | ||
167 | do { \ | ||
168 | if ((sk)->sk_family == AF_INET) \ | ||
169 | UDP_INC_STATS_BH(field, 0); \ | ||
170 | else \ | ||
171 | UDP6_INC_STATS_BH(field, 0); \ | ||
172 | } while (0); | ||
173 | #else | ||
174 | #define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(field, 0) | ||
175 | #endif | ||
176 | |||
152 | /* /proc */ | 177 | /* /proc */ |
153 | struct udp_seq_afinfo { | 178 | struct udp_seq_afinfo { |
154 | struct module *owner; | 179 | struct module *owner; |
diff --git a/include/net/udplite.h b/include/net/udplite.h index 635b0eafca95..b76b2e377af4 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -13,9 +13,6 @@ | |||
13 | extern struct proto udplite_prot; | 13 | extern struct proto udplite_prot; |
14 | extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; | 14 | extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; |
15 | 15 | ||
16 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | ||
17 | DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics); | ||
18 | |||
19 | /* | 16 | /* |
20 | * Checksum computation is all in software, hence simpler getfrag. | 17 | * Checksum computation is all in software, hence simpler getfrag. |
21 | */ | 18 | */ |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index f50de5d5218d..78cfcb4a1b3f 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -110,6 +110,7 @@ | |||
110 | */ | 110 | */ |
111 | 111 | ||
112 | DEFINE_SNMP_STAT(struct udp_mib, udp_statistics) __read_mostly; | 112 | DEFINE_SNMP_STAT(struct udp_mib, udp_statistics) __read_mostly; |
113 | EXPORT_SYMBOL(udp_statistics); | ||
113 | 114 | ||
114 | struct hlist_head udp_hash[UDP_HTABLE_SIZE]; | 115 | struct hlist_head udp_hash[UDP_HTABLE_SIZE]; |
115 | DEFINE_RWLOCK(udp_hash_lock); | 116 | DEFINE_RWLOCK(udp_hash_lock); |
@@ -969,8 +970,11 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
969 | int ret; | 970 | int ret; |
970 | 971 | ||
971 | ret = (*up->encap_rcv)(sk, skb); | 972 | ret = (*up->encap_rcv)(sk, skb); |
972 | if (ret <= 0) | 973 | if (ret <= 0) { |
974 | UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, | ||
975 | is_udplite); | ||
973 | return -ret; | 976 | return -ret; |
977 | } | ||
974 | } | 978 | } |
975 | 979 | ||
976 | /* FALLTHROUGH -- it's a UDP Packet */ | 980 | /* FALLTHROUGH -- it's a UDP Packet */ |
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 44937616057e..41e9980b3e0e 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <net/ip.h> | 27 | #include <net/ip.h> |
28 | #include <net/sock.h> | 28 | #include <net/sock.h> |
29 | #include <net/tcp.h> | 29 | #include <net/tcp.h> |
30 | #include <net/udp.h> | ||
30 | #include <net/transp_v6.h> | 31 | #include <net/transp_v6.h> |
31 | #include <net/ipv6.h> | 32 | #include <net/ipv6.h> |
32 | 33 | ||
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 87bccec9882a..36bdcd2e1b52 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/ipv6.h> | 34 | #include <linux/ipv6.h> |
35 | #include <linux/icmpv6.h> | 35 | #include <linux/icmpv6.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/module.h> | ||
37 | #include <linux/skbuff.h> | 38 | #include <linux/skbuff.h> |
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
39 | 40 | ||
@@ -51,6 +52,7 @@ | |||
51 | #include "udp_impl.h" | 52 | #include "udp_impl.h" |
52 | 53 | ||
53 | DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; | 54 | DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; |
55 | EXPORT_SYMBOL(udp_stats_in6); | ||
54 | 56 | ||
55 | static inline int udp_v6_get_port(struct sock *sk, unsigned short snum) | 57 | static inline int udp_v6_get_port(struct sock *sk, unsigned short snum) |
56 | { | 58 | { |
diff --git a/net/rxrpc/ar-input.c b/net/rxrpc/ar-input.c index 91b5bbb003e2..f446d9b9925f 100644 --- a/net/rxrpc/ar-input.c +++ b/net/rxrpc/ar-input.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <net/sock.h> | 20 | #include <net/sock.h> |
21 | #include <net/af_rxrpc.h> | 21 | #include <net/af_rxrpc.h> |
22 | #include <net/ip.h> | 22 | #include <net/ip.h> |
23 | #include <net/udp.h> | ||
23 | #include "ar-internal.h" | 24 | #include "ar-internal.h" |
24 | 25 | ||
25 | unsigned long rxrpc_ack_timeout = 1; | 26 | unsigned long rxrpc_ack_timeout = 1; |
@@ -707,10 +708,13 @@ void rxrpc_data_ready(struct sock *sk, int count) | |||
707 | if (skb_checksum_complete(skb)) { | 708 | if (skb_checksum_complete(skb)) { |
708 | rxrpc_free_skb(skb); | 709 | rxrpc_free_skb(skb); |
709 | rxrpc_put_local(local); | 710 | rxrpc_put_local(local); |
711 | UDP_INC_STATS_BH(UDP_MIB_INERRORS, 0); | ||
710 | _leave(" [CSUM failed]"); | 712 | _leave(" [CSUM failed]"); |
711 | return; | 713 | return; |
712 | } | 714 | } |
713 | 715 | ||
716 | UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, 0); | ||
717 | |||
714 | /* the socket buffer we have is owned by UDP, with UDP's data all over | 718 | /* the socket buffer we have is owned by UDP, with UDP's data all over |
715 | * it, but we really want our own */ | 719 | * it, but we really want our own */ |
716 | skb_orphan(skb); | 720 | skb_orphan(skb); |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 2f630a512ab7..6fa52f44de0f 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -838,8 +838,12 @@ static void xs_udp_data_ready(struct sock *sk, int len) | |||
838 | copied = repsize; | 838 | copied = repsize; |
839 | 839 | ||
840 | /* Suck it into the iovec, verify checksum if not done by hw. */ | 840 | /* Suck it into the iovec, verify checksum if not done by hw. */ |
841 | if (csum_partial_copy_to_xdr(&rovr->rq_private_buf, skb)) | 841 | if (csum_partial_copy_to_xdr(&rovr->rq_private_buf, skb)) { |
842 | UDPX_INC_STATS_BH(sk, UDP_MIB_INERRORS); | ||
842 | goto out_unlock; | 843 | goto out_unlock; |
844 | } | ||
845 | |||
846 | UDPX_INC_STATS_BH(sk, UDP_MIB_INDATAGRAMS); | ||
843 | 847 | ||
844 | /* Something worked... */ | 848 | /* Something worked... */ |
845 | dst_confirm(skb->dst); | 849 | dst_confirm(skb->dst); |