From: Andi Kleen <andi@firstfloor.org>
To: Bill Fink <billfink@mindspring.com>
Cc: David Miller <davem@davemloft.net>,
andi@firstfloor.org, wangchen@cn.fujitsu.com,
herbert@gondor.apana.org.au, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter
Date: Tue, 20 Nov 2007 15:05:18 +0100 [thread overview]
Message-ID: <20071120140518.GA1502@one.firstfloor.org> (raw)
In-Reply-To: <20071120002945.91fafb2b.billfink@mindspring.com>
On Tue, Nov 20, 2007 at 12:29:45AM -0500, Bill Fink wrote:
> While I agree with your analysis that it could be worked around,
> who knows how all the various SNMP monitoring applications out there
> would interpret such an unusual event. I liked Stephen's suggestion
> of a deferred decrement that would insure the counter didn't ever
> run backwards. But the best approach seems to be just not to count
> it in the first place until tha application has actually received
> the packet, since as Herbert pointed out, that's what the RFC
> actually specifies for the meaning of the udpInDatagrams counter.
Together with another counter that counts "edge datagrams received"
that would be an excellent idea.
Here's a patch.
-Andi
---
Split UDP receive count into UdpInDatagrams and UdpInEarlyDatagrams
UdpInDatagrams can be confusing because it counts packets that
might be dropped later.
Move UdpInDatagrams into recvmsg() as allowed by the RFC.
Add a new UdpInEarlyDatagrams counter to count datagrams received early,
but which might be dropped later
Signed-off-by: Andi Kleen <ak@suse.de>
Index: linux-2.6.24-rc1-hack/include/linux/snmp.h
===================================================================
--- linux-2.6.24-rc1-hack.orig/include/linux/snmp.h
+++ linux-2.6.24-rc1-hack/include/linux/snmp.h
@@ -138,6 +138,7 @@ enum
UDP_MIB_OUTDATAGRAMS, /* OutDatagrams */
UDP_MIB_RCVBUFERRORS, /* RcvbufErrors */
UDP_MIB_SNDBUFERRORS, /* SndbufErrors */
+ UDP_MIB_INEARLYDATAGRAMS, /* Early Datagrams Received */
__UDP_MIB_MAX
};
Index: linux-2.6.24-rc1-hack/net/ipv4/udp.c
===================================================================
--- linux-2.6.24-rc1-hack.orig/net/ipv4/udp.c
+++ linux-2.6.24-rc1-hack/net/ipv4/udp.c
@@ -873,6 +873,8 @@ try_again:
if (err)
goto out_free;
+ UDP_INC_STATS_USER(UDP_MIB_INDATAGRAMS, is_udplite);
+
sock_recv_timestamp(msg, sk, skb);
/* Copy the address. */
@@ -967,7 +969,8 @@ int udp_queue_rcv_skb(struct sock * sk,
ret = (*up->encap_rcv)(sk, skb);
if (ret <= 0) {
- UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, up->pcflag);
+ UDP_INC_STATS_BH(UDP_MIB_INEARLYDATAGRAMS,
+ up->pcflag);
return -ret;
}
}
@@ -1023,7 +1026,7 @@ int udp_queue_rcv_skb(struct sock * sk,
goto drop;
}
- UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS, up->pcflag);
+ UDP_INC_STATS_BH(UDP_MIB_INEARLYDATAGRAMS, up->pcflag);
return 0;
drop:
Index: linux-2.6.24-rc1-hack/net/ipv4/proc.c
===================================================================
--- linux-2.6.24-rc1-hack.orig/net/ipv4/proc.c
+++ linux-2.6.24-rc1-hack/net/ipv4/proc.c
@@ -173,6 +173,7 @@ static const struct snmp_mib snmp4_udp_l
SNMP_MIB_ITEM("OutDatagrams", UDP_MIB_OUTDATAGRAMS),
SNMP_MIB_ITEM("RcvbufErrors", UDP_MIB_RCVBUFERRORS),
SNMP_MIB_ITEM("SndbufErrors", UDP_MIB_SNDBUFERRORS),
+ SNMP_MIB_ITEM("InEarlyDatagrams", UDP_MIB_INEARLYDATAGRAMS),
SNMP_MIB_SENTINEL
};
next prev parent reply other threads:[~2007-11-20 14:05 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-16 2:46 [PATCH 1/2] [IPV4] UDP: Always checksum even if without socket filter Wang Chen
2007-11-16 2:54 ` David Miller
2007-11-16 3:18 ` Wang Chen
2007-11-16 4:04 ` David Miller
2007-11-16 4:13 ` Wang Chen
2007-11-16 17:02 ` Benny Amorsen
2007-11-16 4:11 ` Herbert Xu
2007-11-16 4:17 ` Wang Chen
2007-11-17 13:18 ` Andi Kleen
2007-11-18 0:09 ` David Miller
2007-11-18 21:45 ` Andi Kleen
2007-11-18 22:40 ` David Miller
2007-11-19 1:09 ` Herbert Xu
2007-11-19 8:26 ` David Miller
2007-11-19 2:02 ` Wang Chen
2007-11-19 8:30 ` David Miller
2007-11-19 4:41 ` Herbert Xu
2007-11-19 8:32 ` David Miller
2007-11-19 11:49 ` Arnaldo Carvalho de Melo
2007-11-19 15:29 ` Andi Kleen
2007-11-19 22:23 ` David Miller
2007-11-20 5:29 ` Bill Fink
2007-11-20 6:15 ` David Miller
2007-11-20 6:25 ` Wang Chen
2007-11-20 6:31 ` Herbert Xu
2007-11-20 14:05 ` Andi Kleen [this message]
2007-11-21 1:39 ` David Miller
2007-11-29 7:55 ` Wang Chen
2007-11-29 9:21 ` Herbert Xu
2007-11-29 10:08 ` Wang Chen
2007-11-29 10:21 ` Herbert Xu
2007-11-29 10:33 ` Wang Chen
2007-11-29 10:38 ` Herbert Xu
2007-11-29 10:56 ` Gerrit Renker
2007-11-29 12:01 ` Herbert Xu
2007-11-18 22:14 ` Stephen Hemminger
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=20071120140518.GA1502@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=billfink@mindspring.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=wangchen@cn.fujitsu.com \
/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;
as well as URLs for NNTP newsgroup(s).