From nobody@FreeBSD.org  Mon May 31 14:11:29 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE75D106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 May 2010 14:11:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id A46238FC1E
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 May 2010 14:11:29 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o4VEBShj099219
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 31 May 2010 14:11:28 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o4VEBS6d099218;
	Mon, 31 May 2010 14:11:28 GMT
	(envelope-from nobody)
Message-Id: <201005311411.o4VEBS6d099218@www.freebsd.org>
Date: Mon, 31 May 2010 14:11:28 GMT
From: napTu <napTu@front.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: dummynet skip traffic over configured limit with net.inet.ip.dummynet.io_fast:1
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         147245
>Category:       kern
>Synopsis:       [dummynet] dummynet skip traffic over configured limit with net.inet.ip.dummynet.io_fast:1
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    luigi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 31 14:20:04 UTC 2010
>Closed-Date:    Tue Dec 28 12:23:12 UTC 2010
>Last-Modified:  Tue Dec 28 12:23:12 UTC 2010
>Originator:     napTu
>Release:        8.0
>Organization:
icene
>Environment:
FreeBSD router5 8.0-STABLE FreeBSD 8.0-STABLE #1: Fri May  7 02:03:26 UTC 2010     root@:/buildscripts/frenzybuild/build/buildscripts/frenzybuild/src/sys/FRENZY  i386
>Description:
My example pipe configuration is:

# ipfw pipe 45795 show
45795:  11.992 Mbit/s    0 ms burst 0
q176867  50 sl. 0 flows (1 buckets) sched 111331 weight 0 lmax 0 pri 0 droptail
 sched 111331 type FIFO flags 0x0 0 buckets 0 active

# ipfw list 28795
28795 pipe 45795 ip from not 192.168.0.0/16,10.0.0.0/8,172.0.0.0/8 to 192.168.9.33 out via em0

# ipfw list 30019 
30019 allow ip from any to 192.168.9.33 out via em0

net.inet.ip.fw.one_pass: 0
net.inet.ip.dummynet.io_fast:1


I detect two variants when traffic is greater that limit on the pipe.

1. when pipe speed is greater 11.999Mbit/s, for example when bw is 12.000Mbit/s, no traffic limit happen.

2. when traffic is udp and goes to one port and one ip from multiple sources.
trafshow output:
Source                          Destination                     Protocol     Size         CPS
&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;
95.215.165.200,62844            192.168.8.13,43546              udp          23607K       2194K
109.87.126.156,55629            192.168.8.13,43546              udp          10873K       1138K
85.198.145.111,32100            192.168.8.13,43546              udp          767K         32K
78-137-18-109.dynamic-ppp,15833 192.168.8.13,43546              udp          667K         47K

pipe config is

28521 pipe 45521 ip from not 192.168.0.0/16,10.0.0.0/8,172.0.0.0/8 to 192.168.8.13 out via em0
32349 allow ip from any to 192.168.8.13 out via em0

45521:  11.992 Mbit/s    0 ms burst 0
q176593  50 sl. 0 flows (1 buckets) sched 111057 weight 0 lmax 0 pri 0 droptail
 sched 111057 type FIFO flags 0x0 0 buckets 0 active



>How-To-Repeat:
as descibed in full description
>Fix:
set net.inet.ip.dummynet.io_fast to 0


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Jun 7 05:02:14 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147245 

Date: Wed, 11 Aug 2010 00:10:27 +0400
From: naPtu 3ah <naptu@mail.ru>
Reply-To: naPtu 3ah <naptu@mail.ru>
To: bug-followup@FreeBSD.org,
	napTu@front.ru
Subject: Re: kern/147245: [dummynet] dummynet skip traffic over configured limit with net.inet.ip.dummynet.io_fast:1

 maximum shaping value can be increased to 24Mbit/s with kernel option HZ=2000...
 some calculations:
 12000Kbit/s, HZ=1000, one tick=1/1000sec , 12000/1000 = 12Kbit per tick = 1500Bytes per tick = max packet length
