diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-09-02 21:05:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-02 21:05:33 -0400 |
commit | 6ce9e7b5fe3195d1ae6e3a0753d4ddcac5cd699e (patch) | |
tree | d7228b3ea7000bc29b959556d8cb264b12365586 /net/ipv4/udp.c | |
parent | 2e59af3dcbdf11635c03f22bfc9706744465d589 (diff) |
ip: Report qdisc packet drops
Christoph Lameter pointed out that packet drops at qdisc level where not
accounted in SNMP counters. Only if application sets IP_RECVERR, drops
are reported to user (-ENOBUFS errors) and SNMP counters updated.
IP_RECVERR is used to enable extended reliable error message passing,
but these are not needed to update system wide SNMP stats.
This patch changes things a bit to allow SNMP counters to be updated,
regardless of IP_RECVERR being set or not on the socket.
Example after an UDP tx flood
# netstat -s
...
IP:
1487048 outgoing packets dropped
...
Udp:
...
SndbufErrors: 1487048
send() syscalls, do however still return an OK status, to not
break applications.
Note : send() manual page explicitly says for -ENOBUFS error :
"The output queue for a network interface was full.
This generally indicates that the interface has stopped sending,
but may be caused by transient congestion.
(Normally, this does not occur in Linux. Packets are just silently
dropped when a device queue overflows.) "
This is not true for IP_RECVERR enabled sockets : a send() syscall
that hit a qdisc drop returns an ENOBUFS error.
Many thanks to Christoph, David, and last but not least, Alexey !
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 29ebb0d27a1e..ebaaa7f973d7 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -561,12 +561,18 @@ static int udp_push_pending_frames(struct sock *sk) | |||
561 | 561 | ||
562 | send: | 562 | send: |
563 | err = ip_push_pending_frames(sk); | 563 | err = ip_push_pending_frames(sk); |
564 | if (err) { | ||
565 | if (err == -ENOBUFS && !inet->recverr) { | ||
566 | UDP_INC_STATS_USER(sock_net(sk), | ||
567 | UDP_MIB_SNDBUFERRORS, is_udplite); | ||
568 | err = 0; | ||
569 | } | ||
570 | } else | ||
571 | UDP_INC_STATS_USER(sock_net(sk), | ||
572 | UDP_MIB_OUTDATAGRAMS, is_udplite); | ||
564 | out: | 573 | out: |
565 | up->len = 0; | 574 | up->len = 0; |
566 | up->pending = 0; | 575 | up->pending = 0; |
567 | if (!err) | ||
568 | UDP_INC_STATS_USER(sock_net(sk), | ||
569 | UDP_MIB_OUTDATAGRAMS, is_udplite); | ||
570 | return err; | 576 | return err; |
571 | } | 577 | } |
572 | 578 | ||