FiWiTSF/TEAM_EMAIL_affine_tsf_mappi...

66 lines
2.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Subject: FiWiTSF — software TSF mapping (no per-radio HW adjustments)
Team,
We are changing how we relate timing across radios.
Background
----------
Today we can step each radios hardware TSF toward a master using mac80211
debugfs (or a future non-debugfs hook). That works, but it means frequent
writes, driver interaction, and coupling to whatever the MAC thinks “TSF” is
for medium access.
Proposed approach
-----------------
1. Pick one radio as the **master** timeline. All scheduling and coordination
are expressed in **master TSF time**.
2. **Do not** continuously adjust each radio heads hardware TSF. Leave each
chips TSF running freely.
3. For every other radio, maintain a **linear (affine) map** between master
TSF and that radios TSF:
t_radio ≈ α_i · t_master + β_i
Offset, drift, and measurement noise are absorbed by updating (α_i, β_i)
from paired samples (t_master, t_radio) taken in a scheduling thread.
Filters (e.g. bounded window least-squares, Kalman on offset + skew) can
sit on top of the same idea.
4. **Per-thread timing:** each radios sampling / bookkeeping can use its own
`clock_nanosleep` slot; we are not trying to wake every thread at the same
instant. Barriers or ordering are only needed where we need a consistent
snapshot (e.g. one master read shared across followers for a given cycle).
5. **Lookup:** given a master TSF value, we **predict** each radios TSF for
scheduling decisions in software. Inverse maps (radio → master) are just
the affine inverse when α_i ≠ 0.
Scale (24 radios)
-----------------
With **24 radios** and **one** designated master, we need **23** affine maps
(one per non-master radio). The master is the identity map:
t_radio_master = t_master (α = 1, β = 0).
Caveats
-------
• This gives a unified **software** timebase. Features that truly require
hardware TSF alignment to the master (specific offload, certain MAC
behaviors) still need separate consideration.
• Maps must be **refreshed**; clocks drift. A sliding window or recursive
estimator keeps (α, β) stable under noise.
• PCIe isolation and spare cores reduce **contention**; they do not remove
scheduler jitter. The affine layer is what makes “free-running” radio TSFs
usable for coordinated scheduling.
We will land a small C module in FiWiTSF for the pool of maps, sample updates,
and master→per-radio lookup; the existing RT sync binary remains available for
labs that still want HW stepping.
Thanks,
[Your name]