Help me update my HFSC shaper scripts for fw4/nftables

I don't get this part, i've been stuck here since the begging, i don't get what do i need to change. Could you please replace what you want me fill, with the word "EXAMPLE". Sorry i feel dumb with this setting.

This is a shell script if you do:

GAMEUP=$((UPRATE*15/100+400))
GAMEUP=450

you assign a value to the variable GAMEUP twice and only the last assignment will stick. Commenting the first out like:

#GAMEUP=$((UPRATE*15/100+400))
GAMEUP=450

just makes that explicit...
The hash # is interpreted by the shell as 'ignore the rest of this line'

1 Like

Like this? If i choose the dynamic variable? Do i have to replace "UPRATE" and "DOWNRATE" inside the equation?

## how many kbps of UDP upload and download do you need for your games across all gaming machines? 
## you can tune these yourself, but a good starting point is this formula. this script will not work for UPRATE less than about
## 600kbps or downrate less than about 1000kbps
#GAMEUP=$((UPRATE*15/100+400))
#GAMEDOWN=$((DOWNRATE*15/100+400))

## you can try setting GAMEUP and GAMEDOWN manually, some report this works well for CoD
GAMEUP=450
GAMEDOWN=800

No, as I showed you before just do this:

GAMEUP=$((UPRATE*15/100+400))
GAMEDOWN=$((DOWNRATE*15/100+400))

## you can try setting GAMEUP and GAMEDOWN manually, some report this works well for CoD
#GAMEUP=450
#GAMEDOWN=800

I think i got it now, the script dynamically calculates it, based on my limits: 2650 uprate, and 4900 downrate

#!/bin/sh

##############################
# General settings
##############################
# "atm" for old-school DSL, "DOCSIS" for cable modem, or "other" for anything else
LINKTYPE="ethernet" 
WAN=usb0 # Change this to your WAN device name
LAN=ifb-usb0 # Change to your LAN device if you don't use veth/bridge, leave it alone if you use veth
DOWNRATE=30000 # Change this to about 80% of your download speed (in kbps)
UPRATE=15000 # Change this to your kbps upload speed
OH=44 # Number of bytes of Overhead on your line
PRESERVE_CONFIG_FILES="yes"  # Set to "yes" to preserve, "no" to ignore during sysupgrade

##############################
# Downstream shaping method
##############################
DOWNSHAPING_METHOD="ctinfo" # Options: "veth", "ctinfo", "lan",
## "ctinfo"  Uses connection tracking information to restore DSCP markings on incoming packets
## "veth" Utilizes a virtual Ethernet pair to control incoming traffic
## "lan" Applies traffic shaping directly on the LAN interface, (ideal) for environments with a single interface directed towards the LAN. 

##############################
# Veth-specific settings (only adjust if using the Veth setup)
##############################
LANBR=br-lan # LAN bridge interface name, only relevant if USEVETHDOWN is set to "yes"

##############################
# Performance settings
##############################
BWMAXRATIO=20 ## prevent ack floods by limiting download to at most
	      ## upload times this amount... ratio somewhere between
	      ## 10 and 20 probably optimal. we down-prioritize
	      ## certain ACKs to reduce the chance of a flood as well.

if [ $((DOWNRATE > UPRATE*BWMAXRATIO)) -eq 1 ]; then
    echo "We limit the downrate to at most $BWMAXRATIO times the upstream rate to ensure no upstream ACK floods occur which can cause game packet drops"
    DOWNRATE=$((BWMAXRATIO*UPRATE))
fi

## how many kbps of UDP upload and download do you need for your games across all gaming machines? 
## you can tune these yourself, but a good starting point is this formula. this script will not work for UPRATE less than about
## 600kbps or downrate less than about 1000kbps
GAMEUP=$((UPRATE*15/100+400))
GAMEDOWN=$((DOWNRATE*15/100+400))

## you can try setting GAMEUP and GAMEDOWN manually, some report this works well for CoD
#GAMEUP=450
#GAMEDOWN=800

##############################
# Qdisc selection
##############################
## Right now there are six possible leaf qdiscs: pfifo, bfifo, red,
## fq_codel, cake or netem. If you use netem it's so you can intentionally
## add delay to your packets, set netemdelayms to the number of ms you
## want to add each direction. Our default is pfifo it is reported to
## be the best for use in the realtime queue
gameqdisc="bfifo"

#gameqdisc="netem"

##############################
# General Qdisc Parameters
##############################
# Maximum delay we aim to keep below for game packets after burst
# Used by pfifo, bfifo, and red qdiscs
MAXDEL=24 # Milliseconds
          # 10-25 is good 1 clock tick at 64Hz is ~16ms

