SQM not working despite my efforts

I tried tons of settings, despite my efforts I'm getting nothing. I'm using coaxial cable to connect internet.

This is my results with sqm disabled.

Now I did EXACTLY what wiki says so this is the settings for first run.

I got this

Ok now I just changed ethernet 44 setting to ethernet 34, download and upload setting still same, let's give a run

And thats it. I played with settings, tried tons of different layer adaptation settings, lowered download and upload very much but it doesn't changes anything. It's kinda weird imo. My openwrt is:

Any help would be awesome. Thanks.

Please post links to reports, pictures are useless.

The checkbox titled "Enable this SQM instance" seems not to be checked...

But maybe to get started, log into your router via SSH) and run the following commands:

  1. ifstatus wan | grep -e device
  2. cat /etc/config/sqm
  3. tc -s qdisc

then copy and paste the output of each command to the forum using one of the following two methods:
GUI:

Please use the "Preformatted text </>" button for logs, scripts, configs and general console output.
grafik
Please edit your post accordingly. Thank you! :slight_smile:

CLI:

Just make sure you "sandwich" your text between two rows of backtick characters ` (which themselves will be invisible in the preview) looking in something like this in the editor:
```
Your Pasted Text as preformatted text with fixed width font
1
1111 (note with fixed-width fonts the numbers are right-aligned)
```
but looking like this in the rendered forum:

Your Pasted Text as preformatted text with fixed width font
   1
1111 (note with fixed-width fonts the numbers are right-aligned)

Also, for the waveform bufferbloat test, please post links to the respective results pages for the different tests or at least complete screenshots that also show the latency numbers.
Thanks...

root@OpenWrt:~# ifstatus wan | grep -e device
	"l3_device": "wan",
	"device": "wan",
root@OpenWrt:~# cat /etc/config/sqm

config queue
	option enabled '1'
	option interface 'wan'
	option download '55000'
	option upload '4000'
	option debug_logging '0'
	option verbosity '5'
	option qdisc 'cake'
	option script 'piece_of_cake.qos'
	option linklayer 'ethernet'
	option overhead '22'
	option linklayer_advanced '1'
	option tcMTU '2047'
	option tcTSIZE '128'
	option tcMPU '64'
	option linklayer_adaptation_mechanism 'default'
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 mq 0: dev eth0 root 
 Sent 21768141323 bytes 15181605 pkt (dropped 0, overlimits 0 requeues 3380) 
 backlog 0b 0p requeues 3380
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 21768139611 bytes 15181589 pkt (dropped 0, overlimits 0 requeues 3380) 
 backlog 0b 0p requeues 3380
  maxpacket 21252 drop_overlimit 0 new_flow_count 211826 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 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 :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 cake 810d: dev wan root refcnt 17 bandwidth 4Mbit besteffort triple-isolate nonat nowash no-ack-filter split-gso rtt 100ms noatm overhead 22 mpu 64 
 Sent 5594924 bytes 60500 pkt (dropped 7, overlimits 72992 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 79004b of 4Mb
 capacity estimate: 4Mbit
 min/max network layer size:           28 /    1500
 min/max overhead-adjusted size:       64 /    1522
 average network hdr offset:           14

                  Tin 0
  thresh          4Mbit
  target            5ms
  interval        100ms
  pk_delay       1.85ms
  av_delay        271us
  sp_delay         11us
  backlog            0b
  pkts            60507
  bytes         5605047
  way_inds         9935
  way_miss          253
  way_cols            0
  drops               7
  marks               0
  ack_drop            0
  sp_flows            0
  bk_flows            1
  un_flows            0
  max_len          2908
  quantum           300

qdisc ingress ffff: dev wan parent ffff:fff1 ---------------- 
 Sent 125351651 bytes 86301 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 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 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 cake 810e: dev ifb4wan root refcnt 2 bandwidth 55Mbit besteffort triple-isolate nonat wash no-ack-filter split-gso rtt 100ms noatm overhead 22 mpu 64 
 Sent 117975432 bytes 80098 pkt (dropped 6203, overlimits 130425 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 2863912b of 4Mb
 capacity estimate: 55Mbit
 min/max network layer size:           46 /    1500
 min/max overhead-adjusted size:       68 /    1522
 average network hdr offset:           14

                  Tin 0
  thresh         55Mbit
  target            5ms
  interval        100ms
  pk_delay        1.7ms
  av_delay        478us
  sp_delay          9us
  backlog            0b
  pkts            86301
  bytes       127363397
  way_inds           83
  way_miss          240
  way_cols            0
  drops            6203
  marks               0
  ack_drop            0
  sp_flows            1
  bk_flows            1
  un_flows            0
  max_len         19682
  quantum          1514

Oh and I of course checked enable this SQM instance on my tests it is just screenshoot it looks like that. Now my results with this settings:

root@OpenWrt:~# cat /etc/config/sqm

config queue
	option enabled '1'
	option interface 'wan'
	option download '59000'
	option upload '3800'
	option debug_logging '0'
	option verbosity '5'
	option qdisc 'cake'
	option script 'piece_of_cake.qos'
	option linklayer 'ethernet'
	option overhead '34'

With this settings my results: https://www.waveform.com/tools/bufferbloat?test-id=a2b72bd0-1bf0-4f8f-8b40-9275e581b7f9

now new settings

config queue
	option enabled '1'
	option interface 'wan'
	option download '59000'
	option upload '3800'
	option debug_logging '0'
	option verbosity '5'
	option qdisc 'cake'
	option script 'piece_of_cake.qos'
	option linklayer 'atm'
	option overhead '44'
	option linklayer_advanced '1'
	option tcMTU '2047'
	option tcTSIZE '128'
	option tcMPU '96'
	option linklayer_adaptation_mechanism 'default'
1 Like

Lets set baseline.
Bufferbolat test with firewall offload and SQM disabled (and router rebooted)? So we know over what we are trying to improve.
Then with firewall offload enabled (to see if router CPU was maxed out forwarding)
Also post ubus call system board output, so we know how ressourceful is your device.

this is the firewall config, i don't think i have offload enabled

root@OpenWrt:~# cat /etc/config/firewall

config defaults
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'REJECT'

config zone
	option name 'lan'
	list network 'lan'
	option input 'ACCEPT'
	option output 'ACCEPT'
	option forward 'ACCEPT'

config zone
	option name 'wan'
	list network 'wan'
	list network 'wan6'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'

config forwarding
	option src 'lan'
	option dest 'wan'

config rule
	option name 'Allow-DHCP-Renew'
	option src 'wan'
	option proto 'udp'
	option dest_port '68'
	option target 'ACCEPT'
	option family 'ipv4'

config rule
	option name 'Allow-Ping'
	option src 'wan'
	option proto 'icmp'
	option icmp_type 'echo-request'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-IGMP'
	option src 'wan'
	option proto 'igmp'
	option family 'ipv4'
	option target 'ACCEPT'

config rule
	option name 'Allow-DHCPv6'
	option src 'wan'
	option proto 'udp'
	option dest_port '546'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-MLD'
	option src 'wan'
	option proto 'icmp'
	option src_ip 'fe80::/10'
	list icmp_type '130/0'
	list icmp_type '131/0'
	list icmp_type '132/0'
	list icmp_type '143/0'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Input'
	option src 'wan'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	list icmp_type 'router-solicitation'
	list icmp_type 'neighbour-solicitation'
	list icmp_type 'router-advertisement'
	list icmp_type 'neighbour-advertisement'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-ICMPv6-Forward'
	option src 'wan'
	option dest '*'
	option proto 'icmp'
	list icmp_type 'echo-request'
	list icmp_type 'echo-reply'
	list icmp_type 'destination-unreachable'
	list icmp_type 'packet-too-big'
	list icmp_type 'time-exceeded'
	list icmp_type 'bad-header'
	list icmp_type 'unknown-header-type'
	option limit '1000/sec'
	option family 'ipv6'
	option target 'ACCEPT'

config rule
	option name 'Allow-IPSec-ESP'
	option src 'wan'
	option dest 'lan'
	option proto 'esp'
	option target 'ACCEPT'

config rule
	option name 'Allow-ISAKMP'
	option src 'wan'
	option dest 'lan'
	option dest_port '500'
	option proto 'udp'
	option target 'ACCEPT'

Ok now i just disabled SQM and rebooted and this is the result.

root@OpenWrt:~# ubus call system board
{
	"kernel": "5.15.134",
	"hostname": "OpenWrt",
	"system": "MediaTek MT7621 ver:1 eco:3",
	"model": "Xiaomi Mi Router 4A Gigabit Edition",
	"board_name": "xiaomi,mi-router-4a-gigabit",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.0",
		"revision": "r23497-6637af95aa",
		"target": "ramips/mt7621",
		"description": "OpenWrt 23.05.0 r23497-6637af95aa"
	}
}

i use memory too much. in general i usually have between %5-%10 available memory. for example now i use 90 mb on 117 mb memory so around %70 i use rn. it is because adblock service.

1 Like

Install zram-swap to relieve memory pressure.
Update to 23.05.3 using auc
Redo test now without critical memory shortage. EDIT: 2 tests (no need to reboot changing firewall offload, if you unset it back you are where you started)

installed zram-swap
I installed auc, but is it okay if i don't update? i don't know how to update and worried if something breaks

in preparation for worst:
save configuration backup from firmware menus
find pencil to enter failsafe mode if upgrade breaks

luci-app-attendedsysupgrade XOR auc moves all installed and upgraded packaged packages to squashfs and keeps all your configuration in writable overlay.
nothing bad will happen.

1 Like

Question: who flagged these posts? They contain helpful information, so mo reason to hide them.
EDIT: Thanks to the forum admin who made these reappear, in spite of the (automatic) flagging not being unreasonable...

Mmmh, cake really does not eat that much memory (the OpenWrt limit is set to 4MB per direction, so 8 MB at worst). I would be more concerned that the 880 MHz MIPS core(s) might already be overloaded... IMHO such a CPU should allow cake up to ~70Mbps combined upload and download, which seems to be right around the range you are trying to shape, but that leaves little CPU reserves for other stuff...

So please try to set SQM

	option download '30000'
	option upload '3000'

and redo the waveform test and post the results here.

This is IMHO not all that useful, if my hunch is right that you are already CPU limited... now you gain some memory that could be used for other things, but now you need to invest CPU cycles to compress/uncompress data...

1 Like

:+1:
While you check your bufferbloat with SQM enabled look at the CPU usage in the Overview page of LuCI.

1 Like

@LilRedDog good idea!
Since qdiscs like cake are accounted as soft interrupts the cake load sometimes is not really visible but it is not difficult to configure htop to show these. See in the FAQ section of:
https://openwrt.org/docs/guide-user/network/traffic-shaping/sqm-details#faq
for how to configure htop to show "Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest)"
Open a terminal and look at htop's CPU load bars while running a capacity-test* in parallel

*) Side-note: these are often misnames as "speed"-tests, but the unit of speed is distance/time, and that is decidedly not what these tests are actually measuring... what is measured is the net payload capacity or net payload information rate... the actual speed for most links is a pretty boring 2/3 of the speed of light in vacuum, and that typically is rarely helpful to assess a link's "quality", but I digress...

1 Like

OP said 95% mem used, means zram-swap will prevent crashes with 16MB allocated to fresh cake.
IF fw offload is required to maintain CPU usage under control we can still do br-wan trick to isolate two softirq consumers.

Does he actually see crashes or is this the traditional misunderstanding that buffered/cached memory is not really used up?

Unsure, let's first try to see where the actual issue is, no?

1 Like

Yep, 100Mbps should not be saturating (not the most powerful, but not the sub-par) CPU in this case.

1 Like

If they are supposed to be getting 100Mbps and only getting ~77 without SQM, there are other issues.

i updated router, factory resetted router, installed sqm all clean router, cpu was fine it didn't increased during test, memory also was fine

this is the result with 30000 - 3000 settings, ethernet 34

no no problem there i was supposed to get 70 something without sqm

1 Like
### Unloaded: 338 ms
#### Download Active: +344 ms
#### Upload Active: +0 ms

Something with this test was completely off... I wonder where are you located, maybe run:

and post a screenshot of the full page, to see how well you are connected to cloudflare...