-
Notifications
You must be signed in to change notification settings - Fork 17
qos sqm package
opkg update && opkg install qos-sqm
Dependencies: ancistrus-core
( >= 1.5.0 )
Binaries included: ip, tc
GUI section: Networking
Nvram variables: many
(see next)
Qdiscs available: fq_codel, sfq
Shapers available: htb, hfsc, tbf
KO modules included: sch_fq_codel, sch_hfsc, act_ipt, cls_flow
This package is a fork of sqm-scripts CeroWrt project, created to minimize buffer-bloat and other stuffs.
Adapted for this router to minimize its buffer-bloat issue.
It includes the installation of iproute2 package ( with necessary patches) supporting fq_codel algorithm and other needed features.
It completely substitutes the builtin qos stuff and supports both ingress and egress modes.
It includes also: sch_fq_codel, sch_hfsc, act_ipt, cls_flow kernel modules (see the repository code).
It supports also IPV6 if enabled on router.
Some Docs:
https://github.com/tohojo/sqm-scripts
https://github.com/guidosarducci/sqm-scripts
https://openwrt.org/docs/guide-user/network/traffic-shaping/sqm-details#troubleshooting_sqm
https://www.bufferbloat.net/projects/cerowrt/wiki/Smart_Queue_Management/
https://wiki.linuxfoundation.org/networking/iproute2
https://www.systutorials.com/docs/linux/man/8-tc-fq_codel/
/usr/sbin/rc_app/rc_qos <start restart startforced restartforced stop details stats reset help> (<debug>) (<verbose>)
Used in conjuntion with general netgear code builtin command rc qos
including startup .
rc qos start - stop and start qos-sqm (if qos enable) : remove qdisc class filter & netfilter rules then build them all.
rc qos restart - same as rc qos start
.
rc qos stop - stop qos-sqm: remove qdisc class filter & netfilter rules.
rc_qos startforced - stop and start qos-sqm anyway without checking qos_enable
nvram setting.
rc_qos restartforced - same as startforced
.
rc_qos details - show sqm details.
rc_qos stats - show sqm statistics.
rc_qos reset - turn off qos-sqm, reset original qos vars to default & unset qos-sqm vars.
rc_qos help - help usage instructions.
To debug the scripts, in addition with previous there are this 2 last options ( use as lasts in order ):
debug: during scripts execution it creates a debug temporary file /tmp/qosdebug.log
for debug purpose usage.
verbose: used only in addition with debug parameter it shows pedantic messages during scripts execution.
A selection of the main settings is available on the web gui at the path: Ancistrus -> Networking -> QOS-SQM
Each setting redirects here on the related paragraph.
Press Cancel
to discard changes.
Press Reset
to stop & reset qos-sqm to default.
Press Details
to show qos-sqm details.
Press Stats
to show qos-sqm statistics.
Press Apply
to save settings & apply changes.
N.B.: the class settings and services present in the original web gui page won't affect qos-sqm: it doesn't need to use the NG original classification method because it uses a more reliable DSCP filtering classification method.
There are many settings, but the main are generally the most important to know and to be modified for best usage.
Options available
' 0 ': disable qos
' 1 ': enable qos
(Default: 0).
Real Uplink Bandwidth (no bearer, no max): it can be discovered with 'speedtest' or with network-test package (Speed Test) script. It is the most important parameter: bad setting may bring to qos failure. Setup to ' 0 ' to disable qos uplink capability.
(Default: 512).
Upload rate unit. Note that as in pure SI-prefix notation: Mbps=1000*Kbps
.
GUI: when changing this selection, the web gui does the above conversion and sets rate value properly. In case of non integer result value, it rounds to the integer part of the value.
Options available
' Kbps ': kilobits per second.
' Mbps ': megabits per second.
(Default: Kbps).
Real Downlink Bandwidth: as before. Setup to ' 0 ' to disable qos downlink capability.
(Default: 0 = download qos disabled).
Download rate unit. Note that as in pure SI-prefix notation: Mbps=1000*Kbps
.
GUI: when changing this selection, the web gui does the above conversion and sets rate value properly. In case of non integer result value, it rounds to the integer part of the value.
Options available
' Kbps ': kilobits per second.
' Mbps ': megabits per second.
(Default: Kbps).
Link layer adaptation: wan connection proper overheads calculation.
GUI: at first usage or after pressing Reset
button, the web gui should recognize and set this configuration properly.
Options available
' ptm ': VDSL connections.
' ethernet ': True Ethernet connections (Link, Cable).
' atm ': ADSL connections.
' none ': FTTH fiber, direct LAN, or Other connections.
(Default: none).
Frame compensation profile settings.
This setting is related to web GUI configuration panel only.
GUI: at first usage or after pressing Reset
button, according to Link Layer above setting, the web gui should set the first profile available for the related Link Layer.
Choose the wan connection type related profile for the next link layer related settings: qos_overhead
, qos_stab_mtu
, qos_stab_tsize
, qos_stab_mpu
.
Note that the available profiles are strictly related to the Link Layer adaptation value.
If the frame compensation profile is unknown or the related link layer settings are different due to ISP tunings & adaptations, select: Personal
(own
) and setup the next link layer related settings manually.
(Default: own=' Personal ').
Per-packet size overhead: can be negative and ISP dependent. Range possibile is [ -64 - 256 ]
.
This setting may depend from the wan connection type and from the ISP.
GUI: when selecting the appropriate Frame Compensation Profile, the web gui fills the related Per-Packet Overhead value. This value can be modified if needed and the Frame Compensation Profile will be switched to Personal
.
Typical values
' ptm ' Link Layer: 30 bytes on pppoe-ptm
, 22 bytes on bridged-ptm
.
' ethernet ' Link Layer: 38 bytes on ethernet link
, 18 on cable link
.
' atm ' Link Layer: values may vary depending on wan atm connection type; better tuning may be done with ATM overhead detector script.
' none ' Link Layer: this setting is not active.
(Default: 0).
Max packet size creating size table for (bytes).
GUI: when selecting the appropriate Frame Compensation Profile, the web gui fills the related Size Table MTU value. This value can be modified if needed in particular in case of wan mtu >> 1500 and the Frame Compensation Profile will be switched to Personal
.
Typical values
' ptm ', ' ethernet ' and ' atm ' Link Layers: value must be >= ( wan_mtu + qos_overhead )
.
' none ' Link Layer: this setting is not active.
(Default: 2047).
Number of entries in size/rates table (slots).
GUI: when selecting the appropriate Frame Compensation Profile, the web gui fills the related Required Table Size value. This value can be modified if needed and the Frame Compensation Profile will be switched to Personal
.
Typical values
' ptm ' and ' ethernet ' Link Layers: the default value can be used.
' atm ' Link Layer: value is (qos_stab_mtu + 1) / 16
(typically 128) .
' none ' Link Layer: this setting is not active.
(Default: 512).
Min packet size used (bytes). Range possibile is [ 0 - 256 ]
.
GUI: when selecting the appropriate Frame Compensation Profile, the web gui fills the related Size Table MPU value. This value can be modified if needed and the Frame Compensation Profile will be switched to Personal
.
Typical values
' ptm ' Link Layer: value must be > 0
(64 is recommended).
' ethernet ' Link Layer: value must be > 0
(64 is recommended for link ethernet
and 84 for cable ethernet
).
' atm ' Link Layer: generally not required (0) with exceptions depending from ISP.
' none ' Link Layer: this setting is not active.
(Default: 0).
The qos disc sched algorithm used.
Options available
' fq_codel ': is the recommended for most usage. Choosing this option, next hfsc shaper will be unavailable.
' sfq ': the old algorithm used by 36_42n firmware. Choosing this option, next ECN settings will be unavailable.
(Default: fq_codel).
The qos shaper sched algorithm used.
Options available
' htb ': is the recommended for most usage.
' hfsc ': best combined with sfq qdisc, but unavailable with fq_codel qdisc due possible incompatibilities.
' tbf ': one of the simplest algos. This shaper is classless (no DSCP settings available).
(Default: htb).
Egress prioritization scheme.
Options available
For htb, hfsc shapers:
' shaper ': acting as a shaper (only).
' classful ': use of classful priority tiers.
' diffserv3 ': diffserv priority scheme is supported.
For tbf shaper value can only be: shaper (setting will be adjusted automatically at runtime).
To obtain DSCP egress availability a classfull method ( classfull, diffserv3 ) must be selected.
(Default: diffserv3).
Ingress prioritization scheme.
Options available
For htb, hfsc shapers:
' shaper ': acting as a shaper (only).
' classful ': use of classful priority tiers.
' diffserv3 ': diffserv priority scheme is supported.
For tbf shaper value can only be: shaper (setting will be adjusted automatically at runtime).
To obtain DSCP ingress availability a classfull method ( classfull, diffserv3 ) must be selected.
(Default: diffserv3).
Choose the priority scheme strategy. Note that DSCP filtering can be performed with diffserv prioritization scheme only (htb, hfsc shapers).
Options available
' 1 ': Undifferentiated Priority, do not perform DSCP based filtering on egress (1-tier classification).
' 0 ': N-Tier Priority, perform DSCP based filtering on egress (n-tier classification).
(Default: 0).
Choose the priority scheme strategy. Note that DSCP filtering can be performed with diffserv prioritization scheme only (htb, hfsc shapers).
Options available
' 1 ': Undifferentiated Priority, do not perform DSCP based filtering on ingress (1-tier classification).
' 0 ': N-Tier Priority, perform DSCP based filtering on ingress (n-tier classification).
(Default: 1).
Egress Explicit Congestion Notification.
It's recommended to set ECN on high uplink rates (VDSL connections) and NOECN on low uplink rates (ADSL connections). Note that this option is not available in conjunction with classless shapers (sfq).
Options available
' ECN ': egress ECN on.
' NOECN ': egress ECN off.
(Default: NOECN).
Ingress Explicit Congestion Notification.
It's recommended to set ECN to notify congestions to local hosts before starting to drop packets. Note that this option is not available in conjunction with classless shapers (sfq).
Options available
' ECN ': ingress ECN on.
' NOECN ': ingress ECN off.
(Default: ECN).
Use a personal qos script instead of builtin. Scripts must have .sqm
extension and must have compatible content. (see qos-sqm documentation).
Scripts must be located at: /usr/sbin/scripts
location.
Note that old legacy scripts: simple.qos, simplest.qos, simplest_tbf.qos are embedded now.
GUI: select the personal qos script and press Install
.
If already installed, type the exact name of the script in use (included .sqm extension) in the Personal QOS Script Name box above; finally, press Apply
on the top of the page to apply changes.
To remove the personal script in use, delete the Personal QOS Script Name box content then press Apply
on the top of the page to apply changes.
(Default: void).
Default values should commonly satisfy: change them only if you know what to do. Consider that ingress=download, egress=upload.
Link layer adjustment method.
Options available
' htb_private ' : htb fixed table size of 256.
' tc_stab ': generic size table manipulations.
(Default: default=' tc_stab ').
Options available
' 1 ': limit the number of flows.
' 0 ': the default of 1024 will be used for fq_codel qdiscs.
(Default: 0).
Iptables mask. To disable: set mask to 0xffffffff .
(Default: 0xff).
Global queue size hard limit.
(Default: 1001).
Egress queue size limit.
(Default: void).
Ingress queue size limit.
(Default: void).
Egress minimum queue delay target.
(Default: void).
Ingress minimum queue delay target.
(Default: void).
Used in conjunction with fq_codel disc only: target of 5ms is good for fast links, in the worst cases it depends from dw bandwidth and it is recalculated.
(Default: 5ms).
Setup the egress shaper burst duration (us
) to leap over CPU interrupts when the CPU is severly loaded. Setting this value to 0, in conjunction with htb shaper, allows default burst of the ATM/AAL5 expanded mtu packet with overhead.
(Default: 1000).
Setup the ingress shaper burst duration (us
) to leap over CPU interrupts when the CPU is severly loaded. Setting this value to 0, in conjunction with htb shaper, allows default burst of the ATM/AAL5 expanded mtu packet with overhead.
(Default: 1000).
Setup the egress shaper quantum duration (us
).
This checks how many bytes htb tries to deque from the current tier before switching to the next to lower CPU cost. In first approximation this value should be <= qos_eshaper_burst_dur
.
(Default: 1000).
Setup the ingress shaper quantum duration (us
).
This checks how many bytes htb tries to deque from the current tier before switching to the next to lower CPU cost. In first approximation this value should be <= qos_ishaper_burst_dur
.
(Default: 1000).
Other defined egress qdisc options.
(Default: void).
Other defined ingress qdisc options.
(Default: void).
Legacy option to mantain retrocompatibility with old configs.
Options available
' 1 ': squashing differentiated services code points (DSCP) on egress.
' 0 ': keeping differentiated services code points (DSCP) on egress.
(Default: 1).
Legacy option to mantain retrocompatibility with old configs.
Options available
' 1 ': squashing differentiated services code points (DSCP) from ingress
' 0 ': keeping differentiated services code points (DSCP) from ingress.
(Default: 1).
All settings can be setup at once with:
anc nvram set qos_enable 1 qos_uplink_rate 400 qos_dwlink_rate 15000 ... VARN VALN
.
Finally, settings must be stored permanently with:
anc nvram commit
or nvram commit
.
They can also be setup singularly with:
anc nvram set qos_enable 1
anc nvram set qos_uplink_rate 400
anc nvram set qos_dwlink_rate 15000
...
anc nvram set VARN VALN
anc nvram commit
.
To empty a setting, reverting it to its default value, type:
anc nvram set VARN ""
anc nvram commit
.
Or as well, to remove a setting completely, reverting it to its default value, type:
anc nvram unset VARN
anc nvram commit
.
Reload then qos-sqm by typing:
rc qos restart
If you wanna look for previously stored value, type:
anc nvram get qos_enable qos_uplink_rate qos_dwlink_rate ... VARN
or singularly with:
anc nvram get qos_enable
anc nvram get qos_uplink_rate
anc nvram get qos_dwlink_rate
...
anc nvram get VARN
.