diff options
author | Sara Sharon <sara.sharon@intel.com> | 2019-01-16 21:26:25 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2019-02-08 13:51:50 +0100 |
commit | 7ece9c372b21635120e7ab5ea3fc41ce9892ead8 (patch) | |
tree | f2b78f04ca9cec69c322379b7c889f2734a488c5 /include/net/cfg80211.h | |
parent | 213ed579d38ef47c55694a4a411926af3dfc6558 (diff) | |
download | linux-7ece9c372b21635120e7ab5ea3fc41ce9892ead8.tar.bz2 |
cfg80211: make BSSID generation function inline
This will enable reuse by mac80211.
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r-- | include/net/cfg80211.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 67aeb7199617..c33ebc41d797 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5462,6 +5462,29 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy, } /** + * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID + * @bssid: transmitter BSSID + * @max_bssid: max BSSID indicator, taken from Multiple BSSID element + * @mbssid_index: BSSID index, taken from Multiple BSSID index element + * @new_bssid_addr: address of the resulting BSSID + */ +static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid, + u8 mbssid_index, u8 *new_bssid_addr) +{ + u64 bssid_tmp, new_bssid; + u64 lsb_n; + + bssid_tmp = ether_addr_to_u64(bssid); + + lsb_n = bssid_tmp & ((1 << max_bssid) - 1); + new_bssid = bssid_tmp; + new_bssid &= ~((1 << max_bssid) - 1); + new_bssid |= (lsb_n + mbssid_index) % (1 << max_bssid); + + u64_to_ether_addr(new_bssid, new_bssid_addr); +} + +/** * enum cfg80211_bss_frame_type - frame type that the BSS data came from * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is * from a beacon or probe response |