diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
21 files changed, 1753 insertions, 1912 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index af6b9d444778..f63a9c5ba262 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -719,7 +719,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, | |||
719 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pm\n", | 719 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pm\n", |
720 | hdr->addr1); | 720 | hdr->addr1); |
721 | sta_id = iwl3945_add_station(priv, | 721 | sta_id = iwl3945_add_station(priv, |
722 | hdr->addr1, 0, CMD_ASYNC); | 722 | hdr->addr1, 0, CMD_ASYNC, NULL); |
723 | } | 723 | } |
724 | if (sta_id != IWL_INVALID_STATION) | 724 | if (sta_id != IWL_INVALID_STATION) |
725 | rs_sta->ibss_sta_added = 1; | 725 | rs_sta->ibss_sta_added = 1; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 527525cc0919..41f1d66cfeba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -1964,6 +1964,194 @@ int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) | |||
1964 | return 0; | 1964 | return 0; |
1965 | } | 1965 | } |
1966 | 1966 | ||
1967 | static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | ||
1968 | { | ||
1969 | int rc = 0; | ||
1970 | struct iwl_rx_packet *res = NULL; | ||
1971 | struct iwl3945_rxon_assoc_cmd rxon_assoc; | ||
1972 | struct iwl_host_cmd cmd = { | ||
1973 | .id = REPLY_RXON_ASSOC, | ||
1974 | .len = sizeof(rxon_assoc), | ||
1975 | .meta.flags = CMD_WANT_SKB, | ||
1976 | .data = &rxon_assoc, | ||
1977 | }; | ||
1978 | const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; | ||
1979 | const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; | ||
1980 | |||
1981 | if ((rxon1->flags == rxon2->flags) && | ||
1982 | (rxon1->filter_flags == rxon2->filter_flags) && | ||
1983 | (rxon1->cck_basic_rates == rxon2->cck_basic_rates) && | ||
1984 | (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { | ||
1985 | IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); | ||
1986 | return 0; | ||
1987 | } | ||
1988 | |||
1989 | rxon_assoc.flags = priv->staging_rxon.flags; | ||
1990 | rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; | ||
1991 | rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; | ||
1992 | rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; | ||
1993 | rxon_assoc.reserved = 0; | ||
1994 | |||
1995 | rc = iwl_send_cmd_sync(priv, &cmd); | ||
1996 | if (rc) | ||
1997 | return rc; | ||
1998 | |||
1999 | res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; | ||
2000 | if (res->hdr.flags & IWL_CMD_FAILED_MSK) { | ||
2001 | IWL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n"); | ||
2002 | rc = -EIO; | ||
2003 | } | ||
2004 | |||
2005 | priv->alloc_rxb_skb--; | ||
2006 | dev_kfree_skb_any(cmd.meta.u.skb); | ||
2007 | |||
2008 | return rc; | ||
2009 | } | ||
2010 | |||
2011 | /** | ||
2012 | * iwl3945_commit_rxon - commit staging_rxon to hardware | ||
2013 | * | ||
2014 | * The RXON command in staging_rxon is committed to the hardware and | ||
2015 | * the active_rxon structure is updated with the new data. This | ||
2016 | * function correctly transitions out of the RXON_ASSOC_MSK state if | ||
2017 | * a HW tune is required based on the RXON structure changes. | ||
2018 | */ | ||
2019 | static int iwl3945_commit_rxon(struct iwl_priv *priv) | ||
2020 | { | ||
2021 | /* cast away the const for active_rxon in this function */ | ||
2022 | struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | ||
2023 | struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon; | ||
2024 | int rc = 0; | ||
2025 | bool new_assoc = | ||
2026 | !!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK); | ||
2027 | |||
2028 | if (!iwl_is_alive(priv)) | ||
2029 | return -1; | ||
2030 | |||
2031 | /* always get timestamp with Rx frame */ | ||
2032 | staging_rxon->flags |= RXON_FLG_TSF2HOST_MSK; | ||
2033 | |||
2034 | /* select antenna */ | ||
2035 | staging_rxon->flags &= | ||
2036 | ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); | ||
2037 | staging_rxon->flags |= iwl3945_get_antenna_flags(priv); | ||
2038 | |||
2039 | rc = iwl_check_rxon_cmd(priv); | ||
2040 | if (rc) { | ||
2041 | IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); | ||
2042 | return -EINVAL; | ||
2043 | } | ||
2044 | |||
2045 | /* If we don't need to send a full RXON, we can use | ||
2046 | * iwl3945_rxon_assoc_cmd which is used to reconfigure filter | ||
2047 | * and other flags for the current radio configuration. */ | ||
2048 | if (!iwl_full_rxon_required(priv)) { | ||
2049 | rc = iwl_send_rxon_assoc(priv); | ||
2050 | if (rc) { | ||
2051 | IWL_ERR(priv, "Error setting RXON_ASSOC " | ||
2052 | "configuration (%d).\n", rc); | ||
2053 | return rc; | ||
2054 | } | ||
2055 | |||
2056 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | ||
2057 | |||
2058 | return 0; | ||
2059 | } | ||
2060 | |||
2061 | /* If we are currently associated and the new config requires | ||
2062 | * an RXON_ASSOC and the new config wants the associated mask enabled, | ||
2063 | * we must clear the associated from the active configuration | ||
2064 | * before we apply the new config */ | ||
2065 | if (iwl_is_associated(priv) && new_assoc) { | ||
2066 | IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); | ||
2067 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2068 | |||
2069 | /* | ||
2070 | * reserved4 and 5 could have been filled by the iwlcore code. | ||
2071 | * Let's clear them before pushing to the 3945. | ||
2072 | */ | ||
2073 | active_rxon->reserved4 = 0; | ||
2074 | active_rxon->reserved5 = 0; | ||
2075 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | ||
2076 | sizeof(struct iwl3945_rxon_cmd), | ||
2077 | &priv->active_rxon); | ||
2078 | |||
2079 | /* If the mask clearing failed then we set | ||
2080 | * active_rxon back to what it was previously */ | ||
2081 | if (rc) { | ||
2082 | active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; | ||
2083 | IWL_ERR(priv, "Error clearing ASSOC_MSK on current " | ||
2084 | "configuration (%d).\n", rc); | ||
2085 | return rc; | ||
2086 | } | ||
2087 | } | ||
2088 | |||
2089 | IWL_DEBUG_INFO(priv, "Sending RXON\n" | ||
2090 | "* with%s RXON_FILTER_ASSOC_MSK\n" | ||
2091 | "* channel = %d\n" | ||
2092 | "* bssid = %pM\n", | ||
2093 | (new_assoc ? "" : "out"), | ||
2094 | le16_to_cpu(staging_rxon->channel), | ||
2095 | staging_rxon->bssid_addr); | ||
2096 | |||
2097 | /* | ||
2098 | * reserved4 and 5 could have been filled by the iwlcore code. | ||
2099 | * Let's clear them before pushing to the 3945. | ||
2100 | */ | ||
2101 | staging_rxon->reserved4 = 0; | ||
2102 | staging_rxon->reserved5 = 0; | ||
2103 | |||
2104 | iwl_set_rxon_hwcrypto(priv, !priv->hw_params.sw_crypto); | ||
2105 | |||
2106 | /* Apply the new configuration */ | ||
2107 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | ||
2108 | sizeof(struct iwl3945_rxon_cmd), | ||
2109 | staging_rxon); | ||
2110 | if (rc) { | ||
2111 | IWL_ERR(priv, "Error setting new configuration (%d).\n", rc); | ||
2112 | return rc; | ||
2113 | } | ||
2114 | |||
2115 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | ||
2116 | |||
2117 | priv->cfg->ops->smgmt->clear_station_table(priv); | ||
2118 | |||
2119 | /* If we issue a new RXON command which required a tune then we must | ||
2120 | * send a new TXPOWER command or we won't be able to Tx any frames */ | ||
2121 | rc = priv->cfg->ops->lib->send_tx_power(priv); | ||
2122 | if (rc) { | ||
2123 | IWL_ERR(priv, "Error setting Tx power (%d).\n", rc); | ||
2124 | return rc; | ||
2125 | } | ||
2126 | |||
2127 | /* Add the broadcast address so we can send broadcast frames */ | ||
2128 | if (priv->cfg->ops->smgmt->add_station(priv, iwl_bcast_addr, 0, 0, NULL) == | ||
2129 | IWL_INVALID_STATION) { | ||
2130 | IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n"); | ||
2131 | return -EIO; | ||
2132 | } | ||
2133 | |||
2134 | /* If we have set the ASSOC_MSK and we are in BSS mode then | ||
2135 | * add the IWL_AP_ID to the station rate table */ | ||
2136 | if (iwl_is_associated(priv) && | ||
2137 | (priv->iw_mode == NL80211_IFTYPE_STATION)) | ||
2138 | if (priv->cfg->ops->smgmt->add_station(priv, | ||
2139 | priv->active_rxon.bssid_addr, 1, 0, NULL) | ||
2140 | == IWL_INVALID_STATION) { | ||
2141 | IWL_ERR(priv, "Error adding AP address for transmit\n"); | ||
2142 | return -EIO; | ||
2143 | } | ||
2144 | |||
2145 | /* Init the hardware's rate fallback order based on the band */ | ||
2146 | rc = iwl3945_init_hw_rate_table(priv); | ||
2147 | if (rc) { | ||
2148 | IWL_ERR(priv, "Error setting HW rate table: %02X\n", rc); | ||
2149 | return -EIO; | ||
2150 | } | ||
2151 | |||
2152 | return 0; | ||
2153 | } | ||
2154 | |||
1967 | /* will add 3945 channel switch cmd handling later */ | 2155 | /* will add 3945 channel switch cmd handling later */ |
1968 | int iwl3945_hw_channel_switch(struct iwl_priv *priv, u16 channel) | 2156 | int iwl3945_hw_channel_switch(struct iwl_priv *priv, u16 channel) |
1969 | { | 2157 | { |
@@ -2729,6 +2917,11 @@ static int iwl3945_load_bsm(struct iwl_priv *priv) | |||
2729 | return 0; | 2917 | return 0; |
2730 | } | 2918 | } |
2731 | 2919 | ||
2920 | static struct iwl_hcmd_ops iwl3945_hcmd = { | ||
2921 | .rxon_assoc = iwl3945_send_rxon_assoc, | ||
2922 | .commit_rxon = iwl3945_commit_rxon, | ||
2923 | }; | ||
2924 | |||
2732 | static struct iwl_lib_ops iwl3945_lib = { | 2925 | static struct iwl_lib_ops iwl3945_lib = { |
2733 | .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, | 2926 | .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd, |
2734 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, | 2927 | .txq_free_tfd = iwl3945_hw_txq_free_tfd, |
@@ -2758,6 +2951,17 @@ static struct iwl_lib_ops iwl3945_lib = { | |||
2758 | }, | 2951 | }, |
2759 | .send_tx_power = iwl3945_send_tx_power, | 2952 | .send_tx_power = iwl3945_send_tx_power, |
2760 | .is_valid_rtc_data_addr = iwl3945_hw_valid_rtc_data_addr, | 2953 | .is_valid_rtc_data_addr = iwl3945_hw_valid_rtc_data_addr, |
2954 | .post_associate = iwl3945_post_associate, | ||
2955 | .config_ap = iwl3945_config_ap, | ||
2956 | }; | ||
2957 | |||
2958 | static struct iwl_station_mgmt_ops iwl3945_station_mgmt = { | ||
2959 | .add_station = iwl3945_add_station, | ||
2960 | #if 0 | ||
2961 | .remove_station = iwl3945_remove_station, | ||
2962 | #endif | ||
2963 | .find_station = iwl3945_hw_find_station, | ||
2964 | .clear_station_table = iwl3945_clear_stations_table, | ||
2761 | }; | 2965 | }; |
2762 | 2966 | ||
2763 | static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { | 2967 | static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { |
@@ -2767,7 +2971,9 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = { | |||
2767 | 2971 | ||
2768 | static struct iwl_ops iwl3945_ops = { | 2972 | static struct iwl_ops iwl3945_ops = { |
2769 | .lib = &iwl3945_lib, | 2973 | .lib = &iwl3945_lib, |
2974 | .hcmd = &iwl3945_hcmd, | ||
2770 | .utils = &iwl3945_hcmd_utils, | 2975 | .utils = &iwl3945_hcmd_utils, |
2976 | .smgmt = &iwl3945_station_mgmt, | ||
2771 | }; | 2977 | }; |
2772 | 2978 | ||
2773 | static struct iwl_cfg iwl3945_bg_cfg = { | 2979 | static struct iwl_cfg iwl3945_bg_cfg = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index 55188844657b..da87528f355f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -162,7 +162,6 @@ struct iwl3945_frame { | |||
162 | #define STATUS_TEMPERATURE 8 | 162 | #define STATUS_TEMPERATURE 8 |
163 | #define STATUS_GEO_CONFIGURED 9 | 163 | #define STATUS_GEO_CONFIGURED 9 |
164 | #define STATUS_EXIT_PENDING 10 | 164 | #define STATUS_EXIT_PENDING 10 |
165 | #define STATUS_IN_SUSPEND 11 | ||
166 | #define STATUS_STATISTICS 12 | 165 | #define STATUS_STATISTICS 12 |
167 | #define STATUS_SCANNING 13 | 166 | #define STATUS_SCANNING 13 |
168 | #define STATUS_SCAN_ABORTING 14 | 167 | #define STATUS_SCAN_ABORTING 14 |
@@ -207,7 +206,8 @@ struct iwl3945_addsta_cmd; | |||
207 | extern int iwl3945_send_add_station(struct iwl_priv *priv, | 206 | extern int iwl3945_send_add_station(struct iwl_priv *priv, |
208 | struct iwl3945_addsta_cmd *sta, u8 flags); | 207 | struct iwl3945_addsta_cmd *sta, u8 flags); |
209 | extern u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *bssid, | 208 | extern u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *bssid, |
210 | int is_ap, u8 flags); | 209 | int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info); |
210 | extern void iwl3945_clear_stations_table(struct iwl_priv *priv); | ||
211 | extern int iwl3945_power_init_handle(struct iwl_priv *priv); | 211 | extern int iwl3945_power_init_handle(struct iwl_priv *priv); |
212 | extern int iwl3945_eeprom_init(struct iwl_priv *priv); | 212 | extern int iwl3945_eeprom_init(struct iwl_priv *priv); |
213 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); | 213 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); |
@@ -278,6 +278,8 @@ extern void iwl3945_hw_rx_statistics(struct iwl_priv *priv, | |||
278 | struct iwl_rx_mem_buffer *rxb); | 278 | struct iwl_rx_mem_buffer *rxb); |
279 | extern void iwl3945_disable_events(struct iwl_priv *priv); | 279 | extern void iwl3945_disable_events(struct iwl_priv *priv); |
280 | extern int iwl4965_get_temperature(const struct iwl_priv *priv); | 280 | extern int iwl4965_get_temperature(const struct iwl_priv *priv); |
281 | extern void iwl3945_post_associate(struct iwl_priv *priv); | ||
282 | extern void iwl3945_config_ap(struct iwl_priv *priv); | ||
281 | 283 | ||
282 | /** | 284 | /** |
283 | * iwl3945_hw_find_station - Find station id for a given BSSID | 285 | * iwl3945_hw_find_station - Find station id for a given BSSID |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 847a6220c5e6..a98ff4ead720 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -2268,9 +2268,17 @@ static void iwl4965_cancel_deferred_work(struct iwl_priv *priv) | |||
2268 | cancel_work_sync(&priv->txpower_work); | 2268 | cancel_work_sync(&priv->txpower_work); |
2269 | } | 2269 | } |
2270 | 2270 | ||
2271 | static struct iwl_station_mgmt_ops iwl4965_station_mgmt = { | ||
2272 | .add_station = iwl_add_station_flags, | ||
2273 | .remove_station = iwl_remove_station, | ||
2274 | .find_station = iwl_find_station, | ||
2275 | .clear_station_table = iwl_clear_stations_table, | ||
2276 | }; | ||
2271 | 2277 | ||
2272 | static struct iwl_hcmd_ops iwl4965_hcmd = { | 2278 | static struct iwl_hcmd_ops iwl4965_hcmd = { |
2273 | .rxon_assoc = iwl4965_send_rxon_assoc, | 2279 | .rxon_assoc = iwl4965_send_rxon_assoc, |
2280 | .commit_rxon = iwl_commit_rxon, | ||
2281 | .set_rxon_chain = iwl_set_rxon_chain, | ||
2274 | }; | 2282 | }; |
2275 | 2283 | ||
2276 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { | 2284 | static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = { |
@@ -2324,12 +2332,15 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2324 | .send_tx_power = iwl4965_send_tx_power, | 2332 | .send_tx_power = iwl4965_send_tx_power, |
2325 | .update_chain_flags = iwl_update_chain_flags, | 2333 | .update_chain_flags = iwl_update_chain_flags, |
2326 | .temperature = iwl4965_temperature_calib, | 2334 | .temperature = iwl4965_temperature_calib, |
2335 | .post_associate = iwl_post_associate, | ||
2336 | .config_ap = iwl_config_ap, | ||
2327 | }; | 2337 | }; |
2328 | 2338 | ||
2329 | static struct iwl_ops iwl4965_ops = { | 2339 | static struct iwl_ops iwl4965_ops = { |
2330 | .lib = &iwl4965_lib, | 2340 | .lib = &iwl4965_lib, |
2331 | .hcmd = &iwl4965_hcmd, | 2341 | .hcmd = &iwl4965_hcmd, |
2332 | .utils = &iwl4965_hcmd_utils, | 2342 | .utils = &iwl4965_hcmd_utils, |
2343 | .smgmt = &iwl4965_station_mgmt, | ||
2333 | }; | 2344 | }; |
2334 | 2345 | ||
2335 | struct iwl_cfg iwl4965_agn_cfg = { | 2346 | struct iwl_cfg iwl4965_agn_cfg = { |
@@ -2350,8 +2361,6 @@ MODULE_FIRMWARE(IWL4965_MODULE_FIRMWARE(IWL4965_UCODE_API_MAX)); | |||
2350 | 2361 | ||
2351 | module_param_named(antenna, iwl4965_mod_params.antenna, int, 0444); | 2362 | module_param_named(antenna, iwl4965_mod_params.antenna, int, 0444); |
2352 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); | 2363 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); |
2353 | module_param_named(disable, iwl4965_mod_params.disable, int, 0444); | ||
2354 | MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); | ||
2355 | module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444); | 2364 | module_param_named(swcrypto, iwl4965_mod_params.sw_crypto, int, 0444); |
2356 | MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); | 2365 | MODULE_PARM_DESC(swcrypto, "using crypto in software (default 0 [hardware])"); |
2357 | module_param_named(debug, iwl4965_mod_params.debug, uint, 0444); | 2366 | module_param_named(debug, iwl4965_mod_params.debug, uint, 0444); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index e5ca2511a81a..d731a836e6c8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -678,7 +678,7 @@ static void iwl5000_init_alive_start(struct iwl_priv *priv) | |||
678 | goto restart; | 678 | goto restart; |
679 | } | 679 | } |
680 | 680 | ||
681 | iwl_clear_stations_table(priv); | 681 | priv->cfg->ops->smgmt->clear_station_table(priv); |
682 | ret = priv->cfg->ops->lib->alive_notify(priv); | 682 | ret = priv->cfg->ops->lib->alive_notify(priv); |
683 | if (ret) { | 683 | if (ret) { |
684 | IWL_WARN(priv, | 684 | IWL_WARN(priv, |
@@ -1472,8 +1472,17 @@ int iwl5000_calc_rssi(struct iwl_priv *priv, | |||
1472 | return max_rssi - agc - IWL49_RSSI_OFFSET; | 1472 | return max_rssi - agc - IWL49_RSSI_OFFSET; |
1473 | } | 1473 | } |
1474 | 1474 | ||
1475 | struct iwl_station_mgmt_ops iwl5000_station_mgmt = { | ||
1476 | .add_station = iwl_add_station_flags, | ||
1477 | .remove_station = iwl_remove_station, | ||
1478 | .find_station = iwl_find_station, | ||
1479 | .clear_station_table = iwl_clear_stations_table, | ||
1480 | }; | ||
1481 | |||
1475 | struct iwl_hcmd_ops iwl5000_hcmd = { | 1482 | struct iwl_hcmd_ops iwl5000_hcmd = { |
1476 | .rxon_assoc = iwl5000_send_rxon_assoc, | 1483 | .rxon_assoc = iwl5000_send_rxon_assoc, |
1484 | .commit_rxon = iwl_commit_rxon, | ||
1485 | .set_rxon_chain = iwl_set_rxon_chain, | ||
1477 | }; | 1486 | }; |
1478 | 1487 | ||
1479 | struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = { | 1488 | struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = { |
@@ -1527,12 +1536,15 @@ struct iwl_lib_ops iwl5000_lib = { | |||
1527 | .calib_version = iwl5000_eeprom_calib_version, | 1536 | .calib_version = iwl5000_eeprom_calib_version, |
1528 | .query_addr = iwl5000_eeprom_query_addr, | 1537 | .query_addr = iwl5000_eeprom_query_addr, |
1529 | }, | 1538 | }, |
1539 | .post_associate = iwl_post_associate, | ||
1540 | .config_ap = iwl_config_ap, | ||
1530 | }; | 1541 | }; |
1531 | 1542 | ||
1532 | struct iwl_ops iwl5000_ops = { | 1543 | struct iwl_ops iwl5000_ops = { |
1533 | .lib = &iwl5000_lib, | 1544 | .lib = &iwl5000_lib, |
1534 | .hcmd = &iwl5000_hcmd, | 1545 | .hcmd = &iwl5000_hcmd, |
1535 | .utils = &iwl5000_hcmd_utils, | 1546 | .utils = &iwl5000_hcmd_utils, |
1547 | .smgmt = &iwl5000_station_mgmt, | ||
1536 | }; | 1548 | }; |
1537 | 1549 | ||
1538 | struct iwl_mod_params iwl50_mod_params = { | 1550 | struct iwl_mod_params iwl50_mod_params = { |
@@ -1643,9 +1655,6 @@ struct iwl_cfg iwl5150_agn_cfg = { | |||
1643 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 1655 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); |
1644 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | 1656 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); |
1645 | 1657 | ||
1646 | module_param_named(disable50, iwl50_mod_params.disable, int, 0444); | ||
1647 | MODULE_PARM_DESC(disable50, | ||
1648 | "manually disable the 50XX radio (default 0 [radio on])"); | ||
1649 | module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444); | 1658 | module_param_named(swcrypto50, iwl50_mod_params.sw_crypto, bool, 0444); |
1650 | MODULE_PARM_DESC(swcrypto50, | 1659 | MODULE_PARM_DESC(swcrypto50, |
1651 | "using software crypto engine (default 0 [hardware])\n"); | 1660 | "using software crypto engine (default 0 [hardware])\n"); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index edfa5e149f71..ee271d7f6120 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -72,6 +72,7 @@ static struct iwl_ops iwl6000_ops = { | |||
72 | .lib = &iwl5000_lib, | 72 | .lib = &iwl5000_lib, |
73 | .hcmd = &iwl5000_hcmd, | 73 | .hcmd = &iwl5000_hcmd, |
74 | .utils = &iwl6000_hcmd_utils, | 74 | .utils = &iwl6000_hcmd_utils, |
75 | .smgmt = &iwl5000_station_mgmt, | ||
75 | }; | 76 | }; |
76 | 77 | ||
77 | struct iwl_cfg iwl6000_2ag_cfg = { | 78 | struct iwl_cfg iwl6000_2ag_cfg = { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index cab7842a73aa..3504279c7586 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -52,7 +52,7 @@ | |||
52 | /* max allowed rate miss before sync LQ cmd */ | 52 | /* max allowed rate miss before sync LQ cmd */ |
53 | #define IWL_MISSED_RATE_MAX 15 | 53 | #define IWL_MISSED_RATE_MAX 15 |
54 | /* max time to accum history 2 seconds */ | 54 | /* max time to accum history 2 seconds */ |
55 | #define IWL_RATE_SCALE_FLUSH_INTVL (2*HZ) | 55 | #define IWL_RATE_SCALE_FLUSH_INTVL (3*HZ) |
56 | 56 | ||
57 | static u8 rs_ht_to_legacy[] = { | 57 | static u8 rs_ht_to_legacy[] = { |
58 | IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, | 58 | IWL_RATE_6M_INDEX, IWL_RATE_6M_INDEX, |
@@ -135,7 +135,7 @@ struct iwl_lq_sta { | |||
135 | u32 table_count; | 135 | u32 table_count; |
136 | u32 total_failed; /* total failed frames, any/all rates */ | 136 | u32 total_failed; /* total failed frames, any/all rates */ |
137 | u32 total_success; /* total successful frames, any/all rates */ | 137 | u32 total_success; /* total successful frames, any/all rates */ |
138 | u32 flush_timer; /* time staying in mode before new search */ | 138 | u64 flush_timer; /* time staying in mode before new search */ |
139 | 139 | ||
140 | u8 action_counter; /* # mode-switch actions tried */ | 140 | u8 action_counter; /* # mode-switch actions tried */ |
141 | u8 is_green; | 141 | u8 is_green; |
@@ -167,6 +167,8 @@ struct iwl_lq_sta { | |||
167 | 167 | ||
168 | /* used to be in sta_info */ | 168 | /* used to be in sta_info */ |
169 | int last_txrate_idx; | 169 | int last_txrate_idx; |
170 | /* last tx rate_n_flags */ | ||
171 | u32 last_rate_n_flags; | ||
170 | }; | 172 | }; |
171 | 173 | ||
172 | static void rs_rate_scale_perform(struct iwl_priv *priv, | 174 | static void rs_rate_scale_perform(struct iwl_priv *priv, |
@@ -191,7 +193,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, | |||
191 | * 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 60 MBits | 193 | * 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54, 60 MBits |
192 | * "G" is the only table that supports CCK (the first 4 rates). | 194 | * "G" is the only table that supports CCK (the first 4 rates). |
193 | */ | 195 | */ |
194 | /*FIXME:RS:need to separate tables for MIMO2/MIMO3*/ | 196 | |
195 | static s32 expected_tpt_A[IWL_RATE_COUNT] = { | 197 | static s32 expected_tpt_A[IWL_RATE_COUNT] = { |
196 | 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186 | 198 | 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186 |
197 | }; | 199 | }; |
@@ -208,11 +210,11 @@ static s32 expected_tpt_siso20MHzSGI[IWL_RATE_COUNT] = { | |||
208 | 0, 0, 0, 0, 46, 46, 82, 110, 132, 168, 192, 202, 211 | 210 | 0, 0, 0, 0, 46, 46, 82, 110, 132, 168, 192, 202, 211 |
209 | }; | 211 | }; |
210 | 212 | ||
211 | static s32 expected_tpt_mimo20MHz[IWL_RATE_COUNT] = { | 213 | static s32 expected_tpt_mimo2_20MHz[IWL_RATE_COUNT] = { |
212 | 0, 0, 0, 0, 74, 74, 123, 155, 179, 214, 236, 244, 251 | 214 | 0, 0, 0, 0, 74, 74, 123, 155, 179, 214, 236, 244, 251 |
213 | }; | 215 | }; |
214 | 216 | ||
215 | static s32 expected_tpt_mimo20MHzSGI[IWL_RATE_COUNT] = { | 217 | static s32 expected_tpt_mimo2_20MHzSGI[IWL_RATE_COUNT] = { |
216 | 0, 0, 0, 0, 81, 81, 131, 164, 188, 222, 243, 251, 257 | 218 | 0, 0, 0, 0, 81, 81, 131, 164, 188, 222, 243, 251, 257 |
217 | }; | 219 | }; |
218 | 220 | ||
@@ -224,14 +226,48 @@ static s32 expected_tpt_siso40MHzSGI[IWL_RATE_COUNT] = { | |||
224 | 0, 0, 0, 0, 83, 83, 135, 169, 193, 229, 250, 257, 264 | 226 | 0, 0, 0, 0, 83, 83, 135, 169, 193, 229, 250, 257, 264 |
225 | }; | 227 | }; |
226 | 228 | ||
227 | static s32 expected_tpt_mimo40MHz[IWL_RATE_COUNT] = { | 229 | static s32 expected_tpt_mimo2_40MHz[IWL_RATE_COUNT] = { |
228 | 0, 0, 0, 0, 123, 123, 182, 214, 235, 264, 279, 285, 289 | 230 | 0, 0, 0, 0, 123, 123, 182, 214, 235, 264, 279, 285, 289 |
229 | }; | 231 | }; |
230 | 232 | ||
231 | static s32 expected_tpt_mimo40MHzSGI[IWL_RATE_COUNT] = { | 233 | static s32 expected_tpt_mimo2_40MHzSGI[IWL_RATE_COUNT] = { |
232 | 0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293 | 234 | 0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293 |
233 | }; | 235 | }; |
234 | 236 | ||
237 | /* Expected throughput metric MIMO3 */ | ||
238 | static s32 expected_tpt_mimo3_20MHz[IWL_RATE_COUNT] = { | ||
239 | 0, 0, 0, 0, 99, 99, 153, 186, 208, 239, 256, 263, 268 | ||
240 | }; | ||
241 | |||
242 | static s32 expected_tpt_mimo3_20MHzSGI[IWL_RATE_COUNT] = { | ||
243 | 0, 0, 0, 0, 106, 106, 162, 194, 215, 246, 262, 268, 273 | ||
244 | }; | ||
245 | |||
246 | static s32 expected_tpt_mimo3_40MHz[IWL_RATE_COUNT] = { | ||
247 | 0, 0, 0, 0, 152, 152, 211, 239, 255, 279, 290, 294, 297 | ||
248 | }; | ||
249 | |||
250 | static s32 expected_tpt_mimo3_40MHzSGI[IWL_RATE_COUNT] = { | ||
251 | 0, 0, 0, 0, 160, 160, 219, 245, 261, 284, 294, 297, 300 | ||
252 | }; | ||
253 | |||
254 | /* mbps, mcs */ | ||
255 | const static struct iwl_rate_mcs_info iwl_rate_mcs[IWL_RATE_COUNT] = { | ||
256 | {"1", ""}, | ||
257 | {"2", ""}, | ||
258 | {"5.5", ""}, | ||
259 | {"11", ""}, | ||
260 | {"6", "BPSK 1/2"}, | ||
261 | {"9", "BPSK 1/2"}, | ||
262 | {"12", "QPSK 1/2"}, | ||
263 | {"18", "QPSK 3/4"}, | ||
264 | {"24", "16QAM 1/2"}, | ||
265 | {"36", "16QAM 3/4"}, | ||
266 | {"48", "64QAM 2/3"}, | ||
267 | {"54", "64QAM 3/4"}, | ||
268 | {"60", "64QAM 5/6"} | ||
269 | }; | ||
270 | |||
235 | static inline u8 rs_extract_rate(u32 rate_n_flags) | 271 | static inline u8 rs_extract_rate(u32 rate_n_flags) |
236 | { | 272 | { |
237 | return (u8)(rate_n_flags & 0xFF); | 273 | return (u8)(rate_n_flags & 0xFF); |
@@ -902,6 +938,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
902 | * else look up the rate that was, finally, successful. | 938 | * else look up the rate that was, finally, successful. |
903 | */ | 939 | */ |
904 | tx_rate = le32_to_cpu(table->rs_table[index].rate_n_flags); | 940 | tx_rate = le32_to_cpu(table->rs_table[index].rate_n_flags); |
941 | lq_sta->last_rate_n_flags = tx_rate; | ||
905 | rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); | 942 | rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); |
906 | 943 | ||
907 | /* Update frame history window with "success" if Tx got ACKed ... */ | 944 | /* Update frame history window with "success" if Tx got ACKed ... */ |
@@ -988,6 +1025,7 @@ static void rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy, | |||
988 | lq_sta->table_count = 0; | 1025 | lq_sta->table_count = 0; |
989 | lq_sta->total_failed = 0; | 1026 | lq_sta->total_failed = 0; |
990 | lq_sta->total_success = 0; | 1027 | lq_sta->total_success = 0; |
1028 | lq_sta->flush_timer = jiffies; | ||
991 | } | 1029 | } |
992 | 1030 | ||
993 | /* | 1031 | /* |
@@ -1011,17 +1049,26 @@ static void rs_set_expected_tpt_table(struct iwl_lq_sta *lq_sta, | |||
1011 | tbl->expected_tpt = expected_tpt_siso20MHzSGI; | 1049 | tbl->expected_tpt = expected_tpt_siso20MHzSGI; |
1012 | else | 1050 | else |
1013 | tbl->expected_tpt = expected_tpt_siso20MHz; | 1051 | tbl->expected_tpt = expected_tpt_siso20MHz; |
1014 | 1052 | } else if (is_mimo2(tbl->lq_type)) { | |
1015 | } else if (is_mimo(tbl->lq_type)) { /* FIXME:need to separate mimo2/3 */ | 1053 | if (tbl->is_fat && !lq_sta->is_dup) |
1054 | if (tbl->is_SGI) | ||
1055 | tbl->expected_tpt = expected_tpt_mimo2_40MHzSGI; | ||
1056 | else | ||
1057 | tbl->expected_tpt = expected_tpt_mimo2_40MHz; | ||
1058 | else if (tbl->is_SGI) | ||
1059 | tbl->expected_tpt = expected_tpt_mimo2_20MHzSGI; | ||
1060 | else | ||
1061 | tbl->expected_tpt = expected_tpt_mimo2_20MHz; | ||
1062 | } else if (is_mimo3(tbl->lq_type)) { | ||
1016 | if (tbl->is_fat && !lq_sta->is_dup) | 1063 | if (tbl->is_fat && !lq_sta->is_dup) |
1017 | if (tbl->is_SGI) | 1064 | if (tbl->is_SGI) |
1018 | tbl->expected_tpt = expected_tpt_mimo40MHzSGI; | 1065 | tbl->expected_tpt = expected_tpt_mimo3_40MHzSGI; |
1019 | else | 1066 | else |
1020 | tbl->expected_tpt = expected_tpt_mimo40MHz; | 1067 | tbl->expected_tpt = expected_tpt_mimo3_40MHz; |
1021 | else if (tbl->is_SGI) | 1068 | else if (tbl->is_SGI) |
1022 | tbl->expected_tpt = expected_tpt_mimo20MHzSGI; | 1069 | tbl->expected_tpt = expected_tpt_mimo3_20MHzSGI; |
1023 | else | 1070 | else |
1024 | tbl->expected_tpt = expected_tpt_mimo20MHz; | 1071 | tbl->expected_tpt = expected_tpt_mimo3_20MHz; |
1025 | } else | 1072 | } else |
1026 | tbl->expected_tpt = expected_tpt_G; | 1073 | tbl->expected_tpt = expected_tpt_G; |
1027 | } | 1074 | } |
@@ -1130,7 +1177,7 @@ static s32 rs_get_best_rate(struct iwl_priv *priv, | |||
1130 | } | 1177 | } |
1131 | 1178 | ||
1132 | /* | 1179 | /* |
1133 | * Set up search table for MIMO | 1180 | * Set up search table for MIMO2 |
1134 | */ | 1181 | */ |
1135 | static int rs_switch_to_mimo2(struct iwl_priv *priv, | 1182 | static int rs_switch_to_mimo2(struct iwl_priv *priv, |
1136 | struct iwl_lq_sta *lq_sta, | 1183 | struct iwl_lq_sta *lq_sta, |
@@ -1183,7 +1230,73 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv, | |||
1183 | rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); | 1230 | rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); |
1184 | 1231 | ||
1185 | IWL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", rate, rate_mask); | 1232 | IWL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", rate, rate_mask); |
1233 | if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { | ||
1234 | IWL_DEBUG_RATE(priv, "Can't switch with index %d rate mask %x\n", | ||
1235 | rate, rate_mask); | ||
1236 | return -1; | ||
1237 | } | ||
1238 | tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, rate, is_green); | ||
1239 | |||
1240 | IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n", | ||
1241 | tbl->current_rate, is_green); | ||
1242 | return 0; | ||
1243 | } | ||
1244 | |||
1245 | /* | ||
1246 | * Set up search table for MIMO3 | ||
1247 | */ | ||
1248 | static int rs_switch_to_mimo3(struct iwl_priv *priv, | ||
1249 | struct iwl_lq_sta *lq_sta, | ||
1250 | struct ieee80211_conf *conf, | ||
1251 | struct ieee80211_sta *sta, | ||
1252 | struct iwl_scale_tbl_info *tbl, int index) | ||
1253 | { | ||
1254 | u16 rate_mask; | ||
1255 | s32 rate; | ||
1256 | s8 is_green = lq_sta->is_green; | ||
1257 | |||
1258 | if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) | ||
1259 | return -1; | ||
1260 | |||
1261 | if (((sta->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >> 2) | ||
1262 | == WLAN_HT_CAP_SM_PS_STATIC) | ||
1263 | return -1; | ||
1264 | |||
1265 | /* Need both Tx chains/antennas to support MIMO */ | ||
1266 | if (priv->hw_params.tx_chains_num < 3) | ||
1267 | return -1; | ||
1268 | |||
1269 | IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO3\n"); | ||
1270 | |||
1271 | tbl->lq_type = LQ_MIMO3; | ||
1272 | tbl->is_dup = lq_sta->is_dup; | ||
1273 | tbl->action = 0; | ||
1274 | rate_mask = lq_sta->active_mimo3_rate; | ||
1275 | |||
1276 | if (priv->current_ht_config.supported_chan_width | ||
1277 | == IWL_CHANNEL_WIDTH_40MHZ) | ||
1278 | tbl->is_fat = 1; | ||
1279 | else | ||
1280 | tbl->is_fat = 0; | ||
1281 | |||
1282 | /* FIXME: - don't toggle SGI here | ||
1283 | if (tbl->is_fat) { | ||
1284 | if (priv->current_ht_config.sgf & HT_SHORT_GI_40MHZ_ONLY) | ||
1285 | tbl->is_SGI = 1; | ||
1286 | else | ||
1287 | tbl->is_SGI = 0; | ||
1288 | } else if (priv->current_ht_config.sgf & HT_SHORT_GI_20MHZ_ONLY) | ||
1289 | tbl->is_SGI = 1; | ||
1290 | else | ||
1291 | tbl->is_SGI = 0; | ||
1292 | */ | ||
1293 | |||
1294 | rs_set_expected_tpt_table(lq_sta, tbl); | ||
1295 | |||
1296 | rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index); | ||
1186 | 1297 | ||
1298 | IWL_DEBUG_RATE(priv, "LQ: MIMO3 best rate %d mask %X\n", | ||
1299 | rate, rate_mask); | ||
1187 | if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { | 1300 | if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { |
1188 | IWL_DEBUG_RATE(priv, "Can't switch with index %d rate mask %x\n", | 1301 | IWL_DEBUG_RATE(priv, "Can't switch with index %d rate mask %x\n", |
1189 | rate, rate_mask); | 1302 | rate, rate_mask); |
@@ -1342,9 +1455,29 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1342 | goto out; | 1455 | goto out; |
1343 | } | 1456 | } |
1344 | break; | 1457 | break; |
1458 | |||
1459 | case IWL_LEGACY_SWITCH_MIMO3_ABC: | ||
1460 | IWL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO3\n"); | ||
1461 | |||
1462 | /* Set up search table to try MIMO3 */ | ||
1463 | memcpy(search_tbl, tbl, sz); | ||
1464 | search_tbl->is_SGI = 0; | ||
1465 | |||
1466 | search_tbl->ant_type = ANT_ABC; | ||
1467 | |||
1468 | if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) | ||
1469 | break; | ||
1470 | |||
1471 | ret = rs_switch_to_mimo3(priv, lq_sta, conf, sta, | ||
1472 | search_tbl, index); | ||
1473 | if (!ret) { | ||
1474 | lq_sta->action_counter = 0; | ||
1475 | goto out; | ||
1476 | } | ||
1477 | break; | ||
1345 | } | 1478 | } |
1346 | tbl->action++; | 1479 | tbl->action++; |
1347 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO2_BC) | 1480 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) |
1348 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; | 1481 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; |
1349 | 1482 | ||
1350 | if (tbl->action == start_action) | 1483 | if (tbl->action == start_action) |
@@ -1357,7 +1490,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv, | |||
1357 | out: | 1490 | out: |
1358 | lq_sta->search_better_tbl = 1; | 1491 | lq_sta->search_better_tbl = 1; |
1359 | tbl->action++; | 1492 | tbl->action++; |
1360 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO2_BC) | 1493 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) |
1361 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; | 1494 | tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; |
1362 | return 0; | 1495 | return 0; |
1363 | 1496 | ||
@@ -1457,9 +1590,23 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1457 | rate_n_flags_from_tbl(priv, search_tbl, | 1590 | rate_n_flags_from_tbl(priv, search_tbl, |
1458 | index, is_green); | 1591 | index, is_green); |
1459 | goto out; | 1592 | goto out; |
1593 | case IWL_SISO_SWITCH_MIMO3_ABC: | ||
1594 | IWL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO3\n"); | ||
1595 | memcpy(search_tbl, tbl, sz); | ||
1596 | search_tbl->is_SGI = 0; | ||
1597 | search_tbl->ant_type = ANT_ABC; | ||
1598 | |||
1599 | if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) | ||
1600 | break; | ||
1601 | |||
1602 | ret = rs_switch_to_mimo3(priv, lq_sta, conf, sta, | ||
1603 | search_tbl, index); | ||
1604 | if (!ret) | ||
1605 | goto out; | ||
1606 | break; | ||
1460 | } | 1607 | } |
1461 | tbl->action++; | 1608 | tbl->action++; |
1462 | if (tbl->action > IWL_SISO_SWITCH_GI) | 1609 | if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) |
1463 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | 1610 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; |
1464 | 1611 | ||
1465 | if (tbl->action == start_action) | 1612 | if (tbl->action == start_action) |
@@ -1471,15 +1618,15 @@ static int rs_move_siso_to_other(struct iwl_priv *priv, | |||
1471 | out: | 1618 | out: |
1472 | lq_sta->search_better_tbl = 1; | 1619 | lq_sta->search_better_tbl = 1; |
1473 | tbl->action++; | 1620 | tbl->action++; |
1474 | if (tbl->action > IWL_SISO_SWITCH_GI) | 1621 | if (tbl->action > IWL_SISO_SWITCH_MIMO3_ABC) |
1475 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; | 1622 | tbl->action = IWL_SISO_SWITCH_ANTENNA1; |
1476 | return 0; | 1623 | return 0; |
1477 | } | 1624 | } |
1478 | 1625 | ||
1479 | /* | 1626 | /* |
1480 | * Try to switch to new modulation mode from MIMO | 1627 | * Try to switch to new modulation mode from MIMO2 |
1481 | */ | 1628 | */ |
1482 | static int rs_move_mimo_to_other(struct iwl_priv *priv, | 1629 | static int rs_move_mimo2_to_other(struct iwl_priv *priv, |
1483 | struct iwl_lq_sta *lq_sta, | 1630 | struct iwl_lq_sta *lq_sta, |
1484 | struct ieee80211_conf *conf, | 1631 | struct ieee80211_conf *conf, |
1485 | struct ieee80211_sta *sta, int index) | 1632 | struct ieee80211_sta *sta, int index) |
@@ -1501,7 +1648,7 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv, | |||
1501 | switch (tbl->action) { | 1648 | switch (tbl->action) { |
1502 | case IWL_MIMO2_SWITCH_ANTENNA1: | 1649 | case IWL_MIMO2_SWITCH_ANTENNA1: |
1503 | case IWL_MIMO2_SWITCH_ANTENNA2: | 1650 | case IWL_MIMO2_SWITCH_ANTENNA2: |
1504 | IWL_DEBUG_RATE(priv, "LQ: MIMO toggle Antennas\n"); | 1651 | IWL_DEBUG_RATE(priv, "LQ: MIMO2 toggle Antennas\n"); |
1505 | 1652 | ||
1506 | if (tx_chains_num <= 2) | 1653 | if (tx_chains_num <= 2) |
1507 | break; | 1654 | break; |
@@ -1549,9 +1696,9 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv, | |||
1549 | HT_SHORT_GI_40MHZ)) | 1696 | HT_SHORT_GI_40MHZ)) |
1550 | break; | 1697 | break; |
1551 | 1698 | ||
1552 | IWL_DEBUG_RATE(priv, "LQ: MIMO toggle SGI/NGI\n"); | 1699 | IWL_DEBUG_RATE(priv, "LQ: MIMO2 toggle SGI/NGI\n"); |
1553 | 1700 | ||
1554 | /* Set up new search table for MIMO */ | 1701 | /* Set up new search table for MIMO2 */ |
1555 | memcpy(search_tbl, tbl, sz); | 1702 | memcpy(search_tbl, tbl, sz); |
1556 | search_tbl->is_SGI = !tbl->is_SGI; | 1703 | search_tbl->is_SGI = !tbl->is_SGI; |
1557 | rs_set_expected_tpt_table(lq_sta, search_tbl); | 1704 | rs_set_expected_tpt_table(lq_sta, search_tbl); |
@@ -1571,9 +1718,24 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv, | |||
1571 | index, is_green); | 1718 | index, is_green); |
1572 | goto out; | 1719 | goto out; |
1573 | 1720 | ||
1721 | case IWL_MIMO2_SWITCH_MIMO3_ABC: | ||
1722 | IWL_DEBUG_RATE(priv, "LQ: MIMO2 switch to MIMO3\n"); | ||
1723 | memcpy(search_tbl, tbl, sz); | ||
1724 | search_tbl->is_SGI = 0; | ||
1725 | search_tbl->ant_type = ANT_ABC; | ||
1726 | |||
1727 | if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) | ||
1728 | break; | ||
1729 | |||
1730 | ret = rs_switch_to_mimo3(priv, lq_sta, conf, sta, | ||
1731 | search_tbl, index); | ||
1732 | if (!ret) | ||
1733 | goto out; | ||
1734 | |||
1735 | break; | ||
1574 | } | 1736 | } |
1575 | tbl->action++; | 1737 | tbl->action++; |
1576 | if (tbl->action > IWL_MIMO2_SWITCH_GI) | 1738 | if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) |
1577 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; | 1739 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; |
1578 | 1740 | ||
1579 | if (tbl->action == start_action) | 1741 | if (tbl->action == start_action) |
@@ -1584,13 +1746,150 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv, | |||
1584 | out: | 1746 | out: |
1585 | lq_sta->search_better_tbl = 1; | 1747 | lq_sta->search_better_tbl = 1; |
1586 | tbl->action++; | 1748 | tbl->action++; |
1587 | if (tbl->action > IWL_MIMO2_SWITCH_GI) | 1749 | if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) |
1588 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; | 1750 | tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; |
1589 | return 0; | 1751 | return 0; |
1590 | 1752 | ||
1591 | } | 1753 | } |
1592 | 1754 | ||
1593 | /* | 1755 | /* |
1756 | * Try to switch to new modulation mode from MIMO3 | ||
1757 | */ | ||
1758 | static int rs_move_mimo3_to_other(struct iwl_priv *priv, | ||
1759 | struct iwl_lq_sta *lq_sta, | ||
1760 | struct ieee80211_conf *conf, | ||
1761 | struct ieee80211_sta *sta, int index) | ||
1762 | { | ||
1763 | s8 is_green = lq_sta->is_green; | ||
1764 | struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); | ||
1765 | struct iwl_scale_tbl_info *search_tbl = | ||
1766 | &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); | ||
1767 | struct iwl_rate_scale_data *window = &(tbl->win[index]); | ||
1768 | u32 sz = (sizeof(struct iwl_scale_tbl_info) - | ||
1769 | (sizeof(struct iwl_rate_scale_data) * IWL_RATE_COUNT)); | ||
1770 | u8 start_action = tbl->action; | ||
1771 | u8 valid_tx_ant = priv->hw_params.valid_tx_ant; | ||
1772 | u8 tx_chains_num = priv->hw_params.tx_chains_num; | ||
1773 | int ret; | ||
1774 | |||
1775 | for (;;) { | ||
1776 | lq_sta->action_counter++; | ||
1777 | switch (tbl->action) { | ||
1778 | case IWL_MIMO3_SWITCH_ANTENNA1: | ||
1779 | case IWL_MIMO3_SWITCH_ANTENNA2: | ||
1780 | IWL_DEBUG_RATE(priv, "LQ: MIMO3 toggle Antennas\n"); | ||
1781 | |||
1782 | if (tx_chains_num <= 3) | ||
1783 | break; | ||
1784 | |||
1785 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | ||
1786 | break; | ||
1787 | |||
1788 | memcpy(search_tbl, tbl, sz); | ||
1789 | if (rs_toggle_antenna(valid_tx_ant, | ||
1790 | &search_tbl->current_rate, search_tbl)) | ||
1791 | goto out; | ||
1792 | break; | ||
1793 | case IWL_MIMO3_SWITCH_SISO_A: | ||
1794 | case IWL_MIMO3_SWITCH_SISO_B: | ||
1795 | case IWL_MIMO3_SWITCH_SISO_C: | ||
1796 | IWL_DEBUG_RATE(priv, "LQ: MIMO3 switch to SISO\n"); | ||
1797 | |||
1798 | /* Set up new search table for SISO */ | ||
1799 | memcpy(search_tbl, tbl, sz); | ||
1800 | |||
1801 | if (tbl->action == IWL_MIMO3_SWITCH_SISO_A) | ||
1802 | search_tbl->ant_type = ANT_A; | ||
1803 | else if (tbl->action == IWL_MIMO3_SWITCH_SISO_B) | ||
1804 | search_tbl->ant_type = ANT_B; | ||
1805 | else | ||
1806 | search_tbl->ant_type = ANT_C; | ||
1807 | |||
1808 | if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) | ||
1809 | break; | ||
1810 | |||
1811 | ret = rs_switch_to_siso(priv, lq_sta, conf, sta, | ||
1812 | search_tbl, index); | ||
1813 | if (!ret) | ||
1814 | goto out; | ||
1815 | |||
1816 | break; | ||
1817 | |||
1818 | case IWL_MIMO3_SWITCH_MIMO2_AB: | ||
1819 | case IWL_MIMO3_SWITCH_MIMO2_AC: | ||
1820 | case IWL_MIMO3_SWITCH_MIMO2_BC: | ||
1821 | IWL_DEBUG_RATE(priv, "LQ: MIMO3 switch to MIMO2\n"); | ||
1822 | |||
1823 | memcpy(search_tbl, tbl, sz); | ||
1824 | search_tbl->is_SGI = 0; | ||
1825 | if (tbl->action == IWL_MIMO3_SWITCH_MIMO2_AB) | ||
1826 | search_tbl->ant_type = ANT_AB; | ||
1827 | else if (tbl->action == IWL_MIMO3_SWITCH_MIMO2_AC) | ||
1828 | search_tbl->ant_type = ANT_AC; | ||
1829 | else | ||
1830 | search_tbl->ant_type = ANT_BC; | ||
1831 | |||
1832 | if (!rs_is_valid_ant(valid_tx_ant, search_tbl->ant_type)) | ||
1833 | break; | ||
1834 | |||
1835 | ret = rs_switch_to_mimo2(priv, lq_sta, conf, sta, | ||
1836 | search_tbl, index); | ||
1837 | if (!ret) | ||
1838 | goto out; | ||
1839 | |||
1840 | break; | ||
1841 | |||
1842 | case IWL_MIMO3_SWITCH_GI: | ||
1843 | if (!tbl->is_fat && | ||
1844 | !(priv->current_ht_config.sgf & | ||
1845 | HT_SHORT_GI_20MHZ)) | ||
1846 | break; | ||
1847 | if (tbl->is_fat && | ||
1848 | !(priv->current_ht_config.sgf & | ||
1849 | HT_SHORT_GI_40MHZ)) | ||
1850 | break; | ||
1851 | |||
1852 | IWL_DEBUG_RATE(priv, "LQ: MIMO3 toggle SGI/NGI\n"); | ||
1853 | |||
1854 | /* Set up new search table for MIMO */ | ||
1855 | memcpy(search_tbl, tbl, sz); | ||
1856 | search_tbl->is_SGI = !tbl->is_SGI; | ||
1857 | rs_set_expected_tpt_table(lq_sta, search_tbl); | ||
1858 | /* | ||
1859 | * If active table already uses the fastest possible | ||
1860 | * modulation (dual stream with short guard interval), | ||
1861 | * and it's working well, there's no need to look | ||
1862 | * for a better type of modulation! | ||
1863 | */ | ||
1864 | if (tbl->is_SGI) { | ||
1865 | s32 tpt = lq_sta->last_tpt / 100; | ||
1866 | if (tpt >= search_tbl->expected_tpt[index]) | ||
1867 | break; | ||
1868 | } | ||
1869 | search_tbl->current_rate = | ||
1870 | rate_n_flags_from_tbl(priv, search_tbl, | ||
1871 | index, is_green); | ||
1872 | goto out; | ||
1873 | } | ||
1874 | tbl->action++; | ||
1875 | if (tbl->action > IWL_MIMO3_SWITCH_GI) | ||
1876 | tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; | ||
1877 | |||
1878 | if (tbl->action == start_action) | ||
1879 | break; | ||
1880 | } | ||
1881 | search_tbl->lq_type = LQ_NONE; | ||
1882 | return 0; | ||
1883 | out: | ||
1884 | lq_sta->search_better_tbl = 1; | ||
1885 | tbl->action++; | ||
1886 | if (tbl->action > IWL_MIMO3_SWITCH_GI) | ||
1887 | tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; | ||
1888 | return 0; | ||
1889 | |||
1890 | } | ||
1891 | |||
1892 | /* | ||
1594 | * Check whether we should continue using same modulation mode, or | 1893 | * Check whether we should continue using same modulation mode, or |
1595 | * begin search for a new mode, based on: | 1894 | * begin search for a new mode, based on: |
1596 | * 1) # tx successes or failures while using this mode | 1895 | * 1) # tx successes or failures while using this mode |
@@ -1616,8 +1915,8 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta) | |||
1616 | /* Elapsed time using current modulation mode */ | 1915 | /* Elapsed time using current modulation mode */ |
1617 | if (lq_sta->flush_timer) | 1916 | if (lq_sta->flush_timer) |
1618 | flush_interval_passed = | 1917 | flush_interval_passed = |
1619 | time_after(jiffies, | 1918 | time_after(jiffies, |
1620 | (unsigned long)(lq_sta->flush_timer + | 1919 | (unsigned long)(lq_sta->flush_timer + |
1621 | IWL_RATE_SCALE_FLUSH_INTVL)); | 1920 | IWL_RATE_SCALE_FLUSH_INTVL)); |
1622 | 1921 | ||
1623 | /* | 1922 | /* |
@@ -1951,6 +2250,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1951 | update_lq = 1; | 2250 | update_lq = 1; |
1952 | index = low; | 2251 | index = low; |
1953 | } | 2252 | } |
2253 | |||
1954 | break; | 2254 | break; |
1955 | case 1: | 2255 | case 1: |
1956 | /* Increase starting rate, update uCode's rate table */ | 2256 | /* Increase starting rate, update uCode's rate table */ |
@@ -1997,8 +2297,10 @@ lq_update: | |||
1997 | rs_move_legacy_other(priv, lq_sta, conf, sta, index); | 2297 | rs_move_legacy_other(priv, lq_sta, conf, sta, index); |
1998 | else if (is_siso(tbl->lq_type)) | 2298 | else if (is_siso(tbl->lq_type)) |
1999 | rs_move_siso_to_other(priv, lq_sta, conf, sta, index); | 2299 | rs_move_siso_to_other(priv, lq_sta, conf, sta, index); |
2300 | else if (is_mimo2(tbl->lq_type)) | ||
2301 | rs_move_mimo2_to_other(priv, lq_sta, conf, sta, index); | ||
2000 | else | 2302 | else |
2001 | rs_move_mimo_to_other(priv, lq_sta, conf, sta, index); | 2303 | rs_move_mimo3_to_other(priv, lq_sta, conf, sta, index); |
2002 | 2304 | ||
2003 | /* If new "search" mode was selected, set up in uCode table */ | 2305 | /* If new "search" mode was selected, set up in uCode table */ |
2004 | if (lq_sta->search_better_tbl) { | 2306 | if (lq_sta->search_better_tbl) { |
@@ -2014,8 +2316,11 @@ lq_update: | |||
2014 | tbl->current_rate, index); | 2316 | tbl->current_rate, index); |
2015 | rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); | 2317 | rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); |
2016 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); | 2318 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); |
2017 | } | 2319 | } else |
2320 | done_search = 1; | ||
2321 | } | ||
2018 | 2322 | ||
2323 | if (done_search && !lq_sta->stay_in_tbl) { | ||
2019 | /* If the "active" (non-search) mode was legacy, | 2324 | /* If the "active" (non-search) mode was legacy, |
2020 | * and we've tried switching antennas, | 2325 | * and we've tried switching antennas, |
2021 | * but we haven't been able to try HT modes (not available), | 2326 | * but we haven't been able to try HT modes (not available), |
@@ -2050,17 +2355,6 @@ lq_update: | |||
2050 | lq_sta->action_counter = 0; | 2355 | lq_sta->action_counter = 0; |
2051 | rs_set_stay_in_table(priv, 0, lq_sta); | 2356 | rs_set_stay_in_table(priv, 0, lq_sta); |
2052 | } | 2357 | } |
2053 | |||
2054 | /* | ||
2055 | * Else, don't search for a new modulation mode. | ||
2056 | * Put new timestamp in stay-in-modulation-mode flush timer if: | ||
2057 | * 1) Not changing rates right now | ||
2058 | * 2) Not just finishing up a search | ||
2059 | * 3) flush timer is empty | ||
2060 | */ | ||
2061 | } else { | ||
2062 | if ((!update_lq) && (!done_search) && (!lq_sta->flush_timer)) | ||
2063 | lq_sta->flush_timer = jiffies; | ||
2064 | } | 2358 | } |
2065 | 2359 | ||
2066 | out: | 2360 | out: |
@@ -2173,13 +2467,15 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2173 | 2467 | ||
2174 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && | 2468 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
2175 | !lq_sta->ibss_sta_added) { | 2469 | !lq_sta->ibss_sta_added) { |
2176 | u8 sta_id = iwl_find_station(priv, hdr->addr1); | 2470 | u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, |
2471 | hdr->addr1); | ||
2177 | 2472 | ||
2178 | if (sta_id == IWL_INVALID_STATION) { | 2473 | if (sta_id == IWL_INVALID_STATION) { |
2179 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", | 2474 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", |
2180 | hdr->addr1); | 2475 | hdr->addr1); |
2181 | sta_id = iwl_add_station_flags(priv, hdr->addr1, | 2476 | sta_id = priv->cfg->ops->smgmt->add_station(priv, |
2182 | 0, CMD_ASYNC, NULL); | 2477 | hdr->addr1, 0, |
2478 | CMD_ASYNC, NULL); | ||
2183 | } | 2479 | } |
2184 | if ((sta_id != IWL_INVALID_STATION)) { | 2480 | if ((sta_id != IWL_INVALID_STATION)) { |
2185 | lq_sta->lq.sta_id = sta_id; | 2481 | lq_sta->lq.sta_id = sta_id; |
@@ -2246,15 +2542,17 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2246 | 2542 | ||
2247 | lq_sta->ibss_sta_added = 0; | 2543 | lq_sta->ibss_sta_added = 0; |
2248 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | 2544 | if (priv->iw_mode == NL80211_IFTYPE_AP) { |
2249 | u8 sta_id = iwl_find_station(priv, sta->addr); | 2545 | u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, |
2546 | sta->addr); | ||
2250 | 2547 | ||
2251 | /* for IBSS the call are from tasklet */ | 2548 | /* for IBSS the call are from tasklet */ |
2252 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr); | 2549 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr); |
2253 | 2550 | ||
2254 | if (sta_id == IWL_INVALID_STATION) { | 2551 | if (sta_id == IWL_INVALID_STATION) { |
2255 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr); | 2552 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr); |
2256 | sta_id = iwl_add_station_flags(priv, sta->addr, | 2553 | sta_id = priv->cfg->ops->smgmt->add_station(priv, |
2257 | 0, CMD_ASYNC, NULL); | 2554 | sta->addr, 0, |
2555 | CMD_ASYNC, NULL); | ||
2258 | } | 2556 | } |
2259 | if ((sta_id != IWL_INVALID_STATION)) { | 2557 | if ((sta_id != IWL_INVALID_STATION)) { |
2260 | lq_sta->lq.sta_id = sta_id; | 2558 | lq_sta->lq.sta_id = sta_id; |
@@ -2539,6 +2837,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2539 | char *buff; | 2837 | char *buff; |
2540 | int desc = 0; | 2838 | int desc = 0; |
2541 | int i = 0; | 2839 | int i = 0; |
2840 | int index = 0; | ||
2542 | ssize_t ret; | 2841 | ssize_t ret; |
2543 | 2842 | ||
2544 | struct iwl_lq_sta *lq_sta = file->private_data; | 2843 | struct iwl_lq_sta *lq_sta = file->private_data; |
@@ -2570,6 +2869,8 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2570 | (tbl->is_fat) ? "40MHz" : "20MHz"); | 2869 | (tbl->is_fat) ? "40MHz" : "20MHz"); |
2571 | desc += sprintf(buff+desc, " %s\n", (tbl->is_SGI) ? "SGI" : ""); | 2870 | desc += sprintf(buff+desc, " %s\n", (tbl->is_SGI) ? "SGI" : ""); |
2572 | } | 2871 | } |
2872 | desc += sprintf(buff+desc, "last tx rate=0x%X\n", | ||
2873 | lq_sta->last_rate_n_flags); | ||
2573 | desc += sprintf(buff+desc, "general:" | 2874 | desc += sprintf(buff+desc, "general:" |
2574 | "flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n", | 2875 | "flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n", |
2575 | lq_sta->lq.general_params.flags, | 2876 | lq_sta->lq.general_params.flags, |
@@ -2590,10 +2891,19 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2590 | lq_sta->lq.general_params.start_rate_index[2], | 2891 | lq_sta->lq.general_params.start_rate_index[2], |
2591 | lq_sta->lq.general_params.start_rate_index[3]); | 2892 | lq_sta->lq.general_params.start_rate_index[3]); |
2592 | 2893 | ||
2593 | 2894 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) { | |
2594 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) | 2895 | index = iwl_hwrate_to_plcp_idx( |
2595 | desc += sprintf(buff+desc, " rate[%d] 0x%X\n", | 2896 | le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); |
2596 | i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); | 2897 | if (is_legacy(tbl->lq_type)) { |
2898 | desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n", | ||
2899 | i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), | ||
2900 | iwl_rate_mcs[index].mbps); | ||
2901 | } else { | ||
2902 | desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps (%s)\n", | ||
2903 | i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags), | ||
2904 | iwl_rate_mcs[index].mbps, iwl_rate_mcs[index].mcs); | ||
2905 | } | ||
2906 | } | ||
2597 | 2907 | ||
2598 | ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); | 2908 | ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); |
2599 | kfree(buff); | 2909 | kfree(buff); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h index ab59acc405d9..f875136bc5dc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h | |||
@@ -241,6 +241,7 @@ enum { | |||
241 | #define IWL_LEGACY_SWITCH_MIMO2_AB 3 | 241 | #define IWL_LEGACY_SWITCH_MIMO2_AB 3 |
242 | #define IWL_LEGACY_SWITCH_MIMO2_AC 4 | 242 | #define IWL_LEGACY_SWITCH_MIMO2_AC 4 |
243 | #define IWL_LEGACY_SWITCH_MIMO2_BC 5 | 243 | #define IWL_LEGACY_SWITCH_MIMO2_BC 5 |
244 | #define IWL_LEGACY_SWITCH_MIMO3_ABC 6 | ||
244 | 245 | ||
245 | /* possible actions when in siso mode */ | 246 | /* possible actions when in siso mode */ |
246 | #define IWL_SISO_SWITCH_ANTENNA1 0 | 247 | #define IWL_SISO_SWITCH_ANTENNA1 0 |
@@ -249,6 +250,8 @@ enum { | |||
249 | #define IWL_SISO_SWITCH_MIMO2_AC 3 | 250 | #define IWL_SISO_SWITCH_MIMO2_AC 3 |
250 | #define IWL_SISO_SWITCH_MIMO2_BC 4 | 251 | #define IWL_SISO_SWITCH_MIMO2_BC 4 |
251 | #define IWL_SISO_SWITCH_GI 5 | 252 | #define IWL_SISO_SWITCH_GI 5 |
253 | #define IWL_SISO_SWITCH_MIMO3_ABC 6 | ||
254 | |||
252 | 255 | ||
253 | /* possible actions when in mimo mode */ | 256 | /* possible actions when in mimo mode */ |
254 | #define IWL_MIMO2_SWITCH_ANTENNA1 0 | 257 | #define IWL_MIMO2_SWITCH_ANTENNA1 0 |
@@ -257,6 +260,21 @@ enum { | |||
257 | #define IWL_MIMO2_SWITCH_SISO_B 3 | 260 | #define IWL_MIMO2_SWITCH_SISO_B 3 |
258 | #define IWL_MIMO2_SWITCH_SISO_C 4 | 261 | #define IWL_MIMO2_SWITCH_SISO_C 4 |
259 | #define IWL_MIMO2_SWITCH_GI 5 | 262 | #define IWL_MIMO2_SWITCH_GI 5 |
263 | #define IWL_MIMO2_SWITCH_MIMO3_ABC 6 | ||
264 | |||
265 | |||
266 | /* possible actions when in mimo3 mode */ | ||
267 | #define IWL_MIMO3_SWITCH_ANTENNA1 0 | ||
268 | #define IWL_MIMO3_SWITCH_ANTENNA2 1 | ||
269 | #define IWL_MIMO3_SWITCH_SISO_A 2 | ||
270 | #define IWL_MIMO3_SWITCH_SISO_B 3 | ||
271 | #define IWL_MIMO3_SWITCH_SISO_C 4 | ||
272 | #define IWL_MIMO3_SWITCH_MIMO2_AB 5 | ||
273 | #define IWL_MIMO3_SWITCH_MIMO2_AC 6 | ||
274 | #define IWL_MIMO3_SWITCH_MIMO2_BC 7 | ||
275 | #define IWL_MIMO3_SWITCH_GI 8 | ||
276 | |||
277 | |||
260 | 278 | ||
261 | /*FIXME:RS:add possible actions for MIMO3*/ | 279 | /*FIXME:RS:add possible actions for MIMO3*/ |
262 | 280 | ||
@@ -307,6 +325,13 @@ enum iwl_table_type { | |||
307 | #define ANT_BC (ANT_B | ANT_C) | 325 | #define ANT_BC (ANT_B | ANT_C) |
308 | #define ANT_ABC (ANT_AB | ANT_C) | 326 | #define ANT_ABC (ANT_AB | ANT_C) |
309 | 327 | ||
328 | #define IWL_MAX_MCS_DISPLAY_SIZE 12 | ||
329 | |||
330 | struct iwl_rate_mcs_info { | ||
331 | char mbps[IWL_MAX_MCS_DISPLAY_SIZE]; | ||
332 | char mcs[IWL_MAX_MCS_DISPLAY_SIZE]; | ||
333 | }; | ||
334 | |||
310 | static inline u8 num_of_ant(u8 mask) | 335 | static inline u8 num_of_ant(u8 mask) |
311 | { | 336 | { |
312 | return !!((mask) & ANT_A) + | 337 | return !!((mask) & ANT_A) + |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 1ef4192207a5..277dfc57fde9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -102,7 +102,7 @@ MODULE_ALIAS("iwl4965"); | |||
102 | * function correctly transitions out of the RXON_ASSOC_MSK state if | 102 | * function correctly transitions out of the RXON_ASSOC_MSK state if |
103 | * a HW tune is required based on the RXON structure changes. | 103 | * a HW tune is required based on the RXON structure changes. |
104 | */ | 104 | */ |
105 | static int iwl_commit_rxon(struct iwl_priv *priv) | 105 | int iwl_commit_rxon(struct iwl_priv *priv) |
106 | { | 106 | { |
107 | /* cast away the const for active_rxon in this function */ | 107 | /* cast away the const for active_rxon in this function */ |
108 | struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | 108 | struct iwl_rxon_cmd *active_rxon = (void *)&priv->active_rxon; |
@@ -188,7 +188,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv) | |||
188 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); | 188 | memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon)); |
189 | } | 189 | } |
190 | 190 | ||
191 | iwl_clear_stations_table(priv); | 191 | priv->cfg->ops->smgmt->clear_station_table(priv); |
192 | 192 | ||
193 | if (!priv->error_recovering) | 193 | if (!priv->error_recovering) |
194 | priv->start_calib = 0; | 194 | priv->start_calib = 0; |
@@ -246,8 +246,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv) | |||
246 | void iwl_update_chain_flags(struct iwl_priv *priv) | 246 | void iwl_update_chain_flags(struct iwl_priv *priv) |
247 | { | 247 | { |
248 | 248 | ||
249 | iwl_set_rxon_chain(priv); | 249 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
250 | iwl_commit_rxon(priv); | 250 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
251 | iwlcore_commit_rxon(priv); | ||
251 | } | 252 | } |
252 | 253 | ||
253 | static void iwl_clear_free_frames(struct iwl_priv *priv) | 254 | static void iwl_clear_free_frames(struct iwl_priv *priv) |
@@ -531,76 +532,6 @@ int iwl_hw_tx_queue_init(struct iwl_priv *priv, | |||
531 | * | 532 | * |
532 | ******************************************************************************/ | 533 | ******************************************************************************/ |
533 | 534 | ||
534 | static void iwl_ht_conf(struct iwl_priv *priv, | ||
535 | struct ieee80211_bss_conf *bss_conf) | ||
536 | { | ||
537 | struct ieee80211_sta_ht_cap *ht_conf; | ||
538 | struct iwl_ht_info *iwl_conf = &priv->current_ht_config; | ||
539 | struct ieee80211_sta *sta; | ||
540 | |||
541 | IWL_DEBUG_MAC80211(priv, "enter: \n"); | ||
542 | |||
543 | if (!iwl_conf->is_ht) | ||
544 | return; | ||
545 | |||
546 | |||
547 | /* | ||
548 | * It is totally wrong to base global information on something | ||
549 | * that is valid only when associated, alas, this driver works | ||
550 | * that way and I don't know how to fix it. | ||
551 | */ | ||
552 | |||
553 | rcu_read_lock(); | ||
554 | sta = ieee80211_find_sta(priv->hw, priv->bssid); | ||
555 | if (!sta) { | ||
556 | rcu_read_unlock(); | ||
557 | return; | ||
558 | } | ||
559 | ht_conf = &sta->ht_cap; | ||
560 | |||
561 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_20) | ||
562 | iwl_conf->sgf |= HT_SHORT_GI_20MHZ; | ||
563 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_40) | ||
564 | iwl_conf->sgf |= HT_SHORT_GI_40MHZ; | ||
565 | |||
566 | iwl_conf->is_green_field = !!(ht_conf->cap & IEEE80211_HT_CAP_GRN_FLD); | ||
567 | iwl_conf->max_amsdu_size = | ||
568 | !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU); | ||
569 | |||
570 | iwl_conf->supported_chan_width = | ||
571 | !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40); | ||
572 | |||
573 | /* | ||
574 | * XXX: The HT configuration needs to be moved into iwl_mac_config() | ||
575 | * to be done there correctly. | ||
576 | */ | ||
577 | |||
578 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
579 | if (conf_is_ht40_minus(&priv->hw->conf)) | ||
580 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
581 | else if (conf_is_ht40_plus(&priv->hw->conf)) | ||
582 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
583 | |||
584 | /* If no above or below channel supplied disable FAT channel */ | ||
585 | if (iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_ABOVE && | ||
586 | iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_BELOW) | ||
587 | iwl_conf->supported_chan_width = 0; | ||
588 | |||
589 | iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2); | ||
590 | |||
591 | memcpy(&iwl_conf->mcs, &ht_conf->mcs, 16); | ||
592 | |||
593 | iwl_conf->tx_chan_width = iwl_conf->supported_chan_width != 0; | ||
594 | iwl_conf->ht_protection = | ||
595 | bss_conf->ht.operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; | ||
596 | iwl_conf->non_GF_STA_present = | ||
597 | !!(bss_conf->ht.operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); | ||
598 | |||
599 | rcu_read_unlock(); | ||
600 | |||
601 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
602 | } | ||
603 | |||
604 | #define MAX_UCODE_BEACON_INTERVAL 4096 | 535 | #define MAX_UCODE_BEACON_INTERVAL 4096 |
605 | 536 | ||
606 | static u16 iwl_adjust_beacon_interval(u16 beacon_val) | 537 | static u16 iwl_adjust_beacon_interval(u16 beacon_val) |
@@ -657,30 +588,6 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv) | |||
657 | le16_to_cpu(priv->rxon_timing.atim_window)); | 588 | le16_to_cpu(priv->rxon_timing.atim_window)); |
658 | } | 589 | } |
659 | 590 | ||
660 | static int iwl_set_mode(struct iwl_priv *priv, int mode) | ||
661 | { | ||
662 | iwl_connection_init_rx_config(priv, mode); | ||
663 | iwl_set_rxon_chain(priv); | ||
664 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | ||
665 | |||
666 | iwl_clear_stations_table(priv); | ||
667 | |||
668 | /* dont commit rxon if rf-kill is on*/ | ||
669 | if (!iwl_is_ready_rf(priv)) | ||
670 | return -EAGAIN; | ||
671 | |||
672 | cancel_delayed_work(&priv->scan_check); | ||
673 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
674 | IWL_WARN(priv, "Aborted scan still in progress after 100ms\n"); | ||
675 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
676 | return -EAGAIN; | ||
677 | } | ||
678 | |||
679 | iwl_commit_rxon(priv); | ||
680 | |||
681 | return 0; | ||
682 | } | ||
683 | |||
684 | /****************************************************************************** | 591 | /****************************************************************************** |
685 | * | 592 | * |
686 | * Generic RX handler implementations | 593 | * Generic RX handler implementations |
@@ -1002,6 +909,7 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
1002 | IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, | 909 | IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r, |
1003 | i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); | 910 | i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); |
1004 | priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); | 911 | priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); |
912 | priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; | ||
1005 | } else { | 913 | } else { |
1006 | /* No handling needed */ | 914 | /* No handling needed */ |
1007 | IWL_DEBUG_RX(priv, | 915 | IWL_DEBUG_RX(priv, |
@@ -1065,7 +973,7 @@ static void iwl_error_recovery(struct iwl_priv *priv) | |||
1065 | memcpy(&priv->staging_rxon, &priv->recovery_rxon, | 973 | memcpy(&priv->staging_rxon, &priv->recovery_rxon, |
1066 | sizeof(priv->staging_rxon)); | 974 | sizeof(priv->staging_rxon)); |
1067 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 975 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1068 | iwl_commit_rxon(priv); | 976 | iwlcore_commit_rxon(priv); |
1069 | 977 | ||
1070 | iwl_rxon_add_station(priv, priv->bssid, 1); | 978 | iwl_rxon_add_station(priv, priv->bssid, 1); |
1071 | 979 | ||
@@ -1123,6 +1031,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1123 | /* Tell the device to stop sending interrupts */ | 1031 | /* Tell the device to stop sending interrupts */ |
1124 | iwl_disable_interrupts(priv); | 1032 | iwl_disable_interrupts(priv); |
1125 | 1033 | ||
1034 | priv->isr_stats.hw++; | ||
1126 | iwl_irq_handle_error(priv); | 1035 | iwl_irq_handle_error(priv); |
1127 | 1036 | ||
1128 | handled |= CSR_INT_BIT_HW_ERR; | 1037 | handled |= CSR_INT_BIT_HW_ERR; |
@@ -1135,13 +1044,17 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1135 | #ifdef CONFIG_IWLWIFI_DEBUG | 1044 | #ifdef CONFIG_IWLWIFI_DEBUG |
1136 | if (priv->debug_level & (IWL_DL_ISR)) { | 1045 | if (priv->debug_level & (IWL_DL_ISR)) { |
1137 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ | 1046 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ |
1138 | if (inta & CSR_INT_BIT_SCD) | 1047 | if (inta & CSR_INT_BIT_SCD) { |
1139 | IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " | 1048 | IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " |
1140 | "the frame/frames.\n"); | 1049 | "the frame/frames.\n"); |
1050 | priv->isr_stats.sch++; | ||
1051 | } | ||
1141 | 1052 | ||
1142 | /* Alive notification via Rx interrupt will do the real work */ | 1053 | /* Alive notification via Rx interrupt will do the real work */ |
1143 | if (inta & CSR_INT_BIT_ALIVE) | 1054 | if (inta & CSR_INT_BIT_ALIVE) { |
1144 | IWL_DEBUG_ISR(priv, "Alive interrupt\n"); | 1055 | IWL_DEBUG_ISR(priv, "Alive interrupt\n"); |
1056 | priv->isr_stats.alive++; | ||
1057 | } | ||
1145 | } | 1058 | } |
1146 | #endif | 1059 | #endif |
1147 | /* Safely ignore these bits for debug checks below */ | 1060 | /* Safely ignore these bits for debug checks below */ |
@@ -1157,6 +1070,8 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1157 | IWL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", | 1070 | IWL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n", |
1158 | hw_rf_kill ? "disable radio" : "enable radio"); | 1071 | hw_rf_kill ? "disable radio" : "enable radio"); |
1159 | 1072 | ||
1073 | priv->isr_stats.rfkill++; | ||
1074 | |||
1160 | /* driver only loads ucode once setting the interface up. | 1075 | /* driver only loads ucode once setting the interface up. |
1161 | * the driver allows loading the ucode even if the radio | 1076 | * the driver allows loading the ucode even if the radio |
1162 | * is killed. Hence update the killswitch state here. The | 1077 | * is killed. Hence update the killswitch state here. The |
@@ -1176,6 +1091,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1176 | /* Chip got too hot and stopped itself */ | 1091 | /* Chip got too hot and stopped itself */ |
1177 | if (inta & CSR_INT_BIT_CT_KILL) { | 1092 | if (inta & CSR_INT_BIT_CT_KILL) { |
1178 | IWL_ERR(priv, "Microcode CT kill error detected.\n"); | 1093 | IWL_ERR(priv, "Microcode CT kill error detected.\n"); |
1094 | priv->isr_stats.ctkill++; | ||
1179 | handled |= CSR_INT_BIT_CT_KILL; | 1095 | handled |= CSR_INT_BIT_CT_KILL; |
1180 | } | 1096 | } |
1181 | 1097 | ||
@@ -1183,6 +1099,8 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1183 | if (inta & CSR_INT_BIT_SW_ERR) { | 1099 | if (inta & CSR_INT_BIT_SW_ERR) { |
1184 | IWL_ERR(priv, "Microcode SW error detected. " | 1100 | IWL_ERR(priv, "Microcode SW error detected. " |
1185 | " Restarting 0x%X.\n", inta); | 1101 | " Restarting 0x%X.\n", inta); |
1102 | priv->isr_stats.sw++; | ||
1103 | priv->isr_stats.sw_err = inta; | ||
1186 | iwl_irq_handle_error(priv); | 1104 | iwl_irq_handle_error(priv); |
1187 | handled |= CSR_INT_BIT_SW_ERR; | 1105 | handled |= CSR_INT_BIT_SW_ERR; |
1188 | } | 1106 | } |
@@ -1198,6 +1116,8 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1198 | iwl_txq_update_write_ptr(priv, &priv->txq[4]); | 1116 | iwl_txq_update_write_ptr(priv, &priv->txq[4]); |
1199 | iwl_txq_update_write_ptr(priv, &priv->txq[5]); | 1117 | iwl_txq_update_write_ptr(priv, &priv->txq[5]); |
1200 | 1118 | ||
1119 | priv->isr_stats.wakeup++; | ||
1120 | |||
1201 | handled |= CSR_INT_BIT_WAKEUP; | 1121 | handled |= CSR_INT_BIT_WAKEUP; |
1202 | } | 1122 | } |
1203 | 1123 | ||
@@ -1206,19 +1126,23 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1206 | * notifications from uCode come through here*/ | 1126 | * notifications from uCode come through here*/ |
1207 | if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { | 1127 | if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { |
1208 | iwl_rx_handle(priv); | 1128 | iwl_rx_handle(priv); |
1129 | priv->isr_stats.rx++; | ||
1209 | handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); | 1130 | handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); |
1210 | } | 1131 | } |
1211 | 1132 | ||
1212 | if (inta & CSR_INT_BIT_FH_TX) { | 1133 | if (inta & CSR_INT_BIT_FH_TX) { |
1213 | IWL_DEBUG_ISR(priv, "Tx interrupt\n"); | 1134 | IWL_DEBUG_ISR(priv, "Tx interrupt\n"); |
1135 | priv->isr_stats.tx++; | ||
1214 | handled |= CSR_INT_BIT_FH_TX; | 1136 | handled |= CSR_INT_BIT_FH_TX; |
1215 | /* FH finished to write, send event */ | 1137 | /* FH finished to write, send event */ |
1216 | priv->ucode_write_complete = 1; | 1138 | priv->ucode_write_complete = 1; |
1217 | wake_up_interruptible(&priv->wait_command_queue); | 1139 | wake_up_interruptible(&priv->wait_command_queue); |
1218 | } | 1140 | } |
1219 | 1141 | ||
1220 | if (inta & ~handled) | 1142 | if (inta & ~handled) { |
1221 | IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); | 1143 | IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); |
1144 | priv->isr_stats.unhandled++; | ||
1145 | } | ||
1222 | 1146 | ||
1223 | if (inta & ~CSR_INI_SET_MASK) { | 1147 | if (inta & ~CSR_INI_SET_MASK) { |
1224 | IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", | 1148 | IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", |
@@ -1243,6 +1167,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1243 | spin_unlock_irqrestore(&priv->lock, flags); | 1167 | spin_unlock_irqrestore(&priv->lock, flags); |
1244 | } | 1168 | } |
1245 | 1169 | ||
1170 | |||
1246 | /****************************************************************************** | 1171 | /****************************************************************************** |
1247 | * | 1172 | * |
1248 | * uCode download functions | 1173 | * uCode download functions |
@@ -1508,10 +1433,6 @@ static int iwl_read_ucode(struct iwl_priv *priv) | |||
1508 | return ret; | 1433 | return ret; |
1509 | } | 1434 | } |
1510 | 1435 | ||
1511 | /* temporary */ | ||
1512 | static int iwl_mac_beacon_update(struct ieee80211_hw *hw, | ||
1513 | struct sk_buff *skb); | ||
1514 | |||
1515 | /** | 1436 | /** |
1516 | * iwl_alive_start - called after REPLY_ALIVE notification received | 1437 | * iwl_alive_start - called after REPLY_ALIVE notification received |
1517 | * from protocol/runtime uCode (initialization uCode's | 1438 | * from protocol/runtime uCode (initialization uCode's |
@@ -1540,7 +1461,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
1540 | goto restart; | 1461 | goto restart; |
1541 | } | 1462 | } |
1542 | 1463 | ||
1543 | iwl_clear_stations_table(priv); | 1464 | priv->cfg->ops->smgmt->clear_station_table(priv); |
1544 | ret = priv->cfg->ops->lib->alive_notify(priv); | 1465 | ret = priv->cfg->ops->lib->alive_notify(priv); |
1545 | if (ret) { | 1466 | if (ret) { |
1546 | IWL_WARN(priv, | 1467 | IWL_WARN(priv, |
@@ -1568,7 +1489,10 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
1568 | } else { | 1489 | } else { |
1569 | /* Initialize our rx_config data */ | 1490 | /* Initialize our rx_config data */ |
1570 | iwl_connection_init_rx_config(priv, priv->iw_mode); | 1491 | iwl_connection_init_rx_config(priv, priv->iw_mode); |
1571 | iwl_set_rxon_chain(priv); | 1492 | |
1493 | if (priv->cfg->ops->hcmd->set_rxon_chain) | ||
1494 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
1495 | |||
1572 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | 1496 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); |
1573 | } | 1497 | } |
1574 | 1498 | ||
@@ -1578,7 +1502,7 @@ static void iwl_alive_start(struct iwl_priv *priv) | |||
1578 | iwl_reset_run_time_calib(priv); | 1502 | iwl_reset_run_time_calib(priv); |
1579 | 1503 | ||
1580 | /* Configure the adapter for unassociated operation */ | 1504 | /* Configure the adapter for unassociated operation */ |
1581 | iwl_commit_rxon(priv); | 1505 | iwlcore_commit_rxon(priv); |
1582 | 1506 | ||
1583 | /* At this point, the NIC is initialized and operational */ | 1507 | /* At this point, the NIC is initialized and operational */ |
1584 | iwl_rf_kill_ct_config(priv); | 1508 | iwl_rf_kill_ct_config(priv); |
@@ -1626,7 +1550,7 @@ static void __iwl_down(struct iwl_priv *priv) | |||
1626 | 1550 | ||
1627 | iwl_leds_unregister(priv); | 1551 | iwl_leds_unregister(priv); |
1628 | 1552 | ||
1629 | iwl_clear_stations_table(priv); | 1553 | priv->cfg->ops->smgmt->clear_station_table(priv); |
1630 | 1554 | ||
1631 | /* Unblock any waiting calls */ | 1555 | /* Unblock any waiting calls */ |
1632 | wake_up_interruptible_all(&priv->wait_command_queue); | 1556 | wake_up_interruptible_all(&priv->wait_command_queue); |
@@ -1649,7 +1573,7 @@ static void __iwl_down(struct iwl_priv *priv) | |||
1649 | ieee80211_stop_queues(priv->hw); | 1573 | ieee80211_stop_queues(priv->hw); |
1650 | 1574 | ||
1651 | /* If we have not previously called iwl_init() then | 1575 | /* If we have not previously called iwl_init() then |
1652 | * clear all bits but the RF Kill and SUSPEND bits and return */ | 1576 | * clear all bits but the RF Kill bits and return */ |
1653 | if (!iwl_is_init(priv)) { | 1577 | if (!iwl_is_init(priv)) { |
1654 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << | 1578 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << |
1655 | STATUS_RF_KILL_HW | | 1579 | STATUS_RF_KILL_HW | |
@@ -1657,23 +1581,19 @@ static void __iwl_down(struct iwl_priv *priv) | |||
1657 | STATUS_RF_KILL_SW | | 1581 | STATUS_RF_KILL_SW | |
1658 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 1582 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << |
1659 | STATUS_GEO_CONFIGURED | | 1583 | STATUS_GEO_CONFIGURED | |
1660 | test_bit(STATUS_IN_SUSPEND, &priv->status) << | ||
1661 | STATUS_IN_SUSPEND | | ||
1662 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 1584 | test_bit(STATUS_EXIT_PENDING, &priv->status) << |
1663 | STATUS_EXIT_PENDING; | 1585 | STATUS_EXIT_PENDING; |
1664 | goto exit; | 1586 | goto exit; |
1665 | } | 1587 | } |
1666 | 1588 | ||
1667 | /* ...otherwise clear out all the status bits but the RF Kill and | 1589 | /* ...otherwise clear out all the status bits but the RF Kill |
1668 | * SUSPEND bits and continue taking the NIC down. */ | 1590 | * bits and continue taking the NIC down. */ |
1669 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << | 1591 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << |
1670 | STATUS_RF_KILL_HW | | 1592 | STATUS_RF_KILL_HW | |
1671 | test_bit(STATUS_RF_KILL_SW, &priv->status) << | 1593 | test_bit(STATUS_RF_KILL_SW, &priv->status) << |
1672 | STATUS_RF_KILL_SW | | 1594 | STATUS_RF_KILL_SW | |
1673 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 1595 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << |
1674 | STATUS_GEO_CONFIGURED | | 1596 | STATUS_GEO_CONFIGURED | |
1675 | test_bit(STATUS_IN_SUSPEND, &priv->status) << | ||
1676 | STATUS_IN_SUSPEND | | ||
1677 | test_bit(STATUS_FW_ERROR, &priv->status) << | 1597 | test_bit(STATUS_FW_ERROR, &priv->status) << |
1678 | STATUS_FW_ERROR | | 1598 | STATUS_FW_ERROR | |
1679 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 1599 | test_bit(STATUS_EXIT_PENDING, &priv->status) << |
@@ -1698,7 +1618,7 @@ static void __iwl_down(struct iwl_priv *priv) | |||
1698 | udelay(5); | 1618 | udelay(5); |
1699 | 1619 | ||
1700 | /* FIXME: apm_ops.suspend(priv) */ | 1620 | /* FIXME: apm_ops.suspend(priv) */ |
1701 | if (exit_pending || test_bit(STATUS_IN_SUSPEND, &priv->status)) | 1621 | if (exit_pending) |
1702 | priv->cfg->ops->lib->apm_ops.stop(priv); | 1622 | priv->cfg->ops->lib->apm_ops.stop(priv); |
1703 | else | 1623 | else |
1704 | priv->cfg->ops->lib->apm_ops.reset(priv); | 1624 | priv->cfg->ops->lib->apm_ops.reset(priv); |
@@ -1781,7 +1701,7 @@ static int __iwl_up(struct iwl_priv *priv) | |||
1781 | 1701 | ||
1782 | for (i = 0; i < MAX_HW_RESTARTS; i++) { | 1702 | for (i = 0; i < MAX_HW_RESTARTS; i++) { |
1783 | 1703 | ||
1784 | iwl_clear_stations_table(priv); | 1704 | priv->cfg->ops->smgmt->clear_station_table(priv); |
1785 | 1705 | ||
1786 | /* load bootstrap state machine, | 1706 | /* load bootstrap state machine, |
1787 | * load bootstrap program into processor's memory, | 1707 | * load bootstrap program into processor's memory, |
@@ -1910,7 +1830,7 @@ static void iwl_bg_rx_replenish(struct work_struct *data) | |||
1910 | 1830 | ||
1911 | #define IWL_DELAY_NEXT_SCAN (HZ*2) | 1831 | #define IWL_DELAY_NEXT_SCAN (HZ*2) |
1912 | 1832 | ||
1913 | static void iwl_post_associate(struct iwl_priv *priv) | 1833 | void iwl_post_associate(struct iwl_priv *priv) |
1914 | { | 1834 | { |
1915 | struct ieee80211_conf *conf = NULL; | 1835 | struct ieee80211_conf *conf = NULL; |
1916 | int ret = 0; | 1836 | int ret = 0; |
@@ -1938,7 +1858,7 @@ static void iwl_post_associate(struct iwl_priv *priv) | |||
1938 | conf = ieee80211_get_hw_conf(priv->hw); | 1858 | conf = ieee80211_get_hw_conf(priv->hw); |
1939 | 1859 | ||
1940 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1860 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
1941 | iwl_commit_rxon(priv); | 1861 | iwlcore_commit_rxon(priv); |
1942 | 1862 | ||
1943 | iwl_setup_rxon_timing(priv); | 1863 | iwl_setup_rxon_timing(priv); |
1944 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 1864 | ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
@@ -1951,7 +1871,9 @@ static void iwl_post_associate(struct iwl_priv *priv) | |||
1951 | 1871 | ||
1952 | iwl_set_rxon_ht(priv, &priv->current_ht_config); | 1872 | iwl_set_rxon_ht(priv, &priv->current_ht_config); |
1953 | 1873 | ||
1954 | iwl_set_rxon_chain(priv); | 1874 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
1875 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
1876 | |||
1955 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 1877 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); |
1956 | 1878 | ||
1957 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", | 1879 | IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n", |
@@ -1973,7 +1895,7 @@ static void iwl_post_associate(struct iwl_priv *priv) | |||
1973 | 1895 | ||
1974 | } | 1896 | } |
1975 | 1897 | ||
1976 | iwl_commit_rxon(priv); | 1898 | iwlcore_commit_rxon(priv); |
1977 | 1899 | ||
1978 | switch (priv->iw_mode) { | 1900 | switch (priv->iw_mode) { |
1979 | case NL80211_IFTYPE_STATION: | 1901 | case NL80211_IFTYPE_STATION: |
@@ -2059,9 +1981,6 @@ static int iwl_mac_start(struct ieee80211_hw *hw) | |||
2059 | 1981 | ||
2060 | IWL_DEBUG_INFO(priv, "Start UP work done.\n"); | 1982 | IWL_DEBUG_INFO(priv, "Start UP work done.\n"); |
2061 | 1983 | ||
2062 | if (test_bit(STATUS_IN_SUSPEND, &priv->status)) | ||
2063 | return 0; | ||
2064 | |||
2065 | /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from | 1984 | /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from |
2066 | * mac80211 will not be run successfully. */ | 1985 | * mac80211 will not be run successfully. */ |
2067 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, | 1986 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, |
@@ -2130,175 +2049,7 @@ static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
2130 | return NETDEV_TX_OK; | 2049 | return NETDEV_TX_OK; |
2131 | } | 2050 | } |
2132 | 2051 | ||
2133 | static int iwl_mac_add_interface(struct ieee80211_hw *hw, | 2052 | void iwl_config_ap(struct iwl_priv *priv) |
2134 | struct ieee80211_if_init_conf *conf) | ||
2135 | { | ||
2136 | struct iwl_priv *priv = hw->priv; | ||
2137 | unsigned long flags; | ||
2138 | |||
2139 | IWL_DEBUG_MAC80211(priv, "enter: type %d\n", conf->type); | ||
2140 | |||
2141 | if (priv->vif) { | ||
2142 | IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n"); | ||
2143 | return -EOPNOTSUPP; | ||
2144 | } | ||
2145 | |||
2146 | spin_lock_irqsave(&priv->lock, flags); | ||
2147 | priv->vif = conf->vif; | ||
2148 | priv->iw_mode = conf->type; | ||
2149 | |||
2150 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2151 | |||
2152 | mutex_lock(&priv->mutex); | ||
2153 | |||
2154 | if (conf->mac_addr) { | ||
2155 | IWL_DEBUG_MAC80211(priv, "Set %pM\n", conf->mac_addr); | ||
2156 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | ||
2157 | } | ||
2158 | |||
2159 | if (iwl_set_mode(priv, conf->type) == -EAGAIN) | ||
2160 | /* we are not ready, will run again when ready */ | ||
2161 | set_bit(STATUS_MODE_PENDING, &priv->status); | ||
2162 | |||
2163 | mutex_unlock(&priv->mutex); | ||
2164 | |||
2165 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2166 | return 0; | ||
2167 | } | ||
2168 | |||
2169 | /** | ||
2170 | * iwl_mac_config - mac80211 config callback | ||
2171 | * | ||
2172 | * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to | ||
2173 | * be set inappropriately and the driver currently sets the hardware up to | ||
2174 | * use it whenever needed. | ||
2175 | */ | ||
2176 | static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | ||
2177 | { | ||
2178 | struct iwl_priv *priv = hw->priv; | ||
2179 | const struct iwl_channel_info *ch_info; | ||
2180 | struct ieee80211_conf *conf = &hw->conf; | ||
2181 | unsigned long flags = 0; | ||
2182 | int ret = 0; | ||
2183 | u16 ch; | ||
2184 | int scan_active = 0; | ||
2185 | |||
2186 | mutex_lock(&priv->mutex); | ||
2187 | IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n", | ||
2188 | conf->channel->hw_value, changed); | ||
2189 | |||
2190 | if (unlikely(!priv->cfg->mod_params->disable_hw_scan && | ||
2191 | test_bit(STATUS_SCANNING, &priv->status))) { | ||
2192 | scan_active = 1; | ||
2193 | IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); | ||
2194 | } | ||
2195 | |||
2196 | |||
2197 | /* during scanning mac80211 will delay channel setting until | ||
2198 | * scan finish with changed = 0 | ||
2199 | */ | ||
2200 | if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) { | ||
2201 | if (scan_active) | ||
2202 | goto set_ch_out; | ||
2203 | |||
2204 | ch = ieee80211_frequency_to_channel(conf->channel->center_freq); | ||
2205 | ch_info = iwl_get_channel_info(priv, conf->channel->band, ch); | ||
2206 | if (!is_channel_valid(ch_info)) { | ||
2207 | IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n"); | ||
2208 | ret = -EINVAL; | ||
2209 | goto set_ch_out; | ||
2210 | } | ||
2211 | |||
2212 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
2213 | !is_channel_ibss(ch_info)) { | ||
2214 | IWL_ERR(priv, "channel %d in band %d not " | ||
2215 | "IBSS channel\n", | ||
2216 | conf->channel->hw_value, conf->channel->band); | ||
2217 | ret = -EINVAL; | ||
2218 | goto set_ch_out; | ||
2219 | } | ||
2220 | |||
2221 | priv->current_ht_config.is_ht = conf_is_ht(conf); | ||
2222 | |||
2223 | spin_lock_irqsave(&priv->lock, flags); | ||
2224 | |||
2225 | |||
2226 | /* if we are switching from ht to 2.4 clear flags | ||
2227 | * from any ht related info since 2.4 does not | ||
2228 | * support ht */ | ||
2229 | if ((le16_to_cpu(priv->staging_rxon.channel) != ch)) | ||
2230 | priv->staging_rxon.flags = 0; | ||
2231 | |||
2232 | iwl_set_rxon_channel(priv, conf->channel); | ||
2233 | |||
2234 | iwl_set_flags_for_band(priv, conf->channel->band); | ||
2235 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2236 | set_ch_out: | ||
2237 | /* The list of supported rates and rate mask can be different | ||
2238 | * for each band; since the band may have changed, reset | ||
2239 | * the rate mask to what mac80211 lists */ | ||
2240 | iwl_set_rate(priv); | ||
2241 | } | ||
2242 | |||
2243 | if (changed & IEEE80211_CONF_CHANGE_PS) { | ||
2244 | if (conf->flags & IEEE80211_CONF_PS) | ||
2245 | ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3); | ||
2246 | else | ||
2247 | ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM); | ||
2248 | if (ret) | ||
2249 | IWL_DEBUG_MAC80211(priv, "Error setting power level\n"); | ||
2250 | |||
2251 | } | ||
2252 | |||
2253 | if (changed & IEEE80211_CONF_CHANGE_POWER) { | ||
2254 | IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n", | ||
2255 | priv->tx_power_user_lmt, conf->power_level); | ||
2256 | |||
2257 | iwl_set_tx_power(priv, conf->power_level, false); | ||
2258 | } | ||
2259 | |||
2260 | /* call to ensure that 4965 rx_chain is set properly in monitor mode */ | ||
2261 | iwl_set_rxon_chain(priv); | ||
2262 | |||
2263 | if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) { | ||
2264 | if (conf->radio_enabled && | ||
2265 | iwl_radio_kill_sw_enable_radio(priv)) { | ||
2266 | IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - " | ||
2267 | "waiting for uCode\n"); | ||
2268 | goto out; | ||
2269 | } | ||
2270 | |||
2271 | if (!conf->radio_enabled) | ||
2272 | iwl_radio_kill_sw_disable_radio(priv); | ||
2273 | } | ||
2274 | |||
2275 | if (!conf->radio_enabled) { | ||
2276 | IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n"); | ||
2277 | goto out; | ||
2278 | } | ||
2279 | |||
2280 | if (!iwl_is_ready(priv)) { | ||
2281 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | ||
2282 | goto out; | ||
2283 | } | ||
2284 | |||
2285 | if (scan_active) | ||
2286 | goto out; | ||
2287 | |||
2288 | if (memcmp(&priv->active_rxon, | ||
2289 | &priv->staging_rxon, sizeof(priv->staging_rxon))) | ||
2290 | iwl_commit_rxon(priv); | ||
2291 | else | ||
2292 | IWL_DEBUG_INFO(priv, "No re-sending same RXON configuration.\n"); | ||
2293 | |||
2294 | |||
2295 | out: | ||
2296 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2297 | mutex_unlock(&priv->mutex); | ||
2298 | return ret; | ||
2299 | } | ||
2300 | |||
2301 | static void iwl_config_ap(struct iwl_priv *priv) | ||
2302 | { | 2053 | { |
2303 | int ret = 0; | 2054 | int ret = 0; |
2304 | unsigned long flags; | 2055 | unsigned long flags; |
@@ -2311,7 +2062,7 @@ static void iwl_config_ap(struct iwl_priv *priv) | |||
2311 | 2062 | ||
2312 | /* RXON - unassoc (to set timing command) */ | 2063 | /* RXON - unassoc (to set timing command) */ |
2313 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 2064 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2314 | iwl_commit_rxon(priv); | 2065 | iwlcore_commit_rxon(priv); |
2315 | 2066 | ||
2316 | /* RXON Timing */ | 2067 | /* RXON Timing */ |
2317 | iwl_setup_rxon_timing(priv); | 2068 | iwl_setup_rxon_timing(priv); |
@@ -2321,7 +2072,8 @@ static void iwl_config_ap(struct iwl_priv *priv) | |||
2321 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " | 2072 | IWL_WARN(priv, "REPLY_RXON_TIMING failed - " |
2322 | "Attempting to continue.\n"); | 2073 | "Attempting to continue.\n"); |
2323 | 2074 | ||
2324 | iwl_set_rxon_chain(priv); | 2075 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2076 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
2325 | 2077 | ||
2326 | /* FIXME: what should be the assoc_id for AP? */ | 2078 | /* FIXME: what should be the assoc_id for AP? */ |
2327 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); | 2079 | priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id); |
@@ -2347,7 +2099,7 @@ static void iwl_config_ap(struct iwl_priv *priv) | |||
2347 | } | 2099 | } |
2348 | /* restore RXON assoc */ | 2100 | /* restore RXON assoc */ |
2349 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 2101 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
2350 | iwl_commit_rxon(priv); | 2102 | iwlcore_commit_rxon(priv); |
2351 | spin_lock_irqsave(&priv->lock, flags); | 2103 | spin_lock_irqsave(&priv->lock, flags); |
2352 | iwl_activate_qos(priv, 1); | 2104 | iwl_activate_qos(priv, 1); |
2353 | spin_unlock_irqrestore(&priv->lock, flags); | 2105 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -2360,194 +2112,6 @@ static void iwl_config_ap(struct iwl_priv *priv) | |||
2360 | * clear sta table, add BCAST sta... */ | 2112 | * clear sta table, add BCAST sta... */ |
2361 | } | 2113 | } |
2362 | 2114 | ||
2363 | |||
2364 | static int iwl_mac_config_interface(struct ieee80211_hw *hw, | ||
2365 | struct ieee80211_vif *vif, | ||
2366 | struct ieee80211_if_conf *conf) | ||
2367 | { | ||
2368 | struct iwl_priv *priv = hw->priv; | ||
2369 | int rc; | ||
2370 | |||
2371 | if (conf == NULL) | ||
2372 | return -EIO; | ||
2373 | |||
2374 | if (priv->vif != vif) { | ||
2375 | IWL_DEBUG_MAC80211(priv, "leave - priv->vif != vif\n"); | ||
2376 | return 0; | ||
2377 | } | ||
2378 | |||
2379 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
2380 | conf->changed & IEEE80211_IFCC_BEACON) { | ||
2381 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | ||
2382 | if (!beacon) | ||
2383 | return -ENOMEM; | ||
2384 | mutex_lock(&priv->mutex); | ||
2385 | rc = iwl_mac_beacon_update(hw, beacon); | ||
2386 | mutex_unlock(&priv->mutex); | ||
2387 | if (rc) | ||
2388 | return rc; | ||
2389 | } | ||
2390 | |||
2391 | if (!iwl_is_alive(priv)) | ||
2392 | return -EAGAIN; | ||
2393 | |||
2394 | mutex_lock(&priv->mutex); | ||
2395 | |||
2396 | if (conf->bssid) | ||
2397 | IWL_DEBUG_MAC80211(priv, "bssid: %pM\n", conf->bssid); | ||
2398 | |||
2399 | /* | ||
2400 | * very dubious code was here; the probe filtering flag is never set: | ||
2401 | * | ||
2402 | if (unlikely(test_bit(STATUS_SCANNING, &priv->status)) && | ||
2403 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | ||
2404 | */ | ||
2405 | |||
2406 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
2407 | if (!conf->bssid) { | ||
2408 | conf->bssid = priv->mac_addr; | ||
2409 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | ||
2410 | IWL_DEBUG_MAC80211(priv, "bssid was set to: %pM\n", | ||
2411 | conf->bssid); | ||
2412 | } | ||
2413 | if (priv->ibss_beacon) | ||
2414 | dev_kfree_skb(priv->ibss_beacon); | ||
2415 | |||
2416 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | ||
2417 | } | ||
2418 | |||
2419 | if (iwl_is_rfkill(priv)) | ||
2420 | goto done; | ||
2421 | |||
2422 | if (conf->bssid && !is_zero_ether_addr(conf->bssid) && | ||
2423 | !is_multicast_ether_addr(conf->bssid)) { | ||
2424 | /* If there is currently a HW scan going on in the background | ||
2425 | * then we need to cancel it else the RXON below will fail. */ | ||
2426 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
2427 | IWL_WARN(priv, "Aborted scan still in progress " | ||
2428 | "after 100ms\n"); | ||
2429 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
2430 | mutex_unlock(&priv->mutex); | ||
2431 | return -EAGAIN; | ||
2432 | } | ||
2433 | memcpy(priv->staging_rxon.bssid_addr, conf->bssid, ETH_ALEN); | ||
2434 | |||
2435 | /* TODO: Audit driver for usage of these members and see | ||
2436 | * if mac80211 deprecates them (priv->bssid looks like it | ||
2437 | * shouldn't be there, but I haven't scanned the IBSS code | ||
2438 | * to verify) - jpk */ | ||
2439 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | ||
2440 | |||
2441 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
2442 | iwl_config_ap(priv); | ||
2443 | else { | ||
2444 | rc = iwl_commit_rxon(priv); | ||
2445 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) | ||
2446 | iwl_rxon_add_station( | ||
2447 | priv, priv->active_rxon.bssid_addr, 1); | ||
2448 | } | ||
2449 | |||
2450 | } else { | ||
2451 | iwl_scan_cancel_timeout(priv, 100); | ||
2452 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2453 | iwl_commit_rxon(priv); | ||
2454 | } | ||
2455 | |||
2456 | done: | ||
2457 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2458 | mutex_unlock(&priv->mutex); | ||
2459 | |||
2460 | return 0; | ||
2461 | } | ||
2462 | |||
2463 | static void iwl_mac_remove_interface(struct ieee80211_hw *hw, | ||
2464 | struct ieee80211_if_init_conf *conf) | ||
2465 | { | ||
2466 | struct iwl_priv *priv = hw->priv; | ||
2467 | |||
2468 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2469 | |||
2470 | mutex_lock(&priv->mutex); | ||
2471 | |||
2472 | if (iwl_is_ready_rf(priv)) { | ||
2473 | iwl_scan_cancel_timeout(priv, 100); | ||
2474 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2475 | iwl_commit_rxon(priv); | ||
2476 | } | ||
2477 | if (priv->vif == conf->vif) { | ||
2478 | priv->vif = NULL; | ||
2479 | memset(priv->bssid, 0, ETH_ALEN); | ||
2480 | } | ||
2481 | mutex_unlock(&priv->mutex); | ||
2482 | |||
2483 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2484 | |||
2485 | } | ||
2486 | |||
2487 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | ||
2488 | static void iwl_bss_info_changed(struct ieee80211_hw *hw, | ||
2489 | struct ieee80211_vif *vif, | ||
2490 | struct ieee80211_bss_conf *bss_conf, | ||
2491 | u32 changes) | ||
2492 | { | ||
2493 | struct iwl_priv *priv = hw->priv; | ||
2494 | |||
2495 | IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); | ||
2496 | |||
2497 | if (changes & BSS_CHANGED_ERP_PREAMBLE) { | ||
2498 | IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", | ||
2499 | bss_conf->use_short_preamble); | ||
2500 | if (bss_conf->use_short_preamble) | ||
2501 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | ||
2502 | else | ||
2503 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | ||
2504 | } | ||
2505 | |||
2506 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { | ||
2507 | IWL_DEBUG_MAC80211(priv, "ERP_CTS %d\n", bss_conf->use_cts_prot); | ||
2508 | if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) | ||
2509 | priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; | ||
2510 | else | ||
2511 | priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | ||
2512 | } | ||
2513 | |||
2514 | if (changes & BSS_CHANGED_HT) { | ||
2515 | iwl_ht_conf(priv, bss_conf); | ||
2516 | iwl_set_rxon_chain(priv); | ||
2517 | } | ||
2518 | |||
2519 | if (changes & BSS_CHANGED_ASSOC) { | ||
2520 | IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); | ||
2521 | /* This should never happen as this function should | ||
2522 | * never be called from interrupt context. */ | ||
2523 | if (WARN_ON_ONCE(in_interrupt())) | ||
2524 | return; | ||
2525 | if (bss_conf->assoc) { | ||
2526 | priv->assoc_id = bss_conf->aid; | ||
2527 | priv->beacon_int = bss_conf->beacon_int; | ||
2528 | priv->power_data.dtim_period = bss_conf->dtim_period; | ||
2529 | priv->timestamp = bss_conf->timestamp; | ||
2530 | priv->assoc_capability = bss_conf->assoc_capability; | ||
2531 | |||
2532 | /* we have just associated, don't start scan too early | ||
2533 | * leave time for EAPOL exchange to complete | ||
2534 | */ | ||
2535 | priv->next_scan_jiffies = jiffies + | ||
2536 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; | ||
2537 | mutex_lock(&priv->mutex); | ||
2538 | iwl_post_associate(priv); | ||
2539 | mutex_unlock(&priv->mutex); | ||
2540 | } else { | ||
2541 | priv->assoc_id = 0; | ||
2542 | IWL_DEBUG_MAC80211(priv, "DISASSOC %d\n", bss_conf->assoc); | ||
2543 | } | ||
2544 | } else if (changes && iwl_is_associated(priv) && priv->assoc_id) { | ||
2545 | IWL_DEBUG_MAC80211(priv, "Associated Changes %d\n", changes); | ||
2546 | iwl_send_rxon_assoc(priv); | ||
2547 | } | ||
2548 | |||
2549 | } | ||
2550 | |||
2551 | static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, | 2115 | static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw, |
2552 | struct ieee80211_key_conf *keyconf, const u8 *addr, | 2116 | struct ieee80211_key_conf *keyconf, const u8 *addr, |
2553 | u32 iv32, u16 *phase1key) | 2117 | u32 iv32, u16 *phase1key) |
@@ -2579,7 +2143,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2579 | return -EOPNOTSUPP; | 2143 | return -EOPNOTSUPP; |
2580 | } | 2144 | } |
2581 | addr = sta ? sta->addr : iwl_bcast_addr; | 2145 | addr = sta ? sta->addr : iwl_bcast_addr; |
2582 | sta_id = iwl_find_station(priv, addr); | 2146 | sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); |
2583 | if (sta_id == IWL_INVALID_STATION) { | 2147 | if (sta_id == IWL_INVALID_STATION) { |
2584 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | 2148 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", |
2585 | addr); | 2149 | addr); |
@@ -2630,49 +2194,6 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2630 | return ret; | 2194 | return ret; |
2631 | } | 2195 | } |
2632 | 2196 | ||
2633 | static int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | ||
2634 | const struct ieee80211_tx_queue_params *params) | ||
2635 | { | ||
2636 | struct iwl_priv *priv = hw->priv; | ||
2637 | unsigned long flags; | ||
2638 | int q; | ||
2639 | |||
2640 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2641 | |||
2642 | if (!iwl_is_ready_rf(priv)) { | ||
2643 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
2644 | return -EIO; | ||
2645 | } | ||
2646 | |||
2647 | if (queue >= AC_NUM) { | ||
2648 | IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); | ||
2649 | return 0; | ||
2650 | } | ||
2651 | |||
2652 | q = AC_NUM - 1 - queue; | ||
2653 | |||
2654 | spin_lock_irqsave(&priv->lock, flags); | ||
2655 | |||
2656 | priv->qos_data.def_qos_parm.ac[q].cw_min = cpu_to_le16(params->cw_min); | ||
2657 | priv->qos_data.def_qos_parm.ac[q].cw_max = cpu_to_le16(params->cw_max); | ||
2658 | priv->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; | ||
2659 | priv->qos_data.def_qos_parm.ac[q].edca_txop = | ||
2660 | cpu_to_le16((params->txop * 32)); | ||
2661 | |||
2662 | priv->qos_data.def_qos_parm.ac[q].reserved1 = 0; | ||
2663 | priv->qos_data.qos_active = 1; | ||
2664 | |||
2665 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
2666 | iwl_activate_qos(priv, 1); | ||
2667 | else if (priv->assoc_id && iwl_is_associated(priv)) | ||
2668 | iwl_activate_qos(priv, 0); | ||
2669 | |||
2670 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2671 | |||
2672 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2673 | return 0; | ||
2674 | } | ||
2675 | |||
2676 | static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | 2197 | static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, |
2677 | enum ieee80211_ampdu_mlme_action action, | 2198 | enum ieee80211_ampdu_mlme_action action, |
2678 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) | 2199 | struct ieee80211_sta *sta, u16 tid, u16 *ssn) |
@@ -2715,41 +2236,6 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, | |||
2715 | return 0; | 2236 | return 0; |
2716 | } | 2237 | } |
2717 | 2238 | ||
2718 | static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, | ||
2719 | struct ieee80211_tx_queue_stats *stats) | ||
2720 | { | ||
2721 | struct iwl_priv *priv = hw->priv; | ||
2722 | int i, avail; | ||
2723 | struct iwl_tx_queue *txq; | ||
2724 | struct iwl_queue *q; | ||
2725 | unsigned long flags; | ||
2726 | |||
2727 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2728 | |||
2729 | if (!iwl_is_ready_rf(priv)) { | ||
2730 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
2731 | return -EIO; | ||
2732 | } | ||
2733 | |||
2734 | spin_lock_irqsave(&priv->lock, flags); | ||
2735 | |||
2736 | for (i = 0; i < AC_NUM; i++) { | ||
2737 | txq = &priv->txq[i]; | ||
2738 | q = &txq->q; | ||
2739 | avail = iwl_queue_space(q); | ||
2740 | |||
2741 | stats[i].len = q->n_window - avail; | ||
2742 | stats[i].limit = q->n_window - q->high_mark; | ||
2743 | stats[i].count = q->n_window; | ||
2744 | |||
2745 | } | ||
2746 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2747 | |||
2748 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2749 | |||
2750 | return 0; | ||
2751 | } | ||
2752 | |||
2753 | static int iwl_mac_get_stats(struct ieee80211_hw *hw, | 2239 | static int iwl_mac_get_stats(struct ieee80211_hw *hw, |
2754 | struct ieee80211_low_level_stats *stats) | 2240 | struct ieee80211_low_level_stats *stats) |
2755 | { | 2241 | { |
@@ -2762,120 +2248,6 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw, | |||
2762 | return 0; | 2248 | return 0; |
2763 | } | 2249 | } |
2764 | 2250 | ||
2765 | static void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | ||
2766 | { | ||
2767 | struct iwl_priv *priv = hw->priv; | ||
2768 | unsigned long flags; | ||
2769 | |||
2770 | mutex_lock(&priv->mutex); | ||
2771 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2772 | |||
2773 | spin_lock_irqsave(&priv->lock, flags); | ||
2774 | memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info)); | ||
2775 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2776 | |||
2777 | iwl_reset_qos(priv); | ||
2778 | |||
2779 | spin_lock_irqsave(&priv->lock, flags); | ||
2780 | priv->assoc_id = 0; | ||
2781 | priv->assoc_capability = 0; | ||
2782 | priv->assoc_station_added = 0; | ||
2783 | |||
2784 | /* new association get rid of ibss beacon skb */ | ||
2785 | if (priv->ibss_beacon) | ||
2786 | dev_kfree_skb(priv->ibss_beacon); | ||
2787 | |||
2788 | priv->ibss_beacon = NULL; | ||
2789 | |||
2790 | priv->beacon_int = priv->hw->conf.beacon_int; | ||
2791 | priv->timestamp = 0; | ||
2792 | if ((priv->iw_mode == NL80211_IFTYPE_STATION)) | ||
2793 | priv->beacon_int = 0; | ||
2794 | |||
2795 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2796 | |||
2797 | if (!iwl_is_ready_rf(priv)) { | ||
2798 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | ||
2799 | mutex_unlock(&priv->mutex); | ||
2800 | return; | ||
2801 | } | ||
2802 | |||
2803 | /* we are restarting association process | ||
2804 | * clear RXON_FILTER_ASSOC_MSK bit | ||
2805 | */ | ||
2806 | if (priv->iw_mode != NL80211_IFTYPE_AP) { | ||
2807 | iwl_scan_cancel_timeout(priv, 100); | ||
2808 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2809 | iwl_commit_rxon(priv); | ||
2810 | } | ||
2811 | |||
2812 | iwl_power_update_mode(priv, 0); | ||
2813 | |||
2814 | /* Per mac80211.h: This is only used in IBSS mode... */ | ||
2815 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | ||
2816 | |||
2817 | /* switch to CAM during association period. | ||
2818 | * the ucode will block any association/authentication | ||
2819 | * frome during assiciation period if it can not hear | ||
2820 | * the AP because of PM. the timer enable PM back is | ||
2821 | * association do not complete | ||
2822 | */ | ||
2823 | if (priv->hw->conf.channel->flags & (IEEE80211_CHAN_PASSIVE_SCAN | | ||
2824 | IEEE80211_CHAN_RADAR)) | ||
2825 | iwl_power_disable_management(priv, 3000); | ||
2826 | |||
2827 | IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n"); | ||
2828 | mutex_unlock(&priv->mutex); | ||
2829 | return; | ||
2830 | } | ||
2831 | |||
2832 | iwl_set_rate(priv); | ||
2833 | |||
2834 | mutex_unlock(&priv->mutex); | ||
2835 | |||
2836 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2837 | } | ||
2838 | |||
2839 | static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
2840 | { | ||
2841 | struct iwl_priv *priv = hw->priv; | ||
2842 | unsigned long flags; | ||
2843 | __le64 timestamp; | ||
2844 | |||
2845 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2846 | |||
2847 | if (!iwl_is_ready_rf(priv)) { | ||
2848 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
2849 | return -EIO; | ||
2850 | } | ||
2851 | |||
2852 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | ||
2853 | IWL_DEBUG_MAC80211(priv, "leave - not IBSS\n"); | ||
2854 | return -EIO; | ||
2855 | } | ||
2856 | |||
2857 | spin_lock_irqsave(&priv->lock, flags); | ||
2858 | |||
2859 | if (priv->ibss_beacon) | ||
2860 | dev_kfree_skb(priv->ibss_beacon); | ||
2861 | |||
2862 | priv->ibss_beacon = skb; | ||
2863 | |||
2864 | priv->assoc_id = 0; | ||
2865 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | ||
2866 | priv->timestamp = le64_to_cpu(timestamp); | ||
2867 | |||
2868 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2869 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2870 | |||
2871 | iwl_reset_qos(priv); | ||
2872 | |||
2873 | iwl_post_associate(priv); | ||
2874 | |||
2875 | |||
2876 | return 0; | ||
2877 | } | ||
2878 | |||
2879 | /***************************************************************************** | 2251 | /***************************************************************************** |
2880 | * | 2252 | * |
2881 | * sysfs attributes | 2253 | * sysfs attributes |
@@ -3025,7 +2397,7 @@ static ssize_t store_flags(struct device *d, | |||
3025 | else { | 2397 | else { |
3026 | IWL_DEBUG_INFO(priv, "Commit rxon.flags = 0x%04X\n", flags); | 2398 | IWL_DEBUG_INFO(priv, "Commit rxon.flags = 0x%04X\n", flags); |
3027 | priv->staging_rxon.flags = cpu_to_le32(flags); | 2399 | priv->staging_rxon.flags = cpu_to_le32(flags); |
3028 | iwl_commit_rxon(priv); | 2400 | iwlcore_commit_rxon(priv); |
3029 | } | 2401 | } |
3030 | } | 2402 | } |
3031 | mutex_unlock(&priv->mutex); | 2403 | mutex_unlock(&priv->mutex); |
@@ -3066,7 +2438,7 @@ static ssize_t store_filter_flags(struct device *d, | |||
3066 | "0x%04X\n", filter_flags); | 2438 | "0x%04X\n", filter_flags); |
3067 | priv->staging_rxon.filter_flags = | 2439 | priv->staging_rxon.filter_flags = |
3068 | cpu_to_le32(filter_flags); | 2440 | cpu_to_le32(filter_flags); |
3069 | iwl_commit_rxon(priv); | 2441 | iwlcore_commit_rxon(priv); |
3070 | } | 2442 | } |
3071 | } | 2443 | } |
3072 | mutex_unlock(&priv->mutex); | 2444 | mutex_unlock(&priv->mutex); |
@@ -3397,18 +2769,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3397 | goto out_free_eeprom; | 2769 | goto out_free_eeprom; |
3398 | /* At this point both hw and priv are initialized. */ | 2770 | /* At this point both hw and priv are initialized. */ |
3399 | 2771 | ||
3400 | /********************************** | ||
3401 | * 7. Initialize module parameters | ||
3402 | **********************************/ | ||
3403 | |||
3404 | /* Disable radio (SW RF KILL) via parameter when loading driver */ | ||
3405 | if (priv->cfg->mod_params->disable) { | ||
3406 | set_bit(STATUS_RF_KILL_SW, &priv->status); | ||
3407 | IWL_DEBUG_INFO(priv, "Radio disabled.\n"); | ||
3408 | } | ||
3409 | |||
3410 | /******************** | 2772 | /******************** |
3411 | * 8. Setup services | 2773 | * 7. Setup services |
3412 | ********************/ | 2774 | ********************/ |
3413 | spin_lock_irqsave(&priv->lock, flags); | 2775 | spin_lock_irqsave(&priv->lock, flags); |
3414 | iwl_disable_interrupts(priv); | 2776 | iwl_disable_interrupts(priv); |
@@ -3432,7 +2794,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3432 | iwl_setup_rx_handlers(priv); | 2794 | iwl_setup_rx_handlers(priv); |
3433 | 2795 | ||
3434 | /********************************** | 2796 | /********************************** |
3435 | * 9. Setup and register mac80211 | 2797 | * 8. Setup and register mac80211 |
3436 | **********************************/ | 2798 | **********************************/ |
3437 | 2799 | ||
3438 | /* enable interrupts if needed: hw bug w/a */ | 2800 | /* enable interrupts if needed: hw bug w/a */ |
@@ -3450,7 +2812,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3450 | 2812 | ||
3451 | err = iwl_dbgfs_register(priv, DRV_NAME); | 2813 | err = iwl_dbgfs_register(priv, DRV_NAME); |
3452 | if (err) | 2814 | if (err) |
3453 | IWL_ERR(priv, "failed to create debugfs files\n"); | 2815 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); |
3454 | 2816 | ||
3455 | /* If platform's RF_KILL switch is NOT set to KILL */ | 2817 | /* If platform's RF_KILL switch is NOT set to KILL */ |
3456 | if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) | 2818 | if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW) |
@@ -3533,7 +2895,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3533 | iwl_rx_queue_free(priv, &priv->rxq); | 2895 | iwl_rx_queue_free(priv, &priv->rxq); |
3534 | iwl_hw_txq_ctx_free(priv); | 2896 | iwl_hw_txq_ctx_free(priv); |
3535 | 2897 | ||
3536 | iwl_clear_stations_table(priv); | 2898 | priv->cfg->ops->smgmt->clear_station_table(priv); |
3537 | iwl_eeprom_free(priv); | 2899 | iwl_eeprom_free(priv); |
3538 | 2900 | ||
3539 | 2901 | ||
@@ -3561,45 +2923,6 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3561 | ieee80211_free_hw(priv->hw); | 2923 | ieee80211_free_hw(priv->hw); |
3562 | } | 2924 | } |
3563 | 2925 | ||
3564 | #ifdef CONFIG_PM | ||
3565 | |||
3566 | static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | ||
3567 | { | ||
3568 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
3569 | |||
3570 | if (priv->is_open) { | ||
3571 | set_bit(STATUS_IN_SUSPEND, &priv->status); | ||
3572 | iwl_mac_stop(priv->hw); | ||
3573 | priv->is_open = 1; | ||
3574 | } | ||
3575 | |||
3576 | pci_save_state(pdev); | ||
3577 | pci_disable_device(pdev); | ||
3578 | pci_set_power_state(pdev, PCI_D3hot); | ||
3579 | |||
3580 | return 0; | ||
3581 | } | ||
3582 | |||
3583 | static int iwl_pci_resume(struct pci_dev *pdev) | ||
3584 | { | ||
3585 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
3586 | int ret; | ||
3587 | |||
3588 | pci_set_power_state(pdev, PCI_D0); | ||
3589 | ret = pci_enable_device(pdev); | ||
3590 | if (ret) | ||
3591 | return ret; | ||
3592 | pci_restore_state(pdev); | ||
3593 | iwl_enable_interrupts(priv); | ||
3594 | |||
3595 | if (priv->is_open) | ||
3596 | iwl_mac_start(priv->hw); | ||
3597 | |||
3598 | clear_bit(STATUS_IN_SUSPEND, &priv->status); | ||
3599 | return 0; | ||
3600 | } | ||
3601 | |||
3602 | #endif /* CONFIG_PM */ | ||
3603 | 2926 | ||
3604 | /***************************************************************************** | 2927 | /***************************************************************************** |
3605 | * | 2928 | * |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 29d40746da6a..7b84d5246b36 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -2469,11 +2469,12 @@ struct iwl_ssid_ie { | |||
2469 | u8 ssid[32]; | 2469 | u8 ssid[32]; |
2470 | } __attribute__ ((packed)); | 2470 | } __attribute__ ((packed)); |
2471 | 2471 | ||
2472 | #define PROBE_OPTION_MAX_API1 0x4 | 2472 | #define PROBE_OPTION_MAX_3945 4 |
2473 | #define PROBE_OPTION_MAX 0x14 | 2473 | #define PROBE_OPTION_MAX 20 |
2474 | #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) | 2474 | #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF) |
2475 | #define IWL_GOOD_CRC_TH cpu_to_le16(1) | 2475 | #define IWL_GOOD_CRC_TH cpu_to_le16(1) |
2476 | #define IWL_MAX_SCAN_SIZE 1024 | 2476 | #define IWL_MAX_SCAN_SIZE 1024 |
2477 | #define IWL_MAX_PROBE_REQUEST 200 | ||
2477 | 2478 | ||
2478 | /* | 2479 | /* |
2479 | * REPLY_SCAN_CMD = 0x80 (command) | 2480 | * REPLY_SCAN_CMD = 0x80 (command) |
@@ -2552,7 +2553,7 @@ struct iwl3945_scan_cmd { | |||
2552 | struct iwl3945_tx_cmd tx_cmd; | 2553 | struct iwl3945_tx_cmd tx_cmd; |
2553 | 2554 | ||
2554 | /* For directed active scans (set to all-0s otherwise) */ | 2555 | /* For directed active scans (set to all-0s otherwise) */ |
2555 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_API1]; | 2556 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_3945]; |
2556 | 2557 | ||
2557 | /* | 2558 | /* |
2558 | * Probe request frame, followed by channel list. | 2559 | * Probe request frame, followed by channel list. |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index c54fb93e9d72..3dec2d25fa3d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -735,6 +735,8 @@ int iwl_full_rxon_required(struct iwl_priv *priv) | |||
735 | priv->active_rxon.ofdm_ht_single_stream_basic_rates) || | 735 | priv->active_rxon.ofdm_ht_single_stream_basic_rates) || |
736 | (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates != | 736 | (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates != |
737 | priv->active_rxon.ofdm_ht_dual_stream_basic_rates) || | 737 | priv->active_rxon.ofdm_ht_dual_stream_basic_rates) || |
738 | (priv->staging_rxon.ofdm_ht_triple_stream_basic_rates != | ||
739 | priv->active_rxon.ofdm_ht_triple_stream_basic_rates) || | ||
738 | (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id)) | 740 | (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id)) |
739 | return 1; | 741 | return 1; |
740 | 742 | ||
@@ -821,7 +823,8 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info) | |||
821 | 823 | ||
822 | rxon->flags |= cpu_to_le32(val << RXON_FLG_HT_OPERATING_MODE_POS); | 824 | rxon->flags |= cpu_to_le32(val << RXON_FLG_HT_OPERATING_MODE_POS); |
823 | 825 | ||
824 | iwl_set_rxon_chain(priv); | 826 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
827 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
825 | 828 | ||
826 | IWL_DEBUG_ASSOC(priv, "supported HT rate 0x%X 0x%X 0x%X " | 829 | IWL_DEBUG_ASSOC(priv, "supported HT rate 0x%X 0x%X 0x%X " |
827 | "rxon flags 0x%X operation mode :0x%X " | 830 | "rxon flags 0x%X operation mode :0x%X " |
@@ -901,10 +904,11 @@ static u8 iwl_count_chain_bitmap(u32 chain_bitmap) | |||
901 | * never called for monitor mode. The only way mac80211 informs us about | 904 | * never called for monitor mode. The only way mac80211 informs us about |
902 | * monitor mode is through configuring filters (call to configure_filter). | 905 | * monitor mode is through configuring filters (call to configure_filter). |
903 | */ | 906 | */ |
904 | static bool iwl_is_monitor_mode(struct iwl_priv *priv) | 907 | bool iwl_is_monitor_mode(struct iwl_priv *priv) |
905 | { | 908 | { |
906 | return !!(priv->staging_rxon.filter_flags & RXON_FILTER_PROMISC_MSK); | 909 | return !!(priv->staging_rxon.filter_flags & RXON_FILTER_PROMISC_MSK); |
907 | } | 910 | } |
911 | EXPORT_SYMBOL(iwl_is_monitor_mode); | ||
908 | 912 | ||
909 | /** | 913 | /** |
910 | * iwl_set_rxon_chain - Set up Rx chain usage in "staging" RXON image | 914 | * iwl_set_rxon_chain - Set up Rx chain usage in "staging" RXON image |
@@ -1068,11 +1072,6 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) | |||
1068 | RXON_FILTER_ACCEPT_GRP_MSK; | 1072 | RXON_FILTER_ACCEPT_GRP_MSK; |
1069 | break; | 1073 | break; |
1070 | 1074 | ||
1071 | case NL80211_IFTYPE_MONITOR: | ||
1072 | priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER; | ||
1073 | priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK | | ||
1074 | RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK; | ||
1075 | break; | ||
1076 | default: | 1075 | default: |
1077 | IWL_ERR(priv, "Unsupported interface type %d\n", mode); | 1076 | IWL_ERR(priv, "Unsupported interface type %d\n", mode); |
1078 | break; | 1077 | break; |
@@ -1117,6 +1116,7 @@ void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode) | |||
1117 | memcpy(priv->staging_rxon.wlap_bssid_addr, priv->mac_addr, ETH_ALEN); | 1116 | memcpy(priv->staging_rxon.wlap_bssid_addr, priv->mac_addr, ETH_ALEN); |
1118 | priv->staging_rxon.ofdm_ht_single_stream_basic_rates = 0xff; | 1117 | priv->staging_rxon.ofdm_ht_single_stream_basic_rates = 0xff; |
1119 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates = 0xff; | 1118 | priv->staging_rxon.ofdm_ht_dual_stream_basic_rates = 0xff; |
1119 | priv->staging_rxon.ofdm_ht_triple_stream_basic_rates = 0xff; | ||
1120 | } | 1120 | } |
1121 | EXPORT_SYMBOL(iwl_connection_init_rx_config); | 1121 | EXPORT_SYMBOL(iwl_connection_init_rx_config); |
1122 | 1122 | ||
@@ -1305,7 +1305,10 @@ int iwl_setup_mac(struct iwl_priv *priv) | |||
1305 | BIT(NL80211_IFTYPE_ADHOC); | 1305 | BIT(NL80211_IFTYPE_ADHOC); |
1306 | 1306 | ||
1307 | hw->wiphy->custom_regulatory = true; | 1307 | hw->wiphy->custom_regulatory = true; |
1308 | hw->wiphy->max_scan_ssids = 1; | 1308 | |
1309 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX; | ||
1310 | /* we create the 802.11 header and a zero-length SSID element */ | ||
1311 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | ||
1309 | 1312 | ||
1310 | /* Default value; 4 EDCA QOS priorities */ | 1313 | /* Default value; 4 EDCA QOS priorities */ |
1311 | hw->queues = 4; | 1314 | hw->queues = 4; |
@@ -1366,7 +1369,7 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
1366 | mutex_init(&priv->mutex); | 1369 | mutex_init(&priv->mutex); |
1367 | 1370 | ||
1368 | /* Clear the driver's (not device's) station table */ | 1371 | /* Clear the driver's (not device's) station table */ |
1369 | iwl_clear_stations_table(priv); | 1372 | priv->cfg->ops->smgmt->clear_station_table(priv); |
1370 | 1373 | ||
1371 | priv->data_retry_limit = -1; | 1374 | priv->data_retry_limit = -1; |
1372 | priv->ieee_channels = NULL; | 1375 | priv->ieee_channels = NULL; |
@@ -1378,7 +1381,9 @@ int iwl_init_drv(struct iwl_priv *priv) | |||
1378 | priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED; | 1381 | priv->current_ht_config.sm_ps = WLAN_HT_CAP_SM_PS_DISABLED; |
1379 | 1382 | ||
1380 | /* Choose which receivers/antennas to use */ | 1383 | /* Choose which receivers/antennas to use */ |
1381 | iwl_set_rxon_chain(priv); | 1384 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
1385 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
1386 | |||
1382 | iwl_init_scan_params(priv); | 1387 | iwl_init_scan_params(priv); |
1383 | 1388 | ||
1384 | iwl_reset_qos(priv); | 1389 | iwl_reset_qos(priv); |
@@ -2054,7 +2059,7 @@ void iwl_bg_rf_kill(struct work_struct *work) | |||
2054 | "HW and/or SW RF Kill no longer active, restarting " | 2059 | "HW and/or SW RF Kill no longer active, restarting " |
2055 | "device\n"); | 2060 | "device\n"); |
2056 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status) && | 2061 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status) && |
2057 | test_bit(STATUS_ALIVE, &priv->status)) | 2062 | priv->is_open) |
2058 | queue_work(priv->workqueue, &priv->restart); | 2063 | queue_work(priv->workqueue, &priv->restart); |
2059 | } else { | 2064 | } else { |
2060 | /* make sure mac80211 stop sending Tx frame */ | 2065 | /* make sure mac80211 stop sending Tx frame */ |
@@ -2112,3 +2117,727 @@ void iwl_rx_reply_error(struct iwl_priv *priv, | |||
2112 | } | 2117 | } |
2113 | EXPORT_SYMBOL(iwl_rx_reply_error); | 2118 | EXPORT_SYMBOL(iwl_rx_reply_error); |
2114 | 2119 | ||
2120 | void iwl_clear_isr_stats(struct iwl_priv *priv) | ||
2121 | { | ||
2122 | memset(&priv->isr_stats, 0, sizeof(priv->isr_stats)); | ||
2123 | } | ||
2124 | EXPORT_SYMBOL(iwl_clear_isr_stats); | ||
2125 | |||
2126 | int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | ||
2127 | const struct ieee80211_tx_queue_params *params) | ||
2128 | { | ||
2129 | struct iwl_priv *priv = hw->priv; | ||
2130 | unsigned long flags; | ||
2131 | int q; | ||
2132 | |||
2133 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2134 | |||
2135 | if (!iwl_is_ready_rf(priv)) { | ||
2136 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
2137 | return -EIO; | ||
2138 | } | ||
2139 | |||
2140 | if (queue >= AC_NUM) { | ||
2141 | IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); | ||
2142 | return 0; | ||
2143 | } | ||
2144 | |||
2145 | q = AC_NUM - 1 - queue; | ||
2146 | |||
2147 | spin_lock_irqsave(&priv->lock, flags); | ||
2148 | |||
2149 | priv->qos_data.def_qos_parm.ac[q].cw_min = cpu_to_le16(params->cw_min); | ||
2150 | priv->qos_data.def_qos_parm.ac[q].cw_max = cpu_to_le16(params->cw_max); | ||
2151 | priv->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; | ||
2152 | priv->qos_data.def_qos_parm.ac[q].edca_txop = | ||
2153 | cpu_to_le16((params->txop * 32)); | ||
2154 | |||
2155 | priv->qos_data.def_qos_parm.ac[q].reserved1 = 0; | ||
2156 | priv->qos_data.qos_active = 1; | ||
2157 | |||
2158 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
2159 | iwl_activate_qos(priv, 1); | ||
2160 | else if (priv->assoc_id && iwl_is_associated(priv)) | ||
2161 | iwl_activate_qos(priv, 0); | ||
2162 | |||
2163 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2164 | |||
2165 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2166 | return 0; | ||
2167 | } | ||
2168 | EXPORT_SYMBOL(iwl_mac_conf_tx); | ||
2169 | |||
2170 | static void iwl_ht_conf(struct iwl_priv *priv, | ||
2171 | struct ieee80211_bss_conf *bss_conf) | ||
2172 | { | ||
2173 | struct ieee80211_sta_ht_cap *ht_conf; | ||
2174 | struct iwl_ht_info *iwl_conf = &priv->current_ht_config; | ||
2175 | struct ieee80211_sta *sta; | ||
2176 | |||
2177 | IWL_DEBUG_MAC80211(priv, "enter: \n"); | ||
2178 | |||
2179 | if (!iwl_conf->is_ht) | ||
2180 | return; | ||
2181 | |||
2182 | |||
2183 | /* | ||
2184 | * It is totally wrong to base global information on something | ||
2185 | * that is valid only when associated, alas, this driver works | ||
2186 | * that way and I don't know how to fix it. | ||
2187 | */ | ||
2188 | |||
2189 | rcu_read_lock(); | ||
2190 | sta = ieee80211_find_sta(priv->hw, priv->bssid); | ||
2191 | if (!sta) { | ||
2192 | rcu_read_unlock(); | ||
2193 | return; | ||
2194 | } | ||
2195 | ht_conf = &sta->ht_cap; | ||
2196 | |||
2197 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_20) | ||
2198 | iwl_conf->sgf |= HT_SHORT_GI_20MHZ; | ||
2199 | if (ht_conf->cap & IEEE80211_HT_CAP_SGI_40) | ||
2200 | iwl_conf->sgf |= HT_SHORT_GI_40MHZ; | ||
2201 | |||
2202 | iwl_conf->is_green_field = !!(ht_conf->cap & IEEE80211_HT_CAP_GRN_FLD); | ||
2203 | iwl_conf->max_amsdu_size = | ||
2204 | !!(ht_conf->cap & IEEE80211_HT_CAP_MAX_AMSDU); | ||
2205 | |||
2206 | iwl_conf->supported_chan_width = | ||
2207 | !!(ht_conf->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40); | ||
2208 | |||
2209 | /* | ||
2210 | * XXX: The HT configuration needs to be moved into iwl_mac_config() | ||
2211 | * to be done there correctly. | ||
2212 | */ | ||
2213 | |||
2214 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
2215 | if (conf_is_ht40_minus(&priv->hw->conf)) | ||
2216 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
2217 | else if (conf_is_ht40_plus(&priv->hw->conf)) | ||
2218 | iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
2219 | |||
2220 | /* If no above or below channel supplied disable FAT channel */ | ||
2221 | if (iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_ABOVE && | ||
2222 | iwl_conf->extension_chan_offset != IEEE80211_HT_PARAM_CHA_SEC_BELOW) | ||
2223 | iwl_conf->supported_chan_width = 0; | ||
2224 | |||
2225 | iwl_conf->sm_ps = (u8)((ht_conf->cap & IEEE80211_HT_CAP_SM_PS) >> 2); | ||
2226 | |||
2227 | memcpy(&iwl_conf->mcs, &ht_conf->mcs, 16); | ||
2228 | |||
2229 | iwl_conf->tx_chan_width = iwl_conf->supported_chan_width != 0; | ||
2230 | iwl_conf->ht_protection = | ||
2231 | bss_conf->ht.operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; | ||
2232 | iwl_conf->non_GF_STA_present = | ||
2233 | !!(bss_conf->ht.operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); | ||
2234 | |||
2235 | rcu_read_unlock(); | ||
2236 | |||
2237 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2238 | } | ||
2239 | |||
2240 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | ||
2241 | void iwl_bss_info_changed(struct ieee80211_hw *hw, | ||
2242 | struct ieee80211_vif *vif, | ||
2243 | struct ieee80211_bss_conf *bss_conf, | ||
2244 | u32 changes) | ||
2245 | { | ||
2246 | struct iwl_priv *priv = hw->priv; | ||
2247 | int ret; | ||
2248 | |||
2249 | IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); | ||
2250 | |||
2251 | if (changes & BSS_CHANGED_ERP_PREAMBLE) { | ||
2252 | IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", | ||
2253 | bss_conf->use_short_preamble); | ||
2254 | if (bss_conf->use_short_preamble) | ||
2255 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | ||
2256 | else | ||
2257 | priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; | ||
2258 | } | ||
2259 | |||
2260 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { | ||
2261 | IWL_DEBUG_MAC80211(priv, "ERP_CTS %d\n", bss_conf->use_cts_prot); | ||
2262 | if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) | ||
2263 | priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; | ||
2264 | else | ||
2265 | priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | ||
2266 | } | ||
2267 | |||
2268 | if (changes & BSS_CHANGED_HT) { | ||
2269 | iwl_ht_conf(priv, bss_conf); | ||
2270 | |||
2271 | if (priv->cfg->ops->hcmd->set_rxon_chain) | ||
2272 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
2273 | } | ||
2274 | |||
2275 | if (changes & BSS_CHANGED_ASSOC) { | ||
2276 | IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); | ||
2277 | /* This should never happen as this function should | ||
2278 | * never be called from interrupt context. */ | ||
2279 | if (WARN_ON_ONCE(in_interrupt())) | ||
2280 | return; | ||
2281 | if (bss_conf->assoc) { | ||
2282 | priv->assoc_id = bss_conf->aid; | ||
2283 | priv->beacon_int = bss_conf->beacon_int; | ||
2284 | priv->power_data.dtim_period = bss_conf->dtim_period; | ||
2285 | priv->timestamp = bss_conf->timestamp; | ||
2286 | priv->assoc_capability = bss_conf->assoc_capability; | ||
2287 | |||
2288 | /* we have just associated, don't start scan too early | ||
2289 | * leave time for EAPOL exchange to complete | ||
2290 | */ | ||
2291 | priv->next_scan_jiffies = jiffies + | ||
2292 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; | ||
2293 | mutex_lock(&priv->mutex); | ||
2294 | priv->cfg->ops->lib->post_associate(priv); | ||
2295 | mutex_unlock(&priv->mutex); | ||
2296 | } else { | ||
2297 | priv->assoc_id = 0; | ||
2298 | IWL_DEBUG_MAC80211(priv, "DISASSOC %d\n", bss_conf->assoc); | ||
2299 | } | ||
2300 | } else if (changes && iwl_is_associated(priv) && priv->assoc_id) { | ||
2301 | IWL_DEBUG_MAC80211(priv, "Associated Changes %d\n", changes); | ||
2302 | ret = iwl_send_rxon_assoc(priv); | ||
2303 | if (!ret) | ||
2304 | /* Sync active_rxon with latest change. */ | ||
2305 | memcpy((void *)&priv->active_rxon, | ||
2306 | &priv->staging_rxon, | ||
2307 | sizeof(struct iwl_rxon_cmd)); | ||
2308 | } | ||
2309 | |||
2310 | } | ||
2311 | EXPORT_SYMBOL(iwl_bss_info_changed); | ||
2312 | |||
2313 | int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
2314 | { | ||
2315 | struct iwl_priv *priv = hw->priv; | ||
2316 | unsigned long flags; | ||
2317 | __le64 timestamp; | ||
2318 | |||
2319 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2320 | |||
2321 | if (!iwl_is_ready_rf(priv)) { | ||
2322 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
2323 | return -EIO; | ||
2324 | } | ||
2325 | |||
2326 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | ||
2327 | IWL_DEBUG_MAC80211(priv, "leave - not IBSS\n"); | ||
2328 | return -EIO; | ||
2329 | } | ||
2330 | |||
2331 | spin_lock_irqsave(&priv->lock, flags); | ||
2332 | |||
2333 | if (priv->ibss_beacon) | ||
2334 | dev_kfree_skb(priv->ibss_beacon); | ||
2335 | |||
2336 | priv->ibss_beacon = skb; | ||
2337 | |||
2338 | priv->assoc_id = 0; | ||
2339 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | ||
2340 | priv->timestamp = le64_to_cpu(timestamp); | ||
2341 | |||
2342 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2343 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2344 | |||
2345 | iwl_reset_qos(priv); | ||
2346 | |||
2347 | priv->cfg->ops->lib->post_associate(priv); | ||
2348 | |||
2349 | |||
2350 | return 0; | ||
2351 | } | ||
2352 | EXPORT_SYMBOL(iwl_mac_beacon_update); | ||
2353 | |||
2354 | int iwl_set_mode(struct iwl_priv *priv, int mode) | ||
2355 | { | ||
2356 | if (mode == NL80211_IFTYPE_ADHOC) { | ||
2357 | const struct iwl_channel_info *ch_info; | ||
2358 | |||
2359 | ch_info = iwl_get_channel_info(priv, | ||
2360 | priv->band, | ||
2361 | le16_to_cpu(priv->staging_rxon.channel)); | ||
2362 | |||
2363 | if (!ch_info || !is_channel_ibss(ch_info)) { | ||
2364 | IWL_ERR(priv, "channel %d not IBSS channel\n", | ||
2365 | le16_to_cpu(priv->staging_rxon.channel)); | ||
2366 | return -EINVAL; | ||
2367 | } | ||
2368 | } | ||
2369 | |||
2370 | iwl_connection_init_rx_config(priv, mode); | ||
2371 | |||
2372 | if (priv->cfg->ops->hcmd->set_rxon_chain) | ||
2373 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
2374 | |||
2375 | memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN); | ||
2376 | |||
2377 | priv->cfg->ops->smgmt->clear_station_table(priv); | ||
2378 | |||
2379 | /* dont commit rxon if rf-kill is on*/ | ||
2380 | if (!iwl_is_ready_rf(priv)) | ||
2381 | return -EAGAIN; | ||
2382 | |||
2383 | cancel_delayed_work(&priv->scan_check); | ||
2384 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
2385 | IWL_WARN(priv, "Aborted scan still in progress after 100ms\n"); | ||
2386 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
2387 | return -EAGAIN; | ||
2388 | } | ||
2389 | |||
2390 | iwlcore_commit_rxon(priv); | ||
2391 | |||
2392 | return 0; | ||
2393 | } | ||
2394 | EXPORT_SYMBOL(iwl_set_mode); | ||
2395 | |||
2396 | int iwl_mac_add_interface(struct ieee80211_hw *hw, | ||
2397 | struct ieee80211_if_init_conf *conf) | ||
2398 | { | ||
2399 | struct iwl_priv *priv = hw->priv; | ||
2400 | unsigned long flags; | ||
2401 | |||
2402 | IWL_DEBUG_MAC80211(priv, "enter: type %d\n", conf->type); | ||
2403 | |||
2404 | if (priv->vif) { | ||
2405 | IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n"); | ||
2406 | return -EOPNOTSUPP; | ||
2407 | } | ||
2408 | |||
2409 | spin_lock_irqsave(&priv->lock, flags); | ||
2410 | priv->vif = conf->vif; | ||
2411 | priv->iw_mode = conf->type; | ||
2412 | |||
2413 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2414 | |||
2415 | mutex_lock(&priv->mutex); | ||
2416 | |||
2417 | if (conf->mac_addr) { | ||
2418 | IWL_DEBUG_MAC80211(priv, "Set %pM\n", conf->mac_addr); | ||
2419 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | ||
2420 | } | ||
2421 | |||
2422 | if (iwl_set_mode(priv, conf->type) == -EAGAIN) | ||
2423 | /* we are not ready, will run again when ready */ | ||
2424 | set_bit(STATUS_MODE_PENDING, &priv->status); | ||
2425 | |||
2426 | mutex_unlock(&priv->mutex); | ||
2427 | |||
2428 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2429 | return 0; | ||
2430 | } | ||
2431 | EXPORT_SYMBOL(iwl_mac_add_interface); | ||
2432 | |||
2433 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, | ||
2434 | struct ieee80211_if_init_conf *conf) | ||
2435 | { | ||
2436 | struct iwl_priv *priv = hw->priv; | ||
2437 | |||
2438 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2439 | |||
2440 | mutex_lock(&priv->mutex); | ||
2441 | |||
2442 | if (iwl_is_ready_rf(priv)) { | ||
2443 | iwl_scan_cancel_timeout(priv, 100); | ||
2444 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2445 | iwlcore_commit_rxon(priv); | ||
2446 | } | ||
2447 | if (priv->vif == conf->vif) { | ||
2448 | priv->vif = NULL; | ||
2449 | memset(priv->bssid, 0, ETH_ALEN); | ||
2450 | } | ||
2451 | mutex_unlock(&priv->mutex); | ||
2452 | |||
2453 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2454 | |||
2455 | } | ||
2456 | EXPORT_SYMBOL(iwl_mac_remove_interface); | ||
2457 | |||
2458 | /** | ||
2459 | * iwl_mac_config - mac80211 config callback | ||
2460 | * | ||
2461 | * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to | ||
2462 | * be set inappropriately and the driver currently sets the hardware up to | ||
2463 | * use it whenever needed. | ||
2464 | */ | ||
2465 | int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | ||
2466 | { | ||
2467 | struct iwl_priv *priv = hw->priv; | ||
2468 | const struct iwl_channel_info *ch_info; | ||
2469 | struct ieee80211_conf *conf = &hw->conf; | ||
2470 | unsigned long flags = 0; | ||
2471 | int ret = 0; | ||
2472 | u16 ch; | ||
2473 | int scan_active = 0; | ||
2474 | |||
2475 | mutex_lock(&priv->mutex); | ||
2476 | |||
2477 | IWL_DEBUG_MAC80211(priv, "enter to channel %d changed 0x%X\n", | ||
2478 | conf->channel->hw_value, changed); | ||
2479 | |||
2480 | if (unlikely(!priv->cfg->mod_params->disable_hw_scan && | ||
2481 | test_bit(STATUS_SCANNING, &priv->status))) { | ||
2482 | scan_active = 1; | ||
2483 | IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); | ||
2484 | } | ||
2485 | |||
2486 | |||
2487 | /* during scanning mac80211 will delay channel setting until | ||
2488 | * scan finish with changed = 0 | ||
2489 | */ | ||
2490 | if (!changed || (changed & IEEE80211_CONF_CHANGE_CHANNEL)) { | ||
2491 | if (scan_active) | ||
2492 | goto set_ch_out; | ||
2493 | |||
2494 | ch = ieee80211_frequency_to_channel(conf->channel->center_freq); | ||
2495 | ch_info = iwl_get_channel_info(priv, conf->channel->band, ch); | ||
2496 | if (!is_channel_valid(ch_info)) { | ||
2497 | IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n"); | ||
2498 | ret = -EINVAL; | ||
2499 | goto set_ch_out; | ||
2500 | } | ||
2501 | |||
2502 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
2503 | !is_channel_ibss(ch_info)) { | ||
2504 | IWL_ERR(priv, "channel %d in band %d not " | ||
2505 | "IBSS channel\n", | ||
2506 | conf->channel->hw_value, conf->channel->band); | ||
2507 | ret = -EINVAL; | ||
2508 | goto set_ch_out; | ||
2509 | } | ||
2510 | |||
2511 | priv->current_ht_config.is_ht = conf_is_ht(conf); | ||
2512 | |||
2513 | spin_lock_irqsave(&priv->lock, flags); | ||
2514 | |||
2515 | |||
2516 | /* if we are switching from ht to 2.4 clear flags | ||
2517 | * from any ht related info since 2.4 does not | ||
2518 | * support ht */ | ||
2519 | if ((le16_to_cpu(priv->staging_rxon.channel) != ch)) | ||
2520 | priv->staging_rxon.flags = 0; | ||
2521 | |||
2522 | iwl_set_rxon_channel(priv, conf->channel); | ||
2523 | |||
2524 | iwl_set_flags_for_band(priv, conf->channel->band); | ||
2525 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2526 | set_ch_out: | ||
2527 | /* The list of supported rates and rate mask can be different | ||
2528 | * for each band; since the band may have changed, reset | ||
2529 | * the rate mask to what mac80211 lists */ | ||
2530 | iwl_set_rate(priv); | ||
2531 | } | ||
2532 | |||
2533 | if (changed & IEEE80211_CONF_CHANGE_PS) { | ||
2534 | if (conf->flags & IEEE80211_CONF_PS) | ||
2535 | ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3); | ||
2536 | else | ||
2537 | ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM); | ||
2538 | if (ret) | ||
2539 | IWL_DEBUG_MAC80211(priv, "Error setting power level\n"); | ||
2540 | |||
2541 | } | ||
2542 | |||
2543 | if (changed & IEEE80211_CONF_CHANGE_POWER) { | ||
2544 | IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n", | ||
2545 | priv->tx_power_user_lmt, conf->power_level); | ||
2546 | |||
2547 | iwl_set_tx_power(priv, conf->power_level, false); | ||
2548 | } | ||
2549 | |||
2550 | /* call to ensure that 4965 rx_chain is set properly in monitor mode */ | ||
2551 | if (priv->cfg->ops->hcmd->set_rxon_chain) | ||
2552 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | ||
2553 | |||
2554 | if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) { | ||
2555 | if (conf->radio_enabled && | ||
2556 | iwl_radio_kill_sw_enable_radio(priv)) { | ||
2557 | IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - " | ||
2558 | "waiting for uCode\n"); | ||
2559 | goto out; | ||
2560 | } | ||
2561 | |||
2562 | if (!conf->radio_enabled) | ||
2563 | iwl_radio_kill_sw_disable_radio(priv); | ||
2564 | } | ||
2565 | |||
2566 | if (!conf->radio_enabled) { | ||
2567 | IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n"); | ||
2568 | goto out; | ||
2569 | } | ||
2570 | |||
2571 | if (!iwl_is_ready(priv)) { | ||
2572 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | ||
2573 | goto out; | ||
2574 | } | ||
2575 | |||
2576 | if (scan_active) | ||
2577 | goto out; | ||
2578 | |||
2579 | if (memcmp(&priv->active_rxon, | ||
2580 | &priv->staging_rxon, sizeof(priv->staging_rxon))) | ||
2581 | iwlcore_commit_rxon(priv); | ||
2582 | else | ||
2583 | IWL_DEBUG_INFO(priv, "Not re-sending same RXON configuration.\n"); | ||
2584 | |||
2585 | |||
2586 | out: | ||
2587 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2588 | mutex_unlock(&priv->mutex); | ||
2589 | return ret; | ||
2590 | } | ||
2591 | EXPORT_SYMBOL(iwl_mac_config); | ||
2592 | |||
2593 | int iwl_mac_config_interface(struct ieee80211_hw *hw, | ||
2594 | struct ieee80211_vif *vif, | ||
2595 | struct ieee80211_if_conf *conf) | ||
2596 | { | ||
2597 | struct iwl_priv *priv = hw->priv; | ||
2598 | int rc; | ||
2599 | |||
2600 | if (conf == NULL) | ||
2601 | return -EIO; | ||
2602 | |||
2603 | if (priv->vif != vif) { | ||
2604 | IWL_DEBUG_MAC80211(priv, "leave - priv->vif != vif\n"); | ||
2605 | return 0; | ||
2606 | } | ||
2607 | |||
2608 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
2609 | conf->changed & IEEE80211_IFCC_BEACON) { | ||
2610 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | ||
2611 | if (!beacon) | ||
2612 | return -ENOMEM; | ||
2613 | mutex_lock(&priv->mutex); | ||
2614 | rc = iwl_mac_beacon_update(hw, beacon); | ||
2615 | mutex_unlock(&priv->mutex); | ||
2616 | if (rc) | ||
2617 | return rc; | ||
2618 | } | ||
2619 | |||
2620 | if (!iwl_is_alive(priv)) | ||
2621 | return -EAGAIN; | ||
2622 | |||
2623 | mutex_lock(&priv->mutex); | ||
2624 | |||
2625 | if (conf->bssid) | ||
2626 | IWL_DEBUG_MAC80211(priv, "bssid: %pM\n", conf->bssid); | ||
2627 | |||
2628 | /* | ||
2629 | * very dubious code was here; the probe filtering flag is never set: | ||
2630 | * | ||
2631 | if (unlikely(test_bit(STATUS_SCANNING, &priv->status)) && | ||
2632 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | ||
2633 | */ | ||
2634 | |||
2635 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
2636 | if (!conf->bssid) { | ||
2637 | conf->bssid = priv->mac_addr; | ||
2638 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | ||
2639 | IWL_DEBUG_MAC80211(priv, "bssid was set to: %pM\n", | ||
2640 | conf->bssid); | ||
2641 | } | ||
2642 | if (priv->ibss_beacon) | ||
2643 | dev_kfree_skb(priv->ibss_beacon); | ||
2644 | |||
2645 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | ||
2646 | } | ||
2647 | |||
2648 | if (iwl_is_rfkill(priv)) | ||
2649 | goto done; | ||
2650 | |||
2651 | if (conf->bssid && !is_zero_ether_addr(conf->bssid) && | ||
2652 | !is_multicast_ether_addr(conf->bssid)) { | ||
2653 | /* If there is currently a HW scan going on in the background | ||
2654 | * then we need to cancel it else the RXON below will fail. */ | ||
2655 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
2656 | IWL_WARN(priv, "Aborted scan still in progress " | ||
2657 | "after 100ms\n"); | ||
2658 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
2659 | mutex_unlock(&priv->mutex); | ||
2660 | return -EAGAIN; | ||
2661 | } | ||
2662 | memcpy(priv->staging_rxon.bssid_addr, conf->bssid, ETH_ALEN); | ||
2663 | |||
2664 | /* TODO: Audit driver for usage of these members and see | ||
2665 | * if mac80211 deprecates them (priv->bssid looks like it | ||
2666 | * shouldn't be there, but I haven't scanned the IBSS code | ||
2667 | * to verify) - jpk */ | ||
2668 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | ||
2669 | |||
2670 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
2671 | iwlcore_config_ap(priv); | ||
2672 | else { | ||
2673 | rc = iwlcore_commit_rxon(priv); | ||
2674 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) | ||
2675 | iwl_rxon_add_station( | ||
2676 | priv, priv->active_rxon.bssid_addr, 1); | ||
2677 | } | ||
2678 | |||
2679 | } else { | ||
2680 | iwl_scan_cancel_timeout(priv, 100); | ||
2681 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2682 | iwlcore_commit_rxon(priv); | ||
2683 | } | ||
2684 | |||
2685 | done: | ||
2686 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2687 | mutex_unlock(&priv->mutex); | ||
2688 | |||
2689 | return 0; | ||
2690 | } | ||
2691 | EXPORT_SYMBOL(iwl_mac_config_interface); | ||
2692 | |||
2693 | int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, | ||
2694 | struct ieee80211_tx_queue_stats *stats) | ||
2695 | { | ||
2696 | struct iwl_priv *priv = hw->priv; | ||
2697 | int i, avail; | ||
2698 | struct iwl_tx_queue *txq; | ||
2699 | struct iwl_queue *q; | ||
2700 | unsigned long flags; | ||
2701 | |||
2702 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2703 | |||
2704 | if (!iwl_is_ready_rf(priv)) { | ||
2705 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
2706 | return -EIO; | ||
2707 | } | ||
2708 | |||
2709 | spin_lock_irqsave(&priv->lock, flags); | ||
2710 | |||
2711 | for (i = 0; i < AC_NUM; i++) { | ||
2712 | txq = &priv->txq[i]; | ||
2713 | q = &txq->q; | ||
2714 | avail = iwl_queue_space(q); | ||
2715 | |||
2716 | stats[i].len = q->n_window - avail; | ||
2717 | stats[i].limit = q->n_window - q->high_mark; | ||
2718 | stats[i].count = q->n_window; | ||
2719 | |||
2720 | } | ||
2721 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2722 | |||
2723 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2724 | |||
2725 | return 0; | ||
2726 | } | ||
2727 | EXPORT_SYMBOL(iwl_mac_get_tx_stats); | ||
2728 | |||
2729 | void iwl_mac_reset_tsf(struct ieee80211_hw *hw) | ||
2730 | { | ||
2731 | struct iwl_priv *priv = hw->priv; | ||
2732 | unsigned long flags; | ||
2733 | |||
2734 | mutex_lock(&priv->mutex); | ||
2735 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
2736 | |||
2737 | spin_lock_irqsave(&priv->lock, flags); | ||
2738 | memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info)); | ||
2739 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2740 | |||
2741 | iwl_reset_qos(priv); | ||
2742 | |||
2743 | spin_lock_irqsave(&priv->lock, flags); | ||
2744 | priv->assoc_id = 0; | ||
2745 | priv->assoc_capability = 0; | ||
2746 | priv->assoc_station_added = 0; | ||
2747 | |||
2748 | /* new association get rid of ibss beacon skb */ | ||
2749 | if (priv->ibss_beacon) | ||
2750 | dev_kfree_skb(priv->ibss_beacon); | ||
2751 | |||
2752 | priv->ibss_beacon = NULL; | ||
2753 | |||
2754 | priv->beacon_int = priv->hw->conf.beacon_int; | ||
2755 | priv->timestamp = 0; | ||
2756 | if ((priv->iw_mode == NL80211_IFTYPE_STATION)) | ||
2757 | priv->beacon_int = 0; | ||
2758 | |||
2759 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2760 | |||
2761 | if (!iwl_is_ready_rf(priv)) { | ||
2762 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | ||
2763 | mutex_unlock(&priv->mutex); | ||
2764 | return; | ||
2765 | } | ||
2766 | |||
2767 | /* we are restarting association process | ||
2768 | * clear RXON_FILTER_ASSOC_MSK bit | ||
2769 | */ | ||
2770 | if (priv->iw_mode != NL80211_IFTYPE_AP) { | ||
2771 | iwl_scan_cancel_timeout(priv, 100); | ||
2772 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
2773 | iwlcore_commit_rxon(priv); | ||
2774 | } | ||
2775 | |||
2776 | iwl_power_update_mode(priv, 0); | ||
2777 | |||
2778 | /* Per mac80211.h: This is only used in IBSS mode... */ | ||
2779 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | ||
2780 | |||
2781 | /* switch to CAM during association period. | ||
2782 | * the ucode will block any association/authentication | ||
2783 | * frome during assiciation period if it can not hear | ||
2784 | * the AP because of PM. the timer enable PM back is | ||
2785 | * association do not complete | ||
2786 | */ | ||
2787 | if (priv->hw->conf.channel->flags & | ||
2788 | (IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_RADAR)) | ||
2789 | iwl_power_disable_management(priv, 3000); | ||
2790 | |||
2791 | IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n"); | ||
2792 | mutex_unlock(&priv->mutex); | ||
2793 | return; | ||
2794 | } | ||
2795 | |||
2796 | iwl_set_rate(priv); | ||
2797 | |||
2798 | mutex_unlock(&priv->mutex); | ||
2799 | |||
2800 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
2801 | } | ||
2802 | EXPORT_SYMBOL(iwl_mac_reset_tsf); | ||
2803 | |||
2804 | #ifdef CONFIG_PM | ||
2805 | |||
2806 | int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | ||
2807 | { | ||
2808 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
2809 | |||
2810 | /* | ||
2811 | * This function is called when system goes into suspend state | ||
2812 | * mac80211 will call iwl_mac_stop() from the mac80211 suspend function | ||
2813 | * first but since iwl_mac_stop() has no knowledge of who the caller is, | ||
2814 | * it will not call apm_ops.stop() to stop the DMA operation. | ||
2815 | * Calling apm_ops.stop here to make sure we stop the DMA. | ||
2816 | */ | ||
2817 | priv->cfg->ops->lib->apm_ops.stop(priv); | ||
2818 | |||
2819 | pci_save_state(pdev); | ||
2820 | pci_disable_device(pdev); | ||
2821 | pci_set_power_state(pdev, PCI_D3hot); | ||
2822 | |||
2823 | return 0; | ||
2824 | } | ||
2825 | EXPORT_SYMBOL(iwl_pci_suspend); | ||
2826 | |||
2827 | int iwl_pci_resume(struct pci_dev *pdev) | ||
2828 | { | ||
2829 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
2830 | int ret; | ||
2831 | |||
2832 | pci_set_power_state(pdev, PCI_D0); | ||
2833 | ret = pci_enable_device(pdev); | ||
2834 | if (ret) | ||
2835 | return ret; | ||
2836 | pci_restore_state(pdev); | ||
2837 | iwl_enable_interrupts(priv); | ||
2838 | |||
2839 | return 0; | ||
2840 | } | ||
2841 | EXPORT_SYMBOL(iwl_pci_resume); | ||
2842 | |||
2843 | #endif /* CONFIG_PM */ | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index a8eac8c3c1fa..d4c60afa2891 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -83,9 +83,21 @@ struct iwl_cmd; | |||
83 | #define IWL_SKU_A 0x2 | 83 | #define IWL_SKU_A 0x2 |
84 | #define IWL_SKU_N 0x8 | 84 | #define IWL_SKU_N 0x8 |
85 | 85 | ||
86 | struct iwl_station_mgmt_ops { | ||
87 | u8 (*add_station)(struct iwl_priv *priv, const u8 *addr, | ||
88 | int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info); | ||
89 | int (*remove_station)(struct iwl_priv *priv, const u8 *addr, | ||
90 | int is_ap); | ||
91 | u8 (*find_station)(struct iwl_priv *priv, const u8 *addr); | ||
92 | void (*clear_station_table)(struct iwl_priv *priv); | ||
93 | }; | ||
94 | |||
86 | struct iwl_hcmd_ops { | 95 | struct iwl_hcmd_ops { |
87 | int (*rxon_assoc)(struct iwl_priv *priv); | 96 | int (*rxon_assoc)(struct iwl_priv *priv); |
97 | int (*commit_rxon)(struct iwl_priv *priv); | ||
98 | void (*set_rxon_chain)(struct iwl_priv *priv); | ||
88 | }; | 99 | }; |
100 | |||
89 | struct iwl_hcmd_utils_ops { | 101 | struct iwl_hcmd_utils_ops { |
90 | u16 (*get_hcmd_size)(u8 cmd_id, u16 len); | 102 | u16 (*get_hcmd_size)(u8 cmd_id, u16 len); |
91 | u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data); | 103 | u16 (*build_addsta_hcmd)(const struct iwl_addsta_cmd *cmd, u8 *data); |
@@ -149,6 +161,9 @@ struct iwl_lib_ops { | |||
149 | int (*send_tx_power) (struct iwl_priv *priv); | 161 | int (*send_tx_power) (struct iwl_priv *priv); |
150 | void (*update_chain_flags)(struct iwl_priv *priv); | 162 | void (*update_chain_flags)(struct iwl_priv *priv); |
151 | void (*temperature) (struct iwl_priv *priv); | 163 | void (*temperature) (struct iwl_priv *priv); |
164 | void (*post_associate) (struct iwl_priv *priv); | ||
165 | void (*config_ap) (struct iwl_priv *priv); | ||
166 | |||
152 | /* eeprom operations (as defined in iwl-eeprom.h) */ | 167 | /* eeprom operations (as defined in iwl-eeprom.h) */ |
153 | struct iwl_eeprom_ops eeprom_ops; | 168 | struct iwl_eeprom_ops eeprom_ops; |
154 | }; | 169 | }; |
@@ -157,10 +172,10 @@ struct iwl_ops { | |||
157 | const struct iwl_lib_ops *lib; | 172 | const struct iwl_lib_ops *lib; |
158 | const struct iwl_hcmd_ops *hcmd; | 173 | const struct iwl_hcmd_ops *hcmd; |
159 | const struct iwl_hcmd_utils_ops *utils; | 174 | const struct iwl_hcmd_utils_ops *utils; |
175 | const struct iwl_station_mgmt_ops *smgmt; | ||
160 | }; | 176 | }; |
161 | 177 | ||
162 | struct iwl_mod_params { | 178 | struct iwl_mod_params { |
163 | int disable; /* def: 0 = enable radio */ | ||
164 | int sw_crypto; /* def: 0 = using hardware encryption */ | 179 | int sw_crypto; /* def: 0 = using hardware encryption */ |
165 | u32 debug; /* def: 0 = minimal debug log messages */ | 180 | u32 debug; /* def: 0 = minimal debug log messages */ |
166 | int disable_hw_scan; /* def: 0 = use h/w scan */ | 181 | int disable_hw_scan; /* def: 0 = use h/w scan */ |
@@ -225,6 +240,8 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg, | |||
225 | void iwl_hw_detect(struct iwl_priv *priv); | 240 | void iwl_hw_detect(struct iwl_priv *priv); |
226 | void iwl_reset_qos(struct iwl_priv *priv); | 241 | void iwl_reset_qos(struct iwl_priv *priv); |
227 | void iwl_activate_qos(struct iwl_priv *priv, u8 force); | 242 | void iwl_activate_qos(struct iwl_priv *priv, u8 force); |
243 | int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | ||
244 | const struct ieee80211_tx_queue_params *params); | ||
228 | void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt); | 245 | void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt); |
229 | int iwl_check_rxon_cmd(struct iwl_priv *priv); | 246 | int iwl_check_rxon_cmd(struct iwl_priv *priv); |
230 | int iwl_full_rxon_required(struct iwl_priv *priv); | 247 | int iwl_full_rxon_required(struct iwl_priv *priv); |
@@ -249,6 +266,27 @@ int iwl_setup_mac(struct iwl_priv *priv); | |||
249 | int iwl_set_hw_params(struct iwl_priv *priv); | 266 | int iwl_set_hw_params(struct iwl_priv *priv); |
250 | int iwl_init_drv(struct iwl_priv *priv); | 267 | int iwl_init_drv(struct iwl_priv *priv); |
251 | void iwl_uninit_drv(struct iwl_priv *priv); | 268 | void iwl_uninit_drv(struct iwl_priv *priv); |
269 | bool iwl_is_monitor_mode(struct iwl_priv *priv); | ||
270 | void iwl_post_associate(struct iwl_priv *priv); | ||
271 | void iwl_bss_info_changed(struct ieee80211_hw *hw, | ||
272 | struct ieee80211_vif *vif, | ||
273 | struct ieee80211_bss_conf *bss_conf, | ||
274 | u32 changes); | ||
275 | int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb); | ||
276 | int iwl_commit_rxon(struct iwl_priv *priv); | ||
277 | int iwl_set_mode(struct iwl_priv *priv, int mode); | ||
278 | int iwl_mac_add_interface(struct ieee80211_hw *hw, | ||
279 | struct ieee80211_if_init_conf *conf); | ||
280 | void iwl_mac_remove_interface(struct ieee80211_hw *hw, | ||
281 | struct ieee80211_if_init_conf *conf); | ||
282 | int iwl_mac_config(struct ieee80211_hw *hw, u32 changed); | ||
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); | ||
287 | int iwl_mac_get_tx_stats(struct ieee80211_hw *hw, | ||
288 | struct ieee80211_tx_queue_stats *stats); | ||
289 | void iwl_mac_reset_tsf(struct ieee80211_hw *hw); | ||
252 | 290 | ||
253 | /***************************************************** | 291 | /***************************************************** |
254 | * RX handlers. | 292 | * RX handlers. |
@@ -358,8 +396,8 @@ int iwl_scan_cancel(struct iwl_priv *priv); | |||
358 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); | 396 | int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); |
359 | int iwl_scan_initiate(struct iwl_priv *priv); | 397 | int iwl_scan_initiate(struct iwl_priv *priv); |
360 | int iwl_mac_hw_scan(struct ieee80211_hw *hw, struct cfg80211_scan_request *req); | 398 | int iwl_mac_hw_scan(struct ieee80211_hw *hw, struct cfg80211_scan_request *req); |
361 | u16 iwl_fill_probe_req(struct iwl_priv *priv, enum ieee80211_band band, | 399 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, |
362 | struct ieee80211_mgmt *frame, int left); | 400 | const u8 *ie, int ie_len, int left); |
363 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); | 401 | void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); |
364 | u16 iwl_get_active_dwell_time(struct iwl_priv *priv, | 402 | u16 iwl_get_active_dwell_time(struct iwl_priv *priv, |
365 | enum ieee80211_band band, | 403 | enum ieee80211_band band, |
@@ -432,12 +470,17 @@ static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv) | |||
432 | pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); | 470 | pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); |
433 | return pci_lnk_ctl; | 471 | return pci_lnk_ctl; |
434 | } | 472 | } |
473 | #ifdef CONFIG_PM | ||
474 | int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state); | ||
475 | int iwl_pci_resume(struct pci_dev *pdev); | ||
476 | #endif /* CONFIG_PM */ | ||
435 | 477 | ||
436 | /***************************************************** | 478 | /***************************************************** |
437 | * Error Handling Debugging | 479 | * Error Handling Debugging |
438 | ******************************************************/ | 480 | ******************************************************/ |
439 | void iwl_dump_nic_error_log(struct iwl_priv *priv); | 481 | void iwl_dump_nic_error_log(struct iwl_priv *priv); |
440 | void iwl_dump_nic_event_log(struct iwl_priv *priv); | 482 | void iwl_dump_nic_event_log(struct iwl_priv *priv); |
483 | void iwl_clear_isr_stats(struct iwl_priv *priv); | ||
441 | 484 | ||
442 | /***************************************************** | 485 | /***************************************************** |
443 | * GEOS | 486 | * GEOS |
@@ -458,7 +501,6 @@ void iwlcore_free_geos(struct iwl_priv *priv); | |||
458 | #define STATUS_TEMPERATURE 8 | 501 | #define STATUS_TEMPERATURE 8 |
459 | #define STATUS_GEO_CONFIGURED 9 | 502 | #define STATUS_GEO_CONFIGURED 9 |
460 | #define STATUS_EXIT_PENDING 10 | 503 | #define STATUS_EXIT_PENDING 10 |
461 | #define STATUS_IN_SUSPEND 11 | ||
462 | #define STATUS_STATISTICS 12 | 504 | #define STATUS_STATISTICS 12 |
463 | #define STATUS_SCANNING 13 | 505 | #define STATUS_SCANNING 13 |
464 | #define STATUS_SCAN_ABORTING 14 | 506 | #define STATUS_SCAN_ABORTING 14 |
@@ -528,7 +570,14 @@ static inline int iwl_send_rxon_assoc(struct iwl_priv *priv) | |||
528 | { | 570 | { |
529 | return priv->cfg->ops->hcmd->rxon_assoc(priv); | 571 | return priv->cfg->ops->hcmd->rxon_assoc(priv); |
530 | } | 572 | } |
531 | 573 | static inline int iwlcore_commit_rxon(struct iwl_priv *priv) | |
574 | { | ||
575 | return priv->cfg->ops->hcmd->commit_rxon(priv); | ||
576 | } | ||
577 | static inline void iwlcore_config_ap(struct iwl_priv *priv) | ||
578 | { | ||
579 | priv->cfg->ops->lib->config_ap(priv); | ||
580 | } | ||
532 | static inline const struct ieee80211_supported_band *iwl_get_hw_mode( | 581 | static inline const struct ieee80211_supported_band *iwl_get_hw_mode( |
533 | struct iwl_priv *priv, enum ieee80211_band band) | 582 | struct iwl_priv *priv, enum ieee80211_band band) |
534 | { | 583 | { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index 65d1a7f2db9e..db069801bc41 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -75,6 +75,7 @@ struct iwl_debugfs { | |||
75 | struct dentry *file_log_event; | 75 | struct dentry *file_log_event; |
76 | struct dentry *file_channels; | 76 | struct dentry *file_channels; |
77 | struct dentry *file_status; | 77 | struct dentry *file_status; |
78 | struct dentry *file_interrupt; | ||
78 | } dbgfs_data_files; | 79 | } dbgfs_data_files; |
79 | struct dir_rf_files { | 80 | struct dir_rf_files { |
80 | struct dentry *file_disable_sensitivity; | 81 | struct dentry *file_disable_sensitivity; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 64eb585f1578..ffc4be3842b2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -389,7 +389,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, | |||
389 | channels[i].max_power, | 389 | channels[i].max_power, |
390 | channels[i].flags & IEEE80211_CHAN_RADAR ? | 390 | channels[i].flags & IEEE80211_CHAN_RADAR ? |
391 | " (IEEE 802.11h required)" : "", | 391 | " (IEEE 802.11h required)" : "", |
392 | (!(channels[i].flags & IEEE80211_CHAN_NO_IBSS) | 392 | ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) |
393 | || (channels[i].flags & | 393 | || (channels[i].flags & |
394 | IEEE80211_CHAN_RADAR)) ? "" : | 394 | IEEE80211_CHAN_RADAR)) ? "" : |
395 | ", IBSS", | 395 | ", IBSS", |
@@ -456,8 +456,6 @@ static ssize_t iwl_dbgfs_status_read(struct file *file, | |||
456 | test_bit(STATUS_GEO_CONFIGURED, &priv->status)); | 456 | test_bit(STATUS_GEO_CONFIGURED, &priv->status)); |
457 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", | 457 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", |
458 | test_bit(STATUS_EXIT_PENDING, &priv->status)); | 458 | test_bit(STATUS_EXIT_PENDING, &priv->status)); |
459 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_IN_SUSPEND:\t %d\n", | ||
460 | test_bit(STATUS_IN_SUSPEND, &priv->status)); | ||
461 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", | 459 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", |
462 | test_bit(STATUS_STATISTICS, &priv->status)); | 460 | test_bit(STATUS_STATISTICS, &priv->status)); |
463 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n", | 461 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n", |
@@ -475,6 +473,95 @@ static ssize_t iwl_dbgfs_status_read(struct file *file, | |||
475 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 473 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
476 | } | 474 | } |
477 | 475 | ||
476 | static ssize_t iwl_dbgfs_interrupt_read(struct file *file, | ||
477 | char __user *user_buf, | ||
478 | size_t count, loff_t *ppos) { | ||
479 | |||
480 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
481 | int pos = 0; | ||
482 | int cnt = 0; | ||
483 | char *buf; | ||
484 | int bufsz = 24 * 64; /* 24 items * 64 char per item */ | ||
485 | ssize_t ret; | ||
486 | |||
487 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
488 | if (!buf) { | ||
489 | IWL_ERR(priv, "Can not allocate Buffer\n"); | ||
490 | return -ENOMEM; | ||
491 | } | ||
492 | |||
493 | pos += scnprintf(buf + pos, bufsz - pos, | ||
494 | "Interrupt Statistics Report:\n"); | ||
495 | |||
496 | pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n", | ||
497 | priv->isr_stats.hw); | ||
498 | pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n", | ||
499 | priv->isr_stats.sw); | ||
500 | if (priv->isr_stats.sw > 0) { | ||
501 | pos += scnprintf(buf + pos, bufsz - pos, | ||
502 | "\tLast Restarting Code: 0x%X\n", | ||
503 | priv->isr_stats.sw_err); | ||
504 | } | ||
505 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
506 | pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n", | ||
507 | priv->isr_stats.sch); | ||
508 | pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n", | ||
509 | priv->isr_stats.alive); | ||
510 | #endif | ||
511 | pos += scnprintf(buf + pos, bufsz - pos, | ||
512 | "HW RF KILL switch toggled:\t %u\n", | ||
513 | priv->isr_stats.rfkill); | ||
514 | |||
515 | pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n", | ||
516 | priv->isr_stats.ctkill); | ||
517 | |||
518 | pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n", | ||
519 | priv->isr_stats.wakeup); | ||
520 | |||
521 | pos += scnprintf(buf + pos, bufsz - pos, | ||
522 | "Rx command responses:\t\t %u\n", | ||
523 | priv->isr_stats.rx); | ||
524 | for (cnt = 0; cnt < REPLY_MAX; cnt++) { | ||
525 | if (priv->isr_stats.rx_handlers[cnt] > 0) | ||
526 | pos += scnprintf(buf + pos, bufsz - pos, | ||
527 | "\tRx handler[%36s]:\t\t %u\n", | ||
528 | get_cmd_string(cnt), | ||
529 | priv->isr_stats.rx_handlers[cnt]); | ||
530 | } | ||
531 | |||
532 | pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n", | ||
533 | priv->isr_stats.tx); | ||
534 | |||
535 | pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n", | ||
536 | priv->isr_stats.unhandled); | ||
537 | |||
538 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
539 | kfree(buf); | ||
540 | return ret; | ||
541 | } | ||
542 | |||
543 | static ssize_t iwl_dbgfs_interrupt_write(struct file *file, | ||
544 | const char __user *user_buf, | ||
545 | size_t count, loff_t *ppos) | ||
546 | { | ||
547 | struct iwl_priv *priv = file->private_data; | ||
548 | char buf[8]; | ||
549 | int buf_size; | ||
550 | u32 reset_flag; | ||
551 | |||
552 | memset(buf, 0, sizeof(buf)); | ||
553 | buf_size = min(count, sizeof(buf) - 1); | ||
554 | if (copy_from_user(buf, user_buf, buf_size)) | ||
555 | return -EFAULT; | ||
556 | if (sscanf(buf, "%x", &reset_flag) != 1) | ||
557 | return -EFAULT; | ||
558 | if (reset_flag == 0) | ||
559 | iwl_clear_isr_stats(priv); | ||
560 | |||
561 | return count; | ||
562 | } | ||
563 | |||
564 | |||
478 | DEBUGFS_READ_WRITE_FILE_OPS(sram); | 565 | DEBUGFS_READ_WRITE_FILE_OPS(sram); |
479 | DEBUGFS_WRITE_FILE_OPS(log_event); | 566 | DEBUGFS_WRITE_FILE_OPS(log_event); |
480 | DEBUGFS_READ_FILE_OPS(eeprom); | 567 | DEBUGFS_READ_FILE_OPS(eeprom); |
@@ -483,6 +570,7 @@ DEBUGFS_READ_FILE_OPS(rx_statistics); | |||
483 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 570 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
484 | DEBUGFS_READ_FILE_OPS(channels); | 571 | DEBUGFS_READ_FILE_OPS(channels); |
485 | DEBUGFS_READ_FILE_OPS(status); | 572 | DEBUGFS_READ_FILE_OPS(status); |
573 | DEBUGFS_READ_WRITE_FILE_OPS(interrupt); | ||
486 | 574 | ||
487 | /* | 575 | /* |
488 | * Create the debugfs files and directories | 576 | * Create the debugfs files and directories |
@@ -518,6 +606,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
518 | DEBUGFS_ADD_FILE(tx_statistics, data); | 606 | DEBUGFS_ADD_FILE(tx_statistics, data); |
519 | DEBUGFS_ADD_FILE(channels, data); | 607 | DEBUGFS_ADD_FILE(channels, data); |
520 | DEBUGFS_ADD_FILE(status, data); | 608 | DEBUGFS_ADD_FILE(status, data); |
609 | DEBUGFS_ADD_FILE(interrupt, data); | ||
521 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); | 610 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); |
522 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, | 611 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, |
523 | &priv->disable_chain_noise_cal); | 612 | &priv->disable_chain_noise_cal); |
@@ -548,6 +637,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
548 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); | 637 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); |
549 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_channels); | 638 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_channels); |
550 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_status); | 639 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_status); |
640 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_interrupt); | ||
551 | DEBUGFS_REMOVE(priv->dbgfs->dir_data); | 641 | DEBUGFS_REMOVE(priv->dbgfs->dir_data); |
552 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); | 642 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); |
553 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); | 643 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index cf7f0db58fcf..5aa76a706320 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -70,6 +70,7 @@ extern struct iwl_ops iwl5000_ops; | |||
70 | extern struct iwl_lib_ops iwl5000_lib; | 70 | extern struct iwl_lib_ops iwl5000_lib; |
71 | extern struct iwl_hcmd_ops iwl5000_hcmd; | 71 | extern struct iwl_hcmd_ops iwl5000_hcmd; |
72 | extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils; | 72 | extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils; |
73 | extern struct iwl_station_mgmt_ops iwl5000_station_mgmt; | ||
73 | 74 | ||
74 | /* shared functions from iwl-5000.c */ | 75 | /* shared functions from iwl-5000.c */ |
75 | extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len); | 76 | extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len); |
@@ -822,6 +823,21 @@ enum { | |||
822 | MEASUREMENT_ACTIVE = (1 << 1), | 823 | MEASUREMENT_ACTIVE = (1 << 1), |
823 | }; | 824 | }; |
824 | 825 | ||
826 | /* interrupt statistics */ | ||
827 | struct isr_statistics { | ||
828 | u32 hw; | ||
829 | u32 sw; | ||
830 | u32 sw_err; | ||
831 | u32 sch; | ||
832 | u32 alive; | ||
833 | u32 rfkill; | ||
834 | u32 ctkill; | ||
835 | u32 wakeup; | ||
836 | u32 rx; | ||
837 | u32 rx_handlers[REPLY_MAX]; | ||
838 | u32 tx; | ||
839 | u32 unhandled; | ||
840 | }; | ||
825 | 841 | ||
826 | #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ | 842 | #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ |
827 | 843 | ||
@@ -877,9 +893,7 @@ struct iwl_priv { | |||
877 | unsigned long scan_start_tsf; | 893 | unsigned long scan_start_tsf; |
878 | void *scan; | 894 | void *scan; |
879 | int scan_bands; | 895 | int scan_bands; |
880 | int one_direct_scan; | 896 | struct cfg80211_scan_request *scan_request; |
881 | u8 direct_ssid_len; | ||
882 | u8 direct_ssid[IW_ESSID_MAX_SIZE]; | ||
883 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; | 897 | u8 scan_tx_ant[IEEE80211_NUM_BANDS]; |
884 | u8 mgmt_tx_ant; | 898 | u8 mgmt_tx_ant; |
885 | 899 | ||
@@ -978,6 +992,9 @@ struct iwl_priv { | |||
978 | u64 bytes; | 992 | u64 bytes; |
979 | } tx_stats[3], rx_stats[3]; | 993 | } tx_stats[3], rx_stats[3]; |
980 | 994 | ||
995 | /* counts interrupts */ | ||
996 | struct isr_statistics isr_stats; | ||
997 | |||
981 | struct iwl_power_mgr power_data; | 998 | struct iwl_power_mgr power_data; |
982 | 999 | ||
983 | struct iwl_notif_statistics statistics; | 1000 | struct iwl_notif_statistics statistics; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rfkill.c b/drivers/net/wireless/iwlwifi/iwl-rfkill.c index 2ad9faf1508a..65605ad44e4b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rfkill.c +++ b/drivers/net/wireless/iwlwifi/iwl-rfkill.c | |||
@@ -91,7 +91,6 @@ int iwl_rfkill_init(struct iwl_priv *priv) | |||
91 | priv->rfkill->data = priv; | 91 | priv->rfkill->data = priv; |
92 | priv->rfkill->state = RFKILL_STATE_UNBLOCKED; | 92 | priv->rfkill->state = RFKILL_STATE_UNBLOCKED; |
93 | priv->rfkill->toggle_radio = iwl_rfkill_soft_rf_kill; | 93 | priv->rfkill->toggle_radio = iwl_rfkill_soft_rf_kill; |
94 | priv->rfkill->user_claim_unsupported = 1; | ||
95 | 94 | ||
96 | priv->rfkill->dev.class->suspend = NULL; | 95 | priv->rfkill->dev.class->suspend = NULL; |
97 | priv->rfkill->dev.class->resume = NULL; | 96 | priv->rfkill->dev.class->resume = NULL; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c index 8f65908f66f1..fae84262efb6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-rx.c | |||
@@ -1102,13 +1102,6 @@ void iwl_rx_reply_rx(struct iwl_priv *priv, | |||
1102 | if (rx_start->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) | 1102 | if (rx_start->phy_flags & RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK) |
1103 | rx_status.flag |= RX_FLAG_SHORTPRE; | 1103 | rx_status.flag |= RX_FLAG_SHORTPRE; |
1104 | 1104 | ||
1105 | /* Take shortcut when only in monitor mode */ | ||
1106 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) { | ||
1107 | iwl_pass_packet_to_mac80211(priv, include_phy, | ||
1108 | rxb, &rx_status); | ||
1109 | return; | ||
1110 | } | ||
1111 | |||
1112 | network_packet = iwl_is_network_packet(priv, header); | 1105 | network_packet = iwl_is_network_packet(priv, header); |
1113 | if (network_packet) { | 1106 | if (network_packet) { |
1114 | priv->last_rx_rssi = rx_status.signal; | 1107 | priv->last_rx_rssi = rx_status.signal; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index e7c65c4f741b..dd8766b80b34 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -448,13 +448,6 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw, | |||
448 | unsigned long flags; | 448 | unsigned long flags; |
449 | struct iwl_priv *priv = hw->priv; | 449 | struct iwl_priv *priv = hw->priv; |
450 | int ret; | 450 | int ret; |
451 | u8 *ssid = NULL; | ||
452 | size_t ssid_len = 0; | ||
453 | |||
454 | if (req->n_ssids) { | ||
455 | ssid = req->ssids[0].ssid; | ||
456 | ssid_len = req->ssids[0].ssid_len; | ||
457 | } | ||
458 | 451 | ||
459 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 452 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
460 | 453 | ||
@@ -488,13 +481,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw, | |||
488 | goto out_unlock; | 481 | goto out_unlock; |
489 | } | 482 | } |
490 | 483 | ||
491 | if (ssid_len) { | 484 | priv->scan_request = req; |
492 | priv->one_direct_scan = 1; | ||
493 | priv->direct_ssid_len = ssid_len; | ||
494 | memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len); | ||
495 | } else { | ||
496 | priv->one_direct_scan = 0; | ||
497 | } | ||
498 | 485 | ||
499 | ret = iwl_scan_initiate(priv); | 486 | ret = iwl_scan_initiate(priv); |
500 | 487 | ||
@@ -533,73 +520,14 @@ void iwl_bg_scan_check(struct work_struct *data) | |||
533 | EXPORT_SYMBOL(iwl_bg_scan_check); | 520 | EXPORT_SYMBOL(iwl_bg_scan_check); |
534 | 521 | ||
535 | /** | 522 | /** |
536 | * iwl_supported_rate_to_ie - fill in the supported rate in IE field | ||
537 | * | ||
538 | * return : set the bit for each supported rate insert in ie | ||
539 | */ | ||
540 | static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, | ||
541 | u16 basic_rate, int *left) | ||
542 | { | ||
543 | u16 ret_rates = 0, bit; | ||
544 | int i; | ||
545 | u8 *cnt = ie; | ||
546 | u8 *rates = ie + 1; | ||
547 | |||
548 | for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { | ||
549 | if (bit & supported_rate) { | ||
550 | ret_rates |= bit; | ||
551 | rates[*cnt] = iwl_rates[i].ieee | | ||
552 | ((bit & basic_rate) ? 0x80 : 0x00); | ||
553 | (*cnt)++; | ||
554 | (*left)--; | ||
555 | if ((*left <= 0) || | ||
556 | (*cnt >= IWL_SUPPORTED_RATES_IE_LEN)) | ||
557 | break; | ||
558 | } | ||
559 | } | ||
560 | |||
561 | return ret_rates; | ||
562 | } | ||
563 | |||
564 | |||
565 | static void iwl_ht_cap_to_ie(const struct ieee80211_supported_band *sband, | ||
566 | u8 *pos, int *left) | ||
567 | { | ||
568 | struct ieee80211_ht_cap *ht_cap; | ||
569 | |||
570 | if (!sband || !sband->ht_cap.ht_supported) | ||
571 | return; | ||
572 | |||
573 | if (*left < sizeof(struct ieee80211_ht_cap)) | ||
574 | return; | ||
575 | |||
576 | *pos++ = sizeof(struct ieee80211_ht_cap); | ||
577 | ht_cap = (struct ieee80211_ht_cap *) pos; | ||
578 | |||
579 | ht_cap->cap_info = cpu_to_le16(sband->ht_cap.cap); | ||
580 | memcpy(&ht_cap->mcs, &sband->ht_cap.mcs, 16); | ||
581 | ht_cap->ampdu_params_info = | ||
582 | (sband->ht_cap.ampdu_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) | | ||
583 | ((sband->ht_cap.ampdu_density << 2) & | ||
584 | IEEE80211_HT_AMPDU_PARM_DENSITY); | ||
585 | *left -= sizeof(struct ieee80211_ht_cap); | ||
586 | } | ||
587 | |||
588 | /** | ||
589 | * iwl_fill_probe_req - fill in all required fields and IE for probe request | 523 | * iwl_fill_probe_req - fill in all required fields and IE for probe request |
590 | */ | 524 | */ |
591 | 525 | ||
592 | u16 iwl_fill_probe_req(struct iwl_priv *priv, | 526 | u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, |
593 | enum ieee80211_band band, | 527 | const u8 *ies, int ie_len, int left) |
594 | struct ieee80211_mgmt *frame, | ||
595 | int left) | ||
596 | { | 528 | { |
597 | int len = 0; | 529 | int len = 0; |
598 | u8 *pos = NULL; | 530 | u8 *pos = NULL; |
599 | u16 active_rates, ret_rates, cck_rates, active_rate_basic; | ||
600 | const struct ieee80211_supported_band *sband = | ||
601 | iwl_get_hw_mode(priv, band); | ||
602 | |||
603 | 531 | ||
604 | /* Make sure there is enough space for the probe request, | 532 | /* Make sure there is enough space for the probe request, |
605 | * two mandatory IEs and the data */ | 533 | * two mandatory IEs and the data */ |
@@ -627,62 +555,12 @@ u16 iwl_fill_probe_req(struct iwl_priv *priv, | |||
627 | 555 | ||
628 | len += 2; | 556 | len += 2; |
629 | 557 | ||
630 | /* fill in supported rate */ | 558 | if (WARN_ON(left < ie_len)) |
631 | left -= 2; | 559 | return len; |
632 | if (left < 0) | ||
633 | return 0; | ||
634 | |||
635 | *pos++ = WLAN_EID_SUPP_RATES; | ||
636 | *pos = 0; | ||
637 | |||
638 | /* exclude 60M rate */ | ||
639 | active_rates = priv->rates_mask; | ||
640 | active_rates &= ~IWL_RATE_60M_MASK; | ||
641 | |||
642 | active_rate_basic = active_rates & IWL_BASIC_RATES_MASK; | ||
643 | |||
644 | cck_rates = IWL_CCK_RATES_MASK & active_rates; | ||
645 | ret_rates = iwl_supported_rate_to_ie(pos, cck_rates, | ||
646 | active_rate_basic, &left); | ||
647 | active_rates &= ~ret_rates; | ||
648 | |||
649 | ret_rates = iwl_supported_rate_to_ie(pos, active_rates, | ||
650 | active_rate_basic, &left); | ||
651 | active_rates &= ~ret_rates; | ||
652 | |||
653 | len += 2 + *pos; | ||
654 | pos += (*pos) + 1; | ||
655 | 560 | ||
656 | if (active_rates == 0) | 561 | memcpy(pos, ies, ie_len); |
657 | goto fill_end; | 562 | len += ie_len; |
658 | 563 | left -= ie_len; | |
659 | /* fill in supported extended rate */ | ||
660 | /* ...next IE... */ | ||
661 | left -= 2; | ||
662 | if (left < 0) | ||
663 | return 0; | ||
664 | /* ... fill it in... */ | ||
665 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | ||
666 | *pos = 0; | ||
667 | iwl_supported_rate_to_ie(pos, active_rates, active_rate_basic, &left); | ||
668 | if (*pos > 0) { | ||
669 | len += 2 + *pos; | ||
670 | pos += (*pos) + 1; | ||
671 | } else { | ||
672 | pos--; | ||
673 | } | ||
674 | |||
675 | fill_end: | ||
676 | |||
677 | left -= 2; | ||
678 | if (left < 0) | ||
679 | return 0; | ||
680 | |||
681 | *pos++ = WLAN_EID_HT_CAPABILITY; | ||
682 | *pos = 0; | ||
683 | iwl_ht_cap_to_ie(sband, pos, &left); | ||
684 | if (*pos > 0) | ||
685 | len += 2 + *pos; | ||
686 | 564 | ||
687 | return (u16)len; | 565 | return (u16)len; |
688 | } | 566 | } |
@@ -703,10 +581,10 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
703 | u32 rate_flags = 0; | 581 | u32 rate_flags = 0; |
704 | u16 cmd_len; | 582 | u16 cmd_len; |
705 | enum ieee80211_band band; | 583 | enum ieee80211_band band; |
706 | u8 n_probes = 2; | 584 | u8 n_probes = 0; |
707 | u8 rx_chain = priv->hw_params.valid_rx_ant; | 585 | u8 rx_chain = priv->hw_params.valid_rx_ant; |
708 | u8 rate; | 586 | u8 rate; |
709 | DECLARE_SSID_BUF(ssid); | 587 | bool is_active = false; |
710 | 588 | ||
711 | conf = ieee80211_get_hw_conf(priv->hw); | 589 | conf = ieee80211_get_hw_conf(priv->hw); |
712 | 590 | ||
@@ -796,19 +674,25 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
796 | scan_suspend_time, interval); | 674 | scan_suspend_time, interval); |
797 | } | 675 | } |
798 | 676 | ||
799 | /* We should add the ability for user to lock to PASSIVE ONLY */ | 677 | if (priv->scan_request->n_ssids) { |
800 | if (priv->one_direct_scan) { | 678 | int i, p = 0; |
801 | IWL_DEBUG_SCAN(priv, "Start direct scan for '%s'\n", | 679 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); |
802 | print_ssid(ssid, priv->direct_ssid, | 680 | for (i = 0; i < priv->scan_request->n_ssids; i++) { |
803 | priv->direct_ssid_len)); | 681 | /* always does wildcard anyway */ |
804 | scan->direct_scan[0].id = WLAN_EID_SSID; | 682 | if (!priv->scan_request->ssids[i].ssid_len) |
805 | scan->direct_scan[0].len = priv->direct_ssid_len; | 683 | continue; |
806 | memcpy(scan->direct_scan[0].ssid, | 684 | scan->direct_scan[p].id = WLAN_EID_SSID; |
807 | priv->direct_ssid, priv->direct_ssid_len); | 685 | scan->direct_scan[p].len = |
808 | n_probes++; | 686 | priv->scan_request->ssids[i].ssid_len; |
809 | } else { | 687 | memcpy(scan->direct_scan[p].ssid, |
810 | IWL_DEBUG_SCAN(priv, "Start indirect scan.\n"); | 688 | priv->scan_request->ssids[i].ssid, |
811 | } | 689 | priv->scan_request->ssids[i].ssid_len); |
690 | n_probes++; | ||
691 | p++; | ||
692 | } | ||
693 | is_active = true; | ||
694 | } else | ||
695 | IWL_DEBUG_SCAN(priv, "Start passive scan.\n"); | ||
812 | 696 | ||
813 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; | 697 | scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; |
814 | scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id; | 698 | scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id; |
@@ -828,7 +712,12 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
828 | } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { | 712 | } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { |
829 | band = IEEE80211_BAND_5GHZ; | 713 | band = IEEE80211_BAND_5GHZ; |
830 | rate = IWL_RATE_6M_PLCP; | 714 | rate = IWL_RATE_6M_PLCP; |
831 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | 715 | /* |
716 | * If active scaning is requested but a certain channel | ||
717 | * is marked passive, we can do active scanning if we | ||
718 | * detect transmissions. | ||
719 | */ | ||
720 | scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; | ||
832 | 721 | ||
833 | /* Force use of chains B and C (0x6) for scan Rx for 4965 | 722 | /* Force use of chains B and C (0x6) for scan Rx for 4965 |
834 | * Avoid A (0x1) because of its off-channel reception on A-band. | 723 | * Avoid A (0x1) because of its off-channel reception on A-band. |
@@ -850,22 +739,22 @@ static void iwl_bg_request_scan(struct work_struct *data) | |||
850 | cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | | 739 | cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | |
851 | (rx_chain << RXON_RX_CHAIN_FORCE_SEL_POS) | | 740 | (rx_chain << RXON_RX_CHAIN_FORCE_SEL_POS) | |
852 | (0x7 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS)); | 741 | (0x7 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS)); |
853 | 742 | cmd_len = iwl_fill_probe_req(priv, | |
854 | cmd_len = iwl_fill_probe_req(priv, band, | 743 | (struct ieee80211_mgmt *)scan->data, |
855 | (struct ieee80211_mgmt *)scan->data, | 744 | priv->scan_request->ie, |
856 | IWL_MAX_SCAN_SIZE - sizeof(*scan)); | 745 | priv->scan_request->ie_len, |
746 | IWL_MAX_SCAN_SIZE - sizeof(*scan)); | ||
857 | 747 | ||
858 | scan->tx_cmd.len = cpu_to_le16(cmd_len); | 748 | scan->tx_cmd.len = cpu_to_le16(cmd_len); |
859 | 749 | ||
860 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) | 750 | if (iwl_is_monitor_mode(priv)) |
861 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | 751 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; |
862 | 752 | ||
863 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | | 753 | scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | |
864 | RXON_FILTER_BCON_AWARE_MSK); | 754 | RXON_FILTER_BCON_AWARE_MSK); |
865 | 755 | ||
866 | scan->channel_count = | 756 | scan->channel_count = |
867 | iwl_get_channels_for_scan(priv, band, 1, /* active */ | 757 | iwl_get_channels_for_scan(priv, band, is_active, n_probes, |
868 | n_probes, | ||
869 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | 758 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); |
870 | 759 | ||
871 | if (scan->channel_count == 0) { | 760 | if (scan->channel_count == 0) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c index 5798fe49c771..17a4dd2be1f2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-sta.c | |||
@@ -75,7 +75,7 @@ int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
75 | return IWL_AP_ID; | 75 | return IWL_AP_ID; |
76 | } else { | 76 | } else { |
77 | u8 *da = ieee80211_get_DA(hdr); | 77 | u8 *da = ieee80211_get_DA(hdr); |
78 | return iwl_find_station(priv, da); | 78 | return priv->cfg->ops->smgmt->find_station(priv, da); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | EXPORT_SYMBOL(iwl_get_ra_sta_id); | 81 | EXPORT_SYMBOL(iwl_get_ra_sta_id); |
@@ -300,7 +300,7 @@ EXPORT_SYMBOL(iwl_add_station_flags); | |||
300 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr) | 300 | static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr) |
301 | { | 301 | { |
302 | unsigned long flags; | 302 | unsigned long flags; |
303 | u8 sta_id = iwl_find_station(priv, addr); | 303 | u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); |
304 | 304 | ||
305 | BUG_ON(sta_id == IWL_INVALID_STATION); | 305 | BUG_ON(sta_id == IWL_INVALID_STATION); |
306 | 306 | ||
@@ -758,7 +758,7 @@ void iwl_update_tkip_key(struct iwl_priv *priv, | |||
758 | int i; | 758 | int i; |
759 | DECLARE_MAC_BUF(mac); | 759 | DECLARE_MAC_BUF(mac); |
760 | 760 | ||
761 | sta_id = iwl_find_station(priv, addr); | 761 | sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); |
762 | if (sta_id == IWL_INVALID_STATION) { | 762 | if (sta_id == IWL_INVALID_STATION) { |
763 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | 763 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", |
764 | addr); | 764 | addr); |
@@ -1019,7 +1019,7 @@ int iwl_rxon_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) | |||
1019 | rcu_read_unlock(); | 1019 | rcu_read_unlock(); |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | sta_id = iwl_add_station_flags(priv, addr, is_ap, | 1022 | sta_id = priv->cfg->ops->smgmt->add_station(priv, addr, is_ap, |
1023 | 0, cur_ht_config); | 1023 | 0, cur_ht_config); |
1024 | 1024 | ||
1025 | /* Set up default rate scaling table in device's station table */ | 1025 | /* Set up default rate scaling table in device's station table */ |
@@ -1053,7 +1053,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
1053 | 1053 | ||
1054 | /* If we are an AP, then find the station, or use BCAST */ | 1054 | /* If we are an AP, then find the station, or use BCAST */ |
1055 | case NL80211_IFTYPE_AP: | 1055 | case NL80211_IFTYPE_AP: |
1056 | sta_id = iwl_find_station(priv, hdr->addr1); | 1056 | sta_id = priv->cfg->ops->smgmt->find_station(priv, hdr->addr1); |
1057 | if (sta_id != IWL_INVALID_STATION) | 1057 | if (sta_id != IWL_INVALID_STATION) |
1058 | return sta_id; | 1058 | return sta_id; |
1059 | return priv->hw_params.bcast_sta_id; | 1059 | return priv->hw_params.bcast_sta_id; |
@@ -1061,12 +1061,12 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
1061 | /* If this frame is going out to an IBSS network, find the station, | 1061 | /* If this frame is going out to an IBSS network, find the station, |
1062 | * or create a new station table entry */ | 1062 | * or create a new station table entry */ |
1063 | case NL80211_IFTYPE_ADHOC: | 1063 | case NL80211_IFTYPE_ADHOC: |
1064 | sta_id = iwl_find_station(priv, hdr->addr1); | 1064 | sta_id = priv->cfg->ops->smgmt->find_station(priv, hdr->addr1); |
1065 | if (sta_id != IWL_INVALID_STATION) | 1065 | if (sta_id != IWL_INVALID_STATION) |
1066 | return sta_id; | 1066 | return sta_id; |
1067 | 1067 | ||
1068 | /* Create new station table entry */ | 1068 | /* Create new station table entry */ |
1069 | sta_id = iwl_add_station_flags(priv, hdr->addr1, | 1069 | sta_id = priv->cfg->ops->smgmt->add_station(priv, hdr->addr1, |
1070 | 0, CMD_ASYNC, NULL); | 1070 | 0, CMD_ASYNC, NULL); |
1071 | 1071 | ||
1072 | if (sta_id != IWL_INVALID_STATION) | 1072 | if (sta_id != IWL_INVALID_STATION) |
@@ -1078,11 +1078,6 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | |||
1078 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | 1078 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); |
1079 | return priv->hw_params.bcast_sta_id; | 1079 | return priv->hw_params.bcast_sta_id; |
1080 | 1080 | ||
1081 | /* If we are in monitor mode, use BCAST. This is required for | ||
1082 | * packet injection. */ | ||
1083 | case NL80211_IFTYPE_MONITOR: | ||
1084 | return priv->hw_params.bcast_sta_id; | ||
1085 | |||
1086 | default: | 1081 | default: |
1087 | IWL_WARN(priv, "Unknown mode of operation: %d\n", | 1082 | IWL_WARN(priv, "Unknown mode of operation: %d\n", |
1088 | priv->iw_mode); | 1083 | priv->iw_mode); |
@@ -1115,7 +1110,7 @@ int iwl_sta_rx_agg_start(struct iwl_priv *priv, | |||
1115 | unsigned long flags; | 1110 | unsigned long flags; |
1116 | int sta_id; | 1111 | int sta_id; |
1117 | 1112 | ||
1118 | sta_id = iwl_find_station(priv, addr); | 1113 | sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); |
1119 | if (sta_id == IWL_INVALID_STATION) | 1114 | if (sta_id == IWL_INVALID_STATION) |
1120 | return -ENXIO; | 1115 | return -ENXIO; |
1121 | 1116 | ||
@@ -1137,7 +1132,7 @@ int iwl_sta_rx_agg_stop(struct iwl_priv *priv, const u8 *addr, int tid) | |||
1137 | unsigned long flags; | 1132 | unsigned long flags; |
1138 | int sta_id; | 1133 | int sta_id; |
1139 | 1134 | ||
1140 | sta_id = iwl_find_station(priv, addr); | 1135 | sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); |
1141 | if (sta_id == IWL_INVALID_STATION) { | 1136 | if (sta_id == IWL_INVALID_STATION) { |
1142 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); | 1137 | IWL_ERR(priv, "Invalid station for AGG tid %d\n", tid); |
1143 | return -ENXIO; | 1138 | return -ENXIO; |
@@ -1172,7 +1167,7 @@ static void iwl_sta_modify_ps_wake(struct iwl_priv *priv, int sta_id) | |||
1172 | void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) | 1167 | void iwl_update_ps_mode(struct iwl_priv *priv, u16 ps_bit, u8 *addr) |
1173 | { | 1168 | { |
1174 | /* FIXME: need locking over ps_status ??? */ | 1169 | /* FIXME: need locking over ps_status ??? */ |
1175 | u8 sta_id = iwl_find_station(priv, addr); | 1170 | u8 sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); |
1176 | 1171 | ||
1177 | if (sta_id != IWL_INVALID_STATION) { | 1172 | if (sta_id != IWL_INVALID_STATION) { |
1178 | u8 sta_awake = priv->stations[sta_id]. | 1173 | u8 sta_awake = priv->stations[sta_id]. |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index 71d5b8a1a73e..a82cca0a30c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -728,7 +728,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
728 | 728 | ||
729 | /* drop all data frame if we are not associated */ | 729 | /* drop all data frame if we are not associated */ |
730 | if (ieee80211_is_data(fc) && | 730 | if (ieee80211_is_data(fc) && |
731 | (priv->iw_mode != NL80211_IFTYPE_MONITOR || | 731 | (!iwl_is_monitor_mode(priv) || |
732 | !(info->flags & IEEE80211_TX_CTL_INJECTED)) && /* packet injection */ | 732 | !(info->flags & IEEE80211_TX_CTL_INJECTED)) && /* packet injection */ |
733 | (!iwl_is_associated(priv) || | 733 | (!iwl_is_associated(priv) || |
734 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id) || | 734 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id) || |
@@ -1183,8 +1183,10 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1183 | __func__, ra, tid); | 1183 | __func__, ra, tid); |
1184 | 1184 | ||
1185 | sta_id = iwl_find_station(priv, ra); | 1185 | sta_id = iwl_find_station(priv, ra); |
1186 | if (sta_id == IWL_INVALID_STATION) | 1186 | if (sta_id == IWL_INVALID_STATION) { |
1187 | IWL_ERR(priv, "Start AGG on invalid station\n"); | ||
1187 | return -ENXIO; | 1188 | return -ENXIO; |
1189 | } | ||
1188 | 1190 | ||
1189 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { | 1191 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { |
1190 | IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); | 1192 | IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); |
@@ -1192,8 +1194,10 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1192 | } | 1194 | } |
1193 | 1195 | ||
1194 | txq_id = iwl_txq_ctx_activate_free(priv); | 1196 | txq_id = iwl_txq_ctx_activate_free(priv); |
1195 | if (txq_id == -1) | 1197 | if (txq_id == -1) { |
1198 | IWL_ERR(priv, "No free aggregation queue available\n"); | ||
1196 | return -ENXIO; | 1199 | return -ENXIO; |
1200 | } | ||
1197 | 1201 | ||
1198 | spin_lock_irqsave(&priv->sta_lock, flags); | 1202 | spin_lock_irqsave(&priv->sta_lock, flags); |
1199 | tid_data = &priv->stations[sta_id].tid[tid]; | 1203 | tid_data = &priv->stations[sta_id].tid[tid]; |
@@ -1207,7 +1211,7 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) | |||
1207 | return ret; | 1211 | return ret; |
1208 | 1212 | ||
1209 | if (tid_data->tfds_in_queue == 0) { | 1213 | if (tid_data->tfds_in_queue == 0) { |
1210 | IWL_ERR(priv, "HW queue is empty\n"); | 1214 | IWL_DEBUG_HT(priv, "HW queue is empty\n"); |
1211 | tid_data->agg.state = IWL_AGG_ON; | 1215 | tid_data->agg.state = IWL_AGG_ON; |
1212 | ieee80211_start_tx_ba_cb_irqsafe(priv->hw, ra, tid); | 1216 | ieee80211_start_tx_ba_cb_irqsafe(priv->hw, ra, tid); |
1213 | } else { | 1217 | } else { |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 70a00c8ee42e..a782292ed435 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -149,7 +149,7 @@ out: | |||
149 | * | 149 | * |
150 | * NOTE: This does not clear or otherwise alter the device's station table. | 150 | * NOTE: This does not clear or otherwise alter the device's station table. |
151 | */ | 151 | */ |
152 | static void iwl3945_clear_stations_table(struct iwl_priv *priv) | 152 | void iwl3945_clear_stations_table(struct iwl_priv *priv) |
153 | { | 153 | { |
154 | unsigned long flags; | 154 | unsigned long flags; |
155 | 155 | ||
@@ -164,7 +164,7 @@ static void iwl3945_clear_stations_table(struct iwl_priv *priv) | |||
164 | /** | 164 | /** |
165 | * iwl3945_add_station - Add station to station tables in driver and device | 165 | * iwl3945_add_station - Add station to station tables in driver and device |
166 | */ | 166 | */ |
167 | u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags) | 167 | u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags, struct ieee80211_sta_ht_cap *ht_info) |
168 | { | 168 | { |
169 | int i; | 169 | int i; |
170 | int index = IWL_INVALID_STATION; | 170 | int index = IWL_INVALID_STATION; |
@@ -233,50 +233,6 @@ u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flag | |||
233 | 233 | ||
234 | } | 234 | } |
235 | 235 | ||
236 | static int iwl3945_send_rxon_assoc(struct iwl_priv *priv) | ||
237 | { | ||
238 | int rc = 0; | ||
239 | struct iwl_rx_packet *res = NULL; | ||
240 | struct iwl3945_rxon_assoc_cmd rxon_assoc; | ||
241 | struct iwl_host_cmd cmd = { | ||
242 | .id = REPLY_RXON_ASSOC, | ||
243 | .len = sizeof(rxon_assoc), | ||
244 | .meta.flags = CMD_WANT_SKB, | ||
245 | .data = &rxon_assoc, | ||
246 | }; | ||
247 | const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon; | ||
248 | const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon; | ||
249 | |||
250 | if ((rxon1->flags == rxon2->flags) && | ||
251 | (rxon1->filter_flags == rxon2->filter_flags) && | ||
252 | (rxon1->cck_basic_rates == rxon2->cck_basic_rates) && | ||
253 | (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) { | ||
254 | IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC. Not resending.\n"); | ||
255 | return 0; | ||
256 | } | ||
257 | |||
258 | rxon_assoc.flags = priv->staging_rxon.flags; | ||
259 | rxon_assoc.filter_flags = priv->staging_rxon.filter_flags; | ||
260 | rxon_assoc.ofdm_basic_rates = priv->staging_rxon.ofdm_basic_rates; | ||
261 | rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates; | ||
262 | rxon_assoc.reserved = 0; | ||
263 | |||
264 | rc = iwl_send_cmd_sync(priv, &cmd); | ||
265 | if (rc) | ||
266 | return rc; | ||
267 | |||
268 | res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; | ||
269 | if (res->hdr.flags & IWL_CMD_FAILED_MSK) { | ||
270 | IWL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n"); | ||
271 | rc = -EIO; | ||
272 | } | ||
273 | |||
274 | priv->alloc_rxb_skb--; | ||
275 | dev_kfree_skb_any(cmd.meta.u.skb); | ||
276 | |||
277 | return rc; | ||
278 | } | ||
279 | |||
280 | /** | 236 | /** |
281 | * iwl3945_get_antenna_flags - Get antenna flags for RXON command | 237 | * iwl3945_get_antenna_flags - Get antenna flags for RXON command |
282 | * @priv: eeprom and antenna fields are used to determine antenna flags | 238 | * @priv: eeprom and antenna fields are used to determine antenna flags |
@@ -314,150 +270,6 @@ __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv) | |||
314 | return 0; /* "diversity" is default if error */ | 270 | return 0; /* "diversity" is default if error */ |
315 | } | 271 | } |
316 | 272 | ||
317 | /** | ||
318 | * iwl3945_commit_rxon - commit staging_rxon to hardware | ||
319 | * | ||
320 | * The RXON command in staging_rxon is committed to the hardware and | ||
321 | * the active_rxon structure is updated with the new data. This | ||
322 | * function correctly transitions out of the RXON_ASSOC_MSK state if | ||
323 | * a HW tune is required based on the RXON structure changes. | ||
324 | */ | ||
325 | static int iwl3945_commit_rxon(struct iwl_priv *priv) | ||
326 | { | ||
327 | /* cast away the const for active_rxon in this function */ | ||
328 | struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon; | ||
329 | struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon; | ||
330 | int rc = 0; | ||
331 | bool new_assoc = | ||
332 | !!(priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK); | ||
333 | |||
334 | if (!iwl_is_alive(priv)) | ||
335 | return -1; | ||
336 | |||
337 | /* always get timestamp with Rx frame */ | ||
338 | staging_rxon->flags |= RXON_FLG_TSF2HOST_MSK; | ||
339 | |||
340 | /* select antenna */ | ||
341 | staging_rxon->flags &= | ||
342 | ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK); | ||
343 | staging_rxon->flags |= iwl3945_get_antenna_flags(priv); | ||
344 | |||
345 | rc = iwl_check_rxon_cmd(priv); | ||
346 | if (rc) { | ||
347 | IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); | ||
348 | return -EINVAL; | ||
349 | } | ||
350 | |||
351 | /* If we don't need to send a full RXON, we can use | ||
352 | * iwl3945_rxon_assoc_cmd which is used to reconfigure filter | ||
353 | * and other flags for the current radio configuration. */ | ||
354 | if (!iwl_full_rxon_required(priv)) { | ||
355 | rc = iwl3945_send_rxon_assoc(priv); | ||
356 | if (rc) { | ||
357 | IWL_ERR(priv, "Error setting RXON_ASSOC " | ||
358 | "configuration (%d).\n", rc); | ||
359 | return rc; | ||
360 | } | ||
361 | |||
362 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | ||
363 | |||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | /* If we are currently associated and the new config requires | ||
368 | * an RXON_ASSOC and the new config wants the associated mask enabled, | ||
369 | * we must clear the associated from the active configuration | ||
370 | * before we apply the new config */ | ||
371 | if (iwl_is_associated(priv) && new_assoc) { | ||
372 | IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n"); | ||
373 | active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
374 | |||
375 | /* | ||
376 | * reserved4 and 5 could have been filled by the iwlcore code. | ||
377 | * Let's clear them before pushing to the 3945. | ||
378 | */ | ||
379 | active_rxon->reserved4 = 0; | ||
380 | active_rxon->reserved5 = 0; | ||
381 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | ||
382 | sizeof(struct iwl3945_rxon_cmd), | ||
383 | &priv->active_rxon); | ||
384 | |||
385 | /* If the mask clearing failed then we set | ||
386 | * active_rxon back to what it was previously */ | ||
387 | if (rc) { | ||
388 | active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK; | ||
389 | IWL_ERR(priv, "Error clearing ASSOC_MSK on current " | ||
390 | "configuration (%d).\n", rc); | ||
391 | return rc; | ||
392 | } | ||
393 | } | ||
394 | |||
395 | IWL_DEBUG_INFO(priv, "Sending RXON\n" | ||
396 | "* with%s RXON_FILTER_ASSOC_MSK\n" | ||
397 | "* channel = %d\n" | ||
398 | "* bssid = %pM\n", | ||
399 | (new_assoc ? "" : "out"), | ||
400 | le16_to_cpu(staging_rxon->channel), | ||
401 | staging_rxon->bssid_addr); | ||
402 | |||
403 | /* | ||
404 | * reserved4 and 5 could have been filled by the iwlcore code. | ||
405 | * Let's clear them before pushing to the 3945. | ||
406 | */ | ||
407 | staging_rxon->reserved4 = 0; | ||
408 | staging_rxon->reserved5 = 0; | ||
409 | |||
410 | iwl_set_rxon_hwcrypto(priv, !priv->hw_params.sw_crypto); | ||
411 | |||
412 | /* Apply the new configuration */ | ||
413 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON, | ||
414 | sizeof(struct iwl3945_rxon_cmd), | ||
415 | staging_rxon); | ||
416 | if (rc) { | ||
417 | IWL_ERR(priv, "Error setting new configuration (%d).\n", rc); | ||
418 | return rc; | ||
419 | } | ||
420 | |||
421 | memcpy(active_rxon, staging_rxon, sizeof(*active_rxon)); | ||
422 | |||
423 | iwl3945_clear_stations_table(priv); | ||
424 | |||
425 | /* If we issue a new RXON command which required a tune then we must | ||
426 | * send a new TXPOWER command or we won't be able to Tx any frames */ | ||
427 | rc = priv->cfg->ops->lib->send_tx_power(priv); | ||
428 | if (rc) { | ||
429 | IWL_ERR(priv, "Error setting Tx power (%d).\n", rc); | ||
430 | return rc; | ||
431 | } | ||
432 | |||
433 | /* Add the broadcast address so we can send broadcast frames */ | ||
434 | if (iwl3945_add_station(priv, iwl_bcast_addr, 0, 0) == | ||
435 | IWL_INVALID_STATION) { | ||
436 | IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n"); | ||
437 | return -EIO; | ||
438 | } | ||
439 | |||
440 | /* If we have set the ASSOC_MSK and we are in BSS mode then | ||
441 | * add the IWL_AP_ID to the station rate table */ | ||
442 | if (iwl_is_associated(priv) && | ||
443 | (priv->iw_mode == NL80211_IFTYPE_STATION)) | ||
444 | if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, | ||
445 | 1, 0) | ||
446 | == IWL_INVALID_STATION) { | ||
447 | IWL_ERR(priv, "Error adding AP address for transmit\n"); | ||
448 | return -EIO; | ||
449 | } | ||
450 | |||
451 | /* Init the hardware's rate fallback order based on the band */ | ||
452 | rc = iwl3945_init_hw_rate_table(priv); | ||
453 | if (rc) { | ||
454 | IWL_ERR(priv, "Error setting HW rate table: %02X\n", rc); | ||
455 | return -EIO; | ||
456 | } | ||
457 | |||
458 | return 0; | ||
459 | } | ||
460 | |||
461 | static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, | 273 | static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv, |
462 | struct ieee80211_key_conf *keyconf, | 274 | struct ieee80211_key_conf *keyconf, |
463 | u8 sta_id) | 275 | u8 sta_id) |
@@ -758,42 +570,6 @@ static void iwl3945_setup_rxon_timing(struct iwl_priv *priv) | |||
758 | le16_to_cpu(priv->rxon_timing.atim_window)); | 570 | le16_to_cpu(priv->rxon_timing.atim_window)); |
759 | } | 571 | } |
760 | 572 | ||
761 | static int iwl3945_set_mode(struct iwl_priv *priv, int mode) | ||
762 | { | ||
763 | if (mode == NL80211_IFTYPE_ADHOC) { | ||
764 | const struct iwl_channel_info *ch_info; | ||
765 | |||
766 | ch_info = iwl_get_channel_info(priv, | ||
767 | priv->band, | ||
768 | le16_to_cpu(priv->staging_rxon.channel)); | ||
769 | |||
770 | if (!ch_info || !is_channel_ibss(ch_info)) { | ||
771 | IWL_ERR(priv, "channel %d not IBSS channel\n", | ||
772 | le16_to_cpu(priv->staging_rxon.channel)); | ||
773 | return -EINVAL; | ||
774 | } | ||
775 | } | ||
776 | |||
777 | iwl_connection_init_rx_config(priv, mode); | ||
778 | |||
779 | iwl3945_clear_stations_table(priv); | ||
780 | |||
781 | /* don't commit rxon if rf-kill is on*/ | ||
782 | if (!iwl_is_ready_rf(priv)) | ||
783 | return -EAGAIN; | ||
784 | |||
785 | cancel_delayed_work(&priv->scan_check); | ||
786 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
787 | IWL_WARN(priv, "Aborted scan still in progress after 100ms\n"); | ||
788 | IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n"); | ||
789 | return -EAGAIN; | ||
790 | } | ||
791 | |||
792 | iwl3945_commit_rxon(priv); | ||
793 | |||
794 | return 0; | ||
795 | } | ||
796 | |||
797 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | 573 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, |
798 | struct ieee80211_tx_info *info, | 574 | struct ieee80211_tx_info *info, |
799 | struct iwl_cmd *cmd, | 575 | struct iwl_cmd *cmd, |
@@ -900,64 +676,6 @@ static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, | |||
900 | tx->next_frame_len = 0; | 676 | tx->next_frame_len = 0; |
901 | } | 677 | } |
902 | 678 | ||
903 | /** | ||
904 | * iwl3945_get_sta_id - Find station's index within station table | ||
905 | */ | ||
906 | static int iwl3945_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr) | ||
907 | { | ||
908 | int sta_id; | ||
909 | u16 fc = le16_to_cpu(hdr->frame_control); | ||
910 | |||
911 | /* If this frame is broadcast or management, use broadcast station id */ | ||
912 | if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) || | ||
913 | is_multicast_ether_addr(hdr->addr1)) | ||
914 | return priv->hw_params.bcast_sta_id; | ||
915 | |||
916 | switch (priv->iw_mode) { | ||
917 | |||
918 | /* If we are a client station in a BSS network, use the special | ||
919 | * AP station entry (that's the only station we communicate with) */ | ||
920 | case NL80211_IFTYPE_STATION: | ||
921 | return IWL_AP_ID; | ||
922 | |||
923 | /* If we are an AP, then find the station, or use BCAST */ | ||
924 | case NL80211_IFTYPE_AP: | ||
925 | sta_id = iwl3945_hw_find_station(priv, hdr->addr1); | ||
926 | if (sta_id != IWL_INVALID_STATION) | ||
927 | return sta_id; | ||
928 | return priv->hw_params.bcast_sta_id; | ||
929 | |||
930 | /* If this frame is going out to an IBSS network, find the station, | ||
931 | * or create a new station table entry */ | ||
932 | case NL80211_IFTYPE_ADHOC: { | ||
933 | /* Create new station table entry */ | ||
934 | sta_id = iwl3945_hw_find_station(priv, hdr->addr1); | ||
935 | if (sta_id != IWL_INVALID_STATION) | ||
936 | return sta_id; | ||
937 | |||
938 | sta_id = iwl3945_add_station(priv, hdr->addr1, 0, CMD_ASYNC); | ||
939 | |||
940 | if (sta_id != IWL_INVALID_STATION) | ||
941 | return sta_id; | ||
942 | |||
943 | IWL_DEBUG_DROP(priv, "Station %pM not in station map. " | ||
944 | "Defaulting to broadcast...\n", | ||
945 | hdr->addr1); | ||
946 | iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr)); | ||
947 | return priv->hw_params.bcast_sta_id; | ||
948 | } | ||
949 | /* If we are in monitor mode, use BCAST. This is required for | ||
950 | * packet injection. */ | ||
951 | case NL80211_IFTYPE_MONITOR: | ||
952 | return priv->hw_params.bcast_sta_id; | ||
953 | |||
954 | default: | ||
955 | IWL_WARN(priv, "Unknown mode of operation: %d\n", | ||
956 | priv->iw_mode); | ||
957 | return priv->hw_params.bcast_sta_id; | ||
958 | } | ||
959 | } | ||
960 | |||
961 | /* | 679 | /* |
962 | * start REPLY_TX command process | 680 | * start REPLY_TX command process |
963 | */ | 681 | */ |
@@ -1011,7 +729,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
1011 | 729 | ||
1012 | /* drop all data frame if we are not associated */ | 730 | /* drop all data frame if we are not associated */ |
1013 | if (ieee80211_is_data(fc) && | 731 | if (ieee80211_is_data(fc) && |
1014 | (priv->iw_mode != NL80211_IFTYPE_MONITOR) && /* packet injection */ | 732 | (!iwl_is_monitor_mode(priv)) && /* packet injection */ |
1015 | (!iwl_is_associated(priv) || | 733 | (!iwl_is_associated(priv) || |
1016 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) { | 734 | ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) { |
1017 | IWL_DEBUG_DROP(priv, "Dropping - !iwl_is_associated\n"); | 735 | IWL_DEBUG_DROP(priv, "Dropping - !iwl_is_associated\n"); |
@@ -1023,7 +741,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
1023 | hdr_len = ieee80211_hdrlen(fc); | 741 | hdr_len = ieee80211_hdrlen(fc); |
1024 | 742 | ||
1025 | /* Find (or create) index into station table for destination station */ | 743 | /* Find (or create) index into station table for destination station */ |
1026 | sta_id = iwl3945_get_sta_id(priv, hdr); | 744 | sta_id = iwl_get_sta_id(priv, hdr); |
1027 | if (sta_id == IWL_INVALID_STATION) { | 745 | if (sta_id == IWL_INVALID_STATION) { |
1028 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", | 746 | IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", |
1029 | hdr->addr1); | 747 | hdr->addr1); |
@@ -1887,6 +1605,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) | |||
1887 | "r = %d, i = %d, %s, 0x%02x\n", r, i, | 1605 | "r = %d, i = %d, %s, 0x%02x\n", r, i, |
1888 | get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); | 1606 | get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd); |
1889 | priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); | 1607 | priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); |
1608 | priv->isr_stats.rx_handlers[pkt->hdr.cmd]++; | ||
1890 | } else { | 1609 | } else { |
1891 | /* No handling needed */ | 1610 | /* No handling needed */ |
1892 | IWL_DEBUG(priv, IWL_DL_HCMD | IWL_DL_RX | IWL_DL_ISR, | 1611 | IWL_DEBUG(priv, IWL_DL_HCMD | IWL_DL_RX | IWL_DL_ISR, |
@@ -2128,9 +1847,9 @@ static void iwl3945_error_recovery(struct iwl_priv *priv) | |||
2128 | memcpy(&priv->staging_rxon, &priv->recovery_rxon, | 1847 | memcpy(&priv->staging_rxon, &priv->recovery_rxon, |
2129 | sizeof(priv->staging_rxon)); | 1848 | sizeof(priv->staging_rxon)); |
2130 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 1849 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
2131 | iwl3945_commit_rxon(priv); | 1850 | iwlcore_commit_rxon(priv); |
2132 | 1851 | ||
2133 | iwl3945_add_station(priv, priv->bssid, 1, 0); | 1852 | priv->cfg->ops->smgmt->add_station(priv, priv->bssid, 1, 0, NULL); |
2134 | 1853 | ||
2135 | spin_lock_irqsave(&priv->lock, flags); | 1854 | spin_lock_irqsave(&priv->lock, flags); |
2136 | priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); | 1855 | priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); |
@@ -2186,6 +1905,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
2186 | /* Tell the device to stop sending interrupts */ | 1905 | /* Tell the device to stop sending interrupts */ |
2187 | iwl_disable_interrupts(priv); | 1906 | iwl_disable_interrupts(priv); |
2188 | 1907 | ||
1908 | priv->isr_stats.hw++; | ||
2189 | iwl_irq_handle_error(priv); | 1909 | iwl_irq_handle_error(priv); |
2190 | 1910 | ||
2191 | handled |= CSR_INT_BIT_HW_ERR; | 1911 | handled |= CSR_INT_BIT_HW_ERR; |
@@ -2198,13 +1918,17 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
2198 | #ifdef CONFIG_IWLWIFI_DEBUG | 1918 | #ifdef CONFIG_IWLWIFI_DEBUG |
2199 | if (priv->debug_level & (IWL_DL_ISR)) { | 1919 | if (priv->debug_level & (IWL_DL_ISR)) { |
2200 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ | 1920 | /* NIC fires this, but we don't use it, redundant with WAKEUP */ |
2201 | if (inta & CSR_INT_BIT_SCD) | 1921 | if (inta & CSR_INT_BIT_SCD) { |
2202 | IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " | 1922 | IWL_DEBUG_ISR(priv, "Scheduler finished to transmit " |
2203 | "the frame/frames.\n"); | 1923 | "the frame/frames.\n"); |
1924 | priv->isr_stats.sch++; | ||
1925 | } | ||
2204 | 1926 | ||
2205 | /* Alive notification via Rx interrupt will do the real work */ | 1927 | /* Alive notification via Rx interrupt will do the real work */ |
2206 | if (inta & CSR_INT_BIT_ALIVE) | 1928 | if (inta & CSR_INT_BIT_ALIVE) { |
2207 | IWL_DEBUG_ISR(priv, "Alive interrupt\n"); | 1929 | IWL_DEBUG_ISR(priv, "Alive interrupt\n"); |
1930 | priv->isr_stats.alive++; | ||
1931 | } | ||
2208 | } | 1932 | } |
2209 | #endif | 1933 | #endif |
2210 | /* Safely ignore these bits for debug checks below */ | 1934 | /* Safely ignore these bits for debug checks below */ |
@@ -2214,6 +1938,8 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
2214 | if (inta & CSR_INT_BIT_SW_ERR) { | 1938 | if (inta & CSR_INT_BIT_SW_ERR) { |
2215 | IWL_ERR(priv, "Microcode SW error detected. " | 1939 | IWL_ERR(priv, "Microcode SW error detected. " |
2216 | "Restarting 0x%X.\n", inta); | 1940 | "Restarting 0x%X.\n", inta); |
1941 | priv->isr_stats.sw++; | ||
1942 | priv->isr_stats.sw_err = inta; | ||
2217 | iwl_irq_handle_error(priv); | 1943 | iwl_irq_handle_error(priv); |
2218 | handled |= CSR_INT_BIT_SW_ERR; | 1944 | handled |= CSR_INT_BIT_SW_ERR; |
2219 | } | 1945 | } |
@@ -2229,6 +1955,7 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
2229 | iwl_txq_update_write_ptr(priv, &priv->txq[4]); | 1955 | iwl_txq_update_write_ptr(priv, &priv->txq[4]); |
2230 | iwl_txq_update_write_ptr(priv, &priv->txq[5]); | 1956 | iwl_txq_update_write_ptr(priv, &priv->txq[5]); |
2231 | 1957 | ||
1958 | priv->isr_stats.wakeup++; | ||
2232 | handled |= CSR_INT_BIT_WAKEUP; | 1959 | handled |= CSR_INT_BIT_WAKEUP; |
2233 | } | 1960 | } |
2234 | 1961 | ||
@@ -2237,11 +1964,13 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
2237 | * notifications from uCode come through here*/ | 1964 | * notifications from uCode come through here*/ |
2238 | if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { | 1965 | if (inta & (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX)) { |
2239 | iwl3945_rx_handle(priv); | 1966 | iwl3945_rx_handle(priv); |
1967 | priv->isr_stats.rx++; | ||
2240 | handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); | 1968 | handled |= (CSR_INT_BIT_FH_RX | CSR_INT_BIT_SW_RX); |
2241 | } | 1969 | } |
2242 | 1970 | ||
2243 | if (inta & CSR_INT_BIT_FH_TX) { | 1971 | if (inta & CSR_INT_BIT_FH_TX) { |
2244 | IWL_DEBUG_ISR(priv, "Tx interrupt\n"); | 1972 | IWL_DEBUG_ISR(priv, "Tx interrupt\n"); |
1973 | priv->isr_stats.tx++; | ||
2245 | 1974 | ||
2246 | iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); | 1975 | iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6)); |
2247 | if (!iwl_grab_nic_access(priv)) { | 1976 | if (!iwl_grab_nic_access(priv)) { |
@@ -2252,8 +1981,10 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
2252 | handled |= CSR_INT_BIT_FH_TX; | 1981 | handled |= CSR_INT_BIT_FH_TX; |
2253 | } | 1982 | } |
2254 | 1983 | ||
2255 | if (inta & ~handled) | 1984 | if (inta & ~handled) { |
2256 | IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); | 1985 | IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled); |
1986 | priv->isr_stats.unhandled++; | ||
1987 | } | ||
2257 | 1988 | ||
2258 | if (inta & ~CSR_INI_SET_MASK) { | 1989 | if (inta & ~CSR_INI_SET_MASK) { |
2259 | IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", | 1990 | IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n", |
@@ -2895,11 +2626,6 @@ static void iwl3945_init_alive_start(struct iwl_priv *priv) | |||
2895 | queue_work(priv->workqueue, &priv->restart); | 2626 | queue_work(priv->workqueue, &priv->restart); |
2896 | } | 2627 | } |
2897 | 2628 | ||
2898 | |||
2899 | /* temporary */ | ||
2900 | static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, | ||
2901 | struct sk_buff *skb); | ||
2902 | |||
2903 | /** | 2629 | /** |
2904 | * iwl3945_alive_start - called after REPLY_ALIVE notification received | 2630 | * iwl3945_alive_start - called after REPLY_ALIVE notification received |
2905 | * from protocol/runtime uCode (initialization uCode's | 2631 | * from protocol/runtime uCode (initialization uCode's |
@@ -2930,7 +2656,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
2930 | goto restart; | 2656 | goto restart; |
2931 | } | 2657 | } |
2932 | 2658 | ||
2933 | iwl3945_clear_stations_table(priv); | 2659 | priv->cfg->ops->smgmt->clear_station_table(priv); |
2934 | 2660 | ||
2935 | rc = iwl_grab_nic_access(priv); | 2661 | rc = iwl_grab_nic_access(priv); |
2936 | if (rc) { | 2662 | if (rc) { |
@@ -2989,7 +2715,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
2989 | iwl_send_bt_config(priv); | 2715 | iwl_send_bt_config(priv); |
2990 | 2716 | ||
2991 | /* Configure the adapter for unassociated operation */ | 2717 | /* Configure the adapter for unassociated operation */ |
2992 | iwl3945_commit_rxon(priv); | 2718 | iwlcore_commit_rxon(priv); |
2993 | 2719 | ||
2994 | iwl3945_reg_txpower_periodic(priv); | 2720 | iwl3945_reg_txpower_periodic(priv); |
2995 | 2721 | ||
@@ -3007,9 +2733,12 @@ static void iwl3945_alive_start(struct iwl_priv *priv) | |||
3007 | struct sk_buff *beacon = ieee80211_beacon_get(priv->hw, | 2733 | struct sk_buff *beacon = ieee80211_beacon_get(priv->hw, |
3008 | priv->vif); | 2734 | priv->vif); |
3009 | if (beacon) | 2735 | if (beacon) |
3010 | iwl3945_mac_beacon_update(priv->hw, beacon); | 2736 | iwl_mac_beacon_update(priv->hw, beacon); |
3011 | } | 2737 | } |
3012 | 2738 | ||
2739 | if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status)) | ||
2740 | iwl_set_mode(priv, priv->iw_mode); | ||
2741 | |||
3013 | return; | 2742 | return; |
3014 | 2743 | ||
3015 | restart: | 2744 | restart: |
@@ -3032,7 +2761,7 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
3032 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 2761 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
3033 | 2762 | ||
3034 | iwl3945_led_unregister(priv); | 2763 | iwl3945_led_unregister(priv); |
3035 | iwl3945_clear_stations_table(priv); | 2764 | priv->cfg->ops->smgmt->clear_station_table(priv); |
3036 | 2765 | ||
3037 | /* Unblock any waiting calls */ | 2766 | /* Unblock any waiting calls */ |
3038 | wake_up_interruptible_all(&priv->wait_command_queue); | 2767 | wake_up_interruptible_all(&priv->wait_command_queue); |
@@ -3055,7 +2784,7 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
3055 | ieee80211_stop_queues(priv->hw); | 2784 | ieee80211_stop_queues(priv->hw); |
3056 | 2785 | ||
3057 | /* If we have not previously called iwl3945_init() then | 2786 | /* If we have not previously called iwl3945_init() then |
3058 | * clear all bits but the RF Kill and SUSPEND bits and return */ | 2787 | * clear all bits but the RF Kill bits and return */ |
3059 | if (!iwl_is_init(priv)) { | 2788 | if (!iwl_is_init(priv)) { |
3060 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << | 2789 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << |
3061 | STATUS_RF_KILL_HW | | 2790 | STATUS_RF_KILL_HW | |
@@ -3063,23 +2792,19 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
3063 | STATUS_RF_KILL_SW | | 2792 | STATUS_RF_KILL_SW | |
3064 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 2793 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << |
3065 | STATUS_GEO_CONFIGURED | | 2794 | STATUS_GEO_CONFIGURED | |
3066 | test_bit(STATUS_IN_SUSPEND, &priv->status) << | ||
3067 | STATUS_IN_SUSPEND | | ||
3068 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 2795 | test_bit(STATUS_EXIT_PENDING, &priv->status) << |
3069 | STATUS_EXIT_PENDING; | 2796 | STATUS_EXIT_PENDING; |
3070 | goto exit; | 2797 | goto exit; |
3071 | } | 2798 | } |
3072 | 2799 | ||
3073 | /* ...otherwise clear out all the status bits but the RF Kill and | 2800 | /* ...otherwise clear out all the status bits but the RF Kill |
3074 | * SUSPEND bits and continue taking the NIC down. */ | 2801 | * bits and continue taking the NIC down. */ |
3075 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << | 2802 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << |
3076 | STATUS_RF_KILL_HW | | 2803 | STATUS_RF_KILL_HW | |
3077 | test_bit(STATUS_RF_KILL_SW, &priv->status) << | 2804 | test_bit(STATUS_RF_KILL_SW, &priv->status) << |
3078 | STATUS_RF_KILL_SW | | 2805 | STATUS_RF_KILL_SW | |
3079 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 2806 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << |
3080 | STATUS_GEO_CONFIGURED | | 2807 | STATUS_GEO_CONFIGURED | |
3081 | test_bit(STATUS_IN_SUSPEND, &priv->status) << | ||
3082 | STATUS_IN_SUSPEND | | ||
3083 | test_bit(STATUS_FW_ERROR, &priv->status) << | 2808 | test_bit(STATUS_FW_ERROR, &priv->status) << |
3084 | STATUS_FW_ERROR | | 2809 | STATUS_FW_ERROR | |
3085 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 2810 | test_bit(STATUS_EXIT_PENDING, &priv->status) << |
@@ -3103,7 +2828,7 @@ static void __iwl3945_down(struct iwl_priv *priv) | |||
3103 | 2828 | ||
3104 | udelay(5); | 2829 | udelay(5); |
3105 | 2830 | ||
3106 | if (exit_pending || test_bit(STATUS_IN_SUSPEND, &priv->status)) | 2831 | if (exit_pending) |
3107 | priv->cfg->ops->lib->apm_ops.stop(priv); | 2832 | priv->cfg->ops->lib->apm_ops.stop(priv); |
3108 | else | 2833 | else |
3109 | priv->cfg->ops->lib->apm_ops.reset(priv); | 2834 | priv->cfg->ops->lib->apm_ops.reset(priv); |
@@ -3156,10 +2881,8 @@ static int __iwl3945_up(struct iwl_priv *priv) | |||
3156 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 2881 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
3157 | else { | 2882 | else { |
3158 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 2883 | set_bit(STATUS_RF_KILL_HW, &priv->status); |
3159 | if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) { | 2884 | IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); |
3160 | IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); | 2885 | return -ENODEV; |
3161 | return -ENODEV; | ||
3162 | } | ||
3163 | } | 2886 | } |
3164 | 2887 | ||
3165 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); | 2888 | iwl_write32(priv, CSR_INT, 0xFFFFFFFF); |
@@ -3195,7 +2918,7 @@ static int __iwl3945_up(struct iwl_priv *priv) | |||
3195 | 2918 | ||
3196 | for (i = 0; i < MAX_HW_RESTARTS; i++) { | 2919 | for (i = 0; i < MAX_HW_RESTARTS; i++) { |
3197 | 2920 | ||
3198 | iwl3945_clear_stations_table(priv); | 2921 | priv->cfg->ops->smgmt->clear_station_table(priv); |
3199 | 2922 | ||
3200 | /* load bootstrap state machine, | 2923 | /* load bootstrap state machine, |
3201 | * load bootstrap program into processor's memory, | 2924 | * load bootstrap program into processor's memory, |
@@ -3291,9 +3014,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
3291 | int rc = 0; | 3014 | int rc = 0; |
3292 | struct iwl3945_scan_cmd *scan; | 3015 | struct iwl3945_scan_cmd *scan; |
3293 | struct ieee80211_conf *conf = NULL; | 3016 | struct ieee80211_conf *conf = NULL; |
3294 | u8 n_probes = 2; | 3017 | u8 n_probes = 0; |
3295 | enum ieee80211_band band; | 3018 | enum ieee80211_band band; |
3296 | DECLARE_SSID_BUF(ssid); | 3019 | bool is_active = false; |
3297 | 3020 | ||
3298 | conf = ieee80211_get_hw_conf(priv->hw); | 3021 | conf = ieee80211_get_hw_conf(priv->hw); |
3299 | 3022 | ||
@@ -3392,18 +3115,25 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
3392 | scan_suspend_time, interval); | 3115 | scan_suspend_time, interval); |
3393 | } | 3116 | } |
3394 | 3117 | ||
3395 | /* We should add the ability for user to lock to PASSIVE ONLY */ | 3118 | if (priv->scan_request->n_ssids) { |
3396 | if (priv->one_direct_scan) { | 3119 | int i, p = 0; |
3397 | IWL_DEBUG_SCAN(priv, "Kicking off one direct scan for '%s'\n", | 3120 | IWL_DEBUG_SCAN(priv, "Kicking off active scan\n"); |
3398 | print_ssid(ssid, priv->direct_ssid, | 3121 | for (i = 0; i < priv->scan_request->n_ssids; i++) { |
3399 | priv->direct_ssid_len)); | 3122 | /* always does wildcard anyway */ |
3400 | scan->direct_scan[0].id = WLAN_EID_SSID; | 3123 | if (!priv->scan_request->ssids[i].ssid_len) |
3401 | scan->direct_scan[0].len = priv->direct_ssid_len; | 3124 | continue; |
3402 | memcpy(scan->direct_scan[0].ssid, | 3125 | scan->direct_scan[p].id = WLAN_EID_SSID; |
3403 | priv->direct_ssid, priv->direct_ssid_len); | 3126 | scan->direct_scan[p].len = |
3404 | n_probes++; | 3127 | priv->scan_request->ssids[i].ssid_len; |
3128 | memcpy(scan->direct_scan[p].ssid, | ||
3129 | priv->scan_request->ssids[i].ssid, | ||
3130 | priv->scan_request->ssids[i].ssid_len); | ||
3131 | n_probes++; | ||
3132 | p++; | ||
3133 | } | ||
3134 | is_active = true; | ||
3405 | } else | 3135 | } else |
3406 | IWL_DEBUG_SCAN(priv, "Kicking off one indirect scan.\n"); | 3136 | IWL_DEBUG_SCAN(priv, "Kicking off passive scan.\n"); |
3407 | 3137 | ||
3408 | /* We don't build a direct scan probe request; the uCode will do | 3138 | /* We don't build a direct scan probe request; the uCode will do |
3409 | * that based on the direct_mask added to each channel entry */ | 3139 | * that based on the direct_mask added to each channel entry */ |
@@ -3420,7 +3150,12 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
3420 | band = IEEE80211_BAND_2GHZ; | 3150 | band = IEEE80211_BAND_2GHZ; |
3421 | } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { | 3151 | } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { |
3422 | scan->tx_cmd.rate = IWL_RATE_6M_PLCP; | 3152 | scan->tx_cmd.rate = IWL_RATE_6M_PLCP; |
3423 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | 3153 | /* |
3154 | * If active scaning is requested but a certain channel | ||
3155 | * is marked passive, we can do active scanning if we | ||
3156 | * detect transmissions. | ||
3157 | */ | ||
3158 | scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; | ||
3424 | band = IEEE80211_BAND_5GHZ; | 3159 | band = IEEE80211_BAND_5GHZ; |
3425 | } else { | 3160 | } else { |
3426 | IWL_WARN(priv, "Invalid scan band count\n"); | 3161 | IWL_WARN(priv, "Invalid scan band count\n"); |
@@ -3428,19 +3163,20 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
3428 | } | 3163 | } |
3429 | 3164 | ||
3430 | scan->tx_cmd.len = cpu_to_le16( | 3165 | scan->tx_cmd.len = cpu_to_le16( |
3431 | iwl_fill_probe_req(priv, band, | 3166 | iwl_fill_probe_req(priv, |
3432 | (struct ieee80211_mgmt *)scan->data, | 3167 | (struct ieee80211_mgmt *)scan->data, |
3433 | IWL_MAX_SCAN_SIZE - sizeof(*scan))); | 3168 | priv->scan_request->ie, |
3169 | priv->scan_request->ie_len, | ||
3170 | IWL_MAX_SCAN_SIZE - sizeof(*scan))); | ||
3434 | 3171 | ||
3435 | /* select Rx antennas */ | 3172 | /* select Rx antennas */ |
3436 | scan->flags |= iwl3945_get_antenna_flags(priv); | 3173 | scan->flags |= iwl3945_get_antenna_flags(priv); |
3437 | 3174 | ||
3438 | if (priv->iw_mode == NL80211_IFTYPE_MONITOR) | 3175 | if (iwl_is_monitor_mode(priv)) |
3439 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | 3176 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; |
3440 | 3177 | ||
3441 | scan->channel_count = | 3178 | scan->channel_count = |
3442 | iwl3945_get_channels_for_scan(priv, band, 1, /* active */ | 3179 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, |
3443 | n_probes, | ||
3444 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | 3180 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); |
3445 | 3181 | ||
3446 | if (scan->channel_count == 0) { | 3182 | if (scan->channel_count == 0) { |
@@ -3517,7 +3253,7 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data) | |||
3517 | 3253 | ||
3518 | #define IWL_DELAY_NEXT_SCAN (HZ*2) | 3254 | #define IWL_DELAY_NEXT_SCAN (HZ*2) |
3519 | 3255 | ||
3520 | static void iwl3945_post_associate(struct iwl_priv *priv) | 3256 | void iwl3945_post_associate(struct iwl_priv *priv) |
3521 | { | 3257 | { |
3522 | int rc = 0; | 3258 | int rc = 0; |
3523 | struct ieee80211_conf *conf = NULL; | 3259 | struct ieee80211_conf *conf = NULL; |
@@ -3542,7 +3278,7 @@ static void iwl3945_post_associate(struct iwl_priv *priv) | |||
3542 | conf = ieee80211_get_hw_conf(priv->hw); | 3278 | conf = ieee80211_get_hw_conf(priv->hw); |
3543 | 3279 | ||
3544 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3280 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3545 | iwl3945_commit_rxon(priv); | 3281 | iwlcore_commit_rxon(priv); |
3546 | 3282 | ||
3547 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 3283 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
3548 | iwl3945_setup_rxon_timing(priv); | 3284 | iwl3945_setup_rxon_timing(priv); |
@@ -3575,7 +3311,7 @@ static void iwl3945_post_associate(struct iwl_priv *priv) | |||
3575 | 3311 | ||
3576 | } | 3312 | } |
3577 | 3313 | ||
3578 | iwl3945_commit_rxon(priv); | 3314 | iwlcore_commit_rxon(priv); |
3579 | 3315 | ||
3580 | switch (priv->iw_mode) { | 3316 | switch (priv->iw_mode) { |
3581 | case NL80211_IFTYPE_STATION: | 3317 | case NL80211_IFTYPE_STATION: |
@@ -3585,7 +3321,7 @@ static void iwl3945_post_associate(struct iwl_priv *priv) | |||
3585 | case NL80211_IFTYPE_ADHOC: | 3321 | case NL80211_IFTYPE_ADHOC: |
3586 | 3322 | ||
3587 | priv->assoc_id = 1; | 3323 | priv->assoc_id = 1; |
3588 | iwl3945_add_station(priv, priv->bssid, 0, 0); | 3324 | priv->cfg->ops->smgmt->add_station(priv, priv->bssid, 0, 0, NULL); |
3589 | iwl3945_sync_sta(priv, IWL_STA_ID, | 3325 | iwl3945_sync_sta(priv, IWL_STA_ID, |
3590 | (priv->band == IEEE80211_BAND_5GHZ) ? | 3326 | (priv->band == IEEE80211_BAND_5GHZ) ? |
3591 | IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, | 3327 | IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, |
@@ -3607,8 +3343,6 @@ static void iwl3945_post_associate(struct iwl_priv *priv) | |||
3607 | priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN; | 3343 | priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN; |
3608 | } | 3344 | } |
3609 | 3345 | ||
3610 | static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed); | ||
3611 | |||
3612 | /***************************************************************************** | 3346 | /***************************************************************************** |
3613 | * | 3347 | * |
3614 | * mac80211 entry point functions | 3348 | * mac80211 entry point functions |
@@ -3651,9 +3385,6 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw) | |||
3651 | 3385 | ||
3652 | IWL_DEBUG_INFO(priv, "Start UP work.\n"); | 3386 | IWL_DEBUG_INFO(priv, "Start UP work.\n"); |
3653 | 3387 | ||
3654 | if (test_bit(STATUS_IN_SUSPEND, &priv->status)) | ||
3655 | return 0; | ||
3656 | |||
3657 | /* Wait for START_ALIVE from ucode. Otherwise callbacks from | 3388 | /* Wait for START_ALIVE from ucode. Otherwise callbacks from |
3658 | * mac80211 will not be run successfully. */ | 3389 | * mac80211 will not be run successfully. */ |
3659 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, | 3390 | ret = wait_event_interruptible_timeout(priv->wait_command_queue, |
@@ -3732,144 +3463,7 @@ static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
3732 | return NETDEV_TX_OK; | 3463 | return NETDEV_TX_OK; |
3733 | } | 3464 | } |
3734 | 3465 | ||
3735 | static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, | 3466 | void iwl3945_config_ap(struct iwl_priv *priv) |
3736 | struct ieee80211_if_init_conf *conf) | ||
3737 | { | ||
3738 | struct iwl_priv *priv = hw->priv; | ||
3739 | unsigned long flags; | ||
3740 | |||
3741 | IWL_DEBUG_MAC80211(priv, "enter: type %d\n", conf->type); | ||
3742 | |||
3743 | if (priv->vif) { | ||
3744 | IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n"); | ||
3745 | return -EOPNOTSUPP; | ||
3746 | } | ||
3747 | |||
3748 | spin_lock_irqsave(&priv->lock, flags); | ||
3749 | priv->vif = conf->vif; | ||
3750 | priv->iw_mode = conf->type; | ||
3751 | |||
3752 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3753 | |||
3754 | mutex_lock(&priv->mutex); | ||
3755 | |||
3756 | if (conf->mac_addr) { | ||
3757 | IWL_DEBUG_MAC80211(priv, "Set: %pM\n", conf->mac_addr); | ||
3758 | memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN); | ||
3759 | } | ||
3760 | |||
3761 | if (iwl_is_ready(priv)) | ||
3762 | iwl3945_set_mode(priv, conf->type); | ||
3763 | |||
3764 | mutex_unlock(&priv->mutex); | ||
3765 | |||
3766 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
3767 | return 0; | ||
3768 | } | ||
3769 | |||
3770 | /** | ||
3771 | * iwl3945_mac_config - mac80211 config callback | ||
3772 | * | ||
3773 | * We ignore conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME since it seems to | ||
3774 | * be set inappropriately and the driver currently sets the hardware up to | ||
3775 | * use it whenever needed. | ||
3776 | */ | ||
3777 | static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed) | ||
3778 | { | ||
3779 | struct iwl_priv *priv = hw->priv; | ||
3780 | const struct iwl_channel_info *ch_info; | ||
3781 | struct ieee80211_conf *conf = &hw->conf; | ||
3782 | unsigned long flags; | ||
3783 | int ret = 0; | ||
3784 | |||
3785 | mutex_lock(&priv->mutex); | ||
3786 | IWL_DEBUG_MAC80211(priv, "enter to channel %d\n", | ||
3787 | conf->channel->hw_value); | ||
3788 | |||
3789 | if (!iwl_is_ready(priv)) { | ||
3790 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | ||
3791 | ret = -EIO; | ||
3792 | goto out; | ||
3793 | } | ||
3794 | |||
3795 | if (unlikely(!iwl3945_mod_params.disable_hw_scan && | ||
3796 | test_bit(STATUS_SCANNING, &priv->status))) { | ||
3797 | IWL_DEBUG_MAC80211(priv, "leave - scanning\n"); | ||
3798 | set_bit(STATUS_CONF_PENDING, &priv->status); | ||
3799 | mutex_unlock(&priv->mutex); | ||
3800 | return 0; | ||
3801 | } | ||
3802 | |||
3803 | spin_lock_irqsave(&priv->lock, flags); | ||
3804 | |||
3805 | ch_info = iwl_get_channel_info(priv, conf->channel->band, | ||
3806 | conf->channel->hw_value); | ||
3807 | if (!is_channel_valid(ch_info)) { | ||
3808 | IWL_DEBUG_SCAN(priv, | ||
3809 | "Channel %d [%d] is INVALID for this band.\n", | ||
3810 | conf->channel->hw_value, conf->channel->band); | ||
3811 | IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n"); | ||
3812 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3813 | ret = -EINVAL; | ||
3814 | goto out; | ||
3815 | } | ||
3816 | |||
3817 | iwl_set_rxon_channel(priv, conf->channel); | ||
3818 | |||
3819 | iwl_set_flags_for_band(priv, conf->channel->band); | ||
3820 | |||
3821 | /* The list of supported rates and rate mask can be different | ||
3822 | * for each phymode; since the phymode may have changed, reset | ||
3823 | * the rate mask to what mac80211 lists */ | ||
3824 | iwl_set_rate(priv); | ||
3825 | |||
3826 | spin_unlock_irqrestore(&priv->lock, flags); | ||
3827 | |||
3828 | #ifdef IEEE80211_CONF_CHANNEL_SWITCH | ||
3829 | if (conf->flags & IEEE80211_CONF_CHANNEL_SWITCH) { | ||
3830 | iwl3945_hw_channel_switch(priv, conf->channel); | ||
3831 | goto out; | ||
3832 | } | ||
3833 | #endif | ||
3834 | |||
3835 | if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) { | ||
3836 | if (conf->radio_enabled && | ||
3837 | iwl_radio_kill_sw_enable_radio(priv)) { | ||
3838 | IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - " | ||
3839 | "waiting for uCode\n"); | ||
3840 | goto out; | ||
3841 | } | ||
3842 | |||
3843 | if (!conf->radio_enabled) { | ||
3844 | iwl_radio_kill_sw_disable_radio(priv); | ||
3845 | IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n"); | ||
3846 | goto out; | ||
3847 | } | ||
3848 | } | ||
3849 | |||
3850 | if (iwl_is_rfkill(priv)) { | ||
3851 | IWL_DEBUG_MAC80211(priv, "leave - RF kill\n"); | ||
3852 | ret = -EIO; | ||
3853 | goto out; | ||
3854 | } | ||
3855 | |||
3856 | iwl_set_rate(priv); | ||
3857 | |||
3858 | if (memcmp(&priv->active_rxon, | ||
3859 | &priv->staging_rxon, sizeof(priv->staging_rxon))) | ||
3860 | iwl3945_commit_rxon(priv); | ||
3861 | else | ||
3862 | IWL_DEBUG_INFO(priv, "Not re-sending same RXON configuration\n"); | ||
3863 | |||
3864 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
3865 | |||
3866 | out: | ||
3867 | clear_bit(STATUS_CONF_PENDING, &priv->status); | ||
3868 | mutex_unlock(&priv->mutex); | ||
3869 | return ret; | ||
3870 | } | ||
3871 | |||
3872 | static void iwl3945_config_ap(struct iwl_priv *priv) | ||
3873 | { | 3467 | { |
3874 | int rc = 0; | 3468 | int rc = 0; |
3875 | 3469 | ||
@@ -3881,7 +3475,7 @@ static void iwl3945_config_ap(struct iwl_priv *priv) | |||
3881 | 3475 | ||
3882 | /* RXON - unassoc (to set timing command) */ | 3476 | /* RXON - unassoc (to set timing command) */ |
3883 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 3477 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
3884 | iwl3945_commit_rxon(priv); | 3478 | iwlcore_commit_rxon(priv); |
3885 | 3479 | ||
3886 | /* RXON Timing */ | 3480 | /* RXON Timing */ |
3887 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 3481 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
@@ -3917,8 +3511,8 @@ static void iwl3945_config_ap(struct iwl_priv *priv) | |||
3917 | } | 3511 | } |
3918 | /* restore RXON assoc */ | 3512 | /* restore RXON assoc */ |
3919 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; | 3513 | priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK; |
3920 | iwl3945_commit_rxon(priv); | 3514 | iwlcore_commit_rxon(priv); |
3921 | iwl3945_add_station(priv, iwl_bcast_addr, 0, 0); | 3515 | priv->cfg->ops->smgmt->add_station(priv, iwl_bcast_addr, 0, 0, NULL); |
3922 | } | 3516 | } |
3923 | iwl3945_send_beacon_cmd(priv); | 3517 | iwl3945_send_beacon_cmd(priv); |
3924 | 3518 | ||
@@ -3927,189 +3521,6 @@ static void iwl3945_config_ap(struct iwl_priv *priv) | |||
3927 | * clear sta table, add BCAST sta... */ | 3521 | * clear sta table, add BCAST sta... */ |
3928 | } | 3522 | } |
3929 | 3523 | ||
3930 | static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, | ||
3931 | struct ieee80211_vif *vif, | ||
3932 | struct ieee80211_if_conf *conf) | ||
3933 | { | ||
3934 | struct iwl_priv *priv = hw->priv; | ||
3935 | int rc; | ||
3936 | |||
3937 | if (conf == NULL) | ||
3938 | return -EIO; | ||
3939 | |||
3940 | if (priv->vif != vif) { | ||
3941 | IWL_DEBUG_MAC80211(priv, "leave - priv->vif != vif\n"); | ||
3942 | return 0; | ||
3943 | } | ||
3944 | |||
3945 | /* handle this temporarily here */ | ||
3946 | if (priv->iw_mode == NL80211_IFTYPE_ADHOC && | ||
3947 | conf->changed & IEEE80211_IFCC_BEACON) { | ||
3948 | struct sk_buff *beacon = ieee80211_beacon_get(hw, vif); | ||
3949 | if (!beacon) | ||
3950 | return -ENOMEM; | ||
3951 | mutex_lock(&priv->mutex); | ||
3952 | rc = iwl3945_mac_beacon_update(hw, beacon); | ||
3953 | mutex_unlock(&priv->mutex); | ||
3954 | if (rc) | ||
3955 | return rc; | ||
3956 | } | ||
3957 | |||
3958 | if (!iwl_is_alive(priv)) | ||
3959 | return -EAGAIN; | ||
3960 | |||
3961 | mutex_lock(&priv->mutex); | ||
3962 | |||
3963 | if (conf->bssid) | ||
3964 | IWL_DEBUG_MAC80211(priv, "bssid: %pM\n", conf->bssid); | ||
3965 | |||
3966 | /* | ||
3967 | * very dubious code was here; the probe filtering flag is never set: | ||
3968 | * | ||
3969 | if (unlikely(test_bit(STATUS_SCANNING, &priv->status)) && | ||
3970 | !(priv->hw->flags & IEEE80211_HW_NO_PROBE_FILTERING)) { | ||
3971 | */ | ||
3972 | |||
3973 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
3974 | if (!conf->bssid) { | ||
3975 | conf->bssid = priv->mac_addr; | ||
3976 | memcpy(priv->bssid, priv->mac_addr, ETH_ALEN); | ||
3977 | IWL_DEBUG_MAC80211(priv, "bssid was set to: %pM\n", | ||
3978 | conf->bssid); | ||
3979 | } | ||
3980 | if (priv->ibss_beacon) | ||
3981 | dev_kfree_skb(priv->ibss_beacon); | ||
3982 | |||
3983 | priv->ibss_beacon = ieee80211_beacon_get(hw, vif); | ||
3984 | } | ||
3985 | |||
3986 | if (iwl_is_rfkill(priv)) | ||
3987 | goto done; | ||
3988 | |||
3989 | if (conf->bssid && !is_zero_ether_addr(conf->bssid) && | ||
3990 | !is_multicast_ether_addr(conf->bssid)) { | ||
3991 | /* If there is currently a HW scan going on in the background | ||
3992 | * then we need to cancel it else the RXON below will fail. */ | ||
3993 | if (iwl_scan_cancel_timeout(priv, 100)) { | ||
3994 | IWL_WARN(priv, "Aborted scan still in progress " | ||
3995 | "after 100ms\n"); | ||
3996 | IWL_DEBUG_MAC80211(priv, "leaving:scan abort failed\n"); | ||
3997 | mutex_unlock(&priv->mutex); | ||
3998 | return -EAGAIN; | ||
3999 | } | ||
4000 | memcpy(priv->staging_rxon.bssid_addr, conf->bssid, ETH_ALEN); | ||
4001 | |||
4002 | /* TODO: Audit driver for usage of these members and see | ||
4003 | * if mac80211 deprecates them (priv->bssid looks like it | ||
4004 | * shouldn't be there, but I haven't scanned the IBSS code | ||
4005 | * to verify) - jpk */ | ||
4006 | memcpy(priv->bssid, conf->bssid, ETH_ALEN); | ||
4007 | |||
4008 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
4009 | iwl3945_config_ap(priv); | ||
4010 | else { | ||
4011 | rc = iwl3945_commit_rxon(priv); | ||
4012 | if ((priv->iw_mode == NL80211_IFTYPE_STATION) && rc) | ||
4013 | iwl3945_add_station(priv, | ||
4014 | priv->active_rxon.bssid_addr, 1, 0); | ||
4015 | } | ||
4016 | |||
4017 | } else { | ||
4018 | iwl_scan_cancel_timeout(priv, 100); | ||
4019 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
4020 | iwl3945_commit_rxon(priv); | ||
4021 | } | ||
4022 | |||
4023 | done: | ||
4024 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
4025 | mutex_unlock(&priv->mutex); | ||
4026 | |||
4027 | return 0; | ||
4028 | } | ||
4029 | |||
4030 | static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, | ||
4031 | struct ieee80211_if_init_conf *conf) | ||
4032 | { | ||
4033 | struct iwl_priv *priv = hw->priv; | ||
4034 | |||
4035 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
4036 | |||
4037 | mutex_lock(&priv->mutex); | ||
4038 | |||
4039 | if (iwl_is_ready_rf(priv)) { | ||
4040 | iwl_scan_cancel_timeout(priv, 100); | ||
4041 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
4042 | iwl3945_commit_rxon(priv); | ||
4043 | } | ||
4044 | if (priv->vif == conf->vif) { | ||
4045 | priv->vif = NULL; | ||
4046 | memset(priv->bssid, 0, ETH_ALEN); | ||
4047 | } | ||
4048 | mutex_unlock(&priv->mutex); | ||
4049 | |||
4050 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
4051 | } | ||
4052 | |||
4053 | #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6) | ||
4054 | |||
4055 | static void iwl3945_bss_info_changed(struct ieee80211_hw *hw, | ||
4056 | struct ieee80211_vif *vif, | ||
4057 | struct ieee80211_bss_conf *bss_conf, | ||
4058 | u32 changes) | ||
4059 | { | ||
4060 | struct iwl_priv *priv = hw->priv; | ||
4061 | |||
4062 | IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes); | ||
4063 | |||
4064 | if (changes & BSS_CHANGED_ERP_PREAMBLE) { | ||
4065 | IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n", | ||
4066 | bss_conf->use_short_preamble); | ||
4067 | if (bss_conf->use_short_preamble) | ||
4068 | priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; | ||
4069 | else | ||
4070 | priv->staging_rxon.flags &= | ||
4071 | ~RXON_FLG_SHORT_PREAMBLE_MSK; | ||
4072 | } | ||
4073 | |||
4074 | if (changes & BSS_CHANGED_ERP_CTS_PROT) { | ||
4075 | IWL_DEBUG_MAC80211(priv, "ERP_CTS %d\n", | ||
4076 | bss_conf->use_cts_prot); | ||
4077 | if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ)) | ||
4078 | priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; | ||
4079 | else | ||
4080 | priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | ||
4081 | } | ||
4082 | |||
4083 | if (changes & BSS_CHANGED_ASSOC) { | ||
4084 | IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc); | ||
4085 | /* This should never happen as this function should | ||
4086 | * never be called from interrupt context. */ | ||
4087 | if (WARN_ON_ONCE(in_interrupt())) | ||
4088 | return; | ||
4089 | if (bss_conf->assoc) { | ||
4090 | priv->assoc_id = bss_conf->aid; | ||
4091 | priv->beacon_int = bss_conf->beacon_int; | ||
4092 | priv->timestamp = bss_conf->timestamp; | ||
4093 | priv->assoc_capability = bss_conf->assoc_capability; | ||
4094 | priv->power_data.dtim_period = bss_conf->dtim_period; | ||
4095 | priv->next_scan_jiffies = jiffies + | ||
4096 | IWL_DELAY_NEXT_SCAN_AFTER_ASSOC; | ||
4097 | mutex_lock(&priv->mutex); | ||
4098 | iwl3945_post_associate(priv); | ||
4099 | mutex_unlock(&priv->mutex); | ||
4100 | } else { | ||
4101 | priv->assoc_id = 0; | ||
4102 | IWL_DEBUG_MAC80211(priv, | ||
4103 | "DISASSOC %d\n", bss_conf->assoc); | ||
4104 | } | ||
4105 | } else if (changes && iwl_is_associated(priv) && priv->assoc_id) { | ||
4106 | IWL_DEBUG_MAC80211(priv, | ||
4107 | "Associated Changes %d\n", changes); | ||
4108 | iwl3945_send_rxon_assoc(priv); | ||
4109 | } | ||
4110 | |||
4111 | } | ||
4112 | |||
4113 | static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | 3524 | static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
4114 | struct ieee80211_vif *vif, | 3525 | struct ieee80211_vif *vif, |
4115 | struct ieee80211_sta *sta, | 3526 | struct ieee80211_sta *sta, |
@@ -4132,7 +3543,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
4132 | static_key = !iwl_is_associated(priv); | 3543 | static_key = !iwl_is_associated(priv); |
4133 | 3544 | ||
4134 | if (!static_key) { | 3545 | if (!static_key) { |
4135 | sta_id = iwl3945_hw_find_station(priv, addr); | 3546 | sta_id = priv->cfg->ops->smgmt->find_station(priv, addr); |
4136 | if (sta_id == IWL_INVALID_STATION) { | 3547 | if (sta_id == IWL_INVALID_STATION) { |
4137 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", | 3548 | IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n", |
4138 | addr); | 3549 | addr); |
@@ -4168,185 +3579,6 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
4168 | return ret; | 3579 | return ret; |
4169 | } | 3580 | } |
4170 | 3581 | ||
4171 | static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | ||
4172 | const struct ieee80211_tx_queue_params *params) | ||
4173 | { | ||
4174 | struct iwl_priv *priv = hw->priv; | ||
4175 | unsigned long flags; | ||
4176 | int q; | ||
4177 | |||
4178 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
4179 | |||
4180 | if (!iwl_is_ready_rf(priv)) { | ||
4181 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
4182 | return -EIO; | ||
4183 | } | ||
4184 | |||
4185 | if (queue >= AC_NUM) { | ||
4186 | IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue); | ||
4187 | return 0; | ||
4188 | } | ||
4189 | |||
4190 | q = AC_NUM - 1 - queue; | ||
4191 | |||
4192 | spin_lock_irqsave(&priv->lock, flags); | ||
4193 | |||
4194 | priv->qos_data.def_qos_parm.ac[q].cw_min = cpu_to_le16(params->cw_min); | ||
4195 | priv->qos_data.def_qos_parm.ac[q].cw_max = cpu_to_le16(params->cw_max); | ||
4196 | priv->qos_data.def_qos_parm.ac[q].aifsn = params->aifs; | ||
4197 | priv->qos_data.def_qos_parm.ac[q].edca_txop = | ||
4198 | cpu_to_le16((params->txop * 32)); | ||
4199 | |||
4200 | priv->qos_data.def_qos_parm.ac[q].reserved1 = 0; | ||
4201 | priv->qos_data.qos_active = 1; | ||
4202 | |||
4203 | spin_unlock_irqrestore(&priv->lock, flags); | ||
4204 | |||
4205 | mutex_lock(&priv->mutex); | ||
4206 | if (priv->iw_mode == NL80211_IFTYPE_AP) | ||
4207 | iwl_activate_qos(priv, 1); | ||
4208 | else if (priv->assoc_id && iwl_is_associated(priv)) | ||
4209 | iwl_activate_qos(priv, 0); | ||
4210 | |||
4211 | mutex_unlock(&priv->mutex); | ||
4212 | |||
4213 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
4214 | return 0; | ||
4215 | } | ||
4216 | |||
4217 | static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw, | ||
4218 | struct ieee80211_tx_queue_stats *stats) | ||
4219 | { | ||
4220 | struct iwl_priv *priv = hw->priv; | ||
4221 | int i, avail; | ||
4222 | struct iwl_tx_queue *txq; | ||
4223 | struct iwl_queue *q; | ||
4224 | unsigned long flags; | ||
4225 | |||
4226 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
4227 | |||
4228 | if (!iwl_is_ready_rf(priv)) { | ||
4229 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
4230 | return -EIO; | ||
4231 | } | ||
4232 | |||
4233 | spin_lock_irqsave(&priv->lock, flags); | ||
4234 | |||
4235 | for (i = 0; i < AC_NUM; i++) { | ||
4236 | txq = &priv->txq[i]; | ||
4237 | q = &txq->q; | ||
4238 | avail = iwl_queue_space(q); | ||
4239 | |||
4240 | stats[i].len = q->n_window - avail; | ||
4241 | stats[i].limit = q->n_window - q->high_mark; | ||
4242 | stats[i].count = q->n_window; | ||
4243 | |||
4244 | } | ||
4245 | spin_unlock_irqrestore(&priv->lock, flags); | ||
4246 | |||
4247 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
4248 | |||
4249 | return 0; | ||
4250 | } | ||
4251 | |||
4252 | static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw) | ||
4253 | { | ||
4254 | struct iwl_priv *priv = hw->priv; | ||
4255 | unsigned long flags; | ||
4256 | |||
4257 | mutex_lock(&priv->mutex); | ||
4258 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
4259 | |||
4260 | iwl_reset_qos(priv); | ||
4261 | |||
4262 | spin_lock_irqsave(&priv->lock, flags); | ||
4263 | priv->assoc_id = 0; | ||
4264 | priv->assoc_capability = 0; | ||
4265 | |||
4266 | /* new association get rid of ibss beacon skb */ | ||
4267 | if (priv->ibss_beacon) | ||
4268 | dev_kfree_skb(priv->ibss_beacon); | ||
4269 | |||
4270 | priv->ibss_beacon = NULL; | ||
4271 | |||
4272 | priv->beacon_int = priv->hw->conf.beacon_int; | ||
4273 | priv->timestamp = 0; | ||
4274 | if ((priv->iw_mode == NL80211_IFTYPE_STATION)) | ||
4275 | priv->beacon_int = 0; | ||
4276 | |||
4277 | spin_unlock_irqrestore(&priv->lock, flags); | ||
4278 | |||
4279 | if (!iwl_is_ready_rf(priv)) { | ||
4280 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | ||
4281 | mutex_unlock(&priv->mutex); | ||
4282 | return; | ||
4283 | } | ||
4284 | |||
4285 | /* we are restarting association process | ||
4286 | * clear RXON_FILTER_ASSOC_MSK bit | ||
4287 | */ | ||
4288 | if (priv->iw_mode != NL80211_IFTYPE_AP) { | ||
4289 | iwl_scan_cancel_timeout(priv, 100); | ||
4290 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
4291 | iwl3945_commit_rxon(priv); | ||
4292 | } | ||
4293 | |||
4294 | /* Per mac80211.h: This is only used in IBSS mode... */ | ||
4295 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | ||
4296 | |||
4297 | IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n"); | ||
4298 | mutex_unlock(&priv->mutex); | ||
4299 | return; | ||
4300 | } | ||
4301 | |||
4302 | iwl_set_rate(priv); | ||
4303 | |||
4304 | mutex_unlock(&priv->mutex); | ||
4305 | |||
4306 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
4307 | |||
4308 | } | ||
4309 | |||
4310 | static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
4311 | { | ||
4312 | struct iwl_priv *priv = hw->priv; | ||
4313 | unsigned long flags; | ||
4314 | __le64 timestamp; | ||
4315 | |||
4316 | IWL_DEBUG_MAC80211(priv, "enter\n"); | ||
4317 | |||
4318 | if (!iwl_is_ready_rf(priv)) { | ||
4319 | IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n"); | ||
4320 | return -EIO; | ||
4321 | } | ||
4322 | |||
4323 | if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { | ||
4324 | IWL_DEBUG_MAC80211(priv, "leave - not IBSS\n"); | ||
4325 | return -EIO; | ||
4326 | } | ||
4327 | |||
4328 | spin_lock_irqsave(&priv->lock, flags); | ||
4329 | |||
4330 | if (priv->ibss_beacon) | ||
4331 | dev_kfree_skb(priv->ibss_beacon); | ||
4332 | |||
4333 | priv->ibss_beacon = skb; | ||
4334 | |||
4335 | priv->assoc_id = 0; | ||
4336 | timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp; | ||
4337 | priv->timestamp = le64_to_cpu(timestamp); | ||
4338 | |||
4339 | IWL_DEBUG_MAC80211(priv, "leave\n"); | ||
4340 | spin_unlock_irqrestore(&priv->lock, flags); | ||
4341 | |||
4342 | iwl_reset_qos(priv); | ||
4343 | |||
4344 | iwl3945_post_associate(priv); | ||
4345 | |||
4346 | |||
4347 | return 0; | ||
4348 | } | ||
4349 | |||
4350 | /***************************************************************************** | 3582 | /***************************************************************************** |
4351 | * | 3583 | * |
4352 | * sysfs attributes | 3584 | * sysfs attributes |
@@ -4454,7 +3686,7 @@ static ssize_t store_flags(struct device *d, | |||
4454 | IWL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", | 3686 | IWL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n", |
4455 | flags); | 3687 | flags); |
4456 | priv->staging_rxon.flags = cpu_to_le32(flags); | 3688 | priv->staging_rxon.flags = cpu_to_le32(flags); |
4457 | iwl3945_commit_rxon(priv); | 3689 | iwlcore_commit_rxon(priv); |
4458 | } | 3690 | } |
4459 | } | 3691 | } |
4460 | mutex_unlock(&priv->mutex); | 3692 | mutex_unlock(&priv->mutex); |
@@ -4490,7 +3722,7 @@ static ssize_t store_filter_flags(struct device *d, | |||
4490 | "0x%04X\n", filter_flags); | 3722 | "0x%04X\n", filter_flags); |
4491 | priv->staging_rxon.filter_flags = | 3723 | priv->staging_rxon.filter_flags = |
4492 | cpu_to_le32(filter_flags); | 3724 | cpu_to_le32(filter_flags); |
4493 | iwl3945_commit_rxon(priv); | 3725 | iwlcore_commit_rxon(priv); |
4494 | } | 3726 | } |
4495 | } | 3727 | } |
4496 | mutex_unlock(&priv->mutex); | 3728 | mutex_unlock(&priv->mutex); |
@@ -4870,16 +4102,16 @@ static struct ieee80211_ops iwl3945_hw_ops = { | |||
4870 | .tx = iwl3945_mac_tx, | 4102 | .tx = iwl3945_mac_tx, |
4871 | .start = iwl3945_mac_start, | 4103 | .start = iwl3945_mac_start, |
4872 | .stop = iwl3945_mac_stop, | 4104 | .stop = iwl3945_mac_stop, |
4873 | .add_interface = iwl3945_mac_add_interface, | 4105 | .add_interface = iwl_mac_add_interface, |
4874 | .remove_interface = iwl3945_mac_remove_interface, | 4106 | .remove_interface = iwl_mac_remove_interface, |
4875 | .config = iwl3945_mac_config, | 4107 | .config = iwl_mac_config, |
4876 | .config_interface = iwl3945_mac_config_interface, | 4108 | .config_interface = iwl_mac_config_interface, |
4877 | .configure_filter = iwl_configure_filter, | 4109 | .configure_filter = iwl_configure_filter, |
4878 | .set_key = iwl3945_mac_set_key, | 4110 | .set_key = iwl3945_mac_set_key, |
4879 | .get_tx_stats = iwl3945_mac_get_tx_stats, | 4111 | .get_tx_stats = iwl_mac_get_tx_stats, |
4880 | .conf_tx = iwl3945_mac_conf_tx, | 4112 | .conf_tx = iwl_mac_conf_tx, |
4881 | .reset_tsf = iwl3945_mac_reset_tsf, | 4113 | .reset_tsf = iwl_mac_reset_tsf, |
4882 | .bss_info_changed = iwl3945_bss_info_changed, | 4114 | .bss_info_changed = iwl_bss_info_changed, |
4883 | .hw_scan = iwl_mac_hw_scan | 4115 | .hw_scan = iwl_mac_hw_scan |
4884 | }; | 4116 | }; |
4885 | 4117 | ||
@@ -4901,7 +4133,7 @@ static int iwl3945_init_drv(struct iwl_priv *priv) | |||
4901 | mutex_init(&priv->mutex); | 4133 | mutex_init(&priv->mutex); |
4902 | 4134 | ||
4903 | /* Clear the driver's (not device's) station table */ | 4135 | /* Clear the driver's (not device's) station table */ |
4904 | iwl3945_clear_stations_table(priv); | 4136 | priv->cfg->ops->smgmt->clear_station_table(priv); |
4905 | 4137 | ||
4906 | priv->data_retry_limit = -1; | 4138 | priv->data_retry_limit = -1; |
4907 | priv->ieee_channels = NULL; | 4139 | priv->ieee_channels = NULL; |
@@ -4972,7 +4204,9 @@ static int iwl3945_setup_mac(struct iwl_priv *priv) | |||
4972 | 4204 | ||
4973 | hw->wiphy->custom_regulatory = true; | 4205 | hw->wiphy->custom_regulatory = true; |
4974 | 4206 | ||
4975 | hw->wiphy->max_scan_ssids = 1; /* WILL FIX */ | 4207 | hw->wiphy->max_scan_ssids = PROBE_OPTION_MAX_3945; |
4208 | /* we create the 802.11 header and a zero-length SSID element */ | ||
4209 | hw->wiphy->max_scan_ie_len = IWL_MAX_PROBE_REQUEST - 24 - 2; | ||
4976 | 4210 | ||
4977 | /* Default value; 4 EDCA QOS priorities */ | 4211 | /* Default value; 4 EDCA QOS priorities */ |
4978 | hw->queues = 4; | 4212 | hw->queues = 4; |
@@ -5134,20 +4368,8 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5134 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", | 4368 | IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n", |
5135 | priv->cfg->name); | 4369 | priv->cfg->name); |
5136 | 4370 | ||
5137 | /*********************************** | ||
5138 | * 7. Initialize Module Parameters | ||
5139 | * **********************************/ | ||
5140 | |||
5141 | /* Initialize module parameter values here */ | ||
5142 | /* Disable radio (SW RF KILL) via parameter when loading driver */ | ||
5143 | if (iwl3945_mod_params.disable) { | ||
5144 | set_bit(STATUS_RF_KILL_SW, &priv->status); | ||
5145 | IWL_DEBUG_INFO(priv, "Radio disabled.\n"); | ||
5146 | } | ||
5147 | |||
5148 | |||
5149 | /*********************** | 4371 | /*********************** |
5150 | * 8. Setup Services | 4372 | * 7. Setup Services |
5151 | * ********************/ | 4373 | * ********************/ |
5152 | 4374 | ||
5153 | spin_lock_irqsave(&priv->lock, flags); | 4375 | spin_lock_irqsave(&priv->lock, flags); |
@@ -5175,7 +4397,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5175 | iwl3945_setup_rx_handlers(priv); | 4397 | iwl3945_setup_rx_handlers(priv); |
5176 | 4398 | ||
5177 | /********************************* | 4399 | /********************************* |
5178 | * 9. Setup and Register mac80211 | 4400 | * 8. Setup and Register mac80211 |
5179 | * *******************************/ | 4401 | * *******************************/ |
5180 | 4402 | ||
5181 | iwl_enable_interrupts(priv); | 4403 | iwl_enable_interrupts(priv); |
@@ -5184,6 +4406,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e | |||
5184 | if (err) | 4406 | if (err) |
5185 | goto out_remove_sysfs; | 4407 | goto out_remove_sysfs; |
5186 | 4408 | ||
4409 | err = iwl_dbgfs_register(priv, DRV_NAME); | ||
4410 | if (err) | ||
4411 | IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err); | ||
4412 | |||
5187 | err = iwl_rfkill_init(priv); | 4413 | err = iwl_rfkill_init(priv); |
5188 | if (err) | 4414 | if (err) |
5189 | IWL_ERR(priv, "Unable to initialize RFKILL system. " | 4415 | IWL_ERR(priv, "Unable to initialize RFKILL system. " |
@@ -5234,6 +4460,8 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
5234 | 4460 | ||
5235 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 4461 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); |
5236 | 4462 | ||
4463 | iwl_dbgfs_unregister(priv); | ||
4464 | |||
5237 | set_bit(STATUS_EXIT_PENDING, &priv->status); | 4465 | set_bit(STATUS_EXIT_PENDING, &priv->status); |
5238 | 4466 | ||
5239 | if (priv->mac80211_registered) { | 4467 | if (priv->mac80211_registered) { |
@@ -5264,7 +4492,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
5264 | iwl3945_hw_txq_ctx_free(priv); | 4492 | iwl3945_hw_txq_ctx_free(priv); |
5265 | 4493 | ||
5266 | iwl3945_unset_hw_params(priv); | 4494 | iwl3945_unset_hw_params(priv); |
5267 | iwl3945_clear_stations_table(priv); | 4495 | priv->cfg->ops->smgmt->clear_station_table(priv); |
5268 | 4496 | ||
5269 | /*netif_stop_queue(dev); */ | 4497 | /*netif_stop_queue(dev); */ |
5270 | flush_workqueue(priv->workqueue); | 4498 | flush_workqueue(priv->workqueue); |
@@ -5292,43 +4520,6 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
5292 | ieee80211_free_hw(priv->hw); | 4520 | ieee80211_free_hw(priv->hw); |
5293 | } | 4521 | } |
5294 | 4522 | ||
5295 | #ifdef CONFIG_PM | ||
5296 | |||
5297 | static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state) | ||
5298 | { | ||
5299 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
5300 | |||
5301 | if (priv->is_open) { | ||
5302 | set_bit(STATUS_IN_SUSPEND, &priv->status); | ||
5303 | iwl3945_mac_stop(priv->hw); | ||
5304 | priv->is_open = 1; | ||
5305 | } | ||
5306 | pci_save_state(pdev); | ||
5307 | pci_disable_device(pdev); | ||
5308 | pci_set_power_state(pdev, PCI_D3hot); | ||
5309 | |||
5310 | return 0; | ||
5311 | } | ||
5312 | |||
5313 | static int iwl3945_pci_resume(struct pci_dev *pdev) | ||
5314 | { | ||
5315 | struct iwl_priv *priv = pci_get_drvdata(pdev); | ||
5316 | int ret; | ||
5317 | |||
5318 | pci_set_power_state(pdev, PCI_D0); | ||
5319 | ret = pci_enable_device(pdev); | ||
5320 | if (ret) | ||
5321 | return ret; | ||
5322 | pci_restore_state(pdev); | ||
5323 | |||
5324 | if (priv->is_open) | ||
5325 | iwl3945_mac_start(priv->hw); | ||
5326 | |||
5327 | clear_bit(STATUS_IN_SUSPEND, &priv->status); | ||
5328 | return 0; | ||
5329 | } | ||
5330 | |||
5331 | #endif /* CONFIG_PM */ | ||
5332 | 4523 | ||
5333 | /***************************************************************************** | 4524 | /***************************************************************************** |
5334 | * | 4525 | * |
@@ -5342,8 +4533,8 @@ static struct pci_driver iwl3945_driver = { | |||
5342 | .probe = iwl3945_pci_probe, | 4533 | .probe = iwl3945_pci_probe, |
5343 | .remove = __devexit_p(iwl3945_pci_remove), | 4534 | .remove = __devexit_p(iwl3945_pci_remove), |
5344 | #ifdef CONFIG_PM | 4535 | #ifdef CONFIG_PM |
5345 | .suspend = iwl3945_pci_suspend, | 4536 | .suspend = iwl_pci_suspend, |
5346 | .resume = iwl3945_pci_resume, | 4537 | .resume = iwl_pci_resume, |
5347 | #endif | 4538 | #endif |
5348 | }; | 4539 | }; |
5349 | 4540 | ||
@@ -5384,8 +4575,6 @@ MODULE_FIRMWARE(IWL3945_MODULE_FIRMWARE(IWL3945_UCODE_API_MAX)); | |||
5384 | 4575 | ||
5385 | module_param_named(antenna, iwl3945_mod_params.antenna, int, 0444); | 4576 | module_param_named(antenna, iwl3945_mod_params.antenna, int, 0444); |
5386 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); | 4577 | MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])"); |
5387 | module_param_named(disable, iwl3945_mod_params.disable, int, 0444); | ||
5388 | MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])"); | ||
5389 | module_param_named(swcrypto, iwl3945_mod_params.sw_crypto, int, 0444); | 4578 | module_param_named(swcrypto, iwl3945_mod_params.sw_crypto, int, 0444); |
5390 | MODULE_PARM_DESC(swcrypto, | 4579 | MODULE_PARM_DESC(swcrypto, |
5391 | "using software crypto (default 1 [software])\n"); | 4580 | "using software crypto (default 1 [software])\n"); |