Subject: Report TX drops Incrementing of TX drop counters currently does not work if errors from the network stack are suppressed (IP_RECVERR off). Increment the statistics independently of the setting of IP_RECVERR. Signed-off-by: Christoph Lameter --- net/ipv4/ip_output.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) Index: linux-2.6/net/ipv4/ip_output.c =================================================================== --- linux-2.6.orig/net/ipv4/ip_output.c 2009-08-24 17:32:10.000000000 +0000 +++ linux-2.6/net/ipv4/ip_output.c 2009-08-24 18:00:39.000000000 +0000 @@ -79,6 +79,7 @@ #include #include #include +#include int sysctl_ip_default_ttl __read_mostly = IPDEFTTL; @@ -1300,20 +1301,24 @@ int ip_push_pending_frames(struct sock * /* Netfilter gets whole the not fragmented skb. */ err = ip_local_out(skb); - if (err) { - if (err > 0) - err = inet->recverr ? net_xmit_errno(err) : 0; - if (err) - goto error; + if (err > 0) { + /* The packet was dropped by the network subsystem */ + IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS); + if (iph->protocol == IPPROTO_UDP) + UDP_INC_STATS_USER(sock_net(sk), + UDP_MIB_SNDBUFERRORS, 0); + + /* + * Errors are not passed on if the socket + * does not process errors (see IP_RECVERR). + * net_xmit_errno filters NET_XMIT_CN. + */ + err = inet->recverr ? net_xmit_errno(err) : 0; } out: ip_cork_release(inet); return err; - -error: - IP_INC_STATS(net, IPSTATS_MIB_OUTDISCARDS); - goto out; } /*