Table of Contents
Key handling in mac80211 is done based on per-interface (sub_if_data) keys and per-station keys. Since each station belongs to an interface, each station key also belongs to that interface.
Hardware acceleration is done on a best-effort basis, for each key that is eligible the hardware is asked to enable that key but if it cannot do that they key is simply kept for software encryption. There is currently no way of knowing this except by looking into debugfs.
All operations here are called under RTNL so no extra locking is required.
NOTE: This code requires that sta info *destruction* is done under RTNL, otherwise it can try to access already freed STA structs when a STA key is being freed.