Page MenuHomeFreeBSD

net80211: represent rates via 'struct ieee80211_rate_t' / global rate indices (where possible)
Needs ReviewPublic

Authored by avos on Mar 19 2018, 2:18 AM.



Typically rates are stored as indices to the 'global' table (stored in separate ieee80211_rates.h, so userland can use it too - probably, via lib80211).

There were few reasons why indices are preferred over in-place struct's:

  • ABI stability (assumed that new rates will be appended to the end of the table + struct ieee80211_rate_t may be changed);
  • easier manipulation (comparison / copying);
  • less memory consumption.

Two new sysctls (IEEE80211_IOC_ROAM_VHT and IEEE80211_IOC_TXPARAMS_VHT) were added in addition to previous ones; since VHT rates cannot be exported via plain 'uint8_t' representation without ambiguity older versions will never show related parameters for 11ac mode.

There are few places where 'raw' rates are still used:

  • struct ieee80211_rx_stats (VHT rates may be distinguished via c_pktflags field + conversion will break current alignment);
  • radiotap (probably, mcs_nss field from will be used by applications instead).

Also, struct ieee80211_bpf_params has overall size limitation (14 bytes), so it uses 'reduced' number of rates - fine until there are < 255 rates (now 197).

(Probably, incomplete) list of unrelated changes:

  • Do not setup / store Tx and roaming parameters for unsupported modes (e.g., OFDM half / quarter for most drivers). As a result, ifconfig(8) in verbose mode will not show them too.
  • Add initial version of ieee80211_rate_to_string() (used only in ieee80211_amrr.c and ieee80211_ddb.c for now).
  • Move ieee80211_get_suprates() / ieee80211_get_suphtrates() to ieee80211_var.h
  • Check if chosen rateset is initialized before trying to access it in various rate control modules. As a result, ieee80211_ratectl_node_init() call was dropped from ieee80211_alloc_node() - there are no valid channel / ratesets yet.
  • Merge ieee80211_compute_duration_ht() into ieee80211_compute_duration() (VHT version is not ready yet).
  • Bump version for BPF parameters structure (0 - plain rates, 1 - rate indices).
Test Plan

Tested with:

  • iwn(4) (Intel 6205, STA mode)
  • rtwn(4) (RTL8821AU, STA mode)
  • rsu(4) (ASUS USB-N10, STA mode)

Diff Detail

rS FreeBSD src repository - subversion
Lint Skipped
Unit Tests Skipped