How to setup SQM QoS for GeForce Now on OpenWrt routers with Qosify Cake for no packet loss and frame loss
I was trying to setup and optimize SQM QoS (Smart Queue Management and Quality of Service) on my router for Cloud Gaming, and specifically for GeForce Now, for quite some time. I hope these findings will be useful to someone.
Smart Queue Management is great and works amazingly to reduce bufferbloat, and by default it's optimized for Voice calls and fair queue between all traffic.
However, GeForce Now uses UDP packets and a lot of them, while still requiring low latency. The issue arrises when these packets are the first ones to get dropped by SQM as soon as anyone on the same network starts to watch a YouTube video, opens a larger website or watches a 4K video.
The following workaround will still keep SQM on for low bufferbloat, while dividing it in 4 priority tiers (diffserv4), and setting GeForce Now above other traffic by marking its packets as Video with AF41 priority.
The example shows how to set it up on OpenWrt based routers with the Qosify script (https://github.com/openwrt/qosify), and uses the Cake queue management system from Dave Täht and the team (https://libreqos.io/credits/) .
- Login to your OpenWrt router (default is https://192.168.1.1 or http://openwrt.lan) and go to System > Software
- Click on "Update lists"
- (Optional) Click on "Installed" and remove any previous SQM and QoS scripts. Be careful not to remove something that is essential for the router to run
- Click on "Available", search for
qosify
and install it - Open Terminal and login to your OpenWrt router using SSH (default is
ssh [email protected]
) - Type
uci show qosify
and press Return to see the current the configuration - Type
uci set qosify.wan.bandwidth_up='140mbit'
and press Return to set your upload speed (make sure to change the 140 to somewhat below your actual upload speed) - Type
uci set qosify.wan.bandwidth_down='140mbit'
and press Return to set your download speed (make sure to change the 140 to somewhat below your actual download speed) - Type
uci set qosify.wan.disabled='0'
and press Return to enable Qosify SQM on the Wan port - Type
uci commit qosify
and press Return to save the changes in the Qosify configuration file - We need to add GeForce Now as a priority Video traffic. To do this, type
cat > /etc/qosify/05-geforcenow.conf
and press Return - Copy the following configuration (the white spaces are separated with Tab):
# GeForceNow
udp:49003 +video
udp:49004 +video
udp:49005 +video
udp:49006 +video
dns:*.nvidiagrid.net +video
- Paste the configuration in Terminal and press on CTRL + D to save it
- Type
cat /etc/qosify/05-geforcenow.conf
and press Return to check and make sure everything looks good. - Finally, you can start the Qosify SQM QoS script by typing
/etc/init.d/qosify start
or/etc/init.d/qosify restart
and press Return - You can now start GeForce Now and test the speed or try playing a game
- You can check if the QoS is working and the statistics by typing
qosify-status
ortc -s qdisc
. If it works good, you should see packets under the Video column.
Hopefully this would be useful to anyone trying to setup SQM QoS to work with GeForce Now or other Cloud Gaming services.
You can use the same procedure to give priority to other services as well, by adding the DNS or port of the service, like for example:
# xCloud
dns:*.gssv-play-prod.xboxlive.com +video
Please feel free to ask if you have any questions about the procedure. Let me know how is your experience with this setup and if you have any suggestions for improvement.
Keep in mind that QoS is computationally expensive, and you usually need to turn off any Software or Hardware offloading in order for it to work properly. Your router might need a fast CPU to handle this. Routers with the Mediatek mt7622 chipset (like for example the Xiaomi AX3200) are pretty fast and can handle 300+ Mbps speeds with Qosify.
Big thanks goes to:
- /u/Porg-Life for the idea to give priority to GeForce Now traffic based on the ports.
- /u/keridil for pointing out that the downstream video doesn't get marked with just the source port and for the amazing explanations that pointed in the right direction for the DNS solution.
- /u/jharle for all the help and support on the GeForce Now subreddit.
- Dave Täht and the team for all their work on Cake and reducing bufferbloat for everyone
- nbd, the developer of the Qosify script and the users that helped to improve it: https://github.com/openwrt/qosify https://forum.openwrt.org/t/qosify-new-package-for-dscp-marking-cake/111789
Yeah, I checked, I have a MediaTek MT7628AN. But i have only 100 mbps speed connection, the only thing that works is to disable SQM