From nobody@FreeBSD.org  Thu May  5 21:47:26 2011
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 5D1BC1065672
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 May 2011 21:47:26 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 4C42E8FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 May 2011 21:47:26 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p45LlQ7m012112
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 5 May 2011 21:47:26 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p45LlQoA012111;
	Thu, 5 May 2011 21:47:26 GMT
	(envelope-from nobody)
Message-Id: <201105052147.p45LlQoA012111@red.freebsd.org>
Date: Thu, 5 May 2011 21:47:26 GMT
From: Ji Li <lijimlee@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: "ipfw pipe show" shows wrong dummynet pipe delay when hz is not 1000
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         156838
>Category:       bin
>Synopsis:       [dummynet] ipfw(8): "ipfw pipe show" shows wrong dummynet pipe delay when hz is not 1000
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ipfw
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 05 21:50:09 UTC 2011
>Closed-Date:    Fri May 13 09:52:51 UTC 2011
>Last-Modified:  Fri May 13 10:00:19 UTC 2011
>Originator:     Ji Li
>Release:        8.2 Rel, 8 stable and head
>Organization:
>Environment:
FreeBSD example.example.com 8.2-STABLE FreeBSD 8.2-STABLE #0 r221483: Thu May  5 07:19:30 PDT 2011     example@example.example.com:/usr/home/example/src/freebsd-8-stable/sys/amd64/compile/GENERIC  amd64

>Description:
When one uses "ipfw pipe config" to configure delay for a dummynet pipe,
dummynet translates the delay (in ms) to ticks and saves it in its data
structure. When one uses "ipfw pipe show" expects the delay shown in ms,
dummynet however returns the delay in ticks. When kern.hz is 1000, it is
fine, but if hz is not 1000, the delay shown is confusing. 

The problem may exist since 8.1 rel. I checked 7.2 rel and 8.0 rel,
dummynet does convert delay back to ms, but that conversion seems missing
since dummyent was re-written.
>How-To-Repeat:
1. On FreeBSD 8.2 or 8 stable, set "kern.hz=100" in /boot/loader.conf. 
2. Load ipfw.ko and dummynet.ko
3. Then create a pipe and config the delay to 100, then run "ipfw pipe show",
   you will see the delay shown is "10 ms", but actual pipe delay is 100ms.
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-ipfw 
Responsible-Changed-By: ae 
Responsible-Changed-When: Fri May 6 07:05:52 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=156838 
State-Changed-From-To: open->patched 
State-Changed-By: ae 
State-Changed-When: Fri May 6 07:14:05 UTC 2011 
State-Changed-Why:  
Fixed in head/. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/156838: commit references a PR
Date: Fri,  6 May 2011 07:13:43 +0000 (UTC)

 Author: ae
 Date: Fri May  6 07:13:34 2011
 New Revision: 221521
 URL: http://svn.freebsd.org/changeset/base/221521
 
 Log:
   Convert delay parameter back to ms when reporting to user.
   
   PR:		156838
   MFC after:	1 week
 
 Modified:
   head/sys/netinet/ipfw/ip_dn_glue.c
   head/sys/netinet/ipfw/ip_dummynet.c
 
 Modified: head/sys/netinet/ipfw/ip_dn_glue.c
 ==============================================================================
 --- head/sys/netinet/ipfw/ip_dn_glue.c	Fri May  6 03:44:49 2011	(r221520)
 +++ head/sys/netinet/ipfw/ip_dn_glue.c	Fri May  6 07:13:34 2011	(r221521)
 @@ -624,7 +624,7 @@ dn_c_copy_pipe(struct dn_schk *s, struct
  	/* These 4 field are the same in pipe7 and pipe8 */
  	pipe7->next.sle_next = (struct dn_pipe7 *)DN_IS_PIPE;
  	pipe7->bandwidth = l->bandwidth;
 -	pipe7->delay = l->delay;
 +	pipe7->delay = l->delay * 1000 / hz;
  	pipe7->pipe_nr = l->link_nr - DN_MAX_ID;
  
  	if (!is7) {
 
 Modified: head/sys/netinet/ipfw/ip_dummynet.c
 ==============================================================================
 --- head/sys/netinet/ipfw/ip_dummynet.c	Fri May  6 03:44:49 2011	(r221520)
 +++ head/sys/netinet/ipfw/ip_dummynet.c	Fri May  6 07:13:34 2011	(r221521)
 @@ -808,6 +808,7 @@ copy_obj(char **start, char *end, void *
  		/* Adjust burst parameter for link */
  		struct dn_link *l = (struct dn_link *)*start;
  		l->burst =  div64(l->burst, 8 * hz);
 +		l->delay = l->delay * 1000 / hz;
  	} else if (o->type == DN_SCH) {
  		/* Set id->id to the number of instances */
  		struct dn_schk *s = _o;
 _______________________________________________
 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: patched->closed 
State-Changed-By: ae 
State-Changed-When: Fri May 13 09:52:22 UTC 2011 
State-Changed-Why:  
Merged to stable/8. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/156838: commit references a PR
Date: Fri, 13 May 2011 09:52:18 +0000 (UTC)

 Author: ae
 Date: Fri May 13 09:52:04 2011
 New Revision: 221831
 URL: http://svn.freebsd.org/changeset/base/221831
 
 Log:
   MFC r221521:
     Convert delay parameter back to ms when reporting to user.
   
     PR:		156838
 
 Modified:
   stable/8/sys/netinet/ipfw/ip_dn_glue.c
   stable/8/sys/netinet/ipfw/ip_dummynet.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_glue.c
 ==============================================================================
 --- stable/8/sys/netinet/ipfw/ip_dn_glue.c	Fri May 13 07:21:41 2011	(r221830)
 +++ stable/8/sys/netinet/ipfw/ip_dn_glue.c	Fri May 13 09:52:04 2011	(r221831)
 @@ -624,7 +624,7 @@ dn_c_copy_pipe(struct dn_schk *s, struct
  	/* These 4 field are the same in pipe7 and pipe8 */
  	pipe7->next.sle_next = (struct dn_pipe7 *)DN_IS_PIPE;
  	pipe7->bandwidth = l->bandwidth;
 -	pipe7->delay = l->delay;
 +	pipe7->delay = l->delay * 1000 / hz;
  	pipe7->pipe_nr = l->link_nr - DN_MAX_ID;
  
  	if (!is7) {
 
 Modified: stable/8/sys/netinet/ipfw/ip_dummynet.c
 ==============================================================================
 --- stable/8/sys/netinet/ipfw/ip_dummynet.c	Fri May 13 07:21:41 2011	(r221830)
 +++ stable/8/sys/netinet/ipfw/ip_dummynet.c	Fri May 13 09:52:04 2011	(r221831)
 @@ -807,6 +807,7 @@ copy_obj(char **start, char *end, void *
  		/* Adjust burst parameter for link */
  		struct dn_link *l = (struct dn_link *)*start;
  		l->burst =  div64(l->burst, 8 * hz);
 +		l->delay = l->delay * 1000 / hz;
  	} else if (o->type == DN_SCH) {
  		/* Set id->id to the number of instances */
  		struct dn_schk *s = _o;
 _______________________________________________
 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"
 
>Unformatted:
