SQM CABLE DOCSIS 3.1 Settings + Packet Prioritization

I already tried with all the measures I can't find the balance

Well, if the waveform test results are too variable you can either repeat the test multiple times and calculate averages (or download the .csv files and look at the aggregate distributions) or switch to a test that is less variable. But such preferably npn-browser tests typically require test servers somewhere in the internet and these can be hard to come by.

In the end however this is a policy question you need to answer for your network, "how much bufferbloat/latency-under-load-increase you are willing to accept" (keeping in mind that by default sqm will under saturating loads allow an median latency increase of 5 ms per direction).

Also keep in mind that you can not "fix the whole internet" on your router, you essentially can only solve your access link's bufferbloat there, if the delays happen somewhere upstream SQM can not really help (that said, the adaptive methods linked somewhere above at least try and manage to do so to a degree).

my mistake sqm if it does its job well when there is saturation it is sent to the massive class and everything returns to normal the latency is good but I expected that configuring the measures would be better or when it starts to saturate the transfer time to the massive class is immediate or nonexistent

hey @moeller0 should i enable ecn for gaming ? or is it only for tcp ?

ECN requires that the endoints negotiate and use it. Typically it is used by TCP stacks, but since the ECN bitfield lives in the IP header every protocol on top of IP can use ECN signaling. I would be amazed if current games would actually use ECN (for traffic between servers and clients that render the images themselves, I see little use as these are relatively few and mostly small packets; for graphics streaming, like google stadia or nvidia gforcenow? and friends it might be useful, but again I am unsure whether they actually negotiate it). If you are using cake, ECN-signaling is on permanently anyway, it is only for the fq_codel based scripts that ECN signaling can be toggled.

1 Like

i noticed that when i use layer_cake i get diffserv3 for egress and besteffort for ingress:

root@OpenWrt:~# tc -d qdisc
qdisc noqueue 0: dev lo root refcnt 2 
qdisc cake 8048: dev eth0 root refcnt 9 bandwidth 42Mbit diffserv3 dual-srchost nat nowash ack-filter split-gso rtt 100ms noatm overhead 18 mpu 64 
qdisc ingress ffff: dev eth0 parent ffff:fff1 ---------------- 
qdisc fq_codel 0: dev eth1 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc noqueue 0: dev br-lan root refcnt 2 
qdisc cake 8049: dev ifb4eth0 root refcnt 2 bandwidth 850Mbit besteffort dual-dsthost nat wash ingress no-ack-filter split-gso rtt 100ms noatm overhead 18 mpu 64

but what happens if i use the diffserv3 keyword for ingress, would my firewall prioritization work then ?
image

and what happens if i use piece_of_cake with diffserv3 ingress/egress

sorry for entering the discussion
i want to give my xbox udp traffic priority over all traffic in the network
installed veth and it's working it shows the same traffic on wan interface
from traffic rules i tagged all the traffic from/to wan to cs0 and the udp traffic from/to my console ip EF
two sqm on pppoe-wan and another on veth0 (both layer- cake) my problem is after playing online for some time
when i see tc -s qdisc i see the voice tin have small sizes of data a few bytes (for veth0 wich is ingress)
so what's the problem ?
and i want to thank you for what you are doing to this community

You need to change one of the DSCP related options in the GUI, or add the diffserv3 keyword to the ingress options field. Not at my computer, so I do not know the name by heart.

        option squash_dscp '0'                                                                                                                                                                  
        option squash_ingress '0' 

in /etc/config/sqm make sure that squash_ingress is set to 0. If that is set to 1 (the default) the ingress qdisc will be started as 'besteffort' (sorry no idea what these are called in the GUI, still not at my router). Why? For the simple reason that incoming DSCPs are traditionally unreliable (case in point my ISP sends ICMP messages from its own nodes as CS6) and typically not as you desire, so unless you took measures to sanitize incoming DSCPs ignoring these seems the only viabe sane default action.

Could you post the output of tc -s qdisc from immediately before and immediately after playing your game, please? Also, which game are you playing, and could you take a packet capture at the router to see what DSCPs are actually in use (and whether your games actually uses UDP)?

Could you post the output of tc -s qdisc from immediately before and immediately after playing your game

befor gaming

root@OpenWrt:~# tc -s qdisc
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 fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
 Sent 13541881 bytes 92251 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 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 eth0.1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.2 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8005: dev pppoe-wan root refcnt 2 bandwidth 8Mbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100.0ms noatm overhead 50
 Sent 11383680 bytes 89086 pkt (dropped 23, overlimits 15264 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 73920b of 4Mb
 capacity estimate: 8Mbit
 min/max network layer size:           40 /    1480
 min/max overhead-adjusted size:       90 /    1530
 average network hdr offset:            0

                   Bulk  Best Effort        Voice
  thresh        500Kbit        8Mbit        2Mbit
  target         36.1ms        5.0ms        9.0ms
  interval      131.1ms      100.0ms      104.0ms
  pk_delay          0us        2.0ms        813us
  av_delay          0us        177us        374us
  sp_delay          0us         37us         25us
  backlog            0b           0b           0b
  pkts                0        88517          592
  bytes               0     11318263        93515
  way_inds            0          543            0
  way_miss            0         2368           23
  way_cols            0            0            0
  drops               0           23            0
  marks               0            0            0
  ack_drop            0            0            0
  sp_flows            0            1            1
  bk_flows            0            1            0
  un_flows            0            0            0
  max_len             0         8670          576
  quantum           300          300          300

qdisc noqueue 0: dev wlan1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev wlan0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8008: dev veth0 root refcnt 2 bandwidth 12Mbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100.0ms noatm overhead 50
 Sent 179797386 bytes 147456 pkt (dropped 140, overlimits 174724 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 189Kb of 4Mb
 capacity estimate: 12Mbit
 min/max network layer size:           28 /    1480
 min/max overhead-adjusted size:       78 /    1530
 average network hdr offset:           14

                   Bulk  Best Effort        Voice
  thresh        750Kbit       12Mbit        3Mbit
  target         24.2ms        5.0ms        6.1ms
  interval      119.2ms      100.0ms      101.1ms
  pk_delay          0us        268us        386us
  av_delay          0us         38us         29us
  sp_delay          0us         21us         13us
  backlog            0b           0b           0b
  pkts                0       147166          430
  bytes               0    179974648        18312
  way_inds            0           35            0
  way_miss            0         1234            2
  way_cols            0            0            0
  drops               0          140            0
  marks               0            0            0
  ack_drop            0            0            0
  sp_flows            0            1            1
  bk_flows            0            1            0
  un_flows            0            0            0
  max_len             0         1494           70
  quantum           300          366          300

qdisc noqueue 0: dev veth1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
root@OpenWrt:~#

after gaming

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 fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn
 Sent 34126743 bytes 209919 pkt (dropped 0, overlimits 0 requeues 3)
 backlog 0b 0p requeues 3
  maxpacket 68 drop_overlimit 0 new_flow_count 3 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 eth0.1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.2 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8005: dev pppoe-wan root refcnt 2 bandwidth 8Mbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100.0ms noatm overhead 50
 Sent 29329778 bytes 205303 pkt (dropped 26, overlimits 18850 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 80640b of 4Mb
 capacity estimate: 8Mbit
 min/max network layer size:           31 /    1480
 min/max overhead-adjusted size:       81 /    1530
 average network hdr offset:            0

                   Bulk  Best Effort        Voice
  thresh        500Kbit        8Mbit        2Mbit
  target         36.1ms        5.0ms        9.0ms
  interval      131.1ms      100.0ms      104.0ms
  pk_delay          0us        3.1ms        310us
  av_delay          0us        183us         32us
  sp_delay          0us         28us         27us
  backlog            0b           0b           0b
  pkts                0        98582       106747
  bytes               0     13119958     16241810
  way_inds            0          705            0
  way_miss            0         3080           82
  way_cols            0            0            0
  drops               0           25            1
  marks               0            0            0
  ack_drop            0            0            0
  sp_flows            0            1            1
  bk_flows            0            1            0
  un_flows            0            0            0
  max_len             0         8670         1292
  quantum           300          300          300

qdisc noqueue 0: dev wlan1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev wlan0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8008: dev veth0 root refcnt 2 bandwidth 12Mbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 100.0ms noatm overhead 50
 Sent 220861829 bytes 199351 pkt (dropped 141, overlimits 176821 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 189Kb of 4Mb
 capacity estimate: 12Mbit
 min/max network layer size:           28 /    1480
 min/max overhead-adjusted size:       78 /    1530
 average network hdr offset:           14

                   Bulk  Best Effort        Voice
  thresh        750Kbit       12Mbit        3Mbit
  target         24.2ms        5.0ms        6.1ms
  interval      119.2ms      100.0ms      101.1ms
  pk_delay          0us        349us        297us
  av_delay          0us         42us         26us
  sp_delay          0us         21us         10us
  backlog            0b           0b           0b
  pkts                0       198909          583
  bytes               0    221033991        24906
  way_inds            0           41            0
  way_miss            0         1633            2
  way_cols            0            0            0
  drops               0          141            0
  marks               0            0            0
  ack_drop            0            0            0
  sp_flows            0            1            0
  bk_flows            0            1            0
  un_flows            0            0            0
  max_len             0         1494           70
  quantum           300          366          300

qdisc noqueue 0: dev veth1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
root@OpenWrt:~#

which game are you playing

mostly warzone

could you take a packet capture at the router to see what DSCPs are actually in use

you mean inside the router ? i don't know how to do that ?
or you mean via wireshark ?

(and whether your games actually uses UDP)?


it's using udp the first ip it's my console ip
and this is my traffic rules

thank you for your help

Thanks, I agree that it does not look like on ingress packets are marked appropriately and hence also not treated differentially by cake. Egress seems fine... I have no theory why this is however. The marking rules look okay (as far as can be judged from the screenshot)...

On the router do:

  1. make sure there is enough storage available on the router, e.g. by adding a usb flash drive as additional storage, mount it as e.g. /srv
  2. install tcpdump (opkg update ; opkg install tcpdump)
  3. run tcpdump -s 1000 -i veth0 'host 192.168.2.146' -w /srv/my_veth0_capture.cap (this is from memory and might not be 100% correct)
  4. play your game for a short while
  5. stop the tcmdump (by pressing CTRL-C if I recall correctly)
  6. transfer /srv/my_veth0_capture.cap to a computer and open it with wireshark and look at the markings of UDP packets coming in

repeat the same with tcpdump -s 1000 -i br-lan 'host 192.168.2.146' -w /srv/my_br-lan_capture.cap and compare....

for veth capturing


for br-lan capturing

it's all marked CS0 :confused:

OK then something is not working... my first guess is the re-marking rules, @nbd could that be related to fw4 versus fw3?

yes . there is a problem with traffic rules i just gave my laptop fixed ip and mark all traffic from(any zone to lan(laptop ip) with F31 , CS3 and did a capture on my laptop it gives all CS0
here is my veth script please cheack it , is there any problem with it ?

## set up veth devices to handle inbound and outbound traffic
ip link show | grep veth0 || ip link add type veth

## get new veth interfaces up
ip link set veth0 up
ip link set veth1 up

## trun on promisc mode,sometimes it's needed to make bridge work
ip link set veth1 promisc on

## add veth1 to bridge
brctl addif br-lan veth1

## just to make sure there's nothing inside this table
ip rule del priority 100
ip route flush table 100

## add routing for veth0 this will handle all traffic
ip route add default dev veth0 table 100
ip rule add iif pppoe-wan table 100 priority 100

now what can i do ?
is there any guide to learn how to create rules ?

I have no first-hand experience with veths so not the best to check this, but if traffic shaping on veth works as expected (run a speedtest without sqm, then with sqm (using the veth for ingress shaping) set to shape to 50% of the previous speedtest results) then traffic seems to traverse the veth....

i did before and it's working
:pensive:

1 Like

Good, so the question is 'merely' what happened to the requested marking action :wink:

remarking dscp through firewall not working at all
i think my isp is giving all the packets CS0 and after remarking the traffic with a lot of marks and with sqm off/on it's still the same CS0
i need a guide to learn marking packets without using luCi ?
could you help with that please?

A far as I can tell with firewall3/iptables something like:

iptables -t mangle -A POSTROUTING -p udp -d 192.168.42.201 -j DSCP --set-dscp-class EF
iptables -t mangle -A POSTROUTING -p udp -s 192.168.42.201 -j DSCP --set-dscp-class EF

should have worked to mark all traffic from/to 192.168.42.201 (not 100% sure about the POSTROUTING chain); nftables will be different, except that nftables also allows iptables commands so this might (or might not work).

1 Like

I'm on 19.07.10 is it work with iptables or nftables
and , am i free to choose any by downloading it's opkg ?