as I've been enjoying sqm-scripts on OpenWrt for quite some time, I wanted to deploy something similar on a non-OpenWrt machine. In particular, I'd like to use cake for its simplicity (and since it performs well, too) and I looked at the source code of sqm-scripts  as well as many manpages to see and understand how it's done.
While I could simply run sqm-scripts as is, I prefer to understand what's going on And here's where it get's tricky. There are a few steps I don't fully understand. So, maybe someone smarter than me or with more knowledge regarding SQM could help me understand the logic.
tc filter options
Most importantly, I'm not sure what some of the options do when the tc filter is set up to redirect ingress traffic to the ifb device (from ):
$TC filter add dev $IFACE parent ffff: protocol all prio 10 u32 \ match u32 0 0 flowid 1:1 action mirred egress redirect dev $DEV
Two parts here I don't understand:
- Why "prio 10"? Does the priority here even matter considering no additional filters are added? I saw a couple of examples showing how to set up an ifb device in order to be able to shape ingress traffic, but most of them don't specify any priority.
- What does flowid 1:1 do here? Or it other terms, would it matter if it were omitted here?
tc qdisc del+add vs replace
Aside from that, I have another question about the qdisc setup in general: In the script, every "tc qdisc add" action, is preceded by a respective "tc qdisc del" action. Is there any particular reason for not using a single "tc qdisc replace" instead? According to the manpage :
Performs a nearly atomic remove/add on an existing node id. If the node does not exist yet it is created.
This would have the benefit of not needing to silence the "tc qdisc del" action, which fails and complains if a node doesn't exist yet. Maybe it's just a stylistic question, but maybe there is a functional difference as well?
"Permanent" ifb device
Lastly, I have a question that is not necessarily related to the sqm-scripts itself. The machine I try to use cake on has a non-permanent network connection. So, it can come up and down from time to time. Obviously, I have to set up cake from fresh when the conneciton comes up. But I was wondering if I could simplify that slightly. To my understanding, setting up cake involves three main steps:
- Set up the cake qdisc for egress on the network interface.
- Set up the cake qdisc for ingress on a virtual ifb device.
- Set up a filter on the network interface to redirect the ingress traffic to the ifb device.
In such a setup with a non-permanent network connection, would it be possible to perform step 2) only once at boot, and then perform only steps 1) and 3) every time the network connection comes up? Or are there any negative sideeffects to be expected?
I'd appreciate if someone with more experience in traffic control or SQM could help me understand these things.
Thanks and regards,