##############################
# pfifo Qdisc Settings
##############################
# pfifo (Packet FIFO) operates by queuing packets
# in a first-in-first-out manner without any packet classification, ensuring fairness
# and simplicity in packet delivery.
PFIFOMIN=5 ## Minimum number of packets in pfifo
PACKETSIZE=450 # Bytes per game packet avg

##############################
# netem Qdisc Settings (Optional)
##############################
# netem (Network Emulator) is a tool for testing network conditions by simulating
# latency, packet loss, jitter, and other network phenomena. It's primarily used
# for testing and is not recommended for active gaming sessions as it intentionally
# introduces delay and variability to mimic different network conditions.
netemdelayms="30"
netemjitterms="7"
netemdist="normal"
pktlossp="none" # set to "none" for no packet loss, or use a fraction
		# like 0.015 for 1.5% packet loss in the realtime UDP
		# streams

##############################
# cake Qdisc Settings
##############################
# If a variable is left empty "", the corresponding setting will not be passed to Cake.
# Use either COMMON_LINK_PRESETS or a combination of OVERHEAD, MPU, ETHER_VLAN_KEYWORD, and LINK_COMPENSATION.
# If OVERHEAD, MPU, ETHER_VLAN_KEYWORD, or LINK_COMPENSATION are set, they will override the COMMON_LINK_PRESETS setting.
# For more information about Cake's configuration options, refer to the Cake manpage: https://man7.org/linux/man-pages/man8/tc-cake.8.html
COMMON_LINK_PRESETS="ethernet"  # Predefined settings for common link types.
                                # Options: "raw" | "conservative" | "ethernet" | "docsis" | "pppoe-ptm" | "bridged-ptm" | "pppoa-vcmux" | "pppoa-llc" | "pppoe-vcmux" | "pppoe-llcsnap" | "bridged-vcmux" | "bridged-llcsnap" | "ipoa-vcmux" | "ipoa-llcsnap"
OVERHEAD=""           # Additional overhead per packet in bytes. Valid values: -64 to 256.
MPU=""                # Minimum packet size in bytes. Valid values: 0 to 256.
LINK_COMPENSATION=""  # Compensation for specific link types. Options: "atm" | "ptm" | "noatm"
                      # "atm": Asynchronous Transfer Mode, commonly used with ADSL.
                      # "ptm": Packet Transfer Mode, commonly used with VDSL2.
                      # "noatm": No compensation.
ETHER_VLAN_KEYWORD=""  # Number of VLAN tags in the Ethernet frame. Valid values: 1 to 3.
PRIORITY_QUEUE_INGRESS="diffserv4"  # Priority queues for ingress traffic. Options: "besteffort" | "diffserv3" | "diffserv4" | "diffserv8"
PRIORITY_QUEUE_EGRESS="diffserv4"   # Priority queues for egress traffic. Options: "besteffort" | "diffserv3" | "diffserv4" | "diffserv8"
HOST_ISOLATION="yes"  # Enable host isolation. Options: "yes" | "no"
                      # Prevents a single host with many connections from claiming all available bandwidth.
NAT_INGRESS="yes"  # Enable NAT for ingress traffic. Options: "yes" | "no"
NAT_EGRESS="yes"   # Enable NAT for egress traffic. Options: "yes" | "no"
WASH_INGRESS="no"  # Clear incoming DSCP markings. Options: "yes" | "no"
WASH_EGRESS="no"   # Clear outgoing DSCP markings. Options: "yes" | "no"
ACK_FILTER_EGRESS="auto"  # Options: "yes" | "no" | "auto"
                          # "auto": Cake decides based on the connection asymmetry.
RTT="25"  # Expected average packet round-trip time in milliseconds. Valid values: 1 to 1000.
AUTORATE_INGRESS="no"  # Automatic bandwidth adjustment for ingress traffic. Options: "yes" | "no"
                       # Enables Cake's automatic bandwidth adjustment for ingress traffic.
                       # For proper functionality, the downlink bandwidth must be specified in "DOWNRATE".
                       # This option is most useful for mobile connections where the quality frequently changes.
EXTRA_PARAMETERS_INGRESS=""  # Additional parameters for ingress traffic. For experts.
EXTRA_PARAMETERS_EGRESS=""   # Additional parameters for egress traffic. For experts.

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

if [ $gameqdisc != "fq_codel" -a $gameqdisc != "red" -a $gameqdisc != "pfifo" -a $gameqdisc != "bfifo" -a $gameqdisc != "cake" -a $gameqdisc != "netem" ]; then
    echo "Other qdiscs are not tested and do not work on OpenWrt yet anyway, reverting to red"
    gameqdisc="red"
fi
#############################

