]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[IPV4]: add the UdpSndbufErrors and UdpRcvbufErrors MIBs
authorMartin Bligh <mbligh@google.com>
Tue, 15 Aug 2006 06:57:10 +0000 (23:57 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Sep 2006 21:54:41 +0000 (14:54 -0700)
Signed-off-by: Martin Bligh <mbligh@google.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
include/linux/snmp.h
net/ipv4/proc.c
net/ipv4/udp.c

index 4db25d5c7cd17032ecff97ce1f8576242d82f950..30156556f78d76772f4f050dfa1d476c8a14a73b 100644 (file)
@@ -155,6 +155,8 @@ enum
        UDP_MIB_NOPORTS,                        /* NoPorts */
        UDP_MIB_INERRORS,                       /* InErrors */
        UDP_MIB_OUTDATAGRAMS,                   /* OutDatagrams */
+       UDP_MIB_RCVBUFERRORS,                   /* RcvbufErrors */
+       UDP_MIB_SNDBUFERRORS,                   /* SndbufErrors */
        __UDP_MIB_MAX
 };
 
index d61e2a9d394d24d22d282deabba9fafeb088affa..9c6cbe3d9fb80d9f2dda0d5d8716818a3ef40501 100644 (file)
@@ -173,6 +173,8 @@ static const struct snmp_mib snmp4_udp_list[] = {
        SNMP_MIB_ITEM("NoPorts", UDP_MIB_NOPORTS),
        SNMP_MIB_ITEM("InErrors", UDP_MIB_INERRORS),
        SNMP_MIB_ITEM("OutDatagrams", UDP_MIB_OUTDATAGRAMS),
+       SNMP_MIB_ITEM("RcvbufErrors", UDP_MIB_RCVBUFERRORS),
+       SNMP_MIB_ITEM("SndbufErrors", UDP_MIB_SNDBUFERRORS),
        SNMP_MIB_SENTINEL
 };
 
index 87152510980c84df1693f1e29c4c58d25c9ed75e..514c1e9ae81036b90d93fedb38a61000edcae2c7 100644 (file)
@@ -662,6 +662,16 @@ out:
                UDP_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS);
                return len;
        }
+       /*
+        * ENOBUFS = no kernel mem, SOCK_NOSPACE = no sndbuf space.  Reporting
+        * ENOBUFS might not be good (it's not tunable per se), but otherwise
+        * we don't have a good statistic (IpOutDiscards but it can be too many
+        * things).  We could add another new stat but at least for now that
+        * seems like overkill.
+        */
+       if (err == -ENOBUFS || test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) {
+               UDP_INC_STATS_USER(UDP_MIB_SNDBUFERRORS);
+       }
        return err;
 
 do_confirm:
@@ -981,6 +991,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
 static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
 {
        struct udp_sock *up = udp_sk(sk);
+       int rc;
 
        /*
         *      Charge it to the socket, dropping if the queue is full.
@@ -1027,7 +1038,10 @@ static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
                skb->ip_summed = CHECKSUM_UNNECESSARY;
        }
 
-       if (sock_queue_rcv_skb(sk,skb)<0) {
+       if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) {
+               /* Note that an ENOMEM error is charged twice */
+               if (rc == -ENOMEM)
+                       UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS);
                UDP_INC_STATS_BH(UDP_MIB_INERRORS);
                kfree_skb(skb);
                return -1;