Skip to main content

QoS/CAKE

Per-subscriber traffic shaping with CAKE qdisc.

Overview

AthenaBNG applies per-subscriber QoS using CAKE (Common Applications Kept Enhanced), a modern qdisc that provides:

  • Fair bandwidth allocation
  • Low latency
  • Automatic overhead calculation
  • Per-flow fairness
  • Built-in SQM (Smart Queue Management)

CAKE Qdisc

CAKE is a modern replacement for fq_codel that:

  • Automatically detects and isolates flows
  • Provides fair bandwidth allocation
  • Reduces latency and jitter
  • Handles overhead calculation
  • Supports diffserv (QoS classes)

CAKE Parameters

tc qdisc add dev ppp0 root cake \
bandwidth 100Mbit \
overhead 34 \
mpu 64 \
rtt 20ms \
ack-filter \
split-gst \
diffserv4 \
nat \
nowash
ParameterValuePurpose
bandwidthRateDownload/upload rate
overheadBytesEncapsulation overhead
mpuBytesMinimum packet unit
rttTimeRound-trip time estimate
ack-filterFilter duplicate ACKs
split-gstSplit GST (get-set-test)
diffserv44-class QoS
natNAT detection
nowashDisable wash

Overhead Profiles

Different encapsulations require different overhead calculations:

PPPoE over Ethernet

pppoe_ethernet:
overhead: 34
mpu: 64

Breakdown:

  • Ethernet: 14 bytes
  • PPPoE: 6 bytes
  • PPP: 2 bytes
  • IP: 20 bytes (minimum)
  • FCS: 4 bytes
  • Total: 46 bytes (rounded to 34)

IPoE over Ethernet

ipoe_ethernet:
overhead: 22
mpu: 64

Breakdown:

  • Ethernet: 14 bytes
  • VLAN: 4 bytes
  • FCS: 4 bytes
  • Total: 22 bytes

PPPoE over QinQ

pppoe_qinq:
overhead: 38
mpu: 64

Breakdown:

  • Ethernet: 14 bytes
  • Outer VLAN: 4 bytes
  • Inner VLAN: 4 bytes
  • PPPoE: 6 bytes
  • PPP: 2 bytes
  • IP: 20 bytes
  • FCS: 4 bytes
  • Total: 54 bytes (rounded to 38)

Ingress Shaping

For upload rate limiting, abng-qos creates IFB (Intermediate Functional Block) devices:

# Create IFB device
ip link add ifb-ppp0 type ifb

# Redirect ingress to IFB
tc filter add dev ppp0 parent ffff: protocol all u32 match u32 0 0 action mirred egress redirect dev ifb-ppp0

# Apply CAKE to IFB
tc qdisc add dev ifb-ppp0 root cake bandwidth 40Mbit ...

# Bring up IFB
ip link set ifb-ppp0 up

Configuration

qos:
enabled: true
default_down: "100mbit"
default_up: "40mbit"
default_overhead_profile: "pppoe_ethernet"
overhead_profiles:
pppoe_ethernet:
overhead: 34
mpu: 64
ipoe_ethernet:
overhead: 22
mpu: 64

Per-Subscriber Rates

Default Rates

All subscribers get default rates:

qos:
default_down: "100mbit"
default_up: "40mbit"

RADIUS Override

RADIUS can override rates per-subscriber:

Athena-Rate-Down = "50mbit"
Athena-Rate-Up = "20mbit"

Dynamic Rate Changes (CoA)

RADIUS server can change rates on-the-fly:

Acct-Session-Id = "abng-1709312400-1"
Athena-Rate-Down = "25mbit"
Athena-Rate-Up = "10mbit"

abng-qos applies new rates without packet loss.

Monitoring

View QoS Status

abng> show qos

Check CAKE Qdisc

tc qdisc show
tc -s qdisc show dev ppp0

View IFB Devices

ip link show | grep ifb

Monitor abng-qos Logs

sudo journalctl -u abng-qos -f

Testing

Verify Download Rate

# From subscriber
iperf -c <bng-ip> -t 10 -R

Verify Upload Rate

# From subscriber
iperf -c <bng-ip> -t 10

Check Latency

# From subscriber
ping <bng-ip>

Troubleshooting

QoS Not Applying

  1. Check QoS is enabled: show configuration | match qos
  2. Check CAKE qdisc exists: tc qdisc show
  3. Check abng-qos logs: journalctl -u abng-qos -f
  4. Check session is active: show subscribers

Rates Not Matching Expected

  1. Check overhead profile: show configuration | match overhead_profiles
  2. Verify with iperf: iperf -c <subscriber-ip> -t 10
  3. Check CAKE stats: tc -s qdisc show dev ppp0
  4. Adjust overhead if needed

IFB Ingress Shaping Not Working

  1. Check IFB device exists: ip link show | grep ifb
  2. Check ingress qdisc: tc qdisc show dev ifb-ppp0
  3. Check abng-qos logs: journalctl -u abng-qos -f

Best Practices

  1. Overhead Profile — Match your actual encapsulation
  2. Default Rates — Set reasonable defaults for your subscriber base
  3. RADIUS Override — Use RADIUS for per-subscriber customization
  4. Testing — Test with iperf to verify rates
  5. Monitoring — Monitor CAKE stats for congestion
  6. Ingress Shaping — Enable IFB for upload rate limiting
  7. Documentation — Document your overhead calculations

Next Steps