Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jul 2011 15:28:00 +0200
From:      =?ISO-8859-1?Q?Ermal_Lu=E7i?= <eri@freebsd.org>
To:        Calomel Org <infallibilismindefeasibility@calomel.org>
Cc:        misc@openbsd.org, freebsd-pf@freebsd.org
Subject:   Re: pf ALTQ bandwidth limited to a 32bit value (4294Mb)
Message-ID:  <CAPBZQG1tp9HE7X06YqKGAJJw0y7kOxTgbGnYEQRCMEjCg=AOeQ@mail.gmail.com>
In-Reply-To: <20110706152506.GA26334@calomel.org>
References:  <20110706152506.GA26334@calomel.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jul 6, 2011 at 5:25 PM, Calomel Org
<infallibilismindefeasibility@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPBZQG1tp9HE7X06YqKGAJJw0y7kOxTgbGnYEQRCMEjCg=AOeQ>