diff options
Diffstat (limited to 'drivers/net/wireless/mac80211_hwsim.c')
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 2cd3f54e1efa..de0df86704e7 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -167,6 +167,7 @@ struct hwsim_vif_priv { | |||
167 | u32 magic; | 167 | u32 magic; |
168 | u8 bssid[ETH_ALEN]; | 168 | u8 bssid[ETH_ALEN]; |
169 | bool assoc; | 169 | bool assoc; |
170 | bool bcn_en; | ||
170 | u16 aid; | 171 | u16 aid; |
171 | }; | 172 | }; |
172 | 173 | ||
@@ -1170,6 +1171,16 @@ static void mac80211_hwsim_configure_filter(struct ieee80211_hw *hw, | |||
1170 | *total_flags = data->rx_filter; | 1171 | *total_flags = data->rx_filter; |
1171 | } | 1172 | } |
1172 | 1173 | ||
1174 | static void mac80211_hwsim_bcn_en_iter(void *data, u8 *mac, | ||
1175 | struct ieee80211_vif *vif) | ||
1176 | { | ||
1177 | unsigned int *count = data; | ||
1178 | struct hwsim_vif_priv *vp = (void *)vif->drv_priv; | ||
1179 | |||
1180 | if (vp->bcn_en) | ||
1181 | (*count)++; | ||
1182 | } | ||
1183 | |||
1173 | static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | 1184 | static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, |
1174 | struct ieee80211_vif *vif, | 1185 | struct ieee80211_vif *vif, |
1175 | struct ieee80211_bss_conf *info, | 1186 | struct ieee80211_bss_conf *info, |
@@ -1180,7 +1191,8 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | |||
1180 | 1191 | ||
1181 | hwsim_check_magic(vif); | 1192 | hwsim_check_magic(vif); |
1182 | 1193 | ||
1183 | wiphy_debug(hw->wiphy, "%s(changed=0x%x)\n", __func__, changed); | 1194 | wiphy_debug(hw->wiphy, "%s(changed=0x%x vif->addr=%pM)\n", |
1195 | __func__, changed, vif->addr); | ||
1184 | 1196 | ||
1185 | if (changed & BSS_CHANGED_BSSID) { | 1197 | if (changed & BSS_CHANGED_BSSID) { |
1186 | wiphy_debug(hw->wiphy, "%s: BSSID changed: %pM\n", | 1198 | wiphy_debug(hw->wiphy, "%s: BSSID changed: %pM\n", |
@@ -1202,6 +1214,7 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | |||
1202 | 1214 | ||
1203 | if (changed & BSS_CHANGED_BEACON_ENABLED) { | 1215 | if (changed & BSS_CHANGED_BEACON_ENABLED) { |
1204 | wiphy_debug(hw->wiphy, " BCN EN: %d\n", info->enable_beacon); | 1216 | wiphy_debug(hw->wiphy, " BCN EN: %d\n", info->enable_beacon); |
1217 | vp->bcn_en = info->enable_beacon; | ||
1205 | if (data->started && | 1218 | if (data->started && |
1206 | !hrtimer_is_queued(&data->beacon_timer.timer) && | 1219 | !hrtimer_is_queued(&data->beacon_timer.timer) && |
1207 | info->enable_beacon) { | 1220 | info->enable_beacon) { |
@@ -1215,8 +1228,16 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, | |||
1215 | tasklet_hrtimer_start(&data->beacon_timer, | 1228 | tasklet_hrtimer_start(&data->beacon_timer, |
1216 | ns_to_ktime(until_tbtt * 1000), | 1229 | ns_to_ktime(until_tbtt * 1000), |
1217 | HRTIMER_MODE_REL); | 1230 | HRTIMER_MODE_REL); |
1218 | } else if (!info->enable_beacon) | 1231 | } else if (!info->enable_beacon) { |
1219 | tasklet_hrtimer_cancel(&data->beacon_timer); | 1232 | unsigned int count = 0; |
1233 | ieee80211_iterate_active_interfaces( | ||
1234 | data->hw, IEEE80211_IFACE_ITER_NORMAL, | ||
1235 | mac80211_hwsim_bcn_en_iter, &count); | ||
1236 | wiphy_debug(hw->wiphy, " beaconing vifs remaining: %u", | ||
1237 | count); | ||
1238 | if (count == 0) | ||
1239 | tasklet_hrtimer_cancel(&data->beacon_timer); | ||
1240 | } | ||
1220 | } | 1241 | } |
1221 | 1242 | ||
1222 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { | 1243 | if (changed & BSS_CHANGED_ERP_CTS_PROT) { |