QoSmate: (Yet Another) Quality of Service Tool for OpenWrt

It's very worth it for some people. Some people get 1000ms increase in latency under download etc... Other people their ISP already handles latency well, so maybe doesn't matter.

So it is useful…maybe @Hudra have it in mind for this.

Is it possible to select prio bin without setting/changing original dscp?

for HFSC you can directly set the prio bin in nftables and it will obey that setting if you do it in the right place... (you gotta do it after the existing code that maps from dscp to prio) but for cake it has a fixed mapping from dscp to bin.

1 Like

What sorta connection you got? Fiber FTTH. Bet you already read docs and still confused then try this..

Install ethtool & tcpdump-mini packages.

ip -details link show pppoe-wan
ethtool eth1
ethtool -k eth1
tcpdump -i eth1 -e -n
tcpdump -i pppoe-wan -e -c 10

edit commands according to your setup.

Copy paste the result in text file and upload it on ChatGPT and ask questions. Result may not be 100% accurate but it'll give you head start.

New Feature Preview: Autorate (Dynamic Bandwidth Adjustment)

Hey everyone,

I wanted to share a new feature I've been working on that some of you have requested before.

I recently moved to a new house and unfortunately only have cable internet here... a downgrade from the FTTH I had before. Over the past weeks, I've experienced intermittent connection issues. A technician confirmed that there's a damaged cable somewhere in the neighborhood that probably becomes unstable during extreme cold or wet weather conditions. When this happens, my bandwidth drops significantly and I get bufferbloat, even with QoSmate running.

My options were either to set my bandwidth very conservatively low (which I didn't want), or to implement something that adapts dynamically. So I decided to build an Autorate feature for QoSmate.

I took inspiration from existing projects like cake-autorate and sqm-autorate.... great projects that I want to acknowledge here. However, since those are designed specifically for CAKE, and QoSmate supports multiple root qdiscs (HFSC, HTB, Hybrid, CAKE), I needed/wanted to build something that works with all of them.

Due to time constraints, I decided to implement a simpler version that covers the basic functionality I needed. It's probably not as feature-complete as the dedicated autorate projects, but it gets the job done for my use case.

How it works:

  • Measures latency by pinging configurable reflector servers
  • Learns a baseline latency (your connection's "unloaded" state)
  • Decreases bandwidth when latency rises above a threshold (indicating congestion)
  • Increases bandwidth cautiously when latency is stable and link is under load
  • Works with all supported qdisc types (CAKE, HFSC, HTB, Hybrid)

Usage:

For most users, it should be as simple as:

  1. Enable "Dynamic Bandwidth (Autorate)" in Settings
  2. That's it... the defaults should work for most scenarios

Detailed configuration options are available under Advanced → Autorate Settings if you want to fine-tune the behavior.

Full documentation is in the README: Autorate Documentation

How to try it:

The feature is currently in the autorate branch. To test it:

/etc/init.d/qosmate update -i -v branch=autorate

Clear your browser cache (and restart browser) to ensure the LuCI loads the new settings.

After updating, enable it via LuCI or:

uci set qosmate.autorate.enabled='1'
uci commit qosmate
service qosmate restart

I've done some basic testing and it works well for my setup. However, I haven't had time for:

  • Long-term stability tests
  • Performance/resource usage analysis
  • Graphical visualization of latency and bandwidth adjustments over time

A nice future addition could be a LuCI statistics page showing how the rates adapt in real-time, but that's beyond what I could implement with my current time constraints. If anyone is interested in contributing something like this, or wants to run more thorough tests on their own setup, that would be really helpful!

I plan to merge this into the main branch once I've received some feedback and am confident everything works well. If you try it out, I'd love to hear your experiences... whether it's suggestions, feature requests, or criticism. I'm open to all of it!

My own connection has stabilized for now, and once the ground thaws in a few weeks, they'll hopefully dig up and replace the faulty cable. But I figured this feature could be useful for others with variable connections.

Cheers!

Edit: I’ve just added a simple autorate tab to the statistics ui to better visualize autorate behavior.

8 Likes

Amazing. Question for you, how do you adjust the rate with HFSC and other non-cake qdiscs. cake has the option to adjust its parameters using tc, but I thought HFSC you had to actually drop the old qdisc and insert a new one. Does that cause a brief spike of packet loss? or did you come up with another method that doesn't do packet loss?

1 Like

Turns out you can actually use tc class change to modify hfsc and htb class parameters in-place, so there's no need to tear down and rebuild the qdisc and there seems to be no packet loss at all.
For HFSC it looks something like this:

tc class change dev $DEV parent 1: classid 1:1 hfsc ls m2 ${RATE}kbit ul m2 ${RATE}kbit
tc class change dev $DEV parent 1:1 classid 1:11 hfsc rt m1 ${BURST}kbit d ${DUR}ms m2 ${GAMERATE}kbit

I also pipe all class changes through tc -batch (although probably not necessary) so they get applied atomically. Same approach works for htb and hybrid. For cake I just use the standard tc qdisc change.

5 Likes

SWEET, thanks for looking into that. QoSmate has SO many features now. very impressed.

3 Likes

Thanks! I’m honestly sometimes surprised myself how much it has grown.