iwlwifi.h 20 KB

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