##############################
# Port/IP settings for traffic categorization
##############################
## Help the system prioritize your gaming by telling it what is bulk
## traffic ... define a list of udp and tcp ports used for bulk
## traffic such as torrents. By default we include the transmission
## torrent client default port 51413 and the default TCP ports for
## bittorrent. Use comma separated values or ranges A:B as shown. Set
## your torrent client to use a known port and include it here
UDPBULKPORT="51413"
TCPBULKPORT="51413,6881-6889"
VIDCONFPORTS="10000,3478-3479,8801-8802,19302-19309,5938,53"
REALTIME4="192.168.1.2" # example, just add all your game console here
REALTIME6="fd90::129a" ## example only replace with game console
LOWPRIOLAN4="192.168.109.2" # example, add your low priority lan machines here
LOWPRIOLAN6="fd90::129a" ## example, add your low priority lan ipv6 PUBLIC addr here

# Set the ACK rate to 5% of the upload bandwidth. This allocation helps ensure that ACK packets,
# which are essential for maintaining smooth TCP connections, do not overwhelm the network.
# By limiting ACK traffic to a small percentage of the total bandwidth, we prevent these packets
# from interfering with higher priority gaming traffic, thus reducing latency and improving
# overall network performance during gaming sessions.
ACKRATE="$(($UPRATE * 5 / 100))" # auto moode - or set manual
#ACKRATE="300"  ## 300-600 ist a good starting point - or leave blank to disable

FIRST500MS=$((DOWNRATE * 500 / 8)) # downrate * 500/8
FIRST10S=$((DOWNRATE * 10000 / 8)) # downrate * 10000/8

# Control whether to limit UDP traffic going faster than 450 pps
UDP_RATE_LIMIT_ENABLED="yes"  # Set to "yes" to enable or "no" to disable

##############################
#  Traffic washing settings
##############################
WASHDSCPUP="no"
WASHDSCPDOWN="no"


Yes, now you got it. You shouldn't get any errors when restarting the script now.

Please:

I'm struggling to get you the full output, puTTY keeps cutting of the top of it. jeeez

tc -s qdisc

Do you know the first lines of the output, how does it start?

Download completed (516 bytes)
Global configuration section already exists.
Enabled option already exists.
Config files have been added to sysupgrade.conf for preservation.

This script prioritizes the UDP packets from / to a set of gaming
machines into a real-time HFSC queue with guaranteed total bandwidth

Based on your settings:

Game upload guarantee = 2650 kbps
Game download guarantee = 4900 kbps

Download direction only works if you install this on a *wired* router
and there is a separate AP wired into your network, because otherwise
there are multiple parallel queues for traffic to leave your router
heading to the LAN.

Based on your link total bandwidth, the **minimum** amount of jitter
you should expect in your network is about:

UP = 2 ms

DOWN = 1 ms

In order to get lower minimum jitter you must upgrade the speed of
your link, no queuing system can help.

Please note for your display rate that:

at 30Hz, one on screen frame lasts:   33.3 ms
at 60Hz, one on screen frame lasts:   16.6 ms
at 144Hz, one on screen frame lasts:   6.9 ms

This means the typical gamer is sensitive to as little as on the order
of 5ms of jitter. To get 5ms minimum jitter you should have bandwidth
in each direction of at least:

7200 kbps

The queue system can ONLY control bandwidth and jitter in the link
between your router and the VERY FIRST device in the ISP
network. Typically you will have 5 to 10 devices between your router
and your gaming server, any of those can have variable delay and ruin
your gaming, and there is NOTHING that your router can do about it.

adding fq_codel qdisc for non-game traffic
adding fq_codel qdisc for non-game traffic
DONE!
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 mq 0: dev eth0 root
 Sent 1929033706 bytes 1537426 pkt (dropped 0, overlimits 0 requeues 9)
 backlog 0b 0p requeues 9
