diff options
author | Assaf Krauss <assaf.krauss@intel.com> | 2008-06-11 21:47:06 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-14 12:18:07 -0400 |
commit | 398f9e765f57c0dca0f6fb13c28ad929c09c68ef (patch) | |
tree | b35d110f16f1327d29625e62b13c735b7624022c /drivers/net/wireless/iwlwifi/iwl4965-base.c | |
parent | c46fbefa32c3c314884d3d3be27d0e1839de2c24 (diff) |
iwlwifi: Fix mode changes (ad-hoc <--> managed)
This fix allows to move between modes (ad-hoc to managed, and vice versa).
Since mode changes can only be done while driver is down, check for ibss
support can only be made when the channel is set (afte the driver goes up).
Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 4570fd133d74..8e7860debdf6 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -1176,22 +1176,11 @@ static void iwl4965_connection_init_rx_config(struct iwl_priv *priv) | |||
1176 | 1176 | ||
1177 | static int iwl4965_set_mode(struct iwl_priv *priv, int mode) | 1177 | static int iwl4965_set_mode(struct iwl_priv *priv, int mode) |
1178 | { | 1178 | { |
1179 | if (mode == IEEE80211_IF_TYPE_IBSS) { | ||
1180 | const struct iwl_channel_info *ch_info; | ||
1181 | |||
1182 | ch_info = iwl_get_channel_info(priv, | ||
1183 | priv->band, | ||
1184 | le16_to_cpu(priv->staging_rxon.channel)); | ||
1185 | |||
1186 | if (!ch_info || !is_channel_ibss(ch_info)) { | ||
1187 | IWL_ERROR("channel %d not IBSS channel\n", | ||
1188 | le16_to_cpu(priv->staging_rxon.channel)); | ||
1189 | return -EINVAL; | ||
1190 | } | ||
1191 | } | ||
1192 | |||
1193 | priv->iw_mode = mode; | 1179 | priv->iw_mode = mode; |
1194 | 1180 | ||
1181 | /* init channel/phymode to values given at driver init */ | ||
1182 | iwl_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6); | ||
1183 | |||
1195 | iwl4965_connection_init_rx_config(priv); | 1184 | iwl4965_connection_init_rx_config(priv); |
1196 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | 1185 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); |
1197 | 1186 | ||
@@ -3892,6 +3881,14 @@ static int iwl4965_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
3892 | goto out; | 3881 | goto out; |
3893 | } | 3882 | } |
3894 | 3883 | ||
3884 | if (priv->iw_mode == IEEE80211_IF_TYPE_IBSS && | ||
3885 | !is_channel_ibss(ch_info)) { | ||
3886 | IWL_ERROR("channel %d in band %d not IBSS channel\n", | ||
3887 | conf->channel->hw_value, conf->channel->band); | ||
3888 | ret = -EINVAL; | ||
3889 | goto out; | ||
3890 | } | ||
3891 | |||
3895 | spin_lock_irqsave(&priv->lock, flags); | 3892 | spin_lock_irqsave(&priv->lock, flags); |
3896 | 3893 | ||
3897 | /* if we are switching from ht to 2.4 clear flags | 3894 | /* if we are switching from ht to 2.4 clear flags |