LinuxKPI: 802.11: rework sta state machine compatibility
Rework the state machine parts for various reasons:
(1) to add sta tracing to be able to better follow ni and lsta state
(2) factor out/implement lkpi_lsta_remove() to unlink the lsta and
free the ni reference.
(3) avoid calling lkpi_disassoc() when you would think you should as
changing BSS_CHANGED_ASSOC setting vif->bss_conf.assoc to false triggers a sta removal from firmware in iwlwifi which then triggers follow-up errors. I do not understand why they use flags and state and ?? in parallel (too many options and ways to do things?).
(4) when "roaming" (or being disassoc/deauth) from an AP both net80211
and apparently so mac80211 re-start with a new node/sta. This results in us losing one or the other state in the compat layer or not updating firmware appropriately. To resolve this make use of (a) the newly introduced (*iv_update_bss)() and (b) always tear a station down to "State 1" (INIT/SCAN/pre-AUTH) and only if needed re-create the new one (if we go to AUTH). A slightly earlier version has survived a night of wpa_supplicant and hostapd fighting each other over disassoc and deauth and re-associating/authorizing.
While there update a few comments and typos and do a few minor auxiliary
changes which are hard or not worth to extract.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days