aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-04-27 08:19:34 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-04-30 11:57:32 -0400
commitebf8dc8060e4b10e8e13abbf98544f5c6cc8b25e (patch)
tree7726fb8217d44c62703ee7ea8ee2e0812c7f9480
parentc914ac26caf462567078f9615ffcedf1962087f2 (diff)
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>
-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,
1765{ 1765{
1766 struct iwl_priv *priv = hw->priv; 1766 struct iwl_priv *priv = hw->priv;
1767 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif); 1767 struct iwl_rxon_context *ctx = iwl_rxon_ctx_from_vif(vif);
1768 struct iwl_rxon_context *bss_ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1768 struct iwl_rxon_context *tmp; 1769 struct iwl_rxon_context *tmp;
1769 u32 interface_modes; 1770 u32 interface_modes;
1770 int err; 1771 int err;
@@ -1789,6 +1790,19 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1789 goto out; 1790 goto out;
1790 } 1791 }
1791 1792
1793 /*
1794 * Refuse a change that should be done by moving from the PAN
1795 * context to the BSS context instead, if the BSS context is
1796 * available and can support the new interface type.
1797 */
1798 if (ctx->ctxid == IWL_RXON_CTX_PAN && !bss_ctx->vif &&
1799 (bss_ctx->interface_modes & BIT(newtype) ||
1800 bss_ctx->exclusive_interface_modes & BIT(newtype))) {
1801 BUILD_BUG_ON(NUM_IWL_RXON_CTX != 2);
1802 err = -EBUSY;
1803 goto out;
1804 }
1805
1792 if (ctx->exclusive_interface_modes & BIT(newtype)) { 1806 if (ctx->exclusive_interface_modes & BIT(newtype)) {
1793 for_each_context(priv, tmp) { 1807 for_each_context(priv, tmp) {
1794 if (ctx == tmp) 1808 if (ctx == tmp)