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.h128
1 files changed, 83 insertions, 45 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 028d50599550..9dea8fa08c0e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -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"
@@ -57,17 +56,22 @@ extern struct iwl_cfg iwl5100_bg_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 iwl6000h_2agn_cfg;
59extern struct iwl_cfg iwl6000h_2abg_cfg;
60extern struct iwl_cfg iwl6000h_2bg_cfg;
60extern struct iwl_cfg iwl6000i_2agn_cfg; 61extern struct iwl_cfg iwl6000i_2agn_cfg;
62extern struct iwl_cfg iwl6000i_2abg_cfg;
63extern struct iwl_cfg iwl6000i_2bg_cfg;
61extern struct iwl_cfg iwl6000_3agn_cfg; 64extern struct iwl_cfg iwl6000_3agn_cfg;
62extern struct iwl_cfg iwl6050_2agn_cfg; 65extern struct iwl_cfg iwl6050_2agn_cfg;
66extern struct iwl_cfg iwl6050_2abg_cfg;
63extern struct iwl_cfg iwl6050_3agn_cfg; 67extern struct iwl_cfg iwl6050_3agn_cfg;
64extern struct iwl_cfg iwl1000_bgn_cfg; 68extern struct iwl_cfg iwl1000_bgn_cfg;
69extern struct iwl_cfg iwl1000_bg_cfg;
65 70
66struct iwl_tx_queue; 71struct iwl_tx_queue;
67 72
68/* shared structures from iwl-5000.c */ 73/* shared structures from iwl-5000.c */
69extern struct iwl_mod_params iwl50_mod_params; 74extern struct iwl_mod_params iwl50_mod_params;
70extern struct iwl_ops iwl5000_ops;
71extern struct iwl_ucode_ops iwl5000_ucode; 75extern struct iwl_ucode_ops iwl5000_ucode;
72extern struct iwl_lib_ops iwl5000_lib; 76extern struct iwl_lib_ops iwl5000_lib;
73extern struct iwl_hcmd_ops iwl5000_hcmd; 77extern struct iwl_hcmd_ops iwl5000_hcmd;
@@ -81,9 +85,6 @@ extern void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
81 __le32 *tx_flags); 85 __le32 *tx_flags);
82extern int iwl5000_calc_rssi(struct iwl_priv *priv, 86extern int iwl5000_calc_rssi(struct iwl_priv *priv,
83 struct iwl_rx_phy_res *rx_resp); 87 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); 88extern void iwl5000_nic_config(struct iwl_priv *priv);
88extern u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv); 89extern u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv);
89extern const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv, 90extern const u8 *iwl5000_eeprom_query_addr(const struct iwl_priv *priv,
@@ -144,12 +145,13 @@ extern void iwl5000_temperature(struct iwl_priv *priv);
144#define DEFAULT_LONG_RETRY_LIMIT 4U 145#define DEFAULT_LONG_RETRY_LIMIT 4U
145 146
146struct iwl_rx_mem_buffer { 147struct iwl_rx_mem_buffer {
147 dma_addr_t real_dma_addr; 148 dma_addr_t page_dma;
148 dma_addr_t aligned_dma_addr; 149 struct page *page;
149 struct sk_buff *skb;
150 struct list_head list; 150 struct list_head list;
151}; 151};
152 152
153#define rxb_addr(r) page_address(r->page)
154
153/* defined below */ 155/* defined below */
154struct iwl_device_cmd; 156struct iwl_device_cmd;
155 157
@@ -165,7 +167,7 @@ struct iwl_cmd_meta {
165 */ 167 */
166 void (*callback)(struct iwl_priv *priv, 168 void (*callback)(struct iwl_priv *priv,
167 struct iwl_device_cmd *cmd, 169 struct iwl_device_cmd *cmd,
168 struct sk_buff *skb); 170 struct iwl_rx_packet *pkt);
169 171
170 /* The CMD_SIZE_HUGE flag bit indicates that the command 172 /* The CMD_SIZE_HUGE flag bit indicates that the command
171 * structure is stored at the end of the shared queue memory. */ 173 * structure is stored at the end of the shared queue memory. */
@@ -321,6 +323,13 @@ struct iwl_channel_info {
321 * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */ 323 * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */
322#define IWL_MIN_NUM_QUEUES 10 324#define IWL_MIN_NUM_QUEUES 10
323 325
326/*
327 * Queue #4 is the command queue for 3945/4965/5x00/1000/6x00,
328 * the driver maps it into the appropriate device FIFO for the
329 * uCode.
330 */
331#define IWL_CMD_QUEUE_NUM 4
332
324/* Power management (not Tx power) structures */ 333/* Power management (not Tx power) structures */
325 334
326enum iwl_pwr_src { 335enum iwl_pwr_src {
@@ -356,7 +365,14 @@ enum {
356 CMD_WANT_SKB = (1 << 2), 365 CMD_WANT_SKB = (1 << 2),
357}; 366};
358 367
359#define IWL_CMD_MAX_PAYLOAD 320 368#define DEF_CMD_PAYLOAD_SIZE 320
369
370/*
371 * IWL_LINK_HDR_MAX should include ieee80211_hdr, radiotap header,
372 * SNAP header and alignment. It should also be big enough for 802.11
373 * control frames.
374 */
375#define IWL_LINK_HDR_MAX 64
360 376
361/** 377/**
362 * struct iwl_device_cmd 378 * struct iwl_device_cmd
@@ -373,7 +389,8 @@ struct iwl_device_cmd {
373 u16 val16; 389 u16 val16;
374 u32 val32; 390 u32 val32;
375 struct iwl_tx_cmd tx; 391 struct iwl_tx_cmd tx;
376 u8 payload[IWL_CMD_MAX_PAYLOAD]; 392 struct iwl6000_channel_switch_cmd chswitch;
393 u8 payload[DEF_CMD_PAYLOAD_SIZE];
377 } __attribute__ ((packed)) cmd; 394 } __attribute__ ((packed)) cmd;
378} __attribute__ ((packed)); 395} __attribute__ ((packed));
379 396
@@ -382,21 +399,15 @@ struct iwl_device_cmd {
382 399
383struct iwl_host_cmd { 400struct iwl_host_cmd {
384 const void *data; 401 const void *data;
385 struct sk_buff *reply_skb; 402 unsigned long reply_page;
386 void (*callback)(struct iwl_priv *priv, 403 void (*callback)(struct iwl_priv *priv,
387 struct iwl_device_cmd *cmd, 404 struct iwl_device_cmd *cmd,
388 struct sk_buff *skb); 405 struct iwl_rx_packet *pkt);
389 u32 flags; 406 u32 flags;
390 u16 len; 407 u16 len;
391 u8 id; 408 u8 id;
392}; 409};
393 410
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 411#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
401#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 412#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
402#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 413#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
@@ -502,12 +513,12 @@ union iwl_ht_rate_supp {
502#define CFG_HT_MPDU_DENSITY_4USEC (0x5) 513#define CFG_HT_MPDU_DENSITY_4USEC (0x5)
503#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC 514#define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC
504 515
505struct iwl_ht_info { 516struct iwl_ht_config {
506 /* self configuration data */ 517 /* self configuration data */
507 u8 is_ht; 518 bool is_ht;
508 u8 supported_chan_width; 519 bool is_40mhz;
520 bool single_chain_sufficient;
509 u8 sm_ps; 521 u8 sm_ps;
510 struct ieee80211_mcs_info mcs;
511 /* BSS related data */ 522 /* BSS related data */
512 u8 extension_chan_offset; 523 u8 extension_chan_offset;
513 u8 ht_protection; 524 u8 ht_protection;
@@ -561,6 +572,19 @@ struct iwl_station_entry {
561 struct iwl_hw_key keyinfo; 572 struct iwl_hw_key keyinfo;
562}; 573};
563 574
575/*
576 * iwl_station_priv: Driver's private station information
577 *
578 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
579 * in the structure for use by driver. This structure is places in that
580 * space.
581 *
582 * At the moment use it for the station's rate scaling information.
583 */
584struct iwl_station_priv {
585 struct iwl_lq_sta lq_sta;
586};
587
564/* one for each uCode image (inst/data, boot/init/runtime) */ 588/* one for each uCode image (inst/data, boot/init/runtime) */
565struct fw_desc { 589struct fw_desc {
566 void *v_addr; /* access by driver */ 590 void *v_addr; /* access by driver */
@@ -622,6 +646,10 @@ struct iwl_sensitivity_ranges {
622 u16 auto_corr_max_cck_mrc; 646 u16 auto_corr_max_cck_mrc;
623 u16 auto_corr_min_cck; 647 u16 auto_corr_min_cck;
624 u16 auto_corr_min_cck_mrc; 648 u16 auto_corr_min_cck_mrc;
649
650 u16 barker_corr_th_min;
651 u16 barker_corr_th_min_mrc;
652 u16 nrg_th_cca;
625}; 653};
626 654
627 655
@@ -639,7 +667,7 @@ struct iwl_sensitivity_ranges {
639 * @valid_tx/rx_ant: usable antennas 667 * @valid_tx/rx_ant: usable antennas
640 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2) 668 * @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 669 * @max_rxq_log: Log-base-2 of max_rxq_size
642 * @rx_buf_size: Rx buffer size 670 * @rx_page_order: Rx buffer page order
643 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR 671 * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
644 * @max_stations: 672 * @max_stations:
645 * @bcast_sta_id: 673 * @bcast_sta_id:
@@ -662,9 +690,8 @@ struct iwl_hw_params {
662 u8 valid_rx_ant; 690 u8 valid_rx_ant;
663 u16 max_rxq_size; 691 u16 max_rxq_size;
664 u16 max_rxq_log; 692 u16 max_rxq_log;
665 u32 rx_buf_size; 693 u32 rx_page_order;
666 u32 rx_wrt_ptr_reg; 694 u32 rx_wrt_ptr_reg;
667 u32 max_pkt_size;
668 u8 max_stations; 695 u8 max_stations;
669 u8 bcast_sta_id; 696 u8 bcast_sta_id;
670 u8 ht40_channel; 697 u8 ht40_channel;
@@ -711,7 +738,11 @@ static inline int iwl_queue_used(const struct iwl_queue *q, int i)
711 738
712static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) 739static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
713{ 740{
714 /* This is for scan command, the big buffer at end of command array */ 741 /*
742 * This is for init calibration result and scan command which
743 * required buffer > TFD_MAX_PAYLOAD_SIZE,
744 * the big buffer at end of command array
745 */
715 if (is_huge) 746 if (is_huge)
716 return q->n_window; /* must be power of 2 */ 747 return q->n_window; /* must be power of 2 */
717 748
@@ -726,9 +757,6 @@ struct iwl_dma_ptr {
726 size_t size; 757 size_t size;
727}; 758};
728 759
729#define IWL_CHANNEL_WIDTH_20MHZ 0
730#define IWL_CHANNEL_WIDTH_40MHZ 1
731
732#define IWL_OPERATION_MODE_AUTO 0 760#define IWL_OPERATION_MODE_AUTO 0
733#define IWL_OPERATION_MODE_HT_ONLY 1 761#define IWL_OPERATION_MODE_HT_ONLY 1
734#define IWL_OPERATION_MODE_MIXED 2 762#define IWL_OPERATION_MODE_MIXED 2
@@ -741,7 +769,8 @@ struct iwl_dma_ptr {
741 769
742/* Sensitivity and chain noise calibration */ 770/* Sensitivity and chain noise calibration */
743#define INITIALIZATION_VALUE 0xFFFF 771#define INITIALIZATION_VALUE 0xFFFF
744#define CAL_NUM_OF_BEACONS 20 772#define IWL4965_CAL_NUM_BEACONS 20
773#define IWL_CAL_NUM_BEACONS 16
745#define MAXIMUM_ALLOWED_PATHLOSS 15 774#define MAXIMUM_ALLOWED_PATHLOSS 15
746 775
747#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3 776#define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
@@ -845,6 +874,10 @@ struct iwl_sensitivity_data {
845 s32 nrg_auto_corr_silence_diff; 874 s32 nrg_auto_corr_silence_diff;
846 u32 num_in_cck_no_fa; 875 u32 num_in_cck_no_fa;
847 u32 nrg_th_ofdm; 876 u32 nrg_th_ofdm;
877
878 u16 barker_corr_th_min;
879 u16 barker_corr_th_min_mrc;
880 u16 nrg_th_cca;
848}; 881};
849 882
850/* Chain noise (differential Rx gain) calib data */ 883/* Chain noise (differential Rx gain) calib data */
@@ -894,13 +927,11 @@ enum iwl_access_mode {
894/** 927/**
895 * enum iwl_pa_type - Power Amplifier type 928 * enum iwl_pa_type - Power Amplifier type
896 * @IWL_PA_SYSTEM: based on uCode configuration 929 * @IWL_PA_SYSTEM: based on uCode configuration
897 * @IWL_PA_HYBRID: use both Internal and external PA
898 * @IWL_PA_INTERNAL: use Internal only 930 * @IWL_PA_INTERNAL: use Internal only
899 */ 931 */
900enum iwl_pa_type { 932enum iwl_pa_type {
901 IWL_PA_SYSTEM = 0, 933 IWL_PA_SYSTEM = 0,
902 IWL_PA_HYBRID = 1, 934 IWL_PA_INTERNAL = 1,
903 IWL_PA_INTERNAL = 2,
904}; 935};
905 936
906/* interrupt statistics */ 937/* interrupt statistics */
@@ -961,7 +992,16 @@ struct traffic_stats {
961}; 992};
962#endif 993#endif
963 994
964#define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */ 995/*
996 * iwl_switch_rxon: "channel switch" structure
997 *
998 * @ switch_in_progress: channel switch in progress
999 * @ channel: new channel
1000 */
1001struct iwl_switch_rxon {
1002 bool switch_in_progress;
1003 __le16 channel;
1004};
965 1005
966struct iwl_priv { 1006struct iwl_priv {
967 1007
@@ -976,7 +1016,7 @@ struct iwl_priv {
976 int frames_count; 1016 int frames_count;
977 1017
978 enum ieee80211_band band; 1018 enum ieee80211_band band;
979 int alloc_rxb_skb; 1019 int alloc_rxb_page;
980 1020
981 void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv, 1021 void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
982 struct iwl_rx_mem_buffer *rxb); 1022 struct iwl_rx_mem_buffer *rxb);
@@ -1056,21 +1096,18 @@ struct iwl_priv {
1056 const struct iwl_rxon_cmd active_rxon; 1096 const struct iwl_rxon_cmd active_rxon;
1057 struct iwl_rxon_cmd staging_rxon; 1097 struct iwl_rxon_cmd staging_rxon;
1058 1098
1059 struct iwl_rxon_cmd recovery_rxon; 1099 struct iwl_switch_rxon switch_rxon;
1060 1100
1061 /* 1st responses from initialize and runtime uCode images. 1101 /* 1st responses from initialize and runtime uCode images.
1062 * 4965's initialize alive response contains some calibration data. */ 1102 * 4965's initialize alive response contains some calibration data. */
1063 struct iwl_init_alive_resp card_alive_init; 1103 struct iwl_init_alive_resp card_alive_init;
1064 struct iwl_alive_resp card_alive; 1104 struct iwl_alive_resp card_alive;
1065 1105
1066#ifdef CONFIG_IWLWIFI_LEDS
1067 unsigned long last_blink_time; 1106 unsigned long last_blink_time;
1068 u8 last_blink_rate; 1107 u8 last_blink_rate;
1069 u8 allow_blinking; 1108 u8 allow_blinking;
1070 u64 led_tpt; 1109 u64 led_tpt;
1071 struct iwl_led led[IWL_LED_TRG_MAX]; 1110
1072 unsigned int rxtxpackets;
1073#endif
1074 u16 active_rate; 1111 u16 active_rate;
1075 u16 active_rate_basic; 1112 u16 active_rate_basic;
1076 1113
@@ -1080,11 +1117,10 @@ struct iwl_priv {
1080 struct iwl_chain_noise_data chain_noise_data; 1117 struct iwl_chain_noise_data chain_noise_data;
1081 __le16 sensitivity_tbl[HD_TABLE_SIZE]; 1118 __le16 sensitivity_tbl[HD_TABLE_SIZE];
1082 1119
1083 struct iwl_ht_info current_ht_config; 1120 struct iwl_ht_config current_ht_config;
1084 u8 last_phy_res[100]; 1121 u8 last_phy_res[100];
1085 1122
1086 /* Rate scaling data */ 1123 /* Rate scaling data */
1087 s8 data_retry_limit;
1088 u8 retry_rate; 1124 u8 retry_rate;
1089 1125
1090 wait_queue_head_t wait_command_queue; 1126 wait_queue_head_t wait_command_queue;
@@ -1093,7 +1129,7 @@ struct iwl_priv {
1093 1129
1094 /* Rx and Tx DMA processing queues */ 1130 /* Rx and Tx DMA processing queues */
1095 struct iwl_rx_queue rxq; 1131 struct iwl_rx_queue rxq;
1096 struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES]; 1132 struct iwl_tx_queue *txq;
1097 unsigned long txq_ctx_active_msk; 1133 unsigned long txq_ctx_active_msk;
1098 struct iwl_dma_ptr kw; /* keep warm address */ 1134 struct iwl_dma_ptr kw; /* keep warm address */
1099 struct iwl_dma_ptr scd_bc_tbls; 1135 struct iwl_dma_ptr scd_bc_tbls;
@@ -1116,7 +1152,9 @@ struct iwl_priv {
1116 struct iwl_tt_mgmt thermal_throttle; 1152 struct iwl_tt_mgmt thermal_throttle;
1117 1153
1118 struct iwl_notif_statistics statistics; 1154 struct iwl_notif_statistics statistics;
1119 unsigned long last_statistics_time; 1155#ifdef CONFIG_IWLWIFI_DEBUG
1156 struct iwl_notif_statistics accum_statistics;
1157#endif
1120 1158
1121 /* context information */ 1159 /* context information */
1122 u16 rates_mask; 1160 u16 rates_mask;