# priq on a trunk interface with asymmetric link throughput?



## Orum (Nov 19, 2009)

I have a machine that was previously connected via two interfaces, one LAN and one WAN interface.  I was running priq on the WAN interface to limit throughput and provide QoS like so:

```
altq on $ext_if priq bandwidth 2Mb queue { ntcq, vipq, vidq, ctlq, exeq, sprq, bckq }
queue ntcq priority 7 qlimit 10  priq
queue vipq priority 6 qlimit 50  priq
queue vidq priority 5 qlimit 50  priq
queue ctlq priority 4 qlimit 50  priq
queue exeq priority 3 qlimit 100 priq
queue sprq priority 2 qlimit 100 priq (default)
queue bckq priority 1 qlimit 50  priq
```

These two interfaces have been converted to one vlan trunk over a lagg interface.  Queues, however, cannot exist on vlan interfaces, and thus the queue has to be created on the lagg interface.  This causes all packets on all vlans to be queued, reguardless of what vlan they're on.  As such, the queue has to have a throughput equal to the lagg interface throughput (200 mbit) for LAN traffic to not be queued.  This presents a problem with the priq scheduler, which only has one bandwidth parameter, on the "altq" line.

The alternative is to use another scheduler, such as cbq or hfsc.  However, after testing, I cannot get cbq to behave as well as the priq scheduler, especially for VoIP traffic.  The hfsc scheduler is also not ideal, and has many of the same issues I had with cbq (wrr scheduling, not starving lower queues when higher priority queues had packets queued).

Basically, what I'd like to be able to do is combine the two, to use cbq for throughput limiting on the WAN vlan, followed by priority queuing, and give the rest to the LAN vlans.  Basically, the configuration would look like this:

```
altq on $agg_if cbq bandwidth 200Mb queue { ext, int }
  queue ext bandwidth 2Mb priority 1 cbq { ntcq, vipq, vidq, ctlq, exeq, sprq, bckq }
    queue ntcq priority 7 qlimit 10  priq
    queue vipq priority 6 qlimit 50  priq
    queue vidq priority 5 qlimit 50  priq
    queue ctlq priority 4 qlimit 50  priq
    queue exeq priority 3 qlimit 100 priq
    queue sprq priority 2 qlimit 100 priq
    queue bckq priority 1 qlimit 50  priq
  queue int bandwidth 198Mb priority 0 cbq (ecn borrow default)
```
However, altq does not let you mix schedulers on an interface!  Thus, this type of configuration is impossible.  I tried to make cbq behave like priq, like so:

```
altq on $agg_if cbq bandwidth 200Mb queue { ext, int }
  queue ext bandwidth 2Mb priority 1 cbq { ntcq, vipq, vidq, ctlq, exeq, sprq, bckq }
    queue ntcq bandwidth 100% priority 6 qlimit 10  cbq
    queue vipq bandwidth 0%   priority 5 qlimit 50  cbq (borrow)
    queue vidq bandwidth 0%   priority 4 qlimit 50  cbq (borrow)
    queue ctlq bandwidth 0%   priority 3 qlimit 50  cbq (borrow)
    queue exeq bandwidth 0%   priority 2 qlimit 100 cbq (borrow)
    queue sprq bandwidth 0%   priority 1 qlimit 100 cbq (borrow)
    queue bckq bandwidth 0%   priority 0 qlimit 50  cbq (borrow)
  queue int bandwidth 198Mb priority 0 qlimit 100 cbq (default ecn borrow)
```
...but this had catastrophic results.  Throughput dropped drastically (though packets did appear to be being queued), and I quickly reverted back to no queuing.

Those that are on the networking mailing list might remember I posted about this issue over two years ago here.  I was never able to get it working the way I wanted, so I ended up buying another interface for the machine to just use altq on the WAN link :\.  Unfortunately, that's not an option on this system.

I did some looking around and found several different patches that allow queues to be created on a vlan device.  Has anyone used one of these, and if so, which one, which version of FBSD, and most importantly, did it work well?  Is there some other way I can get this to work with priq-style scheduling (instead of wrr) that I'm missing?


----------

