From owner-freebsd-pf@FreeBSD.ORG Thu Jul 7 13:28:01 2011 Return-Path: Delivered-To: freebsd-pf@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9ACA81065670 for ; Thu, 7 Jul 2011 13:28:01 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 66A648FC12 for ; Thu, 7 Jul 2011 13:28:01 +0000 (UTC) Received: by iyb11 with SMTP id 11so1132069iyb.13 for ; Thu, 07 Jul 2011 06:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=0mas8WJhQgjOcoerWAzicb9BFcYSDHOmKdrDP4Y0bw8=; b=R8TN9oItZOJHD4XyiKCU3E2tQsl5wHzCDxo6V/M+fIDf80szcK3diAUfR5NNnD+AFN R6+dI2lpPPqOGVVbzh453T5OA2X0jIlJ6funhx3uJ2vuzTaxSX3+2zE7z8tdGOXGqlRE YufJx6VJCwVORTUPg4Y3uMdpS8EdZzs9mDAIE= MIME-Version: 1.0 Received: by 10.231.200.20 with SMTP id eu20mr742347ibb.24.1310045280165; Thu, 07 Jul 2011 06:28:00 -0700 (PDT) Sender: ermal.luci@gmail.com Received: by 10.231.171.148 with HTTP; Thu, 7 Jul 2011 06:28:00 -0700 (PDT) In-Reply-To: <20110706152506.GA26334@calomel.org> References: <20110706152506.GA26334@calomel.org> Date: Thu, 7 Jul 2011 15:28:00 +0200 X-Google-Sender-Auth: SLPpiH2eiK7qBoetAVJDcsPdfwo Message-ID: From: =?ISO-8859-1?Q?Ermal_Lu=E7i?= To: Calomel Org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: misc@openbsd.org, freebsd-pf@freebsd.org Subject: Re: pf ALTQ bandwidth limited to a 32bit value (4294Mb) X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2011 13:28:01 -0000 On Wed, Jul 6, 2011 at 5:25 PM, Calomel Org wrote: > ALTQ using hfsc is limited to a maximum parent bandwidth of 4294Mb. > This value is 2^32 or 4,294,967,296 bits. If you set the bandwidth any > higher, altq will flip back to zero. This "bug" was found when trying > to test 10 gigabit and 40 gigabit bandwidth models. These tests were > done on OpenBSD 32bit and 64bit as well as FreeBSD 32bit and 64bit. > > If anyone else can verify this independently and agree with the > results I would be happy to register it as a bug. > > > How to replicate: > > A quick test is setting the bandwidth to 4294Mb and doing a pfctl -sq > to check altq. > > =A0altq on $ExtIf bandwidth 4294Mb hfsc queue { ack, web} > =A0queue root_em0 on em0 bandwidth 4.29Gb priority 0 {ack, web} > > Now set the bandwidth to 4295Mb and notice altq has flip to zero and > add the 32.70Kb difference. > > =A0altq on $ExtIf bandwidth 4295Mb hfsc queue { ack, web } > =A0queue root_em0 on em0 bandwidth 32.70Kb priority 0 {ack, web} > > Again, we can set the bandwidth to a multiple of two(2) to 8589Mb. > The bandwidth value flips to zero once and the result is 4.29Gb. > > =A0altq on $ExtIf bandwidth 8589Mb hfsc queue { ack, web} > =A0queue root_em0 on em0 bandwidth 4.29Gb priority 0 {ack, web} > > If we add one more megabit to 8590Mb the value flips twice and we are > left with 65.41Kb. > > =A0altq on $ExtIf bandwidth 8590Mb hfsc queue { ack, web} > =A0queue root_em0 on em0 bandwidth 65.41Kb priority 0 {ack, web} > It is true that there is a limit because of data type used. Though it cannot be fixed easily on i386 but on amd64 this should work. Index: sys/contrib/pf/net/pfvar.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/contrib/pf/net/pfvar.h (revision 223824) +++ sys/contrib/pf/net/pfvar.h (working copy) @@ -1491,13 +1491,13 @@ /* scheduler spec */ u_int8_t scheduler; /* scheduler type */ u_int16_t tbrsize; /* tokenbucket regulator si= ze */ - u_int32_t ifbandwidth; /* interface bandwidth */ + u_int64_t ifbandwidth; /* interface bandwidth */ /* queue spec */ char qname[PF_QNAME_SIZE]; /* queue name */ char parent[PF_QNAME_SIZE]; /* parent name */ u_int32_t parent_qid; /* parent queue id */ - u_int32_t bandwidth; /* queue bandwidth */ + u_int64_t bandwidth; /* queue bandwidth */ u_int8_t priority; /* priority */ #ifdef __FreeBSD__ u_int8_t local_flags; /* dynamic interface */ > > Thanks. > > -- > =A0 Calomel @ https://calomel.org > =A0 Open Source Research and Reference > _______________________________________________ > freebsd-pf@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-pf > To unsubscribe, send any mail to "freebsd-pf-unsubscribe@freebsd.org" > --=20 Ermal