diff options
author | Abhijeet Kolekar <abhijeet.kolekar@intel.com> | 2009-04-08 14:26:50 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:43 -0400 |
commit | 5ee5811e24b20d49ea553fda568433effbab7a62 (patch) | |
tree | 35e835e3ac5e8e2740f8efbb4ae7030837549c51 /drivers/net | |
parent | 60690a6a38cc03142a0c5aaed64cf043e707457d (diff) |
iwl3945: use iwl_mac_config_interface from iwlwifi
3945 can now use iwl_mac_config_interface 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')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 100 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 100 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 102 |
4 files changed, 104 insertions, 201 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 97f8322e0661..edfece6e0d4c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2099,106 +2099,6 @@ void iwl_config_ap(struct iwl_priv *priv) | |||
2099 | * clear sta table, add BCAST sta... */ | 2099 | * clear sta table, add BCAST sta... */ |
2100 | } | 2100 | } |
2101 | 2101 | ||
2102 | |||
2103 | static int iwl_mac_config_interface(struct ieee80211_hw *hw, | ||
2104 | struct ieee80211_vif *vif, | ||
2105 | struct ieee80211_if_conf *conf) | ||
2106 | { | ||
2107 | struct iwl_priv *priv = hw->priv; | ||
2108 | int rc; | ||
2109 | |||
2110 | if (conf == NULL) | ||
2111 | return -EIO; | ||
2112 | |||
2113 | if (priv->vif != vif) { | ||
2114 | IWL_DEBUG_MAC80211(priv, "leave - priv->vif != vif\n"); | ||
2115 | return 0; | ||
2116 | } | ||
2117 | |||
2118 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
2119 | conf->changed & IEEE80211_IFCC_BEACON) { | ||
2120 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | ||
2121 | if (!beacon) | ||
2122 | return -ENOMEM; | ||
2123 | mutex_lock(&priv->mutex); | ||
2124 | rc = iwl_mac_beacon_update(hw, beacon); | ||
2125 | mutex_unlock(&priv->mutex); | ||
2126 | if (rc) | ||
2127 | return rc; | ||
2128 | } | ||
2129 | |||
2130 | if (!iwl_is_alive(priv)) | ||
2131 | return -EAGAIN; | ||
2132 | |||
2133 | mutex_lock(&priv->mutex); | ||
2134 | |||
2135 | if (conf->bssid) | ||
2136 | IWL_DEBUG_MAC80211(priv, "bssid: %pM\n", conf->bssid); | ||
2137 | |||
2138 | /* | ||
2139 | * very dubious code was here; the probe filtering flag is never set: | ||
2140 | * | ||
2141 | if (unlikely(test_bit(STATUS_SCANNING, &priv->status)) && | ||
2142 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | ||
2143 | */ | ||
2144 | |||
2145 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
2146 | if (!conf->bssid) { | ||
2147 | conf->bssid = priv->mac_addr; | ||
2148 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | ||
2149 | IWL_DEBUG_MAC80211(priv, "bssid was set to: %pM\n", | ||
2150 | conf->bssid); | ||
2151 | } | ||
2152 | if (priv->ibss_beacon) | ||
2153 | dev_kfree_skb(priv->ibss_beacon); | ||
2154 | |||
2155 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | ||
2156 | } | ||
2157 | |||
2158 | if (iwl_is_rfkill(priv)) | ||
2159 | goto done; | ||
2160 | |||
2161 | if (conf->bssid && !is_zero_ether_addr(conf->bssid) && | ||
2162 | !is_multicast_ether_addr(conf->bssid)) { | ||
2163 | /* If there is currently a HW scan going on in the background | ||
2164 | * then we need to cancel it else the RXON below will fail. */ | ||
2165 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
2166 | IWL_WARN(priv, "Aborted scan still in progress " | ||
2167 | "after 100ms\n"); | ||
2168 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
2169 | mutex_unlock(&priv->mutex); | ||
2170 | return -EAGAIN; | ||
2171 | } | ||
2172 | memcpy(priv->staging_rxon.bssid_addr, conf->bssid, ETH_ALEN); | ||
2173 | |||
2174 | /* TODO: Audit driver for usage of these members and see | ||
2175 | * if mac80211 deprecates them (priv->bssid looks like it | ||
2176 | * shouldn't be there, but I haven't scanned the IBSS code | ||
2177 | * to verify) - jpk */ | ||
2178 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | ||
2179 | |||
2180 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
2181 | iwlcore_config_ap(priv); | ||
2182 | else { | ||
2183 | rc = iwlcore_commit_rxon(priv); | ||
2184 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) | ||
2185 | iwl_rxon_add_station( | ||
2186 | priv, priv->active_rxon.bssid_addr, 1); | ||
2187 | } | ||
2188 | |||
2189 | } else { | ||
2190 | iwl_scan_cancel_timeout(priv, 100); | ||
2191 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2192 | iwlcore_commit_rxon(priv); | ||
2193 | } | ||
2194 | |||
2195 | done: | ||
2196 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2197 | mutex_unlock(&priv->mutex); | ||
2198 | |||
2199 | return 0; | ||
2200 | } | ||
2201 | |||
2202 | static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, | 2102 | static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, |
2203 | struct ieee80211_key_conf *keyconf, const u8 *addr, | 2103 | struct ieee80211_key_conf *keyconf, const u8 *addr, |
2204 | u32 iv32, u16 *phase1key) | 2104 | u32 iv32, u16 *phase1key) |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 4369fc8978f9..e8b74fc82515 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -2579,6 +2579,106 @@ out: | |||
2579 | } | 2579 | } |
2580 | EXPORT_SYMBOL(iwl_mac_config); | 2580 | EXPORT_SYMBOL(iwl_mac_config); |
2581 | 2581 | ||
2582 | int iwl_mac_config_interface(struct ieee80211_hw *hw, | ||
2583 | struct ieee80211_vif *vif, | ||
2584 | struct ieee80211_if_conf *conf) | ||
2585 | { | ||
2586 | struct iwl_priv *priv = hw->priv; | ||
2587 | int rc; | ||
2588 | |||
2589 | if (conf == NULL) | ||
2590 | return -EIO; | ||
2591 | |||
2592 | if (priv->vif != vif) { | ||
2593 | IWL_DEBUG_MAC80211(priv, "leave - priv->vif != vif\n"); | ||
2594 | return 0; | ||
2595 | } | ||
2596 | |||
2597 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
2598 | conf->changed & IEEE80211_IFCC_BEACON) { | ||
2599 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | ||
2600 | if (!beacon) | ||
2601 | return -ENOMEM; | ||
2602 | mutex_lock(&priv->mutex); | ||
2603 | rc = iwl_mac_beacon_update(hw, beacon); | ||
2604 | mutex_unlock(&priv->mutex); | ||
2605 | if (rc) | ||
2606 | return rc; | ||
2607 | } | ||
2608 | |||
2609 | if (!iwl_is_alive(priv)) | ||
2610 | return -EAGAIN; | ||
2611 | |||
2612 | mutex_lock(&priv->mutex); | ||
2613 | |||
2614 | if (conf->bssid) | ||
2615 | IWL_DEBUG_MAC80211(priv, "bssid: %pM\n", conf->bssid); | ||
2616 | |||
2617 | /* | ||
2618 | * very dubious code was here; the probe filtering flag is never set: | ||
2619 | * | ||
2620 | if (unlikely(test_bit(STATUS_SCANNING, &priv->status)) && | ||
2621 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | ||
2622 | */ | ||
2623 | |||
2624 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
2625 | if (!conf->bssid) { | ||
2626 | conf->bssid = priv->mac_addr; | ||
2627 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | ||
2628 | IWL_DEBUG_MAC80211(priv, "bssid was set to: %pM\n", | ||
2629 | conf->bssid); | ||
2630 | } | ||
2631 | if (priv->ibss_beacon) | ||
2632 | dev_kfree_skb(priv->ibss_beacon); | ||
2633 | |||
2634 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | ||
2635 | } | ||
2636 | |||
2637 | if (iwl_is_rfkill(priv)) | ||
2638 | goto done; | ||
2639 | |||
2640 | if (conf->bssid && !is_zero_ether_addr(conf->bssid) && | ||
2641 | !is_multicast_ether_addr(conf->bssid)) { | ||
2642 | /* If there is currently a HW scan going on in the background | ||
2643 | * then we need to cancel it else the RXON below will fail. */ | ||
2644 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
2645 | IWL_WARN(priv, "Aborted scan still in progress " | ||
2646 | "after 100ms\n"); | ||
2647 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
2648 | mutex_unlock(&priv->mutex); | ||
2649 | return -EAGAIN; | ||
2650 | } | ||
2651 | memcpy(priv->staging_rxon.bssid_addr, conf->bssid, ETH_ALEN); | ||
2652 | |||
2653 | /* TODO: Audit driver for usage of these members and see | ||
2654 | * if mac80211 deprecates them (priv->bssid looks like it | ||
2655 | * shouldn't be there, but I haven't scanned the IBSS code | ||
2656 | * to verify) - jpk */ | ||
2657 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | ||
2658 | |||
2659 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
2660 | iwlcore_config_ap(priv); | ||
2661 | else { | ||
2662 | rc = iwlcore_commit_rxon(priv); | ||
2663 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) | ||
2664 | iwl_rxon_add_station( | ||
2665 | priv, priv->active_rxon.bssid_addr, 1); | ||
2666 | } | ||
2667 | |||
2668 | } else { | ||
2669 | iwl_scan_cancel_timeout(priv, 100); | ||
2670 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2671 | iwlcore_commit_rxon(priv); | ||
2672 | } | ||
2673 | |||
2674 | done: | ||
2675 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2676 | mutex_unlock(&priv->mutex); | ||
2677 | |||
2678 | return 0; | ||
2679 | } | ||
2680 | EXPORT_SYMBOL(iwl_mac_config_interface); | ||
2681 | |||
2582 | #ifdef CONFIG_PM | 2682 | #ifdef CONFIG_PM |
2583 | 2683 | ||
2584 | int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | 2684 | int 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 af559b07cc8e..92a42c880488 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -281,6 +281,9 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw, | |||
281 | struct ieee80211_if_init_conf *conf); | 281 | struct ieee80211_if_init_conf *conf); |
282 | int iwl_mac_config(struct ieee80211_hw *hw, u32 changed); | 282 | int iwl_mac_config(struct ieee80211_hw *hw, u32 changed); |
283 | void iwl_config_ap(struct iwl_priv *priv); | 283 | void iwl_config_ap(struct iwl_priv *priv); |
284 | int iwl_mac_config_interface(struct ieee80211_hw *hw, | ||
285 | struct ieee80211_vif *vif, | ||
286 | struct ieee80211_if_conf *conf); | ||
284 | 287 | ||
285 | /***************************************************** | 288 | /***************************************************** |
286 | * RX handlers. | 289 | * RX handlers. |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index ad6f5ebeaf7a..3461768e5a2b 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -3436,106 +3436,6 @@ void iwl3945_config_ap(struct iwl_priv *priv) | |||
3436 | * clear sta table, add BCAST sta... */ | 3436 | * clear sta table, add BCAST sta... */ |
3437 | } | 3437 | } |
3438 | 3438 | ||
3439 | static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | ||
3440 | struct ieee80211_vif *vif, | ||
3441 | struct ieee80211_if_conf *conf) | ||
3442 | { | ||
3443 | struct iwl_priv *priv = hw->priv; | ||
3444 | int rc; | ||
3445 | |||
3446 | if (conf == NULL) | ||
3447 | return -EIO; | ||
3448 | |||
3449 | if (priv->vif != vif) { | ||
3450 | IWL_DEBUG_MAC80211(priv, "leave - priv->vif != vif\n"); | ||
3451 | return 0; | ||
3452 | } | ||
3453 | |||
3454 | /* handle this temporarily here */ | ||
3455 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
3456 | conf->changed & IEEE80211_IFCC_BEACON) { | ||
3457 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | ||
3458 | if (!beacon) | ||
3459 | return -ENOMEM; | ||
3460 | mutex_lock(&priv->mutex); | ||
3461 | rc = iwl_mac_beacon_update(hw, beacon); | ||
3462 | mutex_unlock(&priv->mutex); | ||
3463 | if (rc) | ||
3464 | return rc; | ||
3465 | } | ||
3466 | |||
3467 | if (!iwl_is_alive(priv)) | ||
3468 | return -EAGAIN; | ||
3469 | |||
3470 | mutex_lock(&priv->mutex); | ||
3471 | |||
3472 | if (conf->bssid) | ||
3473 | IWL_DEBUG_MAC80211(priv, "bssid: %pM\n", conf->bssid); | ||
3474 | |||
3475 | /* | ||
3476 | * very dubious code was here; the probe filtering flag is never set: | ||
3477 | * | ||
3478 | if (unlikely(test_bit(STATUS_SCANNING, &priv->status)) && | ||
3479 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | ||
3480 | */ | ||
3481 | |||
3482 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
3483 | if (!conf->bssid) { | ||
3484 | conf->bssid = priv->mac_addr; | ||
3485 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | ||
3486 | IWL_DEBUG_MAC80211(priv, "bssid was set to: %pM\n", | ||
3487 | conf->bssid); | ||
3488 | } | ||
3489 | if (priv->ibss_beacon) | ||
3490 | dev_kfree_skb(priv->ibss_beacon); | ||
3491 | |||
3492 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | ||
3493 | } | ||
3494 | |||
3495 | if (iwl_is_rfkill(priv)) | ||
3496 | goto done; | ||
3497 | |||
3498 | if (conf->bssid && !is_zero_ether_addr(conf->bssid) && | ||
3499 | !is_multicast_ether_addr(conf->bssid)) { | ||
3500 | /* If there is currently a HW scan going on in the background | ||
3501 | * then we need to cancel it else the RXON below will fail. */ | ||
3502 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
3503 | IWL_WARN(priv, "Aborted scan still in progress " | ||
3504 | "after 100ms\n"); | ||
3505 | IWL_DEBUG_MAC80211(priv, "leaving:scan abort failed\n"); | ||
3506 | mutex_unlock(&priv->mutex); | ||
3507 | return -EAGAIN; | ||
3508 | } | ||
3509 | memcpy(priv->staging_rxon.bssid_addr, conf->bssid, ETH_ALEN); | ||
3510 | |||
3511 | /* TODO: Audit driver for usage of these members and see | ||
3512 | * if mac80211 deprecates them (priv->bssid looks like it | ||
3513 | * shouldn't be there, but I haven't scanned the IBSS code | ||
3514 | * to verify) - jpk */ | ||
3515 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | ||
3516 | |||
3517 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
3518 | iwlcore_config_ap(priv); | ||
3519 | else { | ||
3520 | rc = iwlcore_commit_rxon(priv); | ||
3521 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) | ||
3522 | priv->cfg->ops->smgmt->add_station(priv, | ||
3523 | priv->active_rxon.bssid_addr, 1, 0, NULL); | ||
3524 | } | ||
3525 | |||
3526 | } else { | ||
3527 | iwl_scan_cancel_timeout(priv, 100); | ||
3528 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
3529 | iwlcore_commit_rxon(priv); | ||
3530 | } | ||
3531 | |||
3532 | done: | ||
3533 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
3534 | mutex_unlock(&priv->mutex); | ||
3535 | |||
3536 | return 0; | ||
3537 | } | ||
3538 | |||
3539 | static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 3439 | static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
3540 | struct ieee80211_vif *vif, | 3440 | struct ieee80211_vif *vif, |
3541 | struct ieee80211_sta *sta, | 3441 | struct ieee80211_sta *sta, |
@@ -4213,7 +4113,7 @@ static struct ieee80211_ops iwl3945_hw_ops = { | |||
4213 | .add_interface = iwl_mac_add_interface, | 4113 | .add_interface = iwl_mac_add_interface, |
4214 | .remove_interface = iwl_mac_remove_interface, | 4114 | .remove_interface = iwl_mac_remove_interface, |
4215 | .config = iwl_mac_config, | 4115 | .config = iwl_mac_config, |
4216 | .config_interface = iwl3945_mac_config_interface, | 4116 | .config_interface = iwl_mac_config_interface, |
4217 | .configure_filter = iwl_configure_filter, | 4117 | .configure_filter = iwl_configure_filter, |
4218 | .set_key = iwl3945_mac_set_key, | 4118 | .set_key = iwl3945_mac_set_key, |
4219 | .get_tx_stats = iwl3945_mac_get_tx_stats, | 4119 | .get_tx_stats = iwl3945_mac_get_tx_stats, |