Nice
If you have your GAMEUP and GAMEDOWN set to the default formula, it uses 15 percent of your bandwidth and adds 400 kbps to it as a buffer. This bandwidth is reserved for your gaming realtime class.
When using bfifo
, the script uses the following tc
command for the realtime gaming queue:
tc qdisc add dev "$DEV" parent 1:11 handle 10: bfifo limit $((MAXDEL * gamerate / 8))
This command adds a byte-limited FIFO queue, with the queue size being determined by the specified maximum delay (MAXDEL
) and the defined gamerates for upload (GAMEUP) and download (GAMEDOWN).
For example:
Assume your download rate (DOWNRATE
) is 100000 kbps and MAXDEL
is 10 ms:
GAMEDOWN=$((DOWNRATE*15/100+400)) = 15400
GAMEDOWN=$((100000*15/100+400)) = 15400
Bfifo = (MAXDEL * gamerate / 8) = 19250
Bfifo = (10 * 15400 / 8) = 19250
So in this example, the byte-limited FIFO queue would have a size of 19250 bytes. This setup ensures that the gaming traffic has a reserved bandwidth of 15400 kbps, with a queue that can buffer up to 19250 bytes.
But depending on your bandwidth be careful how low you set your MAXDEL
Example with Low Bandwidth and Low MAXDEL
Assume your download rate (DOWNRATE
) is 5000 kbps and MAXDEL
is set to 1 ms:
GAMEDOWN=$((5000*15/100+400)) = 1150
Bfifo = (1 * 1150 / 8) = 143,75
In this example, the bfifo queue would be limited to 143.75 bytes and gaming packets are probably are bigger than that. Such a small queue size is not sufficient to ensure a stable network connection for gaming, as it would fill up instantly, leading to packet loss and higher latency.
I was considering implementing a formula to prevent the bfifo size from being set too low when dealing with low bandwidths.
You can also test if the bfifo MAXDEL is set too low.
- Install watch:
opkg update && opkg install procps-ng-watch
- Start and play your game
- Use this command and see if packets are dropped frequently
watch -n 2 'tc -s qdisc | grep -A 2 "parent 1:11"'
This executes thetc
command every 2 seconds and filters only the realtime gaming class (1:11) for up and download. If you see your sent packets increasing but no packets dropped, you are probably good to go...
qdisc bfifo 10: dev ifb-eth1 parent 1:11 limit 19250b
Sent 130 bytes 1 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0