netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/1]SNMPv2 "ipv6IfStatsOutFragCreates" counter error
@ 2006-07-31  9:23 weidong
  2006-07-31  9:43 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 3+ messages in thread
From: weidong @ 2006-07-31  9:23 UTC (permalink / raw)
  To: netdev, davem

Hi, All
  When I tested linux kernel 2.6.71.7 about statistics
"ipv6IfStatsOutFragCreates", and found that it couldn't increase
correctly. The criteria is RFC 2465:

  ipv6IfStatsOutFragCreates OBJECT-TYPE
      SYNTAX      Counter32
      MAX-ACCESS  read-only
      STATUS      current
      DESCRIPTION
         "The number of output datagram fragments that have
         been generated as a result of fragmentation at
         this output interface."
      ::= { ipv6IfStatsEntry 15 }

I think there are two issues in Linux kernel. 
1st:
RFC2465 specifies the counter is "The number of output datagram
fragments...". I think increasing this counter after output a fragment
successfully is better. And it should not be increased even though a
fragment is created but failed to output.

2nd:
If we send a big ICMP/ICMPv6 echo request to a host, and receive
ICMP/ICMPv6 echo reply consisted of some fragments. As we know that in
Linux kernel first fragmentation occurs in ICMP layer(maybe saying
transport layer is better), but this is not the "real"
fragmentation,just do some "pre-fragment" -- allocate space for date,
and form a frag_list, etc. The "real" fragmentation happens in IP layer
-- set offset and MF flag and so on. So I think in "fast path" for
ip_fragment/ip6_fragment, if we send a fragment which "pre-fragment" by
upper layer we should also increase "ipv6IfStatsOutFragCreates".

The following is the patch for the issues mentioned above:

diff -ruN old/net/ipv4/ip_output.c new/net/ipv4/ip_output.c
--- old/net/ipv4/ip_output.c	2006-07-25 11:36:01.000000000 +0800
+++ new/net/ipv4/ip_output.c	2006-07-31 16:24:57.000000000 +0800
@@ -527,6 +527,8 @@
 
 			err = output(skb);
 
+			if (!err)
+				IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
 			if (err || !frag)
 				break;
 
@@ -650,9 +652,6 @@
 		/*
 		 *	Put this fragment into the sending queue.
 		 */
-
-		IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
-
 		iph->tot_len = htons(len + hlen);
 
 		ip_send_check(iph);
@@ -660,6 +659,8 @@
 		err = output(skb2);
 		if (err)
 			goto fail;
+
+		IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
 	}
 	kfree_skb(skb);
 	IP_INC_STATS(IPSTATS_MIB_FRAGOKS);
diff -ruN old/net/ipv6/ip6_output.c new/net/ipv6/ip6_output.c
--- old/net/ipv6/ip6_output.c	2006-07-25 11:36:01.000000000 +0800
+++ new/net/ipv6/ip6_output.c	2006-07-31 16:24:21.000000000 +0800
@@ -593,6 +593,9 @@
 			}
 			
 			err = output(skb);
+			if(!err)
+				IP6_INC_STATS(IPSTATS_MIB_FRAGCREATES);
+	
 			if (err || !frag)
 				break;
 
@@ -704,12 +707,11 @@
 		/*
 		 *	Put this fragment into the sending queue.
 		 */
-
-		IP6_INC_STATS(IPSTATS_MIB_FRAGCREATES);
-
 		err = output(frag);
 		if (err)
 			goto fail;
+
+		IP6_INC_STATS(IPSTATS_MIB_FRAGCREATES);
 	}
 	kfree_skb(skb);
 	IP6_INC_STATS(IPSTATS_MIB_FRAGOKS);

signed-off-by: Wei Dong <weid@nanjing-fnst.com>
Regards
Wei Dong


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 1/1]SNMPv2 "ipv6IfStatsOutFragCreates" counter error
  2006-07-31  9:23 [patch 1/1]SNMPv2 "ipv6IfStatsOutFragCreates" counter error weidong
@ 2006-07-31  9:43 ` YOSHIFUJI Hideaki / 吉藤英明
  2006-08-02 20:42   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2006-07-31  9:43 UTC (permalink / raw)
  To: weid; +Cc: netdev, davem, yoshfuji

Hello.

The patch seems sane to me.

In article <1154425539.3329.3.camel@LINE> (at Tue, 01 Aug 2006 05:45:39 -0400), weidong <weid@nanjing-fnst.com> says:

> signed-off-by: Wei Dong <weid@nanjing-fnst.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

--yoshfuji

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 1/1]SNMPv2 "ipv6IfStatsOutFragCreates" counter error
  2006-07-31  9:43 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2006-08-02 20:42   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2006-08-02 20:42 UTC (permalink / raw)
  To: yoshfuji; +Cc: weid, netdev

From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Date: Mon, 31 Jul 2006 18:43:14 +0900 (JST)

> The patch seems sane to me.
> 
> In article <1154425539.3329.3.camel@LINE> (at Tue, 01 Aug 2006 05:45:39 -0400), weidong <weid@nanjing-fnst.com> says:
> 
> > signed-off-by: Wei Dong <weid@nanjing-fnst.com>
> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Also applied, thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-02 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31  9:23 [patch 1/1]SNMPv2 "ipv6IfStatsOutFragCreates" counter error weidong
2006-07-31  9:43 ` YOSHIFUJI Hideaki / 吉藤英明
2006-08-02 20:42   ` David Miller

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).