-
Notifications
You must be signed in to change notification settings - Fork 2
SQM and Shaping
NSS-accelerated traffic shaping: the kernel/iproute2 pieces, the
nss-edma.qos SQM script, and the firmware shaping behaviors that
were verified at the firmware level (including the ones that
contradict folklore).
-
Kernel patches 0968/0969 (openwrt tree): uapi
pkt_clsadditions and qdisc support (ifb,sch_api,sch_generic,sk_bufffield). ⚠ 0969 adds a bitfield tostruct sk_buff: any change to that patch requires wiping the targetbuild_dirandstaging_dirso every kmod is rebuilt against the new layout. -
kmod-qca-nss-drv-qdisc/kmod-qca-nss-drv-igs(feed): the NSS qdiscs (nsstbl,nssfq_codel, …) and theact_nssmirredingress action. Built withNSS_QDISC_PPE_ENABLE=n— PPE shaper mode and NSS-bridge qdisc attach need qca-ssdk and bridge-mgr, neither of which exists here; the firmware accel mode (accel_mode 0) used for everything below is unaffected. -
iproute2 patches (openwrt tree):
tcparsers for the NSS qdiscs and thenssmirredaction. -
sqm-scripts-nss(feed): ships exactly one queue setup script,nss-edma.qos— flatnsstbl(rate) →nssfq_codel(AQM), egress on the WAN device, ingress viaact_nssmirredinto an ifb.
-
A leaf-less NSS qdisc kills ALL egress on the device, including
ARP. Every NSS qdisc setup must pass
set_defaulton a leaf.nss-edma.qosdoes this unconditionally, by construction. -
The firmware refuses shaper nodes on
pppoe-wan(node-init timeout; non-destructive but the shaper never comes up). Attach shaping to the physical/ifb interfaces. SQM configured on the logicalwanlands on the right netdev by construction. -
Boot safety: the script refuses to modprobe the NSS qdisc
modules unless
qca_nss_drvis already loaded — an SQM config enabled at boot must not drag the firmware up on an unarmed system (that would kill all wired RX; see Runtime Operation). The sqm hotplug then simply retries after the NSS stack is up.
-
The 12.5 firmware does not ECN-mark from CoDel. The host
plumbing exists end to end (uapi,
nss_codel.c, fw ACKs thecodel_param.ecnconfig and exposes anecn_markstat), but under forced-ECT(0) traffic and ~1150 CoDel drops,ecn_markstayed 0. QCA's tc parser rejectingecnfor CoDel is honest.nss-edma.qosignores the SQM ECN setting with one log line. - Queue limit must respect the buffer pools. Firmware queue buffering is roughly 2× the configured limit; on the MEDIUM profile (pbuf pools 9984 + 1736) the script caps the auto queue limit at 2048 packets.
-
Flow-hash quality degrades on encapsulated WANs.
nssfq_codelflow dissection over PPPoE/VLAN encapsulation shows a ~27 % new-flow ratio versus ~3 % on a plain ethernet port — per-flow fairness is weaker on a PPPoE WAN; CoDel delay control is unaffected.
Two things conspire to leave the shaper down at boot on a PPPoE WAN:
- sqm-scripts' hotplug matches on the netdev (
$DEVICE, e.g.pppoe-wan), so a uci section keyedinterface='wan'never fires from hotplug alone — the bring-up must run/etc/init.d/sqm restartexplicitly. -
nss-edma.qos'scheck_addraborts withno IP on wan (proto=pppoe)if the WAN has no L3 address yet. Asqm restartissued straight afterifup wanloses this race — PPPoE negotiation (PADI…IPCP, plus DHCPv6-PD) outlasts a fixed sleep — and the shaper silently never attaches (nonsstblon the WAN device → full line rate, no bufferbloat control).
The bring-up therefore waits for pppoe-wan to actually carry an
address before starting SQM, then retries sqm restart until
nsstbl is attached to the WAN netdev (see Runtime Operation).
Verify with tc qdisc show dev <wan> | grep nsstbl.
The SQM section must also be a real per-WAN queue section with
download/upload rates — a rate-less section attaches qdiscs that shape
nothing and just adds a spurious second start at boot. Provision
exactly one queue section for the WAN.
AX3600 on a 300/150 PPPoE line, sqm rates 285000/142500 kbit,
nss-edma.qos:
- 258.6 Mbit/s goodput through the 285 Mbit ingress shaper.
- RTT under full load 16 ms avg / 31 ms max versus 20/49 idle — i.e. zero bufferbloat (re-validated with correctly-routed probes on both IPv4 and IPv6).
- CPU ~99.1 % idle during shaped saturation.
- Shaper authority confirmed:
nsstbloverlimits in the tens of thousands whilefq_codel(host side) saw single-digit drops — the firmware shaper, not the host, is in charge. - A deliberately tight 50/25 test config shaped to 45.2/22.8 Mbit — authority again with the expected overhead margin.
-
sqm stoptears down cleanly; reboot with SQM enabled boots safely on the host stack (the guard logs "refusing to load NSS qdisc modules" and wired RX stays alive).