diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-04-29 07:43:05 -0400 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-05-10 18:08:58 -0400 |
commit | 3474ad635db371b0d8d0ee40086f15d223d5b6a4 (patch) | |
tree | 357d40529a6ba92d1766f3ff07fe90625cd99e80 /drivers/net/wireless | |
parent | eafdfbd32aa9fcaf17733c04d5eb071af3b1ff47 (diff) |
iwlwifi: apply filter flags directly
Since iwl_configure_filter can now sleep since
the mac80211 callback was changed, we can now
apply filter flags changes directly.
Also, while at it, make the code a bit more
generic with a local macro. There's no need
to check changed_flags since we apply all at
the same time anyway.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 5c6f25462a09..246538a27fc6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -1257,41 +1257,33 @@ void iwl_configure_filter(struct ieee80211_hw *hw, | |||
1257 | u64 multicast) | 1257 | u64 multicast) |
1258 | { | 1258 | { |
1259 | struct iwl_priv *priv = hw->priv; | 1259 | struct iwl_priv *priv = hw->priv; |
1260 | __le32 *filter_flags = &priv->staging_rxon.filter_flags; | 1260 | __le32 filter_or = 0, filter_nand = 0; |
1261 | |||
1262 | #define CHK(test, flag) do { \ | ||
1263 | if (*total_flags & (test)) \ | ||
1264 | filter_or |= (flag); \ | ||
1265 | else \ | ||
1266 | filter_nand |= (flag); \ | ||
1267 | } while (0) | ||
1261 | 1268 | ||
1262 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", | 1269 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", |
1263 | changed_flags, *total_flags); | 1270 | changed_flags, *total_flags); |
1264 | 1271 | ||
1265 | if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) { | 1272 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); |
1266 | if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) | 1273 | CHK(FIF_ALLMULTI, RXON_FILTER_ACCEPT_GRP_MSK); |
1267 | *filter_flags |= RXON_FILTER_PROMISC_MSK; | 1274 | CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); |
1268 | else | 1275 | CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); |
1269 | *filter_flags &= ~RXON_FILTER_PROMISC_MSK; | ||
1270 | } | ||
1271 | if (changed_flags & FIF_ALLMULTI) { | ||
1272 | if (*total_flags & FIF_ALLMULTI) | ||
1273 | *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK; | ||
1274 | else | ||
1275 | *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK; | ||
1276 | } | ||
1277 | if (changed_flags & FIF_CONTROL) { | ||
1278 | if (*total_flags & FIF_CONTROL) | ||
1279 | *filter_flags |= RXON_FILTER_CTL2HOST_MSK; | ||
1280 | else | ||
1281 | *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK; | ||
1282 | } | ||
1283 | if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { | ||
1284 | if (*total_flags & FIF_BCN_PRBRESP_PROMISC) | ||
1285 | *filter_flags |= RXON_FILTER_BCON_AWARE_MSK; | ||
1286 | else | ||
1287 | *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK; | ||
1288 | } | ||
1289 | 1276 | ||
1290 | /* We avoid iwl_commit_rxon here to commit the new filter flags | 1277 | #undef CHK |
1291 | * since mac80211 will call ieee80211_hw_config immediately. | 1278 | |
1292 | * (mc_list is not supported at this time). Otherwise, we need to | 1279 | mutex_lock(&priv->mutex); |
1293 | * queue a background iwl_commit_rxon work. | 1280 | |
1294 | */ | 1281 | priv->staging_rxon.filter_flags &= ~filter_nand; |
1282 | priv->staging_rxon.filter_flags |= filter_or; | ||
1283 | |||
1284 | iwlcore_commit_rxon(priv); | ||
1285 | |||
1286 | mutex_unlock(&priv->mutex); | ||
1295 | 1287 | ||
1296 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | 1288 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | |
1297 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | 1289 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; |