aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-07-06 00:18:48 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-06 00:18:48 -0400
commit0283328e2360bbf3081e97f1b720dd4c4dbae111 (patch)
treed0734e59c0900b3389ddcf469950715e60f537b4
parent629ca23c331ec75ac87b016debbb3c4d2fe62650 (diff)
MIB: add struct net to UDP_INC_STATS_BH
Two special cases here - one is rxrpc - I put init_net there explicitly, since we haven't touched this part yet. The second place is in __udp4_lib_rcv - we already have a struct net there, but I have to move its initialization above to make it ready at the "drop" label. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/udp.h6
-rw-r--r--net/ipv4/udp.c18
-rw-r--r--net/rxrpc/ar-input.c5
3 files changed, 16 insertions, 13 deletions
diff --git a/include/net/udp.h b/include/net/udp.h
index 13319094b134..7b18cfb2fe0b 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -161,7 +161,7 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
161#define UDP_INC_STATS_USER(net, field, is_udplite) do { (void)net; \ 161#define UDP_INC_STATS_USER(net, field, is_udplite) do { (void)net; \
162 if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \ 162 if (is_udplite) SNMP_INC_STATS_USER(udplite_statistics, field); \
163 else SNMP_INC_STATS_USER(udp_statistics, field); } while(0) 163 else SNMP_INC_STATS_USER(udp_statistics, field); } while(0)
164#define UDP_INC_STATS_BH(field, is_udplite) do { \ 164#define UDP_INC_STATS_BH(net, field, is_udplite) do { (void)net; \
165 if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ 165 if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \
166 else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) 166 else SNMP_INC_STATS_BH(udp_statistics, field); } while(0)
167 167
@@ -176,12 +176,12 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
176#define UDPX_INC_STATS_BH(sk, field) \ 176#define UDPX_INC_STATS_BH(sk, field) \
177 do { \ 177 do { \
178 if ((sk)->sk_family == AF_INET) \ 178 if ((sk)->sk_family == AF_INET) \
179 UDP_INC_STATS_BH(field, 0); \ 179 UDP_INC_STATS_BH(sock_net(sk), field, 0); \
180 else \ 180 else \
181 UDP6_INC_STATS_BH(field, 0); \ 181 UDP6_INC_STATS_BH(field, 0); \
182 } while (0); 182 } while (0);
183#else 183#else
184#define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(field, 0) 184#define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(sock_net(sk), field, 0)
185#endif 185#endif
186 186
187/* /proc */ 187/* /proc */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index c97da5394d70..7187121e922d 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -991,7 +991,8 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
991 991
992 ret = (*up->encap_rcv)(sk, skb); 992 ret = (*up->encap_rcv)(sk, skb);
993 if (ret <= 0) { 993 if (ret <= 0) {
994 UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, 994 UDP_INC_STATS_BH(sock_net(sk),
995 UDP_MIB_INDATAGRAMS,
995 is_udplite); 996 is_udplite);
996 return -ret; 997 return -ret;
997 } 998 }
@@ -1044,7 +1045,8 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
1044 if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { 1045 if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) {
1045 /* Note that an ENOMEM error is charged twice */ 1046 /* Note that an ENOMEM error is charged twice */
1046 if (rc == -ENOMEM) { 1047 if (rc == -ENOMEM) {
1047 UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); 1048 UDP_INC_STATS_BH(sock_net(sk),
1049 UDP_MIB_RCVBUFERRORS, is_udplite);
1048 atomic_inc(&sk->sk_drops); 1050 atomic_inc(&sk->sk_drops);
1049 } 1051 }
1050 goto drop; 1052 goto drop;
@@ -1053,7 +1055,7 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
1053 return 0; 1055 return 0;
1054 1056
1055drop: 1057drop:
1056 UDP_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite); 1058 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
1057 kfree_skb(skb); 1059 kfree_skb(skb);
1058 return -1; 1060 return -1;
1059} 1061}
@@ -1161,7 +1163,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1161 struct rtable *rt = (struct rtable*)skb->dst; 1163 struct rtable *rt = (struct rtable*)skb->dst;
1162 __be32 saddr = ip_hdr(skb)->saddr; 1164 __be32 saddr = ip_hdr(skb)->saddr;
1163 __be32 daddr = ip_hdr(skb)->daddr; 1165 __be32 daddr = ip_hdr(skb)->daddr;
1164 struct net *net; 1166 struct net *net = dev_net(skb->dev);
1165 1167
1166 /* 1168 /*
1167 * Validate the packet. 1169 * Validate the packet.
@@ -1183,7 +1185,6 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1183 if (udp4_csum_init(skb, uh, proto)) 1185 if (udp4_csum_init(skb, uh, proto))
1184 goto csum_error; 1186 goto csum_error;
1185 1187
1186 net = dev_net(skb->dev);
1187 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) 1188 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
1188 return __udp4_lib_mcast_deliver(net, skb, uh, 1189 return __udp4_lib_mcast_deliver(net, skb, uh,
1189 saddr, daddr, udptable); 1190 saddr, daddr, udptable);
@@ -1217,7 +1218,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1217 if (udp_lib_checksum_complete(skb)) 1218 if (udp_lib_checksum_complete(skb))
1218 goto csum_error; 1219 goto csum_error;
1219 1220
1220 UDP_INC_STATS_BH(UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE); 1221 UDP_INC_STATS_BH(net, UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE);
1221 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); 1222 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
1222 1223
1223 /* 1224 /*
@@ -1251,7 +1252,7 @@ csum_error:
1251 ntohs(uh->dest), 1252 ntohs(uh->dest),
1252 ulen); 1253 ulen);
1253drop: 1254drop:
1254 UDP_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); 1255 UDP_INC_STATS_BH(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
1255 kfree_skb(skb); 1256 kfree_skb(skb);
1256 return 0; 1257 return 0;
1257} 1258}
@@ -1458,7 +1459,8 @@ unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)
1458 spin_lock_bh(&rcvq->lock); 1459 spin_lock_bh(&rcvq->lock);
1459 while ((skb = skb_peek(rcvq)) != NULL && 1460 while ((skb = skb_peek(rcvq)) != NULL &&
1460 udp_lib_checksum_complete(skb)) { 1461 udp_lib_checksum_complete(skb)) {
1461 UDP_INC_STATS_BH(UDP_MIB_INERRORS, is_lite); 1462 UDP_INC_STATS_BH(sock_net(sk),
1463 UDP_MIB_INERRORS, is_lite);
1462 __skb_unlink(skb, rcvq); 1464 __skb_unlink(skb, rcvq);
1463 kfree_skb(skb); 1465 kfree_skb(skb);
1464 } 1466 }
diff --git a/net/rxrpc/ar-input.c b/net/rxrpc/ar-input.c
index f8a699e92962..f98c8027e5c1 100644
--- a/net/rxrpc/ar-input.c
+++ b/net/rxrpc/ar-input.c
@@ -21,6 +21,7 @@
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 <net/udp.h>
24#include <net/net_namespace.h>
24#include "ar-internal.h" 25#include "ar-internal.h"
25 26
26unsigned long rxrpc_ack_timeout = 1; 27unsigned long rxrpc_ack_timeout = 1;
@@ -708,12 +709,12 @@ void rxrpc_data_ready(struct sock *sk, int count)
708 if (skb_checksum_complete(skb)) { 709 if (skb_checksum_complete(skb)) {
709 rxrpc_free_skb(skb); 710 rxrpc_free_skb(skb);
710 rxrpc_put_local(local); 711 rxrpc_put_local(local);
711 UDP_INC_STATS_BH(UDP_MIB_INERRORS, 0); 712 UDP_INC_STATS_BH(&init_net, UDP_MIB_INERRORS, 0);
712 _leave(" [CSUM failed]"); 713 _leave(" [CSUM failed]");
713 return; 714 return;
714 } 715 }
715 716
716 UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, 0); 717 UDP_INC_STATS_BH(&init_net, UDP_MIB_INDATAGRAMS, 0);
717 718
718 /* the socket buffer we have is owned by UDP, with UDP's data all over 719 /* the socket buffer we have is owned by UDP, with UDP's data all over
719 * it, but we really want our own */ 720 * it, but we really want our own */