aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-dev.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-dev.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h265
1 files changed, 188 insertions, 77 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 028d50599550..ef1720a852e9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -43,7 +43,6 @@
43#include "iwl-debug.h" 43#include "iwl-debug.h"
44#include "iwl-4965-hw.h" 44#include "iwl-4965-hw.h"
45#include "iwl-3945-hw.h" 45#include "iwl-3945-hw.h"
46#include "iwl-3945-led.h"
47#include "iwl-led.h" 46#include "iwl-led.h"
48#include "iwl-power.h" 47#include "iwl-power.h"
49#include "iwl-agn-rs.h" 48#include "iwl-agn-rs.h"
@@ -53,21 +52,23 @@ extern struct iwl_cfg iwl4965_agn_cfg;
53extern struct iwl_cfg iwl5300_agn_cfg; 52extern struct iwl_cfg iwl5300_agn_cfg;
54extern struct iwl_cfg iwl5100_agn_cfg; 53extern struct iwl_cfg iwl5100_agn_cfg;
55extern struct iwl_cfg iwl5350_agn_cfg; 54extern struct iwl_cfg iwl5350_agn_cfg;
56extern struct iwl_cfg iwl5100_bg_cfg; 55extern struct iwl_cfg iwl5100_bgn_cfg;
57extern struct iwl_cfg iwl5100_abg_cfg; 56extern struct iwl_cfg iwl5100_abg_cfg;
58extern struct iwl_cfg iwl5150_agn_cfg; 57extern struct iwl_cfg iwl5150_agn_cfg;
59extern struct iwl_cfg iwl6000h_2agn_cfg; 58extern struct iwl_cfg iwl5150_abg_cfg;
60extern struct iwl_cfg iwl6000i_2agn_cfg; 59extern struct iwl_cfg iwl6000i_2agn_cfg;
60extern struct iwl_cfg iwl6000i_2abg_cfg;
61extern struct iwl_cfg iwl6000i_2bg_cfg;
61extern struct iwl_cfg iwl6000_3agn_cfg; 62extern struct iwl_cfg iwl6000_3agn_cfg;
62extern struct iwl_cfg iwl6050_2agn_cfg; 63extern struct iwl_cfg iwl6050_2agn_cfg;
63extern struct iwl_cfg iwl6050_3agn_cfg; 64extern struct iwl_cfg iwl6050_2abg_cfg;
64extern struct iwl_cfg iwl1000_bgn_cfg; 65extern struct iwl_cfg iwl1000_bgn_cfg;
66extern struct iwl_cfg iwl1000_bg_cfg;
65 67
66struct iwl_tx_queue; 68struct iwl_tx_queue;
67 69
68/* shared structures from iwl-5000.c */ 70/* shared structures from iwl-5000.c */
69extern struct iwl_mod_params iwl50_mod_params; 71extern struct iwl_mod_params iwl50_mod_params;
70extern struct iwl_ops iwl5000_ops;
71extern struct iwl_ucode_ops iwl5000_ucode; 72extern struct iwl_ucode_ops iwl5000_ucode;
72extern struct iwl_lib_ops iwl5000_lib; 73extern struct iwl_lib_ops iwl5000_lib;
73extern struct iwl_hcmd_ops iwl5000_hcmd; 74extern struct iwl_hcmd_ops iwl5000_hcmd;
@@ -81,9 +82,6 @@ extern void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
81 __le32 *tx_flags); 82 __le32 *tx_flags);
82extern int iwl5000_calc_rssi(struct iwl_priv *priv, 83extern int iwl5000_calc_rssi(struct iwl_priv *priv,
83 struct iwl_rx_phy_res *rx_resp); 84 struct iwl_rx_phy_res *rx_resp);
84extern int iwl5000_apm_init(struct iwl_priv *priv);
85extern void iwl5000_apm_stop(struct iwl_priv *priv);
86extern int iwl5000_apm_reset(struct iwl_priv *priv);
87extern void iwl5000_nic_config(struct iwl_priv *priv); 85extern void iwl5000_nic_config(struct iwl_priv *priv);
88extern u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv); 86extern u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv);
89extern const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv, 87extern const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv,
@@ -144,12 +142,13 @@ extern void iwl5000_temperature(struct iwl_priv *priv);
144#define DEFAULT_LONG_RETRY_LIMIT 4U 142#define DEFAULT_LONG_RETRY_LIMIT 4U
145 143
146struct iwl_rx_mem_buffer { 144struct iwl_rx_mem_buffer {
147 dma_addr_t real_dma_addr; 145 dma_addr_t page_dma;
148 dma_addr_t aligned_dma_addr; 146 struct page *page;
149 struct sk_buff *skb;
150 struct list_head list; 147 struct list_head list;
151}; 148};
152 149
150#define rxb_addr(r) page_address(r->page)
151
153/* defined below */ 152/* defined below */
154struct iwl_device_cmd; 153struct iwl_device_cmd;
155 154
@@ -165,7 +164,7 @@ struct iwl_cmd_meta {
165 */ 164 */
166 void (*callback)(struct iwl_priv *priv, 165 void (*callback)(struct iwl_priv *priv,
167 struct iwl_device_cmd *cmd, 166 struct iwl_device_cmd *cmd,
168 struct sk_buff *skb); 167 struct iwl_rx_packet *pkt);
169 168
170 /* The CMD_SIZE_HUGE flag bit indicates that the command 169 /* The CMD_SIZE_HUGE flag bit indicates that the command
171 * structure is stored at the end of the shared queue memory. */ 170 * structure is stored at the end of the shared queue memory. */
@@ -293,9 +292,6 @@ struct iwl_channel_info {
293 292
294 /* HT40 channel info */ 293 /* HT40 channel info */
295 s8 ht40_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */ 294 s8 ht40_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
296 s8 ht40_curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */
297 s8 ht40_min_power; /* always 0 */
298 s8 ht40_scan_power; /* (dBm) eeprom, direct scans, any rate */
299 u8 ht40_flags; /* flags copied from EEPROM */ 295 u8 ht40_flags; /* flags copied from EEPROM */
300 u8 ht40_extension_channel; /* HT_IE_EXT_CHANNEL_* */ 296 u8 ht40_extension_channel; /* HT_IE_EXT_CHANNEL_* */
301 297
@@ -321,6 +317,13 @@ struct iwl_channel_info {
321 * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */ 317 * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */
322#define IWL_MIN_NUM_QUEUES 10 318#define IWL_MIN_NUM_QUEUES 10
323 319
320/*
321 * Queue #4 is the command queue for 3945/4965/5x00/1000/6x00,
322 * the driver maps it into the appropriate device FIFO for the
323 * uCode.
324 */
325#define IWL_CMD_QUEUE_NUM 4
326
324/* Power management (not Tx power) structures */ 327/* Power management (not Tx power) structures */
325 328
326enum iwl_pwr_src { 329enum iwl_pwr_src {
@@ -356,7 +359,14 @@ enum {
356 CMD_WANT_SKB = (1 << 2), 359 CMD_WANT_SKB = (1 << 2),
357}; 360};
358 361
359#define IWL_CMD_MAX_PAYLOAD 320 362#define DEF_CMD_PAYLOAD_SIZE 320
363
364/*
365 * IWL_LINK_HDR_MAX should include ieee80211_hdr, radiotap header,
366 * SNAP header and alignment. It should also be big enough for 802.11
367 * control frames.
368 */
369#define IWL_LINK_HDR_MAX 64
360 370
361/** 371/**
362 * struct iwl_device_cmd 372 * struct iwl_device_cmd
@@ -373,7 +383,8 @@ struct iwl_device_cmd {
373 u16 val16; 383 u16 val16;
374 u32 val32; 384 u32 val32;
375 struct iwl_tx_cmd tx; 385 struct iwl_tx_cmd tx;
376 u8 payload[IWL_CMD_MAX_PAYLOAD]; 386 struct iwl6000_channel_switch_cmd chswitch;
387 u8 payload[DEF_CMD_PAYLOAD_SIZE];
377 } __attribute__ ((packed)) cmd; 388 } __attribute__ ((packed)) cmd;
378} __attribute__ ((packed)); 389} __attribute__ ((packed));
379 390
@@ -382,21 +393,15 @@ struct iwl_device_cmd {
382 393
383struct iwl_host_cmd { 394struct iwl_host_cmd {
384 const void *data; 395 const void *data;
385 struct sk_buff *reply_skb; 396 unsigned long reply_page;
386 void (*callback)(struct iwl_priv *priv, 397 void (*callback)(struct iwl_priv *priv,
387 struct iwl_device_cmd *cmd, 398 struct iwl_device_cmd *cmd,
388 struct sk_buff *skb); 399 struct iwl_rx_packet *pkt);
389 u32 flags; 400 u32 flags;
390 u16 len; 401 u16 len;
391 u8 id; 402 u8 id;
392}; 403};
393 404
394/*
395 * RX related structures and functions
396 */
397#define RX_FREE_BUFFERS 64
398#define RX_LOW_WATERMARK 8
399
400#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 405#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
401#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 406#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
402#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 407#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
@@ -502,12 +507,12 @@ union iwl_ht_rate_supp {
502#define CFG_HT_MPDU_DENSITY_4USEC (0x5) 507#define CFG_HT_MPDU_DENSITY_4USEC (0x5)
503#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC 508#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC
504 509
505struct iwl_ht_info { 510struct iwl_ht_config {
506 /* self configuration data */ 511 /* self configuration data */
507 u8 is_ht; 512 bool is_ht;
508 u8 supported_chan_width; 513 bool is_40mhz;
509 u8 sm_ps; 514 bool single_chain_sufficient;
510 struct ieee80211_mcs_info mcs; 515 enum ieee80211_smps_mode smps; /* current smps mode */
511 /* BSS related data */ 516 /* BSS related data */
512 u8 extension_chan_offset; 517 u8 extension_chan_offset;
513 u8 ht_protection; 518 u8 ht_protection;
@@ -541,26 +546,27 @@ struct iwl_qos_info {
541 struct iwl_qosparam_cmd def_qos_parm; 546 struct iwl_qosparam_cmd def_qos_parm;
542}; 547};
543 548
544#define STA_PS_STATUS_WAKE 0
545#define STA_PS_STATUS_SLEEP 1
546
547
548struct iwl3945_station_entry {
549 struct iwl3945_addsta_cmd sta;
550 struct iwl_tid_data tid[MAX_TID_COUNT];
551 u8 used;
552 u8 ps_status;
553 struct iwl_hw_key keyinfo;
554};
555
556struct iwl_station_entry { 549struct iwl_station_entry {
557 struct iwl_addsta_cmd sta; 550 struct iwl_addsta_cmd sta;
558 struct iwl_tid_data tid[MAX_TID_COUNT]; 551 struct iwl_tid_data tid[MAX_TID_COUNT];
559 u8 used; 552 u8 used;
560 u8 ps_status;
561 struct iwl_hw_key keyinfo; 553 struct iwl_hw_key keyinfo;
562}; 554};
563 555
556/*
557 * iwl_station_priv: Driver's private station information
558 *
559 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
560 * in the structure for use by driver. This structure is places in that
561 * space.
562 */
563struct iwl_station_priv {
564 struct iwl_lq_sta lq_sta;
565 atomic_t pending_frames;
566 bool client;
567 bool asleep;
568};
569
564/* one for each uCode image (inst/data, boot/init/runtime) */ 570/* one for each uCode image (inst/data, boot/init/runtime) */
565struct fw_desc { 571struct fw_desc {
566 void *v_addr; /* access by driver */ 572 void *v_addr; /* access by driver */
@@ -622,6 +628,10 @@ struct iwl_sensitivity_ranges {
622 u16 auto_corr_max_cck_mrc; 628 u16 auto_corr_max_cck_mrc;
623 u16 auto_corr_min_cck; 629 u16 auto_corr_min_cck;
624 u16 auto_corr_min_cck_mrc; 630 u16 auto_corr_min_cck_mrc;
631
632 u16 barker_corr_th_min;
633 u16 barker_corr_th_min_mrc;
634 u16 nrg_th_cca;
625}; 635};
626 636
627 637
@@ -639,7 +649,7 @@ struct iwl_sensitivity_ranges {
639 * @valid_tx/rx_ant: usable antennas 649 * @valid_tx/rx_ant: usable antennas
640 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2) 650 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
641 * @max_rxq_log: Log-base-2 of max_rxq_size 651 * @max_rxq_log: Log-base-2 of max_rxq_size
642 * @rx_buf_size: Rx buffer size 652 * @rx_page_order: Rx buffer page order
643 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR 653 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
644 * @max_stations: 654 * @max_stations:
645 * @bcast_sta_id: 655 * @bcast_sta_id:
@@ -662,9 +672,8 @@ struct iwl_hw_params {
662 u8 valid_rx_ant; 672 u8 valid_rx_ant;
663 u16 max_rxq_size; 673 u16 max_rxq_size;
664 u16 max_rxq_log; 674 u16 max_rxq_log;
665 u32 rx_buf_size; 675 u32 rx_page_order;
666 u32 rx_wrt_ptr_reg; 676 u32 rx_wrt_ptr_reg;
667 u32 max_pkt_size;
668 u8 max_stations; 677 u8 max_stations;
669 u8 bcast_sta_id; 678 u8 bcast_sta_id;
670 u8 ht40_channel; 679 u8 ht40_channel;
@@ -703,7 +712,7 @@ extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
703extern int iwl_queue_space(const struct iwl_queue *q); 712extern int iwl_queue_space(const struct iwl_queue *q);
704static inline int iwl_queue_used(const struct iwl_queue *q, int i) 713static inline int iwl_queue_used(const struct iwl_queue *q, int i)
705{ 714{
706 return q->write_ptr > q->read_ptr ? 715 return q->write_ptr >= q->read_ptr ?
707 (i >= q->read_ptr && i < q->write_ptr) : 716 (i >= q->read_ptr && i < q->write_ptr) :
708 !(i < q->read_ptr && i >= q->write_ptr); 717 !(i < q->read_ptr && i >= q->write_ptr);
709} 718}
@@ -711,7 +720,11 @@ static inline int iwl_queue_used(const struct iwl_queue *q, int i)
711 720
712static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) 721static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
713{ 722{
714 /* This is for scan command, the big buffer at end of command array */ 723 /*
724 * This is for init calibration result and scan command which
725 * required buffer > TFD_MAX_PAYLOAD_SIZE,
726 * the big buffer at end of command array
727 */
715 if (is_huge) 728 if (is_huge)
716 return q->n_window; /* must be power of 2 */ 729 return q->n_window; /* must be power of 2 */
717 730
@@ -726,9 +739,6 @@ struct iwl_dma_ptr {
726 size_t size; 739 size_t size;
727}; 740};
728 741
729#define IWL_CHANNEL_WIDTH_20MHZ 0
730#define IWL_CHANNEL_WIDTH_40MHZ 1
731
732#define IWL_OPERATION_MODE_AUTO 0 742#define IWL_OPERATION_MODE_AUTO 0
733#define IWL_OPERATION_MODE_HT_ONLY 1 743#define IWL_OPERATION_MODE_HT_ONLY 1
734#define IWL_OPERATION_MODE_MIXED 2 744#define IWL_OPERATION_MODE_MIXED 2
@@ -741,7 +751,8 @@ struct iwl_dma_ptr {
741 751
742/* Sensitivity and chain noise calibration */ 752/* Sensitivity and chain noise calibration */
743#define INITIALIZATION_VALUE 0xFFFF 753#define INITIALIZATION_VALUE 0xFFFF
744#define CAL_NUM_OF_BEACONS 20 754#define IWL4965_CAL_NUM_BEACONS 20
755#define IWL_CAL_NUM_BEACONS 16
745#define MAXIMUM_ALLOWED_PATHLOSS 15 756#define MAXIMUM_ALLOWED_PATHLOSS 15
746 757
747#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 758#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
@@ -845,6 +856,10 @@ struct iwl_sensitivity_data {
845 s32 nrg_auto_corr_silence_diff; 856 s32 nrg_auto_corr_silence_diff;
846 u32 num_in_cck_no_fa; 857 u32 num_in_cck_no_fa;
847 u32 nrg_th_ofdm; 858 u32 nrg_th_ofdm;
859
860 u16 barker_corr_th_min;
861 u16 barker_corr_th_min_mrc;
862 u16 nrg_th_cca;
848}; 863};
849 864
850/* Chain noise (differential Rx gain) calib data */ 865/* Chain noise (differential Rx gain) calib data */
@@ -894,13 +909,11 @@ enum iwl_access_mode {
894/** 909/**
895 * enum iwl_pa_type - Power Amplifier type 910 * enum iwl_pa_type - Power Amplifier type
896 * @IWL_PA_SYSTEM: based on uCode configuration 911 * @IWL_PA_SYSTEM: based on uCode configuration
897 * @IWL_PA_HYBRID: use both Internal and external PA
898 * @IWL_PA_INTERNAL: use Internal only 912 * @IWL_PA_INTERNAL: use Internal only
899 */ 913 */
900enum iwl_pa_type { 914enum iwl_pa_type {
901 IWL_PA_SYSTEM = 0, 915 IWL_PA_SYSTEM = 0,
902 IWL_PA_HYBRID = 1, 916 IWL_PA_INTERNAL = 1,
903 IWL_PA_INTERNAL = 2,
904}; 917};
905 918
906/* interrupt statistics */ 919/* interrupt statistics */
@@ -961,7 +974,84 @@ struct traffic_stats {
961}; 974};
962#endif 975#endif
963 976
964#define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ 977/*
978 * iwl_switch_rxon: "channel switch" structure
979 *
980 * @ switch_in_progress: channel switch in progress
981 * @ channel: new channel
982 */
983struct iwl_switch_rxon {
984 bool switch_in_progress;
985 __le16 channel;
986};
987
988/*
989 * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
990 * to perform continuous uCode event logging operation if enabled
991 */
992#define UCODE_TRACE_PERIOD (100)
993
994/*
995 * iwl_event_log: current uCode event log position
996 *
997 * @ucode_trace: enable/disable ucode continuous trace timer
998 * @num_wraps: how many times the event buffer wraps
999 * @next_entry: the entry just before the next one that uCode would fill
1000 * @non_wraps_count: counter for no wrap detected when dump ucode events
1001 * @wraps_once_count: counter for wrap once detected when dump ucode events
1002 * @wraps_more_count: counter for wrap more than once detected
1003 * when dump ucode events
1004 */
1005struct iwl_event_log {
1006 bool ucode_trace;
1007 u32 num_wraps;
1008 u32 next_entry;
1009 int non_wraps_count;
1010 int wraps_once_count;
1011 int wraps_more_count;
1012};
1013
1014/*
1015 * host interrupt timeout value
1016 * used with setting interrupt coalescing timer
1017 * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit
1018 *
1019 * default interrupt coalescing timer is 64 x 32 = 2048 usecs
1020 * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs
1021 */
1022#define IWL_HOST_INT_TIMEOUT_MAX (0xFF)
1023#define IWL_HOST_INT_TIMEOUT_DEF (0x40)
1024#define IWL_HOST_INT_TIMEOUT_MIN (0x0)
1025#define IWL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF)
1026#define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10)
1027#define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0)
1028
1029/*
1030 * This is the threshold value of plcp error rate per 100mSecs. It is
1031 * used to set and check for the validity of plcp_delta.
1032 */
1033#define IWL_MAX_PLCP_ERR_THRESHOLD_MIN (0)
1034#define IWL_MAX_PLCP_ERR_THRESHOLD_DEF (50)
1035#define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF (100)
1036#define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200)
1037#define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255)
1038
1039#define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3)
1040#define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5)
1041
1042enum iwl_reset {
1043 IWL_RF_RESET = 0,
1044 IWL_FW_RESET,
1045 IWL_MAX_FORCE_RESET,
1046};
1047
1048struct iwl_force_reset {
1049 int reset_request_count;
1050 int reset_success_count;
1051 int reset_reject_count;
1052 unsigned long reset_duration;
1053 unsigned long last_force_reset_jiffies;
1054};
965 1055
966struct iwl_priv { 1056struct iwl_priv {
967 1057
@@ -976,20 +1066,26 @@ struct iwl_priv {
976 int frames_count; 1066 int frames_count;
977 1067
978 enum ieee80211_band band; 1068 enum ieee80211_band band;
979 int alloc_rxb_skb; 1069 int alloc_rxb_page;
980 1070
981 void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, 1071 void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
982 struct iwl_rx_mem_buffer *rxb); 1072 struct iwl_rx_mem_buffer *rxb);
983 1073
984 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; 1074 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
985 1075
986#if defined(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) || defined(CONFIG_IWL3945_SPECTRUM_MEASUREMENT)
987 /* spectrum measurement report caching */ 1076 /* spectrum measurement report caching */
988 struct iwl_spectrum_notification measure_report; 1077 struct iwl_spectrum_notification measure_report;
989 u8 measurement_status; 1078 u8 measurement_status;
990#endif 1079
991 /* ucode beacon time */ 1080 /* ucode beacon time */
992 u32 ucode_beacon_time; 1081 u32 ucode_beacon_time;
1082 int missed_beacon_threshold;
1083
1084 /* storing the jiffies when the plcp error rate is received */
1085 unsigned long plcp_jiffies;
1086
1087 /* force reset */
1088 struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET];
993 1089
994 /* we allocate array of iwl4965_channel_info for NIC's valid channels. 1090 /* we allocate array of iwl4965_channel_info for NIC's valid channels.
995 * Access via channel # using indirect index array */ 1091 * Access via channel # using indirect index array */
@@ -1008,7 +1104,6 @@ struct iwl_priv {
1008 struct iwl_calib_result calib_results[IWL_CALIB_MAX]; 1104 struct iwl_calib_result calib_results[IWL_CALIB_MAX];
1009 1105
1010 /* Scan related variables */ 1106 /* Scan related variables */
1011 unsigned long last_scan_jiffies;
1012 unsigned long next_scan_jiffies; 1107 unsigned long next_scan_jiffies;
1013 unsigned long scan_start; 1108 unsigned long scan_start;
1014 unsigned long scan_pass_start; 1109 unsigned long scan_pass_start;
@@ -1016,6 +1111,7 @@ struct iwl_priv {
1016 void *scan; 1111 void *scan;
1017 int scan_bands; 1112 int scan_bands;
1018 struct cfg80211_scan_request *scan_request; 1113 struct cfg80211_scan_request *scan_request;
1114 bool is_internal_short_scan;
1019 u8 scan_tx_ant[IEEE80211_NUM_BANDS]; 1115 u8 scan_tx_ant[IEEE80211_NUM_BANDS];
1020 u8 mgmt_tx_ant; 1116 u8 mgmt_tx_ant;
1021 1117
@@ -1024,6 +1120,7 @@ struct iwl_priv {
1024 spinlock_t hcmd_lock; /* protect hcmd */ 1120 spinlock_t hcmd_lock; /* protect hcmd */
1025 spinlock_t reg_lock; /* protect hw register access */ 1121 spinlock_t reg_lock; /* protect hw register access */
1026 struct mutex mutex; 1122 struct mutex mutex;
1123 struct mutex sync_cmd_mutex; /* enable serialization of sync commands */
1027 1124
1028 /* basic pci-network driver stuff */ 1125 /* basic pci-network driver stuff */
1029 struct pci_dev *pci_dev; 1126 struct pci_dev *pci_dev;
@@ -1035,6 +1132,7 @@ struct iwl_priv {
1035 u8 rev_id; 1132 u8 rev_id;
1036 1133
1037 /* uCode images, save to reload in case of failure */ 1134 /* uCode images, save to reload in case of failure */
1135 int fw_index; /* firmware we're trying to load */
1038 u32 ucode_ver; /* version of ucode, copy of 1136 u32 ucode_ver; /* version of ucode, copy of
1039 iwl_ucode.ver */ 1137 iwl_ucode.ver */
1040 struct fw_desc ucode_code; /* runtime inst */ 1138 struct fw_desc ucode_code; /* runtime inst */
@@ -1045,6 +1143,7 @@ struct iwl_priv {
1045 struct fw_desc ucode_boot; /* bootstrap inst */ 1143 struct fw_desc ucode_boot; /* bootstrap inst */
1046 enum ucode_type ucode_type; 1144 enum ucode_type ucode_type;
1047 u8 ucode_write_complete; /* the image write is complete */ 1145 u8 ucode_write_complete; /* the image write is complete */
1146 char firmware_name[25];
1048 1147
1049 1148
1050 struct iwl_rxon_time_cmd rxon_timing; 1149 struct iwl_rxon_time_cmd rxon_timing;
@@ -1056,21 +1155,18 @@ struct iwl_priv {
1056 const struct iwl_rxon_cmd active_rxon; 1155 const struct iwl_rxon_cmd active_rxon;
1057 struct iwl_rxon_cmd staging_rxon; 1156 struct iwl_rxon_cmd staging_rxon;
1058 1157
1059 struct iwl_rxon_cmd recovery_rxon; 1158 struct iwl_switch_rxon switch_rxon;
1060 1159
1061 /* 1st responses from initialize and runtime uCode images. 1160 /* 1st responses from initialize and runtime uCode images.
1062 * 4965's initialize alive response contains some calibration data. */ 1161 * 4965's initialize alive response contains some calibration data. */
1063 struct iwl_init_alive_resp card_alive_init; 1162 struct iwl_init_alive_resp card_alive_init;
1064 struct iwl_alive_resp card_alive; 1163 struct iwl_alive_resp card_alive;
1065 1164
1066#ifdef CONFIG_IWLWIFI_LEDS
1067 unsigned long last_blink_time; 1165 unsigned long last_blink_time;
1068 u8 last_blink_rate; 1166 u8 last_blink_rate;
1069 u8 allow_blinking; 1167 u8 allow_blinking;
1070 u64 led_tpt; 1168 u64 led_tpt;
1071 struct iwl_led led[IWL_LED_TRG_MAX]; 1169
1072 unsigned int rxtxpackets;
1073#endif
1074 u16 active_rate; 1170 u16 active_rate;
1075 u16 active_rate_basic; 1171 u16 active_rate_basic;
1076 1172
@@ -1080,11 +1176,10 @@ struct iwl_priv {
1080 struct iwl_chain_noise_data chain_noise_data; 1176 struct iwl_chain_noise_data chain_noise_data;
1081 __le16 sensitivity_tbl[HD_TABLE_SIZE]; 1177 __le16 sensitivity_tbl[HD_TABLE_SIZE];
1082 1178
1083 struct iwl_ht_info current_ht_config; 1179 struct iwl_ht_config current_ht_config;
1084 u8 last_phy_res[100]; 1180 u8 last_phy_res[100];
1085 1181
1086 /* Rate scaling data */ 1182 /* Rate scaling data */
1087 s8 data_retry_limit;
1088 u8 retry_rate; 1183 u8 retry_rate;
1089 1184
1090 wait_queue_head_t wait_command_queue; 1185 wait_queue_head_t wait_command_queue;
@@ -1093,7 +1188,7 @@ struct iwl_priv {
1093 1188
1094 /* Rx and Tx DMA processing queues */ 1189 /* Rx and Tx DMA processing queues */
1095 struct iwl_rx_queue rxq; 1190 struct iwl_rx_queue rxq;
1096 struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; 1191 struct iwl_tx_queue *txq;
1097 unsigned long txq_ctx_active_msk; 1192 unsigned long txq_ctx_active_msk;
1098 struct iwl_dma_ptr kw; /* keep warm address */ 1193 struct iwl_dma_ptr kw; /* keep warm address */
1099 struct iwl_dma_ptr scd_bc_tbls; 1194 struct iwl_dma_ptr scd_bc_tbls;
@@ -1116,7 +1211,11 @@ struct iwl_priv {
1116 struct iwl_tt_mgmt thermal_throttle; 1211 struct iwl_tt_mgmt thermal_throttle;
1117 1212
1118 struct iwl_notif_statistics statistics; 1213 struct iwl_notif_statistics statistics;
1119 unsigned long last_statistics_time; 1214#ifdef CONFIG_IWLWIFI_DEBUG
1215 struct iwl_notif_statistics accum_statistics;
1216 struct iwl_notif_statistics delta_statistics;
1217 struct iwl_notif_statistics max_delta;
1218#endif
1120 1219
1121 /* context information */ 1220 /* context information */
1122 u16 rates_mask; 1221 u16 rates_mask;
@@ -1149,7 +1248,7 @@ struct iwl_priv {
1149 u32 last_beacon_time; 1248 u32 last_beacon_time;
1150 u64 last_tsf; 1249 u64 last_tsf;
1151 1250
1152 /* eeprom */ 1251 /* eeprom -- this is in the card's little endian byte order */
1153 u8 *eeprom; 1252 u8 *eeprom;
1154 int nvm_device_type; 1253 int nvm_device_type;
1155 struct iwl_eeprom_calib_info *calib_info; 1254 struct iwl_eeprom_calib_info *calib_info;
@@ -1188,20 +1287,16 @@ struct iwl_priv {
1188 1287
1189 struct workqueue_struct *workqueue; 1288 struct workqueue_struct *workqueue;
1190 1289
1191 struct work_struct up;
1192 struct work_struct restart; 1290 struct work_struct restart;
1193 struct work_struct calibrated_work;
1194 struct work_struct scan_completed; 1291 struct work_struct scan_completed;
1195 struct work_struct rx_replenish; 1292 struct work_struct rx_replenish;
1196 struct work_struct abort_scan; 1293 struct work_struct abort_scan;
1197 struct work_struct update_link_led;
1198 struct work_struct auth_work;
1199 struct work_struct report_work;
1200 struct work_struct request_scan; 1294 struct work_struct request_scan;
1201 struct work_struct beacon_update; 1295 struct work_struct beacon_update;
1202 struct work_struct tt_work; 1296 struct work_struct tt_work;
1203 struct work_struct ct_enter; 1297 struct work_struct ct_enter;
1204 struct work_struct ct_exit; 1298 struct work_struct ct_exit;
1299 struct work_struct start_internal_scan;
1205 1300
1206 struct tasklet_struct irq_tasklet; 1301 struct tasklet_struct irq_tasklet;
1207 1302
@@ -1216,6 +1311,7 @@ struct iwl_priv {
1216 /* TX Power */ 1311 /* TX Power */
1217 s8 tx_power_user_lmt; 1312 s8 tx_power_user_lmt;
1218 s8 tx_power_device_lmt; 1313 s8 tx_power_device_lmt;
1314 s8 tx_power_lmt_in_half_dbm; /* max tx power in half-dBm format */
1219 1315
1220 1316
1221#ifdef CONFIG_IWLWIFI_DEBUG 1317#ifdef CONFIG_IWLWIFI_DEBUG
@@ -1231,7 +1327,8 @@ struct iwl_priv {
1231 u16 rx_traffic_idx; 1327 u16 rx_traffic_idx;
1232 u8 *tx_traffic; 1328 u8 *tx_traffic;
1233 u8 *rx_traffic; 1329 u8 *rx_traffic;
1234 struct iwl_debugfs *dbgfs; 1330 struct dentry *debugfs_dir;
1331 u32 dbgfs_sram_offset, dbgfs_sram_len;
1235#endif /* CONFIG_IWLWIFI_DEBUGFS */ 1332#endif /* CONFIG_IWLWIFI_DEBUGFS */
1236#endif /* CONFIG_IWLWIFI_DEBUG */ 1333#endif /* CONFIG_IWLWIFI_DEBUG */
1237 1334
@@ -1241,6 +1338,7 @@ struct iwl_priv {
1241 u32 disable_tx_power_cal; 1338 u32 disable_tx_power_cal;
1242 struct work_struct run_time_calib_work; 1339 struct work_struct run_time_calib_work;
1243 struct timer_list statistics_periodic; 1340 struct timer_list statistics_periodic;
1341 struct timer_list ucode_trace;
1244 bool hw_ready; 1342 bool hw_ready;
1245 /*For 3945*/ 1343 /*For 3945*/
1246#define IWL_DEFAULT_TX_POWER 0x0F 1344#define IWL_DEFAULT_TX_POWER 0x0F
@@ -1248,6 +1346,8 @@ struct iwl_priv {
1248 struct iwl3945_notif_statistics statistics_39; 1346 struct iwl3945_notif_statistics statistics_39;
1249 1347
1250 u32 sta_supp_rates; 1348 u32 sta_supp_rates;
1349
1350 struct iwl_event_log event_log;
1251}; /*iwl_priv */ 1351}; /*iwl_priv */
1252 1352
1253static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id) 1353static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
@@ -1333,4 +1433,15 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch)
1333 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0; 1433 return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
1334} 1434}
1335 1435
1436static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page)
1437{
1438 __free_pages(page, priv->hw_params.rx_page_order);
1439 priv->alloc_rxb_page--;
1440}
1441
1442static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page)
1443{
1444 free_pages(page, priv->hw_params.rx_page_order);
1445 priv->alloc_rxb_page--;
1446}
1336#endif /* __iwl_dev_h__ */ 1447#endif /* __iwl_dev_h__ */