You missed the point. I didn't do any testing. I just looked at the output of "pfctl -squeue" (correction: In the original post I wrote "pfctl -srules") and noticed that the assigned queue bandwidths reported by pfctl were in some cases much different than the specified queue bandwidth parameters in pf.conf. To put it another way, the readback of defined bandwidth does not match the definition.
>From observation it looks like specified bandwidths in pf.conf with 4 or more >digits followed by 'K' have the 3 LSD's dropped and 'K' changed to 'M' in the >output of "pfctl -squeue." Example: 1800K in pf.conf becomes 1M in the output >of "pfctl -squeue" -- a very significant difference. It remains to be determined whether the fault is in the setting of bandwidth by pf or in the reporting of bandwidth by pfctl. Actual tests with a simple queue, as you suggested, could determine whether pf is enforcing the correct bandwidth values. To make it easiest to see an error the optimum leaf queue max bandwidth to use is 1999K. Then see whether the measured bandwidth is ~2M or ~1M. When I have time I'll do a simple test. -------------------------------------------- On Sat, 5/13/17, Mike Belopuhov <m...@belopuhov.com> wrote: Subject: Re: pf queue definition: bandwidth resolution problem To: "Carl Mascott" <cmasc...@yahoo.com> Cc: misc@openbsd.org Date: Saturday, May 13, 2017, 12:02 PM On Tue, May 09, 2017 at 19:47 +0000, Carl Mascott wrote: > Intel Atom D2500 1.66GHz > OpenBSD i386 v6.1-stable > > I can't get pf to give me the queue bandwidths that I specify in pf.conf. > > pf.conf: > > queue rootq on $ext_if bandwidth 9M max 9M qlimit 100 > queue qdef parent rootq bandwidth 3650K default > queue qrtp parent rootq bandwidth 350K min 350K burst 700K for 200ms > queue qweb parent rootq bandwidth 4M > queue qpri parent rootq bandwidth 900K min 50K burst 1800K for 200ms > queue qdns parent rootq bandwidth 100K min 10K burst 200K for 1000ms > > output of pfctl -srules: > > queue rootq on bge0 bandwidth 9M, max 9M qlimit 100 > queue qdef parent rootq bandwidth 3M default qlimit 50 > queue qrtp parent rootq bandwidth 350K, min 350K burst 700K for 200ms qlimit 50 > queue qweb parent rootq bandwidth 4M qlimit 50 > queue qpri parent rootq bandwidth 900K, min 50K burst 1M for 200ms qlimit 50 > queue qdns parent rootq bandwidth 100K, min 10K burst 200K for 1000ms qlimit 50 > > Discrepancies in the above: > > defined actual > ---------- --------- > qdef BW 3650K 3M > qpri burst 1800K 1M > > It looks like for anything specified as abcdK the result is aM, i.e., for any bandwidth >= 1000K the resulting bandwidth is truncated (not rounded) to <msd>M, where <msd> = most significant digit. Any bandwidth < 1000K works correctly. > > Is this a bug, a misfeature, or a feature? > Thanks! > Borrowing is enabled by default, so it's hard to say what affects your test since you didn't specify how are you exactly testing this. Every queue in your setup can borrow up to 9M of bandwidth, preventing others from doing the same, especially since you're attempting to measure a 200ms burst. How are you exactly doing this? I suggest you create a simple isolated test where you have only the specified traffic, e.g. generated with tcpbench. Then you disable borrowing by specifying "max" bandwidth: queue rootq on $ext_if bandwidth 9M max 9M queue qdef parent rootq bandwidth 3650K max 3650K default W/o other queues. Then you proceed to add others, with or without borrowing enabled undestanding what you're doing and what an how you're testing. Inside pfctl parser all bandwitdh specifications are converted to bits per second (where K means multiplied by 1000 and M by 1.000.000).