QoSmate: (Yet Another) Quality of Service Tool for OpenWrt

I want to try netem for a while and I read on another forum that it is better to apply it to the output, I notice that when I play on European servers with low ping the game feeling is heavier than when I play with server above 100 ping, so the idea of increasing the ping on nearby servers. And yes, my connection is 1gb. I am currently using proxmox and a virtual machine for openwrt and so far it works pretty good in general. Still I feel that the gaming feel can be improved even more.

You can try whatever you want, but Netem won’t improve your gaming experience... it will likely make things worse. Feel free to test it, though... I’ve done multiple tests with it, and I’ve yet to find a situation where it had any positive effect.

I will try it during the day. As far as I can see for you the best option is to use the qdisc Red?

Exactly, but it shouldn’t make a huge difference

So adding delay is an attempt to "game" a game's lag compensation... and the hope is that the disadvantage of adding really delay is less than the advantage of getting treated better by the lag compensation system. Without any decent theory how the lag compensation actually works and which thresholds or mapping functions it uses, this is an exercise in trial and error against essentially a black box....
Getting robust and reliable data on whether (or how much) delay helps is looking like a long and arduous slog...

1 Like

It is not about reverse rules, port that matter for CoD is assumed to be on game console not on the server, so of all rules none matches the game traffic.

While each game may implement lag compensation or server rewind differently the fundamental techniques and underlying logic are publicly accessible.

Above is a good explanation.
Below is a nice represenation

https://www.reddit.com/r/Unity3D/comments/9h75re/a_brief_summary_of_my_lag_compensation_and_server/?rdt=56274

https://developer.valvesoftware.com/wiki/Latency_Compensating_Methods_in_Client/Server_In-game_Protocol_Design_and_Optimization#Lag_Compensation:~:text=interpolating%20from%20there.-,Lag%20Compensation,-Understanding%20interpolation%20is

These systems generally store historical player states (positions, rotations, hitbox data) in buffers and then “rewind” the game state using factors such as network latency, client-side interpolation etc...

Attempting to add artificial delay in hopes of gaining an advantage is a risky gamble which can easily backfire and put you at a disadvantage. In short, without a deep understanding of the game’s specific thresholds and processing logic, trying to manipulate the lag compensation system becomes a trial-and-error battle against a black box, just as you correctly pointed out.

Also, if the game transmits game state and clock information within the network packets, then artificially adding latency wouldn’t probably directly influence the server’s decisions. The server evaluates actions based on the actual timestamps in the received packets rather than just their arrival time. As a result, intentionally increasing latency could simply cause your packets to arrive too late, likely creating more problems rather than providing any advantage.

I was downloading a game yesterday and there were a lot of tcp dup ack and retransmissions, is it normal? 50% packets


Screenshot 2025-02-20 124007

I used this guide to set up my CAKE and now I can set the download speed to 45 Mbps, which is close to my actual package speed, and the results are fine for bufferbloat.

https://www.waveform.com/tools/bufferbloat?test-id=1b2ea784-f95c-4c11-81e5-69d3aaa6bae1

Common Link Presets pppoe-ptm and Ether VLAN Keyword ether-vlan

 service qosmate status
==== qosmate Status ====
qosmate autostart is enabled.
qosmate service is enabled.
Traffic shaping is active on the egress interface (pppoe-wan).
Traffic shaping is active on the ingress interface (ifb-pppoe-wan).
==== Overall Status ====
qosmate is currently active and managing traffic shaping.
==== Current Settings ====
Upload rate: 16000 kbps
Download rate: 45000 kbps
Game traffic upload: 2800 kbps
Game traffic download: 7150 kbps
Queue discipline: CAKE (Root qdisc)
==== Package Status ====
All required packages are installed.

==== Detailed Technical Information ====
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 87366934614 bytes 76752016 pkt (dropped 0, overlimits 0 requeues 301)
 backlog 0b 0p requeues 301
