Skip to content

Cap Adaptive SQM rates at WAN link speed, editable baseline latency, cellular 7-day profile, and connection type auto-detect#368

Merged
tvancott42 merged 18 commits intomainfrom
feature/sqm-link-cap
Feb 26, 2026
Merged

Cap Adaptive SQM rates at WAN link speed, editable baseline latency, cellular 7-day profile, and connection type auto-detect#368
tvancott42 merged 18 commits intomainfrom
feature/sqm-link-cap

Conversation

@tvancott42
Copy link
Collaborator

@tvancott42 tvancott42 commented Feb 26, 2026

Summary

  • Cap SQM rates at physical WAN link speed - MaxSpeed, MinSpeed, and AbsoluteMax are capped at the WAN port's link rate (e.g., 1 Gbps for 1GbE) so SQM never shapes above what the link can carry. Link speed detected from the WAN object with port_table fallback for PPPoE. GRE tunnels and unknown link speeds are left uncapped.
  • Editable baseline latency - Users can override the auto-calculated baseline latency inline in the calculated params grid. Persisted to database with backwards-compatible nullable column. Change detection tracks it for the unsaved changes indicator.
  • Ratio-based latency coloring - Ping latency display color is now based on ratio to baseline (>1.5x warning, >3x danger) instead of hardcoded 50ms threshold.
  • Full 7-day cellular congestion profile - Replace uniform daily pattern with research-based 7x24 matrix reflecting real cellular tower load patterns: weekday commute/work ramps, Friday evening out, Saturday worst evening (people at restaurants/events on cellular, not home on Wi-Fi), Sunday lightest day with early recovery.
  • Auto-detect connection type from WAN name - Automatically selects the right connection profile when the WAN name contains Starlink, LTE, 5G, Cellular, Fiber, FTTH, FTTP, or DSL.
  • Reset all fields on WAN interface change - Switching WAN interface now resets connection type, nominal speeds, speedtest server, and ping host to appropriate defaults.
  • Fix Min == Max validation - Allow deployment when link speed caps both Min and Max to the same value (e.g., 1.2 Gbps fiber on 1GbE port).

Test plan

  • dotnet build with zero warnings
  • All 3,891 tests pass
  • Deploy and verify capped values display correctly when nominal * multiplier > link speed
  • Verify deployed script has capped MAX/MIN/ABSOLUTE_MAX values
  • Verify GRE/unknown link speed WANs are unaffected (no capping)
  • Set custom baseline latency, deploy, reload page, verify it persists
  • Switch WAN interface and verify all fields reset properly
  • Verify connection type auto-detects for Starlink, LTE/5G, Fiber, DSL WAN names
  • Verify 1.2 Gbps fiber on 1GbE deploys without validation error

Read link speed from WAN object (with port_table fallback via port_idx)
and cap MaxSpeed/AbsoluteMax so SQM never shapes above what the port
can carry. GRE tunnels and unknown links are left uncapped.
Also cap the speed floor so entering a nominal speed above link speed
doesn't produce a min above what the port can carry. Fix the Smart
Queue rate warning to use the already-capped AbsoluteMax instead of
recomputing from an uncapped profile.
LoadSavedConfigsAsync runs before RefreshStatus fetches wanInterfaces,
so WanLinkSpeedMbps was null on first render. Now updates link speeds
on loaded configs after wanInterfaces arrives.
The deploy service was re-applying profile settings without link speed
context, overwriting the caps set by the caller. The config arrives
fully populated from CreateSqmConfiguration - validation still runs.
Previously only set name/ping conditionally and didn't reset connection
type, nominal speeds, or speedtest server - leaving stale values from
the previous WAN selection.
Replace the read-only display with an inline input so users can
override the auto-calculated value. Nominal speed changes preserve
the override; connection type changes reset it.
Add nullable BaselineLatencyMs column to SqmWanConfigurations. Existing
rows default to null (use auto-calculated value). When the user edits
the inline baseline latency field, the value is saved and restored on
page reload.
Use ratio to baseline: >3x = danger (red), >1.5x = warning (yellow),
otherwise no highlight. Applies per-WAN using each WAN's configured
baseline latency.
- Add BaselineLatencyMs to upsert path in SaveSqmWanConfigAsync
- Restore user's baseline latency after ApplyProfileSettings in deploy
- Comment out auto speedtest scheduling (metered WAN testing)
@tvancott42 tvancott42 changed the title Cap Adaptive SQM rates at WAN physical link speed Cap Adaptive SQM rates at WAN link speed and add editable baseline latency Feb 26, 2026
@tvancott42 tvancott42 changed the title Cap Adaptive SQM rates at WAN link speed and add editable baseline latency Cap Adaptive SQM rates at WAN link speed, add editable baseline latency Feb 26, 2026
…arch

Replace uniform daily pattern with full 7x24 matrix reflecting real cellular
tower congestion patterns: weekday commute/work ramps, Friday evening out,
Saturday worst evening (people at restaurants/events on cellular not Wi-Fi),
Sunday lightest day with early evening recovery.
@tvancott42 tvancott42 changed the title Cap Adaptive SQM rates at WAN link speed, add editable baseline latency Cap Adaptive SQM rates at WAN link speed, editable baseline latency, and cellular 7-day profile Feb 26, 2026
- Add BaselineLatency to WanConfigSnapshot so changing it triggers the
  unsaved changes indicator. Uses epsilon comparison (0.01) for doubles.
- Set WanLinkSpeedMbps in OnEnabledChanged when auto-selecting interface.
When WAN link speed is lower than both calculated Min and Max (e.g.,
1.2 Gbps fiber on 1GbE port), both get capped to link speed making
them equal. The >= validation blocked deployment in this common case.
Changed to > to allow equality.
- Match LTE/5G/Cellular -> CellularHome, Fiber/FTTH/FTTP -> Fiber,
  DSL -> Dsl in ApplyConnectionDefaults
- Allow Min == Max download speed when both capped at link speed
@tvancott42 tvancott42 changed the title Cap Adaptive SQM rates at WAN link speed, editable baseline latency, and cellular 7-day profile Cap Adaptive SQM rates at WAN link speed, editable baseline latency, cellular 7-day profile, and connection type auto-detect Feb 26, 2026
@tvancott42 tvancott42 merged commit 31e9f9d into main Feb 26, 2026
1 check passed
@tvancott42 tvancott42 deleted the feature/sqm-link-cap branch February 26, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant