From face940b4076edb5678a4daffff8160dfd367fca Mon Sep 17 00:00:00 2001 From: rickk Date: Fri, 17 Feb 2023 20:05:25 +0100 Subject: [PATCH] updated readme and comments in script --- README.md | 37 ++++++++++++++-------- files/usr/lib/sqm/nss-rk.qos | 53 ++++++++++++++++---------------- openwrt/sqm-scripts-nss/Makefile | 4 +-- 3 files changed, 52 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 4947d88..a6d03d4 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,39 @@ Currently only supports nssfq-codel and no traffic classification / marking due ## Requirements -* An SQM enabled build such as https://github.com/ACwifidude/openwrt +* An SQM enabled OpenWRT build such as https://github.com/ACwifidude/openwrt * sqm-scripts package * luci-app-sqm package (for configuration from the GUI) -## Manual Installation +## Installation + +### Package Installation + +* Download the .ipk package file here +* Go to the System -> Software menu on your router and upload the .ipk package file + +### Manual Installation + +* Just copy the nss-rk.qos and nss-rk.qos.help files to /usr/lib/sqm on your router + +### Installation via feeds + +If you're building OpenWRT yourselves, you can add this script to your build with a feed: + + echo "src-git sqm_scripts_nss https://github.com/rickkdotnet/sqm-scripts-nss.git >> feeds.conf + ./scripts/feeds update + ./scripts/feeds install sqm-scripts-nss + + Now you can find the script in menuconfig under 'Extra packages'. + +## Configuration -* Just copy the nss.qos and nss.qos.help files to /usr/lib/sqm on your router * Go to Network -> SQM QoS in luci * Add a a queue or change your existing one * Select your physical uplink interface (usually eth0) * Sheck the 'enable this SQM instance' checkbox * Enter your down and upload speeds, 95% of your actual line speed is a good ballpark figure -* Go to the queue discipline tab and select "fq_codel" as discipline and and "nss.qos" for the script +* Go to the queue discipline tab and select "fq_codel" as discipline and and "nss-rk.qos" for the script * Configure other parameters if you want, although the defaults should work well. If you like to play with the codel interval, you can do by entering 'interval XXms' in the 'advanced option string'. * Click "save and apply" @@ -47,15 +67,6 @@ If it's working the output from tc should look something like this: maxpacket 1518 drop_overlimit 0 new_flow_count 5081 ecn_mark 0 new_flows_len 0 old_flows_len 1 -## Installation via feeds - -If you're building OpenWRT yourselves, you can add this script to your build with a feed: - - echo "src-git sqm_scripts_nss https://github.com/rickkdotnet/sqm-scripts-nss.git >> feeds.conf - ./scripts/feeds update - ./scripts/feeds install sqm-scripts-nss - - Now you can find the script in menuconfig under 'Extra packages'. ## Known bugs, limitations diff --git a/files/usr/lib/sqm/nss-rk.qos b/files/usr/lib/sqm/nss-rk.qos index 6a9ec38..1e14209 100644 --- a/files/usr/lib/sqm/nss-rk.qos +++ b/files/usr/lib/sqm/nss-rk.qos @@ -1,21 +1,22 @@ ################################################################################ -# nss.qos (HW Accelerated Simple Traffic Shaper) -# version 20230217a +# nss-rk.qos (HW Accelerated Simple Traffic Shaper) +# version 20230217b # # sqm script to use the NSS accelerated nssfq_codel qdisc # -# Based on https://github.com/ricsc/sqm-scripts/blob/master/src/nss.qos -# and simple.qos. +# Based on simple.qos and nss.qos by ricsc. # Modified by rickk to allow configuration via (l)uci and play nicely with # the standard sqm scripts without throwing all kinds of errors. # # This script should be placed in your /usr/lib/sqm directory together with -# nss.qos.help. +# nss-rk.qos.help. # # To use it, select fq_codel as a queue discipline in (l)uci and nss.qos # for the script. # -# Works on my machine certified. +# Works on my machine (R7800 with OpenWRT 22.03.3) certified. +# +# Original can be found at https://github.com/rickkdotnet/sqm-scripts-nss # ################################################################################ @@ -50,7 +51,7 @@ egress() { # a lower codel quantum is rumoured to improve priority for interactive flows # at lower speed interfaces. if [ ${UPLINK} -lt 100000 ]; then - sqm_debug "Uplink speed is below 100Mb, setting codel quantum to 300" + sqm_debug "Uplink speed is below 100Mb, setting codel quantum to 300" EQUANTUM=300 else # use the interface mtu, this seems to work well in almost all cases @@ -60,9 +61,8 @@ egress() { # this allows you to set the codel interval via (l)uci eqdisc_opts # if no interval statement is present, set a sensible default if [[ "${EQDISC_OPTS}" != *"interval"* ]]; then - sqm_debug "No interval specified via advanced option string, going with 100ms" - # 100ms works well in most cases, unless the link speed is so slow that target > interval - # but you probably don't want/need NSS in that case anyway + sqm_debug "No interval specified via advanced option string, going with 100ms" # 100ms works well in most cases, unless the link speed is so slow that target > interval + # but you probably don't want/need NSS in that case anyway EQDISC_OPTS="interval 100ms ${EQDISC_OPTS}" fi @@ -112,7 +112,7 @@ ingress() { # this allows you to set the codel interval via (l)uci iqdisc_opts # if no interval statement is present, set a sensible default if [[ "${IQDISC_OPTS}" != *"interval"* ]]; then - sqm_debug "No interval specified via advanced option string, going with 100ms." + sqm_debug "No interval specified via advanced option string, going with 100ms." IQDISC_OPTS="interval 100ms ${IQDISC_OPTS}" fi @@ -139,14 +139,14 @@ sqm_prepare_script() { # sqm-scripts standard do_modules does not insert the necessary nss_ifb module # load it here if it's not loaded, so we can keep all NSS changes together in this script if [ ! -d /sys/module/nss_ifb ]; then - sqm_debug "required nss_ifb kernel module not detected, loading it now.. " - insmod nss-ifb 2>>${OUTPUT_TARGET} || return 1 + sqm_debug "required nss_ifb kernel module not detected, loading it now.. " + insmod nss-ifb 2>>${OUTPUT_TARGET} || return 1 fi # the default sqm-stop script deletes the nssifb interface if [ ! `SILENT=1 $IP link show dev nssifb` ]; then - sqm_debug "nssifb interface does not exist, trying to create a new one.. " - $IP link add dev nssifb type nss_ifb || return 1 + sqm_debug "nssifb interface does not exist, trying to create a new one.. " + $IP link add dev nssifb type nss_ifb || return 1 fi verify_iptables || return 1 @@ -171,23 +171,23 @@ sqm_start() { if [ "${UPLINK}" -ne 0 ]; then - CUR_DIRECTION="egress" - fn_exists egress && egress || sqm_warn "sqm_start_default: ${SCRIPT} lacks an egress() function" - sqm_debug "sqm_start: egress shaping activated" + CUR_DIRECTION="egress" + fn_exists egress && egress || sqm_warn "sqm_start_default: ${SCRIPT} lacks an egress() function" + sqm_debug "sqm_start: egress shaping activated" else - sqm_debug "sqm_start_default: egress shaping deactivated" - SILENT=1 $TC qdisc del dev ${IFACE} root + sqm_debug "sqm_start_default: egress shaping deactivated" + SILENT=1 $TC qdisc del dev ${IFACE} root fi if [ "${DOWNLINK}" -ne 0 ]; then - CUR_DIRECTION="ingress" - fn_exists ingress && ingress || sqm_warn "sqm_start_default: ${SCRIPT} lacks an ingress() function" - sqm_debug "sqm_start_default: ingress shaping activated" + CUR_DIRECTION="ingress" + fn_exists ingress && ingress || sqm_warn "sqm_start_default: ${SCRIPT} lacks an ingress() function" + sqm_debug "sqm_start_default: ingress shaping activated" else - sqm_debug "sqm_start_default: ingress shaping deactivated" - SILENT=1 $TC qdisc del dev ${DEV} root - SILENT=1 $TC qdisc del dev ${IFACE} ingress + sqm_debug "sqm_start_default: ingress shaping deactivated" + SILENT=1 $TC qdisc del dev ${DEV} root + SILENT=1 $TC qdisc del dev ${IFACE} ingress fi return 0 @@ -228,5 +228,4 @@ CUR_IFB=nssifb # configure the WAN interface as a subinterface # just strip off the vlan tag here IFACE=`echo ${IFACE} | sed 's/\.[0-9]*//g'` -sqm_debug "Setting nssifb physical interface to ${IFACE}" diff --git a/openwrt/sqm-scripts-nss/Makefile b/openwrt/sqm-scripts-nss/Makefile index 37f6a31..3bcf18a 100644 --- a/openwrt/sqm-scripts-nss/Makefile +++ b/openwrt/sqm-scripts-nss/Makefile @@ -1,8 +1,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sqm-scripts-nss -PKG_VERSION:=20230217a -PKG_RELEASE:=3 +PKG_VERSION:=20230217b +PKG_RELEASE:=1 include $(INCLUDE_DIR)/package.mk