]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/net/wireless/iwlwifi/iwlwifi.h
96558cc60ae64e5cd4622c7bcda09aa60513cac4
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / iwlwifi / iwlwifi.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved.
4  *
5  * Portions of this file are derived from the ipw3945 project, as well
6  * as portions of the ieee80211 subsystem header files.
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of version 2 of the GNU General Public License as
10  * published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  * more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20  *
21  * The full GNU General Public License is included in this distribution in the
22  * file called LICENSE.
23  *
24  * Contact Information:
25  * James P. Ketrenos <ipw2100-admin@linux.intel.com>
26  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27  *
28  *****************************************************************************/
29
30 #ifndef __iwlwifi_h__
31 #define __iwlwifi_h__
32
33 #include <linux/pci.h> /* for struct pci_device_id */
34 #include <linux/kernel.h>
35 #include <net/ieee80211_radiotap.h>
36
37 struct iwl_priv;
38
39 /* Hardware specific file defines the PCI IDs table for that hardware module */
40 extern struct pci_device_id iwl_hw_card_ids[];
41
42 #include "iwl-hw.h"
43 #if IWL == 3945
44 #define DRV_NAME        "iwl3945"
45 #include "iwl-3945-hw.h"
46 #elif IWL == 4965
47 #define DRV_NAME        "iwl4965"
48 #include "iwl-4965-hw.h"
49 #endif
50
51 #include "iwl-prph.h"
52
53 /*
54  * Driver implementation data structures, constants, inline
55  * functions
56  *
57  * NOTE:  DO NOT PUT HARDWARE/UCODE SPECIFIC DECLARATIONS HERE
58  *
59  * Hardware specific declarations go into iwl-*hw.h
60  *
61  */
62
63 #include "iwl-debug.h"
64
65 /* Default noise level to report when noise measurement is not available.
66  *   This may be because we're:
67  *   1)  Not associated (4965, no beacon statistics being sent to driver)
68  *   2)  Scanning (noise measurement does not apply to associated channel)
69  *   3)  Receiving CCK (3945 delivers noise info only for OFDM frames)
70  * Use default noise value of -127 ... this is below the range of measurable
71  *   Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user.
72  *   Also, -127 works better than 0 when averaging frames with/without
73  *   noise info (e.g. averaging might be done in app); measured dBm values are
74  *   always negative ... using a negative value as the default keeps all
75  *   averages within an s8's (used in some apps) range of negative values. */
76 #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
77
78 /* Module parameters accessible from iwl-*.c */
79 extern int iwl_param_hwcrypto;
80 extern int iwl_param_queues_num;
81
82 enum iwl_antenna {
83         IWL_ANTENNA_DIVERSITY,
84         IWL_ANTENNA_MAIN,
85         IWL_ANTENNA_AUX
86 };
87
88 /*
89  * RTS threshold here is total size [2347] minus 4 FCS bytes
90  * Per spec:
91  *   a value of 0 means RTS on all data/management packets
92  *   a value > max MSDU size means no RTS
93  * else RTS for data/management frames where MPDU is larger
94  *   than RTS value.
95  */
96 #define DEFAULT_RTS_THRESHOLD     2347U
97 #define MIN_RTS_THRESHOLD         0U
98 #define MAX_RTS_THRESHOLD         2347U
99 #define MAX_MSDU_SIZE             2304U
100 #define MAX_MPDU_SIZE             2346U
101 #define DEFAULT_BEACON_INTERVAL   100U
102 #define DEFAULT_SHORT_RETRY_LIMIT 7U
103 #define DEFAULT_LONG_RETRY_LIMIT  4U
104
105 struct iwl_rx_mem_buffer {
106         dma_addr_t dma_addr;
107         struct sk_buff *skb;
108         struct list_head list;
109 };
110
111 struct iwl_rt_rx_hdr {
112         struct ieee80211_radiotap_header rt_hdr;
113         __le64 rt_tsf;          /* TSF */
114         u8 rt_flags;            /* radiotap packet flags */
115         u8 rt_rate;             /* rate in 500kb/s */
116         __le16 rt_channelMHz;   /* channel in MHz */
117         __le16 rt_chbitmask;    /* channel bitfield */
118         s8 rt_dbmsignal;        /* signal in dBm, kluged to signed */
119         s8 rt_dbmnoise;
120         u8 rt_antenna;          /* antenna number */
121         u8 payload[0];          /* payload... */
122 } __attribute__ ((packed));
123
124 struct iwl_rt_tx_hdr {
125         struct ieee80211_radiotap_header rt_hdr;
126         u8 rt_rate;             /* rate in 500kb/s */
127         __le16 rt_channel;      /* channel in mHz */
128         __le16 rt_chbitmask;    /* channel bitfield */
129         s8 rt_dbmsignal;        /* signal in dBm, kluged to signed */
130         u8 rt_antenna;          /* antenna number */
131         u8 payload[0];          /* payload... */
132 } __attribute__ ((packed));
133
134 /*
135  * Generic queue structure
136  *
137  * Contains common data for Rx and Tx queues
138  */
139 struct iwl_queue {
140         int n_bd;              /* number of BDs in this queue */
141         int write_ptr;       /* 1-st empty entry (index) host_w*/
142         int read_ptr;         /* last used entry (index) host_r*/
143         dma_addr_t dma_addr;   /* physical addr for BD's */
144         int n_window;          /* safe queue window */
145         u32 id;
146         int low_mark;          /* low watermark, resume queue if free
147                                 * space more than this */
148         int high_mark;         /* high watermark, stop queue if free
149                                 * space less than this */
150 } __attribute__ ((packed));
151
152 #define MAX_NUM_OF_TBS          (20)
153
154 struct iwl_tx_info {
155         struct ieee80211_tx_status status;
156         struct sk_buff *skb[MAX_NUM_OF_TBS];
157 };
158
159 /**
160  * struct iwl_tx_queue - Tx Queue for DMA
161  * @need_update: need to update read/write index
162  * @shed_retry: queue is HT AGG enabled
163  *
164  * Queue consists of circular buffer of BD's and required locking structures.
165  */
166 struct iwl_tx_queue {
167         struct iwl_queue q;
168         struct iwl_tfd_frame *bd;
169         struct iwl_cmd *cmd;
170         dma_addr_t dma_addr_cmd;
171         struct iwl_tx_info *txb;
172         int need_update;
173         int sched_retry;
174         int active;
175 };
176
177 #include "iwl-channel.h"
178
179 #if IWL == 3945
180 #include "iwl-3945-rs.h"
181 #else
182 #include "iwl-4965-rs.h"
183 #endif
184
185 #define IWL_TX_FIFO_AC0 0
186 #define IWL_TX_FIFO_AC1 1
187 #define IWL_TX_FIFO_AC2 2
188 #define IWL_TX_FIFO_AC3 3
189 #define IWL_TX_FIFO_HCCA_1      5
190 #define IWL_TX_FIFO_HCCA_2      6
191 #define IWL_TX_FIFO_NONE        7
192
193 /* Minimum number of queues. MAX_NUM is defined in hw specific files */
194 #define IWL_MIN_NUM_QUEUES      4
195
196 /* Power management (not Tx power) structures */
197
198 struct iwl_power_vec_entry {
199         struct iwl_powertable_cmd cmd;
200         u8 no_dtim;
201 };
202 #define IWL_POWER_RANGE_0  (0)
203 #define IWL_POWER_RANGE_1  (1)
204
205 #define IWL_POWER_MODE_CAM      0x00    /* Continuously Aware Mode, always on */
206 #define IWL_POWER_INDEX_3       0x03
207 #define IWL_POWER_INDEX_5       0x05
208 #define IWL_POWER_AC            0x06
209 #define IWL_POWER_BATTERY       0x07
210 #define IWL_POWER_LIMIT         0x07
211 #define IWL_POWER_MASK          0x0F
212 #define IWL_POWER_ENABLED       0x10
213 #define IWL_POWER_LEVEL(x)      ((x) & IWL_POWER_MASK)
214
215 struct iwl_power_mgr {
216         spinlock_t lock;
217         struct iwl_power_vec_entry pwr_range_0[IWL_POWER_AC];
218         struct iwl_power_vec_entry pwr_range_1[IWL_POWER_AC];
219         u8 active_index;
220         u32 dtim_val;
221 };
222
223 #define IEEE80211_DATA_LEN              2304
224 #define IEEE80211_4ADDR_LEN             30
225 #define IEEE80211_HLEN                  (IEEE80211_4ADDR_LEN)
226 #define IEEE80211_FRAME_LEN             (IEEE80211_DATA_LEN + IEEE80211_HLEN)
227
228 struct iwl_frame {
229         union {
230                 struct ieee80211_hdr frame;
231                 struct iwl_tx_beacon_cmd beacon;
232                 u8 raw[IEEE80211_FRAME_LEN];
233                 u8 cmd[360];
234         } u;
235         struct list_head list;
236 };
237
238 #define SEQ_TO_QUEUE(x)  ((x >> 8) & 0xbf)
239 #define QUEUE_TO_SEQ(x)  ((x & 0xbf) << 8)
240 #define SEQ_TO_INDEX(x) (x & 0xff)
241 #define INDEX_TO_SEQ(x) (x & 0xff)
242 #define SEQ_HUGE_FRAME  (0x4000)
243 #define SEQ_RX_FRAME    __constant_cpu_to_le16(0x8000)
244 #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
245 #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
246 #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
247
248 enum {
249         /* CMD_SIZE_NORMAL = 0, */
250         CMD_SIZE_HUGE = (1 << 0),
251         /* CMD_SYNC = 0, */
252         CMD_ASYNC = (1 << 1),
253         /* CMD_NO_SKB = 0, */
254         CMD_WANT_SKB = (1 << 2),
255 };
256
257 struct iwl_cmd;
258 struct iwl_priv;
259
260 struct iwl_cmd_meta {
261         struct iwl_cmd_meta *source;
262         union {
263                 struct sk_buff *skb;
264                 int (*callback)(struct iwl_priv *priv,
265                                 struct iwl_cmd *cmd, struct sk_buff *skb);
266         } __attribute__ ((packed)) u;
267
268         /* The CMD_SIZE_HUGE flag bit indicates that the command
269          * structure is stored at the end of the shared queue memory. */
270         u32 flags;
271
272 } __attribute__ ((packed));
273
274 struct iwl_cmd {
275         struct iwl_cmd_meta meta;
276         struct iwl_cmd_header hdr;
277         union {
278                 struct iwl_addsta_cmd addsta;
279                 struct iwl_led_cmd led;
280                 u32 flags;
281                 u8 val8;
282                 u16 val16;
283                 u32 val32;
284                 struct iwl_bt_cmd bt;
285                 struct iwl_rxon_time_cmd rxon_time;
286                 struct iwl_powertable_cmd powertable;
287                 struct iwl_qosparam_cmd qosparam;
288                 struct iwl_tx_cmd tx;
289                 struct iwl_tx_beacon_cmd tx_beacon;
290                 struct iwl_rxon_assoc_cmd rxon_assoc;
291                 u8 *indirect;
292                 u8 payload[360];
293         } __attribute__ ((packed)) cmd;
294 } __attribute__ ((packed));
295
296 struct iwl_host_cmd {
297         u8 id;
298         u16 len;
299         struct iwl_cmd_meta meta;
300         const void *data;
301 };
302
303 #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
304                               sizeof(struct iwl_cmd_meta))
305
306 /*
307  * RX related structures and functions
308  */
309 #define RX_FREE_BUFFERS 64
310 #define RX_LOW_WATERMARK 8
311
312 #define SUP_RATE_11A_MAX_NUM_CHANNELS  8
313 #define SUP_RATE_11B_MAX_NUM_CHANNELS  4
314 #define SUP_RATE_11G_MAX_NUM_CHANNELS  12
315
316 /**
317  * struct iwl_rx_queue - Rx queue
318  * @processed: Internal index to last handled Rx packet
319  * @read: Shared index to newest available Rx buffer
320  * @write: Shared index to oldest written Rx packet
321  * @free_count: Number of pre-allocated buffers in rx_free
322  * @rx_free: list of free SKBs for use
323  * @rx_used: List of Rx buffers with no SKB
324  * @need_update: flag to indicate we need to update read/write index
325  *
326  * NOTE:  rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
327  */
328 struct iwl_rx_queue {
329         __le32 *bd;
330         dma_addr_t dma_addr;
331         struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
332         struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
333         u32 processed;
334         u32 read;
335         u32 write;
336         u32 free_count;
337         struct list_head rx_free;
338         struct list_head rx_used;
339         int need_update;
340         spinlock_t lock;
341 };
342
343 #define IWL_SUPPORTED_RATES_IE_LEN         8
344
345 #define SCAN_INTERVAL 100
346
347 #define MAX_A_CHANNELS  252
348 #define MIN_A_CHANNELS  7
349
350 #define MAX_B_CHANNELS  14
351 #define MIN_B_CHANNELS  1
352
353 #define STATUS_HCMD_ACTIVE      0       /* host command in progress */
354 #define STATUS_INT_ENABLED      1
355 #define STATUS_RF_KILL_HW       2
356 #define STATUS_RF_KILL_SW       3
357 #define STATUS_INIT             4
358 #define STATUS_ALIVE            5
359 #define STATUS_READY            6
360 #define STATUS_TEMPERATURE      7
361 #define STATUS_GEO_CONFIGURED   8
362 #define STATUS_EXIT_PENDING     9
363 #define STATUS_IN_SUSPEND       10
364 #define STATUS_STATISTICS       11
365 #define STATUS_SCANNING         12
366 #define STATUS_SCAN_ABORTING    13
367 #define STATUS_SCAN_HW          14
368 #define STATUS_POWER_PMI        15
369 #define STATUS_FW_ERROR         16
370
371 #define MAX_TID_COUNT        9
372
373 #define IWL_INVALID_RATE     0xFF
374 #define IWL_INVALID_VALUE    -1
375
376 #if IWL == 4965
377 #ifdef CONFIG_IWLWIFI_HT
378 #ifdef CONFIG_IWLWIFI_HT_AGG
379 struct iwl_ht_agg {
380         u16 txq_id;
381         u16 frame_count;
382         u16 wait_for_ba;
383         u16 start_idx;
384         u32 bitmap0;
385         u32 bitmap1;
386         u32 rate_n_flags;
387 };
388 #endif /* CONFIG_IWLWIFI_HT_AGG */
389 #endif /* CONFIG_IWLWIFI_HT */
390 #endif
391
392 struct iwl_tid_data {
393         u16 seq_number;
394 #if IWL == 4965
395 #ifdef CONFIG_IWLWIFI_HT
396 #ifdef CONFIG_IWLWIFI_HT_AGG
397         struct iwl_ht_agg agg;
398 #endif  /* CONFIG_IWLWIFI_HT_AGG */
399 #endif /* CONFIG_IWLWIFI_HT */
400 #endif
401 };
402
403 struct iwl_hw_key {
404         enum ieee80211_key_alg alg;
405         int keylen;
406         u8 key[32];
407 };
408
409 union iwl_ht_rate_supp {
410         u16 rates;
411         struct {
412                 u8 siso_rate;
413                 u8 mimo_rate;
414         };
415 };
416
417 #ifdef CONFIG_IWLWIFI_HT
418 #define CFG_HT_RX_AMPDU_FACTOR_DEF  (0x3)
419 #define HT_IE_MAX_AMSDU_SIZE_4K     (0)
420 #define CFG_HT_MPDU_DENSITY_2USEC   (0x5)
421 #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC
422
423 struct sta_ht_info {
424         u8 is_ht;
425         u16 rx_mimo_ps_mode;
426         u16 tx_mimo_ps_mode;
427         u16 control_channel;
428         u8 max_amsdu_size;
429         u8 ampdu_factor;
430         u8 mpdu_density;
431         u8 operating_mode;
432         u8 supported_chan_width;
433         u8 extension_chan_offset;
434         u8 is_green_field;
435         u8 sgf;
436         u8 supp_rates[16];
437         u8 tx_chan_width;
438         u8 chan_width_cap;
439 };
440 #endif                          /*CONFIG_IWLWIFI_HT */
441
442 #ifdef CONFIG_IWLWIFI_QOS
443
444 union iwl_qos_capabity {
445         struct {
446                 u8 edca_count:4;        /* bit 0-3 */
447                 u8 q_ack:1;             /* bit 4 */
448                 u8 queue_request:1;     /* bit 5 */
449                 u8 txop_request:1;      /* bit 6 */
450                 u8 reserved:1;          /* bit 7 */
451         } q_AP;
452         struct {
453                 u8 acvo_APSD:1;         /* bit 0 */
454                 u8 acvi_APSD:1;         /* bit 1 */
455                 u8 ac_bk_APSD:1;        /* bit 2 */
456                 u8 ac_be_APSD:1;        /* bit 3 */
457                 u8 q_ack:1;             /* bit 4 */
458                 u8 max_len:2;           /* bit 5-6 */
459                 u8 more_data_ack:1;     /* bit 7 */
460         } q_STA;
461         u8 val;
462 };
463
464 /* QoS structures */
465 struct iwl_qos_info {
466         int qos_enable;
467         int qos_active;
468         union iwl_qos_capabity qos_cap;
469         struct iwl_qosparam_cmd def_qos_parm;
470 };
471 #endif /*CONFIG_IWLWIFI_QOS */
472
473 #define STA_PS_STATUS_WAKE             0
474 #define STA_PS_STATUS_SLEEP            1
475
476 struct iwl_station_entry {
477         struct iwl_addsta_cmd sta;
478         struct iwl_tid_data tid[MAX_TID_COUNT];
479 #if IWL == 3945
480         union {
481                 struct {
482                         u8 rate;
483                         u8 flags;
484                 } s;
485                 u16 rate_n_flags;
486         } current_rate;
487 #endif
488         u8 used;
489         u8 ps_status;
490         struct iwl_hw_key keyinfo;
491 };
492
493 /* one for each uCode image (inst/data, boot/init/runtime) */
494 struct fw_desc {
495         void *v_addr;           /* access by driver */
496         dma_addr_t p_addr;      /* access by card's busmaster DMA */
497         u32 len;                /* bytes */
498 };
499
500 /* uCode file layout */
501 struct iwl_ucode {
502         __le32 ver;             /* major/minor/subminor */
503         __le32 inst_size;       /* bytes of runtime instructions */
504         __le32 data_size;       /* bytes of runtime data */
505         __le32 init_size;       /* bytes of initialization instructions */
506         __le32 init_data_size;  /* bytes of initialization data */
507         __le32 boot_size;       /* bytes of bootstrap instructions */
508         u8 data[0];             /* data in same order as "size" elements */
509 };
510
511 #define IWL_IBSS_MAC_HASH_SIZE 32
512
513 struct iwl_ibss_seq {
514         u8 mac[ETH_ALEN];
515         u16 seq_num;
516         u16 frag_num;
517         unsigned long packet_time;
518         struct list_head list;
519 };
520
521 struct iwl_driver_hw_info {
522         u16 max_txq_num;
523         u16 ac_queue_count;
524         u16 tx_cmd_len;
525         u16 max_rxq_size;
526         u32 rx_buffer_size;
527         u16 max_rxq_log;
528         u8  max_stations;
529         u8  bcast_sta_id;
530         void *shared_virt;
531         dma_addr_t shared_phys;
532 };
533
534
535 #define STA_FLG_RTS_MIMO_PROT_MSK       __constant_cpu_to_le32(1 << 17)
536 #define STA_FLG_AGG_MPDU_8US_MSK        __constant_cpu_to_le32(1 << 18)
537 #define STA_FLG_MAX_AGG_SIZE_POS        (19)
538 #define STA_FLG_MAX_AGG_SIZE_MSK        __constant_cpu_to_le32(3 << 19)
539 #define STA_FLG_FAT_EN_MSK              __constant_cpu_to_le32(1 << 21)
540 #define STA_FLG_MIMO_DIS_MSK            __constant_cpu_to_le32(1 << 22)
541 #define STA_FLG_AGG_MPDU_DENSITY_POS    (23)
542 #define STA_FLG_AGG_MPDU_DENSITY_MSK    __constant_cpu_to_le32(7 << 23)
543 #define HT_SHORT_GI_20MHZ_ONLY          (1 << 0)
544 #define HT_SHORT_GI_40MHZ_ONLY          (1 << 1)
545
546
547 #include "iwl-priv.h"
548
549 /* Requires full declaration of iwl_priv before including */
550 #include "iwl-io.h"
551
552 #define IWL_RX_HDR(x) ((struct iwl_rx_frame_hdr *)(\
553                        x->u.rx_frame.stats.payload + \
554                        x->u.rx_frame.stats.phy_count))
555 #define IWL_RX_END(x) ((struct iwl_rx_frame_end *)(\
556                        IWL_RX_HDR(x)->payload + \
557                        le16_to_cpu(IWL_RX_HDR(x)->len)))
558 #define IWL_RX_STATS(x) (&x->u.rx_frame.stats)
559 #define IWL_RX_DATA(x) (IWL_RX_HDR(x)->payload)
560
561
562 /******************************************************************************
563  *
564  * Functions implemented in iwl-base.c which are forward declared here
565  * for use by iwl-*.c
566  *
567  *****************************************************************************/
568 struct iwl_addsta_cmd;
569 extern int iwl_send_add_station(struct iwl_priv *priv,
570                                 struct iwl_addsta_cmd *sta, u8 flags);
571 extern u8 iwl_add_station(struct iwl_priv *priv, const u8 *bssid,
572                           int is_ap, u8 flags);
573 extern int iwl_is_network_packet(struct iwl_priv *priv,
574                                  struct ieee80211_hdr *header);
575 extern int iwl_power_init_handle(struct iwl_priv *priv);
576 extern int iwl_eeprom_init(struct iwl_priv *priv);
577 #ifdef CONFIG_IWLWIFI_DEBUG
578 extern void iwl_report_frame(struct iwl_priv *priv,
579                              struct iwl_rx_packet *pkt,
580                              struct ieee80211_hdr *header, int group100);
581 #else
582 static inline void iwl_report_frame(struct iwl_priv *priv,
583                                     struct iwl_rx_packet *pkt,
584                                     struct ieee80211_hdr *header,
585                                     int group100) {}
586 #endif
587 extern void iwl_handle_data_packet_monitor(struct iwl_priv *priv,
588                                            struct iwl_rx_mem_buffer *rxb,
589                                            void *data, short len,
590                                            struct ieee80211_rx_status *stats,
591                                            u16 phy_flags);
592 extern int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr
593                                *header);
594 extern int iwl_rx_queue_alloc(struct iwl_priv *priv);
595 extern void iwl_rx_queue_reset(struct iwl_priv *priv,
596                                struct iwl_rx_queue *rxq);
597 extern int iwl_calc_db_from_ratio(int sig_ratio);
598 extern int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm);
599 extern int iwl_tx_queue_init(struct iwl_priv *priv,
600                              struct iwl_tx_queue *txq, int count, u32 id);
601 extern void iwl_rx_replenish(void *data);
602 extern void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq);
603 extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,
604                             const void *data);
605 extern int __must_check iwl_send_cmd(struct iwl_priv *priv,
606                 struct iwl_host_cmd *cmd);
607 extern unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
608                                         struct ieee80211_hdr *hdr,
609                                         const u8 *dest, int left);
610 extern int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv,
611                                          struct iwl_rx_queue *q);
612 extern int iwl_send_statistics_request(struct iwl_priv *priv);
613 extern void iwl_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
614                                    u32 decrypt_res,
615                                    struct ieee80211_rx_status *stats);
616 #if IWL == 4965
617 extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr);
618 #endif
619
620 extern const u8 BROADCAST_ADDR[ETH_ALEN];
621
622 /*
623  * Currently used by iwl-3945-rs... look at restructuring so that it doesn't
624  * call this... todo... fix that.
625 */
626 extern u8 iwl_sync_station(struct iwl_priv *priv, int sta_id,
627                            u16 tx_rate, u8 flags);
628
629 static inline int iwl_is_associated(struct iwl_priv *priv)
630 {
631         return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
632 }
633
634 /******************************************************************************
635  *
636  * Functions implemented in iwl-[34]*.c which are forward declared here
637  * for use by iwl-base.c
638  *
639  * NOTE:  The implementation of these functions are hardware specific
640  * which is why they are in the hardware specific files (vs. iwl-base.c)
641  *
642  * Naming convention --
643  * iwl_         <-- Its part of iwlwifi (should be changed to iwl_)
644  * iwl_hw_      <-- Hardware specific (implemented in iwl-XXXX.c by all HW)
645  * iwlXXXX_     <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
646  * iwl_bg_      <-- Called from work queue context
647  * iwl_mac_     <-- mac80211 callback
648  *
649  ****************************************************************************/
650 extern void iwl_hw_rx_handler_setup(struct iwl_priv *priv);
651 extern void iwl_hw_setup_deferred_work(struct iwl_priv *priv);
652 extern void iwl_hw_cancel_deferred_work(struct iwl_priv *priv);
653 extern int iwl_hw_rxq_stop(struct iwl_priv *priv);
654 extern int iwl_hw_set_hw_setting(struct iwl_priv *priv);
655 extern int iwl_hw_nic_init(struct iwl_priv *priv);
656 extern int iwl_hw_nic_stop_master(struct iwl_priv *priv);
657 extern void iwl_hw_txq_ctx_free(struct iwl_priv *priv);
658 extern void iwl_hw_txq_ctx_stop(struct iwl_priv *priv);
659 extern int iwl_hw_nic_reset(struct iwl_priv *priv);
660 extern int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
661                                         dma_addr_t addr, u16 len);
662 extern int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq);
663 extern int iwl_hw_get_temperature(struct iwl_priv *priv);
664 extern int iwl_hw_tx_queue_init(struct iwl_priv *priv,
665                                 struct iwl_tx_queue *txq);
666 extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
667                                  struct iwl_frame *frame, u8 rate);
668 extern int iwl_hw_get_rx_read(struct iwl_priv *priv);
669 extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
670                                      struct iwl_cmd *cmd,
671                                      struct ieee80211_tx_control *ctrl,
672                                      struct ieee80211_hdr *hdr,
673                                      int sta_id, int tx_id);
674 extern int iwl_hw_reg_send_txpower(struct iwl_priv *priv);
675 extern int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
676 extern void iwl_hw_rx_statistics(struct iwl_priv *priv,
677                                  struct iwl_rx_mem_buffer *rxb);
678 extern void iwl_disable_events(struct iwl_priv *priv);
679 extern int iwl4965_get_temperature(const struct iwl_priv *priv);
680
681 /**
682  * iwl_hw_find_station - Find station id for a given BSSID
683  * @bssid: MAC address of station ID to find
684  *
685  * NOTE:  This should not be hardware specific but the code has
686  * not yet been merged into a single common layer for managing the
687  * station tables.
688  */
689 extern u8 iwl_hw_find_station(struct iwl_priv *priv, const u8 *bssid);
690
691 extern int iwl_hw_channel_switch(struct iwl_priv *priv, u16 channel);
692 #if IWL == 4965
693 extern int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index);
694 #endif
695 #endif