summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-core.c
diff options
context:
space:
mode:
authorJohannes Berg2011-04-27 14:19:34 +0200
committerWey-Yi Guy2011-04-30 17:57:32 +0200
commitebf8dc8060e4b10e8e13abbf98544f5c6cc8b25e (patch)
tree7726fb8217d44c62703ee7ea8ee2e0812c7f9480 /drivers/net/wireless/iwlwifi/iwl-core.c
parentiwlagn: improve RXON checking (diff)
downloadkernel-qcow2-linux-ebf8dc8060e4b10e8e13abbf98544f5c6cc8b25e.tar.gz
kernel-qcow2-linux-ebf8dc8060e4b10e8e13abbf98544f5c6cc8b25e.tar.xz
kernel-qcow2-linux-ebf8dc8060e4b10e8e13abbf98544f5c6cc8b25e.zip
iwlagn: prefer BSS context
If an interface type changes from a type that is only supported on the PAN context (e.g. P2P GO) to a type that is supported on the BSS context, and the BSS context is not in use, then we need to use the BSS context instead of changing the device type within the context. To achieve this, refuse the type change, which causes a down/up cycle that will allocate the BSS context for the interface. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-core.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 98cfbb6d2369..4653deada05b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1765,6 +1765,7 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
{
struct iwl_priv *priv = hw->priv;
struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
+ struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS];
struct iwl_rxon_context *tmp;
u32 interface_modes;
int err;
@@ -1789,6 +1790,19 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
goto out;
}
+ /*
+ * Refuse a change that should be done by moving from the PAN
+ * context to the BSS context instead, if the BSS context is
+ * available and can support the new interface type.
+ */
+ if (ctx->ctxid == IWL_RXON_CTX_PAN && !bss_ctx->vif &&
+ (bss_ctx->interface_modes & BIT(newtype) ||
+ bss_ctx->exclusive_interface_modes & BIT(newtype))) {
+ BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
+ err = -EBUSY;
+ goto out;
+ }
+
if (ctx->exclusive_interface_modes & BIT(newtype)) {
for_each_context(priv, tmp) {
if (ctx == tmp)