Code to sync Fi-Wi TSFs radio heads over PCIe
Go to file
Robert McMahon b5bd67757b README: document affine TSF library and example build
Made-with: Cursor
2026-03-31 20:13:56 -07:00
.gitignore Add affine TSF pool for master-to-radio mapping 2026-03-31 20:10:30 -07:00
Makefile Add affine TSF pool for master-to-radio mapping 2026-03-31 20:10:30 -07:00
README.md README: document affine TSF library and example build 2026-03-31 20:13:56 -07:00
TEAM_EMAIL_affine_tsf_mapping.txt Add affine TSF pool for master-to-radio mapping 2026-03-31 20:10:30 -07:00
tsf_affine.c Add affine TSF pool for master-to-radio mapping 2026-03-31 20:10:30 -07:00
tsf_affine.h Add affine TSF pool for master-to-radio mapping 2026-03-31 20:10:30 -07:00
tsf_affine_example.c Add affine TSF pool for master-to-radio mapping 2026-03-31 20:10:30 -07:00
tsf_sync_rt_starter.c FiWiTSF: single exit points in helpers and main 2026-03-31 12:30:17 -07:00

README.md

FiWiTSF

Repository root: ~/Code/FiWiTSF (standalone; not part of a Linux kernel tree).

This repo contains two related pieces:

  1. tsf_sync_rt_starter — C11 userspace tool using SCHED_FIFO that reads a master 802.11 TSF from mac80211 debugfs and nudges follower interfaces by writing their tsf files (hardware alignment).

  2. tsf_affine — Library-style C code (tsf_affine.h / tsf_affine.c) that keeps an affine map per radio (master TSF → each radio TSF) from paired samples, so scheduling can stay on a master timeline without stepping every radios hardware TSF. With N radios and one master, there are N1 fitted maps plus identity on the master. See TEAM_EMAIL_affine_tsf_mapping.txt for the design note you can share with the team.

Hosting (Gitea, SSH)

Canonical server: git.umbernetworks.com.

Optional: ~/.ssh/config

If git push over SSH fails (wrong port or key), add a host block. Gitea uses SSH user git. Port is often 22; some installs use 2222.

Host git.umbernetworks.com
    HostName git.umbernetworks.com
    User git
    Port 22

Add IdentityFile ~/.ssh/your_key only if you do not use the default key.

Check SSH before Git

ssh -T git@git.umbernetworks.com

You want a success message from Gitea, not a normal shell login.

Remote URL (this repo)

User repo rjmcmahon/FiWiTSF — use the git SSH user (not your Linux username):

cd ~/Code/FiWiTSF
git remote set-url origin git@git.umbernetworks.com:rjmcmahon/FiWiTSF.git
git push -u origin main

If you must put a non-default port in the URL itself (no Host block):

git remote set-url origin ssh://git@git.umbernetworks.com:2222/rjmcmahon/FiWiTSF.git

New clone

git clone git@git.umbernetworks.com:rjmcmahon/FiWiTSF.git

Build

make

Produces:

  • tsf_sync_rt_starter — RT TSF sync (needs debugfs; see below)
  • tsf_affine_example — demo that trains 24 affine maps and prints a master→all lookup (no Wi-Fi required)

Requirements

tsf_sync_rt_starter

  • Linux with mac80211 and CONFIG_MAC80211_DEBUGFS
  • debugfs mounted (e.g. on /sys/kernel/debug)
  • Privileges for real-time scheduling (root or CAP_SYS_NICE)

tsf_affine / tsf_affine_example

  • C11 toolchain and -lm (as in the Makefile). No debugfs or RT privileges unless you wire samples to real hardware yourself.

Usage

Hardware TSF sync (debugfs)

sudo ./tsf_sync_rt_starter -h

See -h / --help for options (-m, -f, -p, -j, etc.).

Affine mapping API

Include tsf_affine.h and compile with tsf_affine.c. Typical flow:

  • tsf_affine_pool_init(pool, n_radios, master_idx, window_cap)
  • For each paired snapshot: tsf_affine_pool_sample(pool, radio_idx, master_tsf, radio_tsf) (master index ignored)
  • Lookup: tsf_affine_pool_master_to_all(pool, master_tsf, out_array) or tsf_affine_pool_master_to_radio(...)

Run the demo:

./tsf_affine_example

Note

Experimental tooling for lab and bring-up. Production systems often replace debugfs with a dedicated kernel interface or driver hook. The affine layer is meant for software scheduling against a master TSF; features that require true hardware TSF alignment still need the driver/MAC path.