iwlwifi.h 21 KB

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