qdisc fq_codel 0: dev eth0 parent :10 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :f limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :e limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :d limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :c limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :b limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :a limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :9 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :8 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :7 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :6 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 1929031994 bytes 1537410 pkt (dropped 0, overlimits 0 requeues 9)
 backlog 0b 0p requeues 9
  maxpacket 1420 drop_overlimit 0 new_flow_count 23 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :5 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :4 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 1712 bytes 16 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :3 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :2 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :1 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev lan1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 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 usb0 root refcnt 2 default 13
 Sent 457 bytes 3 pkt (dropped 1, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 8016: dev usb0 parent 1:13 limit 10240p flows 1024 quantum 3000 target 4ms interval 101ms memory_limit 375000b ecn drop_batch 64
 Sent 457 bytes 3 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 269 drop_overlimit 0 new_flow_count 1 ecn_mark 0
  new_flows_len 1 old_flows_len 0
qdisc fq_codel 8018: dev usb0 parent 1:15 limit 10240p flows 1024 quantum 3000 target 4ms interval 101ms memory_limit 375000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc bfifo 10: dev usb0 parent 1:11 limit 7950b
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 8015: dev usb0 parent 1:12 limit 10240p flows 1024 quantum 3000 target 4ms interval 101ms memory_limit 375000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 8017: dev usb0 parent 1:14 limit 10240p flows 1024 quantum 3000 target 4ms interval 101ms memory_limit 375000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc ingress ffff: dev usb0 parent ffff:fff1 ----------------
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc ingress ffff: dev usb0 parent ffff:fff1 ----------------
 Sent 883953 bytes 8566 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc hfsc 1: dev ifb-usb0 root refcnt 2 default 13
 Sent 1344812 bytes 8562 pkt (dropped 2, overlimits 156 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 802b: dev ifb-usb0 parent 1:14 limit 10240p flows 1024 quantum 3000 target 4ms interval 100ms memory_limit 750000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 8029: dev ifb-usb0 parent 1:12 limit 10240p flows 1024 quantum 3000 target 4ms interval 100ms memory_limit 750000b ecn drop_batch 64
 Sent 1305002 bytes 8442 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1456 drop_overlimit 0 new_flow_count 323 ecn_mark 0
  new_flows_len 0 old_flows_len 1
qdisc bfifo 10: dev ifb-usb0 parent 1:11 limit 2400b
 Sent 32242 bytes 61 pkt (dropped 1, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 802a: dev ifb-usb0 parent 1:13 limit 10240p flows 1024 quantum 3000 target 4ms interval 100ms memory_limit 750000b ecn drop_batch 64
 Sent 7290 bytes 57 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 256 drop_overlimit 0 new_flow_count 56 ecn_mark 0
  new_flows_len 1 old_flows_len 0
qdisc fq_codel 802c: dev ifb-usb0 parent 1:15 limit 10240p flows 1024 quantum 3000 target 4ms interval 100ms memory_limit 750000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
root@OpenWrt:/etc#

==== Traffic Control (tc) Queues ====
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 mq 0: dev eth0 root
 Sent 1944495042 bytes 1635861 pkt (dropped 0, overlimits 0 requeues 9)
 backlog 0b 0p requeues 9
qdisc fq_codel 0: dev eth0 parent :10 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :f limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :e limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :d limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :c limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :b limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :a limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :9 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :8 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :7 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :6 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 1944493330 bytes 1635845 pkt (dropped 0, overlimits 0 requeues 9)
 backlog 0b 0p requeues 9
  maxpacket 1420 drop_overlimit 0 new_flow_count 23 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :5 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :4 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 1712 bytes 16 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :3 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :2 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :1 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev lan1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 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 usb0 root refcnt 2 default 13
 Sent 890662 bytes 6069 pkt (dropped 9, overlimits 173 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 8026: dev usb0 parent 1:13 limit 10240p flows 1024 quantum 3000 target 4ms interval 101ms memory_limit 375000b ecn drop_batch 64
 Sent 13936 bytes 120 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 269 drop_overlimit 0 new_flow_count 102 ecn_mark 0
  new_flows_len 1 old_flows_len 0
qdisc bfifo 10: dev usb0 parent 1:11 limit 1350b
 Sent 45360 bytes 109 pkt (dropped 9, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 8028: dev usb0 parent 1:15 limit 10240p flows 1024 quantum 3000 target 4ms interval 101ms memory_limit 375000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 8025: dev usb0 parent 1:12 limit 10240p flows 1024 quantum 3000 target 4ms interval 101ms memory_limit 375000b ecn drop_batch 64
 Sent 831366 bytes 5840 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 9460 drop_overlimit 0 new_flow_count 425 ecn_mark 0
  new_flows_len 1 old_flows_len 2
qdisc fq_codel 8027: dev usb0 parent 1:14 limit 10240p flows 1024 quantum 3000 target 4ms interval 101ms memory_limit 375000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc ingress ffff: dev usb0 parent ffff:fff1 ----------------
 Sent 1005204 bytes 9138 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc hfsc 1: dev ifb-usb0 root refcnt 2 default 13
 Sent 1496951 bytes 9134 pkt (dropped 2, overlimits 255 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 802b: dev ifb-usb0 parent 1:14 limit 10240p flows 1024 quantum 3000 target 4ms interval 100ms memory_limit 750000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 8029: dev ifb-usb0 parent 1:12 limit 10240p flows 1024 quantum 3000 target 4ms interval 100ms memory_limit 750000b ecn drop_batch 64
 Sent 1414394 bytes 8906 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 1456 drop_overlimit 0 new_flow_count 436 ecn_mark 0
  new_flows_len 1 old_flows_len 2
qdisc bfifo 10: dev ifb-usb0 parent 1:11 limit 2400b
 Sent 69210 bytes 127 pkt (dropped 1, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 802a: dev ifb-usb0 parent 1:13 limit 10240p flows 1024 quantum 3000 target 4ms interval 100ms memory_limit 750000b ecn drop_batch 64
 Sent 13069 bytes 99 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 256 drop_overlimit 0 new_flow_count 95 ecn_mark 0
  new_flows_len 1 old_flows_len 0
qdisc fq_codel 802c: dev ifb-usb0 parent 1:15 limit 10240p flows 1024 quantum 3000 target 4ms interval 100ms memory_limit 750000b ecn drop_batch 64
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0

==== Nftables Ruleset: dscptag ====
        chain dscptag {
                type filter hook forward priority filter; policy accept;
                ip protocol udp udp sport 51413 ip dscp set cs1 counter packets 0 bytes 0
                ip6 nexthdr udp udp sport 51413 ip6 dscp set cs1 counter packets 0 bytes 0
                ip protocol udp udp dport 51413 ip dscp set cs1 counter packets 0 bytes 0
                ip6 nexthdr udp udp dport 51413 ip6 dscp set cs1 counter packets 0 bytes 0
                ip protocol tcp tcp sport { 6881-6889, 51413 } ip dscp set cs1 counter packets 0 bytes 0
                ip6 nexthdr tcp tcp sport { 6881-6889, 51413 } ip6 dscp set cs1 counter packets 0 bytes 0
                ip protocol tcp tcp dport { 6881-6889, 51413 } ip dscp set cs1 counter packets 0 bytes 0
                ip6 nexthdr tcp tcp dport { 6881-6889, 51413 } ip6 dscp set cs1 counter packets 0 bytes 0
                ip protocol tcp tcp flags & ack == ack meta length < 100 add @xfst4ack { ip daddr . ip saddr . tcp dport . tcp sport limit rate over 75000/second } counter packets 0 bytes 0 jump drop995
                ip protocol tcp tcp flags & ack == ack meta length < 100 add @fast4ack { ip daddr . ip saddr . tcp dport . tcp sport limit rate over 7500/second } counter packets 0 bytes 0 jump drop95
                ip protocol tcp tcp flags & ack == ack meta length < 100 add @med4ack { ip daddr . ip saddr . tcp dport . tcp sport limit rate over 750/second } counter packets 0 bytes 0 jump drop50
                ip protocol tcp tcp flags & ack == ack meta length < 100 add @slow4ack { ip daddr . ip saddr . tcp dport . tcp sport limit rate over 750/second } counter packets 0 bytes 0 jump drop50
                ip protocol udp udp dport { 53, 3478-3479, 5938, 8801-8802, 10000, 19302-19309 } ip dscp set af42 counter packets 0 bytes 0
                ip6 nexthdr udp udp dport { 53, 3478-3479, 5938, 8801-8802, 10000, 19302-19309 } ip6 dscp set af42 counter packets 0 bytes 0
                ip protocol udp ip daddr 192.168.1.2 ip dscp set cs5 counter packets 127 bytes 62352
                ip protocol udp ip saddr 192.168.1.2 ip dscp set cs5 counter packets 118 bytes 44631
                ip6 nexthdr udp ip6 daddr fd90::129a ip6 dscp set cs5 counter packets 0 bytes 0
                ip6 nexthdr udp ip6 saddr fd90::129a ip6 dscp set cs5 counter packets 0 bytes 0
                ip protocol udp ip daddr 192.168.109.2 ip dscp set cs0 counter packets 0 bytes 0
                ip protocol udp ip saddr 192.168.109.2 ip dscp set cs0 counter packets 0 bytes 0
                ip6 nexthdr udp ip6 daddr fd90::129a ip6 dscp set cs0 counter packets 0 bytes 0
                ip6 nexthdr udp ip6 saddr fd90::129a ip6 dscp set cs0 counter packets 0 bytes 0
                ip protocol udp ip dscp > cs2 add @udp_meter4 { ip saddr . ip daddr . udp sport . udp dport limit rate over 450/second } counter packets 1 bytes 59 ip dscp set cs0 counter packets 1 bytes 59
                ip6 nexthdr udp ip6 dscp > cs2 add @udp_meter6 { ip6 saddr . ip6 daddr . udp sport . udp dport limit rate over 450/second } counter packets 0 bytes 0 ip6 dscp set cs0 counter packets 0 bytes 0
                ip protocol tcp ct bytes < 1875000 ip dscp < cs4 ip dscp set cs0 counter packets 1022 bytes 156979
                ip protocol tcp ct bytes > 37500000 ip dscp < cs4 ip dscp set cs1 counter packets 0 bytes 0
                ip protocol tcp add @slowtcp4 { ip saddr . ip daddr . tcp sport . tcp dport limit rate 150/second burst 150 packets } ip dscp set af42 counter packets 14692 bytes 1450831
                ip6 nexthdr tcp add @slowtcp6 { ip6 saddr . ip6 daddr . tcp sport . tcp dport limit rate 150/second burst 150 packets } ip6 dscp set af42 counter packets 0 bytes 0
                ip saddr 192.168.1.2 udp dport != 80 ip dscp set cs5 counter packets 118 bytes 44631
                ip saddr 192.168.1.2 udp dport != 443 ip dscp set cs5 counter packets 0 bytes 0
                meta priority set ip dscp map @priomap counter packets 14937 bytes 1557814
                meta priority set ip6 dscp map @priomap counter packets 0 bytes 0
                meta nfproto ipv4 ct mark set @nh,8,8 & 0xfc [invalid type] | 0x80 counter packets 14937 bytes 1557814
                meta nfproto ipv6 ct mark set @nh,0,16 & 0xfc0 [invalid type] | 0x80 counter packets 0 bytes 0
        }
}

Everything looks good now!

Youtube video sended to 1:11 again :frowning:

config global 'global'
        option enabled '1'

config rule
        option name 'Game Console non-HTTP'
        option proto 'udp'
        option src_ip '192.168.1.2'
        option dest_port '!=80'
        option class 'cs5'
        option counter '1'

config rule
        option name 'Game Console non-HTTPS'
        option proto 'udp'
        option src_ip '192.168.1.2'
        option dest_port '!=443'
        option class 'cs5'
        option counter '1'

#config rule 'cod1'
#       option name 'cod1'
#       option proto 'udp'
#       option src_ip '192.168.1.208'
#       option src_port '3074'
#       option dest_port '30000-65535'
#       option class 'cs5'
#       option counter '1'

#config rule 'cod2'
#       option name 'cod3'
#       option proto 'udp'
#       option dest_ip '192.168.1.208'
#       option dest_port '3074'
#       option class 'cs5'
#       option counter '1'

#config rule
#       option name 'TeamViewer'
#       option proto 'tcp'
#       option dest_port '5938'
#       option src_ip '192.168.1.190'
#       option class 'cs4'
#       option counter '1'
~
~
~

Maybe there is some other udp traffic on your pc... To check if youtube videos are not prioritized you can use tcpdump while you are watching a youtube video:

tcpdump udp port 443 -i br-lan -v -n
tcpdump udp port 443 -i usb0 -v -n

The result should be:

(tos 0x0

to check what other traffic is marked with cs5 do this:

tcpdump -i br-lan 'ip[1] == 0xa0 and (src 192.168.1.2 or dst 192.168.1.2)'

1 Like

This will not ignore the ECN bits, so maybe try:

tcpdump -i br-lan -v -n '(ip and (ip[1] & 0xfc) >> 2 == 40 and (src net 192.168.1.2/32 or dst net 192.168.1.2/32)'

(untested, might explode, but the idea is to mask out the ECN bits and right shift the DSCP bits so direct comparision with decimal DCSP becomes feasible)

1 Like

Very well put and I strongly agree @Hudra.

@godsEXist I think you are trying to bite off more than you can comfortably chew. Your goal seems to be something like: achieve a better network for gaming to improve your gaming performance through whatever means (in my mind I can't but help compare this to stealing a television to fuel a drug addiction).

At the moment I have the impression that you are trying to achieve too much at once without fully understanding what you are doing. Maybe try to work on small problems and build up your understanding as you go along, taking care not to do or use anything without fully understanding what you are doing first.

Or alternatively, I can be your networking engineer and work on your router. My hourly rate is £500 per hour, and I anticipate spending about ten hours optimizing your setup. So approximately £5000.

Great community and plenty of expertise here, but I think people don't take well to being called into action. This is a hobby for most. Motivation comes from things like learning and exchanging ideas. Whereas by contrast, employment involves receiving money in exchange for work. Probably many here would be happy to work for you, but not without payment in exchange.

By the way, for what it's worth, I personally think computer games are addictive and destructive and worth abandoning altogether in pursuit of healthier alternatives. I should know, as an ex-addict myself. I've seen lives and minds destroyed by them. You'll miss them at first, but then as time progresses value healthier pursuits that give longer term satisfaction (as compared to the short term buzz that you get from gaming).

Hope this makes sense and seems reasonable? I mean this to be encouraging, albeit I fully understand that many will find my stance on computer games extreme.

2 Likes

the kmod-schdcore package is installed

I have had simliar issues with youtube getting sent to 1:11
also had a intermittent issue where there would be massive lag spikes when the connection was strained hard to test because I could only replicate it 1 in every 10 or so waveform tests

for now the script is disabled while I see if the issue re-occurs

I am not sure if the way hudra is using the firewall rules is the correct fix I think it would be better to simply set 80/443 to cs3/cs4 rather then set ALL traffic to CS5 and try and exclude 80/443 that is likely to cause mixups in the query

I was testing something like this to see if it helped

config global 'global'
	option enabled '1'

config rule
        option name 'pcmr  non-HTTP'
        option proto 'udp'
        option src_ip '192.168.1.100'
        option dest_port '!=80'
        option class 'cs5'
        option counter '1'

config rule
        option name 'pcmr non-HTTPS'
        option proto 'udp'
        option src_ip '192.168.1.100'
        option dest_port '!=443'
        option class 'cs5'
        option counter '1'

config rule
        option name 'HTTP'
        option proto 'udp'
        option dest_port '80'
        option class 'cs4'
        option counter '1'

config rule
        option name 'HTTPS'
        option proto 'udp'
        option dest_port '443'
        option class 'cs4'
        option counter '1'

but really has others have said giving one machine absoute priority is always going to cause hell
nature of the beast its safer to classify based on traffic then machine address

the other issue I ran into was
in the testing I ran setting gameup/gamedown to
gameup 1780
gamedown 20000

resulted in lag when the connection was tested despite using Quake3 to test which makes out at 64kbit/s down and 1000up I was able to tune some of this out by playing with max del and limits but it never went completely away

setting higher limits resolves this but odd non the less as traffic was well within the limits set

#!/bin/sh
##############################
# General settings
##############################
# "atm" for old-school DSL, "DOCSIS" for cable modem, or "other" for anything else
LINKTYPE="DOCSIS" 
WAN=wan # Change this to your WAN device name
LAN=br-lan # Change to your LAN device if you don't use veth/bridge, leave it alone if you use veth
DOWNRATE=340000 # Change this to about 80% of your download speed (in kbps)
UPRATE=9100 # Change this to your kbps upload speed
OH=22 # Number of bytes of Overhead on your line
PRESERVE_CONFIG_FILES="yes"  # Set to "yes" to preserve, "no" to ignore during sysupgrade
##############################
# Downstream shaping method
##############################
DOWNSHAPING_METHOD="ctinfo" # Options: "veth", "ctinfo", "lan"
## "ctinfo"  Uses connection tracking information to restore DSCP markings on incoming packets
## "veth" Utilizes a virtual Ethernet pair to control incoming traffic
## "lan" Applies traffic shaping directly on the LAN interface, (ideal) for environments with a single interface directed towards the LAN. 
##############################
# Veth-specific settings (only adjust if using the Veth setup)
##############################
LANBR=br-lan # LAN bridge interface name, only relevant if USEVETHDOWN is set to "yes"
##############################
# Performance settings
##############################
BWMAXRATIO=33 ## prevent ack floods by limiting download to at most
	      ## upload times this amount... ratio somewhere between
	      ## 10 and 20 probably optimal. we down-prioritize
	      ## certain ACKs to reduce the chance of a flood as well.
if [ $((DOWNRATE > UPRATE*BWMAXRATIO)) -eq 1 ]; then
    echo "We limit the downrate to at most $BWMAXRATIO times the upstream rate to ensure no upstream ACK floods occur which can cause game packet drops"
    DOWNRATE=$((BWMAXRATIO*UPRATE))
fi
## how many kbps of UDP upload and download do you need for your games across all gaming machines? 
## you can tune these yourself, but a good starting point is this formula. this script will not work for UPRATE less than about
## 600kbps or downrate less than about 1000kbps
GAMEUP=$((UPRATE*15/100+400))
GAMEDOWN=$((DOWNRATE*15/100+400))
## you can try setting GAMEUP and GAMEDOWN manually, some report this works well for CoD
#GAMEUP=2142
#GAMEDOWN=42000
##############################
# Qdisc selection
##############################
## Right now there are four possible leaf qdiscs: pfifo, red,
## fq_codel, or netem. If you use netem it's so you can intentionally
## add delay to your packets, set netemdelayms to the number of ms you
## want to add each direction. Our default is pfifo it is reported to
## be the best for use in the realtime queue
gameqdisc="pfifo"
#gameqdisc="cake"
##############################
# pfifo Qdisc Settings
##############################
# pfifo (Packet FIFO) is utilized for maintaining low latency and minimal packet loss,
# particularly suited for real-time applications like gaming. It operates by queuing packets
# in a first-in-first-out manner without any packet classification, ensuring fairness
# and simplicity in packet delivery.
PFIFOMIN=5 ## Minimum number of packets in pfifo
PACKETSIZE=512 # Bytes per game packet avg
MAXDEL=25 # Ms we try to keep max delay below for game packets after burst
##############################
# netem Qdisc Settings (Optional)
##############################
# netem (Network Emulator) is a tool for testing network conditions by simulating
# latency, packet loss, jitter, and other network phenomena. It's primarily used
# for testing and is not recommended for active gaming sessions as it intentionally
# introduces delay and variability to mimic different network conditions.
netemdelayms="1"
netemjitterms="7"
netemdist="normal"
pktlossp="none" # set to "none" for no packet loss, or use a fraction
		# like 0.015 for 1.5% packet loss in the realtime UDP
		# streams
#############################
if [ $gameqdisc != "fq_codel" -a $gameqdisc != "red" -a $gameqdisc != "pfifo" -a $gameqdisc != "netem" ]; then
    echo "Other qdiscs are not tested and do not work on OpenWrt yet anyway, reverting to red"
    gameqdisc="red"
fi
#############################
##############################
# Port/IP settings for traffic categorization
##############################
## Help the system prioritize your gaming by telling it what is bulk
## traffic ... define a list of udp and tcp ports used for bulk
## traffic such as torrents. By default we include the transmission
## torrent client default port 51413 and the default TCP ports for
## bittorrent. Use comma separated values or ranges A:B as shown. Set
## your torrent client to use a known port and include it here
UDPBULKPORT="51413"
TCPBULKPORT="51413,6881-6889"
VIDCONFPORTS="10000,3478-3479,8801-8802,19302-19309,5938"
REALTIME4="192.168.1.100" # example, just add all your game console here
REALTIME6="fda9:d3aa:40e9::57e" ## example only replace with game console
LOWPRIOLAN4="192.168.0.240" # example, add your low priority lan machines here
LOWPRIOLAN6="fd90::129a" ## example, add your low priority lan ipv6 PUBLIC addr here
# Set the ACK rate to 5% of the upload bandwidth. This allocation helps ensure that ACK packets,
# which are essential for maintaining smooth TCP connections, do not overwhelm the network.
# By limiting ACK traffic to a small percentage of the total bandwidth, we prevent these packets
# from interfering with higher priority gaming traffic, thus reducing latency and improving
# overall network performance during gaming sessions.
ACKRATE="$(($UPRATE * 6 / 100))" # auto moode - or set manual
#ACKRATE="500"  ## 300-600 ist a good starting point - or leave blank to disable
FIRST500MS=$((DOWNRATE * 500 / 8)) # downrate * 500/8
FIRST10S=$((DOWNRATE * 10000 / 8)) # downrate * 10000/8
# Control whether to limit UDP traffic going faster than 450 pps
UDP_RATE_LIMIT_ENABLED="no"  # Set to "yes" to enable or "no" to disable
##############################
#  Traffic washing settings
##############################
WASHDSCPUP="no"
WASHDSCPDOWN="no"
######################################## CUSTOMIZATIONS GO ABOVE THIS LINE ###############################################

Because your gaming device ip is still in realtime variable

root@OpenWrt:/etc# tcpdump -i br-lan -v -n '(ip and (ip[1] & 0xfc) >> 2 == 40 and (src net 192.168.1.2/32 or dst net 192.168.1.2/32)'
tcpdump: can't parse filter expression: syntax error

root@OpenWrt:~# tcpdump -i br-lan 'ip[1] == 0xa0 and (src 192.168.1.2 or dst 192.168.1.2)'
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on br-lan, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:53:19.773894 IP 173.194.135.106.443 > 192.168.1.2.57961: UDP, length 1250
15:53:19.785944 IP 173.194.135.106.443 > 192.168.1.2.57961: UDP, length 1250
15:53:19.794182 IP 173.194.135.106.443 > 192.168.1.2.57961: UDP, length 1250
15:53:19.807500 IP 173.194.135.106.443 > 192.168.1.2.57961: UDP, length 1250
15:53:19.820857 IP 173.194.135.106.443 > 192.168.1.2.57961: UDP, length 1250

In my case:

config global 'global'
	option enabled '1'

config rule
        option name 'pcmr  non-HTTP'
        option proto 'udp'
        option src_ip '192.168.1.100'
        option dest_port '!=80'
        option class 'cs5'
        option counter '1'

config rule
        option name 'pcmr non-HTTPS'
        option proto 'udp'
        option src_ip '192.168.1.100'
        option dest_port '!=443'
        option class 'cs5'
        option counter '1'

config rule
        option name 'HTTP'
        option proto 'udp'
        option dest_port '80'
        option class 'cs4'
        option counter '1'

config rule
        option name 'HTTPS'
        option proto 'udp'
        option dest_port '443'
        option class 'cs4'
        option counter '1'

This kinda of works, while keeping REALTIME4:

REALTIME4="" # example, just add all your game console here

COD, Hunt:Showdown are ok, but Diablo 4 is not being sended to 1:11.
I'm kinda of curious why is this happening.

Sorry, I lost a parenthesis there:

tcpdump -i br-lan -v -n '(ip and (ip[1] & 0xfc) >> 2 == 40) and (src net 192.168.1.2/32 or dst net 192.168.1.2/32)'

should work, as I said untested...