Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save GetVladimir/2ff48f4729884148f0567bb63ffd8b43 to your computer and use it in GitHub Desktop.

Select an option

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 root@192.168.1.1)
  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

mclauder commented Feb 4, 2024

Copy link
Copy Markdown

Bro, its super helpful, thanks ))

@GetVladimir

Copy link
Copy Markdown
Author

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

@mclauder

mclauder commented Feb 4, 2024

Copy link
Copy Markdown

@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

mclauder commented Feb 4, 2024

Copy link
Copy Markdown

Any way to fix this?

@GetVladimir

Copy link
Copy Markdown
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

mclauder commented Feb 5, 2024

Copy link
Copy Markdown

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

mclauder commented Feb 5, 2024

Copy link
Copy Markdown

is it possible to do something else?

@GetVladimir

Copy link
Copy Markdown
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.

@Jorn1993

Copy link
Copy Markdown

Hi,

Your solution works really good, although I get some high bursts of packet loss now and then. Running latest openwrt on proxmox as a VM. With pfsense or opensense never had this issue. Don't know how to fix it. Any help?

Also, have you heard about QoSmate? https://github.com/hudra0/qosmate

Might be a better solution?

@GetVladimir

Copy link
Copy Markdown
Author

@Jorn1993 Thank you for your comment.

There are quite a few layers, so we need to isolate why the packet loss is happening. Is it on OpenWrt 23.05.5? How is the CPU usage? Does it happen when Qosify is turned off?

Thank you for the info regarding QoSmate, I haven't checked it in more detail.

Also interesting to note, lately more and more ISPs are implementing QoS Shaping on their side, so Cloud Gaming seems to work better when QoS is turned off on the user side.

It's best to try it out if possible and see which one works best for your specific setup and Internet connection

@ReznikGun

Copy link
Copy Markdown

Hi, very helpful information. Just a small question, is there a way to configure this for a pc game, like gears 5? Or nedds to be the xbox app instead the geforce?

@GetVladimir

Copy link
Copy Markdown
Author

@ReznikGun thank you. Yes, you can use the same process to set it up for a local PC game as well. You just need to know which ports the game uses and assign the priority to those instead in step 12

@ReznikGun

Copy link
Copy Markdown

Hi, its me again :) on the step #12 what value should I type for dns? The game is Gears 5 from xbox on pc. How can i get that info? It would be so awesome learn how to get it

@GetVladimir

Copy link
Copy Markdown
Author

@ReznikGun If it uses the Xbox app on PC, it might be using the same ports that are shown on their official documentation here: https://support.xbox.com/en-US/help/hardware-network/connect-network/network-ports-used-xbox-live

For dns, you can use xboxlive.com and xbox.com or leave it empty (as the game seems to just needs the ports to be a priority).

I haven't tested this myself though.

@ReznikGun

Copy link
Copy Markdown

Hi, again. I did all the steps to setup SQM for xbox, im showing the configuration that I did. My question is about if the configuration its correct.

cat > /etc/qosify/05-gears5.conf

Gears5

udp:88 +video
udp:3074 +video
udp:53 +video
udp:500 +video
udp:3544 +video
udp:4500 +video
udp:9002 +video
dns:

And this is the info from qosify-status:
PXL_20260610_173935833 RAW-01 COVER

@GetVladimir

Copy link
Copy Markdown
Author

@ReznikGun That seems correct. You might want to add the TCP ports as well (although they seem to be generic ports used for other services too, so be careful about that)

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