aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2009-04-08 14:26:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:43 -0400
commit4808368dad3263ac46e71f037c0dcd2dcf082525 (patch)
tree23ade76011df676aca0925fd025c313bfa5c4055 /drivers/net/wireless
parentd8052319f2a7d1ee86248df00193110ad1946a33 (diff)
iwl3945: use iwl_mac_config from iwlwifi
3945 can now use iwl_mac_config from iwlwifi Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c133
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c136
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c106
4 files changed, 138 insertions, 238 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 5cc30a223cf0..4640996aa298 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2036,139 +2036,6 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
2036 return NETDEV_TX_OK; 2036 return NETDEV_TX_OK;
2037} 2037}
2038 2038
2039/**
2040 * iwl_mac_config - mac80211 config callback
2041 *
2042 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to
2043 * be set inappropriately and the driver currently sets the hardware up to
2044 * use it whenever needed.
2045 */
2046static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2047{
2048 struct iwl_priv *priv = hw->priv;
2049 const struct iwl_channel_info *ch_info;
2050 struct ieee80211_conf *conf = &hw->conf;
2051 unsigned long flags = 0;
2052 int ret = 0;
2053 u16 ch;
2054 int scan_active = 0;
2055
2056 mutex_lock(&priv->mutex);
2057 IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n",
2058 conf->channel->hw_value, changed);
2059
2060 if (unlikely(!priv->cfg->mod_params->disable_hw_scan &&
2061 test_bit(STATUS_SCANNING, &priv->status))) {
2062 scan_active = 1;
2063 IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
2064 }
2065
2066
2067 /* during scanning mac80211 will delay channel setting until
2068 * scan finish with changed = 0
2069 */
2070 if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
2071 if (scan_active)
2072 goto set_ch_out;
2073
2074 ch = ieee80211_frequency_to_channel(conf->channel->center_freq);
2075 ch_info = iwl_get_channel_info(priv, conf->channel->band, ch);
2076 if (!is_channel_valid(ch_info)) {
2077 IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
2078 ret = -EINVAL;
2079 goto set_ch_out;
2080 }
2081
2082 if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
2083 !is_channel_ibss(ch_info)) {
2084 IWL_ERR(priv, "channel %d in band %d not "
2085 "IBSS channel\n",
2086 conf->channel->hw_value, conf->channel->band);
2087 ret = -EINVAL;
2088 goto set_ch_out;
2089 }
2090
2091 priv->current_ht_config.is_ht = conf_is_ht(conf);
2092
2093 spin_lock_irqsave(&priv->lock, flags);
2094
2095
2096 /* if we are switching from ht to 2.4 clear flags
2097 * from any ht related info since 2.4 does not
2098 * support ht */
2099 if ((le16_to_cpu(priv->staging_rxon.channel) != ch))
2100 priv->staging_rxon.flags = 0;
2101
2102 iwl_set_rxon_channel(priv, conf->channel);
2103
2104 iwl_set_flags_for_band(priv, conf->channel->band);
2105 spin_unlock_irqrestore(&priv->lock, flags);
2106 set_ch_out:
2107 /* The list of supported rates and rate mask can be different
2108 * for each band; since the band may have changed, reset
2109 * the rate mask to what mac80211 lists */
2110 iwl_set_rate(priv);
2111 }
2112
2113 if (changed & IEEE80211_CONF_CHANGE_PS) {
2114 if (conf->flags & IEEE80211_CONF_PS)
2115 ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3);
2116 else
2117 ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM);
2118 if (ret)
2119 IWL_DEBUG_MAC80211(priv, "Error setting power level\n");
2120
2121 }
2122
2123 if (changed & IEEE80211_CONF_CHANGE_POWER) {
2124 IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
2125 priv->tx_power_user_lmt, conf->power_level);
2126
2127 iwl_set_tx_power(priv, conf->power_level, false);
2128 }
2129
2130 /* call to ensure that 4965 rx_chain is set properly in monitor mode */
2131 if (priv->cfg->ops->hcmd->set_rxon_chain)
2132 priv->cfg->ops->hcmd->set_rxon_chain(priv);
2133
2134 if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
2135 if (conf->radio_enabled &&
2136 iwl_radio_kill_sw_enable_radio(priv)) {
2137 IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - "
2138 "waiting for uCode\n");
2139 goto out;
2140 }
2141
2142 if (!conf->radio_enabled)
2143 iwl_radio_kill_sw_disable_radio(priv);
2144 }
2145
2146 if (!conf->radio_enabled) {
2147 IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
2148 goto out;
2149 }
2150
2151 if (!iwl_is_ready(priv)) {
2152 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
2153 goto out;
2154 }
2155
2156 if (scan_active)
2157 goto out;
2158
2159 if (memcmp(&priv->active_rxon,
2160 &priv->staging_rxon, sizeof(priv->staging_rxon)))
2161 iwlcore_commit_rxon(priv);
2162 else
2163 IWL_DEBUG_INFO(priv, "No re-sending same RXON configuration.\n");
2164
2165
2166out:
2167 IWL_DEBUG_MAC80211(priv, "leave\n");
2168 mutex_unlock(&priv->mutex);
2169 return ret;
2170}
2171
2172static void iwl_config_ap(struct iwl_priv *priv) 2039static void iwl_config_ap(struct iwl_priv *priv)
2173{ 2040{
2174 int ret = 0; 2041 int ret = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index b8afd9b81fb8..4369fc8978f9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2443,6 +2443,142 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw,
2443} 2443}
2444EXPORT_SYMBOL(iwl_mac_remove_interface); 2444EXPORT_SYMBOL(iwl_mac_remove_interface);
2445 2445
2446/**
2447 * iwl_mac_config - mac80211 config callback
2448 *
2449 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to
2450 * be set inappropriately and the driver currently sets the hardware up to
2451 * use it whenever needed.
2452 */
2453int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
2454{
2455 struct iwl_priv *priv = hw->priv;
2456 const struct iwl_channel_info *ch_info;
2457 struct ieee80211_conf *conf = &hw->conf;
2458 unsigned long flags = 0;
2459 int ret = 0;
2460 u16 ch;
2461 int scan_active = 0;
2462
2463 mutex_lock(&priv->mutex);
2464
2465 if (!iwl_is_ready(priv)) {
2466 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
2467 ret = -EIO;
2468 goto out;
2469 }
2470
2471 IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n",
2472 conf->channel->hw_value, changed);
2473
2474 if (unlikely(!priv->cfg->mod_params->disable_hw_scan &&
2475 test_bit(STATUS_SCANNING, &priv->status))) {
2476 scan_active = 1;
2477 IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
2478 }
2479
2480
2481 /* during scanning mac80211 will delay channel setting until
2482 * scan finish with changed = 0
2483 */
2484 if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
2485 if (scan_active)
2486 goto set_ch_out;
2487
2488 ch = ieee80211_frequency_to_channel(conf->channel->center_freq);
2489 ch_info = iwl_get_channel_info(priv, conf->channel->band, ch);
2490 if (!is_channel_valid(ch_info)) {
2491 IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
2492 ret = -EINVAL;
2493 goto set_ch_out;
2494 }
2495
2496 if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
2497 !is_channel_ibss(ch_info)) {
2498 IWL_ERR(priv, "channel %d in band %d not "
2499 "IBSS channel\n",
2500 conf->channel->hw_value, conf->channel->band);
2501 ret = -EINVAL;
2502 goto set_ch_out;
2503 }
2504
2505 priv->current_ht_config.is_ht = conf_is_ht(conf);
2506
2507 spin_lock_irqsave(&priv->lock, flags);
2508
2509
2510 /* if we are switching from ht to 2.4 clear flags
2511 * from any ht related info since 2.4 does not
2512 * support ht */
2513 if ((le16_to_cpu(priv->staging_rxon.channel) != ch))
2514 priv->staging_rxon.flags = 0;
2515
2516 iwl_set_rxon_channel(priv, conf->channel);
2517
2518 iwl_set_flags_for_band(priv, conf->channel->band);
2519 spin_unlock_irqrestore(&priv->lock, flags);
2520 set_ch_out:
2521 /* The list of supported rates and rate mask can be different
2522 * for each band; since the band may have changed, reset
2523 * the rate mask to what mac80211 lists */
2524 iwl_set_rate(priv);
2525 }
2526
2527 if (changed & IEEE80211_CONF_CHANGE_PS) {
2528 if (conf->flags & IEEE80211_CONF_PS)
2529 ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3);
2530 else
2531 ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM);
2532 if (ret)
2533 IWL_DEBUG_MAC80211(priv, "Error setting power level\n");
2534
2535 }
2536
2537 if (changed & IEEE80211_CONF_CHANGE_POWER) {
2538 IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
2539 priv->tx_power_user_lmt, conf->power_level);
2540
2541 iwl_set_tx_power(priv, conf->power_level, false);
2542 }
2543
2544 /* call to ensure that 4965 rx_chain is set properly in monitor mode */
2545 if (priv->cfg->ops->hcmd->set_rxon_chain)
2546 priv->cfg->ops->hcmd->set_rxon_chain(priv);
2547
2548 if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
2549 if (conf->radio_enabled &&
2550 iwl_radio_kill_sw_enable_radio(priv)) {
2551 IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - "
2552 "waiting for uCode\n");
2553 goto out;
2554 }
2555
2556 if (!conf->radio_enabled)
2557 iwl_radio_kill_sw_disable_radio(priv);
2558 }
2559
2560 if (!conf->radio_enabled) {
2561 IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
2562 goto out;
2563 }
2564
2565 if (scan_active)
2566 goto out;
2567
2568 if (memcmp(&priv->active_rxon,
2569 &priv->staging_rxon, sizeof(priv->staging_rxon)))
2570 iwlcore_commit_rxon(priv);
2571 else
2572 IWL_DEBUG_INFO(priv, "Not re-sending same RXON configuration.\n");
2573
2574
2575out:
2576 IWL_DEBUG_MAC80211(priv, "leave\n");
2577 mutex_unlock(&priv->mutex);
2578 return ret;
2579}
2580EXPORT_SYMBOL(iwl_mac_config);
2581
2446#ifdef CONFIG_PM 2582#ifdef CONFIG_PM
2447 2583
2448int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) 2584int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 5dc33065f0ba..da8fae52a5d6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -278,6 +278,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw,
278 struct ieee80211_if_init_conf *conf); 278 struct ieee80211_if_init_conf *conf);
279void iwl_mac_remove_interface(struct ieee80211_hw *hw, 279void iwl_mac_remove_interface(struct ieee80211_hw *hw,
280 struct ieee80211_if_init_conf *conf); 280 struct ieee80211_if_init_conf *conf);
281int iwl_mac_config(struct ieee80211_hw *hw, u32 changed);
281 282
282/***************************************************** 283/*****************************************************
283 * RX handlers. 284 * RX handlers.
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index f82a9dc82eef..c5644a5e50c9 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3166,8 +3166,6 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data)
3166 mutex_unlock(&priv->mutex); 3166 mutex_unlock(&priv->mutex);
3167} 3167}
3168 3168
3169static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed);
3170
3171#define IWL_DELAY_NEXT_SCAN (HZ*2) 3169#define IWL_DELAY_NEXT_SCAN (HZ*2)
3172 3170
3173void iwl3945_post_associate(struct iwl_priv *priv) 3171void iwl3945_post_associate(struct iwl_priv *priv)
@@ -3380,108 +3378,6 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
3380 return NETDEV_TX_OK; 3378 return NETDEV_TX_OK;
3381} 3379}
3382 3380
3383/**
3384 * iwl3945_mac_config - mac80211 config callback
3385 *
3386 * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to
3387 * be set inappropriately and the driver currently sets the hardware up to
3388 * use it whenever needed.
3389 */
3390static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
3391{
3392 struct iwl_priv *priv = hw->priv;
3393 const struct iwl_channel_info *ch_info;
3394 struct ieee80211_conf *conf = &hw->conf;
3395 unsigned long flags;
3396 int ret = 0;
3397
3398 mutex_lock(&priv->mutex);
3399 IWL_DEBUG_MAC80211(priv, "enter to channel %d\n",
3400 conf->channel->hw_value);
3401
3402 if (!iwl_is_ready(priv)) {
3403 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
3404 ret = -EIO;
3405 goto out;
3406 }
3407
3408 if (unlikely(!iwl3945_mod_params.disable_hw_scan &&
3409 test_bit(STATUS_SCANNING, &priv->status))) {
3410 IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
3411 set_bit(STATUS_CONF_PENDING, &priv->status);
3412 mutex_unlock(&priv->mutex);
3413 return 0;
3414 }
3415
3416 spin_lock_irqsave(&priv->lock, flags);
3417
3418 ch_info = iwl_get_channel_info(priv, conf->channel->band,
3419 conf->channel->hw_value);
3420 if (!is_channel_valid(ch_info)) {
3421 IWL_DEBUG_SCAN(priv,
3422 "Channel %d [%d] is INVALID for this band.\n",
3423 conf->channel->hw_value, conf->channel->band);
3424 IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
3425 spin_unlock_irqrestore(&priv->lock, flags);
3426 ret = -EINVAL;
3427 goto out;
3428 }
3429
3430 iwl_set_rxon_channel(priv, conf->channel);
3431
3432 iwl_set_flags_for_band(priv, conf->channel->band);
3433
3434 /* The list of supported rates and rate mask can be different
3435 * for each phymode; since the phymode may have changed, reset
3436 * the rate mask to what mac80211 lists */
3437 iwl_set_rate(priv);
3438
3439 spin_unlock_irqrestore(&priv->lock, flags);
3440
3441#ifdef IEEE80211_CONF_CHANNEL_SWITCH
3442 if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) {
3443 iwl3945_hw_channel_switch(priv, conf->channel);
3444 goto out;
3445 }
3446#endif
3447
3448 if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) {
3449 if (conf->radio_enabled &&
3450 iwl_radio_kill_sw_enable_radio(priv)) {
3451 IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - "
3452 "waiting for uCode\n");
3453 goto out;
3454 }
3455
3456 if (!conf->radio_enabled) {
3457 iwl_radio_kill_sw_disable_radio(priv);
3458 IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
3459 goto out;
3460 }
3461 }
3462
3463 if (iwl_is_rfkill(priv)) {
3464 IWL_DEBUG_MAC80211(priv, "leave - RF kill\n");
3465 ret = -EIO;
3466 goto out;
3467 }
3468
3469 iwl_set_rate(priv);
3470
3471 if (memcmp(&priv->active_rxon,
3472 &priv->staging_rxon, sizeof(priv->staging_rxon)))
3473 iwlcore_commit_rxon(priv);
3474 else
3475 IWL_DEBUG_INFO(priv, "Not re-sending same RXON configuration\n");
3476
3477 IWL_DEBUG_MAC80211(priv, "leave\n");
3478
3479out:
3480 clear_bit(STATUS_CONF_PENDING, &priv->status);
3481 mutex_unlock(&priv->mutex);
3482 return ret;
3483}
3484
3485static void iwl3945_config_ap(struct iwl_priv *priv) 3381static void iwl3945_config_ap(struct iwl_priv *priv)
3486{ 3382{
3487 int rc = 0; 3383 int rc = 0;
@@ -4316,7 +4212,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
4316 .stop = iwl3945_mac_stop, 4212 .stop = iwl3945_mac_stop,
4317 .add_interface = iwl_mac_add_interface, 4213 .add_interface = iwl_mac_add_interface,
4318 .remove_interface = iwl_mac_remove_interface, 4214 .remove_interface = iwl_mac_remove_interface,
4319 .config = iwl3945_mac_config, 4215 .config = iwl_mac_config,
4320 .config_interface = iwl3945_mac_config_interface, 4216 .config_interface = iwl3945_mac_config_interface,
4321 .configure_filter = iwl_configure_filter, 4217 .configure_filter = iwl_configure_filter,
4322 .set_key = iwl3945_mac_set_key, 4218 .set_key = iwl3945_mac_set_key,