I noticed, that for some reason, subequeues have hard time
borrowing unless the parent queue can borrow itself.

For example, consider following setup (only important parts):

altq on $if_100 cbq bandwidth 100Mb queue { if100_www,if100_mail, \
    if100_misc, if100_ftp, if100_pri, if100_extbulk, if100_ack }

queue if100_misc on $if_100      bandwidth 2.8Mb cbq(default borrow)
queue if100_www on $if_100       bandwidth  25Mb cbq \
                                    {if100_www_int, if100_www_sqd}
  queue if100_www_int on $if_100 bandwidth   5Mb cbq(borrow)
  queue if100_www_sqd on $if_100 bandwidth  20Mb cbq(borrow)
queue if100_mail on $if_100      bandwidth  15Mb cbq(borrow)
#...remaining queues...

#and following rule:

pass in on $if_100 inet proto tcp from any to $srv_100 port www 
         flags S/SAFR keep state queue (if100_www_int, if100_ack)

In this scenario (note - no borrow in parent if100_www),
I got following results:

queue root_fxp0 bandwidth 100Mb priority 0 cbq( wrr root ) {if100_misc, 
    if100_www, if100_mail, if100_ftp, if100_pri, if100_extbulk, if100_ack}
  [ pkts:      24451  bytes:   34995648  dropped pkts:      0 bytes:      0 ]
  [ qlength:   0/ 50  borrows:      0  suspends:      0 ]
  [ measured:   516.5 packets/s, 5.91Mb/s ]
queue  if100_www bandwidth 25Mb {if100_www_int, if100_www_sqd}
  [ 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   if100_www_int bandwidth 5Mb cbq( borrow ) 
  [ pkts:      24448  bytes:   34995380  dropped pkts:      0 bytes:      0 ]
  [ qlength:  11/ 50  borrows:  18713  suspends:   1357 ]
  [ measured:   516.5 packets/s, 5.91Mb/s ]
queue   if100_www_sqd bandwidth 20Mb 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 ]

Now, if I add (borrow) to if100_www queue:

queue if100_www on $if_100       bandwidth  25Mb cbq(borrow) \
                                    {if100_www_int, if100_www_sqd}
the results:

queue root_fxp0 bandwidth 100Mb priority 0 cbq( wrr root ) {if100_misc, 
    if100_www, if100_mail, if100_ftp, if100_pri, if100_extbulk, if100_ack}
  [ pkts:      86969  bytes:  124483434  dropped pkts:      0 bytes:      0 ]
  [ qlength:   0/ 50  borrows:      0  suspends:      0 ]
  [ measured:  6563.2 packets/s, 75.16Mb/s ]
queue  if100_www bandwidth 25Mb cbq( borrow ) {if100_www_int, if100_www_sqd}
  [ pkts:          0  bytes:          0  dropped pkts:      0 bytes:      0 ]
  [ qlength:   0/ 50  borrows:  86678  suspends:      0 ]
  [ measured:     0.0 packets/s, 0 b/s ]
queue   if100_www_int bandwidth 5Mb cbq( borrow ) 
  [ pkts:      86967  bytes:  124483226  dropped pkts:      0 bytes:      0 ]
  [ qlength:   0/ 50  borrows:  86880  suspends:      0 ]
  [ measured:  6563.2 packets/s, 75.16Mb/s ]
queue   if100_www_sqd bandwidth 20Mb 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 ]


No suspends, almost identical borrows, and quite a difference in bandwidth. 
It somehow looks, that parent queue prohibits borrowing, unless it can borrow 
itself from the root queue.

Is it intended (or maybe a bug or misconfiguration on my side) ? I was under 
impression (including pf faq examples) that if a subqueue has the borrow 
attribute, it can use extra bw from parent queue, regardless if the parent 
can or cannot borrow itself.

Reply via email to