diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2008-06-18 00:04:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-18 00:04:56 -0400 |
commit | cb61cb9b8b5ef6c2697d84e5015e314626eb2fba (patch) | |
tree | 430dd8d5b56d0a9911750ffcbd97563ce68d1b27 /net | |
parent | fe2c802ab62aa63d276deafa905875f3455f2621 (diff) |
udp: sk_drops handling
In commits 33c732c36169d7022ad7d6eb474b0c9be43a2dc1 ([IPV4]: Add raw
drops counter) and a92aa318b4b369091fd80433c80e62838db8bc1c ([IPV6]:
Add raw drops counter), Wang Chen added raw drops counter for
/proc/net/raw & /proc/net/raw6
This patch adds this capability to UDP sockets too (/proc/net/udp &
/proc/net/udp6).
This means that 'RcvbufErrors' errors found in /proc/net/snmp can be also
be examined for each udp socket.
# grep Udp: /proc/net/snmp
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors
Udp: 23971006 75 899420 16390693 146348 0
# cat /proc/net/udp
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt ---
uid timeout inode ref pointer drops
75: 00000000:02CB 00000000:0000 07 00000000:00000000 00:00000000 00000000 ---
0 0 2358 2 ffff81082a538c80 0
111: 00000000:006F 00000000:0000 07 00000000:00000000 00:00000000 00000000 ---
0 0 2286 2 ffff81042dd35c80 146348
In this example, only port 111 (0x006F) was flooded by messages that
user program could not read fast enough. 146348 messages were lost.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/raw.c | 2 | ||||
-rw-r--r-- | net/ipv4/udp.c | 11 | ||||
-rw-r--r-- | net/ipv6/raw.c | 2 | ||||
-rw-r--r-- | net/ipv6/udp.c | 11 |
4 files changed, 16 insertions, 10 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 7d449468409e..925fdf18cf92 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -944,7 +944,7 @@ static int raw_seq_show(struct seq_file *seq, void *v) | |||
944 | if (v == SEQ_START_TOKEN) | 944 | if (v == SEQ_START_TOKEN) |
945 | seq_printf(seq, " sl local_address rem_address st tx_queue " | 945 | seq_printf(seq, " sl local_address rem_address st tx_queue " |
946 | "rx_queue tr tm->when retrnsmt uid timeout " | 946 | "rx_queue tr tm->when retrnsmt uid timeout " |
947 | "inode drops\n"); | 947 | "inode ref pointer drops\n"); |
948 | else | 948 | else |
949 | raw_sock_seq_show(seq, v, raw_seq_private(seq)->bucket); | 949 | raw_sock_seq_show(seq, v, raw_seq_private(seq)->bucket); |
950 | return 0; | 950 | return 0; |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 11eabf136144..3bbf6fb6e4f5 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1040,8 +1040,10 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
1040 | 1040 | ||
1041 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { | 1041 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { |
1042 | /* Note that an ENOMEM error is charged twice */ | 1042 | /* Note that an ENOMEM error is charged twice */ |
1043 | if (rc == -ENOMEM) | 1043 | if (rc == -ENOMEM) { |
1044 | UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); | 1044 | UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); |
1045 | atomic_inc(&sk->sk_drops); | ||
1046 | } | ||
1045 | goto drop; | 1047 | goto drop; |
1046 | } | 1048 | } |
1047 | 1049 | ||
@@ -1629,12 +1631,13 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f, | |||
1629 | __u16 srcp = ntohs(inet->sport); | 1631 | __u16 srcp = ntohs(inet->sport); |
1630 | 1632 | ||
1631 | seq_printf(f, "%4d: %08X:%04X %08X:%04X" | 1633 | seq_printf(f, "%4d: %08X:%04X %08X:%04X" |
1632 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p%n", | 1634 | " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n", |
1633 | bucket, src, srcp, dest, destp, sp->sk_state, | 1635 | bucket, src, srcp, dest, destp, sp->sk_state, |
1634 | atomic_read(&sp->sk_wmem_alloc), | 1636 | atomic_read(&sp->sk_wmem_alloc), |
1635 | atomic_read(&sp->sk_rmem_alloc), | 1637 | atomic_read(&sp->sk_rmem_alloc), |
1636 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), | 1638 | 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), |
1637 | atomic_read(&sp->sk_refcnt), sp, len); | 1639 | atomic_read(&sp->sk_refcnt), sp, |
1640 | atomic_read(&sp->sk_drops), len); | ||
1638 | } | 1641 | } |
1639 | 1642 | ||
1640 | int udp4_seq_show(struct seq_file *seq, void *v) | 1643 | int udp4_seq_show(struct seq_file *seq, void *v) |
@@ -1643,7 +1646,7 @@ int udp4_seq_show(struct seq_file *seq, void *v) | |||
1643 | seq_printf(seq, "%-127s\n", | 1646 | seq_printf(seq, "%-127s\n", |
1644 | " sl local_address rem_address st tx_queue " | 1647 | " sl local_address rem_address st tx_queue " |
1645 | "rx_queue tr tm->when retrnsmt uid timeout " | 1648 | "rx_queue tr tm->when retrnsmt uid timeout " |
1646 | "inode"); | 1649 | "inode ref pointer drops"); |
1647 | else { | 1650 | else { |
1648 | struct udp_iter_state *state = seq->private; | 1651 | struct udp_iter_state *state = seq->private; |
1649 | int len; | 1652 | int len; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 456777d7a407..34cfb3f41c2c 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -1251,7 +1251,7 @@ static int raw6_seq_show(struct seq_file *seq, void *v) | |||
1251 | "local_address " | 1251 | "local_address " |
1252 | "remote_address " | 1252 | "remote_address " |
1253 | "st tx_queue rx_queue tr tm->when retrnsmt" | 1253 | "st tx_queue rx_queue tr tm->when retrnsmt" |
1254 | " uid timeout inode drops\n"); | 1254 | " uid timeout inode ref pointer drops\n"); |
1255 | else | 1255 | else |
1256 | raw6_sock_seq_show(seq, v, raw_seq_private(seq)->bucket); | 1256 | raw6_sock_seq_show(seq, v, raw_seq_private(seq)->bucket); |
1257 | return 0; | 1257 | return 0; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 432edaa882f6..f91e1df0d25e 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -297,8 +297,10 @@ int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) | |||
297 | 297 | ||
298 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { | 298 | if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { |
299 | /* Note that an ENOMEM error is charged twice */ | 299 | /* Note that an ENOMEM error is charged twice */ |
300 | if (rc == -ENOMEM) | 300 | if (rc == -ENOMEM) { |
301 | UDP6_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); | 301 | UDP6_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, is_udplite); |
302 | atomic_inc(&sk->sk_drops); | ||
303 | } | ||
302 | goto drop; | 304 | goto drop; |
303 | } | 305 | } |
304 | 306 | ||
@@ -955,7 +957,7 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket | |||
955 | srcp = ntohs(inet->sport); | 957 | srcp = ntohs(inet->sport); |
956 | seq_printf(seq, | 958 | seq_printf(seq, |
957 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 959 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
958 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p\n", | 960 | "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n", |
959 | bucket, | 961 | bucket, |
960 | src->s6_addr32[0], src->s6_addr32[1], | 962 | src->s6_addr32[0], src->s6_addr32[1], |
961 | src->s6_addr32[2], src->s6_addr32[3], srcp, | 963 | src->s6_addr32[2], src->s6_addr32[3], srcp, |
@@ -967,7 +969,8 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket | |||
967 | 0, 0L, 0, | 969 | 0, 0L, 0, |
968 | sock_i_uid(sp), 0, | 970 | sock_i_uid(sp), 0, |
969 | sock_i_ino(sp), | 971 | sock_i_ino(sp), |
970 | atomic_read(&sp->sk_refcnt), sp); | 972 | atomic_read(&sp->sk_refcnt), sp, |
973 | atomic_read(&sp->sk_drops)); | ||
971 | } | 974 | } |
972 | 975 | ||
973 | int udp6_seq_show(struct seq_file *seq, void *v) | 976 | int udp6_seq_show(struct seq_file *seq, void *v) |
@@ -978,7 +981,7 @@ int udp6_seq_show(struct seq_file *seq, void *v) | |||
978 | "local_address " | 981 | "local_address " |
979 | "remote_address " | 982 | "remote_address " |
980 | "st tx_queue rx_queue tr tm->when retrnsmt" | 983 | "st tx_queue rx_queue tr tm->when retrnsmt" |
981 | " uid timeout inode\n"); | 984 | " uid timeout inode ref pointer drops\n"); |
982 | else | 985 | else |
983 | udp6_sock_seq_show(seq, v, ((struct udp_iter_state *)seq->private)->bucket); | 986 | udp6_sock_seq_show(seq, v, ((struct udp_iter_state *)seq->private)->bucket); |
984 | return 0; | 987 | return 0; |