aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-04-23 14:43:45 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-23 14:43:45 -0400
commit3b51cc996e81d8a113416d8094fa4a88f8360a51 (patch)
treee75b98b228bb4e456c30673fcc4b56ffa1d09cf5 /drivers/net/wireless/iwlwifi
parentc68ed255265968c3948fa2678bf59d15c471b055 (diff)
parent672724403b42da1d276c6cf811e8e34d15efd964 (diff)
Merge branch 'master' into for-davem
Conflicts: drivers/net/wireless/ath/ath9k/phy.c drivers/net/wireless/iwlwifi/iwl-6000.c drivers/net/wireless/iwlwifi/iwl-debugfs.c
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/Makefile1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-1000.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c34
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c834
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h56
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c403
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c47
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c42
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-ucode.c36
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c50
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c46
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-csr.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c770
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.h36
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-prph.h80
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c506
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c87
28 files changed, 1606 insertions, 1509 deletions
diff --git a/drivers/net/wireless/iwlwifi/Makefile b/drivers/net/wireless/iwlwifi/Makefile
index a684a72eb6e9..5ed2dcbe6d01 100644
--- a/drivers/net/wireless/iwlwifi/Makefile
+++ b/drivers/net/wireless/iwlwifi/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_IWLAGN) += iwlagn.o
12iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o iwl-agn-ict.o 12iwlagn-objs := iwl-agn.o iwl-agn-rs.o iwl-agn-led.o iwl-agn-ict.o
13iwlagn-objs += iwl-agn-ucode.o iwl-agn-hcmd.o iwl-agn-tx.o 13iwlagn-objs += iwl-agn-ucode.o iwl-agn-hcmd.o iwl-agn-tx.o
14iwlagn-objs += iwl-agn-lib.o 14iwlagn-objs += iwl-agn-lib.o
15iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-agn-debugfs.o
15 16
16iwlagn-$(CONFIG_IWL4965) += iwl-4965.o 17iwlagn-$(CONFIG_IWL4965) += iwl-4965.o
17iwlagn-$(CONFIG_IWL5000) += iwl-5000.o 18iwlagn-$(CONFIG_IWL5000) += iwl-5000.o
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
index 9a0191a5ea35..8431ffce37d3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-1000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
@@ -46,6 +46,7 @@
46#include "iwl-helpers.h" 46#include "iwl-helpers.h"
47#include "iwl-agn-hw.h" 47#include "iwl-agn-hw.h"
48#include "iwl-agn-led.h" 48#include "iwl-agn-led.h"
49#include "iwl-agn-debugfs.h"
49 50
50/* Highest firmware API version supported */ 51/* Highest firmware API version supported */
51#define IWL1000_UCODE_API_MAX 3 52#define IWL1000_UCODE_API_MAX 3
@@ -212,6 +213,11 @@ static struct iwl_lib_ops iwl1000_lib = {
212 .set_ct_kill = iwl1000_set_ct_threshold, 213 .set_ct_kill = iwl1000_set_ct_threshold,
213 }, 214 },
214 .add_bcast_station = iwl_add_bcast_station, 215 .add_bcast_station = iwl_add_bcast_station,
216 .debugfs_ops = {
217 .rx_stats_read = iwl_ucode_rx_stats_read,
218 .tx_stats_read = iwl_ucode_tx_stats_read,
219 .general_stats_read = iwl_ucode_general_stats_read,
220 },
215 .recover_from_tx_stall = iwl_bg_monitor_recover, 221 .recover_from_tx_stall = iwl_bg_monitor_recover,
216 .check_plcp_health = iwl_good_plcp_health, 222 .check_plcp_health = iwl_good_plcp_health,
217 .check_ack_health = iwl_good_ack_health, 223 .check_ack_health = iwl_good_ack_health,
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index bde3b4cbab9d..59af2594c9c5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2688,6 +2688,7 @@ IWL3945_UCODE_GET(boot_size);
2688static struct iwl_hcmd_ops iwl3945_hcmd = { 2688static struct iwl_hcmd_ops iwl3945_hcmd = {
2689 .rxon_assoc = iwl3945_send_rxon_assoc, 2689 .rxon_assoc = iwl3945_send_rxon_assoc,
2690 .commit_rxon = iwl3945_commit_rxon, 2690 .commit_rxon = iwl3945_commit_rxon,
2691 .send_bt_config = iwl_send_bt_config,
2691}; 2692};
2692 2693
2693static struct iwl_ucode_ops iwl3945_ucode = { 2694static struct iwl_ucode_ops iwl3945_ucode = {
@@ -2741,6 +2742,7 @@ static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
2741 .get_hcmd_size = iwl3945_get_hcmd_size, 2742 .get_hcmd_size = iwl3945_get_hcmd_size,
2742 .build_addsta_hcmd = iwl3945_build_addsta_hcmd, 2743 .build_addsta_hcmd = iwl3945_build_addsta_hcmd,
2743 .rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag, 2744 .rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag,
2745 .request_scan = iwl3945_request_scan,
2744}; 2746};
2745 2747
2746static const struct iwl_ops iwl3945_ops = { 2748static const struct iwl_ops iwl3945_ops = {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index b89219573b91..e9674f0a1e94 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -294,6 +294,9 @@ extern const struct iwl_channel_info *iwl3945_get_channel_info(
294 294
295extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate); 295extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate);
296 296
297/* scanning */
298void iwl3945_request_scan(struct iwl_priv *priv);
299
297/* Requires full declaration of iwl_priv before including */ 300/* Requires full declaration of iwl_priv before including */
298#include "iwl-io.h" 301#include "iwl-io.h"
299 302
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 2e3cda75f3ad..136c29067489 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -47,6 +47,7 @@
47#include "iwl-sta.h" 47#include "iwl-sta.h"
48#include "iwl-agn-led.h" 48#include "iwl-agn-led.h"
49#include "iwl-agn.h" 49#include "iwl-agn.h"
50#include "iwl-agn-debugfs.h"
50 51
51static int iwl4965_send_tx_power(struct iwl_priv *priv); 52static int iwl4965_send_tx_power(struct iwl_priv *priv);
52static int iwl4965_hw_get_temperature(struct iwl_priv *priv); 53static int iwl4965_hw_get_temperature(struct iwl_priv *priv);
@@ -2143,6 +2144,7 @@ static struct iwl_hcmd_ops iwl4965_hcmd = {
2143 .rxon_assoc = iwl4965_send_rxon_assoc, 2144 .rxon_assoc = iwl4965_send_rxon_assoc,
2144 .commit_rxon = iwl_commit_rxon, 2145 .commit_rxon = iwl_commit_rxon,
2145 .set_rxon_chain = iwl_set_rxon_chain, 2146 .set_rxon_chain = iwl_set_rxon_chain,
2147 .send_bt_config = iwl_send_bt_config,
2146}; 2148};
2147 2149
2148static struct iwl_ucode_ops iwl4965_ucode = { 2150static struct iwl_ucode_ops iwl4965_ucode = {
@@ -2162,6 +2164,7 @@ static struct iwl_hcmd_utils_ops iwl4965_hcmd_utils = {
2162 .gain_computation = iwl4965_gain_computation, 2164 .gain_computation = iwl4965_gain_computation,
2163 .rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag, 2165 .rts_tx_cmd_flag = iwlcore_rts_tx_cmd_flag,
2164 .calc_rssi = iwl4965_calc_rssi, 2166 .calc_rssi = iwl4965_calc_rssi,
2167 .request_scan = iwlagn_request_scan,
2165}; 2168};
2166 2169
2167static struct iwl_lib_ops iwl4965_lib = { 2170static struct iwl_lib_ops iwl4965_lib = {
@@ -2216,6 +2219,11 @@ static struct iwl_lib_ops iwl4965_lib = {
2216 .set_ct_kill = iwl4965_set_ct_threshold, 2219 .set_ct_kill = iwl4965_set_ct_threshold,
2217 }, 2220 },
2218 .add_bcast_station = iwl_add_bcast_station, 2221 .add_bcast_station = iwl_add_bcast_station,
2222 .debugfs_ops = {
2223 .rx_stats_read = iwl_ucode_rx_stats_read,
2224 .tx_stats_read = iwl_ucode_tx_stats_read,
2225 .general_stats_read = iwl_ucode_general_stats_read,
2226 },
2219 .check_plcp_health = iwl_good_plcp_health, 2227 .check_plcp_health = iwl_good_plcp_health,
2220}; 2228};
2221 2229
@@ -2253,8 +2261,13 @@ struct iwl_cfg iwl4965_agn_cfg = {
2253 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, 2261 .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
2254 .monitor_recover_period = IWL_MONITORING_PERIOD, 2262 .monitor_recover_period = IWL_MONITORING_PERIOD,
2255 .temperature_kelvin = true, 2263 .temperature_kelvin = true,
2256 .off_channel_workaround = true,
2257 .max_event_log_size = 512, 2264 .max_event_log_size = 512,
2265
2266 /*
2267 * Force use of chains B and C for scan RX on 5 GHz band
2268 * because the device has off-channel reception on chain A.
2269 */
2270 .scan_antennas[IEEE80211_BAND_5GHZ] = ANT_BC,
2258}; 2271};
2259 2272
2260/* Module firmware */ 2273/* Module firmware */
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index e967cfcac224..e43493685271 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -48,6 +48,7 @@
48#include "iwl-agn-led.h" 48#include "iwl-agn-led.h"
49#include "iwl-agn-hw.h" 49#include "iwl-agn-hw.h"
50#include "iwl-5000-hw.h" 50#include "iwl-5000-hw.h"
51#include "iwl-agn-debugfs.h"
51 52
52/* Highest firmware API version supported */ 53/* Highest firmware API version supported */
53#define IWL5000_UCODE_API_MAX 2 54#define IWL5000_UCODE_API_MAX 2
@@ -320,6 +321,11 @@ static struct iwl_lib_ops iwl5000_lib = {
320 .set_ct_kill = iwl5000_set_ct_threshold, 321 .set_ct_kill = iwl5000_set_ct_threshold,
321 }, 322 },
322 .add_bcast_station = iwl_add_bcast_station, 323 .add_bcast_station = iwl_add_bcast_station,
324 .debugfs_ops = {
325 .rx_stats_read = iwl_ucode_rx_stats_read,
326 .tx_stats_read = iwl_ucode_tx_stats_read,
327 .general_stats_read = iwl_ucode_general_stats_read,
328 },
323 .recover_from_tx_stall = iwl_bg_monitor_recover, 329 .recover_from_tx_stall = iwl_bg_monitor_recover,
324 .check_plcp_health = iwl_good_plcp_health, 330 .check_plcp_health = iwl_good_plcp_health,
325 .check_ack_health = iwl_good_ack_health, 331 .check_ack_health = iwl_good_ack_health,
@@ -377,6 +383,11 @@ static struct iwl_lib_ops iwl5150_lib = {
377 .set_ct_kill = iwl5150_set_ct_threshold, 383 .set_ct_kill = iwl5150_set_ct_threshold,
378 }, 384 },
379 .add_bcast_station = iwl_add_bcast_station, 385 .add_bcast_station = iwl_add_bcast_station,
386 .debugfs_ops = {
387 .rx_stats_read = iwl_ucode_rx_stats_read,
388 .tx_stats_read = iwl_ucode_tx_stats_read,
389 .general_stats_read = iwl_ucode_general_stats_read,
390 },
380 .recover_from_tx_stall = iwl_bg_monitor_recover, 391 .recover_from_tx_stall = iwl_bg_monitor_recover,
381 .check_plcp_health = iwl_good_plcp_health, 392 .check_plcp_health = iwl_good_plcp_health,
382 .check_ack_health = iwl_good_ack_health, 393 .check_ack_health = iwl_good_ack_health,
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index 3e32693d1c2f..7da23d3ff7b6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -47,17 +47,19 @@
47#include "iwl-agn-hw.h" 47#include "iwl-agn-hw.h"
48#include "iwl-6000-hw.h" 48#include "iwl-6000-hw.h"
49#include "iwl-agn-led.h" 49#include "iwl-agn-led.h"
50#include "iwl-agn-debugfs.h"
50 51
51/* Highest firmware API version supported */ 52/* Highest firmware API version supported */
52#define IWL6000_UCODE_API_MAX 4 53#define IWL6000_UCODE_API_MAX 4
53#define IWL6050_UCODE_API_MAX 4 54#define IWL6050_UCODE_API_MAX 4
55#define IWL6000G2_UCODE_API_MAX 4
54 56
55/* Lowest firmware API version supported */ 57/* Lowest firmware API version supported */
56#define IWL6000_UCODE_API_MIN 4 58#define IWL6000_UCODE_API_MIN 4
57#define IWL6050_UCODE_API_MIN 4 59#define IWL6050_UCODE_API_MIN 4
60#define IWL6000G2_UCODE_API_MIN 4
58 61
59#define IWL6000_FW_PRE "iwlwifi-6000-" 62#define IWL6000_FW_PRE "iwlwifi-6000-"
60#define IWL6000_G2_FW_PRE "iwlwifi-6005-"
61#define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode" 63#define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode"
62#define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api) 64#define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api)
63 65
@@ -65,6 +67,10 @@
65#define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode" 67#define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode"
66#define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api) 68#define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api)
67 69
70#define IWL6000G2_FW_PRE "iwlwifi-6005-"
71#define _IWL6000G2_MODULE_FIRMWARE(api) IWL6000G2_FW_PRE #api ".ucode"
72#define IWL6000G2_MODULE_FIRMWARE(api) _IWL6000G2_MODULE_FIRMWARE(api)
73
68static void iwl6000_set_ct_threshold(struct iwl_priv *priv) 74static void iwl6000_set_ct_threshold(struct iwl_priv *priv)
69{ 75{
70 /* want Celsius */ 76 /* want Celsius */
@@ -261,7 +267,6 @@ static struct iwl_lib_ops iwl6000_lib = {
261 EEPROM_REG_BAND_3_CHANNELS, 267 EEPROM_REG_BAND_3_CHANNELS,
262 EEPROM_REG_BAND_4_CHANNELS, 268 EEPROM_REG_BAND_4_CHANNELS,
263 EEPROM_REG_BAND_5_CHANNELS, 269 EEPROM_REG_BAND_5_CHANNELS,
264 EEPROM_REG_BAND_24_HT40_CHANNELS,
265 EEPROM_6000_REG_BAND_24_HT40_CHANNELS, 270 EEPROM_6000_REG_BAND_24_HT40_CHANNELS,
266 EEPROM_REG_BAND_52_HT40_CHANNELS 271 EEPROM_REG_BAND_52_HT40_CHANNELS
267 }, 272 },
@@ -280,6 +285,11 @@ static struct iwl_lib_ops iwl6000_lib = {
280 .set_ct_kill = iwl6000_set_ct_threshold, 285 .set_ct_kill = iwl6000_set_ct_threshold,
281 }, 286 },
282 .add_bcast_station = iwl_add_bcast_station, 287 .add_bcast_station = iwl_add_bcast_station,
288 .debugfs_ops = {
289 .rx_stats_read = iwl_ucode_rx_stats_read,
290 .tx_stats_read = iwl_ucode_tx_stats_read,
291 .general_stats_read = iwl_ucode_general_stats_read,
292 },
283 .recover_from_tx_stall = iwl_bg_monitor_recover, 293 .recover_from_tx_stall = iwl_bg_monitor_recover,
284 .check_plcp_health = iwl_good_plcp_health, 294 .check_plcp_health = iwl_good_plcp_health,
285 .check_ack_health = iwl_good_ack_health, 295 .check_ack_health = iwl_good_ack_health,
@@ -348,6 +358,11 @@ static struct iwl_lib_ops iwl6050_lib = {
348 .set_calib_version = iwl6050_set_calib_version, 358 .set_calib_version = iwl6050_set_calib_version,
349 }, 359 },
350 .add_bcast_station = iwl_add_bcast_station, 360 .add_bcast_station = iwl_add_bcast_station,
361 .debugfs_ops = {
362 .rx_stats_read = iwl_ucode_rx_stats_read,
363 .tx_stats_read = iwl_ucode_tx_stats_read,
364 .general_stats_read = iwl_ucode_general_stats_read,
365 },
351 .recover_from_tx_stall = iwl_bg_monitor_recover, 366 .recover_from_tx_stall = iwl_bg_monitor_recover,
352 .check_plcp_health = iwl_good_plcp_health, 367 .check_plcp_health = iwl_good_plcp_health,
353 .check_ack_health = iwl_good_ack_health, 368 .check_ack_health = iwl_good_ack_health,
@@ -364,16 +379,16 @@ static const struct iwl_ops iwl6050_ops = {
364/* 379/*
365 * "i": Internal configuration, use internal Power Amplifier 380 * "i": Internal configuration, use internal Power Amplifier
366 */ 381 */
367struct iwl_cfg iwl6000i_g2_2agn_cfg = { 382struct iwl_cfg iwl6000g2_2agn_cfg = {
368 .name = "6000 Series 2x2 AGN Gen2", 383 .name = "6000 Series 2x2 AGN Gen2",
369 .fw_name_pre = IWL6000_G2_FW_PRE, 384 .fw_name_pre = IWL6000G2_FW_PRE,
370 .ucode_api_max = IWL6000_UCODE_API_MAX, 385 .ucode_api_max = IWL6000G2_UCODE_API_MAX,
371 .ucode_api_min = IWL6000_UCODE_API_MIN, 386 .ucode_api_min = IWL6000G2_UCODE_API_MIN,
372 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 387 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
373 .ops = &iwl6000_ops, 388 .ops = &iwl6000_ops,
374 .eeprom_size = OTP_LOW_IMAGE_SIZE, 389 .eeprom_size = OTP_LOW_IMAGE_SIZE,
375 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 390 .eeprom_ver = EEPROM_6000G2_EEPROM_VERSION,
376 .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION, 391 .eeprom_calib_ver = EEPROM_6000G2_TX_POWER_VERSION,
377 .num_of_queues = IWLAGN_NUM_QUEUES, 392 .num_of_queues = IWLAGN_NUM_QUEUES,
378 .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES, 393 .num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
379 .mod_params = &iwlagn_mod_params, 394 .mod_params = &iwlagn_mod_params,
@@ -382,7 +397,7 @@ struct iwl_cfg iwl6000i_g2_2agn_cfg = {
382 .pll_cfg_val = 0, 397 .pll_cfg_val = 0,
383 .set_l0s = true, 398 .set_l0s = true,
384 .use_bsm = false, 399 .use_bsm = false,
385 .pa_type = IWL_PA_INTERNAL, 400 .pa_type = IWL_PA_SYSTEM,
386 .max_ll_items = OTP_MAX_LL_ITEMS_6x00, 401 .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
387 .shadow_ram_support = true, 402 .shadow_ram_support = true,
388 .ht_greenfield_support = true, 403 .ht_greenfield_support = true,
@@ -601,3 +616,4 @@ struct iwl_cfg iwl6000_3agn_cfg = {
601 616
602MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX)); 617MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
603MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); 618MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
619MODULE_FIRMWARE(IWL6000G2_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
new file mode 100644
index 000000000000..f249b706bf17
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c
@@ -0,0 +1,834 @@
1/******************************************************************************
2*
3* GPL LICENSE SUMMARY
4*
5* Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
6*
7* This program is free software; you can redistribute it and/or modify
8* it under the terms of version 2 of the GNU General Public License as
9* published by the Free Software Foundation.
10*
11* This program is distributed in the hope that it will be useful, but
12* WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14* General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program; if not, write to the Free Software
18* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19* USA
20*
21* The full GNU General Public License is included in this distribution
22* in the file called LICENSE.GPL.
23*
24* Contact Information:
25* Intel Linux Wireless <ilw@linux.intel.com>
26* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27*****************************************************************************/
28
29#include "iwl-agn-debugfs.h"
30
31ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
32 size_t count, loff_t *ppos)
33 {
34 struct iwl_priv *priv = file->private_data;
35 int pos = 0;
36 char *buf;
37 int bufsz = sizeof(struct statistics_rx_phy) * 40 +
38 sizeof(struct statistics_rx_non_phy) * 40 +
39 sizeof(struct statistics_rx_ht_phy) * 40 + 400;
40 ssize_t ret;
41 struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
42 struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
43 struct statistics_rx_non_phy *general, *accum_general;
44 struct statistics_rx_non_phy *delta_general, *max_general;
45 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
46
47 if (!iwl_is_alive(priv))
48 return -EAGAIN;
49
50 buf = kzalloc(bufsz, GFP_KERNEL);
51 if (!buf) {
52 IWL_ERR(priv, "Can not allocate Buffer\n");
53 return -ENOMEM;
54 }
55
56 /*
57 * the statistic information display here is based on
58 * the last statistics notification from uCode
59 * might not reflect the current uCode activity
60 */
61 ofdm = &priv->statistics.rx.ofdm;
62 cck = &priv->statistics.rx.cck;
63 general = &priv->statistics.rx.general;
64 ht = &priv->statistics.rx.ofdm_ht;
65 accum_ofdm = &priv->accum_statistics.rx.ofdm;
66 accum_cck = &priv->accum_statistics.rx.cck;
67 accum_general = &priv->accum_statistics.rx.general;
68 accum_ht = &priv->accum_statistics.rx.ofdm_ht;
69 delta_ofdm = &priv->delta_statistics.rx.ofdm;
70 delta_cck = &priv->delta_statistics.rx.cck;
71 delta_general = &priv->delta_statistics.rx.general;
72 delta_ht = &priv->delta_statistics.rx.ofdm_ht;
73 max_ofdm = &priv->max_delta.rx.ofdm;
74 max_cck = &priv->max_delta.rx.cck;
75 max_general = &priv->max_delta.rx.general;
76 max_ht = &priv->max_delta.rx.ofdm_ht;
77
78 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
79 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
80 "acumulative delta max\n",
81 "Statistics_Rx - OFDM:");
82 pos += scnprintf(buf + pos, bufsz - pos,
83 " %-30s %10u %10u %10u %10u\n",
84 "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
85 accum_ofdm->ina_cnt,
86 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
87 pos += scnprintf(buf + pos, bufsz - pos,
88 " %-30s %10u %10u %10u %10u\n",
89 "fina_cnt:",
90 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
91 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
92 pos += scnprintf(buf + pos, bufsz - pos,
93 " %-30s %10u %10u %10u %10u\n",
94 "plcp_err:",
95 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
96 delta_ofdm->plcp_err, max_ofdm->plcp_err);
97 pos += scnprintf(buf + pos, bufsz - pos,
98 " %-30s %10u %10u %10u %10u\n", "crc32_err:",
99 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
100 delta_ofdm->crc32_err, max_ofdm->crc32_err);
101 pos += scnprintf(buf + pos, bufsz - pos,
102 " %-30s %10u %10u %10u %10u\n", "overrun_err:",
103 le32_to_cpu(ofdm->overrun_err),
104 accum_ofdm->overrun_err, delta_ofdm->overrun_err,
105 max_ofdm->overrun_err);
106 pos += scnprintf(buf + pos, bufsz - pos,
107 " %-30s %10u %10u %10u %10u\n",
108 "early_overrun_err:",
109 le32_to_cpu(ofdm->early_overrun_err),
110 accum_ofdm->early_overrun_err,
111 delta_ofdm->early_overrun_err,
112 max_ofdm->early_overrun_err);
113 pos += scnprintf(buf + pos, bufsz - pos,
114 " %-30s %10u %10u %10u %10u\n",
115 "crc32_good:", le32_to_cpu(ofdm->crc32_good),
116 accum_ofdm->crc32_good, delta_ofdm->crc32_good,
117 max_ofdm->crc32_good);
118 pos += scnprintf(buf + pos, bufsz - pos,
119 " %-30s %10u %10u %10u %10u\n", "false_alarm_cnt:",
120 le32_to_cpu(ofdm->false_alarm_cnt),
121 accum_ofdm->false_alarm_cnt,
122 delta_ofdm->false_alarm_cnt,
123 max_ofdm->false_alarm_cnt);
124 pos += scnprintf(buf + pos, bufsz - pos,
125 " %-30s %10u %10u %10u %10u\n",
126 "fina_sync_err_cnt:",
127 le32_to_cpu(ofdm->fina_sync_err_cnt),
128 accum_ofdm->fina_sync_err_cnt,
129 delta_ofdm->fina_sync_err_cnt,
130 max_ofdm->fina_sync_err_cnt);
131 pos += scnprintf(buf + pos, bufsz - pos,
132 " %-30s %10u %10u %10u %10u\n", "sfd_timeout:",
133 le32_to_cpu(ofdm->sfd_timeout),
134 accum_ofdm->sfd_timeout, delta_ofdm->sfd_timeout,
135 max_ofdm->sfd_timeout);
136 pos += scnprintf(buf + pos, bufsz - pos,
137 " %-30s %10u %10u %10u %10u\n", "fina_timeout:",
138 le32_to_cpu(ofdm->fina_timeout),
139 accum_ofdm->fina_timeout, delta_ofdm->fina_timeout,
140 max_ofdm->fina_timeout);
141 pos += scnprintf(buf + pos, bufsz - pos,
142 " %-30s %10u %10u %10u %10u\n",
143 "unresponded_rts:",
144 le32_to_cpu(ofdm->unresponded_rts),
145 accum_ofdm->unresponded_rts,
146 delta_ofdm->unresponded_rts,
147 max_ofdm->unresponded_rts);
148 pos += scnprintf(buf + pos, bufsz - pos,
149 " %-30s %10u %10u %10u %10u\n",
150 "rxe_frame_lmt_ovrun:",
151 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
152 accum_ofdm->rxe_frame_limit_overrun,
153 delta_ofdm->rxe_frame_limit_overrun,
154 max_ofdm->rxe_frame_limit_overrun);
155 pos += scnprintf(buf + pos, bufsz - pos,
156 " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:",
157 le32_to_cpu(ofdm->sent_ack_cnt),
158 accum_ofdm->sent_ack_cnt, delta_ofdm->sent_ack_cnt,
159 max_ofdm->sent_ack_cnt);
160 pos += scnprintf(buf + pos, bufsz - pos,
161 " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:",
162 le32_to_cpu(ofdm->sent_cts_cnt),
163 accum_ofdm->sent_cts_cnt, delta_ofdm->sent_cts_cnt,
164 max_ofdm->sent_cts_cnt);
165 pos += scnprintf(buf + pos, bufsz - pos,
166 " %-30s %10u %10u %10u %10u\n",
167 "sent_ba_rsp_cnt:",
168 le32_to_cpu(ofdm->sent_ba_rsp_cnt),
169 accum_ofdm->sent_ba_rsp_cnt,
170 delta_ofdm->sent_ba_rsp_cnt,
171 max_ofdm->sent_ba_rsp_cnt);
172 pos += scnprintf(buf + pos, bufsz - pos,
173 " %-30s %10u %10u %10u %10u\n", "dsp_self_kill:",
174 le32_to_cpu(ofdm->dsp_self_kill),
175 accum_ofdm->dsp_self_kill,
176 delta_ofdm->dsp_self_kill,
177 max_ofdm->dsp_self_kill);
178 pos += scnprintf(buf + pos, bufsz - pos,
179 " %-30s %10u %10u %10u %10u\n",
180 "mh_format_err:",
181 le32_to_cpu(ofdm->mh_format_err),
182 accum_ofdm->mh_format_err,
183 delta_ofdm->mh_format_err,
184 max_ofdm->mh_format_err);
185 pos += scnprintf(buf + pos, bufsz - pos,
186 " %-30s %10u %10u %10u %10u\n",
187 "re_acq_main_rssi_sum:",
188 le32_to_cpu(ofdm->re_acq_main_rssi_sum),
189 accum_ofdm->re_acq_main_rssi_sum,
190 delta_ofdm->re_acq_main_rssi_sum,
191 max_ofdm->re_acq_main_rssi_sum);
192
193 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
194 "acumulative delta max\n",
195 "Statistics_Rx - CCK:");
196 pos += scnprintf(buf + pos, bufsz - pos,
197 " %-30s %10u %10u %10u %10u\n",
198 "ina_cnt:",
199 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
200 delta_cck->ina_cnt, max_cck->ina_cnt);
201 pos += scnprintf(buf + pos, bufsz - pos,
202 " %-30s %10u %10u %10u %10u\n",
203 "fina_cnt:",
204 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
205 delta_cck->fina_cnt, max_cck->fina_cnt);
206 pos += scnprintf(buf + pos, bufsz - pos,
207 " %-30s %10u %10u %10u %10u\n",
208 "plcp_err:",
209 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
210 delta_cck->plcp_err, max_cck->plcp_err);
211 pos += scnprintf(buf + pos, bufsz - pos,
212 " %-30s %10u %10u %10u %10u\n",
213 "crc32_err:",
214 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
215 delta_cck->crc32_err, max_cck->crc32_err);
216 pos += scnprintf(buf + pos, bufsz - pos,
217 " %-30s %10u %10u %10u %10u\n",
218 "overrun_err:",
219 le32_to_cpu(cck->overrun_err),
220 accum_cck->overrun_err, delta_cck->overrun_err,
221 max_cck->overrun_err);
222 pos += scnprintf(buf + pos, bufsz - pos,
223 " %-30s %10u %10u %10u %10u\n",
224 "early_overrun_err:",
225 le32_to_cpu(cck->early_overrun_err),
226 accum_cck->early_overrun_err,
227 delta_cck->early_overrun_err,
228 max_cck->early_overrun_err);
229 pos += scnprintf(buf + pos, bufsz - pos,
230 " %-30s %10u %10u %10u %10u\n",
231 "crc32_good:",
232 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
233 delta_cck->crc32_good, max_cck->crc32_good);
234 pos += scnprintf(buf + pos, bufsz - pos,
235 " %-30s %10u %10u %10u %10u\n",
236 "false_alarm_cnt:",
237 le32_to_cpu(cck->false_alarm_cnt),
238 accum_cck->false_alarm_cnt,
239 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
240 pos += scnprintf(buf + pos, bufsz - pos,
241 " %-30s %10u %10u %10u %10u\n",
242 "fina_sync_err_cnt:",
243 le32_to_cpu(cck->fina_sync_err_cnt),
244 accum_cck->fina_sync_err_cnt,
245 delta_cck->fina_sync_err_cnt,
246 max_cck->fina_sync_err_cnt);
247 pos += scnprintf(buf + pos, bufsz - pos,
248 " %-30s %10u %10u %10u %10u\n",
249 "sfd_timeout:",
250 le32_to_cpu(cck->sfd_timeout),
251 accum_cck->sfd_timeout, delta_cck->sfd_timeout,
252 max_cck->sfd_timeout);
253 pos += scnprintf(buf + pos, bufsz - pos,
254 " %-30s %10u %10u %10u %10u\n", "fina_timeout:",
255 le32_to_cpu(cck->fina_timeout),
256 accum_cck->fina_timeout, delta_cck->fina_timeout,
257 max_cck->fina_timeout);
258 pos += scnprintf(buf + pos, bufsz - pos,
259 " %-30s %10u %10u %10u %10u\n",
260 "unresponded_rts:",
261 le32_to_cpu(cck->unresponded_rts),
262 accum_cck->unresponded_rts, delta_cck->unresponded_rts,
263 max_cck->unresponded_rts);
264 pos += scnprintf(buf + pos, bufsz - pos,
265 " %-30s %10u %10u %10u %10u\n",
266 "rxe_frame_lmt_ovrun:",
267 le32_to_cpu(cck->rxe_frame_limit_overrun),
268 accum_cck->rxe_frame_limit_overrun,
269 delta_cck->rxe_frame_limit_overrun,
270 max_cck->rxe_frame_limit_overrun);
271 pos += scnprintf(buf + pos, bufsz - pos,
272 " %-30s %10u %10u %10u %10u\n", "sent_ack_cnt:",
273 le32_to_cpu(cck->sent_ack_cnt),
274 accum_cck->sent_ack_cnt, delta_cck->sent_ack_cnt,
275 max_cck->sent_ack_cnt);
276 pos += scnprintf(buf + pos, bufsz - pos,
277 " %-30s %10u %10u %10u %10u\n", "sent_cts_cnt:",
278 le32_to_cpu(cck->sent_cts_cnt),
279 accum_cck->sent_cts_cnt, delta_cck->sent_cts_cnt,
280 max_cck->sent_cts_cnt);
281 pos += scnprintf(buf + pos, bufsz - pos,
282 " %-30s %10u %10u %10u %10u\n", "sent_ba_rsp_cnt:",
283 le32_to_cpu(cck->sent_ba_rsp_cnt),
284 accum_cck->sent_ba_rsp_cnt,
285 delta_cck->sent_ba_rsp_cnt,
286 max_cck->sent_ba_rsp_cnt);
287 pos += scnprintf(buf + pos, bufsz - pos,
288 " %-30s %10u %10u %10u %10u\n", "dsp_self_kill:",
289 le32_to_cpu(cck->dsp_self_kill),
290 accum_cck->dsp_self_kill, delta_cck->dsp_self_kill,
291 max_cck->dsp_self_kill);
292 pos += scnprintf(buf + pos, bufsz - pos,
293 " %-30s %10u %10u %10u %10u\n", "mh_format_err:",
294 le32_to_cpu(cck->mh_format_err),
295 accum_cck->mh_format_err, delta_cck->mh_format_err,
296 max_cck->mh_format_err);
297 pos += scnprintf(buf + pos, bufsz - pos,
298 " %-30s %10u %10u %10u %10u\n",
299 "re_acq_main_rssi_sum:",
300 le32_to_cpu(cck->re_acq_main_rssi_sum),
301 accum_cck->re_acq_main_rssi_sum,
302 delta_cck->re_acq_main_rssi_sum,
303 max_cck->re_acq_main_rssi_sum);
304
305 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
306 "acumulative delta max\n",
307 "Statistics_Rx - GENERAL:");
308 pos += scnprintf(buf + pos, bufsz - pos,
309 " %-30s %10u %10u %10u %10u\n", "bogus_cts:",
310 le32_to_cpu(general->bogus_cts),
311 accum_general->bogus_cts, delta_general->bogus_cts,
312 max_general->bogus_cts);
313 pos += scnprintf(buf + pos, bufsz - pos,
314 " %-30s %10u %10u %10u %10u\n", "bogus_ack:",
315 le32_to_cpu(general->bogus_ack),
316 accum_general->bogus_ack, delta_general->bogus_ack,
317 max_general->bogus_ack);
318 pos += scnprintf(buf + pos, bufsz - pos,
319 " %-30s %10u %10u %10u %10u\n",
320 "non_bssid_frames:",
321 le32_to_cpu(general->non_bssid_frames),
322 accum_general->non_bssid_frames,
323 delta_general->non_bssid_frames,
324 max_general->non_bssid_frames);
325 pos += scnprintf(buf + pos, bufsz - pos,
326 " %-30s %10u %10u %10u %10u\n",
327 "filtered_frames:",
328 le32_to_cpu(general->filtered_frames),
329 accum_general->filtered_frames,
330 delta_general->filtered_frames,
331 max_general->filtered_frames);
332 pos += scnprintf(buf + pos, bufsz - pos,
333 " %-30s %10u %10u %10u %10u\n",
334 "non_channel_beacons:",
335 le32_to_cpu(general->non_channel_beacons),
336 accum_general->non_channel_beacons,
337 delta_general->non_channel_beacons,
338 max_general->non_channel_beacons);
339 pos += scnprintf(buf + pos, bufsz - pos,
340 " %-30s %10u %10u %10u %10u\n",
341 "channel_beacons:",
342 le32_to_cpu(general->channel_beacons),
343 accum_general->channel_beacons,
344 delta_general->channel_beacons,
345 max_general->channel_beacons);
346 pos += scnprintf(buf + pos, bufsz - pos,
347 " %-30s %10u %10u %10u %10u\n",
348 "num_missed_bcon:",
349 le32_to_cpu(general->num_missed_bcon),
350 accum_general->num_missed_bcon,
351 delta_general->num_missed_bcon,
352 max_general->num_missed_bcon);
353 pos += scnprintf(buf + pos, bufsz - pos,
354 " %-30s %10u %10u %10u %10u\n",
355 "adc_rx_saturation_time:",
356 le32_to_cpu(general->adc_rx_saturation_time),
357 accum_general->adc_rx_saturation_time,
358 delta_general->adc_rx_saturation_time,
359 max_general->adc_rx_saturation_time);
360 pos += scnprintf(buf + pos, bufsz - pos,
361 " %-30s %10u %10u %10u %10u\n",
362 "ina_detect_search_tm:",
363 le32_to_cpu(general->ina_detection_search_time),
364 accum_general->ina_detection_search_time,
365 delta_general->ina_detection_search_time,
366 max_general->ina_detection_search_time);
367 pos += scnprintf(buf + pos, bufsz - pos,
368 " %-30s %10u %10u %10u %10u\n",
369 "beacon_silence_rssi_a:",
370 le32_to_cpu(general->beacon_silence_rssi_a),
371 accum_general->beacon_silence_rssi_a,
372 delta_general->beacon_silence_rssi_a,
373 max_general->beacon_silence_rssi_a);
374 pos += scnprintf(buf + pos, bufsz - pos,
375 " %-30s %10u %10u %10u %10u\n",
376 "beacon_silence_rssi_b:",
377 le32_to_cpu(general->beacon_silence_rssi_b),
378 accum_general->beacon_silence_rssi_b,
379 delta_general->beacon_silence_rssi_b,
380 max_general->beacon_silence_rssi_b);
381 pos += scnprintf(buf + pos, bufsz - pos,
382 " %-30s %10u %10u %10u %10u\n",
383 "beacon_silence_rssi_c:",
384 le32_to_cpu(general->beacon_silence_rssi_c),
385 accum_general->beacon_silence_rssi_c,
386 delta_general->beacon_silence_rssi_c,
387 max_general->beacon_silence_rssi_c);
388 pos += scnprintf(buf + pos, bufsz - pos,
389 " %-30s %10u %10u %10u %10u\n",
390 "interference_data_flag:",
391 le32_to_cpu(general->interference_data_flag),
392 accum_general->interference_data_flag,
393 delta_general->interference_data_flag,
394 max_general->interference_data_flag);
395 pos += scnprintf(buf + pos, bufsz - pos,
396 " %-30s %10u %10u %10u %10u\n",
397 "channel_load:",
398 le32_to_cpu(general->channel_load),
399 accum_general->channel_load,
400 delta_general->channel_load,
401 max_general->channel_load);
402 pos += scnprintf(buf + pos, bufsz - pos,
403 " %-30s %10u %10u %10u %10u\n",
404 "dsp_false_alarms:",
405 le32_to_cpu(general->dsp_false_alarms),
406 accum_general->dsp_false_alarms,
407 delta_general->dsp_false_alarms,
408 max_general->dsp_false_alarms);
409 pos += scnprintf(buf + pos, bufsz - pos,
410 " %-30s %10u %10u %10u %10u\n",
411 "beacon_rssi_a:",
412 le32_to_cpu(general->beacon_rssi_a),
413 accum_general->beacon_rssi_a,
414 delta_general->beacon_rssi_a,
415 max_general->beacon_rssi_a);
416 pos += scnprintf(buf + pos, bufsz - pos,
417 " %-30s %10u %10u %10u %10u\n",
418 "beacon_rssi_b:",
419 le32_to_cpu(general->beacon_rssi_b),
420 accum_general->beacon_rssi_b,
421 delta_general->beacon_rssi_b,
422 max_general->beacon_rssi_b);
423 pos += scnprintf(buf + pos, bufsz - pos,
424 " %-30s %10u %10u %10u %10u\n",
425 "beacon_rssi_c:",
426 le32_to_cpu(general->beacon_rssi_c),
427 accum_general->beacon_rssi_c,
428 delta_general->beacon_rssi_c,
429 max_general->beacon_rssi_c);
430 pos += scnprintf(buf + pos, bufsz - pos,
431 " %-30s %10u %10u %10u %10u\n",
432 "beacon_energy_a:",
433 le32_to_cpu(general->beacon_energy_a),
434 accum_general->beacon_energy_a,
435 delta_general->beacon_energy_a,
436 max_general->beacon_energy_a);
437 pos += scnprintf(buf + pos, bufsz - pos,
438 " %-30s %10u %10u %10u %10u\n",
439 "beacon_energy_b:",
440 le32_to_cpu(general->beacon_energy_b),
441 accum_general->beacon_energy_b,
442 delta_general->beacon_energy_b,
443 max_general->beacon_energy_b);
444 pos += scnprintf(buf + pos, bufsz - pos,
445 " %-30s %10u %10u %10u %10u\n",
446 "beacon_energy_c:",
447 le32_to_cpu(general->beacon_energy_c),
448 accum_general->beacon_energy_c,
449 delta_general->beacon_energy_c,
450 max_general->beacon_energy_c);
451
452 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
453 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
454 "acumulative delta max\n",
455 "Statistics_Rx - OFDM_HT:");
456 pos += scnprintf(buf + pos, bufsz - pos,
457 " %-30s %10u %10u %10u %10u\n",
458 "plcp_err:",
459 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
460 delta_ht->plcp_err, max_ht->plcp_err);
461 pos += scnprintf(buf + pos, bufsz - pos,
462 " %-30s %10u %10u %10u %10u\n",
463 "overrun_err:",
464 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
465 delta_ht->overrun_err, max_ht->overrun_err);
466 pos += scnprintf(buf + pos, bufsz - pos,
467 " %-30s %10u %10u %10u %10u\n",
468 "early_overrun_err:",
469 le32_to_cpu(ht->early_overrun_err),
470 accum_ht->early_overrun_err,
471 delta_ht->early_overrun_err,
472 max_ht->early_overrun_err);
473 pos += scnprintf(buf + pos, bufsz - pos,
474 " %-30s %10u %10u %10u %10u\n",
475 "crc32_good:",
476 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
477 delta_ht->crc32_good, max_ht->crc32_good);
478 pos += scnprintf(buf + pos, bufsz - pos,
479 " %-30s %10u %10u %10u %10u\n",
480 "crc32_err:",
481 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
482 delta_ht->crc32_err, max_ht->crc32_err);
483 pos += scnprintf(buf + pos, bufsz - pos,
484 " %-30s %10u %10u %10u %10u\n",
485 "mh_format_err:",
486 le32_to_cpu(ht->mh_format_err),
487 accum_ht->mh_format_err,
488 delta_ht->mh_format_err, max_ht->mh_format_err);
489 pos += scnprintf(buf + pos, bufsz - pos,
490 " %-30s %10u %10u %10u %10u\n",
491 "agg_crc32_good:",
492 le32_to_cpu(ht->agg_crc32_good),
493 accum_ht->agg_crc32_good,
494 delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
495 pos += scnprintf(buf + pos, bufsz - pos,
496 " %-30s %10u %10u %10u %10u\n",
497 "agg_mpdu_cnt:",
498 le32_to_cpu(ht->agg_mpdu_cnt),
499 accum_ht->agg_mpdu_cnt,
500 delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
501 pos += scnprintf(buf + pos, bufsz - pos,
502 " %-30s %10u %10u %10u %10u\n",
503 "agg_cnt:",
504 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
505 delta_ht->agg_cnt, max_ht->agg_cnt);
506 pos += scnprintf(buf + pos, bufsz - pos,
507 " %-30s %10u %10u %10u %10u\n",
508 "unsupport_mcs:",
509 le32_to_cpu(ht->unsupport_mcs),
510 accum_ht->unsupport_mcs,
511 delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
512
513 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
514 kfree(buf);
515 return ret;
516}
517
518ssize_t iwl_ucode_tx_stats_read(struct file *file,
519 char __user *user_buf,
520 size_t count, loff_t *ppos)
521{
522 struct iwl_priv *priv = file->private_data;
523 int pos = 0;
524 char *buf;
525 int bufsz = (sizeof(struct statistics_tx) * 48) + 250;
526 ssize_t ret;
527 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
528
529 if (!iwl_is_alive(priv))
530 return -EAGAIN;
531
532 buf = kzalloc(bufsz, GFP_KERNEL);
533 if (!buf) {
534 IWL_ERR(priv, "Can not allocate Buffer\n");
535 return -ENOMEM;
536 }
537
538 /* the statistic information display here is based on
539 * the last statistics notification from uCode
540 * might not reflect the current uCode activity
541 */
542 tx = &priv->statistics.tx;
543 accum_tx = &priv->accum_statistics.tx;
544 delta_tx = &priv->delta_statistics.tx;
545 max_tx = &priv->max_delta.tx;
546 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
547 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
548 "acumulative delta max\n",
549 "Statistics_Tx:");
550 pos += scnprintf(buf + pos, bufsz - pos,
551 " %-30s %10u %10u %10u %10u\n",
552 "preamble:",
553 le32_to_cpu(tx->preamble_cnt),
554 accum_tx->preamble_cnt,
555 delta_tx->preamble_cnt, max_tx->preamble_cnt);
556 pos += scnprintf(buf + pos, bufsz - pos,
557 " %-30s %10u %10u %10u %10u\n",
558 "rx_detected_cnt:",
559 le32_to_cpu(tx->rx_detected_cnt),
560 accum_tx->rx_detected_cnt,
561 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
562 pos += scnprintf(buf + pos, bufsz - pos,
563 " %-30s %10u %10u %10u %10u\n",
564 "bt_prio_defer_cnt:",
565 le32_to_cpu(tx->bt_prio_defer_cnt),
566 accum_tx->bt_prio_defer_cnt,
567 delta_tx->bt_prio_defer_cnt,
568 max_tx->bt_prio_defer_cnt);
569 pos += scnprintf(buf + pos, bufsz - pos,
570 " %-30s %10u %10u %10u %10u\n",
571 "bt_prio_kill_cnt:",
572 le32_to_cpu(tx->bt_prio_kill_cnt),
573 accum_tx->bt_prio_kill_cnt,
574 delta_tx->bt_prio_kill_cnt,
575 max_tx->bt_prio_kill_cnt);
576 pos += scnprintf(buf + pos, bufsz - pos,
577 " %-30s %10u %10u %10u %10u\n",
578 "few_bytes_cnt:",
579 le32_to_cpu(tx->few_bytes_cnt),
580 accum_tx->few_bytes_cnt,
581 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
582 pos += scnprintf(buf + pos, bufsz - pos,
583 " %-30s %10u %10u %10u %10u\n",
584 "cts_timeout:",
585 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
586 delta_tx->cts_timeout, max_tx->cts_timeout);
587 pos += scnprintf(buf + pos, bufsz - pos,
588 " %-30s %10u %10u %10u %10u\n",
589 "ack_timeout:",
590 le32_to_cpu(tx->ack_timeout),
591 accum_tx->ack_timeout,
592 delta_tx->ack_timeout, max_tx->ack_timeout);
593 pos += scnprintf(buf + pos, bufsz - pos,
594 " %-30s %10u %10u %10u %10u\n",
595 "expected_ack_cnt:",
596 le32_to_cpu(tx->expected_ack_cnt),
597 accum_tx->expected_ack_cnt,
598 delta_tx->expected_ack_cnt,
599 max_tx->expected_ack_cnt);
600 pos += scnprintf(buf + pos, bufsz - pos,
601 " %-30s %10u %10u %10u %10u\n",
602 "actual_ack_cnt:",
603 le32_to_cpu(tx->actual_ack_cnt),
604 accum_tx->actual_ack_cnt,
605 delta_tx->actual_ack_cnt,
606 max_tx->actual_ack_cnt);
607 pos += scnprintf(buf + pos, bufsz - pos,
608 " %-30s %10u %10u %10u %10u\n",
609 "dump_msdu_cnt:",
610 le32_to_cpu(tx->dump_msdu_cnt),
611 accum_tx->dump_msdu_cnt,
612 delta_tx->dump_msdu_cnt,
613 max_tx->dump_msdu_cnt);
614 pos += scnprintf(buf + pos, bufsz - pos,
615 " %-30s %10u %10u %10u %10u\n",
616 "abort_nxt_frame_mismatch:",
617 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
618 accum_tx->burst_abort_next_frame_mismatch_cnt,
619 delta_tx->burst_abort_next_frame_mismatch_cnt,
620 max_tx->burst_abort_next_frame_mismatch_cnt);
621 pos += scnprintf(buf + pos, bufsz - pos,
622 " %-30s %10u %10u %10u %10u\n",
623 "abort_missing_nxt_frame:",
624 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
625 accum_tx->burst_abort_missing_next_frame_cnt,
626 delta_tx->burst_abort_missing_next_frame_cnt,
627 max_tx->burst_abort_missing_next_frame_cnt);
628 pos += scnprintf(buf + pos, bufsz - pos,
629 " %-30s %10u %10u %10u %10u\n",
630 "cts_timeout_collision:",
631 le32_to_cpu(tx->cts_timeout_collision),
632 accum_tx->cts_timeout_collision,
633 delta_tx->cts_timeout_collision,
634 max_tx->cts_timeout_collision);
635 pos += scnprintf(buf + pos, bufsz - pos,
636 " %-30s %10u %10u %10u %10u\n",
637 "ack_ba_timeout_collision:",
638 le32_to_cpu(tx->ack_or_ba_timeout_collision),
639 accum_tx->ack_or_ba_timeout_collision,
640 delta_tx->ack_or_ba_timeout_collision,
641 max_tx->ack_or_ba_timeout_collision);
642 pos += scnprintf(buf + pos, bufsz - pos,
643 " %-30s %10u %10u %10u %10u\n",
644 "agg ba_timeout:",
645 le32_to_cpu(tx->agg.ba_timeout),
646 accum_tx->agg.ba_timeout,
647 delta_tx->agg.ba_timeout,
648 max_tx->agg.ba_timeout);
649 pos += scnprintf(buf + pos, bufsz - pos,
650 " %-30s %10u %10u %10u %10u\n",
651 "agg ba_resched_frames:",
652 le32_to_cpu(tx->agg.ba_reschedule_frames),
653 accum_tx->agg.ba_reschedule_frames,
654 delta_tx->agg.ba_reschedule_frames,
655 max_tx->agg.ba_reschedule_frames);
656 pos += scnprintf(buf + pos, bufsz - pos,
657 " %-30s %10u %10u %10u %10u\n",
658 "agg scd_query_agg_frame:",
659 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
660 accum_tx->agg.scd_query_agg_frame_cnt,
661 delta_tx->agg.scd_query_agg_frame_cnt,
662 max_tx->agg.scd_query_agg_frame_cnt);
663 pos += scnprintf(buf + pos, bufsz - pos,
664 " %-30s %10u %10u %10u %10u\n",
665 "agg scd_query_no_agg:",
666 le32_to_cpu(tx->agg.scd_query_no_agg),
667 accum_tx->agg.scd_query_no_agg,
668 delta_tx->agg.scd_query_no_agg,
669 max_tx->agg.scd_query_no_agg);
670 pos += scnprintf(buf + pos, bufsz - pos,
671 " %-30s %10u %10u %10u %10u\n",
672 "agg scd_query_agg:",
673 le32_to_cpu(tx->agg.scd_query_agg),
674 accum_tx->agg.scd_query_agg,
675 delta_tx->agg.scd_query_agg,
676 max_tx->agg.scd_query_agg);
677 pos += scnprintf(buf + pos, bufsz - pos,
678 " %-30s %10u %10u %10u %10u\n",
679 "agg scd_query_mismatch:",
680 le32_to_cpu(tx->agg.scd_query_mismatch),
681 accum_tx->agg.scd_query_mismatch,
682 delta_tx->agg.scd_query_mismatch,
683 max_tx->agg.scd_query_mismatch);
684 pos += scnprintf(buf + pos, bufsz - pos,
685 " %-30s %10u %10u %10u %10u\n",
686 "agg frame_not_ready:",
687 le32_to_cpu(tx->agg.frame_not_ready),
688 accum_tx->agg.frame_not_ready,
689 delta_tx->agg.frame_not_ready,
690 max_tx->agg.frame_not_ready);
691 pos += scnprintf(buf + pos, bufsz - pos,
692 " %-30s %10u %10u %10u %10u\n",
693 "agg underrun:",
694 le32_to_cpu(tx->agg.underrun),
695 accum_tx->agg.underrun,
696 delta_tx->agg.underrun, max_tx->agg.underrun);
697 pos += scnprintf(buf + pos, bufsz - pos,
698 " %-30s %10u %10u %10u %10u\n",
699 "agg bt_prio_kill:",
700 le32_to_cpu(tx->agg.bt_prio_kill),
701 accum_tx->agg.bt_prio_kill,
702 delta_tx->agg.bt_prio_kill,
703 max_tx->agg.bt_prio_kill);
704 pos += scnprintf(buf + pos, bufsz - pos,
705 " %-30s %10u %10u %10u %10u\n",
706 "agg rx_ba_rsp_cnt:",
707 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
708 accum_tx->agg.rx_ba_rsp_cnt,
709 delta_tx->agg.rx_ba_rsp_cnt,
710 max_tx->agg.rx_ba_rsp_cnt);
711
712 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
713 kfree(buf);
714 return ret;
715}
716
717ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
718 size_t count, loff_t *ppos)
719{
720 struct iwl_priv *priv = file->private_data;
721 int pos = 0;
722 char *buf;
723 int bufsz = sizeof(struct statistics_general) * 10 + 300;
724 ssize_t ret;
725 struct statistics_general *general, *accum_general;
726 struct statistics_general *delta_general, *max_general;
727 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
728 struct statistics_div *div, *accum_div, *delta_div, *max_div;
729
730 if (!iwl_is_alive(priv))
731 return -EAGAIN;
732
733 buf = kzalloc(bufsz, GFP_KERNEL);
734 if (!buf) {
735 IWL_ERR(priv, "Can not allocate Buffer\n");
736 return -ENOMEM;
737 }
738
739 /* the statistic information display here is based on
740 * the last statistics notification from uCode
741 * might not reflect the current uCode activity
742 */
743 general = &priv->statistics.general;
744 dbg = &priv->statistics.general.dbg;
745 div = &priv->statistics.general.div;
746 accum_general = &priv->accum_statistics.general;
747 delta_general = &priv->delta_statistics.general;
748 max_general = &priv->max_delta.general;
749 accum_dbg = &priv->accum_statistics.general.dbg;
750 delta_dbg = &priv->delta_statistics.general.dbg;
751 max_dbg = &priv->max_delta.general.dbg;
752 accum_div = &priv->accum_statistics.general.div;
753 delta_div = &priv->delta_statistics.general.div;
754 max_div = &priv->max_delta.general.div;
755 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
756 pos += scnprintf(buf + pos, bufsz - pos, "%-32s current"
757 "acumulative delta max\n",
758 "Statistics_General:");
759 pos += scnprintf(buf + pos, bufsz - pos, " %-30s %10u\n",
760 "temperature:",
761 le32_to_cpu(general->temperature));
762 pos += scnprintf(buf + pos, bufsz - pos, " %-30s %10u\n",
763 "temperature_m:",
764 le32_to_cpu(general->temperature_m));
765 pos += scnprintf(buf + pos, bufsz - pos,
766 " %-30s %10u %10u %10u %10u\n",
767 "burst_check:",
768 le32_to_cpu(dbg->burst_check),
769 accum_dbg->burst_check,
770 delta_dbg->burst_check, max_dbg->burst_check);
771 pos += scnprintf(buf + pos, bufsz - pos,
772 " %-30s %10u %10u %10u %10u\n",
773 "burst_count:",
774 le32_to_cpu(dbg->burst_count),
775 accum_dbg->burst_count,
776 delta_dbg->burst_count, max_dbg->burst_count);
777 pos += scnprintf(buf + pos, bufsz - pos,
778 " %-30s %10u %10u %10u %10u\n",
779 "sleep_time:",
780 le32_to_cpu(general->sleep_time),
781 accum_general->sleep_time,
782 delta_general->sleep_time, max_general->sleep_time);
783 pos += scnprintf(buf + pos, bufsz - pos,
784 " %-30s %10u %10u %10u %10u\n",
785 "slots_out:",
786 le32_to_cpu(general->slots_out),
787 accum_general->slots_out,
788 delta_general->slots_out, max_general->slots_out);
789 pos += scnprintf(buf + pos, bufsz - pos,
790 " %-30s %10u %10u %10u %10u\n",
791 "slots_idle:",
792 le32_to_cpu(general->slots_idle),
793 accum_general->slots_idle,
794 delta_general->slots_idle, max_general->slots_idle);
795 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
796 le32_to_cpu(general->ttl_timestamp));
797 pos += scnprintf(buf + pos, bufsz - pos,
798 " %-30s %10u %10u %10u %10u\n",
799 "tx_on_a:",
800 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
801 delta_div->tx_on_a, max_div->tx_on_a);
802 pos += scnprintf(buf + pos, bufsz - pos,
803 " %-30s %10u %10u %10u %10u\n",
804 "tx_on_b:",
805 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
806 delta_div->tx_on_b, max_div->tx_on_b);
807 pos += scnprintf(buf + pos, bufsz - pos,
808 " %-30s %10u %10u %10u %10u\n",
809 "exec_time:",
810 le32_to_cpu(div->exec_time), accum_div->exec_time,
811 delta_div->exec_time, max_div->exec_time);
812 pos += scnprintf(buf + pos, bufsz - pos,
813 " %-30s %10u %10u %10u %10u\n",
814 "probe_time:",
815 le32_to_cpu(div->probe_time), accum_div->probe_time,
816 delta_div->probe_time, max_div->probe_time);
817 pos += scnprintf(buf + pos, bufsz - pos,
818 " %-30s %10u %10u %10u %10u\n",
819 "rx_enable_counter:",
820 le32_to_cpu(general->rx_enable_counter),
821 accum_general->rx_enable_counter,
822 delta_general->rx_enable_counter,
823 max_general->rx_enable_counter);
824 pos += scnprintf(buf + pos, bufsz - pos,
825 " %-30s %10u %10u %10u %10u\n",
826 "num_of_sos_states:",
827 le32_to_cpu(general->num_of_sos_states),
828 accum_general->num_of_sos_states,
829 delta_general->num_of_sos_states,
830 max_general->num_of_sos_states);
831 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
832 kfree(buf);
833 return ret;
834}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h
new file mode 100644
index 000000000000..59b1f25f0d85
--- /dev/null
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-debugfs.h
@@ -0,0 +1,56 @@
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19 * USA
20 *
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *****************************************************************************/
28
29#include "iwl-dev.h"
30#include "iwl-core.h"
31#include "iwl-debug.h"
32
33#ifdef CONFIG_IWLWIFI_DEBUGFS
34ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
35 size_t count, loff_t *ppos);
36ssize_t iwl_ucode_tx_stats_read(struct file *file, char __user *user_buf,
37 size_t count, loff_t *ppos);
38ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
39 size_t count, loff_t *ppos);
40#else
41static ssize_t iwl_ucode_rx_stats_read(struct file *file, char __user *user_buf,
42 size_t count, loff_t *ppos)
43{
44 return 0;
45}
46static ssize_t iwl_ucode_tx_stats_read(struct file *file, char __user *user_buf,
47 size_t count, loff_t *ppos)
48{
49 return 0;
50}
51static ssize_t iwl_ucode_general_stats_read(struct file *file, char __user *user_buf,
52 size_t count, loff_t *ppos)
53{
54 return 0;
55}
56#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
index 28bc8f8ba981..44ef5d93befc 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
@@ -262,6 +262,7 @@ struct iwl_hcmd_ops iwlagn_hcmd = {
262 .commit_rxon = iwl_commit_rxon, 262 .commit_rxon = iwl_commit_rxon,
263 .set_rxon_chain = iwl_set_rxon_chain, 263 .set_rxon_chain = iwl_set_rxon_chain,
264 .set_tx_ant = iwlagn_send_tx_ant_config, 264 .set_tx_ant = iwlagn_send_tx_ant_config,
265 .send_bt_config = iwl_send_bt_config,
265}; 266};
266 267
267struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = { 268struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
@@ -271,4 +272,5 @@ struct iwl_hcmd_utils_ops iwlagn_hcmd_utils = {
271 .chain_noise_reset = iwlagn_chain_noise_reset, 272 .chain_noise_reset = iwlagn_chain_noise_reset,
272 .rts_tx_cmd_flag = iwlagn_rts_tx_cmd_flag, 273 .rts_tx_cmd_flag = iwlagn_rts_tx_cmd_flag,
273 .calc_rssi = iwlagn_calc_rssi, 274 .calc_rssi = iwlagn_calc_rssi,
275 .request_scan = iwlagn_request_scan,
274}; 276};
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index c465c8590833..4bd0aecc7713 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -331,7 +331,7 @@ u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv)
331 } *hdr; 331 } *hdr;
332 332
333 hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv, 333 hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
334 EEPROM_5000_CALIB_ALL); 334 EEPROM_CALIB_ALL);
335 return hdr->version; 335 return hdr->version;
336 336
337} 337}
@@ -348,22 +348,22 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
348 348
349 switch (address & INDIRECT_TYPE_MSK) { 349 switch (address & INDIRECT_TYPE_MSK) {
350 case INDIRECT_HOST: 350 case INDIRECT_HOST:
351 offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_HOST); 351 offset = iwl_eeprom_query16(priv, EEPROM_LINK_HOST);
352 break; 352 break;
353 case INDIRECT_GENERAL: 353 case INDIRECT_GENERAL:
354 offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_GENERAL); 354 offset = iwl_eeprom_query16(priv, EEPROM_LINK_GENERAL);
355 break; 355 break;
356 case INDIRECT_REGULATORY: 356 case INDIRECT_REGULATORY:
357 offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_REGULATORY); 357 offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY);
358 break; 358 break;
359 case INDIRECT_CALIBRATION: 359 case INDIRECT_CALIBRATION:
360 offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_CALIBRATION); 360 offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION);
361 break; 361 break;
362 case INDIRECT_PROCESS_ADJST: 362 case INDIRECT_PROCESS_ADJST:
363 offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_PROCESS_ADJST); 363 offset = iwl_eeprom_query16(priv, EEPROM_LINK_PROCESS_ADJST);
364 break; 364 break;
365 case INDIRECT_OTHERS: 365 case INDIRECT_OTHERS:
366 offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_OTHERS); 366 offset = iwl_eeprom_query16(priv, EEPROM_LINK_OTHERS);
367 break; 367 break;
368 default: 368 default:
369 IWL_ERR(priv, "illegal indirect type: 0x%X\n", 369 IWL_ERR(priv, "illegal indirect type: 0x%X\n",
@@ -1111,3 +1111,392 @@ void iwlagn_rx_reply_rx_phy(struct iwl_priv *priv,
1111 memcpy(&priv->_agn.last_phy_res, pkt->u.raw, 1111 memcpy(&priv->_agn.last_phy_res, pkt->u.raw,
1112 sizeof(struct iwl_rx_phy_res)); 1112 sizeof(struct iwl_rx_phy_res));
1113} 1113}
1114
1115static int iwl_get_single_channel_for_scan(struct iwl_priv *priv,
1116 enum ieee80211_band band,
1117 struct iwl_scan_channel *scan_ch)
1118{
1119 const struct ieee80211_supported_band *sband;
1120 const struct iwl_channel_info *ch_info;
1121 u16 passive_dwell = 0;
1122 u16 active_dwell = 0;
1123 int i, added = 0;
1124 u16 channel = 0;
1125
1126 sband = iwl_get_hw_mode(priv, band);
1127 if (!sband) {
1128 IWL_ERR(priv, "invalid band\n");
1129 return added;
1130 }
1131
1132 active_dwell = iwl_get_active_dwell_time(priv, band, 0);
1133 passive_dwell = iwl_get_passive_dwell_time(priv, band);
1134
1135 if (passive_dwell <= active_dwell)
1136 passive_dwell = active_dwell + 1;
1137
1138 /* only scan single channel, good enough to reset the RF */
1139 /* pick the first valid not in-use channel */
1140 if (band == IEEE80211_BAND_5GHZ) {
1141 for (i = 14; i < priv->channel_count; i++) {
1142 if (priv->channel_info[i].channel !=
1143 le16_to_cpu(priv->staging_rxon.channel)) {
1144 channel = priv->channel_info[i].channel;
1145 ch_info = iwl_get_channel_info(priv,
1146 band, channel);
1147 if (is_channel_valid(ch_info))
1148 break;
1149 }
1150 }
1151 } else {
1152 for (i = 0; i < 14; i++) {
1153 if (priv->channel_info[i].channel !=
1154 le16_to_cpu(priv->staging_rxon.channel)) {
1155 channel =
1156 priv->channel_info[i].channel;
1157 ch_info = iwl_get_channel_info(priv,
1158 band, channel);
1159 if (is_channel_valid(ch_info))
1160 break;
1161 }
1162 }
1163 }
1164 if (channel) {
1165 scan_ch->channel = cpu_to_le16(channel);
1166 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
1167 scan_ch->active_dwell = cpu_to_le16(active_dwell);
1168 scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
1169 /* Set txpower levels to defaults */
1170 scan_ch->dsp_atten = 110;
1171 if (band == IEEE80211_BAND_5GHZ)
1172 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
1173 else
1174 scan_ch->tx_gain = ((1 << 5) | (5 << 3));
1175 added++;
1176 } else
1177 IWL_ERR(priv, "no valid channel found\n");
1178 return added;
1179}
1180
1181static int iwl_get_channels_for_scan(struct iwl_priv *priv,
1182 enum ieee80211_band band,
1183 u8 is_active, u8 n_probes,
1184 struct iwl_scan_channel *scan_ch)
1185{
1186 struct ieee80211_channel *chan;
1187 const struct ieee80211_supported_band *sband;
1188 const struct iwl_channel_info *ch_info;
1189 u16 passive_dwell = 0;
1190 u16 active_dwell = 0;
1191 int added, i;
1192 u16 channel;
1193
1194 sband = iwl_get_hw_mode(priv, band);
1195 if (!sband)
1196 return 0;
1197
1198 active_dwell = iwl_get_active_dwell_time(priv, band, n_probes);
1199 passive_dwell = iwl_get_passive_dwell_time(priv, band);
1200
1201 if (passive_dwell <= active_dwell)
1202 passive_dwell = active_dwell + 1;
1203
1204 for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) {
1205 chan = priv->scan_request->channels[i];
1206
1207 if (chan->band != band)
1208 continue;
1209
1210 channel = ieee80211_frequency_to_channel(chan->center_freq);
1211 scan_ch->channel = cpu_to_le16(channel);
1212
1213 ch_info = iwl_get_channel_info(priv, band, channel);
1214 if (!is_channel_valid(ch_info)) {
1215 IWL_DEBUG_SCAN(priv, "Channel %d is INVALID for this band.\n",
1216 channel);
1217 continue;
1218 }
1219
1220 if (!is_active || is_channel_passive(ch_info) ||
1221 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN))
1222 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
1223 else
1224 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
1225
1226 if (n_probes)
1227 scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);
1228
1229 scan_ch->active_dwell = cpu_to_le16(active_dwell);
1230 scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
1231
1232 /* Set txpower levels to defaults */
1233 scan_ch->dsp_atten = 110;
1234
1235 /* NOTE: if we were doing 6Mb OFDM for scans we'd use
1236 * power level:
1237 * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3;
1238 */
1239 if (band == IEEE80211_BAND_5GHZ)
1240 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
1241 else
1242 scan_ch->tx_gain = ((1 << 5) | (5 << 3));
1243
1244 IWL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n",
1245 channel, le32_to_cpu(scan_ch->type),
1246 (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
1247 "ACTIVE" : "PASSIVE",
1248 (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
1249 active_dwell : passive_dwell);
1250
1251 scan_ch++;
1252 added++;
1253 }
1254
1255 IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added);
1256 return added;
1257}
1258
1259void iwlagn_request_scan(struct iwl_priv *priv)
1260{
1261 struct iwl_host_cmd cmd = {
1262 .id = REPLY_SCAN_CMD,
1263 .len = sizeof(struct iwl_scan_cmd),
1264 .flags = CMD_SIZE_HUGE,
1265 };
1266 struct iwl_scan_cmd *scan;
1267 struct ieee80211_conf *conf = NULL;
1268 u32 rate_flags = 0;
1269 u16 cmd_len;
1270 u16 rx_chain = 0;
1271 enum ieee80211_band band;
1272 u8 n_probes = 0;
1273 u8 rx_ant = priv->hw_params.valid_rx_ant;
1274 u8 rate;
1275 bool is_active = false;
1276 int chan_mod;
1277 u8 active_chains;
1278
1279 conf = ieee80211_get_hw_conf(priv->hw);
1280
1281 cancel_delayed_work(&priv->scan_check);
1282
1283 if (!iwl_is_ready(priv)) {
1284 IWL_WARN(priv, "request scan called when driver not ready.\n");
1285 goto done;
1286 }
1287
1288 /* Make sure the scan wasn't canceled before this queued work
1289 * was given the chance to run... */
1290 if (!test_bit(STATUS_SCANNING, &priv->status))
1291 goto done;
1292
1293 /* This should never be called or scheduled if there is currently
1294 * a scan active in the hardware. */
1295 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
1296 IWL_DEBUG_INFO(priv, "Multiple concurrent scan requests in parallel. "
1297 "Ignoring second request.\n");
1298 goto done;
1299 }
1300
1301 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
1302 IWL_DEBUG_SCAN(priv, "Aborting scan due to device shutdown\n");
1303 goto done;
1304 }
1305
1306 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
1307 IWL_DEBUG_HC(priv, "Scan request while abort pending. Queuing.\n");
1308 goto done;
1309 }
1310
1311 if (iwl_is_rfkill(priv)) {
1312 IWL_DEBUG_HC(priv, "Aborting scan due to RF Kill activation\n");
1313 goto done;
1314 }
1315
1316 if (!test_bit(STATUS_READY, &priv->status)) {
1317 IWL_DEBUG_HC(priv, "Scan request while uninitialized. Queuing.\n");
1318 goto done;
1319 }
1320
1321 if (!priv->scan_cmd) {
1322 priv->scan_cmd = kmalloc(sizeof(struct iwl_scan_cmd) +
1323 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
1324 if (!priv->scan_cmd) {
1325 IWL_DEBUG_SCAN(priv,
1326 "fail to allocate memory for scan\n");
1327 goto done;
1328 }
1329 }
1330 scan = priv->scan_cmd;
1331 memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE);
1332
1333 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
1334 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
1335
1336 if (iwl_is_associated(priv)) {
1337 u16 interval = 0;
1338 u32 extra;
1339 u32 suspend_time = 100;
1340 u32 scan_suspend_time = 100;
1341 unsigned long flags;
1342
1343 IWL_DEBUG_INFO(priv, "Scanning while associated...\n");
1344 spin_lock_irqsave(&priv->lock, flags);
1345 interval = priv->beacon_int;
1346 spin_unlock_irqrestore(&priv->lock, flags);
1347
1348 scan->suspend_time = 0;
1349 scan->max_out_time = cpu_to_le32(200 * 1024);
1350 if (!interval)
1351 interval = suspend_time;
1352
1353 extra = (suspend_time / interval) << 22;
1354 scan_suspend_time = (extra |
1355 ((suspend_time % interval) * 1024));
1356 scan->suspend_time = cpu_to_le32(scan_suspend_time);
1357 IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
1358 scan_suspend_time, interval);
1359 }
1360
1361 if (priv->is_internal_short_scan) {
1362 IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n");
1363 } else if (priv->scan_request->n_ssids) {
1364 int i, p = 0;
1365 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n");
1366 for (i = 0; i < priv->scan_request->n_ssids; i++) {
1367 /* always does wildcard anyway */
1368 if (!priv->scan_request->ssids[i].ssid_len)
1369 continue;
1370 scan->direct_scan[p].id = WLAN_EID_SSID;
1371 scan->direct_scan[p].len =
1372 priv->scan_request->ssids[i].ssid_len;
1373 memcpy(scan->direct_scan[p].ssid,
1374 priv->scan_request->ssids[i].ssid,
1375 priv->scan_request->ssids[i].ssid_len);
1376 n_probes++;
1377 p++;
1378 }
1379 is_active = true;
1380 } else
1381 IWL_DEBUG_SCAN(priv, "Start passive scan.\n");
1382
1383 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
1384 scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id;
1385 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
1386
1387 switch (priv->scan_band) {
1388 case IEEE80211_BAND_2GHZ:
1389 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
1390 chan_mod = le32_to_cpu(priv->active_rxon.flags & RXON_FLG_CHANNEL_MODE_MSK)
1391 >> RXON_FLG_CHANNEL_MODE_POS;
1392 if (chan_mod == CHANNEL_MODE_PURE_40) {
1393 rate = IWL_RATE_6M_PLCP;
1394 } else {
1395 rate = IWL_RATE_1M_PLCP;
1396 rate_flags = RATE_MCS_CCK_MSK;
1397 }
1398 scan->good_CRC_th = 0;
1399 break;
1400 case IEEE80211_BAND_5GHZ:
1401 rate = IWL_RATE_6M_PLCP;
1402 /*
1403 * If active scaning is requested but a certain channel
1404 * is marked passive, we can do active scanning if we
1405 * detect transmissions.
1406 */
1407 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0;
1408 break;
1409 default:
1410 IWL_WARN(priv, "Invalid scan band count\n");
1411 goto done;
1412 }
1413
1414 band = priv->scan_band;
1415
1416 if (priv->cfg->scan_antennas[band])
1417 rx_ant = priv->cfg->scan_antennas[band];
1418
1419 priv->scan_tx_ant[band] =
1420 iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band]);
1421 rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]);
1422 scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags);
1423
1424 /* In power save mode use one chain, otherwise use all chains */
1425 if (test_bit(STATUS_POWER_PMI, &priv->status)) {
1426 /* rx_ant has been set to all valid chains previously */
1427 active_chains = rx_ant &
1428 ((u8)(priv->chain_noise_data.active_chains));
1429 if (!active_chains)
1430 active_chains = rx_ant;
1431
1432 IWL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n",
1433 priv->chain_noise_data.active_chains);
1434
1435 rx_ant = first_antenna(active_chains);
1436 }
1437 /* MIMO is not used here, but value is required */
1438 rx_chain |= priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
1439 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
1440 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS;
1441 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
1442 scan->rx_chain = cpu_to_le16(rx_chain);
1443 if (!priv->is_internal_short_scan) {
1444 cmd_len = iwl_fill_probe_req(priv,
1445 (struct ieee80211_mgmt *)scan->data,
1446 priv->scan_request->ie,
1447 priv->scan_request->ie_len,
1448 IWL_MAX_SCAN_SIZE - sizeof(*scan));
1449 } else {
1450 cmd_len = iwl_fill_probe_req(priv,
1451 (struct ieee80211_mgmt *)scan->data,
1452 NULL, 0,
1453 IWL_MAX_SCAN_SIZE - sizeof(*scan));
1454
1455 }
1456 scan->tx_cmd.len = cpu_to_le16(cmd_len);
1457
1458 scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK |
1459 RXON_FILTER_BCON_AWARE_MSK);
1460
1461 if (priv->is_internal_short_scan) {
1462 scan->channel_count =
1463 iwl_get_single_channel_for_scan(priv, band,
1464 (void *)&scan->data[le16_to_cpu(
1465 scan->tx_cmd.len)]);
1466 } else {
1467 scan->channel_count =
1468 iwl_get_channels_for_scan(priv, band,
1469 is_active, n_probes,
1470 (void *)&scan->data[le16_to_cpu(
1471 scan->tx_cmd.len)]);
1472 }
1473 if (scan->channel_count == 0) {
1474 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
1475 goto done;
1476 }
1477
1478 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
1479 scan->channel_count * sizeof(struct iwl_scan_channel);
1480 cmd.data = scan;
1481 scan->len = cpu_to_le16(cmd.len);
1482
1483 set_bit(STATUS_SCAN_HW, &priv->status);
1484 if (iwl_send_cmd_sync(priv, &cmd))
1485 goto done;
1486
1487 queue_delayed_work(priv->workqueue, &priv->scan_check,
1488 IWL_SCAN_CHECK_WATCHDOG);
1489
1490 return;
1491
1492 done:
1493 /* Cannot perform scan. Make sure we clear scanning
1494 * bits from status so next scan request can be performed.
1495 * If we don't clear scanning status bit here all next scan
1496 * will fail
1497 */
1498 clear_bit(STATUS_SCAN_HW, &priv->status);
1499 clear_bit(STATUS_SCANNING, &priv->status);
1500 /* inform mac80211 scan aborted */
1501 queue_work(priv->workqueue, &priv->scan_completed);
1502}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index f7d85a2173c8..0e6161d7c764 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -295,11 +295,11 @@ static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid)
295 return tl->total; 295 return tl->total;
296} 296}
297 297
298static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, 298static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
299 struct iwl_lq_sta *lq_data, u8 tid, 299 struct iwl_lq_sta *lq_data, u8 tid,
300 struct ieee80211_sta *sta) 300 struct ieee80211_sta *sta)
301{ 301{
302 int ret; 302 int ret = -EAGAIN;
303 303
304 if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { 304 if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) {
305 IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", 305 IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n",
@@ -313,29 +313,29 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
313 */ 313 */
314 IWL_DEBUG_HT(priv, "Fail start Tx agg on tid: %d\n", 314 IWL_DEBUG_HT(priv, "Fail start Tx agg on tid: %d\n",
315 tid); 315 tid);
316 ret = ieee80211_stop_tx_ba_session(sta, tid, 316 ieee80211_stop_tx_ba_session(sta, tid,
317 WLAN_BACK_INITIATOR); 317 WLAN_BACK_INITIATOR);
318 } 318 }
319 } 319 } else
320 IWL_ERR(priv, "Fail finding valid aggregation tid: %d\n", tid);
321 return ret;
320} 322}
321 323
322static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, 324static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid,
323 struct iwl_lq_sta *lq_data, 325 struct iwl_lq_sta *lq_data,
324 struct ieee80211_sta *sta) 326 struct ieee80211_sta *sta)
325{ 327{
326 if ((tid < TID_MAX_LOAD_COUNT)) 328 if ((tid < TID_MAX_LOAD_COUNT) &&
327 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); 329 !rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta)) {
328 else if (tid == IWL_AGG_ALL_TID) 330 if (priv->cfg->use_rts_for_ht) {
329 for (tid = 0; tid < TID_MAX_LOAD_COUNT; tid++) 331 /*
330 rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); 332 * switch to RTS/CTS if it is the prefer protection
331 if (priv->cfg->use_rts_for_ht) { 333 * method for HT traffic
332 /* 334 */
333 * switch to RTS/CTS if it is the prefer protection method 335 IWL_DEBUG_HT(priv, "use RTS/CTS protection for HT\n");
334 * for HT traffic 336 priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN;
335 */ 337 iwlcore_commit_rxon(priv);
336 IWL_DEBUG_HT(priv, "use RTS/CTS protection for HT\n"); 338 }
337 priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN;
338 iwlcore_commit_rxon(priv);
339 } 339 }
340} 340}
341 341
@@ -2558,8 +2558,17 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
2558 lq_sta->active_mimo3_rate); 2558 lq_sta->active_mimo3_rate);
2559 2559
2560 /* These values will be overridden later */ 2560 /* These values will be overridden later */
2561 lq_sta->lq.general_params.single_stream_ant_msk = ANT_A; 2561 lq_sta->lq.general_params.single_stream_ant_msk =
2562 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; 2562 first_antenna(priv->hw_params.valid_tx_ant);
2563 lq_sta->lq.general_params.dual_stream_ant_msk =
2564 priv->hw_params.valid_tx_ant &
2565 ~first_antenna(priv->hw_params.valid_tx_ant);
2566 if (!lq_sta->lq.general_params.dual_stream_ant_msk) {
2567 lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB;
2568 } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) {
2569 lq_sta->lq.general_params.dual_stream_ant_msk =
2570 priv->hw_params.valid_tx_ant;
2571 }
2563 2572
2564 /* as default allow aggregation for all tids */ 2573 /* as default allow aggregation for all tids */
2565 lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; 2574 lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 3077eac58880..11661fa28f21 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -167,7 +167,7 @@ static int iwlagn_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,
167 scd_q2ratid = ra_tid & IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK; 167 scd_q2ratid = ra_tid & IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK;
168 168
169 tbl_dw_addr = priv->scd_base_addr + 169 tbl_dw_addr = priv->scd_base_addr +
170 IWL50_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id); 170 IWLAGN_SCD_TRANSLATE_TBL_OFFSET_QUEUE(txq_id);
171 171
172 tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr); 172 tbl_dw = iwl_read_targ_mem(priv, tbl_dw_addr);
173 173
@@ -186,9 +186,9 @@ static void iwlagn_tx_queue_stop_scheduler(struct iwl_priv *priv, u16 txq_id)
186 /* Simply stop the queue, but don't change any configuration; 186 /* Simply stop the queue, but don't change any configuration;
187 * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */ 187 * the SCD_ACT_EN bit is the write-enable mask for the ACTIVE bit. */
188 iwl_write_prph(priv, 188 iwl_write_prph(priv,
189 IWL50_SCD_QUEUE_STATUS_BITS(txq_id), 189 IWLAGN_SCD_QUEUE_STATUS_BITS(txq_id),
190 (0 << IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE)| 190 (0 << IWLAGN_SCD_QUEUE_STTS_REG_POS_ACTIVE)|
191 (1 << IWL50_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN)); 191 (1 << IWLAGN_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
192} 192}
193 193
194void iwlagn_set_wr_ptrs(struct iwl_priv *priv, 194void iwlagn_set_wr_ptrs(struct iwl_priv *priv,
@@ -196,7 +196,7 @@ void iwlagn_set_wr_ptrs(struct iwl_priv *priv,
196{ 196{
197 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 197 iwl_write_direct32(priv, HBUS_TARG_WRPTR,
198 (index & 0xff) | (txq_id << 8)); 198 (index & 0xff) | (txq_id << 8));
199 iwl_write_prph(priv, IWL50_SCD_QUEUE_RDPTR(txq_id), index); 199 iwl_write_prph(priv, IWLAGN_SCD_QUEUE_RDPTR(txq_id), index);
200} 200}
201 201
202void iwlagn_tx_queue_set_status(struct iwl_priv *priv, 202void iwlagn_tx_queue_set_status(struct iwl_priv *priv,
@@ -206,11 +206,11 @@ void iwlagn_tx_queue_set_status(struct iwl_priv *priv,
206 int txq_id = txq->q.id; 206 int txq_id = txq->q.id;
207 int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0; 207 int active = test_bit(txq_id, &priv->txq_ctx_active_msk) ? 1 : 0;
208 208
209 iwl_write_prph(priv, IWL50_SCD_QUEUE_STATUS_BITS(txq_id), 209 iwl_write_prph(priv, IWLAGN_SCD_QUEUE_STATUS_BITS(txq_id),
210 (active << IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE) | 210 (active << IWLAGN_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
211 (tx_fifo_id << IWL50_SCD_QUEUE_STTS_REG_POS_TXF) | 211 (tx_fifo_id << IWLAGN_SCD_QUEUE_STTS_REG_POS_TXF) |
212 (1 << IWL50_SCD_QUEUE_STTS_REG_POS_WSL) | 212 (1 << IWLAGN_SCD_QUEUE_STTS_REG_POS_WSL) |
213 IWL50_SCD_QUEUE_STTS_REG_MSK); 213 IWLAGN_SCD_QUEUE_STTS_REG_MSK);
214 214
215 txq->sched_retry = scd_retry; 215 txq->sched_retry = scd_retry;
216 216
@@ -250,10 +250,10 @@ int iwlagn_txq_agg_enable(struct iwl_priv *priv, int txq_id,
250 iwlagn_tx_queue_set_q2ratid(priv, ra_tid, txq_id); 250 iwlagn_tx_queue_set_q2ratid(priv, ra_tid, txq_id);
251 251
252 /* Set this queue as a chain-building queue */ 252 /* Set this queue as a chain-building queue */
253 iwl_set_bits_prph(priv, IWL50_SCD_QUEUECHAIN_SEL, (1<<txq_id)); 253 iwl_set_bits_prph(priv, IWLAGN_SCD_QUEUECHAIN_SEL, (1<<txq_id));
254 254
255 /* enable aggregations for the queue */ 255 /* enable aggregations for the queue */
256 iwl_set_bits_prph(priv, IWL50_SCD_AGGR_SEL, (1<<txq_id)); 256 iwl_set_bits_prph(priv, IWLAGN_SCD_AGGR_SEL, (1<<txq_id));
257 257
258 /* Place first TFD at index corresponding to start sequence number. 258 /* Place first TFD at index corresponding to start sequence number.
259 * Assumes that ssn_idx is valid (!= 0xFFF) */ 259 * Assumes that ssn_idx is valid (!= 0xFFF) */
@@ -263,16 +263,16 @@ int iwlagn_txq_agg_enable(struct iwl_priv *priv, int txq_id,
263 263
264 /* Set up Tx window size and frame limit for this queue */ 264 /* Set up Tx window size and frame limit for this queue */
265 iwl_write_targ_mem(priv, priv->scd_base_addr + 265 iwl_write_targ_mem(priv, priv->scd_base_addr +
266 IWL50_SCD_CONTEXT_QUEUE_OFFSET(txq_id) + 266 IWLAGN_SCD_CONTEXT_QUEUE_OFFSET(txq_id) +
267 sizeof(u32), 267 sizeof(u32),
268 ((SCD_WIN_SIZE << 268 ((SCD_WIN_SIZE <<
269 IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) & 269 IWLAGN_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) &
270 IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) | 270 IWLAGN_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) |
271 ((SCD_FRAME_LIMIT << 271 ((SCD_FRAME_LIMIT <<
272 IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & 272 IWLAGN_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
273 IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK)); 273 IWLAGN_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK));
274 274
275 iwl_set_bits_prph(priv, IWL50_SCD_INTERRUPT_MASK, (1 << txq_id)); 275 iwl_set_bits_prph(priv, IWLAGN_SCD_INTERRUPT_MASK, (1 << txq_id));
276 276
277 /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */ 277 /* Set up Status area in SRAM, map to Tx DMA/FIFO, activate the queue */
278 iwlagn_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1); 278 iwlagn_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 1);
@@ -298,14 +298,14 @@ int iwlagn_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
298 298
299 iwlagn_tx_queue_stop_scheduler(priv, txq_id); 299 iwlagn_tx_queue_stop_scheduler(priv, txq_id);
300 300
301 iwl_clear_bits_prph(priv, IWL50_SCD_AGGR_SEL, (1 << txq_id)); 301 iwl_clear_bits_prph(priv, IWLAGN_SCD_AGGR_SEL, (1 << txq_id));
302 302
303 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); 303 priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff);
304 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); 304 priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff);
305 /* supposes that ssn_idx is valid (!= 0xFFF) */ 305 /* supposes that ssn_idx is valid (!= 0xFFF) */
306 iwlagn_set_wr_ptrs(priv, txq_id, ssn_idx); 306 iwlagn_set_wr_ptrs(priv, txq_id, ssn_idx);
307 307
308 iwl_clear_bits_prph(priv, IWL50_SCD_INTERRUPT_MASK, (1 << txq_id)); 308 iwl_clear_bits_prph(priv, IWLAGN_SCD_INTERRUPT_MASK, (1 << txq_id));
309 iwl_txq_ctx_deactivate(priv, txq_id); 309 iwl_txq_ctx_deactivate(priv, txq_id);
310 iwlagn_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0); 310 iwlagn_tx_queue_set_status(priv, &priv->txq[txq_id], tx_fifo, 0);
311 311
@@ -318,7 +318,7 @@ int iwlagn_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
318 */ 318 */
319void iwlagn_txq_set_sched(struct iwl_priv *priv, u32 mask) 319void iwlagn_txq_set_sched(struct iwl_priv *priv, u32 mask)
320{ 320{
321 iwl_write_prph(priv, IWL50_SCD_TXFACT, mask); 321 iwl_write_prph(priv, IWLAGN_SCD_TXFACT, mask);
322} 322}
323 323
324static inline int get_queue_from_ac(u16 ac) 324static inline int get_queue_from_ac(u16 ac)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
index 52ae157968b2..ae476c234a7c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-ucode.c
@@ -207,7 +207,7 @@ static int iwlagn_set_Xtal_calib(struct iwl_priv *priv)
207{ 207{
208 struct iwl_calib_xtal_freq_cmd cmd; 208 struct iwl_calib_xtal_freq_cmd cmd;
209 __le16 *xtal_calib = 209 __le16 *xtal_calib =
210 (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL); 210 (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_XTAL);
211 211
212 cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD; 212 cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD;
213 cmd.hdr.first_group = 0; 213 cmd.hdr.first_group = 0;
@@ -329,19 +329,19 @@ int iwlagn_alive_notify(struct iwl_priv *priv)
329 329
330 spin_lock_irqsave(&priv->lock, flags); 330 spin_lock_irqsave(&priv->lock, flags);
331 331
332 priv->scd_base_addr = iwl_read_prph(priv, IWL50_SCD_SRAM_BASE_ADDR); 332 priv->scd_base_addr = iwl_read_prph(priv, IWLAGN_SCD_SRAM_BASE_ADDR);
333 a = priv->scd_base_addr + IWL50_SCD_CONTEXT_DATA_OFFSET; 333 a = priv->scd_base_addr + IWLAGN_SCD_CONTEXT_DATA_OFFSET;
334 for (; a < priv->scd_base_addr + IWL50_SCD_TX_STTS_BITMAP_OFFSET; 334 for (; a < priv->scd_base_addr + IWLAGN_SCD_TX_STTS_BITMAP_OFFSET;
335 a += 4) 335 a += 4)
336 iwl_write_targ_mem(priv, a, 0); 336 iwl_write_targ_mem(priv, a, 0);
337 for (; a < priv->scd_base_addr + IWL50_SCD_TRANSLATE_TBL_OFFSET; 337 for (; a < priv->scd_base_addr + IWLAGN_SCD_TRANSLATE_TBL_OFFSET;
338 a += 4) 338 a += 4)
339 iwl_write_targ_mem(priv, a, 0); 339 iwl_write_targ_mem(priv, a, 0);
340 for (; a < priv->scd_base_addr + 340 for (; a < priv->scd_base_addr +
341 IWL50_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4) 341 IWLAGN_SCD_TRANSLATE_TBL_OFFSET_QUEUE(priv->hw_params.max_txq_num); a += 4)
342 iwl_write_targ_mem(priv, a, 0); 342 iwl_write_targ_mem(priv, a, 0);
343 343
344 iwl_write_prph(priv, IWL50_SCD_DRAM_BASE_ADDR, 344 iwl_write_prph(priv, IWLAGN_SCD_DRAM_BASE_ADDR,
345 priv->scd_bc_tbls.dma >> 10); 345 priv->scd_bc_tbls.dma >> 10);
346 346
347 /* Enable DMA channel */ 347 /* Enable DMA channel */
@@ -355,28 +355,28 @@ int iwlagn_alive_notify(struct iwl_priv *priv)
355 iwl_write_direct32(priv, FH_TX_CHICKEN_BITS_REG, 355 iwl_write_direct32(priv, FH_TX_CHICKEN_BITS_REG,
356 reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN); 356 reg_val | FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN);
357 357
358 iwl_write_prph(priv, IWL50_SCD_QUEUECHAIN_SEL, 358 iwl_write_prph(priv, IWLAGN_SCD_QUEUECHAIN_SEL,
359 IWL50_SCD_QUEUECHAIN_SEL_ALL(priv->hw_params.max_txq_num)); 359 IWLAGN_SCD_QUEUECHAIN_SEL_ALL(priv->hw_params.max_txq_num));
360 iwl_write_prph(priv, IWL50_SCD_AGGR_SEL, 0); 360 iwl_write_prph(priv, IWLAGN_SCD_AGGR_SEL, 0);
361 361
362 /* initiate the queues */ 362 /* initiate the queues */
363 for (i = 0; i < priv->hw_params.max_txq_num; i++) { 363 for (i = 0; i < priv->hw_params.max_txq_num; i++) {
364 iwl_write_prph(priv, IWL50_SCD_QUEUE_RDPTR(i), 0); 364 iwl_write_prph(priv, IWLAGN_SCD_QUEUE_RDPTR(i), 0);
365 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8)); 365 iwl_write_direct32(priv, HBUS_TARG_WRPTR, 0 | (i << 8));
366 iwl_write_targ_mem(priv, priv->scd_base_addr + 366 iwl_write_targ_mem(priv, priv->scd_base_addr +
367 IWL50_SCD_CONTEXT_QUEUE_OFFSET(i), 0); 367 IWLAGN_SCD_CONTEXT_QUEUE_OFFSET(i), 0);
368 iwl_write_targ_mem(priv, priv->scd_base_addr + 368 iwl_write_targ_mem(priv, priv->scd_base_addr +
369 IWL50_SCD_CONTEXT_QUEUE_OFFSET(i) + 369 IWLAGN_SCD_CONTEXT_QUEUE_OFFSET(i) +
370 sizeof(u32), 370 sizeof(u32),
371 ((SCD_WIN_SIZE << 371 ((SCD_WIN_SIZE <<
372 IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) & 372 IWLAGN_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS) &
373 IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) | 373 IWLAGN_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK) |
374 ((SCD_FRAME_LIMIT << 374 ((SCD_FRAME_LIMIT <<
375 IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) & 375 IWLAGN_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS) &
376 IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK)); 376 IWLAGN_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK));
377 } 377 }
378 378
379 iwl_write_prph(priv, IWL50_SCD_INTERRUPT_MASK, 379 iwl_write_prph(priv, IWLAGN_SCD_INTERRUPT_MASK,
380 IWL_MASK(0, priv->hw_params.max_txq_num)); 380 IWL_MASK(0, priv->hw_params.max_txq_num));
381 381
382 /* Activate all Tx DMA/FIFO channels */ 382 /* Activate all Tx DMA/FIFO channels */
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 310bc6aeb99b..00344d64635c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2174,7 +2174,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
2174 } 2174 }
2175 2175
2176 /* Configure Bluetooth device coexistence support */ 2176 /* Configure Bluetooth device coexistence support */
2177 iwl_send_bt_config(priv); 2177 priv->cfg->ops->hcmd->send_bt_config(priv);
2178 2178
2179 iwl_reset_run_time_calib(priv); 2179 iwl_reset_run_time_calib(priv);
2180 2180
@@ -3178,44 +3178,6 @@ static ssize_t store_tx_power(struct device *d,
3178 3178
3179static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power); 3179static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
3180 3180
3181static ssize_t show_statistics(struct device *d,
3182 struct device_attribute *attr, char *buf)
3183{
3184 struct iwl_priv *priv = dev_get_drvdata(d);
3185 u32 size = sizeof(struct iwl_notif_statistics);
3186 u32 len = 0, ofs = 0;
3187 u8 *data = (u8 *)&priv->statistics;
3188 int rc = 0;
3189
3190 if (!iwl_is_alive(priv))
3191 return -EAGAIN;
3192
3193 mutex_lock(&priv->mutex);
3194 rc = iwl_send_statistics_request(priv, CMD_SYNC, false);
3195 mutex_unlock(&priv->mutex);
3196
3197 if (rc) {
3198 len = sprintf(buf,
3199 "Error sending statistics request: 0x%08X\n", rc);
3200 return len;
3201 }
3202
3203 while (size && (PAGE_SIZE - len)) {
3204 hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len,
3205 PAGE_SIZE - len, 1);
3206 len = strlen(buf);
3207 if (PAGE_SIZE - len)
3208 buf[len++] = '\n';
3209
3210 ofs += 16;
3211 size -= min(size, 16U);
3212 }
3213
3214 return len;
3215}
3216
3217static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);
3218
3219static ssize_t show_rts_ht_protection(struct device *d, 3181static ssize_t show_rts_ht_protection(struct device *d,
3220 struct device_attribute *attr, char *buf) 3182 struct device_attribute *attr, char *buf)
3221{ 3183{
@@ -3401,11 +3363,10 @@ static void iwl_uninit_drv(struct iwl_priv *priv)
3401 iwl_calib_free_results(priv); 3363 iwl_calib_free_results(priv);
3402 iwlcore_free_geos(priv); 3364 iwlcore_free_geos(priv);
3403 iwl_free_channel_map(priv); 3365 iwl_free_channel_map(priv);
3404 kfree(priv->scan); 3366 kfree(priv->scan_cmd);
3405} 3367}
3406 3368
3407static struct attribute *iwl_sysfs_entries[] = { 3369static struct attribute *iwl_sysfs_entries[] = {
3408 &dev_attr_statistics.attr,
3409 &dev_attr_temperature.attr, 3370 &dev_attr_temperature.attr,
3410 &dev_attr_tx_power.attr, 3371 &dev_attr_tx_power.attr,
3411 &dev_attr_rts_ht_protection.attr, 3372 &dev_attr_rts_ht_protection.attr,
@@ -3836,7 +3797,12 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
3836 {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)}, 3797 {IWL_PCI_DEVICE(0x4238, 0x1111, iwl6000_3agn_cfg)},
3837 {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)}, 3798 {IWL_PCI_DEVICE(0x4239, 0x1311, iwl6000i_2agn_cfg)},
3838 {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)}, 3799 {IWL_PCI_DEVICE(0x4239, 0x1316, iwl6000i_2abg_cfg)},
3839 {IWL_PCI_DEVICE(0x0082, 0x1201, iwl6000i_g2_2agn_cfg)}, 3800
3801/* 6x00 Series Gen2 */
3802 {IWL_PCI_DEVICE(0x0082, 0x1201, iwl6000g2_2agn_cfg)},
3803 {IWL_PCI_DEVICE(0x0082, 0x1301, iwl6000g2_2agn_cfg)},
3804 {IWL_PCI_DEVICE(0x0082, 0x1321, iwl6000g2_2agn_cfg)},
3805 {IWL_PCI_DEVICE(0x0085, 0x1311, iwl6000g2_2agn_cfg)},
3840 3806
3841/* 6x50 WiFi/WiMax Series */ 3807/* 6x50 WiFi/WiMax Series */
3842 {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)}, 3808 {IWL_PCI_DEVICE(0x0087, 0x1301, iwl6050_2agn_cfg)},
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index 5d3142287e14..cfee9994383e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -171,4 +171,7 @@ static inline bool iwl_is_tx_success(u32 status)
171 (status == TX_STATUS_DIRECT_DONE); 171 (status == TX_STATUS_DIRECT_DONE);
172} 172}
173 173
174/* scan */
175void iwlagn_request_scan(struct iwl_priv *priv);
176
174#endif /* __iwl_agn_h__ */ 177#endif /* __iwl_agn_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index d830086ca195..67c723cc32d2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -1443,7 +1443,7 @@ struct iwl4965_rx_mpdu_res_start {
1443 1443
1444/* 1: Ignore Bluetooth priority for this frame. 1444/* 1: Ignore Bluetooth priority for this frame.
1445 * 0: Delay Tx until Bluetooth device is done (normal usage). */ 1445 * 0: Delay Tx until Bluetooth device is done (normal usage). */
1446#define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12) 1446#define TX_CMD_FLG_IGNORE_BT cpu_to_le32(1 << 12)
1447 1447
1448/* 1: uCode overrides sequence control field in MAC header. 1448/* 1: uCode overrides sequence control field in MAC header.
1449 * 0: Driver provides sequence control field in MAC header. 1449 * 0: Driver provides sequence control field in MAC header.
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index b75808aad1ef..56a9f1741419 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -829,19 +829,6 @@ static u8 iwl_count_chain_bitmap(u32 chain_bitmap)
829} 829}
830 830
831/** 831/**
832 * iwl_is_monitor_mode - Determine if interface in monitor mode
833 *
834 * priv->iw_mode is set in add_interface, but add_interface is
835 * never called for monitor mode. The only way mac80211 informs us about
836 * monitor mode is through configuring filters (call to configure_filter).
837 */
838bool iwl_is_monitor_mode(struct iwl_priv *priv)
839{
840 return !!(priv->staging_rxon.filter_flags & RXON_FILTER_PROMISC_MSK);
841}
842EXPORT_SYMBOL(iwl_is_monitor_mode);
843
844/**
845 * iwl_set_rxon_chain - Set up Rx chain usage in "staging" RXON image 832 * iwl_set_rxon_chain - Set up Rx chain usage in "staging" RXON image
846 * 833 *
847 * Selects how many and which Rx receivers/antennas/chains to use. 834 * Selects how many and which Rx receivers/antennas/chains to use.
@@ -884,19 +871,6 @@ void iwl_set_rxon_chain(struct iwl_priv *priv)
884 rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS; 871 rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS;
885 rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS; 872 rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS;
886 873
887 /* copied from 'iwl_bg_request_scan()' */
888 /* Force use of chains B and C (0x6) for Rx
889 * Avoid A (0x1) for the device has off-channel reception on A-band.
890 * MIMO is not used here, but value is required */
891 if (iwl_is_monitor_mode(priv) &&
892 !(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) &&
893 priv->cfg->off_channel_workaround) {
894 rx_chain = ANT_ABC << RXON_RX_CHAIN_VALID_POS;
895 rx_chain |= ANT_BC << RXON_RX_CHAIN_FORCE_SEL_POS;
896 rx_chain |= ANT_ABC << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
897 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
898 }
899
900 priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain); 874 priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain);
901 875
902 if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam) 876 if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam)
@@ -1480,7 +1454,7 @@ irqreturn_t iwl_isr_legacy(int irq, void *data)
1480} 1454}
1481EXPORT_SYMBOL(iwl_isr_legacy); 1455EXPORT_SYMBOL(iwl_isr_legacy);
1482 1456
1483int iwl_send_bt_config(struct iwl_priv *priv) 1457void iwl_send_bt_config(struct iwl_priv *priv)
1484{ 1458{
1485 struct iwl_bt_cmd bt_cmd = { 1459 struct iwl_bt_cmd bt_cmd = {
1486 .lead_time = BT_LEAD_TIME_DEF, 1460 .lead_time = BT_LEAD_TIME_DEF,
@@ -1497,8 +1471,9 @@ int iwl_send_bt_config(struct iwl_priv *priv)
1497 IWL_DEBUG_INFO(priv, "BT coex %s\n", 1471 IWL_DEBUG_INFO(priv, "BT coex %s\n",
1498 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active"); 1472 (bt_cmd.flags == BT_COEX_DISABLE) ? "disable" : "active");
1499 1473
1500 return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG, 1474 if (iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
1501 sizeof(struct iwl_bt_cmd), &bt_cmd); 1475 sizeof(struct iwl_bt_cmd), &bt_cmd))
1476 IWL_ERR(priv, "failed to send BT Coex Config\n");
1502} 1477}
1503EXPORT_SYMBOL(iwl_send_bt_config); 1478EXPORT_SYMBOL(iwl_send_bt_config);
1504 1479
@@ -1868,7 +1843,6 @@ static inline void iwl_set_no_assoc(struct iwl_priv *priv)
1868 iwlcore_commit_rxon(priv); 1843 iwlcore_commit_rxon(priv);
1869} 1844}
1870 1845
1871#define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
1872void iwl_bss_info_changed(struct ieee80211_hw *hw, 1846void iwl_bss_info_changed(struct ieee80211_hw *hw,
1873 struct ieee80211_vif *vif, 1847 struct ieee80211_vif *vif,
1874 struct ieee80211_bss_conf *bss_conf, 1848 struct ieee80211_bss_conf *bss_conf,
@@ -1989,14 +1963,6 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
1989 1963
1990 iwl_led_associate(priv); 1964 iwl_led_associate(priv);
1991 1965
1992 /*
1993 * We have just associated, don't start scan too early
1994 * leave time for EAPOL exchange to complete.
1995 *
1996 * XXX: do this in mac80211
1997 */
1998 priv->next_scan_jiffies = jiffies +
1999 IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
2000 if (!iwl_is_rfkill(priv)) 1966 if (!iwl_is_rfkill(priv))
2001 priv->cfg->ops->lib->post_associate(priv); 1967 priv->cfg->ops->lib->post_associate(priv);
2002 } else 1968 } else
@@ -2383,11 +2349,11 @@ EXPORT_SYMBOL(iwl_free_txq_mem);
2383 2349
2384int iwl_send_wimax_coex(struct iwl_priv *priv) 2350int iwl_send_wimax_coex(struct iwl_priv *priv)
2385{ 2351{
2386 struct iwl_wimax_coex_cmd uninitialized_var(coex_cmd); 2352 struct iwl_wimax_coex_cmd coex_cmd;
2387 2353
2388 if (priv->cfg->support_wimax_coexist) { 2354 if (priv->cfg->support_wimax_coexist) {
2389 /* UnMask wake up src at associated sleep */ 2355 /* UnMask wake up src at associated sleep */
2390 coex_cmd.flags |= COEX_FLAGS_ASSOC_WA_UNMASK_MSK; 2356 coex_cmd.flags = COEX_FLAGS_ASSOC_WA_UNMASK_MSK;
2391 2357
2392 /* UnMask wake up src at unassociated sleep */ 2358 /* UnMask wake up src at unassociated sleep */
2393 coex_cmd.flags |= COEX_FLAGS_UNASSOC_WA_UNMASK_MSK; 2359 coex_cmd.flags |= COEX_FLAGS_UNASSOC_WA_UNMASK_MSK;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 6c3f0127f743..a0cc11ecbe93 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -90,6 +90,7 @@ struct iwl_hcmd_ops {
90 int (*commit_rxon)(struct iwl_priv *priv); 90 int (*commit_rxon)(struct iwl_priv *priv);
91 void (*set_rxon_chain)(struct iwl_priv *priv); 91 void (*set_rxon_chain)(struct iwl_priv *priv);
92 int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant); 92 int (*set_tx_ant)(struct iwl_priv *priv, u8 valid_tx_ant);
93 void (*send_bt_config)(struct iwl_priv *priv);
93}; 94};
94 95
95struct iwl_hcmd_utils_ops { 96struct iwl_hcmd_utils_ops {
@@ -105,6 +106,7 @@ struct iwl_hcmd_utils_ops {
105 __le32 *tx_flags); 106 __le32 *tx_flags);
106 int (*calc_rssi)(struct iwl_priv *priv, 107 int (*calc_rssi)(struct iwl_priv *priv,
107 struct iwl_rx_phy_res *rx_resp); 108 struct iwl_rx_phy_res *rx_resp);
109 void (*request_scan)(struct iwl_priv *priv);
108}; 110};
109 111
110struct iwl_apm_ops { 112struct iwl_apm_ops {
@@ -114,6 +116,15 @@ struct iwl_apm_ops {
114 int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); 116 int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src);
115}; 117};
116 118
119struct iwl_debugfs_ops {
120 ssize_t (*rx_stats_read)(struct file *file, char __user *user_buf,
121 size_t count, loff_t *ppos);
122 ssize_t (*tx_stats_read)(struct file *file, char __user *user_buf,
123 size_t count, loff_t *ppos);
124 ssize_t (*general_stats_read)(struct file *file, char __user *user_buf,
125 size_t count, loff_t *ppos);
126};
127
117struct iwl_temp_ops { 128struct iwl_temp_ops {
118 void (*temperature)(struct iwl_priv *priv); 129 void (*temperature)(struct iwl_priv *priv);
119 void (*set_ct_kill)(struct iwl_priv *priv); 130 void (*set_ct_kill)(struct iwl_priv *priv);
@@ -199,6 +210,7 @@ struct iwl_lib_ops {
199 /* check for ack health */ 210 /* check for ack health */
200 bool (*check_ack_health)(struct iwl_priv *priv, 211 bool (*check_ack_health)(struct iwl_priv *priv,
201 struct iwl_rx_packet *pkt); 212 struct iwl_rx_packet *pkt);
213 struct iwl_debugfs_ops debugfs_ops;
202}; 214};
203 215
204struct iwl_led_ops { 216struct iwl_led_ops {
@@ -306,8 +318,8 @@ struct iwl_cfg {
306 /* timer period for monitor the driver queues */ 318 /* timer period for monitor the driver queues */
307 u32 monitor_recover_period; 319 u32 monitor_recover_period;
308 bool temperature_kelvin; 320 bool temperature_kelvin;
309 bool off_channel_workaround;
310 u32 max_event_log_size; 321 u32 max_event_log_size;
322 u8 scan_antennas[IEEE80211_NUM_BANDS];
311}; 323};
312 324
313/*************************** 325/***************************
@@ -339,7 +351,6 @@ void iwl_configure_filter(struct ieee80211_hw *hw,
339 unsigned int changed_flags, 351 unsigned int changed_flags,
340 unsigned int *total_flags, u64 multicast); 352 unsigned int *total_flags, u64 multicast);
341int iwl_set_hw_params(struct iwl_priv *priv); 353int iwl_set_hw_params(struct iwl_priv *priv);
342bool iwl_is_monitor_mode(struct iwl_priv *priv);
343void iwl_post_associate(struct iwl_priv *priv); 354void iwl_post_associate(struct iwl_priv *priv);
344void iwl_bss_info_changed(struct ieee80211_hw *hw, 355void iwl_bss_info_changed(struct ieee80211_hw *hw,
345 struct ieee80211_vif *vif, 356 struct ieee80211_vif *vif,
@@ -526,6 +537,7 @@ void iwl_setup_scan_deferred_work(struct iwl_priv *priv);
526#define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */ 537#define IWL_ACTIVE_QUIET_TIME cpu_to_le16(10) /* msec */
527#define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */ 538#define IWL_PLCP_QUIET_THRESH cpu_to_le16(1) /* packets */
528 539
540#define IWL_SCAN_CHECK_WATCHDOG (HZ * 7)
529 541
530/******************************************************************************* 542/*******************************************************************************
531 * Calibrations - implemented in iwl-calib.c 543 * Calibrations - implemented in iwl-calib.c
@@ -665,7 +677,7 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv)
665} 677}
666 678
667extern void iwl_rf_kill_ct_config(struct iwl_priv *priv); 679extern void iwl_rf_kill_ct_config(struct iwl_priv *priv);
668extern int iwl_send_bt_config(struct iwl_priv *priv); 680extern void iwl_send_bt_config(struct iwl_priv *priv);
669extern int iwl_send_statistics_request(struct iwl_priv *priv, 681extern int iwl_send_statistics_request(struct iwl_priv *priv,
670 u8 flags, bool clear); 682 u8 flags, bool clear);
671extern int iwl_verify_ucode(struct iwl_priv *priv); 683extern int iwl_verify_ucode(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h
index 808b7146bead..254c35ae8b38 100644
--- a/drivers/net/wireless/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/iwlwifi/iwl-csr.h
@@ -298,6 +298,7 @@
298#define CSR_HW_REV_TYPE_1000 (0x0000060) 298#define CSR_HW_REV_TYPE_1000 (0x0000060)
299#define CSR_HW_REV_TYPE_6x00 (0x0000070) 299#define CSR_HW_REV_TYPE_6x00 (0x0000070)
300#define CSR_HW_REV_TYPE_6x50 (0x0000080) 300#define CSR_HW_REV_TYPE_6x50 (0x0000080)
301#define CSR_HW_REV_TYPE_6x00g2 (0x00000B0)
301#define CSR_HW_REV_TYPE_NONE (0x00000F0) 302#define CSR_HW_REV_TYPE_NONE (0x00000F0)
302 303
303/* EEPROM REG */ 304/* EEPROM REG */
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 1c7b53d511c7..5c2bcef5df0c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -78,6 +78,8 @@ static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
78#ifdef CONFIG_IWLWIFI_DEBUGFS 78#ifdef CONFIG_IWLWIFI_DEBUGFS
79int iwl_dbgfs_register(struct iwl_priv *priv, const char *name); 79int iwl_dbgfs_register(struct iwl_priv *priv, const char *name);
80void iwl_dbgfs_unregister(struct iwl_priv *priv); 80void iwl_dbgfs_unregister(struct iwl_priv *priv);
81extern int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf,
82 int bufsz);
81#else 83#else
82static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) 84static inline int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
83{ 85{
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 607a91f3eb6b..61faf2dd7fbe 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -106,6 +106,26 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \
106 .open = iwl_dbgfs_open_file_generic, \ 106 .open = iwl_dbgfs_open_file_generic, \
107}; 107};
108 108
109int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
110{
111 int p = 0;
112
113 p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
114 le32_to_cpu(priv->statistics.flag));
115 if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK)
116 p += scnprintf(buf + p, bufsz - p,
117 "\tStatistics have been cleared\n");
118 p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
119 (le32_to_cpu(priv->statistics.flag) &
120 UCODE_STATISTICS_FREQUENCY_MSK)
121 ? "2.4 GHz" : "5.2 GHz");
122 p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
123 (le32_to_cpu(priv->statistics.flag) &
124 UCODE_STATISTICS_NARROW_BAND_MSK)
125 ? "enabled" : "disabled");
126 return p;
127}
128EXPORT_SYMBOL(iwl_dbgfs_statistics_flag);
109 129
110static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, 130static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file,
111 char __user *user_buf, 131 char __user *user_buf,
@@ -1034,474 +1054,15 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
1034 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1054 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1035} 1055}
1036 1056
1037static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf,
1038 int bufsz)
1039{
1040 int p = 0;
1041
1042 p += scnprintf(buf + p, bufsz - p,
1043 "Statistics Flag(0x%X):\n",
1044 le32_to_cpu(priv->statistics.flag));
1045 if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK)
1046 p += scnprintf(buf + p, bufsz - p,
1047 "\tStatistics have been cleared\n");
1048 p += scnprintf(buf + p, bufsz - p,
1049 "\tOperational Frequency: %s\n",
1050 (le32_to_cpu(priv->statistics.flag) &
1051 UCODE_STATISTICS_FREQUENCY_MSK)
1052 ? "2.4 GHz" : "5.2 GHz");
1053 p += scnprintf(buf + p, bufsz - p,
1054 "\tTGj Narrow Band: %s\n",
1055 (le32_to_cpu(priv->statistics.flag) &
1056 UCODE_STATISTICS_NARROW_BAND_MSK)
1057 ? "enabled" : "disabled");
1058 return p;
1059}
1060
1061static const char ucode_stats_header[] =
1062 "%-32s current acumulative delta max\n";
1063static const char ucode_stats_short_format[] =
1064 " %-30s %10u\n";
1065static const char ucode_stats_format[] =
1066 " %-30s %10u %10u %10u %10u\n";
1067
1068static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, 1057static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file,
1069 char __user *user_buf, 1058 char __user *user_buf,
1070 size_t count, loff_t *ppos) 1059 size_t count, loff_t *ppos)
1071{ 1060{
1072 struct iwl_priv *priv = file->private_data; 1061 struct iwl_priv *priv = file->private_data;
1073 int pos = 0; 1062 if (priv->cfg->ops->lib->debugfs_ops.rx_stats_read)
1074 char *buf; 1063 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
1075 int bufsz = sizeof(struct statistics_rx_phy) * 40 + 1064 user_buf, count, ppos);
1076 sizeof(struct statistics_rx_non_phy) * 40 + 1065 return 0;
1077 sizeof(struct statistics_rx_ht_phy) * 40 + 400;
1078 ssize_t ret;
1079 struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm;
1080 struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck;
1081 struct statistics_rx_non_phy *general, *accum_general;
1082 struct statistics_rx_non_phy *delta_general, *max_general;
1083 struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht;
1084
1085 if (!iwl_is_alive(priv))
1086 return -EAGAIN;
1087
1088 buf = kzalloc(bufsz, GFP_KERNEL);
1089 if (!buf) {
1090 IWL_ERR(priv, "Can not allocate Buffer\n");
1091 return -ENOMEM;
1092 }
1093
1094 /* the statistic information display here is based on
1095 * the last statistics notification from uCode
1096 * might not reflect the current uCode activity
1097 */
1098 ofdm = &priv->statistics.rx.ofdm;
1099 cck = &priv->statistics.rx.cck;
1100 general = &priv->statistics.rx.general;
1101 ht = &priv->statistics.rx.ofdm_ht;
1102 accum_ofdm = &priv->accum_statistics.rx.ofdm;
1103 accum_cck = &priv->accum_statistics.rx.cck;
1104 accum_general = &priv->accum_statistics.rx.general;
1105 accum_ht = &priv->accum_statistics.rx.ofdm_ht;
1106 delta_ofdm = &priv->delta_statistics.rx.ofdm;
1107 delta_cck = &priv->delta_statistics.rx.cck;
1108 delta_general = &priv->delta_statistics.rx.general;
1109 delta_ht = &priv->delta_statistics.rx.ofdm_ht;
1110 max_ofdm = &priv->max_delta.rx.ofdm;
1111 max_cck = &priv->max_delta.rx.cck;
1112 max_general = &priv->max_delta.rx.general;
1113 max_ht = &priv->max_delta.rx.ofdm_ht;
1114
1115 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1116 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1117 "Statistics_Rx - OFDM:");
1118 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1119 "ina_cnt:", le32_to_cpu(ofdm->ina_cnt),
1120 accum_ofdm->ina_cnt,
1121 delta_ofdm->ina_cnt, max_ofdm->ina_cnt);
1122 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1123 "fina_cnt:",
1124 le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt,
1125 delta_ofdm->fina_cnt, max_ofdm->fina_cnt);
1126 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1127 "plcp_err:",
1128 le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err,
1129 delta_ofdm->plcp_err, max_ofdm->plcp_err);
1130 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1131 "crc32_err:",
1132 le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err,
1133 delta_ofdm->crc32_err, max_ofdm->crc32_err);
1134 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1135 "overrun_err:",
1136 le32_to_cpu(ofdm->overrun_err),
1137 accum_ofdm->overrun_err,
1138 delta_ofdm->overrun_err, max_ofdm->overrun_err);
1139 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1140 "early_overrun_err:",
1141 le32_to_cpu(ofdm->early_overrun_err),
1142 accum_ofdm->early_overrun_err,
1143 delta_ofdm->early_overrun_err,
1144 max_ofdm->early_overrun_err);
1145 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1146 "crc32_good:",
1147 le32_to_cpu(ofdm->crc32_good),
1148 accum_ofdm->crc32_good,
1149 delta_ofdm->crc32_good, max_ofdm->crc32_good);
1150 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1151 "false_alarm_cnt:",
1152 le32_to_cpu(ofdm->false_alarm_cnt),
1153 accum_ofdm->false_alarm_cnt,
1154 delta_ofdm->false_alarm_cnt,
1155 max_ofdm->false_alarm_cnt);
1156 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1157 "fina_sync_err_cnt:",
1158 le32_to_cpu(ofdm->fina_sync_err_cnt),
1159 accum_ofdm->fina_sync_err_cnt,
1160 delta_ofdm->fina_sync_err_cnt,
1161 max_ofdm->fina_sync_err_cnt);
1162 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1163 "sfd_timeout:",
1164 le32_to_cpu(ofdm->sfd_timeout),
1165 accum_ofdm->sfd_timeout,
1166 delta_ofdm->sfd_timeout,
1167 max_ofdm->sfd_timeout);
1168 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1169 "fina_timeout:",
1170 le32_to_cpu(ofdm->fina_timeout),
1171 accum_ofdm->fina_timeout,
1172 delta_ofdm->fina_timeout,
1173 max_ofdm->fina_timeout);
1174 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1175 "unresponded_rts:",
1176 le32_to_cpu(ofdm->unresponded_rts),
1177 accum_ofdm->unresponded_rts,
1178 delta_ofdm->unresponded_rts,
1179 max_ofdm->unresponded_rts);
1180 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1181 "rxe_frame_lmt_ovrun:",
1182 le32_to_cpu(ofdm->rxe_frame_limit_overrun),
1183 accum_ofdm->rxe_frame_limit_overrun,
1184 delta_ofdm->rxe_frame_limit_overrun,
1185 max_ofdm->rxe_frame_limit_overrun);
1186 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1187 "sent_ack_cnt:",
1188 le32_to_cpu(ofdm->sent_ack_cnt),
1189 accum_ofdm->sent_ack_cnt,
1190 delta_ofdm->sent_ack_cnt,
1191 max_ofdm->sent_ack_cnt);
1192 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1193 "sent_cts_cnt:",
1194 le32_to_cpu(ofdm->sent_cts_cnt),
1195 accum_ofdm->sent_cts_cnt,
1196 delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt);
1197 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1198 "sent_ba_rsp_cnt:",
1199 le32_to_cpu(ofdm->sent_ba_rsp_cnt),
1200 accum_ofdm->sent_ba_rsp_cnt,
1201 delta_ofdm->sent_ba_rsp_cnt,
1202 max_ofdm->sent_ba_rsp_cnt);
1203 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1204 "dsp_self_kill:",
1205 le32_to_cpu(ofdm->dsp_self_kill),
1206 accum_ofdm->dsp_self_kill,
1207 delta_ofdm->dsp_self_kill,
1208 max_ofdm->dsp_self_kill);
1209 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1210 "mh_format_err:",
1211 le32_to_cpu(ofdm->mh_format_err),
1212 accum_ofdm->mh_format_err,
1213 delta_ofdm->mh_format_err,
1214 max_ofdm->mh_format_err);
1215 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1216 "re_acq_main_rssi_sum:",
1217 le32_to_cpu(ofdm->re_acq_main_rssi_sum),
1218 accum_ofdm->re_acq_main_rssi_sum,
1219 delta_ofdm->re_acq_main_rssi_sum,
1220 max_ofdm->re_acq_main_rssi_sum);
1221
1222 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1223 "Statistics_Rx - CCK:");
1224 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1225 "ina_cnt:",
1226 le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt,
1227 delta_cck->ina_cnt, max_cck->ina_cnt);
1228 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1229 "fina_cnt:",
1230 le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt,
1231 delta_cck->fina_cnt, max_cck->fina_cnt);
1232 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1233 "plcp_err:",
1234 le32_to_cpu(cck->plcp_err), accum_cck->plcp_err,
1235 delta_cck->plcp_err, max_cck->plcp_err);
1236 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1237 "crc32_err:",
1238 le32_to_cpu(cck->crc32_err), accum_cck->crc32_err,
1239 delta_cck->crc32_err, max_cck->crc32_err);
1240 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1241 "overrun_err:",
1242 le32_to_cpu(cck->overrun_err),
1243 accum_cck->overrun_err,
1244 delta_cck->overrun_err, max_cck->overrun_err);
1245 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1246 "early_overrun_err:",
1247 le32_to_cpu(cck->early_overrun_err),
1248 accum_cck->early_overrun_err,
1249 delta_cck->early_overrun_err,
1250 max_cck->early_overrun_err);
1251 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1252 "crc32_good:",
1253 le32_to_cpu(cck->crc32_good), accum_cck->crc32_good,
1254 delta_cck->crc32_good,
1255 max_cck->crc32_good);
1256 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1257 "false_alarm_cnt:",
1258 le32_to_cpu(cck->false_alarm_cnt),
1259 accum_cck->false_alarm_cnt,
1260 delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt);
1261 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1262 "fina_sync_err_cnt:",
1263 le32_to_cpu(cck->fina_sync_err_cnt),
1264 accum_cck->fina_sync_err_cnt,
1265 delta_cck->fina_sync_err_cnt,
1266 max_cck->fina_sync_err_cnt);
1267 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1268 "sfd_timeout:",
1269 le32_to_cpu(cck->sfd_timeout),
1270 accum_cck->sfd_timeout,
1271 delta_cck->sfd_timeout, max_cck->sfd_timeout);
1272 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1273 "fina_timeout:",
1274 le32_to_cpu(cck->fina_timeout),
1275 accum_cck->fina_timeout,
1276 delta_cck->fina_timeout, max_cck->fina_timeout);
1277 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1278 "unresponded_rts:",
1279 le32_to_cpu(cck->unresponded_rts),
1280 accum_cck->unresponded_rts,
1281 delta_cck->unresponded_rts,
1282 max_cck->unresponded_rts);
1283 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1284 "rxe_frame_lmt_ovrun:",
1285 le32_to_cpu(cck->rxe_frame_limit_overrun),
1286 accum_cck->rxe_frame_limit_overrun,
1287 delta_cck->rxe_frame_limit_overrun,
1288 max_cck->rxe_frame_limit_overrun);
1289 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1290 "sent_ack_cnt:",
1291 le32_to_cpu(cck->sent_ack_cnt),
1292 accum_cck->sent_ack_cnt,
1293 delta_cck->sent_ack_cnt,
1294 max_cck->sent_ack_cnt);
1295 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1296 "sent_cts_cnt:",
1297 le32_to_cpu(cck->sent_cts_cnt),
1298 accum_cck->sent_cts_cnt,
1299 delta_cck->sent_cts_cnt,
1300 max_cck->sent_cts_cnt);
1301 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1302 "sent_ba_rsp_cnt:",
1303 le32_to_cpu(cck->sent_ba_rsp_cnt),
1304 accum_cck->sent_ba_rsp_cnt,
1305 delta_cck->sent_ba_rsp_cnt,
1306 max_cck->sent_ba_rsp_cnt);
1307 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1308 "dsp_self_kill:",
1309 le32_to_cpu(cck->dsp_self_kill),
1310 accum_cck->dsp_self_kill,
1311 delta_cck->dsp_self_kill,
1312 max_cck->dsp_self_kill);
1313 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1314 "mh_format_err:",
1315 le32_to_cpu(cck->mh_format_err),
1316 accum_cck->mh_format_err,
1317 delta_cck->mh_format_err, max_cck->mh_format_err);
1318 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1319 "re_acq_main_rssi_sum:",
1320 le32_to_cpu(cck->re_acq_main_rssi_sum),
1321 accum_cck->re_acq_main_rssi_sum,
1322 delta_cck->re_acq_main_rssi_sum,
1323 max_cck->re_acq_main_rssi_sum);
1324
1325 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1326 "Statistics_Rx - GENERAL:");
1327 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1328 "bogus_cts:",
1329 le32_to_cpu(general->bogus_cts),
1330 accum_general->bogus_cts,
1331 delta_general->bogus_cts, max_general->bogus_cts);
1332 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1333 "bogus_ack:",
1334 le32_to_cpu(general->bogus_ack),
1335 accum_general->bogus_ack,
1336 delta_general->bogus_ack, max_general->bogus_ack);
1337 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1338 "non_bssid_frames:",
1339 le32_to_cpu(general->non_bssid_frames),
1340 accum_general->non_bssid_frames,
1341 delta_general->non_bssid_frames,
1342 max_general->non_bssid_frames);
1343 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1344 "filtered_frames:",
1345 le32_to_cpu(general->filtered_frames),
1346 accum_general->filtered_frames,
1347 delta_general->filtered_frames,
1348 max_general->filtered_frames);
1349 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1350 "non_channel_beacons:",
1351 le32_to_cpu(general->non_channel_beacons),
1352 accum_general->non_channel_beacons,
1353 delta_general->non_channel_beacons,
1354 max_general->non_channel_beacons);
1355 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1356 "channel_beacons:",
1357 le32_to_cpu(general->channel_beacons),
1358 accum_general->channel_beacons,
1359 delta_general->channel_beacons,
1360 max_general->channel_beacons);
1361 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1362 "num_missed_bcon:",
1363 le32_to_cpu(general->num_missed_bcon),
1364 accum_general->num_missed_bcon,
1365 delta_general->num_missed_bcon,
1366 max_general->num_missed_bcon);
1367 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1368 "adc_rx_saturation_time:",
1369 le32_to_cpu(general->adc_rx_saturation_time),
1370 accum_general->adc_rx_saturation_time,
1371 delta_general->adc_rx_saturation_time,
1372 max_general->adc_rx_saturation_time);
1373 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1374 "ina_detect_search_tm:",
1375 le32_to_cpu(general->ina_detection_search_time),
1376 accum_general->ina_detection_search_time,
1377 delta_general->ina_detection_search_time,
1378 max_general->ina_detection_search_time);
1379 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1380 "beacon_silence_rssi_a:",
1381 le32_to_cpu(general->beacon_silence_rssi_a),
1382 accum_general->beacon_silence_rssi_a,
1383 delta_general->beacon_silence_rssi_a,
1384 max_general->beacon_silence_rssi_a);
1385 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1386 "beacon_silence_rssi_b:",
1387 le32_to_cpu(general->beacon_silence_rssi_b),
1388 accum_general->beacon_silence_rssi_b,
1389 delta_general->beacon_silence_rssi_b,
1390 max_general->beacon_silence_rssi_b);
1391 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1392 "beacon_silence_rssi_c:",
1393 le32_to_cpu(general->beacon_silence_rssi_c),
1394 accum_general->beacon_silence_rssi_c,
1395 delta_general->beacon_silence_rssi_c,
1396 max_general->beacon_silence_rssi_c);
1397 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1398 "interference_data_flag:",
1399 le32_to_cpu(general->interference_data_flag),
1400 accum_general->interference_data_flag,
1401 delta_general->interference_data_flag,
1402 max_general->interference_data_flag);
1403 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1404 "channel_load:",
1405 le32_to_cpu(general->channel_load),
1406 accum_general->channel_load,
1407 delta_general->channel_load,
1408 max_general->channel_load);
1409 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1410 "dsp_false_alarms:",
1411 le32_to_cpu(general->dsp_false_alarms),
1412 accum_general->dsp_false_alarms,
1413 delta_general->dsp_false_alarms,
1414 max_general->dsp_false_alarms);
1415 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1416 "beacon_rssi_a:",
1417 le32_to_cpu(general->beacon_rssi_a),
1418 accum_general->beacon_rssi_a,
1419 delta_general->beacon_rssi_a,
1420 max_general->beacon_rssi_a);
1421 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1422 "beacon_rssi_b:",
1423 le32_to_cpu(general->beacon_rssi_b),
1424 accum_general->beacon_rssi_b,
1425 delta_general->beacon_rssi_b,
1426 max_general->beacon_rssi_b);
1427 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1428 "beacon_rssi_c:",
1429 le32_to_cpu(general->beacon_rssi_c),
1430 accum_general->beacon_rssi_c,
1431 delta_general->beacon_rssi_c,
1432 max_general->beacon_rssi_c);
1433 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1434 "beacon_energy_a:",
1435 le32_to_cpu(general->beacon_energy_a),
1436 accum_general->beacon_energy_a,
1437 delta_general->beacon_energy_a,
1438 max_general->beacon_energy_a);
1439 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1440 "beacon_energy_b:",
1441 le32_to_cpu(general->beacon_energy_b),
1442 accum_general->beacon_energy_b,
1443 delta_general->beacon_energy_b,
1444 max_general->beacon_energy_b);
1445 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1446 "beacon_energy_c:",
1447 le32_to_cpu(general->beacon_energy_c),
1448 accum_general->beacon_energy_c,
1449 delta_general->beacon_energy_c,
1450 max_general->beacon_energy_c);
1451
1452 pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n");
1453 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1454 "Statistics_Rx - OFDM_HT:");
1455 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1456 "plcp_err:",
1457 le32_to_cpu(ht->plcp_err), accum_ht->plcp_err,
1458 delta_ht->plcp_err, max_ht->plcp_err);
1459 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1460 "overrun_err:",
1461 le32_to_cpu(ht->overrun_err), accum_ht->overrun_err,
1462 delta_ht->overrun_err, max_ht->overrun_err);
1463 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1464 "early_overrun_err:",
1465 le32_to_cpu(ht->early_overrun_err),
1466 accum_ht->early_overrun_err,
1467 delta_ht->early_overrun_err,
1468 max_ht->early_overrun_err);
1469 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1470 "crc32_good:",
1471 le32_to_cpu(ht->crc32_good), accum_ht->crc32_good,
1472 delta_ht->crc32_good, max_ht->crc32_good);
1473 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1474 "crc32_err:",
1475 le32_to_cpu(ht->crc32_err), accum_ht->crc32_err,
1476 delta_ht->crc32_err, max_ht->crc32_err);
1477 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1478 "mh_format_err:",
1479 le32_to_cpu(ht->mh_format_err),
1480 accum_ht->mh_format_err,
1481 delta_ht->mh_format_err, max_ht->mh_format_err);
1482 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1483 "agg_crc32_good:",
1484 le32_to_cpu(ht->agg_crc32_good),
1485 accum_ht->agg_crc32_good,
1486 delta_ht->agg_crc32_good, max_ht->agg_crc32_good);
1487 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1488 "agg_mpdu_cnt:",
1489 le32_to_cpu(ht->agg_mpdu_cnt),
1490 accum_ht->agg_mpdu_cnt,
1491 delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt);
1492 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1493 "agg_cnt:",
1494 le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt,
1495 delta_ht->agg_cnt, max_ht->agg_cnt);
1496 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1497 "unsupport_mcs:",
1498 le32_to_cpu(ht->unsupport_mcs),
1499 accum_ht->unsupport_mcs,
1500 delta_ht->unsupport_mcs, max_ht->unsupport_mcs);
1501
1502 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1503 kfree(buf);
1504 return ret;
1505} 1066}
1506 1067
1507static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, 1068static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
@@ -1509,173 +1070,10 @@ static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file,
1509 size_t count, loff_t *ppos) 1070 size_t count, loff_t *ppos)
1510{ 1071{
1511 struct iwl_priv *priv = file->private_data; 1072 struct iwl_priv *priv = file->private_data;
1512 int pos = 0; 1073 if (priv->cfg->ops->lib->debugfs_ops.tx_stats_read)
1513 char *buf; 1074 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
1514 int bufsz = (sizeof(struct statistics_tx) * 48) + 250; 1075 user_buf, count, ppos);
1515 ssize_t ret; 1076 return 0;
1516 struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;
1517
1518 if (!iwl_is_alive(priv))
1519 return -EAGAIN;
1520
1521 buf = kzalloc(bufsz, GFP_KERNEL);
1522 if (!buf) {
1523 IWL_ERR(priv, "Can not allocate Buffer\n");
1524 return -ENOMEM;
1525 }
1526
1527 /* the statistic information display here is based on
1528 * the last statistics notification from uCode
1529 * might not reflect the current uCode activity
1530 */
1531 tx = &priv->statistics.tx;
1532 accum_tx = &priv->accum_statistics.tx;
1533 delta_tx = &priv->delta_statistics.tx;
1534 max_tx = &priv->max_delta.tx;
1535 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1536 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1537 "Statistics_Tx:");
1538 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1539 "preamble:",
1540 le32_to_cpu(tx->preamble_cnt),
1541 accum_tx->preamble_cnt,
1542 delta_tx->preamble_cnt, max_tx->preamble_cnt);
1543 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1544 "rx_detected_cnt:",
1545 le32_to_cpu(tx->rx_detected_cnt),
1546 accum_tx->rx_detected_cnt,
1547 delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt);
1548 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1549 "bt_prio_defer_cnt:",
1550 le32_to_cpu(tx->bt_prio_defer_cnt),
1551 accum_tx->bt_prio_defer_cnt,
1552 delta_tx->bt_prio_defer_cnt,
1553 max_tx->bt_prio_defer_cnt);
1554 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1555 "bt_prio_kill_cnt:",
1556 le32_to_cpu(tx->bt_prio_kill_cnt),
1557 accum_tx->bt_prio_kill_cnt,
1558 delta_tx->bt_prio_kill_cnt,
1559 max_tx->bt_prio_kill_cnt);
1560 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1561 "few_bytes_cnt:",
1562 le32_to_cpu(tx->few_bytes_cnt),
1563 accum_tx->few_bytes_cnt,
1564 delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt);
1565 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1566 "cts_timeout:",
1567 le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout,
1568 delta_tx->cts_timeout, max_tx->cts_timeout);
1569 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1570 "ack_timeout:",
1571 le32_to_cpu(tx->ack_timeout),
1572 accum_tx->ack_timeout,
1573 delta_tx->ack_timeout, max_tx->ack_timeout);
1574 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1575 "expected_ack_cnt:",
1576 le32_to_cpu(tx->expected_ack_cnt),
1577 accum_tx->expected_ack_cnt,
1578 delta_tx->expected_ack_cnt,
1579 max_tx->expected_ack_cnt);
1580 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1581 "actual_ack_cnt:",
1582 le32_to_cpu(tx->actual_ack_cnt),
1583 accum_tx->actual_ack_cnt,
1584 delta_tx->actual_ack_cnt,
1585 max_tx->actual_ack_cnt);
1586 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1587 "dump_msdu_cnt:",
1588 le32_to_cpu(tx->dump_msdu_cnt),
1589 accum_tx->dump_msdu_cnt,
1590 delta_tx->dump_msdu_cnt,
1591 max_tx->dump_msdu_cnt);
1592 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1593 "abort_nxt_frame_mismatch:",
1594 le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt),
1595 accum_tx->burst_abort_next_frame_mismatch_cnt,
1596 delta_tx->burst_abort_next_frame_mismatch_cnt,
1597 max_tx->burst_abort_next_frame_mismatch_cnt);
1598 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1599 "abort_missing_nxt_frame:",
1600 le32_to_cpu(tx->burst_abort_missing_next_frame_cnt),
1601 accum_tx->burst_abort_missing_next_frame_cnt,
1602 delta_tx->burst_abort_missing_next_frame_cnt,
1603 max_tx->burst_abort_missing_next_frame_cnt);
1604 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1605 "cts_timeout_collision:",
1606 le32_to_cpu(tx->cts_timeout_collision),
1607 accum_tx->cts_timeout_collision,
1608 delta_tx->cts_timeout_collision,
1609 max_tx->cts_timeout_collision);
1610 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1611 "ack_ba_timeout_collision:",
1612 le32_to_cpu(tx->ack_or_ba_timeout_collision),
1613 accum_tx->ack_or_ba_timeout_collision,
1614 delta_tx->ack_or_ba_timeout_collision,
1615 max_tx->ack_or_ba_timeout_collision);
1616 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1617 "agg ba_timeout:",
1618 le32_to_cpu(tx->agg.ba_timeout),
1619 accum_tx->agg.ba_timeout,
1620 delta_tx->agg.ba_timeout,
1621 max_tx->agg.ba_timeout);
1622 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1623 "agg ba_resched_frames:",
1624 le32_to_cpu(tx->agg.ba_reschedule_frames),
1625 accum_tx->agg.ba_reschedule_frames,
1626 delta_tx->agg.ba_reschedule_frames,
1627 max_tx->agg.ba_reschedule_frames);
1628 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1629 "agg scd_query_agg_frame:",
1630 le32_to_cpu(tx->agg.scd_query_agg_frame_cnt),
1631 accum_tx->agg.scd_query_agg_frame_cnt,
1632 delta_tx->agg.scd_query_agg_frame_cnt,
1633 max_tx->agg.scd_query_agg_frame_cnt);
1634 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1635 "agg scd_query_no_agg:",
1636 le32_to_cpu(tx->agg.scd_query_no_agg),
1637 accum_tx->agg.scd_query_no_agg,
1638 delta_tx->agg.scd_query_no_agg,
1639 max_tx->agg.scd_query_no_agg);
1640 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1641 "agg scd_query_agg:",
1642 le32_to_cpu(tx->agg.scd_query_agg),
1643 accum_tx->agg.scd_query_agg,
1644 delta_tx->agg.scd_query_agg,
1645 max_tx->agg.scd_query_agg);
1646 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1647 "agg scd_query_mismatch:",
1648 le32_to_cpu(tx->agg.scd_query_mismatch),
1649 accum_tx->agg.scd_query_mismatch,
1650 delta_tx->agg.scd_query_mismatch,
1651 max_tx->agg.scd_query_mismatch);
1652 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1653 "agg frame_not_ready:",
1654 le32_to_cpu(tx->agg.frame_not_ready),
1655 accum_tx->agg.frame_not_ready,
1656 delta_tx->agg.frame_not_ready,
1657 max_tx->agg.frame_not_ready);
1658 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1659 "agg underrun:",
1660 le32_to_cpu(tx->agg.underrun),
1661 accum_tx->agg.underrun,
1662 delta_tx->agg.underrun, max_tx->agg.underrun);
1663 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1664 "agg bt_prio_kill:",
1665 le32_to_cpu(tx->agg.bt_prio_kill),
1666 accum_tx->agg.bt_prio_kill,
1667 delta_tx->agg.bt_prio_kill,
1668 max_tx->agg.bt_prio_kill);
1669 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1670 "agg rx_ba_rsp_cnt:",
1671 le32_to_cpu(tx->agg.rx_ba_rsp_cnt),
1672 accum_tx->agg.rx_ba_rsp_cnt,
1673 delta_tx->agg.rx_ba_rsp_cnt,
1674 max_tx->agg.rx_ba_rsp_cnt);
1675
1676 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1677 kfree(buf);
1678 return ret;
1679} 1077}
1680 1078
1681static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, 1079static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
@@ -1683,107 +1081,10 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1683 size_t count, loff_t *ppos) 1081 size_t count, loff_t *ppos)
1684{ 1082{
1685 struct iwl_priv *priv = file->private_data; 1083 struct iwl_priv *priv = file->private_data;
1686 int pos = 0; 1084 if (priv->cfg->ops->lib->debugfs_ops.general_stats_read)
1687 char *buf; 1085 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file,
1688 int bufsz = sizeof(struct statistics_general) * 10 + 300; 1086 user_buf, count, ppos);
1689 ssize_t ret; 1087 return 0;
1690 struct statistics_general *general, *accum_general;
1691 struct statistics_general *delta_general, *max_general;
1692 struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
1693 struct statistics_div *div, *accum_div, *delta_div, *max_div;
1694
1695 if (!iwl_is_alive(priv))
1696 return -EAGAIN;
1697
1698 buf = kzalloc(bufsz, GFP_KERNEL);
1699 if (!buf) {
1700 IWL_ERR(priv, "Can not allocate Buffer\n");
1701 return -ENOMEM;
1702 }
1703
1704 /* the statistic information display here is based on
1705 * the last statistics notification from uCode
1706 * might not reflect the current uCode activity
1707 */
1708 general = &priv->statistics.general;
1709 dbg = &priv->statistics.general.dbg;
1710 div = &priv->statistics.general.div;
1711 accum_general = &priv->accum_statistics.general;
1712 delta_general = &priv->delta_statistics.general;
1713 max_general = &priv->max_delta.general;
1714 accum_dbg = &priv->accum_statistics.general.dbg;
1715 delta_dbg = &priv->delta_statistics.general.dbg;
1716 max_dbg = &priv->max_delta.general.dbg;
1717 accum_div = &priv->accum_statistics.general.div;
1718 delta_div = &priv->delta_statistics.general.div;
1719 max_div = &priv->max_delta.general.div;
1720 pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz);
1721 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header,
1722 "Statistics_General:");
1723 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format,
1724 "temperature:",
1725 le32_to_cpu(general->temperature));
1726 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format,
1727 "temperature_m:",
1728 le32_to_cpu(general->temperature_m));
1729 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1730 "burst_check:",
1731 le32_to_cpu(dbg->burst_check),
1732 accum_dbg->burst_check,
1733 delta_dbg->burst_check, max_dbg->burst_check);
1734 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1735 "burst_count:",
1736 le32_to_cpu(dbg->burst_count),
1737 accum_dbg->burst_count,
1738 delta_dbg->burst_count, max_dbg->burst_count);
1739 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1740 "sleep_time:",
1741 le32_to_cpu(general->sleep_time),
1742 accum_general->sleep_time,
1743 delta_general->sleep_time, max_general->sleep_time);
1744 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1745 "slots_out:",
1746 le32_to_cpu(general->slots_out),
1747 accum_general->slots_out,
1748 delta_general->slots_out, max_general->slots_out);
1749 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1750 "slots_idle:",
1751 le32_to_cpu(general->slots_idle),
1752 accum_general->slots_idle,
1753 delta_general->slots_idle, max_general->slots_idle);
1754 pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n",
1755 le32_to_cpu(general->ttl_timestamp));
1756 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1757 "tx_on_a:",
1758 le32_to_cpu(div->tx_on_a), accum_div->tx_on_a,
1759 delta_div->tx_on_a, max_div->tx_on_a);
1760 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1761 "tx_on_b:",
1762 le32_to_cpu(div->tx_on_b), accum_div->tx_on_b,
1763 delta_div->tx_on_b, max_div->tx_on_b);
1764 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1765 "exec_time:",
1766 le32_to_cpu(div->exec_time), accum_div->exec_time,
1767 delta_div->exec_time, max_div->exec_time);
1768 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1769 "probe_time:",
1770 le32_to_cpu(div->probe_time), accum_div->probe_time,
1771 delta_div->probe_time, max_div->probe_time);
1772 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1773 "rx_enable_counter:",
1774 le32_to_cpu(general->rx_enable_counter),
1775 accum_general->rx_enable_counter,
1776 delta_general->rx_enable_counter,
1777 max_general->rx_enable_counter);
1778 pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format,
1779 "num_of_sos_states:",
1780 le32_to_cpu(general->num_of_sos_states),
1781 accum_general->num_of_sos_states,
1782 delta_general->num_of_sos_states,
1783 max_general->num_of_sos_states);
1784 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1785 kfree(buf);
1786 return ret;
1787} 1088}
1788 1089
1789static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, 1090static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
@@ -2341,10 +1642,11 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2341 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); 1642 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
2342 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); 1643 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR);
2343 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); 1644 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR);
1645 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
1646 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
1647 DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
1648
2344 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { 1649 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) {
2345 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
2346 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
2347 DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
2348 DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); 1650 DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR);
2349 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); 1651 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR);
2350 DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); 1652 DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index b2d94c7c6457..bdc60aae75ec 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -58,7 +58,7 @@ extern struct iwl_cfg iwl5100_abg_cfg;
58extern struct iwl_cfg iwl5150_agn_cfg; 58extern struct iwl_cfg iwl5150_agn_cfg;
59extern struct iwl_cfg iwl5150_abg_cfg; 59extern struct iwl_cfg iwl5150_abg_cfg;
60extern struct iwl_cfg iwl6000i_2agn_cfg; 60extern struct iwl_cfg iwl6000i_2agn_cfg;
61extern struct iwl_cfg iwl6000i_g2_2agn_cfg; 61extern struct iwl_cfg iwl6000g2_2agn_cfg;
62extern struct iwl_cfg iwl6000i_2abg_cfg; 62extern struct iwl_cfg iwl6000i_2abg_cfg;
63extern struct iwl_cfg iwl6000i_2bg_cfg; 63extern struct iwl_cfg iwl6000i_2bg_cfg;
64extern struct iwl_cfg iwl6000_3agn_cfg; 64extern struct iwl_cfg iwl6000_3agn_cfg;
@@ -1049,12 +1049,10 @@ struct iwl_priv {
1049 struct iwl_calib_result calib_results[IWL_CALIB_MAX]; 1049 struct iwl_calib_result calib_results[IWL_CALIB_MAX];
1050 1050
1051 /* Scan related variables */ 1051 /* Scan related variables */
1052 unsigned long next_scan_jiffies;
1053 unsigned long scan_start; 1052 unsigned long scan_start;
1054 unsigned long scan_pass_start;
1055 unsigned long scan_start_tsf; 1053 unsigned long scan_start_tsf;
1056 void *scan; 1054 void *scan_cmd;
1057 int scan_bands; 1055 enum ieee80211_band scan_band;
1058 struct cfg80211_scan_request *scan_request; 1056 struct cfg80211_scan_request *scan_request;
1059 bool is_internal_short_scan; 1057 bool is_internal_short_scan;
1060 u8 scan_tx_ant[IEEE80211_NUM_BANDS]; 1058 u8 scan_tx_ant[IEEE80211_NUM_BANDS];
@@ -1259,7 +1257,6 @@ struct iwl_priv {
1259 struct work_struct scan_completed; 1257 struct work_struct scan_completed;
1260 struct work_struct rx_replenish; 1258 struct work_struct rx_replenish;
1261 struct work_struct abort_scan; 1259 struct work_struct abort_scan;
1262 struct work_struct request_scan;
1263 struct work_struct beacon_update; 1260 struct work_struct beacon_update;
1264 struct work_struct tt_work; 1261 struct work_struct tt_work;
1265 struct work_struct ct_enter; 1262 struct work_struct ct_enter;
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
index ef0e3256eec2..95aa202c85e3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
@@ -172,22 +172,22 @@ struct iwl_eeprom_enhanced_txpwr {
172#define EEPROM_5000_TX_POWER_VERSION (4) 172#define EEPROM_5000_TX_POWER_VERSION (4)
173#define EEPROM_5000_EEPROM_VERSION (0x11A) 173#define EEPROM_5000_EEPROM_VERSION (0x11A)
174 174
175/*5000 calibrations */ 175/* 5000 and up calibration */
176#define EEPROM_5000_CALIB_ALL (INDIRECT_ADDRESS | INDIRECT_CALIBRATION) 176#define EEPROM_CALIB_ALL (INDIRECT_ADDRESS | INDIRECT_CALIBRATION)
177#define EEPROM_5000_XTAL ((2*0x128) | EEPROM_5000_CALIB_ALL) 177#define EEPROM_XTAL ((2*0x128) | EEPROM_CALIB_ALL)
178#define EEPROM_5000_TEMPERATURE ((2*0x12A) | EEPROM_5000_CALIB_ALL) 178
179 179/* 5000 temperature */
180/* 5000 links */ 180#define EEPROM_5000_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL)
181#define EEPROM_5000_LINK_HOST (2*0x64) 181
182#define EEPROM_5000_LINK_GENERAL (2*0x65) 182/* agn links */
183#define EEPROM_5000_LINK_REGULATORY (2*0x66) 183#define EEPROM_LINK_HOST (2*0x64)
184#define EEPROM_5000_LINK_CALIBRATION (2*0x67) 184#define EEPROM_LINK_GENERAL (2*0x65)
185#define EEPROM_5000_LINK_PROCESS_ADJST (2*0x68) 185#define EEPROM_LINK_REGULATORY (2*0x66)
186#define EEPROM_5000_LINK_OTHERS (2*0x69) 186#define EEPROM_LINK_CALIBRATION (2*0x67)
187 187#define EEPROM_LINK_PROCESS_ADJST (2*0x68)
188/* 5000 regulatory - indirect access */ 188#define EEPROM_LINK_OTHERS (2*0x69)
189#define EEPROM_5000_REG_SKU_ID ((0x02)\ 189
190 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 4 bytes */ 190/* agn regulatory - indirect access */
191#define EEPROM_REG_BAND_1_CHANNELS ((0x08)\ 191#define EEPROM_REG_BAND_1_CHANNELS ((0x08)\
192 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 28 bytes */ 192 | INDIRECT_ADDRESS | INDIRECT_REGULATORY) /* 28 bytes */
193#define EEPROM_REG_BAND_2_CHANNELS ((0x26)\ 193#define EEPROM_REG_BAND_2_CHANNELS ((0x26)\
@@ -276,6 +276,10 @@ struct iwl_eeprom_enhanced_txpwr {
276#define EEPROM_6050_TX_POWER_VERSION (4) 276#define EEPROM_6050_TX_POWER_VERSION (4)
277#define EEPROM_6050_EEPROM_VERSION (0x532) 277#define EEPROM_6050_EEPROM_VERSION (0x532)
278 278
279/* 6x00g2 Specific */
280#define EEPROM_6000G2_TX_POWER_VERSION (6)
281#define EEPROM_6000G2_EEPROM_VERSION (0x709)
282
279/* OTP */ 283/* OTP */
280/* lower blocks contain EEPROM image and calibration data */ 284/* lower blocks contain EEPROM image and calibration data */
281#define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ 285#define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
index 5944de7a98a2..b1f101caf19d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-prph.h
+++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
@@ -529,48 +529,48 @@
529#define IWL_SCD_TXFIFO_POS_RA (4) 529#define IWL_SCD_TXFIFO_POS_RA (4)
530#define IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF) 530#define IWL_SCD_QUEUE_RA_TID_MAP_RATID_MSK (0x01FF)
531 531
532/* 5000 SCD */ 532/* agn SCD */
533#define IWL50_SCD_QUEUE_STTS_REG_POS_TXF (0) 533#define IWLAGN_SCD_QUEUE_STTS_REG_POS_TXF (0)
534#define IWL50_SCD_QUEUE_STTS_REG_POS_ACTIVE (3) 534#define IWLAGN_SCD_QUEUE_STTS_REG_POS_ACTIVE (3)
535#define IWL50_SCD_QUEUE_STTS_REG_POS_WSL (4) 535#define IWLAGN_SCD_QUEUE_STTS_REG_POS_WSL (4)
536#define IWL50_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (19) 536#define IWLAGN_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN (19)
537#define IWL50_SCD_QUEUE_STTS_REG_MSK (0x00FF0000) 537#define IWLAGN_SCD_QUEUE_STTS_REG_MSK (0x00FF0000)
538 538
539#define IWL50_SCD_QUEUE_CTX_REG1_CREDIT_POS (8) 539#define IWLAGN_SCD_QUEUE_CTX_REG1_CREDIT_POS (8)
540#define IWL50_SCD_QUEUE_CTX_REG1_CREDIT_MSK (0x00FFFF00) 540#define IWLAGN_SCD_QUEUE_CTX_REG1_CREDIT_MSK (0x00FFFF00)
541#define IWL50_SCD_QUEUE_CTX_REG1_SUPER_CREDIT_POS (24) 541#define IWLAGN_SCD_QUEUE_CTX_REG1_SUPER_CREDIT_POS (24)
542#define IWL50_SCD_QUEUE_CTX_REG1_SUPER_CREDIT_MSK (0xFF000000) 542#define IWLAGN_SCD_QUEUE_CTX_REG1_SUPER_CREDIT_MSK (0xFF000000)
543#define IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS (0) 543#define IWLAGN_SCD_QUEUE_CTX_REG2_WIN_SIZE_POS (0)
544#define IWL50_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK (0x0000007F) 544#define IWLAGN_SCD_QUEUE_CTX_REG2_WIN_SIZE_MSK (0x0000007F)
545#define IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16) 545#define IWLAGN_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_POS (16)
546#define IWL50_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000) 546#define IWLAGN_SCD_QUEUE_CTX_REG2_FRAME_LIMIT_MSK (0x007F0000)
547 547
548#define IWL50_SCD_CONTEXT_DATA_OFFSET (0x600) 548#define IWLAGN_SCD_CONTEXT_DATA_OFFSET (0x600)
549#define IWL50_SCD_TX_STTS_BITMAP_OFFSET (0x7B1) 549#define IWLAGN_SCD_TX_STTS_BITMAP_OFFSET (0x7B1)
550#define IWL50_SCD_TRANSLATE_TBL_OFFSET (0x7E0) 550#define IWLAGN_SCD_TRANSLATE_TBL_OFFSET (0x7E0)
551 551
552#define IWL50_SCD_CONTEXT_QUEUE_OFFSET(x)\ 552#define IWLAGN_SCD_CONTEXT_QUEUE_OFFSET(x)\
553 (IWL50_SCD_CONTEXT_DATA_OFFSET + ((x) * 8)) 553 (IWLAGN_SCD_CONTEXT_DATA_OFFSET + ((x) * 8))
554 554
555#define IWL50_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \ 555#define IWLAGN_SCD_TRANSLATE_TBL_OFFSET_QUEUE(x) \
556 ((IWL50_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffc) 556 ((IWLAGN_SCD_TRANSLATE_TBL_OFFSET + ((x) * 2)) & 0xfffc)
557 557
558#define IWL50_SCD_QUEUECHAIN_SEL_ALL(x) (((1<<(x)) - 1) &\ 558#define IWLAGN_SCD_QUEUECHAIN_SEL_ALL(x) (((1<<(x)) - 1) &\
559 (~(1<<IWL_CMD_QUEUE_NUM))) 559 (~(1<<IWL_CMD_QUEUE_NUM)))
560 560
561#define IWL50_SCD_BASE (PRPH_BASE + 0xa02c00) 561#define IWLAGN_SCD_BASE (PRPH_BASE + 0xa02c00)
562 562
563#define IWL50_SCD_SRAM_BASE_ADDR (IWL50_SCD_BASE + 0x0) 563#define IWLAGN_SCD_SRAM_BASE_ADDR (IWLAGN_SCD_BASE + 0x0)
564#define IWL50_SCD_DRAM_BASE_ADDR (IWL50_SCD_BASE + 0x8) 564#define IWLAGN_SCD_DRAM_BASE_ADDR (IWLAGN_SCD_BASE + 0x8)
565#define IWL50_SCD_AIT (IWL50_SCD_BASE + 0x0c) 565#define IWLAGN_SCD_AIT (IWLAGN_SCD_BASE + 0x0c)
566#define IWL50_SCD_TXFACT (IWL50_SCD_BASE + 0x10) 566#define IWLAGN_SCD_TXFACT (IWLAGN_SCD_BASE + 0x10)
567#define IWL50_SCD_ACTIVE (IWL50_SCD_BASE + 0x14) 567#define IWLAGN_SCD_ACTIVE (IWLAGN_SCD_BASE + 0x14)
568#define IWL50_SCD_QUEUE_WRPTR(x) (IWL50_SCD_BASE + 0x18 + (x) * 4) 568#define IWLAGN_SCD_QUEUE_WRPTR(x) (IWLAGN_SCD_BASE + 0x18 + (x) * 4)
569#define IWL50_SCD_QUEUE_RDPTR(x) (IWL50_SCD_BASE + 0x68 + (x) * 4) 569#define IWLAGN_SCD_QUEUE_RDPTR(x) (IWLAGN_SCD_BASE + 0x68 + (x) * 4)
570#define IWL50_SCD_QUEUECHAIN_SEL (IWL50_SCD_BASE + 0xe8) 570#define IWLAGN_SCD_QUEUECHAIN_SEL (IWLAGN_SCD_BASE + 0xe8)
571#define IWL50_SCD_AGGR_SEL (IWL50_SCD_BASE + 0x248) 571#define IWLAGN_SCD_AGGR_SEL (IWLAGN_SCD_BASE + 0x248)
572#define IWL50_SCD_INTERRUPT_MASK (IWL50_SCD_BASE + 0x108) 572#define IWLAGN_SCD_INTERRUPT_MASK (IWLAGN_SCD_BASE + 0x108)
573#define IWL50_SCD_QUEUE_STATUS_BITS(x) (IWL50_SCD_BASE + 0x10c + (x) * 4) 573#define IWLAGN_SCD_QUEUE_STATUS_BITS(x) (IWLAGN_SCD_BASE + 0x10c + (x) * 4)
574 574
575/*********************** END TX SCHEDULER *************************************/ 575/*********************** END TX SCHEDULER *************************************/
576 576
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index de0446d4bfe9..f4b897804a80 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -69,9 +69,8 @@ int iwl_scan_cancel(struct iwl_priv *priv)
69 } 69 }
70 70
71 if (test_bit(STATUS_SCANNING, &priv->status)) { 71 if (test_bit(STATUS_SCANNING, &priv->status)) {
72 if (!test_bit(STATUS_SCAN_ABORTING, &priv->status)) { 72 if (!test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) {
73 IWL_DEBUG_SCAN(priv, "Queuing scan abort.\n"); 73 IWL_DEBUG_SCAN(priv, "Queuing scan abort.\n");
74 set_bit(STATUS_SCAN_ABORTING, &priv->status);
75 queue_work(priv->workqueue, &priv->abort_scan); 74 queue_work(priv->workqueue, &priv->abort_scan);
76 75
77 } else 76 } else
@@ -201,9 +200,6 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv,
201 le32_to_cpu(notif->statistics[0]), 200 le32_to_cpu(notif->statistics[0]),
202 le32_to_cpu(notif->tsf_low) - priv->scan_start_tsf); 201 le32_to_cpu(notif->tsf_low) - priv->scan_start_tsf);
203#endif 202#endif
204
205 if (!priv->is_internal_short_scan)
206 priv->next_scan_jiffies = 0;
207} 203}
208 204
209/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */ 205/* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
@@ -223,49 +219,24 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
223 /* The HW is no longer scanning */ 219 /* The HW is no longer scanning */
224 clear_bit(STATUS_SCAN_HW, &priv->status); 220 clear_bit(STATUS_SCAN_HW, &priv->status);
225 221
226 IWL_DEBUG_INFO(priv, "Scan pass on %sGHz took %dms\n", 222 IWL_DEBUG_INFO(priv, "Scan on %sGHz took %dms\n",
227 (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ? 223 (priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2",
228 "2.4" : "5.2",
229 jiffies_to_msecs(elapsed_jiffies 224 jiffies_to_msecs(elapsed_jiffies
230 (priv->scan_pass_start, jiffies))); 225 (priv->scan_start, jiffies)));
231
232 /* Remove this scanned band from the list of pending
233 * bands to scan, band G precedes A in order of scanning
234 * as seen in iwl_bg_request_scan */
235 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ))
236 priv->scan_bands &= ~BIT(IEEE80211_BAND_2GHZ);
237 else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ))
238 priv->scan_bands &= ~BIT(IEEE80211_BAND_5GHZ);
239 226
240 /* If a request to abort was given, or the scan did not succeed 227 /*
228 * If a request to abort was given, or the scan did not succeed
241 * then we reset the scan state machine and terminate, 229 * then we reset the scan state machine and terminate,
242 * re-queuing another scan if one has been requested */ 230 * re-queuing another scan if one has been requested
243 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { 231 */
232 if (test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status))
244 IWL_DEBUG_INFO(priv, "Aborted scan completed.\n"); 233 IWL_DEBUG_INFO(priv, "Aborted scan completed.\n");
245 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
246 } else {
247 /* If there are more bands on this scan pass reschedule */
248 if (priv->scan_bands)
249 goto reschedule;
250 }
251
252 if (!priv->is_internal_short_scan)
253 priv->next_scan_jiffies = 0;
254 234
255 IWL_DEBUG_INFO(priv, "Setting scan to off\n"); 235 IWL_DEBUG_INFO(priv, "Setting scan to off\n");
256 236
257 clear_bit(STATUS_SCANNING, &priv->status); 237 clear_bit(STATUS_SCANNING, &priv->status);
258 238
259 IWL_DEBUG_INFO(priv, "Scan took %dms\n",
260 jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies)));
261
262 queue_work(priv->workqueue, &priv->scan_completed); 239 queue_work(priv->workqueue, &priv->scan_completed);
263
264 return;
265
266reschedule:
267 priv->scan_pass_start = jiffies;
268 queue_work(priv->workqueue, &priv->request_scan);
269} 240}
270 241
271void iwl_setup_rx_scan_handlers(struct iwl_priv *priv) 242void iwl_setup_rx_scan_handlers(struct iwl_priv *priv)
@@ -314,150 +285,6 @@ u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
314} 285}
315EXPORT_SYMBOL(iwl_get_passive_dwell_time); 286EXPORT_SYMBOL(iwl_get_passive_dwell_time);
316 287
317static int iwl_get_single_channel_for_scan(struct iwl_priv *priv,
318 enum ieee80211_band band,
319 struct iwl_scan_channel *scan_ch)
320{
321 const struct ieee80211_supported_band *sband;
322 const struct iwl_channel_info *ch_info;
323 u16 passive_dwell = 0;
324 u16 active_dwell = 0;
325 int i, added = 0;
326 u16 channel = 0;
327
328 sband = iwl_get_hw_mode(priv, band);
329 if (!sband) {
330 IWL_ERR(priv, "invalid band\n");
331 return added;
332 }
333
334 active_dwell = iwl_get_active_dwell_time(priv, band, 0);
335 passive_dwell = iwl_get_passive_dwell_time(priv, band);
336
337 if (passive_dwell <= active_dwell)
338 passive_dwell = active_dwell + 1;
339
340 /* only scan single channel, good enough to reset the RF */
341 /* pick the first valid not in-use channel */
342 if (band == IEEE80211_BAND_5GHZ) {
343 for (i = 14; i < priv->channel_count; i++) {
344 if (priv->channel_info[i].channel !=
345 le16_to_cpu(priv->staging_rxon.channel)) {
346 channel = priv->channel_info[i].channel;
347 ch_info = iwl_get_channel_info(priv,
348 band, channel);
349 if (is_channel_valid(ch_info))
350 break;
351 }
352 }
353 } else {
354 for (i = 0; i < 14; i++) {
355 if (priv->channel_info[i].channel !=
356 le16_to_cpu(priv->staging_rxon.channel)) {
357 channel =
358 priv->channel_info[i].channel;
359 ch_info = iwl_get_channel_info(priv,
360 band, channel);
361 if (is_channel_valid(ch_info))
362 break;
363 }
364 }
365 }
366 if (channel) {
367 scan_ch->channel = cpu_to_le16(channel);
368 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
369 scan_ch->active_dwell = cpu_to_le16(active_dwell);
370 scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
371 /* Set txpower levels to defaults */
372 scan_ch->dsp_atten = 110;
373 if (band == IEEE80211_BAND_5GHZ)
374 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
375 else
376 scan_ch->tx_gain = ((1 << 5) | (5 << 3));
377 added++;
378 } else
379 IWL_ERR(priv, "no valid channel found\n");
380 return added;
381}
382
383static int iwl_get_channels_for_scan(struct iwl_priv *priv,
384 enum ieee80211_band band,
385 u8 is_active, u8 n_probes,
386 struct iwl_scan_channel *scan_ch)
387{
388 struct ieee80211_channel *chan;
389 const struct ieee80211_supported_band *sband;
390 const struct iwl_channel_info *ch_info;
391 u16 passive_dwell = 0;
392 u16 active_dwell = 0;
393 int added, i;
394 u16 channel;
395
396 sband = iwl_get_hw_mode(priv, band);
397 if (!sband)
398 return 0;
399
400 active_dwell = iwl_get_active_dwell_time(priv, band, n_probes);
401 passive_dwell = iwl_get_passive_dwell_time(priv, band);
402
403 if (passive_dwell <= active_dwell)
404 passive_dwell = active_dwell + 1;
405
406 for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) {
407 chan = priv->scan_request->channels[i];
408
409 if (chan->band != band)
410 continue;
411
412 channel = ieee80211_frequency_to_channel(chan->center_freq);
413 scan_ch->channel = cpu_to_le16(channel);
414
415 ch_info = iwl_get_channel_info(priv, band, channel);
416 if (!is_channel_valid(ch_info)) {
417 IWL_DEBUG_SCAN(priv, "Channel %d is INVALID for this band.\n",
418 channel);
419 continue;
420 }
421
422 if (!is_active || is_channel_passive(ch_info) ||
423 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN))
424 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
425 else
426 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
427
428 if (n_probes)
429 scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);
430
431 scan_ch->active_dwell = cpu_to_le16(active_dwell);
432 scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
433
434 /* Set txpower levels to defaults */
435 scan_ch->dsp_atten = 110;
436
437 /* NOTE: if we were doing 6Mb OFDM for scans we'd use
438 * power level:
439 * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3;
440 */
441 if (band == IEEE80211_BAND_5GHZ)
442 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
443 else
444 scan_ch->tx_gain = ((1 << 5) | (5 << 3));
445
446 IWL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n",
447 channel, le32_to_cpu(scan_ch->type),
448 (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
449 "ACTIVE" : "PASSIVE",
450 (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
451 active_dwell : passive_dwell);
452
453 scan_ch++;
454 added++;
455 }
456
457 IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added);
458 return added;
459}
460
461void iwl_init_scan_params(struct iwl_priv *priv) 288void iwl_init_scan_params(struct iwl_priv *priv)
462{ 289{
463 u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1; 290 u8 ant_idx = fls(priv->hw_params.valid_tx_ant) - 1;
@@ -476,26 +303,27 @@ static int iwl_scan_initiate(struct iwl_priv *priv)
476 set_bit(STATUS_SCANNING, &priv->status); 303 set_bit(STATUS_SCANNING, &priv->status);
477 priv->is_internal_short_scan = false; 304 priv->is_internal_short_scan = false;
478 priv->scan_start = jiffies; 305 priv->scan_start = jiffies;
479 priv->scan_pass_start = priv->scan_start;
480 306
481 queue_work(priv->workqueue, &priv->request_scan); 307 if (WARN_ON(!priv->cfg->ops->utils->request_scan))
308 return -EOPNOTSUPP;
309
310 priv->cfg->ops->utils->request_scan(priv);
482 311
483 return 0; 312 return 0;
484} 313}
485 314
486#define IWL_DELAY_NEXT_SCAN (HZ*2)
487
488int iwl_mac_hw_scan(struct ieee80211_hw *hw, 315int iwl_mac_hw_scan(struct ieee80211_hw *hw,
489 struct cfg80211_scan_request *req) 316 struct cfg80211_scan_request *req)
490{ 317{
491 unsigned long flags;
492 struct iwl_priv *priv = hw->priv; 318 struct iwl_priv *priv = hw->priv;
493 int ret, i; 319 int ret;
494 320
495 IWL_DEBUG_MAC80211(priv, "enter\n"); 321 IWL_DEBUG_MAC80211(priv, "enter\n");
496 322
323 if (req->n_channels == 0)
324 return -EINVAL;
325
497 mutex_lock(&priv->mutex); 326 mutex_lock(&priv->mutex);
498 spin_lock_irqsave(&priv->lock, flags);
499 327
500 if (!iwl_is_ready_rf(priv)) { 328 if (!iwl_is_ready_rf(priv)) {
501 ret = -EIO; 329 ret = -EIO;
@@ -515,22 +343,8 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
515 goto out_unlock; 343 goto out_unlock;
516 } 344 }
517 345
518 /* We don't schedule scan within next_scan_jiffies period. 346 /* mac80211 will only ask for one band at a time */
519 * Avoid scanning during possible EAPOL exchange, return 347 priv->scan_band = req->channels[0]->band;
520 * success immediately.
521 */
522 if (priv->next_scan_jiffies &&
523 time_after(priv->next_scan_jiffies, jiffies)) {
524 IWL_DEBUG_SCAN(priv, "scan rejected: within next scan period\n");
525 queue_work(priv->workqueue, &priv->scan_completed);
526 ret = 0;
527 goto out_unlock;
528 }
529
530 priv->scan_bands = 0;
531 for (i = 0; i < req->n_channels; i++)
532 priv->scan_bands |= BIT(req->channels[i]->band);
533
534 priv->scan_request = req; 348 priv->scan_request = req;
535 349
536 ret = iwl_scan_initiate(priv); 350 ret = iwl_scan_initiate(priv);
@@ -538,7 +352,6 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
538 IWL_DEBUG_MAC80211(priv, "leave\n"); 352 IWL_DEBUG_MAC80211(priv, "leave\n");
539 353
540out_unlock: 354out_unlock:
541 spin_unlock_irqrestore(&priv->lock, flags);
542 mutex_unlock(&priv->mutex); 355 mutex_unlock(&priv->mutex);
543 356
544 return ret; 357 return ret;
@@ -576,22 +389,20 @@ static void iwl_bg_start_internal_scan(struct work_struct *work)
576 goto unlock; 389 goto unlock;
577 } 390 }
578 391
579 priv->scan_bands = 0; 392 priv->scan_band = priv->band;
580 if (priv->band == IEEE80211_BAND_5GHZ)
581 priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
582 else
583 priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
584 393
585 IWL_DEBUG_SCAN(priv, "Start internal short scan...\n"); 394 IWL_DEBUG_SCAN(priv, "Start internal short scan...\n");
586 set_bit(STATUS_SCANNING, &priv->status); 395 set_bit(STATUS_SCANNING, &priv->status);
587 priv->is_internal_short_scan = true; 396 priv->is_internal_short_scan = true;
588 queue_work(priv->workqueue, &priv->request_scan); 397
398 if (WARN_ON(!priv->cfg->ops->utils->request_scan))
399 goto unlock;
400
401 priv->cfg->ops->utils->request_scan(priv);
589 unlock: 402 unlock:
590 mutex_unlock(&priv->mutex); 403 mutex_unlock(&priv->mutex);
591} 404}
592 405
593#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
594
595void iwl_bg_scan_check(struct work_struct *data) 406void iwl_bg_scan_check(struct work_struct *data)
596{ 407{
597 struct iwl_priv *priv = 408 struct iwl_priv *priv =
@@ -653,275 +464,15 @@ u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
653 if (WARN_ON(left < ie_len)) 464 if (WARN_ON(left < ie_len))
654 return len; 465 return len;
655 466
656 if (ies) 467 if (ies && ie_len) {
657 memcpy(pos, ies, ie_len); 468 memcpy(pos, ies, ie_len);
658 len += ie_len; 469 len += ie_len;
659 left -= ie_len; 470 }
660 471
661 return (u16)len; 472 return (u16)len;
662} 473}
663EXPORT_SYMBOL(iwl_fill_probe_req); 474EXPORT_SYMBOL(iwl_fill_probe_req);
664 475
665static void iwl_bg_request_scan(struct work_struct *data)
666{
667 struct iwl_priv *priv =
668 container_of(data, struct iwl_priv, request_scan);
669 struct iwl_host_cmd cmd = {
670 .id = REPLY_SCAN_CMD,
671 .len = sizeof(struct iwl_scan_cmd),
672 .flags = CMD_SIZE_HUGE,
673 };
674 struct iwl_scan_cmd *scan;
675 struct ieee80211_conf *conf = NULL;
676 u32 rate_flags = 0;
677 u16 cmd_len;
678 u16 rx_chain = 0;
679 enum ieee80211_band band;
680 u8 n_probes = 0;
681 u8 rx_ant = priv->hw_params.valid_rx_ant;
682 u8 rate;
683 bool is_active = false;
684 int chan_mod;
685 u8 active_chains;
686
687 conf = ieee80211_get_hw_conf(priv->hw);
688
689 mutex_lock(&priv->mutex);
690
691 cancel_delayed_work(&priv->scan_check);
692
693 if (!iwl_is_ready(priv)) {
694 IWL_WARN(priv, "request scan called when driver not ready.\n");
695 goto done;
696 }
697
698 /* Make sure the scan wasn't canceled before this queued work
699 * was given the chance to run... */
700 if (!test_bit(STATUS_SCANNING, &priv->status))
701 goto done;
702
703 /* This should never be called or scheduled if there is currently
704 * a scan active in the hardware. */
705 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
706 IWL_DEBUG_INFO(priv, "Multiple concurrent scan requests in parallel. "
707 "Ignoring second request.\n");
708 goto done;
709 }
710
711 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
712 IWL_DEBUG_SCAN(priv, "Aborting scan due to device shutdown\n");
713 goto done;
714 }
715
716 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
717 IWL_DEBUG_HC(priv, "Scan request while abort pending. Queuing.\n");
718 goto done;
719 }
720
721 if (iwl_is_rfkill(priv)) {
722 IWL_DEBUG_HC(priv, "Aborting scan due to RF Kill activation\n");
723 goto done;
724 }
725
726 if (!test_bit(STATUS_READY, &priv->status)) {
727 IWL_DEBUG_HC(priv, "Scan request while uninitialized. Queuing.\n");
728 goto done;
729 }
730
731 if (!priv->scan_bands) {
732 IWL_DEBUG_HC(priv, "Aborting scan due to no requested bands\n");
733 goto done;
734 }
735
736 if (!priv->scan) {
737 priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) +
738 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
739 if (!priv->scan) {
740 IWL_DEBUG_SCAN(priv,
741 "fail to allocate memory for scan\n");
742 goto done;
743 }
744 }
745 scan = priv->scan;
746 memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE);
747
748 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
749 scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
750
751 if (iwl_is_associated(priv)) {
752 u16 interval = 0;
753 u32 extra;
754 u32 suspend_time = 100;
755 u32 scan_suspend_time = 100;
756 unsigned long flags;
757
758 IWL_DEBUG_INFO(priv, "Scanning while associated...\n");
759 spin_lock_irqsave(&priv->lock, flags);
760 interval = priv->beacon_int;
761 spin_unlock_irqrestore(&priv->lock, flags);
762
763 scan->suspend_time = 0;
764 scan->max_out_time = cpu_to_le32(200 * 1024);
765 if (!interval)
766 interval = suspend_time;
767
768 extra = (suspend_time / interval) << 22;
769 scan_suspend_time = (extra |
770 ((suspend_time % interval) * 1024));
771 scan->suspend_time = cpu_to_le32(scan_suspend_time);
772 IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
773 scan_suspend_time, interval);
774 }
775
776 if (priv->is_internal_short_scan) {
777 IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n");
778 } else if (priv->scan_request->n_ssids) {
779 int i, p = 0;
780 IWL_DEBUG_SCAN(priv, "Kicking off active scan\n");
781 for (i = 0; i < priv->scan_request->n_ssids; i++) {
782 /* always does wildcard anyway */
783 if (!priv->scan_request->ssids[i].ssid_len)
784 continue;
785 scan->direct_scan[p].id = WLAN_EID_SSID;
786 scan->direct_scan[p].len =
787 priv->scan_request->ssids[i].ssid_len;
788 memcpy(scan->direct_scan[p].ssid,
789 priv->scan_request->ssids[i].ssid,
790 priv->scan_request->ssids[i].ssid_len);
791 n_probes++;
792 p++;
793 }
794 is_active = true;
795 } else
796 IWL_DEBUG_SCAN(priv, "Start passive scan.\n");
797
798 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
799 scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id;
800 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
801
802
803 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) {
804 band = IEEE80211_BAND_2GHZ;
805 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
806 chan_mod = le32_to_cpu(priv->active_rxon.flags & RXON_FLG_CHANNEL_MODE_MSK)
807 >> RXON_FLG_CHANNEL_MODE_POS;
808 if (chan_mod == CHANNEL_MODE_PURE_40) {
809 rate = IWL_RATE_6M_PLCP;
810 } else {
811 rate = IWL_RATE_1M_PLCP;
812 rate_flags = RATE_MCS_CCK_MSK;
813 }
814 scan->good_CRC_th = 0;
815 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) {
816 band = IEEE80211_BAND_5GHZ;
817 rate = IWL_RATE_6M_PLCP;
818 /*
819 * If active scaning is requested but a certain channel
820 * is marked passive, we can do active scanning if we
821 * detect transmissions.
822 */
823 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0;
824
825 /* Force use of chains B and C (0x6) for scan Rx
826 * Avoid A (0x1) for the device has off-channel reception
827 * on A-band.
828 */
829 if (priv->cfg->off_channel_workaround)
830 rx_ant = ANT_BC;
831 } else {
832 IWL_WARN(priv, "Invalid scan band count\n");
833 goto done;
834 }
835
836 priv->scan_tx_ant[band] =
837 iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band]);
838 rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]);
839 scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags);
840
841 /* In power save mode use one chain, otherwise use all chains */
842 if (test_bit(STATUS_POWER_PMI, &priv->status)) {
843 /* rx_ant has been set to all valid chains previously */
844 active_chains = rx_ant &
845 ((u8)(priv->chain_noise_data.active_chains));
846 if (!active_chains)
847 active_chains = rx_ant;
848
849 IWL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n",
850 priv->chain_noise_data.active_chains);
851
852 rx_ant = first_antenna(active_chains);
853 }
854 /* MIMO is not used here, but value is required */
855 rx_chain |= priv->hw_params.valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
856 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
857 rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS;
858 rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
859 scan->rx_chain = cpu_to_le16(rx_chain);
860 if (!priv->is_internal_short_scan) {
861 cmd_len = iwl_fill_probe_req(priv,
862 (struct ieee80211_mgmt *)scan->data,
863 priv->scan_request->ie,
864 priv->scan_request->ie_len,
865 IWL_MAX_SCAN_SIZE - sizeof(*scan));
866 } else {
867 cmd_len = iwl_fill_probe_req(priv,
868 (struct ieee80211_mgmt *)scan->data,
869 NULL, 0,
870 IWL_MAX_SCAN_SIZE - sizeof(*scan));
871
872 }
873 scan->tx_cmd.len = cpu_to_le16(cmd_len);
874 if (iwl_is_monitor_mode(priv))
875 scan->filter_flags = RXON_FILTER_PROMISC_MSK;
876
877 scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK |
878 RXON_FILTER_BCON_AWARE_MSK);
879
880 if (priv->is_internal_short_scan) {
881 scan->channel_count =
882 iwl_get_single_channel_for_scan(priv, band,
883 (void *)&scan->data[le16_to_cpu(
884 scan->tx_cmd.len)]);
885 } else {
886 scan->channel_count =
887 iwl_get_channels_for_scan(priv, band,
888 is_active, n_probes,
889 (void *)&scan->data[le16_to_cpu(
890 scan->tx_cmd.len)]);
891 }
892 if (scan->channel_count == 0) {
893 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
894 goto done;
895 }
896
897 cmd.len += le16_to_cpu(scan->tx_cmd.len) +
898 scan->channel_count * sizeof(struct iwl_scan_channel);
899 cmd.data = scan;
900 scan->len = cpu_to_le16(cmd.len);
901
902 set_bit(STATUS_SCAN_HW, &priv->status);
903 if (iwl_send_cmd_sync(priv, &cmd))
904 goto done;
905
906 queue_delayed_work(priv->workqueue, &priv->scan_check,
907 IWL_SCAN_CHECK_WATCHDOG);
908
909 mutex_unlock(&priv->mutex);
910 return;
911
912 done:
913 /* Cannot perform scan. Make sure we clear scanning
914 * bits from status so next scan request can be performed.
915 * If we don't clear scanning status bit here all next scan
916 * will fail
917 */
918 clear_bit(STATUS_SCAN_HW, &priv->status);
919 clear_bit(STATUS_SCANNING, &priv->status);
920 /* inform mac80211 scan aborted */
921 queue_work(priv->workqueue, &priv->scan_completed);
922 mutex_unlock(&priv->mutex);
923}
924
925void iwl_bg_abort_scan(struct work_struct *work) 476void iwl_bg_abort_scan(struct work_struct *work)
926{ 477{
927 struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); 478 struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan);
@@ -969,7 +520,6 @@ EXPORT_SYMBOL(iwl_bg_scan_completed);
969void iwl_setup_scan_deferred_work(struct iwl_priv *priv) 520void iwl_setup_scan_deferred_work(struct iwl_priv *priv)
970{ 521{
971 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); 522 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed);
972 INIT_WORK(&priv->request_scan, iwl_bg_request_scan);
973 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); 523 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan);
974 INIT_WORK(&priv->start_internal_scan, iwl_bg_start_internal_scan); 524 INIT_WORK(&priv->start_internal_scan, iwl_bg_start_internal_scan);
975 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); 525 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check);
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index d86ecd2f9ec2..db934476b5e9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -451,7 +451,17 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, bool is_ap)
451 451
452 link_cmd.general_params.single_stream_ant_msk = 452 link_cmd.general_params.single_stream_ant_msk =
453 first_antenna(priv->hw_params.valid_tx_ant); 453 first_antenna(priv->hw_params.valid_tx_ant);
454 link_cmd.general_params.dual_stream_ant_msk = 3; 454
455 link_cmd.general_params.dual_stream_ant_msk =
456 priv->hw_params.valid_tx_ant &
457 ~first_antenna(priv->hw_params.valid_tx_ant);
458 if (!link_cmd.general_params.dual_stream_ant_msk) {
459 link_cmd.general_params.dual_stream_ant_msk = ANT_AB;
460 } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) {
461 link_cmd.general_params.dual_stream_ant_msk =
462 priv->hw_params.valid_tx_ant;
463 }
464
455 link_cmd.agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; 465 link_cmd.agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
456 link_cmd.agg_params.agg_time_limit = 466 link_cmd.agg_params.agg_time_limit =
457 cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF); 467 cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
@@ -1196,7 +1206,6 @@ int iwl_send_lq_cmd(struct iwl_priv *priv,
1196 iwl_dump_lq_cmd(priv, lq); 1206 iwl_dump_lq_cmd(priv, lq);
1197 BUG_ON(init && (cmd.flags & CMD_ASYNC)); 1207 BUG_ON(init && (cmd.flags & CMD_ASYNC));
1198 1208
1199 iwl_dump_lq_cmd(priv, lq);
1200 ret = iwl_send_cmd(priv, &cmd); 1209 ret = iwl_send_cmd(priv, &cmd);
1201 if (ret || (cmd.flags & CMD_ASYNC)) 1210 if (ret || (cmd.flags & CMD_ASYNC))
1202 return ret; 1211 return ret;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 9f362024a29c..a41ba72ceb00 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2527,7 +2527,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2527 } 2527 }
2528 2528
2529 /* Configure Bluetooth device coexistence support */ 2529 /* Configure Bluetooth device coexistence support */
2530 iwl_send_bt_config(priv); 2530 priv->cfg->ops->hcmd->send_bt_config(priv);
2531 2531
2532 /* Configure the adapter for unassociated operation */ 2532 /* Configure the adapter for unassociated operation */
2533 iwlcore_commit_rxon(priv); 2533 iwlcore_commit_rxon(priv);
@@ -2791,11 +2791,8 @@ static void iwl3945_rfkill_poll(struct work_struct *data)
2791 2791
2792} 2792}
2793 2793
2794#define IWL_SCAN_CHECK_WATCHDOG (7 * HZ) 2794void iwl3945_request_scan(struct iwl_priv *priv)
2795static void iwl3945_bg_request_scan(struct work_struct *data)
2796{ 2795{
2797 struct iwl_priv *priv =
2798 container_of(data, struct iwl_priv, request_scan);
2799 struct iwl_host_cmd cmd = { 2796 struct iwl_host_cmd cmd = {
2800 .id = REPLY_SCAN_CMD, 2797 .id = REPLY_SCAN_CMD,
2801 .len = sizeof(struct iwl3945_scan_cmd), 2798 .len = sizeof(struct iwl3945_scan_cmd),
@@ -2809,8 +2806,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2809 2806
2810 conf = ieee80211_get_hw_conf(priv->hw); 2807 conf = ieee80211_get_hw_conf(priv->hw);
2811 2808
2812 mutex_lock(&priv->mutex);
2813
2814 cancel_delayed_work(&priv->scan_check); 2809 cancel_delayed_work(&priv->scan_check);
2815 2810
2816 if (!iwl_is_ready(priv)) { 2811 if (!iwl_is_ready(priv)) {
@@ -2853,20 +2848,15 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2853 goto done; 2848 goto done;
2854 } 2849 }
2855 2850
2856 if (!priv->scan_bands) { 2851 if (!priv->scan_cmd) {
2857 IWL_DEBUG_HC(priv, "Aborting scan due to no requested bands\n"); 2852 priv->scan_cmd = kmalloc(sizeof(struct iwl3945_scan_cmd) +
2858 goto done; 2853 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
2859 } 2854 if (!priv->scan_cmd) {
2860
2861 if (!priv->scan) {
2862 priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) +
2863 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
2864 if (!priv->scan) {
2865 IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n"); 2855 IWL_DEBUG_SCAN(priv, "Fail to allocate scan memory\n");
2866 goto done; 2856 goto done;
2867 } 2857 }
2868 } 2858 }
2869 scan = priv->scan; 2859 scan = priv->scan_cmd;
2870 memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE); 2860 memset(scan, 0, sizeof(struct iwl3945_scan_cmd) + IWL_MAX_SCAN_SIZE);
2871 2861
2872 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; 2862 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
@@ -2935,12 +2925,14 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2935 2925
2936 /* flags + rate selection */ 2926 /* flags + rate selection */
2937 2927
2938 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) { 2928 switch (priv->scan_band) {
2929 case IEEE80211_BAND_2GHZ:
2939 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 2930 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
2940 scan->tx_cmd.rate = IWL_RATE_1M_PLCP; 2931 scan->tx_cmd.rate = IWL_RATE_1M_PLCP;
2941 scan->good_CRC_th = 0; 2932 scan->good_CRC_th = 0;
2942 band = IEEE80211_BAND_2GHZ; 2933 band = IEEE80211_BAND_2GHZ;
2943 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { 2934 break;
2935 case IEEE80211_BAND_5GHZ:
2944 scan->tx_cmd.rate = IWL_RATE_6M_PLCP; 2936 scan->tx_cmd.rate = IWL_RATE_6M_PLCP;
2945 /* 2937 /*
2946 * If active scaning is requested but a certain channel 2938 * If active scaning is requested but a certain channel
@@ -2949,8 +2941,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2949 */ 2941 */
2950 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; 2942 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0;
2951 band = IEEE80211_BAND_5GHZ; 2943 band = IEEE80211_BAND_5GHZ;
2952 } else { 2944 break;
2953 IWL_WARN(priv, "Invalid scan band count\n"); 2945 default:
2946 IWL_WARN(priv, "Invalid scan band\n");
2954 goto done; 2947 goto done;
2955 } 2948 }
2956 2949
@@ -2971,9 +2964,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2971 /* select Rx antennas */ 2964 /* select Rx antennas */
2972 scan->flags |= iwl3945_get_antenna_flags(priv); 2965 scan->flags |= iwl3945_get_antenna_flags(priv);
2973 2966
2974 if (iwl_is_monitor_mode(priv))
2975 scan->filter_flags = RXON_FILTER_PROMISC_MSK;
2976
2977 scan->channel_count = 2967 scan->channel_count =
2978 iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, 2968 iwl3945_get_channels_for_scan(priv, band, is_active, n_probes,
2979 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); 2969 (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
@@ -2995,7 +2985,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2995 queue_delayed_work(priv->workqueue, &priv->scan_check, 2985 queue_delayed_work(priv->workqueue, &priv->scan_check,
2996 IWL_SCAN_CHECK_WATCHDOG); 2986 IWL_SCAN_CHECK_WATCHDOG);
2997 2987
2998 mutex_unlock(&priv->mutex);
2999 return; 2988 return;
3000 2989
3001 done: 2990 done:
@@ -3009,7 +2998,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
3009 2998
3010 /* inform mac80211 scan aborted */ 2999 /* inform mac80211 scan aborted */
3011 queue_work(priv->workqueue, &priv->scan_completed); 3000 queue_work(priv->workqueue, &priv->scan_completed);
3012 mutex_unlock(&priv->mutex);
3013} 3001}
3014 3002
3015static void iwl3945_bg_restart(struct work_struct *data) 3003static void iwl3945_bg_restart(struct work_struct *data)
@@ -3051,8 +3039,6 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data)
3051 mutex_unlock(&priv->mutex); 3039 mutex_unlock(&priv->mutex);
3052} 3040}
3053 3041
3054#define IWL_DELAY_NEXT_SCAN (HZ*2)
3055
3056void iwl3945_post_associate(struct iwl_priv *priv) 3042void iwl3945_post_associate(struct iwl_priv *priv)
3057{ 3043{
3058 int rc = 0; 3044 int rc = 0;
@@ -3137,9 +3123,6 @@ void iwl3945_post_associate(struct iwl_priv *priv)
3137 __func__, priv->iw_mode); 3123 __func__, priv->iw_mode);
3138 break; 3124 break;
3139 } 3125 }
3140
3141 /* we have just associated, don't start scan too early */
3142 priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
3143} 3126}
3144 3127
3145/***************************************************************************** 3128/*****************************************************************************
@@ -3672,44 +3655,6 @@ static ssize_t show_channels(struct device *d,
3672 3655
3673static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); 3656static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);
3674 3657
3675static ssize_t show_statistics(struct device *d,
3676 struct device_attribute *attr, char *buf)
3677{
3678 struct iwl_priv *priv = dev_get_drvdata(d);
3679 u32 size = sizeof(struct iwl3945_notif_statistics);
3680 u32 len = 0, ofs = 0;
3681 u8 *data = (u8 *)&priv->_3945.statistics;
3682 int rc = 0;
3683
3684 if (!iwl_is_alive(priv))
3685 return -EAGAIN;
3686
3687 mutex_lock(&priv->mutex);
3688 rc = iwl_send_statistics_request(priv, CMD_SYNC, false);
3689 mutex_unlock(&priv->mutex);
3690
3691 if (rc) {
3692 len = sprintf(buf,
3693 "Error sending statistics request: 0x%08X\n", rc);
3694 return len;
3695 }
3696
3697 while (size && (PAGE_SIZE - len)) {
3698 hex_dump_to_buffer(data + ofs, size, 16, 1, buf + len,
3699 PAGE_SIZE - len, 1);
3700 len = strlen(buf);
3701 if (PAGE_SIZE - len)
3702 buf[len++] = '\n';
3703
3704 ofs += 16;
3705 size -= min(size, 16U);
3706 }
3707
3708 return len;
3709}
3710
3711static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);
3712
3713static ssize_t show_antenna(struct device *d, 3658static ssize_t show_antenna(struct device *d,
3714 struct device_attribute *attr, char *buf) 3659 struct device_attribute *attr, char *buf)
3715{ 3660{
@@ -3793,7 +3738,6 @@ static void iwl3945_setup_deferred_work(struct iwl_priv *priv)
3793 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start); 3738 INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
3794 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll); 3739 INIT_DELAYED_WORK(&priv->_3945.rfkill_poll, iwl3945_rfkill_poll);
3795 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); 3740 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed);
3796 INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan);
3797 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); 3741 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan);
3798 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); 3742 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check);
3799 3743
@@ -3830,7 +3774,6 @@ static struct attribute *iwl3945_sysfs_entries[] = {
3830 &dev_attr_filter_flags.attr, 3774 &dev_attr_filter_flags.attr,
3831 &dev_attr_measurement.attr, 3775 &dev_attr_measurement.attr,
3832 &dev_attr_retry_rate.attr, 3776 &dev_attr_retry_rate.attr,
3833 &dev_attr_statistics.attr,
3834 &dev_attr_status.attr, 3777 &dev_attr_status.attr,
3835 &dev_attr_temperature.attr, 3778 &dev_attr_temperature.attr,
3836 &dev_attr_tx_power.attr, 3779 &dev_attr_tx_power.attr,
@@ -4253,7 +4196,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
4253 4196
4254 iwl_free_channel_map(priv); 4197 iwl_free_channel_map(priv);
4255 iwlcore_free_geos(priv); 4198 iwlcore_free_geos(priv);
4256 kfree(priv->scan); 4199 kfree(priv->scan_cmd);
4257 if (priv->ibss_beacon) 4200 if (priv->ibss_beacon)
4258 dev_kfree_skb(priv->ibss_beacon); 4201 dev_kfree_skb(priv->ibss_beacon);
4259 4202