aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mac80211_hwsim.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-10-22 07:11:17 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-10-28 10:11:07 -0400
commit0bb861e6be624111e9f85ade89b9e7548c5eb968 (patch)
tree0ccc2701939bf2ef7e0451db4b6ab8368cfd6f9a /drivers/net/wireless/mac80211_hwsim.c
parent0951ebb8aa219115cec6a53c033ee34715a248db (diff)
mac80211_hwsim: Fix tracking of beaconing for multi-vif
mac80211_hwsim canceled beacon_timer on any vif changing from enabled to disabled beaconing. This breaks cases where there are multiple beaconing vifs and only one of them is removed. Fix this by tracking beaconing status per vif and disable beacon_timer only if no active vif remain with beaconing enabled. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/mac80211_hwsim.c')
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c27
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
1174static 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
1173static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw, 1184static 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) {