Greetings.

I'm running FreeBSD 6-STABLE using pf and altq/cbq to manage bandwidth
on my wireless adapter.  I originally sent this post to the FreeBSD
questions list, but it's probably more of a pf question...  So let's try
here.

The setup from pf.conf is this:

altq on $ext_if bandwidth 54Mb cbq queue { internal, external }
queue internal bandwidth 53104Kb priority 7 cbq(borrow)
queue external bandwidth 896Kb priority 4 cbq { highq, defaultq, lowq }
   queue highq    bandwidth 40% priority 3 cbq(borrow)
   queue defaultq bandwidth 40% priority 2 cbq(default borrow)
   queue lowq     bandwidth 20% priority 1 qlimit 300 cbq(borrow)

The internal queue is for wireless traffic coming from and going to the
internal network.  The external queue (and its children) are for traffic
going upstream to my ISP.  The "external" queue is set to my max
upstream bandwidth to my ISP, so it can't borrow from the root queue.
All the child queue's under "external" can (and should) borrow against
the available upstream bandwidth amount if available.

The problem is that packets in lowq are filling up the queue, even
though there is plenty of bandwidth available to borrow from the parent
queue.

Here's a snapshot from pfctl -vvsqueue:

queue  internal bandwidth 53.10Mb priority 7 cbq( borrow )
  [ pkts:        401  bytes:     216532  dropped pkts:    0 bytes:   0 ]
  [ qlength:   0/ 50  borrows:      0  suspends:      0 ]
  [ measured:     0.0 packets/s, 0 b/s ]
queue  external bandwidth 896Kb priority 4 {highq, defaultq, lowq}
  [ pkts:          0  bytes:          0  dropped pkts:    0 bytes:   0 ]
  [ qlength:   0/ 50  borrows:      0  suspends:      0 ]
  [ measured:     0.0 packets/s, 0 b/s ]
queue   highq bandwidth 358.40Kb priority 3 cbq( borrow )
  [ pkts:          0  bytes:          0  dropped pkts:    0 bytes:   0 ]
  [ qlength:   0/ 50  borrows:      0  suspends:      0 ]
  [ measured:     0.0 packets/s, 0 b/s ]
queue   defaultq bandwidth 358.40Kb priority 2 cbq( borrow default )
  [ pkts:       7397  bytes:    3230740  dropped pkts:    0 bytes:   0 ]
  [ qlength:   0/ 50  borrows:     10  suspends:      9 ]
  [ measured:     1.0 packets/s, 4.16Kb/s ]
queue   lowq bandwidth 179.20Kb qlimit 300 cbq( borrow )
  [ pkts:      41643  bytes:   48966175  dropped pkts:    0 bytes:   0 ]
  [ qlength: 117/300  borrows:  31513  suspends:   6282 ]
  [ measured:    21.1 packets/s, 193.23Kb/s ]


Notice that queue "external", the parent of lowq, has plenty of
available bandwidth.  However, lowq has still got a backlog of 117
packets, and refuses to go over 193Kbit/sec.  It is borrowing, but not
enough to keep the queue in check.

Is there a reason the cbq implementation in pf will not aggressively
borrow against the parent queue if the bandwidth is available, or am I
reading the data wrong?  I had to set the qlimit up to 300 because
anything less will cause dropped packets like crazy, even if there is
*plenty* of available bandwidth to borrow from the parent.

Cheers,
-Wes

Reply via email to