qdisc fq_codel 0: dev eth0 parent :5 limit 10240p flows 1024 quantum 1514 target                                                     5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 20740216213 bytes 16113029 pkt (dropped 0, overlimits 0 requeues 21)
 backlog 0b 0p requeues 21
  maxpacket 1506 drop_overlimit 0 new_flow_count 99 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :4 limit 10240p flows 1024 quantum 1514 target                                                     5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 10774925344 bytes 8709418 pkt (dropped 0, overlimits 0 requeues 156)
 backlog 0b 0p requeues 156
  maxpacket 25738 drop_overlimit 0 new_flow_count 45 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :3 limit 10240p flows 1024 quantum 1514 target                                                     5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 25792932303 bytes 28071210 pkt (dropped 0, overlimits 0 requeues 36)
 backlog 0b 0p requeues 36
  maxpacket 12383 drop_overlimit 0 new_flow_count 78 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :2 limit 10240p flows 1024 quantum 1514 target                                                     5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 21232224422 bytes 16520879 pkt (dropped 0, overlimits 0 requeues 84)
 backlog 0b 0p requeues 84
  maxpacket 15140 drop_overlimit 0 new_flow_count 51 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :1 limit 10240p flows 1024 quantum 1514 target                                                     5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 8826636332 bytes 7337480 pkt (dropped 0, overlimits 0 requeues 4)
 backlog 0b 0p requeues 4
  maxpacket 1514 drop_overlimit 0 new_flow_count 49 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 root refcnt 2 limit 10240p flows 1024 quantum 1514 ta                                                    rget 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 9272405295 bytes 41152137 pkt (dropped 0, overlimits 0 requeues 47)
 backlog 0b 0p requeues 47
  maxpacket 1502 drop_overlimit 0 new_flow_count 16 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev phy0-ap0 root refcnt 2 limit 10240p flows 1024 quantum 151                                                    4 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 30091866 bytes 214358 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 86 drop_overlimit 0 new_flow_count 4 ecn_mark 0
  new_flows_len 0 old_flows_len 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 noqueue 0: dev eth1.10 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth1.20 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8006: dev pppoe-wan root refcnt 2 bandwidth 16Mbit diffserv3 dual-src                                                    host nat wash no-ack-filter split-gso rtt 100ms noatm overhead 30
 Sent 8364103225 bytes 41015984 pkt (dropped 8773, overlimits 27534341 requeues                                                     0)
 backlog 0b 0p requeues 0
 memory used: 3305152b of 4Mb
 capacity estimate: 16Mbit
 min/max network layer size:           21 /    1492
 min/max overhead-adjusted size:       51 /    1522
 average network hdr offset:            0

                   Bulk  Best Effort        Voice
  thresh          1Mbit       16Mbit        4Mbit
  target         18.2ms          5ms          5ms
  interval        113ms        100ms        100ms
  pk_delay        283us       1.21ms        183us
  av_delay         12us        186us         12us
  sp_delay          3us          4us          5us
  backlog            0b           0b           0b
  pkts          1814580     38775426       434751
  bytes       421548830   7631563331    321648405
  way_inds         1107       933916          304
  way_miss         4893       228513         7098
  way_cols            0            8            0
  drops              58         8713            2
  marks               0            0            0
  ack_drop            0            0            0
  sp_flows            1            4            0
  bk_flows            0            1            0
  un_flows            0            0            0
  max_len         28348        31096         8973
  quantum           300          488          300

qdisc ingress ffff: dev pppoe-wan parent ffff:fff1 ----------------
 Sent 63115345827 bytes 60910504 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8007: dev ifb-pppoe-wan root refcnt 2 bandwidth 45Mbit diffserv3 dual                                                    -dsthost nat wash ingress no-ack-filter split-gso rtt 100ms noatm overhead 30
 Sent 61120742336 bytes 58630913 pkt (dropped 2279588, overlimits 94907599 reque                                                    ues 0)
 backlog 0b 0p requeues 0
 memory used: 3066624b of 4Mb
 capacity estimate: 45Mbit
 min/max network layer size:           28 /    1492
 min/max overhead-adjusted size:       58 /    1522
 average network hdr offset:            0

                   Bulk  Best Effort        Voice
  thresh       2812Kbit       45Mbit    11250Kbit
  target         6.46ms          5ms          5ms
  interval        101ms        100ms        100ms
  pk_delay        375us        195us         98us
  av_delay        125us         58us         21us
  sp_delay          7us          5us          4us
  backlog            0b           0b           0b
  pkts          5258375     55526165       125961
  bytes      7404139403  55628052733     83152538
  way_inds           76      1137158            0
  way_miss         3131       248278          178
  way_cols            0            0            0
  drops           36011      2243577            0
  marks               0           22            0
  ack_drop            0            0            0
  sp_flows            1            3            1
  bk_flows            0            1            0
  un_flows            0            0            0
  max_len          1492         1492         1360
  quantum           300         1373          343


==== Nftables Ruleset (dscptag) ====
        chain dscptag {
                type filter hook forward priority filter; policy accept;
                meta l4proto udp ct original proto-src { 6881-6889, 51413 } coun                                                    ter packets 0 bytes 0 jump mark_cs1
                meta l4proto udp ct original proto-dst { 6881-6889, 51413 } coun                                                    ter packets 159176 bytes 104059207 jump mark_cs1
                meta l4proto tcp ct original proto-dst { 6881-6889, 51413 } coun                                                    ter packets 265685 bytes 203756375 jump mark_cs1
                meta length < 100 tcp flags ack add @xfst4ack { ct id . ct direc                                                    tion limit rate over 80000/second burst 5 packets } counter packets 156 bytes 10                                                    268 jump drop995
                meta length < 100 tcp flags ack add @fast4ack { ct id . ct direc                                                    tion limit rate over 8000/second burst 5 packets } counter packets 1737408 bytes                                                     112143297 jump drop95
                meta length < 100 tcp flags ack add @med4ack { ct id . ct direct                                                    ion limit rate over 800/second burst 5 packets } counter packets 2815905 bytes 1                                                    67521447 jump drop50
                meta length < 100 tcp flags ack add @slow4ack { ct id . ct direc                                                    tion limit rate over 800/second burst 5 packets } counter packets 1407819 bytes                                                     83764111 jump drop50
                meta l4proto tcp ct bytes < 2812500 jump mark_500ms
                meta l4proto tcp ct bytes > 56250000 jump mark_10s
                meta l4proto tcp ip dscp != cs1 add @slowtcp { ct id . ct direct                                                    ion limit rate 150/second burst 150 packets } ip dscp set af42 counter packets 1                                                    3709641 bytes 9735030673
                meta l4proto tcp ip6 dscp != cs1 add @slowtcp { ct id . ct direc                                                    tion limit rate 150/second burst 150 packets } ip6 dscp set af42 counter packets                                                     0 bytes 0
                ip saddr { 10.12.12.20, 10.12.12.21 } udp dport != { 80, 443 } i                                                    p dscp set cs5 counter packets 1776850 bytes 1081575091 comment "Game_Console_Ou                                                    tbound"
                ip saddr { 10.12.12.20, 10.12.12.21 } udp sport != { 80, 443 } i                                                    p dscp set cs5 counter packets 26218397 bytes 4997548931 comment "Game_Console_I                                                    nbound"
                meta priority set ip dscp map @priomap counter packets 97448707                                                     bytes 69381010122
                meta priority set ip6 dscp map @priomap counter packets 0 bytes                                                     0
                ct mark set ip dscp | 0x80 counter packets 115756484 bytes 94567                                                    787210
                ct mark set ip6 dscp | 0x80 counter packets 0 bytes 0
        }
}

==== Custom Rules Table Status ====
Custom rules table (qosmate_custom) is not active or doesn't exist.

 cat /etc/config/qosmate

config global 'global'
        option enabled '1'

config settings 'settings'
        option WAN 'pppoe-wan'
        option DOWNRATE '45000'
        option UPRATE '16000'
        option ROOT_QDISC 'cake'

config advanced 'advanced'
        option MSS '536'
        option PRESERVE_CONFIG_FILES '1'
        option WASHDSCPUP '1'
        option WASHDSCPDOWN '1'
        option BWMAXRATIO '20'
        option UDP_RATE_LIMIT_ENABLED '0'
        option TCP_UPGRADE_ENABLED '1'
        option UDPBULKPORT '51413,6881-6889'
        option TCPBULKPORT '51413,6881-6889'
        option NFT_HOOK 'forward'
        option NFT_PRIORITY '0'

config hfsc 'hfsc'
        option LINKTYPE 'ethernet'
        option OH '44'
        option gameqdisc 'pfifo'
        option nongameqdisc 'fq_codel'
        option nongameqdiscoptions 'besteffort ack-filter'
        option MAXDEL '24'
        option PFIFOMIN '5'
        option PACKETSIZE '450'
        option netemdelayms '30'
        option netemjitterms '7'
        option netemdist 'normal'
        option pktlossp 'none'
        option netem_direction 'both'

config cake 'cake'
        option COMMON_LINK_PRESETS 'pppoe-ptm'
        option PRIORITY_QUEUE_INGRESS 'diffserv3'
        option PRIORITY_QUEUE_EGRESS 'diffserv3'
        option HOST_ISOLATION '1'
        option NAT_INGRESS '1'
        option NAT_EGRESS '1'
        option ACK_FILTER_EGRESS 'auto'
        option AUTORATE_INGRESS '0'
        option ETHER_VLAN_KEYWORD 'ether-vlan'

config custom_rules 'custom_rules'

config rule
        option name 'Game_Console_Outbound'
        option proto 'udp'
        option src_ip '10.12.12.20 10.12.12.21'
        list dest_port '!=80'
        list dest_port '!=443'
        option class 'cs5'
        option counter '1'
        option enabled '1'

config rule
        option name 'Game_Console_Inbound'
        option proto 'udp'
        option src_ip '10.12.12.20 10.12.12.21'
        list src_port '!=80'
        list src_port '!=443'
        option class 'cs5'
        option counter '1'
        option enabled '1'



BusyBox v1.36.1 (2025-02-03 23:09:37 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 24.10.0, r28427-6df0e3d02a
 -----------------------------------------------------
root@OpenWrt:~# ifstatus wan | grep -e device
        "l3_device": "lan0",
        "device": "lan0",

```Platform console Xbox

Fix your ruleset, it needs dst port 3074 and maybe src port xxxx wiithout any IP selected


Clear these two and change protocol to tcp+udp.
image


Exactly in opposide order - first apply the settings then check the network communication.

I applied the settings and rebooted the router and still not work

@brada4, let's not confuse @raynelv any further.

I believe that his underlying issue is likely not related to the rules he's using. The sample rules provided in the README work for everyone else, so there’s no reason they shouldn’t work correctly here. Even if he initially set up redundant and far too many rules, DSCP should still appear somewhere in the connections tab since TCP_UPGRADE_ENABLED is set to '1'. However, if you review his previous screenshots, his connections tab shows DSCP as CS0 for every connection.

Also if you look at his previous posts you can clearly so traffic is hitting his cod rules:

Here are some potential issues - @raynelv Please read carefully and provide answers to the questions. :

  1. Do you have offloading enabled – please show us the output of cat /etc/config/firewall?
  2. I'm not sure whether his device (EdgeRouter 4) is using lan0 as the WAN port in the default configuration... have you made any changes that deviate from the default configuration? Perhaps lan0 isn’t routed through the CPU. If you're not using the default config, you might try performing a factory reset and starting over with the default configuration to test qosmate.
  3. Perhaps he is also affected by the bug that @Ridz encountered (and also @Knomax) – see QOSMate / Cake w/ DSCPs. In that case, could you provide the output of:
nft -c -d netlink add rule inet dscptag dscptag ct mark set ip dscp or 128 counter
nft -c -d netlink add rule inet dscptag dscptag ct mark set ip6 dscp or 128 counter
1 Like

A useful debugging tool may be to add a trace flag to a rule definition so you insert a rule that enables meta nftrace set 1 for the same criteria. Horrible sentence structure, I know. Example:

# debug rule:
ip saddr 192.168.10.2 udp sport 3074 udp dport 30000-65535 meta nftrace set 1 comment "debug: cod1"
# user’s rule:
ip saddr 192.168.10.2 udp sport 3074 udp dport 30000-65535 ip dscp set cs5 counter comment "cod1"

Then have the user run nft monitor trace while testing the rule. You’ll see what happens to the packet after the rule is encountered.

Rule kind of works (counter) but the connection (conntrack mark) is not tagged.

ackend versions:
  Current version: 0.5.52
  Latest version: 0.5.52
Frontend versions:
  Current version: 1.0.22
  Latest version: 1.0.22

QoSmate is up to date.
root@OpenWrt:~# /etc/init.d/qosmate status
==== qosmate Status ====
qosmate autostart is enabled.
qosmate service is enabled.
Traffic shaping is active on the egress interface (pppoe-wan).
Traffic shaping is active on the ingress interface (ifb-pppoe-wan).
==== Overall Status ====
qosmate is currently active and managing traffic shaping.
==== Current Settings ====
Upload rate: 36297 kbps
Download rate: 190000 kbps
Game traffic upload: 5844 kbps
Game traffic download: 28900 kbps
Queue discipline: CAKE (Root qdisc)
==== Package Status ====
All required packages are installed.

==== Detailed Technical Information ====
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 25876525144 bytes 30097592 pkt (dropped 3, overlimits 0 requeues 3163) 
 backlog 0b 0p requeues 3163
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 17389847 bytes 43073 pkt (dropped 0, overlimits 0 requeues 195) 
 backlog 0b 0p requeues 195
  maxpacket 1470 drop_overlimit 0 new_flow_count 69 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 3826095 bytes 31955 pkt (dropped 0, overlimits 0 requeues 127) 
 backlog 0b 0p requeues 127
  maxpacket 495 drop_overlimit 0 new_flow_count 51 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 23982397220 bytes 17121925 pkt (dropped 0, overlimits 0 requeues 2277) 
 backlog 0b 0p requeues 2277
  maxpacket 30360 drop_overlimit 0 new_flow_count 1340 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 1872911982 bytes 12900639 pkt (dropped 3, overlimits 0 requeues 564) 
 backlog 0b 0p requeues 564
  maxpacket 1518 drop_overlimit 0 new_flow_count 387 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 wan root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 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 lan2 root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev lan3 root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev lan4 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 noqueue 0: dev phy0-ap0 root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev phy1-ap0 root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc cake 8075: dev pppoe-wan root refcnt 2 bandwidth 36297Kbit diffserv4 dual-srchost nat wash no-ack-filter split-gso rtt 100ms noatm overhead 48 
 Sent 859670977 bytes 8888378 pkt (dropped 40, overlimits 443322 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 538880b of 4Mb
 capacity estimate: 36297Kbit
 min/max network layer size:           28 /    1492
 min/max overhead-adjusted size:       76 /    1540
 average network hdr offset:            0

                   Bulk  Best Effort        Video        Voice
  thresh       2268Kbit    36297Kbit    18148Kbit     9074Kbit
  target         8.01ms          5ms          5ms          5ms
  interval        103ms        100ms        100ms        100ms
  pk_delay         24us        394us        347us         31us
  av_delay          4us         24us         35us          5us
  sp_delay          2us          2us          2us          3us
  backlog            0b           0b           0b           0b
  pkts          7618581       620984       645081         3772
  bytes       695776022     56743885    106779189       429599
  way_inds       280492        12270        42033            0
  way_miss          804        23189         9758          462
  way_cols            0            0            0            0
  drops               5           10           25            0
  marks               0            0            1            0
  ack_drop            0            0            0            0
  sp_flows            1            2            1            1
  bk_flows            1            0            0            0
  un_flows            0            0            0            0
  max_len         37300        16992        16412          576
  quantum           300         1107          553          300

qdisc ingress ffff: dev pppoe-wan parent ffff:fff1 ---------------- 
 Sent 36626396222 bytes 28443758 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc cake 8076: dev ifb-pppoe-wan root refcnt 2 bandwidth 190Mbit diffserv4 dual-dsthost nat wash ingress no-ack-filter split-gso rtt 100ms noatm overhead 48 
 Sent 36625772850 bytes 28443294 pkt (dropped 431, overlimits 40848494 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 2685184b of 9500000b
 capacity estimate: 190Mbit
 min/max network layer size:           28 /    1492
 min/max overhead-adjusted size:       76 /    1540
 average network hdr offset:            0

                   Bulk  Best Effort        Video        Voice
  thresh      11875Kbit      190Mbit       95Mbit    47500Kbit
  target            5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms
  pk_delay        526us        466us        362us         66us
  av_delay        103us        250us        163us         14us
  sp_delay          6us          5us         17us          4us
  backlog            0b           0b           0b           0b
  pkts         25195085      2395929       838644        14067
  bytes     32673200932   3119017594    832146702      1984212
  way_inds       619840         8947        72730           36
  way_miss          806        11312         8897         7636
  way_cols            0            0            0            0
  drops             197          213           21            0
  marks               0            2            0            0
  ack_drop            0            0            0            0
  sp_flows            1            1            1            2
  bk_flows            1            0            0            0
  un_flows            0            0            0            0
  max_len          1492         1492         1492         1167
  quantum           362         1514         1514         1449


==== Nftables Ruleset (dscptag) ====
	chain dscptag {
		type filter hook forward priority filter; policy accept;
		meta l4proto udp ct original proto-src { 6881-6889, 51413 } counter packets 0 bytes 0 jump mark_cs1
		meta l4proto udp ct original proto-dst { 6881-6889, 51413 } counter packets 0 bytes 0 jump mark_cs1
		meta l4proto tcp ct original proto-dst { 6881-6889, 51413 } counter packets 0 bytes 0 jump mark_cs1
		meta length < 100 tcp flags ack add @xfst4ack { ct id . ct direction limit rate over 181400/second burst 5 packets } counter packets 0 bytes 0 jump drop995
		meta length < 100 tcp flags ack add @fast4ack { ct id . ct direction limit rate over 18140/second burst 5 packets } counter packets 931005 bytes 49387417 jump drop95
		meta length < 100 tcp flags ack add @med4ack { ct id . ct direction limit rate over 1814/second burst 5 packets } counter packets 2382245 bytes 125267453 jump drop50
		meta length < 100 tcp flags ack add @slow4ack { ct id . ct direction limit rate over 1814/second burst 5 packets } counter packets 1193128 bytes 62738505 jump drop50
		meta l4proto tcp ct bytes < 11875000 jump mark_500ms
		meta l4proto tcp ct bytes > 237500000 jump mark_10s
		meta l4proto tcp ip dscp != cs1 add @slowtcp { ct id . ct direction limit rate 150/second burst 150 packets } ip dscp set af42 counter packets 1729744 bytes 1086885936
		meta l4proto tcp ip6 dscp != cs1 add @slowtcp { ct id . ct direction limit rate 150/second burst 150 packets } ip6 dscp set af42 counter packets 0 bytes 0
		ip saddr 192.168.1.48 udp dport != { 80, 443 } ip dscp set cs5 counter packets 178 bytes 12528 comment "Game_Console_Outbound"
		udp sport != { 80, 443 } ip daddr 192.168.1.48 ip dscp set cs5 counter packets 178 bytes 12528 comment "Game_Console_Inbound"
		meta l4proto tcp ip saddr 192.168.1.37 ip dscp set cs1 counter packets 1733207 bytes 109988885 comment "Grundig"
		meta l4proto tcp ip daddr 192.168.1.37 ip dscp set cs1 counter packets 13069284 bytes 16409439476 comment "Grundig Income"
		meta l4proto icmp ip daddr 1.1.1.1 ip dscp set cs4 counter packets 1189 bytes 99876 comment "Ping"
		meta l4proto icmp ip saddr 1.1.1.1 ip dscp set cs4 counter packets 1189 bytes 99876 comment "Ping_V2"
		meta priority set ip dscp map @priomap counter packets 37162876 bytes 37475663726
		meta priority set ip6 dscp map @priomap counter packets 0 bytes 0
		ct mark set ip dscp | 0x80 counter packets 37163135 bytes 37475683410
		ct mark set ip6 dscp | 0x80 counter packets 0 bytes 0
	}
}

==== Custom Rules Table Status ====
Custom rules table (qosmate_custom) is not active or doesn't exist.
root@OpenWrt:~# cat /etc/config/qosmate

config global 'global'
	option enabled '1'

config settings 'settings'
	option WAN 'pppoe-wan'
	option DOWNRATE '190000'
	option UPRATE '36297'
	option ROOT_QDISC 'cake'

config advanced 'advanced'
	option PRESERVE_CONFIG_FILES '1'
	option WASHDSCPUP '1'
	option WASHDSCPDOWN '1'
	option BWMAXRATIO '20'
	option UDP_RATE_LIMIT_ENABLED '0'
	option TCP_UPGRADE_ENABLED '1'
	option UDPBULKPORT '51413,6881-6889'
	option TCPBULKPORT '51413,6881-6889'
	option NFT_HOOK 'forward'
	option NFT_PRIORITY '0'

config hfsc 'hfsc'
	option LINKTYPE 'ethernet'
	option OH '44'
	option gameqdisc 'fq_codel'
	option nongameqdisc 'cake'
	option nongameqdiscoptions 'besteffort ack-filter'
	option MAXDEL '24'
	option PFIFOMIN '5'
	option PACKETSIZE '450'
	option netemdelayms '30'
	option netemjitterms '7'
	option netemdist 'normal'
	option pktlossp 'none'

config cake 'cake'
	option COMMON_LINK_PRESETS 'conservative'
	option PRIORITY_QUEUE_INGRESS 'diffserv4'
	option PRIORITY_QUEUE_EGRESS 'diffserv4'
	option HOST_ISOLATION '1'
	option NAT_INGRESS '1'
	option NAT_EGRESS '1'
	option ACK_FILTER_EGRESS 'auto'
	option AUTORATE_INGRESS '0'

config custom_rules 'custom_rules'

config rule
	option name 'Game_Console_Outbound'
	option proto 'udp'
	option src_ip '192.168.1.48'
	list dest_port '!=80'
	list dest_port '!=443'
	option class 'cs5'
	option counter '1'
	option enabled '1'

config rule
	option name 'Game_Console_Inbound'
	option proto 'udp'
	option dest_ip '192.168.1.48'
	list src_port '!=80'
	list src_port '!=443'
	option class 'cs5'
	option counter '1'
	option enabled '1'

config rule
	option name 'Grundig'
	option proto 'tcp'
	list src_ip '192.168.1.37'
	option class 'cs1'
	option counter '1'
	option enabled '1'

config rule
	option name 'Grundig Income'
	option proto 'tcp'
	list dest_ip '192.168.1.37'
	option class 'cs1'
	option counter '1'
	option enabled '1'

config rule
	option name 'Ping'
	option proto 'icmp'
	list dest_ip '1.1.1.1'
	option class 'cs4'
	option counter '1'
	option enabled '1'

config rule
	option proto 'icmp'
	list src_ip '1.1.1.1'
	option class 'cs4'
	option counter '1'
	option enabled '1'
	option name 'Ping_V2'


"l3_device": "pppoe-wan",
	"device": "wan",

Connection Details

Subscribed bandwidth:

  •     Download speed (Mbps): 240
    
  •     Upload speed (Mbps): 45
    

Connection type (DSL/Cable/Fiber): VDSL

Bufferbloat Test Results
Test without QoSmate:
https://www.waveform.com/tools/bufferbloat?test-id=91f526dc-18be-45b2-8327-42ea7d6213c6

Test with QoSmate enabled:
https://www.waveform.com/tools/bufferbloat?test-id=0781cd5a-3f0f-4bbe-a3ba-786b34ec1616

Issue Description
Ping spikes in Counter Strike 2 while TV is streaming

When did it start? (After an update, configuration change, etc.)
Since we got a new TV that supports 4K :smiley:

Can you reliably reproduce the issue?
Yes

What have you tried to resolve it?
Many SQM solutions

Steps to Reproduce
Start streaming on TV

Expected Behavior
No ping spikes in Counter Strike while streaming is not affected negatively

Actual Behavior
Ping spikes any few seconds in Counter Strike 2 or with ping command

Have you reviewed the QoSmate documentation?
Yes

Have you checked the OpenWrt forum thread for similar issues?
Yes

Are there any relevant log messages? (Check with logread | grep qosmate)
No

If gaming-related, what game/platform are you using?
PC, Counter Strike 2

1 Like

That’s why I’d be interested in the nft trace output, to see when the packet traverses the ct mark rule and what else might come after it (e.g. another chain from a different script).

2 Likes