]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/net/wireless/iwlwifi/iwl-priv.h
[IWLWIFI]: add iwlwifi wireless drivers
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / iwlwifi / iwl-priv.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved.
4  *
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
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  * The full GNU General Public License is included in this distribution in the
19  * file called LICENSE.
20  *
21  * Contact Information:
22  * James P. Ketrenos <ipw2100-admin@linux.intel.com>
23  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24  *
25  *****************************************************************************/
26
27 #ifndef __iwl_priv_h__
28 #define __iwl_priv_h__
29
30 #include <linux/workqueue.h>
31
32 #ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT
33
34 enum {
35         MEASUREMENT_READY = (1 << 0),
36         MEASUREMENT_ACTIVE = (1 << 1),
37 };
38
39 #endif
40
41 struct iwl_priv {
42
43         /* ieee device used by generic ieee processing code */
44         struct ieee80211_hw *hw;
45         struct ieee80211_channel *ieee_channels;
46         struct ieee80211_rate *ieee_rates;
47
48         /* temporary frame storage list */
49         struct list_head free_frames;
50         int frames_count;
51
52         u8 phymode;
53         int alloc_rxb_skb;
54
55         void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
56                                        struct iwl_rx_mem_buffer *rxb);
57
58         const struct ieee80211_hw_mode *modes;
59
60 #ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT
61         /* spectrum measurement report caching */
62         struct iwl_spectrum_notification measure_report;
63         u8 measurement_status;
64 #endif
65         /* ucode beacon time */
66         u32 ucode_beacon_time;
67
68         /* we allocate array of iwl_channel_info for NIC's valid channels.
69          *    Access via channel # using indirect index array */
70         struct iwl_channel_info *channel_info;  /* channel info array */
71         u8 channel_count;       /* # of channels */
72
73         /* each calibration channel group in the EEPROM has a derived
74          * clip setting for each rate. */
75         const struct iwl_clip_group clip_groups[5];
76
77         /* thermal calibration */
78         s32 temperature;        /* degrees Kelvin */
79         s32 last_temperature;
80
81         /* Scan related variables */
82         unsigned long last_scan_jiffies;
83         unsigned long scan_start;
84         unsigned long scan_pass_start;
85         unsigned long scan_start_tsf;
86         int scan_bands;
87         int one_direct_scan;
88         u8 direct_ssid_len;
89         u8 direct_ssid[IW_ESSID_MAX_SIZE];
90         struct iwl_scan_cmd *scan;
91         u8 only_active_channel;
92
93         /* spinlock */
94         spinlock_t lock;        /* protect general shared data */
95         spinlock_t hcmd_lock;   /* protect hcmd */
96         struct mutex mutex;
97
98         /* basic pci-network driver stuff */
99         struct pci_dev *pci_dev;
100
101         /* pci hardware address support */
102         void __iomem *hw_base;
103
104         /* uCode images, save to reload in case of failure */
105         struct fw_image_desc ucode_code;        /* runtime inst */
106         struct fw_image_desc ucode_data;        /* runtime data original */
107         struct fw_image_desc ucode_data_backup; /* runtime data save/restore */
108         struct fw_image_desc ucode_init;        /* initialization inst */
109         struct fw_image_desc ucode_init_data;   /* initialization data */
110         struct fw_image_desc ucode_boot;        /* bootstrap inst */
111
112
113         struct iwl_rxon_time_cmd rxon_timing;
114
115         /* We declare this const so it can only be
116          * changed via explicit cast within the
117          * routines that actually update the physical
118          * hardware */
119         const struct iwl_rxon_cmd active_rxon;
120         struct iwl_rxon_cmd staging_rxon;
121
122         int error_recovering;
123         struct iwl_rxon_cmd recovery_rxon;
124
125         /* 1st responses from initialize and runtime uCode images.
126          * 4965's initialize alive response contains some calibration data. */
127         struct iwl_init_alive_resp card_alive_init;
128         struct iwl_alive_resp card_alive;
129
130 #ifdef LED
131         /* LED related variables */
132         struct iwl_activity_blink activity;
133         unsigned long led_packets;
134         int led_state;
135 #endif
136
137         u16 active_rate;
138         u16 active_rate_basic;
139
140         u8 call_post_assoc_from_beacon;
141         u8 assoc_station_added;
142 #if IWL == 4965
143         u8 use_ant_b_for_management_frame;      /* Tx antenna selection */
144         /* HT variables */
145         u8 is_dup;
146         u8 is_ht_enabled;
147         u8 channel_width;       /* 0=20MHZ, 1=40MHZ */
148         u8 current_channel_width;
149         u8 valid_antenna;       /* Bit mask of antennas actually connected */
150 #ifdef CONFIG_IWLWIFI_SENSITIVITY
151         struct iwl_sensitivity_data sensitivity_data;
152         struct iwl_chain_noise_data chain_noise_data;
153         u8 start_calib;
154         __le16 sensitivity_tbl[HD_TABLE_SIZE];
155 #endif /*CONFIG_IWLWIFI_SENSITIVITY*/
156
157 #ifdef CONFIG_IWLWIFI_HT
158         struct sta_ht_info current_assoc_ht;
159 #endif
160         u8 active_rate_ht[2];
161         u8 last_phy_res[100];
162
163         /* Rate scaling data */
164         struct iwl_lq_mngr lq_mngr;
165 #endif
166
167         /* Rate scaling data */
168         s8 data_retry_limit;
169         u8 retry_rate;
170
171         wait_queue_head_t wait_command_queue;
172
173         int activity_timer_active;
174
175         /* Rx and Tx DMA processing queues */
176         struct iwl_rx_queue rxq;
177         struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES];
178 #if IWL == 4965
179         unsigned long txq_ctx_active_msk;
180         struct iwl_kw kw;       /* keep warm address */
181         u32 scd_base_addr;      /* scheduler sram base address */
182 #endif
183
184         unsigned long status;
185         u32 config;
186
187         int last_rx_rssi;       /* From Rx packet statisitics */
188         int last_rx_noise;      /* From beacon statistics */
189
190         struct iwl_power_mgr power_data;
191
192         struct iwl_notif_statistics statistics;
193         unsigned long last_statistics_time;
194
195         /* context information */
196         u8 essid[IW_ESSID_MAX_SIZE];
197         u8 essid_len;
198         u16 rates_mask;
199
200         u32 power_mode;
201         u32 antenna;
202         u8 bssid[ETH_ALEN];
203         u16 rts_threshold;
204         u8 mac_addr[ETH_ALEN];
205
206         /*station table variables */
207         spinlock_t sta_lock;
208         int num_stations;
209         struct iwl_station_entry stations[IWL_STATION_COUNT];
210
211         /* Indication if ieee80211_ops->open has been called */
212         int is_open;
213
214         u8 mac80211_registered;
215         int is_abg;
216
217         u32 notif_missed_beacons;
218
219         /* Rx'd packet timing information */
220         u32 last_beacon_time;
221         u64 last_tsf;
222
223         /* Duplicate packet detection */
224         u16 last_seq_num;
225         u16 last_frag_num;
226         unsigned long last_packet_time;
227         struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE];
228
229         /* eeprom */
230         struct iwl_eeprom eeprom;
231
232         int iw_mode;
233
234         struct sk_buff *ibss_beacon;
235
236         /* Last Rx'd beacon timestamp */
237         u32 timestamp0;
238         u32 timestamp1;
239         u16 beacon_int;
240         struct iwl_driver_hw_info hw_setting;
241         int interface_id;
242
243         /* Current association information needed to configure the
244          * hardware */
245         u16 assoc_id;
246         u16 assoc_capability;
247         u8 ps_mode;
248
249 #ifdef CONFIG_IWLWIFI_QOS
250         struct iwl_qos_info qos_data;
251 #endif /*CONFIG_IWLWIFI_QOS */
252
253         struct workqueue_struct *workqueue;
254
255         struct work_struct up;
256         struct work_struct restart;
257         struct work_struct calibrated_work;
258         struct work_struct scan_completed;
259         struct work_struct rx_replenish;
260         struct work_struct rf_kill;
261         struct work_struct abort_scan;
262         struct work_struct update_link_led;
263         struct work_struct auth_work;
264         struct work_struct report_work;
265         struct work_struct request_scan;
266         struct work_struct beacon_update;
267
268         struct tasklet_struct irq_tasklet;
269
270         struct delayed_work init_alive_start;
271         struct delayed_work alive_start;
272         struct delayed_work activity_timer;
273         struct delayed_work thermal_periodic;
274         struct delayed_work gather_stats;
275         struct delayed_work scan_check;
276         struct delayed_work post_associate;
277
278 #define IWL_DEFAULT_TX_POWER 0x0F
279         s8 user_txpower_limit;
280         s8 max_channel_txpower_limit;
281         u32 cck_power_index_compensation;
282
283 #ifdef CONFIG_PM
284         u32 pm_state[16];
285 #endif
286
287 #ifdef CONFIG_IWLWIFI_DEBUG
288         /* debugging info */
289         u32 framecnt_to_us;
290         atomic_t restrict_refcnt;
291 #endif
292
293 #if IWL == 4965
294         struct work_struct txpower_work;
295 #ifdef CONFIG_IWLWIFI_SENSITIVITY
296         struct work_struct sensitivity_work;
297 #endif
298         struct work_struct statistics_work;
299         struct timer_list statistics_periodic;
300
301 #ifdef CONFIG_IWLWIFI_HT_AGG
302         struct work_struct agg_work;
303 #endif
304
305 #endif /* 4965 */
306 };                              /*iwl_priv */
307
308 #endif /* __iwl_priv_h__ */