iwlwifi.h 21 KB

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