Responsible-Changed-From-To: freebsd-net->oleg 
Responsible-Changed-By: oleg 
Responsible-Changed-When: Tue Aug 17 17:05:24 UTC 2010 
Responsible-Changed-Why:  
i'll look at it. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=147245 
Responsible-Changed-From-To: oleg->luigi 
Responsible-Changed-By: oleg 
Responsible-Changed-When: Thu Aug 19 16:46:20 UTC 2010 
Responsible-Changed-Why:  
Luigi asked for that. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=147245 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/147245: commit references a PR
Date: Wed, 29 Sep 2010 09:22:23 +0000 (UTC)

 Author: luigi
 Date: Wed Sep 29 09:22:12 2010
 New Revision: 213265
 URL: http://svn.freebsd.org/changeset/base/213265
 
 Log:
   fix handling of initial credit for an idle pipe.
   This fixes the bug where setting bw > 1 MTU/tick resulted in
   infinite bandwidth if io_fast=1
   
   PR:		147245 148429
   Obtained from:	Riccardo Panicucci
   MFC after:	3 days
 
 Modified:
   head/sys/netinet/ipfw/ip_dn_io.c
 
 Modified: head/sys/netinet/ipfw/ip_dn_io.c
 ==============================================================================
 --- head/sys/netinet/ipfw/ip_dn_io.c	Wed Sep 29 09:20:18 2010	(r213264)
 +++ head/sys/netinet/ipfw/ip_dn_io.c	Wed Sep 29 09:22:12 2010	(r213265)
 @@ -752,8 +752,11 @@ dummynet_io(struct mbuf **m0, int dir, s
  	}
  
  	/* compute the initial allowance */
 -	{
 +	if (si->idle_time < dn_cfg.curr_time) {
 +	    /* Do this only on the first packet on an idle pipe */
  	    struct dn_link *p = &fs->sched->link;
 +
 +	    si->sched_time = dn_cfg.curr_time;
  	    si->credit = dn_cfg.io_fast ? p->bandwidth : 0;
  	    if (p->burst) {
  		uint64_t burst = (dn_cfg.curr_time - si->idle_time) * p->bandwidth;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/147245: commit references a PR
Date: Tue, 28 Dec 2010 11:35:14 +0000 (UTC)

 Author: oleg
 Date: Tue Dec 28 11:34:59 2010
 New Revision: 216757
 URL: http://svn.freebsd.org/changeset/base/216757
 
 Log:
   MFC r213265:
   
   Fix handling of initial credit for an idle pipe.  This fixes the bug where
   setting bw > 1 MTU/tick resulted in infinite bandwidth if io_fast=1
   
   PR:		kern/147245, kern/148429
   Obtained from:	Riccardo Panicucci
 
 Modified:
   stable/8/sys/netinet/ipfw/ip_dn_io.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/netinet/ipfw/ip_dn_io.c
 ==============================================================================
 --- stable/8/sys/netinet/ipfw/ip_dn_io.c	Tue Dec 28 10:08:50 2010	(r216756)
 +++ stable/8/sys/netinet/ipfw/ip_dn_io.c	Tue Dec 28 11:34:59 2010	(r216757)
 @@ -742,8 +742,11 @@ dummynet_io(struct mbuf **m0, int dir, s
  	}
  
  	/* compute the initial allowance */
 -	{
 +	if (si->idle_time < dn_cfg.curr_time) {
 +	    /* Do this only on the first packet on an idle pipe */
  	    struct dn_link *p = &fs->sched->link;
 +
 +	    si->sched_time = dn_cfg.curr_time;
  	    si->credit = dn_cfg.io_fast ? p->bandwidth : 0;
  	    if (p->burst) {
  		uint64_t burst = (dn_cfg.curr_time - si->idle_time) * p->bandwidth;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/147245: commit references a PR
Date: Tue, 28 Dec 2010 12:18:54 +0000 (UTC)

 Author: oleg
 Date: Tue Dec 28 12:18:46 2010
 New Revision: 216759
 URL: http://svn.freebsd.org/changeset/base/216759
 
 Log:
   MFC r213265:
   
   Fix handling of initial credit for an idle pipe.  This fixes the bug where
   setting bw > 1 MTU/tick resulted in infinite bandwidth if io_fast=1
   
   PR:		kern/147245, kern/148429
   Obtained from:	Riccardo Panicucci
   Approved by:	re (bz)
 
 Modified:
   releng/8.2/sys/netinet/ipfw/ip_dn_io.c
 Directory Properties:
   releng/8.2/sys/   (props changed)
   releng/8.2/sys/amd64/include/xen/   (props changed)
   releng/8.2/sys/cddl/contrib/opensolaris/   (props changed)
   releng/8.2/sys/contrib/dev/acpica/   (props changed)
   releng/8.2/sys/contrib/pf/   (props changed)
 
 Modified: releng/8.2/sys/netinet/ipfw/ip_dn_io.c
 ==============================================================================
 --- releng/8.2/sys/netinet/ipfw/ip_dn_io.c	Tue Dec 28 12:13:30 2010	(r216758)
 +++ releng/8.2/sys/netinet/ipfw/ip_dn_io.c	Tue Dec 28 12:18:46 2010	(r216759)
 @@ -742,8 +742,11 @@ dummynet_io(struct mbuf **m0, int dir, s
  	}
  
  	/* compute the initial allowance */
 -	{
 +	if (si->idle_time < dn_cfg.curr_time) {
 +	    /* Do this only on the first packet on an idle pipe */
  	    struct dn_link *p = &fs->sched->link;
 +
 +	    si->sched_time = dn_cfg.curr_time;
  	    si->credit = dn_cfg.io_fast ? p->bandwidth : 0;
  	    if (p->burst) {
  		uint64_t burst = (dn_cfg.curr_time - si->idle_time) * p->bandwidth;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: oleg 
State-Changed-When: Tue Dec 28 12:22:47 UTC 2010 
State-Changed-Why:  
Patch commited to RELENG_8 & RELENG_8_2. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=147245 
>Unformatted:
