Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GetVladimir/2ff48f4729884148f0567bb63ffd8b43 to your computer and use it in GitHub Desktop.
Save GetVladimir/2ff48f4729884148f0567bb63ffd8b43 to your computer and use it in GitHub Desktop.
How to setup SQM QoS for GeForce Now on OpenWrt routers with Qosify Cake for no packet loss and frame loss

How to setup SQM QoS for GeForce Now on OpenWrt routers with Qosify Cake for no packet loss and frame loss

Screenshot showing no packet loss and frame loss for how to setup SQM QoS for GeForce Now on OpenWrt routers with Qosify Cake

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/) .

Here is the step-by-step tutorial:

  1. Login to your OpenWrt router (default is https://192.168.1.1 or http://openwrt.lan) and go to System > Software
  2. Click on "Update lists"
  3. (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
  4. Click on "Available", search for qosify and install it
  5. Open Terminal and login to your OpenWrt router using SSH (default is ssh [email protected])
  6. Type uci show qosify and press Return to see the current the configuration
  7. 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)
  8. 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)
  9. Type uci set qosify.wan.disabled='0' and press Return to enable Qosify SQM on the Wan port
  10. Type uci commit qosify and press Return to save the changes in the Qosify configuration file
  11. We need to add GeForce Now as a priority Video traffic. To do this, type cat > /etc/qosify/05-geforcenow.conf and press Return
  12. 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
  1. Paste the configuration in Terminal and press on CTRL + D to save it
  2. Type cat /etc/qosify/05-geforcenow.conf and press Return to check and make sure everything looks good.
  3. 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
  4. You can now start GeForce Now and test the speed or try playing a game
  5. You can check if the QoS is working and the statistics by typing qosify-status or tc -s qdisc. If it works good, you should see packets under the Video column.

That's it!

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.

Credits

Big thanks goes to:

@Mclauder
Copy link

Mclauder commented Feb 4, 2024

Bro, its super helpful, thanks ))

@GetVladimir
Copy link
Author

@Mclauder thank you so much for your comment and I'm glad if the guide is useful

@Mclauder
Copy link

Mclauder commented Feb 4, 2024

@GetVladimir noticed now, that with this package download speed just cut by half. I'm sure it's because of this. I removed the package and
speed returned to normal, I don't have other qos packages installed

@Mclauder
Copy link

Mclauder commented Feb 4, 2024

Any way to fix this?

@GetVladimir
Copy link
Author

@Mclauder You're right, this SQM uses Cake Queuing Discipline and it's very CPU demanding. You'll need a somewhat powerful router to handle your full speed if you have a fast Internet. For example, a MediaTek mt7622 based router can use SQM with a 300+ Mbps Internet connection.

If your router is slower, you will either need to reduce the shape speed, or to turn off SQM when you need to use the full download speed (which is not ideal).

@Mclauder
Copy link

Mclauder commented Feb 5, 2024

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

@Mclauder
Copy link

Mclauder commented Feb 5, 2024

is it possible to do something else?

@GetVladimir
Copy link
Author

@Mclauder thank you for the info. From what I could find in its official specifications, it seem that the MT7628 has a single core 580 MHz Mips CPU, which I'm afraid it can't handle higher speed SQM and shaping around 50 Mbps sounds about right.

For comparison, the MediaTek mt7622 has a dual-core 1.36GHz Arm CPU, which is why it can handle the higher 300+ Mbps SQM speeds.

What you can do to test is to enable SQM only on the upload or download and see if that improves your connection. However, don't expect a big improvement if the processor usage is near 100% most of the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment