Best settings for gaming QoS+DSCP

Report issues relating to bandwith monitoring, bandwidth quotas or QoS in this forum.

Moderator: Moderators

SirSWE
Posts: 73
Joined: Sat Jul 13, 2019 2:54 pm

Re: Best settings for gaming QoS+DSCP

Post by SirSWE »

Is gargoyle using sfq + hfsc?

mindwolf
Posts: 9
Joined: Tue Mar 28, 2017 11:09 pm

Re: Best settings for gaming QoS+DSCP

Post by mindwolf »

This is the qos script for gargoyle. Search the page for sfq and you'll see that it uses sfq for download and upload.

https://raw.githubusercontent.com/ericpaulbishop/gargoyle/master/package/qos-gargoyle/files/qos_gargoyle.init

A side not: Why is gargoyle still using tc filters intead of -j CLASSIFY? It's been long supported to set POSTROUTING and FORWARD targets...

SirSWE
Posts: 73
Joined: Sat Jul 13, 2019 2:54 pm

Re: Best settings for gaming QoS+DSCP

Post by SirSWE »

interesting, i also see hsfc

mindwolf
Posts: 9
Joined: Tue Mar 28, 2017 11:09 pm

Re: Best settings for gaming QoS+DSCP

Post by mindwolf »

Code: Select all

#!/bin/sh
########################################################################################################################
#
# This script sets up a simple a 1u tier using Token Bucket Filter and FairQueue(NOT using the codel aspect) as the aqm.
#
########################################################################################################################

# Some housekeeping
tc qdisc del dev eth1.2 root > /dev/null 2>&1
rmmod imq
iptables -t mangle -D PREROUTING -i eth1.2 -j IMQ --todev 0
iptables -t mangle -D PREROUTING -i eth1.2 -p udp --dport 3074 -j DSCP --set-dscp-class AF41
iptables -t mangle -D POSTROUTING -o eth1.2 -p udp --sport 3074 -j DSCP --set-dscp-class AF41

######################################################################################################################

# Variables -  Replace some of these to reflect your setup as needed.
IFACE="eth1.2" # OUTGOING WAN TRAFFIC
DEV="imq0"     # INCOMMING WAN TRAFFIC
# TBF wants to send as fast as the interface can, and using mtu plus peakrate is not very efficient; So we use advertised ISP CIR - 10%
UPLINK="9000"  # WAN UPLOAD RATE/SPEED
DOWNLINK="45000" # WAN DOWNLOAD RATE/SPEED
# TC by default adds 14 bytes for ethernet so we only add what's needed.
# E.G. tc -d -s qdisc show dev $replace_with_your_interface should show maxpacket 1522 after a speedtest.
ESTAB_OPTS="stab linklayer ethernet overhead 8"
# The IMQ device doesn't see the 14 bytes that tc would have already added to the interface, only the mtu the user specified.
# We need to add the 14 bytes + additional wan overheads ONLY to IMQ.
# Which in my case is 8 bytes for VDSL2 (14+4+4) w/o PPPOE (8bytes)
ISTAB_OPTS="stab linklayer ethernet overhead 22"


# The formula is RATE/HZ openwrt/gargoyle=100hz or RATE * tickrate (10ms)
# then converted to bytes (which is actually 8.2 but TC doesn't like decimals)
# We won't use that but instead a sort of leaky bucket with a fixed queue buffer for added control over bufferbloat.
# 2048bytes burst was chosen because it corresponds to the fact that regardless of packet size, a full 2048b skb is used.
EBURST="2048"
IBURST="2048"
# Typically in the USA around 75ms but in reality 100ms with high memory switch buffers BLAAAAHHHHH.
LATENCY="100ms"
# Either mpu is used silently by tbf or not at all?
MPU="64"

######################################################################################################################


egress(){
tc qdisc add dev ${IFACE} root handle 1: ${ESTAB_OPTS} tbf rate ${UPLINK}kbit burst ${EBURST} latency ${LATENCY} mpu ${MPU}
tc qdisc add dev ${IFACE} parent 1: handle 10: fq_codel limit 1000 target 100s quantum 300 ecn
}

######################################################################################################################

ingress(){
insmod imq
ip link set imq0 up
ip link set dev imq0 mtu 1500
tc qdisc add dev ${DEV} root handle 1: ${ISTAB_OPTS} tbf rate ${DOWNLINK}kbit burst ${IBURST} latency ${LATENCY} mpu ${MPU}
tc qdisc add dev ${DEV} parent 1: handle 10: fq_codel limit 1000 target 100s quantum 1522 ecn
iptables -t mangle -A PREROUTING -i eth1.2 -j IMQ --todev 0
}

######################################################################################################################

diffserv(){
iptables -t mangle -A PREROUTING -i eth1.2 -p udp --dport 3074 -j DSCP --set-dscp-class AF41
iptables -t mangle -A POSTROUTING -o eth1.2 -p udp --sport 3074 -j DSCP --set-dscp-class AF41
}

offloads(){
sh /etc/ethtool.sh
}

######################################################################################################################
egress
ingress
diffserv
# offloads

VanCleef
Posts: 51
Joined: Tue Jul 09, 2019 9:01 am

Re: Best settings for gaming QoS+DSCP

Post by VanCleef »

Interesting script mindwolf

Is AF41 better than EF in its configuration?
TP-Link Archer C7 v2
Gargoyle: 1.10.0
Down: 38MB
Up: 6.5MB

VanCleef
Posts: 51
Joined: Tue Jul 09, 2019 9:01 am

Re: Best settings for gaming QoS+DSCP

Post by VanCleef »

I put the dscp lines inside the script qos gargoyle, this prevents the rules from being duplicated after the reboot.

to edit: vi /etc/init.d/qos_gargoyle


Download:

# squash ingress
iptables -t mangle -A fwmark -j DSCP --set-dscp 0

#Go back and touch up the root qdisc to have the proper default class
tc qdisc change dev imq0 $overhead root handle 1:0 hfsc default $def_download_idx

# Create ingress chain
iptables -t mangle -N qos_ingress

# Mark ingress in FORWARD and INPUT chains to make sure any DNAT (virt. server) is taken into account
iptables -t mangle -A FORWARD -i $qos_interface -j qos_ingress
iptables -t mangle -A INPUT -i $qos_interface -j qos_ingress

# icmp ingress
iptables -t mangle -A qos_ingress -p icmp -j DSCP --set-dscp-class CS6

# tcp flags ingress
iptables -t mangle -A qos_ingress -p tcp -m length --length :64 -j DSCP --set-dscp-class CS6

# ps4 ingress
iptables -t mangle -A qos_ingress -d 192.168.1.142 -p udp -j DSCP --set-dscp-class CS6

#Now the rest of the user entered rules.



Upload:

#Go back and touch up the root qdisc to have the proper default class
tc qdisc change dev $qos_interface $overhead root handle 1:0 hfsc default $def_upload_idx

# Set up egress chain
iptables -t mangle -N qos_egress
iptables -t mangle -A POSTROUTING -o $qos_interface -j qos_egress

# icmp egress
iptables -t mangle -A qos_egress -p icmp -j DSCP --set-dscp-class EF

# tcp flags egress
iptables -t mangle -A qos_egress -p tcp -m length --length :64 -j DSCP --set-dscp-class EF

# ps4 egress
iptables -t mangle -A qos_egress -s 192.168.1.142 -p udp -j DSCP --set-dscp-class CS4

#Next the user entered rules.



QoS in gui, download:

Destination: 192.168.1.142, Transport Protocol: UDP/ Ps4
Maximum Packet Length: 64 bytes, Transport Protocol: TCP /Fast
Transport Protocol: ICMP /Fast

Normal 40% zero nolimit
Fast 10% zero nolimit
Ps4 50% zero nolimit minrtt



gui, upload:

Source: 192.168.1.142, Transport Protocol: UDP /Ps4
Maximum Packet Length: 64 bytes, Transport Protocol: TCP /Fast
Transport Protocol: ICMP /Fast

Normal 10% zero nolimit
Fast 40% zero nolimit
Ps4 50% zero nolimit


Best setup for me so far, playing Ps4 over wifi.
TP-Link Archer C7 v2
Gargoyle: 1.10.0
Down: 38MB
Up: 6.5MB

thema1366
Posts: 2
Joined: Fri Mar 20, 2020 10:18 pm

Re: Best settings for gaming QoS+DSCP

Post by thema1366 »

hello vancleef i don't really understand the last topic where is you tap the down and egress rules please ? thanks

encro
Posts: 69
Joined: Fri Mar 13, 2015 10:52 am
Location: au.victoria

Re: Best settings for gaming QoS+DSCP

Post by encro »

VanCleef's last post has moved the rules into the Gargoyle firewall default settings to avoid duplicates with I'm assuming is the intention of offering it to the Gargoyle Devs as a future tweak.

You're basically doing a Search and Replace of the original content so It's important to verify you have the right section you're tweaking. Test the DSCP Ruleset by using the command: service firewall restart (Or: /etc/init.d/firewall restart).

If you don't want to replace the Defaults then you can add it to /etc/firewall.user instead and it should be fine with overriding the default Gargoyle Rules anyway.

Keep in mind this is experimental and not supported by the Gargoyle Dev Team at this stage but I can vouch that the improvement is significant.
Netgear WNDR3700v4 - Gargoyle 1.12.x
D-Link DIR-835 - Gargoyle 1.7.1 (Deceased)
How to manually set up PIA's OpenVPN in Gargoyle (Private Internet Access): https://www.gargoyle-router.com/phpbb/viewtopic.php?f=11&t=9129&p=45410#p45410

Post Reply