From nobody@FreeBSD.org  Sun Jan 27 19:46:37 2008
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 2AB0216A417
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 27 Jan 2008 19:46:37 +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 140EE13C455
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 27 Jan 2008 19:46:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m0RJisLr075039
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 27 Jan 2008 19:44:54 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m0RJis1c075038;
	Sun, 27 Jan 2008 19:44:54 GMT
	(envelope-from nobody)
Message-Id: <200801271944.m0RJis1c075038@www.freebsd.org>
Date: Sun, 27 Jan 2008 19:44:54 GMT
From: Ermal Lui <eri@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Allow propper settings of ALTQ_HFSC. The check i wrong since even with the values forbidden from this check you get a concave curve.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         120057
>Category:       kern
>Synopsis:       [pf] [patch] Allow proper settings of ALTQ_HFSC. The check i wrong since even with the values forbidden from this check you get a concave curve.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-pf
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 27 19:50:00 UTC 2008
>Closed-Date:    
>Last-Modified:  Tue Jan 29 21:20:02 UTC 2008
>Originator:     Ermal Lui
>Release:        HEAD
>Organization:
>Environment:
FreeBSD  8.0-CURRENT FreeBSD 8.0-CURRENT #2: Mon Dec 17 22:57:03 CET 2007     root@:/usr/obj/usr/home/eri/development/compile/src/sys/GENERIC  amd64

>Description:
The authors of PF mistankely have inserted this patch which doesn't
allow propper configuration of ALTQ_HFSC. With these parameters you can
get a concave curve!

Even if you read the paper dedicated to HFSC on acm.org you will see that
the original author used a curve prohibitted by authors of PF.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: pfctl_altq.c
===================================================================
RCS file: /home/eri/FreeBSD/src/contrib/pf/pfctl/pfctl_altq.c,v
retrieving revision 1.9
diff -u -r1.9 pfctl_altq.c
--- pfctl_altq.c	3 Jul 2007 12:30:02 -0000	1.9
+++ pfctl_altq.c	27 Jan 2008 19:41:11 -0000
@@ -690,13 +690,6 @@
 		return (-1);
 	}
 
-	if ((opts->rtsc_m1 < opts->rtsc_m2 && opts->rtsc_m1 != 0) ||
-	    (opts->lssc_m1 < opts->lssc_m2 && opts->lssc_m1 != 0) ||
-	    (opts->ulsc_m1 < opts->ulsc_m2 && opts->ulsc_m1 != 0)) {
-		warnx("m1 must be zero for convex curve: %s", pa->qname);
-		return (-1);
-	}
-
 	/*
 	 * admission control:
 	 * for the real-time service curve, the sum of the service curves


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-pf 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Jan 27 23:53:31 UTC 2008 
Responsible-Changed-Why:  
Over to maintainer(s). 

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

From: Max Laier <max@love2party.net>
To: bug-followup@freebsd.org,
 eri@freebsd.org
Cc:  
Subject: Re: kern/120057: [patch] Allow proper settings of ALTQ_HFSC. The check i wrong since even with the values forbidden from this check you get a concave curve.
Date: Mon, 28 Jan 2008 19:45:01 +0100

 http://www.cs.cmu.edu/~hzhang/HFSC/main.html agrees with the pfctl 
 restrictions.  Can you give an example that is restricted by this check 
 and shouldn't be?
 
 - Max

From: "=?ISO-8859-1?Q?Ermal_Lu=E7i?=" <ermal.luci@gmail.com>
To: "Max Laier" <max@love2party.net>
Cc: bug-followup@freebsd.org, eri@freebsd.org
Subject: Re: kern/120057: [patch] Allow proper settings of ALTQ_HFSC. The check i wrong since even with the values forbidden from this check you get a concave curve.
Date: Mon, 28 Jan 2008 21:13:41 +0100

 Also not that the link you gave me, has the note:
 <snip>
 In order to decouple delay and bandwidth allocation, HFSC is designed
 based on the service curve service model. In HFSC, only two-piece
 linear service curves are used for simplicity. A two-piece linear
 service curve is characterized by three parameters:
 
     * m1, the slope of the first segment
     * m2, the slope of the second segment
     * d, the x-projection of the intersection point of the two segments
 
 The following figure illustrates the two types of two-piece linear
 service curves used in HFSC. For a convex curve (when m1 is less than
 m2), m1 is always zero.
 </snip>
 
 But beware, that

From: "=?ISO-8859-1?Q?Ermal_Lu=E7i?=" <ermal.luci@gmail.com>
To: "Max Laier" <max@love2party.net>
Cc: bug-followup@freebsd.org, eri@freebsd.org
Subject: Re: kern/120057: [patch] Allow proper settings of ALTQ_HFSC. The check i wrong since even with the values forbidden from this check you get a concave curve.
Date: Mon, 28 Jan 2008 21:03:39 +0100

 http://www.sigcomm.org/sigcomm97/papers/p011.pdf
 If you look at the paper on the link i gave here and i copied a
 snippet from page 11:
 <snippet>
 To demonstrate H-FSC's ability to ensure low delay for
 real-time connections, we target for a 5 ms delay for the
 audio session, and a 10 ms delay for the video session. To
 achieve these objectives, we assign to the audio session the
 service curve Sa = (umax
 a = 160 bytes; dmax
 a = 5 ms; ra =
 64 Kbps), and to the video session the service curve Sv =
 (umax
 v = 8 KB; dmax
 v = 10 ms; rv = 2 Mbps). Also, in order
 to pass the admission control test, we assign to the FTP
 session the service curve SFTP = (umax
 FTP = 4 KB; dmax
 FTP =
 16.25 ms; rFTP = 5 Mbps). The service curves of all the
 other sessions and classes are linear
 </snippet>
 
 And the paper specifically states that ALTQ_HFSC implementation
 doesn't allow for convex curve with a m1 parameter of 0.
 Furthermore, the check is wrong since the second curve starting point
 is not (0, 0) but the point where the first curve ends, with x = d and
 y = conversion of m1. So the resultant curve is concave.
 
 Sorry the bug follow up was not complete first time, but was tired
 when reported.
 
 P.S. There is another check actually, but that can be part of another
 PR, which does not allow setting only the realtime parameter and so
 forbids making altq non work conserving and being used in admission
 mode. always if you cipole it with a daemon that makes the propper
 changes in time.

From: "=?ISO-8859-1?Q?Ermal_Lu=E7i?=" <ermal.luci@gmail.com>
To: "Max Laier" <max@love2party.net>
Cc: bug-followup@freebsd.org, eri@freebsd.org
Subject: Re: kern/120057: [patch] Allow proper settings of ALTQ_HFSC. The check i wrong since even with the values forbidden from this check you get a concave curve.
Date: Tue, 29 Jan 2008 22:11:32 +0100

 Following up, since i noticed that the mail was truncated.
 
 Also not that the link you gave me, has the note:
 <snip>
 In order to decouple delay and bandwidth allocation, HFSC is designed
 based on the service curve service model. In HFSC, only two-piece
 linear service curves are used for simplicity. A two-piece linear
 service curve is characterized by three parameters:
 
    * m1, the slope of the first segment
    * m2, the slope of the second segment
    * d, the x-projection of the intersection point of the two segments
 
 The following figure illustrates the two types of two-piece linear
 service curves used in HFSC. For a convex curve (when m1 is less than
 m2), m1 is always zero.
 </snip>
 
 But beware, that m1 here is in slope terms while m1 parameter of
 service curves is not a slope! It is bytes per tick.
 To check if a curve is concave, in the paper there is a proper formula
 but needs some info that is not available at configuration time. But
 as i said you cannot really configure a convex service curve.
>Unformatted:
