Help prioritizing games with alternative qdisc design

something as simple as that? openwrt solutions for sfq qos has been around for AGES

https://www.gargoyle-router.com/phpbb/viewforum.php?f=12

some of your "kin" ps4 and/or COD players
https://www.gargoyle-router.com/phpbb/viewtopic.php?f=12&t=12126

I have already try these methods. Simple but doesnt works for cod.. In other games with Just sqm and Cake you are OK... Cod somehow is something different.

what are you talking about. im talking gargoyle has the same sfq setup as your friend's advanced tomato.

and you telling me about how "simple" and cake doesnt work.

ok, im out of this thread.

i was intrigued by the misleading title about some new qdisc design and dlakelan replied to it and thought it was some high level discussion. im an idiot for joining this thread

This is a thread about creating a simple alternative to SQM for gamers using a custom combination / hierarchy of standard linux qdiscs... sorry if it's somehow misleading.

I hope we can get some people to test it, for the case where gamers want high priority for a special gaming machine this should be better than SQM which tries to be general purpose.

You dont read? I said i already try these methods... I know that gargoyle has sfq.. I try the same settings in gargoyle and It doesnt work as i imagine.
Dlakelan posts because i need something more specific and testing one part at a time.. It is more complicated. If you want to help you are wellcome.. But dont tell that you are an idiot to join... I see many times when we make a post about gaming many members not interested at all to help.. But gamers are a big part of community. And again i want to thank you Dlakelan for his time he spends untill now for my specific needs.

Ok, so it turns out that OpenWrt doesn't include the drr or the tbf qdisc? That seems like a mistake, but let's work with HFSC instead, it's a bit more CPU intensive but it's a great qdisc.

Also to do iptables classify requires iptables-mod-ipopt package.

It has tbf...

root@OpenWrt:~# ls -lha /lib/modules/$(uname -r)/ | grep sch
-rw-r--r--    1 root     root       32.1K Sep  6 16:19 sch_cake.ko
-rw-r--r--    1 root     root        8.2K Sep  6 16:19 sch_codel.ko
-rw-r--r--    1 root     root        7.0K Sep  6 16:19 sch_dsmark.ko
-rw-r--r--    1 root     root       10.3K Sep  6 16:19 sch_fq.ko
-rw-r--r--    1 root     root        9.9K Sep  6 16:19 sch_gred.ko
-rw-r--r--    1 root     root       19.6K Sep  6 16:19 sch_hfsc.ko
-rw-r--r--    1 root     root       19.7K Sep  6 16:19 sch_htb.ko
-rw-r--r--    1 root     root        3.2K Sep  6 16:19 sch_ingress.ko
-rw-r--r--    1 root     root        6.3K Sep  6 16:19 sch_multiq.ko
-rw-r--r--    1 root     root       11.4K Sep  6 16:19 sch_netem.ko
-rw-r--r--    1 root     root        6.8K Sep  6 16:19 sch_pie.ko
-rw-r--r--    1 root     root        6.3K Sep  6 16:19 sch_prio.ko
-rw-r--r--    1 root     root        8.5K Sep  6 16:19 sch_red.ko
-rw-r--r--    1 root     root       12.2K Sep  6 16:19 sch_sfq.ko
-rw-r--r--    1 root     root        9.2K Sep  6 16:19 ****sch_tbf.ko****
-rw-r--r--    1 root     root        6.9K Sep  6 16:19 sch_teql.ko

A "fix" to second script....

#!/bin/sh

GAMINGIP="192.168.1.xxx" # change this

# start by putting everything into 2:1 as "default"
iptables -t mangle -A POSTROUTING -j CLASSIFY --set-class 2:1
#reclassify all udp packets from your gaming machine as 2:2, high priority
iptables -t mangle -A POSTROUTING -p udp -s "${GAMINGIP}" -j CLASSIFY --set-class 2:2

Ok, let's set up an hfsc with two classes... let's see:

#!/bin/sh
WAN=eth0.2 # change this to your WAN device name
UPRATE=650 #change this to your kbps upload speed
LAN=eth0.1
DOWNRATE=3000 #change this to about 80% of your download speed (in kbps)

setqdisc () {
DEV=$1
RATE = $2
OH=37
let uprate=$RATE*90/100
let downrate=$RATE*10/100

tc qdisc replace dev $DEV stab overhead $OH linklayer ethernet handle 1: root hfsc default 3
tc class add dev $DEV parent 1: classid 1:1 hfsc ls m2 ${RATE}kbit ul m2 ${RATE}kbit

# high prio class
tc class add dev $DEV parent 1:1 classid 1:2 hfsc rt m1 ${uprate}kbit d 20ms m2 ${downrate}kbit

tc class add dev $DEV parent 1:1 classid 1:3 hfsc ls m1 ${downrate}kbit d 20ms m2 ${uprate}kbit

tc qdisc add dev $DEV parent 1:2 pfifo limit 10
tc qdisc add dev $DEV parent 1:3 pfifo limit 10

}

setqdisc $WAN $UPRATE

## uncomment this to do the download direction via output of LAN
#setqdisc $LAN $DOWNRATE

and then classify differently:

#!/bin/sh

GAMINGIP="10.1.1.3" # change this

#reclassify all udp packets from your gaming machine as 1:2, high priority
iptables -t mangle -A POSTROUTING -p udp -s ${GAMINGIP} -j CLASSIFY --set-class 1:2
iptables -t mangle -A POSTROUTING -p udp -d ${GAMINGIP} -j CLASSIFY --set-class 1:2

It is wrong this?

fixed... HFSC has a default, so I simplified it somewhat

It does the same thing ?Boosts udp traffic?

That's right. basically it gives your udp traffic up to 90% of the bandwidth for up to 20ms... If you have say 1mbps that means you can transfer 2250 bytes, which should be enough to flush out your high priority queue.

after 20ms of contention, the role will switch, with only 10% of the bandwidth reserved in the long term for your games etc.

we can tune those things later.

Please let me know though what your up and down speed you will use is?

OH=37 this value is for ATM overhead?Mine is 40 from moeller ATM detector..can i change this?
I will use ...

#!/bin/sh
WAN=pppoe-wan # change this to your WAN device name
UPRATE=668 #change this to your kbps upload speed
LAN=br-lan
DOWNRATE=13060 #change this to about 80% of your download speed (in kbps)

Both upload and download are 80% of the lowest values i have taken after several speedtests.

1 Like

that's right, so you can use the 40 ATM overhead, you could even boost that a little above the optimum it will generally be better than being a little below. If you're on ATM then technically things get more complicated, but let's just see if it works with 40

Do you have any wireguard data from your game? Maybe you can tell me what the typical game bandwidth upload usage is? The settings should allow the full game bandwidth + a little extra in the high priority queue so we should probably customize that a bit.

change this to the ethernet device like eth0.1 instead of the bridge.

ok wait a minute to make changes.

I put in startup....
sleep 8
/root/hfsc.sh
sleep 8
/root/gaming.sh

I use the following scripts....

#!/bin/sh
WAN=pppoe-wan # change this to your WAN device name
UPRATE=668 #change this to your kbps upload speed
LAN=eth0.1
DOWNRATE=13060 #change this to about 80% of your download speed (in kbps)

setqdisc () {
DEV=$1
RATE=$2
OH=44
let uprate=$RATE*90/100
let downrate=$RATE*10/100

tc qdisc replace dev $DEV stab overhead $OH linklayer ethernet handle 1: root hfsc default 3
tc class add dev $DEV parent 1: classid 1:1 hfsc ls m2 ${RATE}kbit ul m2 ${RATE}kbit

# high prio class
tc class add dev $DEV parent 1:1 classid 1:2 hfsc rt m1 ${uprate}kbit d 20ms m2 ${downrate}kbit

tc class add dev $DEV parent 1:1 classid 1:3 hfsc ls m1 ${downrate}kbit d 20ms m2 ${uprate}kbit

tc qdisc add dev $DEV parent 1:2 pfifo limit 10
tc qdisc add dev $DEV parent 1:3 pfifo limit 10

}

setqdisc $WAN $UPRATE

## uncomment this to do the download direction via output of LAN
setqdisc $LAN $DOWNRATE

With OH value 44

And this....

#!/bin/sh

GAMINGIP="192.168.1.XXX" # change this

#reclassify all udp packets from your gaming machine as 1:2, high priority
iptables -t mangle -A POSTROUTING -p udp -s ${GAMINGIP} -j CLASSIFY --set-class 1:2
iptables -t mangle -A POSTROUTING -p udp -d ${GAMINGIP} -j CLASSIFY --set-class 1:2

Output of tc -s qdisc....is it ok??

root@OpenWrt:~# tc -s qdisc
qdisc noqueue 0: dev lo root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 2583896 bytes 17520 pkt (dropped 0, overlimits 0 requeues 1) 
 backlog 0b 0p requeues 1
  maxpacket 9713 drop_overlimit 0 new_flow_count 9 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev br-lan root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc hfsc 1: dev eth0.1 root refcnt 2 default 3 
 Sent 1484627 bytes 2912 pkt (dropped 5, overlimits 497 requeues 0) 
 backlog 0b 0p requeues 0
qdisc pfifo 8009: dev eth0.1 parent 1:3 limit 10p
 Sent 1484493 bytes 2911 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc pfifo 8008: dev eth0.1 parent 1:2 limit 10p
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.2 root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc hfsc 1: dev pppoe-wan root refcnt 2 default 3 
 Sent 1281476 bytes 12879 pkt (dropped 417, overlimits 3647 requeues 0) 
 backlog 0b 0p requeues 0
qdisc pfifo 8007: dev pppoe-wan parent 1:3 limit 10p
 Sent 1281380 bytes 12878 pkt (dropped 412, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc pfifo 8006: dev pppoe-wan parent 1:2 limit 10p
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
root@OpenWrt:~# 

second script in firewall..

It seems like it looks ok at first glance. How does a speed test work, and how does game play work? I do think we will need to tune the HFSC settings a bit for you. my current script only allows 10% of total bandwidth for long-term usage by your game... that's probably not enough.

I run a speedtest right now..the speeds doesn't exceeds the values that i setup...so it isn't "broken".

1 Like