A lightweight utility for configuring L4S Static Rate Management (SRM) using Linux Traffic Control (tc).
Please find the corresponding IETF SRM draft.
sudo ./config_srm.sh [OPTIONS]--ing IFNAME
Ingress interface
--egr IFNAME
Egress interface
Enable Layer-2 forwarding between ingress and egress interfaces.
-b
--bridge
--pir RATE
Peak Information Rate
--cir RATE
Committed Information Rate
--burst TIME
Set PBS and CBS simultaneously
--shape RATE
Configure emulated link rate using HTB
--qdisc OPTION
Queue discipline (fq or pfifo or dualpi2)
--delay TIME
Add one-way delay using IFB/netem
--ing-pir RATE
--ing-pbs TIME
--ing-cir RATE
--ing-cbs TIME
--ing-shape RATE
--ing-qdisc OPTION
--ing-delay TIME
--egr-pir RATE
--egr-pbs TIME
--egr-cir RATE
--egr-cbs TIME
--egr-shape RATE
--egr-qdisc OPTION
--egr-delay TIME
Both IPv4 and IPv6 are supported. SRM processing is applied only to L4S traffic, i.e. packets with ECN codepoints ECT(1) or CE.
Rate <= CIR
Forward unchanged
CIR < Rate <= PIR
Mark the ECN field as CE (11)
Rate > PIR
Drop
An HTB hierarchy is created to emulate a fixed-rate bottleneck link.
HTB Root (Shape)
|
+-- Class 1:1
|
+-- Class 1:10 (prio 1)
|
+-- Class 1:11 (prio 2)
Both child classes share the configured shaping rate and borrow bandwidth from the parent HTB class.
HTB Root (Shape)
|
+-- Class 1:1
|
+-- dualpi2
When dualpi2 is selected, all traffic is directed to the DualPI2 queue discipline.
L4S traffic (ECT(1) or CE)
-> Class 1:10
Non-L4S traffic
-> Class 1:11
Available queue disciplines:
pfifo: single FIFO queuefq: per-flow fair queueing
When dualpi2 is selected, traffic classification and queue coupling are handled internally by the Linux DualPI2 implementation.
bit
Kbit
Mbit
Gbit
bps
Kbps
Mbps
Gbps
us
ms
s
sudo ./config_srm.sh --clearIngress Interface : enp4s0
Egress Interface : enp7s0
Ingress
PIR : 10Mbit
PBS : 4ms
CIR : 5Mbit
CBS : 4ms
Shape : 100Mbit
Qdisc : pfifo
Delay : 2ms
Egress
PIR : 10Mbit
PBS : 4ms
CIR : 5Mbit
CBS : 4ms
Shape : 100Mbit
Qdisc : pfifo
Delay : 2ms
Interfaces are temporarily set as unmanaged to prevent NetworkManager from overwriting tc configuration.
Running --clear restores NetworkManager control.
- Script must be executed as root.
- Bridge mode is optional and disabled by default.
- IPv4 and IPv6 are supported.
- GRO/GSO/TSO are disabled on the interfaces.
- IFB devices are used for ingress delay emulation.
- CE marking is applied only to L4S traffic between CIR and PIR.
- HTB is used to emulate a configurable bottleneck link rate.
- Child HTB classes use a minimal guaranteed rate and borrow bandwidth from the configured shaping rate.
- Queue disciplines supported:
pfifo,fq, anddualpi2.pfifoprovides two aggregate FIFO queues.fqprovides per-flow queueing within each traffic class.dualpi2uses the Linux DualPI2 implementation for coupled L4S/Classic queue management.