public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Bligh <mbligh@google.com>
To: Andrew Morton <akpm@osdl.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Add the UdpSndbufErrors and UdpRcvbufErrors MIBs
Date: Wed, 09 Aug 2006 15:31:31 -0700	[thread overview]
Message-ID: <44DA6243.3040803@google.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 100 bytes --]

Add the UdpSndbufErrors and UdpRcvbufErrors MIBs

Signed-off-by: Martin Bligh <mbligh@google.com>



[-- Attachment #2: linux-2.6.18-rc3-udp_mibs --]
[-- Type: text/plain, Size: 2732 bytes --]

Add the UdpSndbufErrors and UdpRcvbufErrors MIBs

Signed-off-by: Martin Bligh <mbligh@google.com>

diff -aurpN -X /home/mbligh/.diff.exclude linux-2.6.18-rc3/include/linux/snmp.h linux-2.6.18-rc3-udp_mibs/include/linux/snmp.h
--- linux-2.6.18-rc3/include/linux/snmp.h	2005-10-27 17:02:08.000000000 -0700
+++ linux-2.6.18-rc3-udp_mibs/include/linux/snmp.h	2006-08-09 15:23:31.000000000 -0700
@@ -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
 };
 
diff -aurpN -X /home/mbligh/.diff.exclude linux-2.6.18-rc3/net/ipv4/proc.c linux-2.6.18-rc3-udp_mibs/net/ipv4/proc.c
--- linux-2.6.18-rc3/net/ipv4/proc.c	2006-06-20 14:07:21.000000000 -0700
+++ linux-2.6.18-rc3-udp_mibs/net/ipv4/proc.c	2006-08-09 15:23:31.000000000 -0700
@@ -173,6 +173,8 @@ static const struct snmp_mib snmp4_udp_l
 	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
 };
 
diff -aurpN -X /home/mbligh/.diff.exclude linux-2.6.18-rc3/net/ipv4/udp.c linux-2.6.18-rc3-udp_mibs/net/ipv4/udp.c
--- linux-2.6.18-rc3/net/ipv4/udp.c	2006-07-31 10:19:01.000000000 -0700
+++ linux-2.6.18-rc3-udp_mibs/net/ipv4/udp.c	2006-08-09 15:23:31.000000000 -0700
@@ -661,6 +661,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:
@@ -980,6 +990,7 @@ static int udp_encap_rcv(struct sock * s
 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.
@@ -1026,7 +1037,10 @@ static int udp_queue_rcv_skb(struct sock
 		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;

                 reply	other threads:[~2006-08-09 22:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44DA6243.3040803@google.com \
    --to=mbligh@google.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox