Qosify: new package for DSCP marking + cake

have you read the opening post??? there is a link to documentation.

and before you ask, yes, that's "the" documentation. plus this thread with 1000+ posts which already covers your questions. i highly recommend to read this thread through, even if it will take some time, or at least use the forum search as there are many answers here already.

to add some value qosify-status is your friend to monitor what happens sqm wise.
i suggest to install procps-ng-watch too, so you can do watch -n1 -d qosify-status to do live monitoring.

2 Likes

can anyone confirm if my setting are appropriate for my cable internet with 23 upload and 600 Down ? let me know if i could make further changes to make it better. my main game call of duty runs on 3074 udp/tcp

config defaults
	list defaults /etc/qosify/*.conf
	option dscp_icmp +besteffort
	option dscp_default_tcp unmarked_traffic
	option dscp_default_udp unmarked_traffic

config class unmarked_traffic
	option ingress CS1
	option egress CS1
	option prio_max_avg_pkt_len 1270
	option dscp_prio CS4
	option bulk_trigger_pps 600
	option bulk_trigger_timeout 10
	option dscp_bulk CS1

config class browsing
	option ingress CS0
	option egress CS0
	option prio_max_avg_pkt_len 575
	option dscp_prio AF41
	option bulk_trigger_pps 1000
	option bulk_trigger_timeout 10
	option dscp_bulk CS1

config class bulk
	option ingress CS1
	option egress CS1

config class besteffort
	option ingress CS0
	option egress CS0

config class network_services
	option ingress CS2
	option egress CS2

config class broadcast_video
	option ingress CS3
	option egress CS3

config class gaming
	option ingress CS4
	option egress CS4

config class multimedia_conferencing
	option ingress AF42
	option egress AF42
	option prio_max_avg_pkt_len 575
	option dscp_prio AF41

config class telephony
	option ingress EF
	option egress EF

config interface wan
	option name wan
	option disabled 0
	option bandwidth_up 20mbit
	option bandwidth_down 500mbit
	option overhead_type docsis
	# for manual:
	option ingress 1
	option egress 1
	option mode diffserv4
	option nat 1
	option host_isolate 1
	option autorate_ingress 0
	option ingress_options "nat dual-dsthost ingress mpu 64 overhead 18"
    	option egress_options "nat dual-srchost mpu 64 overhead 18 wash"

config device wandev
	option disabled 1
	option name wan
	option bandwidth 100mbit
# SSH
tcp:22    network_services

# NTP
udp:123   network_services

# DNS
tcp:53    network_services
tcp:5353  network_services
udp:53    network_services
udp:5353  network_services

# DNS over TLS (DoT)
tcp:853   multimedia_conferencing
udp:853   multimedia_conferencing

# HTTP/HTTPS/QUIC
tcp:80    browsing
tcp:443   browsing
udp:80    browsing
udp:443   browsing

# Microsoft (Download)
dns:*1drv*                 bulk
dns:*backblaze*            bulk
dns:*backblazeb2*          bulk
dns:*ms-acdc.office*       bulk
dns:*onedrive*             bulk
dns:*sharepoint*           bulk
dns:*update.microsoft*     bulk
dns:*windowsupdate*        bulk

# MEGA (Download)
dns:*mega*                 bulk

# Dropbox (Download)
dns:*dropboxusercontent*   bulk

# Google (Download)
dns:*drive.google*         bulk
dns:*googleusercontent*    bulk

# Steam (Download)
dns:*steamcontent*         bulk

# Epic Games (Download)
dns:*download.epicgames*   bulk
dns:*download2.epicgames*  bulk
dns:*download3.epicgames*  bulk
dns:*download4.epicgames*  bulk
dns:*epicgames-download1*  bulk

# YouTube
dns:*googlevideo*   besteffort

# Facebook
dns:*fbcdn*         besteffort

# Twitch
dns:*ttvnw*         besteffort

# TikTok
dns:*tiktok*        besteffort

# Netflix
dns:*nflxvideo*     besteffort

# Amazon Prime Video
dns:*aiv-cdn*       besteffort
dns:*aiv-delivery*  besteffort
dns:*pv-cdn*        besteffort

# Disney Plus
dns:*disney*        besteffort
dns:*dssott*        besteffort

# HBO
dns:*hbo*           besteffort
dns:*hbomaxcdn*     besteffort

# BitTorrent
tcp:6881-7000    bulk
tcp:51413        bulk
udp:6771         bulk
udp:6881-7000    bulk
udp:51413        bulk

# Usenet
tcp:119          bulk
tcp:563          bulk


# Zoom, Microsoft Teams, Skype and FaceTime (they use these same ports)
udp:3478-3497    multimedia_conferencing

# Zoom
dns:*zoom*       multimedia_conferencing
tcp:8801-8802    multimedia_conferencing
udp:8801-8810    multimedia_conferencing

# Skype
dns:*skype*      multimedia_conferencing

# FaceTime
udp:16384-16387  multimedia_conferencing
udp:16393-16402  multimedia_conferencing

# GoToMeeting
udp:1853         multimedia_conferencing
udp:8200         multimedia_conferencing

# Webex Meeting
tcp:5004         multimedia_conferencing
udp:9000         multimedia_conferencing

# Jitsi Meet
tcp:5349         multimedia_conferencing
udp:10000        multimedia_conferencing

# Google Meet
udp:19302-19309  multimedia_conferencing

# TeamViewer
tcp:5938         multimedia_conferencing
udp:5938         multimedia_conferencing

# Voice over Internet Protocol (VoIP)
tcp:5060-5061    telephony
udp:5060-5061    telephony

# Voice over WiFi or WiFi Calling (VoWiFi)
udp:500          telephony
udp:4500         telephony






# Live Streaming to YouTube Live, Twitch, Vimeo and LinkedIn Live
tcp:1935-1936    	broadcast_video
tcp:2396         	broadcast_video
tcp:2935         	broadcast_video

# Xbox
tcp:3074         	gaming
udp:88           	gaming
#udp:500         	gaming # UDP port already used in "VoWiFi" rules
udp:3074         	gaming
udp:3544         	gaming
#udp:4500        	gaming # UDP port already used in "VoWiFi" rules

# PlayStation
tcp:3478-3480    	gaming
#udp:3478-3479   	gaming # UDP ports already used in "Zoom" rules

# Call of Duty
#tcp:3074        	gaming # TCP port already used in "Xbox" rules
tcp:3075-3076    	gaming
#udp:3074        	gaming # UDP port already used in "Xbox" rules
udp:3075-3079    	gaming
udp:3658         	gaming


# FIFA
tcp:3659         	gaming
udp:3659         	gaming





# PlayStation Downloading DNS
dns:*.ps4.update.playstation.net		bulk
dns:*.ps5.update.playstation.net		bulk

# Gaming DNS

# Call of Duty Lobby/Joining Partys
dns:*.prod.demonware.net		gaming

# Tom Clancys Rainbow Six Siege
dns:*.online-services.aws.r6.ubi.com		gaming
dns:*.r6.ubi.com		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 mq 0: dev eth0 root
 Sent 195476103 bytes 613079 pkt (dropped 0, overlimits 0 requeues 41)
 backlog 0b 0p requeues 41
qdisc fq_codel 0: dev eth0 parent :8 limit 10240p flows 1024 quantum 1522 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 1522 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 1522 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 1522 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 1522 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 :3 limit 10240p flows 1024 quantum 1522 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 1522 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 1522 target                                                                                                                                                              5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 195476103 bytes 613079 pkt (dropped 0, overlimits 0 requeues 41)
 backlog 0b 0p requeues 41
  maxpacket 1522 drop_overlimit 0 new_flow_count 8 ecn_mark 0
  new_flows_len 0 old_flows_len 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 lan3 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 lan1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8003: dev wan root refcnt 2 bandwidth 20Mbit diffserv4 dual-srchost n                                                                                                                                                             at wash no-ack-filter split-gso rtt 100ms noatm overhead 18 mpu 64
 Sent 41593534 bytes 194964 pkt (dropped 52, overlimits 47850 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 1183488b of 4Mb
 capacity estimate: 20Mbit
 min/max network layer size:           28 /    1500
 min/max overhead-adjusted size:       64 /    1518
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh       1250Kbit       20Mbit       10Mbit        5Mbit
  target         14.5ms          5ms          5ms          5ms
  interval        110ms        100ms        100ms        100ms
  pk_delay       29.6ms       1.93ms        376us        369us
  av_delay       26.5ms        557us         27us         12us
  sp_delay          5us          1us          1us          2us
  backlog            0b           0b           0b           0b
  pkts             2233        34523        21873       136387
  bytes         3195452     12197475      3887836     22388833
  way_inds            0          142          112            2
  way_miss           14         2524         3985         4068
  way_cols            0            0            0            0
  drops              26           26            0            0
  marks               0            0            0            0
  ack_drop            0            0            0            0
  sp_flows            0            2            0            1
  bk_flows            0            0            1            0
  un_flows            0            0            0            0
  max_len          1514         8545         5920         1514
  quantum           300          610          305          300

qdisc clsact ffff: dev wan parent ffff:fff1
 Sent 283205430 bytes 607053 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev ifb-dns root refcnt 2 limit 10240p flows 1024 quantum 1514                                                                                                                                                              target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 535250 bytes 3024 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 mq 0: dev wlan1 root
 Sent 276662568 bytes 339340 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev wlan1 parent :4 limit 10240p flows 1024 quantum 1514 targe                                                                                                                                                             t 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 wlan1 parent :3 limit 10240p flows 1024 quantum 1514 targe                                                                                                                                                             t 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 269286403 bytes 305770 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 529 drop_overlimit 0 new_flow_count 10 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev wlan1 parent :2 limit 10240p flows 1024 quantum 1514 targe                                                                                                                                                             t 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 3943229 bytes 14756 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 wlan1 parent :1 limit 10240p flows 1024 quantum 1514 targe                                                                                                                                                             t 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 3432936 bytes 18814 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 8004: dev ifb-wan root refcnt 2 bandwidth 500Mbit diffserv4 dual-dsth                                                                                                                                                             ost nat nowash ingress no-ack-filter split-gso rtt 100ms noatm overhead 18 mpu 6                                                                                                                                                             4
 Sent 247027980 bytes 409016 pkt (dropped 0, overlimits 240725 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 206488b of 15140Kb
 capacity estimate: 500Mbit
 min/max network layer size:           46 /    1500
 min/max overhead-adjusted size:       64 /    1518
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh      31250Kbit      500Mbit      250Mbit      125Mbit
  target            5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms
  pk_delay         95us        116us         12us         33us
  av_delay         36us         50us          3us          5us
  sp_delay          1us          2us          1us          2us
  backlog            0b           0b           0b           0b
  pkts             1946       214872        17993       174205
  bytes          723128    215238097      5148907     25917848
  way_inds            0        31320           72            2
  way_miss          205         3484         1873         4174
  way_cols            0            0            0            0
  drops               0            0            0            0
  marks               0            0            0            0
  ack_drop            0            0            0            0
  sp_flows            1            0            0            1
  bk_flows            0            1            0            0
  un_flows            0            0            0            0
  max_len         10352        16654        13626         3028
  quantum           953         1514         1514         1514

qdisc clsact ffff: dev ifb-wan parent ffff:fff1
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0

Hi guys I have started using qosify,

Can anyone recommend a good config for DOCSIS? I am on VirginMedia uk FTTC

Thanks in advance

1 Like

The only thing specific for docsis to take care of is the per-packet-overhead and the MPU:
overhead 18 mpu 64 noatm
(noatm is the default and does not need to be specified, IIRC qosify actually allows to use cake's overhead keywords, so all you need to do is put docsis into the option overhead (or what it is called exactly).
For anything else I can not give any recommendation as I use neither qosify nor your ISP, and have zero information about your use-case and preferences... As a general rule however, try to up-prioritize as little traffic as possible, as that generally works more reliable (e.g. putting all traffic into a high priority bin has more or less the same effect as keeping all traffic in the default priority bin). Good luck!

5 Likes

My network topology: ISP router-> x86 OpenWRT router -> dumbAP Openwrt WiFi AP. My ISP provides me with a FTTC connection. I have been tinkering with Qosify to lower latency for latency sensitive applications. When compared with the SQM package that is also available, the SQM package seems to give me a quicker response to decrease bufferbloat when benchmarked on websites like Waveform and Fast and is easier to setup.

My question is whether any improvements could be made to my qosify configuration files to make Qosify work better? My qosy setup looks like this:

Etc/config/qosify

config defaults
	list defaults /etc/qosify/*.conf
	option dscp_icmp +besteffort
	option dscp_default_tcp unmarked_traffic
	option dscp_default_udp unmarked_traffic

config class unmarked_traffic
	option ingress CS1
	option egress CS1
	option prio_max_avg_pkt_len 1270
	option dscp_prio CS4
	option bulk_trigger_pps 600
	option bulk_trigger_timeout 10
	option dscp_bulk CS1

config class browsing
	option ingress CS0
	option egress CS0
	option prio_max_avg_pkt_len 575
	option dscp_prio AF31
	option bulk_trigger_pps 1000
	option bulk_trigger_timeout 10
	option dscp_bulk CS1

config class bulk
	option ingress CS1
	option egress CS1

config class besteffort
	option ingress CS0
	option egress CS0

config class network_services
	option ingress CS2
	option egress CS2

config class broadcast_video
	option ingress CS3
	option egress CS3

config class gaming
	option ingress CS4
	option egress CS4

config class multimedia_conferencing
	option ingress AF41
	option egress AF41

config class streaming
	option ingress AF32
	option egress AF32
	option prio_max_avg_pkt_len 575
	option dscp_prio AF31

config class telephony
	option ingress EF
	option egress EF

config interface wan
	option name wan
	option disabled 0
	option bandwidth_up 42mbit
	option bandwidth_down 850mbit
	option overhead_type docsis
	# defaults:
	option ingress 1
	option egress 1
	option mode diffserv4
	option nat 1
	option host_isolate 1
	option autorate_ingress 0
	option ingress_options "dual-dsthost ether-vlan nat ingress"
	option egress_options "wash"
	option options ""

config device wandev
	option disabled 1
	option name wan
	option bandwidth 850mbit

Etc/qosify/00-defaults
# HTTP/HTTPS/QUIC
tcp:80    browsing
tcp:443   browsing
udp:80    browsing
udp:443   browsing

dns:*.cloudfront.net* 			streaming
dns:*.akamaiedge.net* 			streaming 
dns:*.demonware.net* 			gaming
dns:*.choopa.net* 			gaming
dns:*.activision.com* 			streaming
dns:*.vultrusercontent.com* 		gaming
dns:*.eu-central-1.compute.amazonaws.com* gaming
dns:*.eu-west-1.compute.amazonaws.com* gaming
dns:*.eu-west-2.compute.amazonaws.com* gaming
dns:*.eu-west-3.compute.amazonaws.com* gaming
dns:*.eu-north-1.compute.amazonaws.com* gaming
dns:*.eu-south-1.compute.amazonaws.com* gaming




# Microsoft (Download)
dns:*1drv*                 bulk
dns:*backblaze*            bulk
dns:*backblazeb2*          bulk
dns:*ms-acdc.office*       bulk
dns:*onedrive*             bulk
dns:*sharepoint*           bulk
dns:*update.microsoft*     bulk
dns:*windowsupdate*        bulk

# MEGA (Download)
dns:*mega*                 bulk

# Dropbox (Download)
dns:*dropboxusercontent*   bulk

# Google (Download)
dns:*drive.google*         bulk
dns:*googleusercontent*    bulk

# Steam (Download)
dns:*steamcontent*         bulk

# Epic Games (Download)
dns:*download.epicgames*   bulk
dns:*download2.epicgames*  bulk
dns:*download3.epicgames*  bulk
dns:*download4.epicgames*  bulk
dns:*epicgames-download1*  bulk

# BitTorrent
tcp:6881-7000    bulk
tcp:51413        bulk
udp:6771         bulk
udp:6881-7000    bulk
udp:51413        bulk

# Usenet
tcp:119          bulk
tcp:563          bulk


# YouTube
dns:*googlevideo*   besteffort

# Facebook
dns:*fbcdn*         besteffort

# Twitch
dns:*ttvnw*         besteffort

# TikTok
dns:*tiktok*        besteffort

# Netflix
dns:*nflxvideo*     besteffort

# Amazon Prime Video
dns:*aiv-cdn*       besteffort
dns:*aiv-delivery*  besteffort
dns:*pv-cdn*        besteffort

# Disney Plus
dns:*disney*        besteffort
dns:*dssott*        besteffort

# HBO
dns:*hbo*           besteffort
dns:*hbomaxcdn*     besteffort




# SSH
tcp:22    network_services

# NTP
udp:123   network_services

# DNS
tcp:5054    network_services
tcp:5053  network_services
udp:5054    network_services
udp:5053  network_services

My SQM settings look like this:



Advanced settings:

diffserv4 dual-dsthost ether-vlan nat ingress
diffserv4 dual-srchost ether-vlan nat mpu 72 ack-filter

image

You can check DSCPCLASSIFY it's similar to Qosify and you get to use sqm with it

1 Like

If you are using Qosify, you need to disable SQM. Qosify creates and manages qdisc automatically.

Nitpick, you can use SQM and qosify in parallel just fine (at least that is the goal) but not on the same interface(s). So qosify on WAN and sqm on br-lan should work (not that this is a generally recommended set-up).

Your SQM settings are using the piece of cake script, which doesn’t put traffic into different tins. It requires less CPU power.

But QoSify uses the equivalent of the layer cake script.

So to have an equal comparison you should re-test with the layer cake test.

If you get the same “low” performance as with QoSify, then perhaps your router is too slow to handle SQM with traffic tins at your bandwidth.

If you get higher performance, then perhaps the issue is related to QoSify or the used rules.

I am only running one ot the other at a time. I am simply putting both configurations up for analysis.

Blockquote So to have an equal comparison you should re-test with the layer cake test.

Fair point. I have retested SQM with Layer Cake and my results are very similar to SQM with Piece of Cake. Results below:

Blockquote If you get the same “low” performance as with QoSify, then perhaps your router is too slow to handle SQM with traffic tins at your bandwidth.

Not being able to handle the bandwidth would be odd on a x86 i7 Intel-based processor, even if Qosify only relies on single threads.

The underlaying cake qdiscs are only running on one processor (each) IIRC due to the qdisc lock or something...

That looks promising. Thanks for the suggestion.

1 Like

@nbd I have found what seems like a bug. Curious if you've seen this one before.

I intentionally have been attempting to run qosify with egress shaping disabled (option egress 0). However, this inhibits the proper establishment of the qdisc on my WAN interface after a reboot. Here is the error I see:

root@OpenWrt:~# logread -e qosify
Sun Feb 26 16:01:25 2023 daemon.info qosify: start interface eth0
Sun Feb 26 16:01:25 2023 daemon.err qosify: Netlink error(-22): Parent Qdisc doesn't exists
Sun Feb 26 16:01:25 2023 daemon.warn qosify: Command: tc filter add dev 'eth0' ingress prio 273 protocol ip u32 match ip sport 53 0xffff flowid 1:1 action mirred egress redirect dev ifb-dns
Sun Feb 26 16:01:25 2023 daemon.warn qosify: RTNETLINK answers: Invalid argument
Sun Feb 26 16:01:25 2023 daemon.warn qosify: We have an error talking to the kernel
Sun Feb 26 16:01:25 2023 daemon.warn qosify: Command: tc filter add dev 'eth0' ingress prio 274 protocol 802.1Q u32 offset plus 4 match ip sport 53 0xffff flowid 1:1 action mirred egress redirect dev ifb-dns
Sun Feb 26 16:01:25 2023 daemon.warn qosify: RTNETLINK answers: Invalid argument
Sun Feb 26 16:01:25 2023 daemon.warn qosify: We have an error talking to the kernel
Sun Feb 26 16:01:25 2023 daemon.warn qosify: Command: tc filter add dev 'eth0' ingress prio 275 protocol ipv6 u32 match ip6 sport 53 0xffff flowid 1:1 action mirred egress redirect dev ifb-dns
Sun Feb 26 16:01:25 2023 daemon.warn qosify: RTNETLINK answers: Invalid argument
Sun Feb 26 16:01:25 2023 daemon.warn qosify: We have an error talking to the kernel
Sun Feb 26 16:01:25 2023 daemon.warn qosify: Command: tc filter add dev 'eth0' ingress prio 276 protocol ipv6 u32 offset plus 4 match ip6 sport 53 0xffff flowid 1:1 action mirred egress redirect dev ifb-dns
Sun Feb 26 16:01:25 2023 daemon.warn qosify: RTNETLINK answers: Invalid argument
Sun Feb 26 16:01:25 2023 daemon.warn qosify: We have an error talking to the kernel
Sun Feb 26 16:01:25 2023 daemon.warn qosify: Command: tc filter add dev 'eth0' ingress prio 277 protocol all u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev 'ifb-eth0'
Sun Feb 26 16:01:25 2023 daemon.warn qosify: RTNETLINK answers: Invalid argument
Sun Feb 26 16:01:25 2023 daemon.warn qosify: We have an error talking to the kernel

If I set option egress 1 and restart qosify, I get no errors and both ingress and egress are shaped. Further, if I set option egress 0 again, then restart qosify, it properly adds the shaping to my ingress (and not egress, per my intent) without the error above.

Once I reboot, if option egress 0 is set, I end up in the same boat again with the error above.

Any suggestions I can try?

Relevant Qosify Config
...
config interface WAN
	option name WAN
	option disabled 0
	option bandwidth_up 1000mbit
	option bandwidth_down 1000mbit
	option overhead_type none
	# defaults:
	option ingress 1
	option egress 0
	option mode diffserv4
	option nat 1
	option host_isolate 1
	option autorate_ingress 0
	option ingress_options ""
	option egress_options ""
	option options "overhead 44 mpu 84"
	#option options ""
OS Release Info
root@OpenWrt:~# cat /etc/os-release
NAME="OpenWrt"
VERSION="SNAPSHOT"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt SNAPSHOT"
VERSION_ID="snapshot"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r22153-107f7374c9"
OPENWRT_BOARD="x86/64"
OPENWRT_ARCH="x86_64"
OPENWRT_TAINTS="no-all busybox"
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt SNAPSHOT r22153-107f7374c9"
1 Like

You might also consider cake-qos-simple:

It's a template for setting up CAKE with DSCP handling using 'tc' and 'nftables' including DSCP restoration from conntrack on download.

2 Likes

Based on current behavior I am seeing, it seems qosify still relies on dnsmasq to correctly classify DNS domains.

I use NextDNS as my upstream DNS provider and have the NextDNS client on my Openwrt router/firewall device. When it is configured to listen on port 53, I do not see any of my DNS classifications taking effect. Only after I switch back to dnsmasq listening on port 53 (and forwarding to NextDNS client on an alternate port) do I see the classifications applied.

Is anyone else noticing the same?

It’s sniffing plain dns packets coming in on the WAN (ifb-dns). If you’re encrypting with NextDNS it won’t see anything.

1 Like

That makes sense, though I'm having trouble wrapping my head around why it works to have:

dnsmasq --> (unencrypted queries) --> NextDNS client --> (encrypted queries) --> WAN

In my scenario, is qosify sniffing in another location?

1 Like

Can qosify work with adguardhome? Since AGH DNS port is set to 53 and I think DSCP marking isn't working since then

Is anyone hitting an issue with qosify failing to start after a recent (perhaps last week?) snapshot build?

When I try to start/restart qosify, it seems to hang for a few seconds and then returns "Command failed: Not found" to the console:

root@OpenWrt:~# ubus call system board
{
	"kernel": "5.15.98",
	"hostname": "OpenWrt",
	"system": "Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz",
	"model": "Dell Inc. OptiPlex 7010",
	"board_name": "dell-inc-optiplex-7010",
	"rootfs_type": "ext4",
	"release": {
		"distribution": "OpenWrt",
		"version": "SNAPSHOT",
		"revision": "r22235-a03076cc39",
		"target": "x86/64",
		"description": "OpenWrt SNAPSHOT r22235-a03076cc39"
	}
}

root@OpenWrt:~# time service qosify restart
Command failed: Request timed out

real	0m10.026s
user	0m0.016s
sys	0m0.000s

root@OpenWrt:~# service qosify status
running

root@OpenWrt:~# ubus -v list qosify
Command failed: Not found

root@OpenWrt:~# service qosify stop && service qosify start
Command failed: Not found
Command failed: Request timed out

root@OpenWrt:~# ps -aux | grep qosify
root      3177 98.6  0.0   1532  1264 ?        R    13:52   0:19 /usr/sbin/qosify
root      3670  0.0  0.0   1188   848 pts/1    S+   13:52   0:00 grep qosify

root@OpenWrt:~# qosify-status
Command failed: Not found
Failed to parse message data
===== device : not found =====
===== interface : not found =====

It appears to lock up a CPU core:

If I just run qosify, I see this output while the CPU core is locked up:

root@OpenWrt:~# qosify
libbpf: loading /lib/bpf/qosify-bpf.o
libbpf: elf: section(3) tc, size 3376, link 0, flags 6, type=1
libbpf: sec 'tc': found program 'classify' at insn offset 0 (0 bytes), code size 422 insns (3376 bytes)
libbpf: elf: section(4) .reltc, size 208, link 12, flags 40, type=9
libbpf: elf: section(5) .rodata, size 4, link 0, flags 2, type=1
libbpf: elf: section(6) license, size 4, link 0, flags 3, type=1
libbpf: license of /lib/bpf/qosify-bpf.o is GPL
libbpf: elf: section(7) .maps, size 296, link 0, flags 3, type=1
libbpf: elf: section(8) .BTF, size 6543, link 0, flags 0, type=1
libbpf: elf: section(10) .BTF.ext, size 3456, link 0, flags 0, type=1
libbpf: elf: section(12) .symtab, size 1488, link 1, flags 0, type=2
libbpf: looking for externs among 62 symbols...
libbpf: collected 0 externs total
libbpf: map 'config': at sec_idx 7, offset 0.
libbpf: map 'config': found type = 2.
libbpf: map 'config': found key [8], sz = 4.
libbpf: map 'config': found value [11], sz = 1.
libbpf: map 'config': found max_entries = 1.
libbpf: map 'config': found pinning = 1.
libbpf: map 'tcp_ports': at sec_idx 7, offset 40.
libbpf: map 'tcp_ports': found type = 2.
libbpf: map 'tcp_ports': found key [8], sz = 4.
libbpf: map 'tcp_ports': found value [14], sz = 1.
libbpf: map 'tcp_ports': found max_entries = 65536.
libbpf: map 'tcp_ports': found pinning = 1.
libbpf: map 'udp_ports': at sec_idx 7, offset 80.
libbpf: map 'udp_ports': found type = 2.
libbpf: map 'udp_ports': found key [8], sz = 4.
libbpf: map 'udp_ports': found value [14], sz = 1.
libbpf: map 'udp_ports': found max_entries = 65536.
libbpf: map 'udp_ports': found pinning = 1.
libbpf: map 'flow_map': at sec_idx 7, offset 120.
libbpf: map 'flow_map': found type = 9.
libbpf: map 'flow_map': found key [8], sz = 4.
libbpf: map 'flow_map': found value [28], sz = 16.
libbpf: map 'flow_map': found max_entries = 8192.
libbpf: map 'flow_map': found pinning = 1.
libbpf: map 'ipv4_map': at sec_idx 7, offset 160.
libbpf: map 'ipv4_map': found type = 1.
libbpf: map 'ipv4_map': found key_size = 4.
libbpf: map 'ipv4_map': found value [36], sz = 2.
libbpf: map 'ipv4_map': found max_entries = 100000.
libbpf: map 'ipv4_map': found map_flags = 0x1.
libbpf: map 'ipv4_map': found pinning = 1.
libbpf: map 'ipv6_map': at sec_idx 7, offset 208.
libbpf: map 'ipv6_map': found type = 1.
libbpf: map 'ipv6_map': found key_size = 16.
libbpf: map 'ipv6_map': found value [36], sz = 2.
libbpf: map 'ipv6_map': found max_entries = 100000.
libbpf: map 'ipv6_map': found map_flags = 0x1.
libbpf: map 'ipv6_map': found pinning = 1.
libbpf: map 'class_map': at sec_idx 7, offset 256.
libbpf: map 'class_map': found type = 2.
libbpf: map 'class_map': found key [8], sz = 4.
libbpf: map 'class_map': found value [46], sz = 12.
libbpf: map 'class_map': found max_entries = 18.
libbpf: map 'class_map': found pinning = 1.
libbpf: map 'qosify_b.rodata' (global data): at sec_idx 5, offset 0, flags 80.
libbpf: map 7 is "qosify_b.rodata"
libbpf: sec '.reltc': collecting relocation for section(3) 'tc'
libbpf: sec '.reltc': relo #0: insn #1 against '.rodata'
libbpf: prog 'classify': found data map 7 (qosify_b.rodata, sec 5, off 0) for insn 1
libbpf: sec '.reltc': relo #1: insn #8 against 'config'
libbpf: prog 'classify': found map 0 (config, sec 7, off 0) for insn #8
libbpf: sec '.reltc': relo #2: insn #59 against 'tcp_ports'
libbpf: prog 'classify': found map 1 (tcp_ports, sec 7, off 40) for insn #59
libbpf: sec '.reltc': relo #3: insn #65 against 'udp_ports'
libbpf: prog 'classify': found map 2 (udp_ports, sec 7, off 80) for insn #65
libbpf: sec '.reltc': relo #4: insn #73 against 'ipv6_map'
libbpf: prog 'classify': found map 5 (ipv6_map, sec 7, off 208) for insn #73
libbpf: sec '.reltc': relo #5: insn #197 against 'tcp_ports'
libbpf: prog 'classify': found map 1 (tcp_ports, sec 7, off 40) for insn #197
libbpf: sec '.reltc': relo #6: insn #203 against 'udp_ports'
libbpf: prog 'classify': found map 2 (udp_ports, sec 7, off 80) for insn #203
libbpf: sec '.reltc': relo #7: insn #217 against 'ipv4_map'
libbpf: prog 'classify': found map 4 (ipv4_map, sec 7, off 160) for insn #217
libbpf: sec '.reltc': relo #8: insn #232 against 'class_map'
libbpf: prog 'classify': found map 6 (class_map, sec 7, off 256) for insn #232
libbpf: sec '.reltc': relo #9: insn #256 against 'flow_map'
libbpf: prog 'classify': found map 3 (flow_map, sec 7, off 120) for insn #256
libbpf: sec '.reltc': relo #10: insn #269 against 'flow_map'
libbpf: prog 'classify': found map 3 (flow_map, sec 7, off 120) for insn #269
libbpf: sec '.reltc': relo #11: insn #275 against 'flow_map'
libbpf: prog 'classify': found map 3 (flow_map, sec 7, off 120) for insn #275
libbpf: sec '.reltc': relo #12: insn #362 against 'class_map'
libbpf: prog 'classify': found map 6 (class_map, sec 7, off 256) for insn #362
libbpf: found no pinned map to reuse at '/sys/fs/bpf/qosify_data/config'
libbpf: map 'config': created successfully, fd=4
libbpf: pinned map '/sys/fs/bpf/qosify_data/config'
libbpf: found no pinned map to reuse at '/sys/fs/bpf/qosify_data/tcp_ports'
libbpf: map 'tcp_ports': created successfully, fd=5
libbpf: pinned map '/sys/fs/bpf/qosify_data/tcp_ports'
libbpf: found no pinned map to reuse at '/sys/fs/bpf/qosify_data/udp_ports'
libbpf: map 'udp_ports': created successfully, fd=6
libbpf: pinned map '/sys/fs/bpf/qosify_data/udp_ports'
libbpf: found no pinned map to reuse at '/sys/fs/bpf/qosify_data/flow_map'
libbpf: map 'flow_map': created successfully, fd=7
libbpf: pinned map '/sys/fs/bpf/qosify_data/flow_map'
libbpf: found no pinned map to reuse at '/sys/fs/bpf/qosify_data/ipv4_map'
libbpf: Error in bpf_create_map_xattr(ipv4_map):Invalid argument(-22). Retrying without BTF.
libbpf: map 'ipv4_map': created successfully, fd=8
libbpf: pinned map '/sys/fs/bpf/qosify_data/ipv4_map'
libbpf: found no pinned map to reuse at '/sys/fs/bpf/qosify_data/ipv6_map'
libbpf: Error in bpf_create_map_xattr(ipv6_map):Invalid argument(-22). Retrying without BTF.
libbpf: map 'ipv6_map': created successfully, fd=9
libbpf: pinned map '/sys/fs/bpf/qosify_data/ipv6_map'
libbpf: found no pinned map to reuse at '/sys/fs/bpf/qosify_data/class_map'
libbpf: map 'class_map': created successfully, fd=10
libbpf: pinned map '/sys/fs/bpf/qosify_data/class_map'
libbpf: map 'qosify_b.rodata': created successfully, fd=11
Qosify Config
config defaults
	list defaults /etc/qosify/*.conf
	option dscp_prio video
	option dscp_icmp +besteffort
	option dscp_default_udp besteffort
	option prio_max_avg_pkt_len 500

config class besteffort
	option ingress CS0
	option egress +CS0

config class bulk
	option ingress LE
	option egress LE

config class video
	option ingress AF41
	option egress AF41

config class voice
	option ingress CS6
	option egress CS6
	option bulk_trigger_pps 100
	option bulk_trigger_timeout 5
	option dscp_bulk CS0

config interface WAN
	option name WAN
	option disabled 0
	option bandwidth_up 1000mbit
	option bandwidth_down 1000mbit
	option overhead_type none
	# defaults:
	option ingress 1
	option egress 1
	option mode diffserv4
	option nat 1
	option host_isolate 1
	option autorate_ingress 0
	option ingress_options ""
	option egress_options ""
	option options "overhead 44 mpu 84"
	#option options ""