iwl-dev.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * Intel Linux Wireless <ilw@linux.intel.com>
  23. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  24. *
  25. *****************************************************************************/
  26. /*
  27. * Please use this file (iwl-dev.h) for driver implementation definitions.
  28. * Please use iwl-commands.h for uCode API definitions.
  29. * Please use iwl-4965-hw.h for hardware-related definitions.
  30. */
  31. #ifndef __iwl_dev_h__
  32. #define __iwl_dev_h__
  33. #include <linux/pci.h> /* for struct pci_device_id */
  34. #include <linux/kernel.h>
  35. #include <net/ieee80211_radiotap.h>
  36. #include "iwl-eeprom.h"
  37. #include "iwl-csr.h"
  38. #include "iwl-prph.h"
  39. #include "iwl-fh.h"
  40. #include "iwl-debug.h"
  41. #include "iwl-4965-hw.h"
  42. #include "iwl-3945-hw.h"
  43. #include "iwl-3945-led.h"
  44. #include "iwl-led.h"
  45. #include "iwl-power.h"
  46. #include "iwl-agn-rs.h"
  47. /* configuration for the iwl4965 */
  48. extern struct iwl_cfg iwl4965_agn_cfg;
  49. extern struct iwl_cfg iwl5300_agn_cfg;
  50. extern struct iwl_cfg iwl5100_agn_cfg;
  51. extern struct iwl_cfg iwl5350_agn_cfg;
  52. extern struct iwl_cfg iwl5100_bg_cfg;
  53. extern struct iwl_cfg iwl5100_abg_cfg;
  54. extern struct iwl_cfg iwl5150_agn_cfg;
  55. extern struct iwl_cfg iwl6000_2ag_cfg;
  56. extern struct iwl_cfg iwl6000_2agn_cfg;
  57. extern struct iwl_cfg iwl6000_3agn_cfg;
  58. extern struct iwl_cfg iwl6050_2agn_cfg;
  59. extern struct iwl_cfg iwl6050_3agn_cfg;
  60. extern struct iwl_cfg iwl1000_bgn_cfg;
  61. /* shared structures from iwl-5000.c */
  62. extern struct iwl_mod_params iwl50_mod_params;
  63. extern struct iwl_ops iwl5000_ops;
  64. extern struct iwl_lib_ops iwl5000_lib;
  65. extern struct iwl_hcmd_ops iwl5000_hcmd;
  66. extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils;
  67. /* shared functions from iwl-5000.c */
  68. extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len);
  69. extern u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd,
  70. u8 *data);
  71. extern void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
  72. __le32 *tx_flags);
  73. extern int iwl5000_calc_rssi(struct iwl_priv *priv,
  74. struct iwl_rx_phy_res *rx_resp);
  75. /* CT-KILL constants */
  76. #define CT_KILL_THRESHOLD 110 /* in Celsius */
  77. /* Default noise level to report when noise measurement is not available.
  78. * This may be because we're:
  79. * 1) Not associated (4965, no beacon statistics being sent to driver)
  80. * 2) Scanning (noise measurement does not apply to associated channel)
  81. * 3) Receiving CCK (3945 delivers noise info only for OFDM frames)
  82. * Use default noise value of -127 ... this is below the range of measurable
  83. * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user.
  84. * Also, -127 works better than 0 when averaging frames with/without
  85. * noise info (e.g. averaging might be done in app); measured dBm values are
  86. * always negative ... using a negative value as the default keeps all
  87. * averages within an s8's (used in some apps) range of negative values. */
  88. #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
  89. /*
  90. * RTS threshold here is total size [2347] minus 4 FCS bytes
  91. * Per spec:
  92. * a value of 0 means RTS on all data/management packets
  93. * a value > max MSDU size means no RTS
  94. * else RTS for data/management frames where MPDU is larger
  95. * than RTS value.
  96. */
  97. #define DEFAULT_RTS_THRESHOLD 2347U
  98. #define MIN_RTS_THRESHOLD 0U
  99. #define MAX_RTS_THRESHOLD 2347U
  100. #define MAX_MSDU_SIZE 2304U
  101. #define MAX_MPDU_SIZE 2346U
  102. #define DEFAULT_BEACON_INTERVAL 100U
  103. #define DEFAULT_SHORT_RETRY_LIMIT 7U
  104. #define DEFAULT_LONG_RETRY_LIMIT 4U
  105. struct iwl_rx_mem_buffer {
  106. dma_addr_t real_dma_addr;
  107. dma_addr_t aligned_dma_addr;
  108. struct sk_buff *skb;
  109. struct list_head list;
  110. };
  111. /*
  112. * Generic queue structure
  113. *
  114. * Contains common data for Rx and Tx queues
  115. */
  116. struct iwl_queue {
  117. int n_bd; /* number of BDs in this queue */
  118. int write_ptr; /* 1-st empty entry (index) host_w*/
  119. int read_ptr; /* last used entry (index) host_r*/
  120. dma_addr_t dma_addr; /* physical addr for BD's */
  121. int n_window; /* safe queue window */
  122. u32 id;
  123. int low_mark; /* low watermark, resume queue if free
  124. * space more than this */
  125. int high_mark; /* high watermark, stop queue if free
  126. * space less than this */
  127. } __attribute__ ((packed));
  128. /* One for each TFD */
  129. struct iwl_tx_info {
  130. struct sk_buff *skb[IWL_NUM_OF_TBS - 1];
  131. };
  132. /**
  133. * struct iwl_tx_queue - Tx Queue for DMA
  134. * @q: generic Rx/Tx queue descriptor
  135. * @bd: base of circular buffer of TFDs
  136. * @cmd: array of command/Tx buffers
  137. * @dma_addr_cmd: physical address of cmd/tx buffer array
  138. * @txb: array of per-TFD driver data
  139. * @need_update: indicates need to update read/write index
  140. * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled
  141. *
  142. * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
  143. * descriptors) and required locking structures.
  144. */
  145. #define TFD_TX_CMD_SLOTS 256
  146. #define TFD_CMD_SLOTS 32
  147. struct iwl_tx_queue {
  148. struct iwl_queue q;
  149. void *tfds;
  150. struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
  151. struct iwl_tx_info *txb;
  152. u8 need_update;
  153. u8 sched_retry;
  154. u8 active;
  155. u8 swq_id;
  156. };
  157. #define IWL_NUM_SCAN_RATES (2)
  158. struct iwl4965_channel_tgd_info {
  159. u8 type;
  160. s8 max_power;
  161. };
  162. struct iwl4965_channel_tgh_info {
  163. s64 last_radar_time;
  164. };
  165. #define IWL4965_MAX_RATE (33)
  166. struct iwl3945_clip_group {
  167. /* maximum power level to prevent clipping for each rate, derived by
  168. * us from this band's saturation power in EEPROM */
  169. const s8 clip_powers[IWL_MAX_RATES];
  170. };
  171. /* current Tx power values to use, one for each rate for each channel.
  172. * requested power is limited by:
  173. * -- regulatory EEPROM limits for this channel
  174. * -- hardware capabilities (clip-powers)
  175. * -- spectrum management
  176. * -- user preference (e.g. iwconfig)
  177. * when requested power is set, base power index must also be set. */
  178. struct iwl3945_channel_power_info {
  179. struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
  180. s8 power_table_index; /* actual (compenst'd) index into gain table */
  181. s8 base_power_index; /* gain index for power at factory temp. */
  182. s8 requested_power; /* power (dBm) requested for this chnl/rate */
  183. };
  184. /* current scan Tx power values to use, one for each scan rate for each
  185. * channel. */
  186. struct iwl3945_scan_power_info {
  187. struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
  188. s8 power_table_index; /* actual (compenst'd) index into gain table */
  189. s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
  190. };
  191. /*
  192. * One for each channel, holds all channel setup data
  193. * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
  194. * with one another!
  195. */
  196. struct iwl_channel_info {
  197. struct iwl4965_channel_tgd_info tgd;
  198. struct iwl4965_channel_tgh_info tgh;
  199. struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */
  200. struct iwl_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
  201. * FAT channel */
  202. u8 channel; /* channel number */
  203. u8 flags; /* flags copied from EEPROM */
  204. s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
  205. s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) limit */
  206. s8 min_power; /* always 0 */
  207. s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */
  208. u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */
  209. u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */
  210. enum ieee80211_band band;
  211. /* FAT channel info */
  212. s8 fat_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
  213. s8 fat_curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) */
  214. s8 fat_min_power; /* always 0 */
  215. s8 fat_scan_power; /* (dBm) eeprom, direct scans, any rate */
  216. u8 fat_flags; /* flags copied from EEPROM */
  217. u8 fat_extension_channel; /* HT_IE_EXT_CHANNEL_* */
  218. /* Radio/DSP gain settings for each "normal" data Tx rate.
  219. * These include, in addition to RF and DSP gain, a few fields for
  220. * remembering/modifying gain settings (indexes). */
  221. struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE];
  222. /* Radio/DSP gain settings for each scan rate, for directed scans. */
  223. struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
  224. };
  225. #define IWL_TX_FIFO_AC0 0
  226. #define IWL_TX_FIFO_AC1 1
  227. #define IWL_TX_FIFO_AC2 2
  228. #define IWL_TX_FIFO_AC3 3
  229. #define IWL_TX_FIFO_HCCA_1 5
  230. #define IWL_TX_FIFO_HCCA_2 6
  231. #define IWL_TX_FIFO_NONE 7
  232. /* Minimum number of queues. MAX_NUM is defined in hw specific files.
  233. * Set the minimum to accommodate the 4 standard TX queues, 1 command
  234. * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */
  235. #define IWL_MIN_NUM_QUEUES 10
  236. /* Power management (not Tx power) structures */
  237. enum iwl_pwr_src {
  238. IWL_PWR_SRC_VMAIN,
  239. IWL_PWR_SRC_VAUX,
  240. };
  241. #define IEEE80211_DATA_LEN 2304
  242. #define IEEE80211_4ADDR_LEN 30
  243. #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
  244. #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
  245. struct iwl_frame {
  246. union {
  247. struct ieee80211_hdr frame;
  248. struct iwl_tx_beacon_cmd beacon;
  249. u8 raw[IEEE80211_FRAME_LEN];
  250. u8 cmd[360];
  251. } u;
  252. struct list_head list;
  253. };
  254. #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
  255. #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
  256. #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
  257. enum {
  258. CMD_SYNC = 0,
  259. CMD_SIZE_NORMAL = 0,
  260. CMD_NO_SKB = 0,
  261. CMD_SIZE_HUGE = (1 << 0),
  262. CMD_ASYNC = (1 << 1),
  263. CMD_WANT_SKB = (1 << 2),
  264. };
  265. struct iwl_cmd;
  266. struct iwl_priv;
  267. struct iwl_cmd_meta {
  268. struct iwl_cmd_meta *source;
  269. union {
  270. struct sk_buff *skb;
  271. int (*callback)(struct iwl_priv *priv,
  272. struct iwl_cmd *cmd, struct sk_buff *skb);
  273. } __attribute__ ((packed)) u;
  274. /* The CMD_SIZE_HUGE flag bit indicates that the command
  275. * structure is stored at the end of the shared queue memory. */
  276. u32 flags;
  277. DECLARE_PCI_UNMAP_ADDR(mapping)
  278. DECLARE_PCI_UNMAP_LEN(len)
  279. } __attribute__ ((packed));
  280. #define IWL_CMD_MAX_PAYLOAD 320
  281. /**
  282. * struct iwl_cmd
  283. *
  284. * For allocation of the command and tx queues, this establishes the overall
  285. * size of the largest command we send to uCode, except for a scan command
  286. * (which is relatively huge; space is allocated separately).
  287. */
  288. struct iwl_cmd {
  289. struct iwl_cmd_meta meta; /* driver data */
  290. struct iwl_cmd_header hdr; /* uCode API */
  291. union {
  292. u32 flags;
  293. u8 val8;
  294. u16 val16;
  295. u32 val32;
  296. struct iwl_tx_cmd tx;
  297. u8 payload[IWL_CMD_MAX_PAYLOAD];
  298. } __attribute__ ((packed)) cmd;
  299. } __attribute__ ((packed));
  300. struct iwl_host_cmd {
  301. u8 id;
  302. u16 len;
  303. struct iwl_cmd_meta meta;
  304. const void *data;
  305. };
  306. #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_cmd) - \
  307. sizeof(struct iwl_cmd_meta))
  308. /*
  309. * RX related structures and functions
  310. */
  311. #define RX_FREE_BUFFERS 64
  312. #define RX_LOW_WATERMARK 8
  313. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  314. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  315. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  316. /**
  317. * struct iwl_rx_queue - Rx queue
  318. * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
  319. * @dma_addr: bus address of buffer of receive buffer descriptors (rbd)
  320. * @read: Shared index to newest available Rx buffer
  321. * @write: Shared index to oldest written Rx packet
  322. * @free_count: Number of pre-allocated buffers in rx_free
  323. * @rx_free: list of free SKBs for use
  324. * @rx_used: List of Rx buffers with no SKB
  325. * @need_update: flag to indicate we need to update read/write index
  326. * @rb_stts: driver's pointer to receive buffer status
  327. * @rb_stts_dma: bus address of receive buffer status
  328. *
  329. * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
  330. */
  331. struct iwl_rx_queue {
  332. __le32 *bd;
  333. dma_addr_t dma_addr;
  334. struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
  335. struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
  336. u32 read;
  337. u32 write;
  338. u32 free_count;
  339. u32 write_actual;
  340. struct list_head rx_free;
  341. struct list_head rx_used;
  342. int need_update;
  343. struct iwl_rb_status *rb_stts;
  344. dma_addr_t rb_stts_dma;
  345. spinlock_t lock;
  346. };
  347. #define IWL_SUPPORTED_RATES_IE_LEN 8
  348. #define MAX_TID_COUNT 9
  349. #define IWL_INVALID_RATE 0xFF
  350. #define IWL_INVALID_VALUE -1
  351. /**
  352. * struct iwl_ht_agg -- aggregation status while waiting for block-ack
  353. * @txq_id: Tx queue used for Tx attempt
  354. * @frame_count: # frames attempted by Tx command
  355. * @wait_for_ba: Expect block-ack before next Tx reply
  356. * @start_idx: Index of 1st Transmit Frame Descriptor (TFD) in Tx window
  357. * @bitmap0: Low order bitmap, one bit for each frame pending ACK in Tx window
  358. * @bitmap1: High order, one bit for each frame pending ACK in Tx window
  359. * @rate_n_flags: Rate at which Tx was attempted
  360. *
  361. * If REPLY_TX indicates that aggregation was attempted, driver must wait
  362. * for block ack (REPLY_COMPRESSED_BA). This struct stores tx reply info
  363. * until block ack arrives.
  364. */
  365. struct iwl_ht_agg {
  366. u16 txq_id;
  367. u16 frame_count;
  368. u16 wait_for_ba;
  369. u16 start_idx;
  370. u64 bitmap;
  371. u32 rate_n_flags;
  372. #define IWL_AGG_OFF 0
  373. #define IWL_AGG_ON 1
  374. #define IWL_EMPTYING_HW_QUEUE_ADDBA 2
  375. #define IWL_EMPTYING_HW_QUEUE_DELBA 3
  376. u8 state;
  377. };
  378. struct iwl_tid_data {
  379. u16 seq_number;
  380. u16 tfds_in_queue;
  381. struct iwl_ht_agg agg;
  382. };
  383. struct iwl_hw_key {
  384. enum ieee80211_key_alg alg;
  385. int keylen;
  386. u8 keyidx;
  387. u8 key[32];
  388. };
  389. union iwl_ht_rate_supp {
  390. u16 rates;
  391. struct {
  392. u8 siso_rate;
  393. u8 mimo_rate;
  394. };
  395. };
  396. #define CFG_HT_RX_AMPDU_FACTOR_DEF (0x3)
  397. #define CFG_HT_MPDU_DENSITY_2USEC (0x5)
  398. #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC
  399. struct iwl_ht_info {
  400. /* self configuration data */
  401. u8 is_ht;
  402. u8 supported_chan_width;
  403. u8 sm_ps;
  404. u8 is_green_field;
  405. u8 sgf; /* HT_SHORT_GI_* short guard interval */
  406. u8 max_amsdu_size;
  407. u8 ampdu_factor;
  408. u8 mpdu_density;
  409. struct ieee80211_mcs_info mcs;
  410. /* BSS related data */
  411. u8 extension_chan_offset;
  412. u8 tx_chan_width;
  413. u8 ht_protection;
  414. u8 non_GF_STA_present;
  415. };
  416. union iwl_qos_capabity {
  417. struct {
  418. u8 edca_count:4; /* bit 0-3 */
  419. u8 q_ack:1; /* bit 4 */
  420. u8 queue_request:1; /* bit 5 */
  421. u8 txop_request:1; /* bit 6 */
  422. u8 reserved:1; /* bit 7 */
  423. } q_AP;
  424. struct {
  425. u8 acvo_APSD:1; /* bit 0 */
  426. u8 acvi_APSD:1; /* bit 1 */
  427. u8 ac_bk_APSD:1; /* bit 2 */
  428. u8 ac_be_APSD:1; /* bit 3 */
  429. u8 q_ack:1; /* bit 4 */
  430. u8 max_len:2; /* bit 5-6 */
  431. u8 more_data_ack:1; /* bit 7 */
  432. } q_STA;
  433. u8 val;
  434. };
  435. /* QoS structures */
  436. struct iwl_qos_info {
  437. int qos_active;
  438. union iwl_qos_capabity qos_cap;
  439. struct iwl_qosparam_cmd def_qos_parm;
  440. };
  441. #define STA_PS_STATUS_WAKE 0
  442. #define STA_PS_STATUS_SLEEP 1
  443. struct iwl3945_station_entry {
  444. struct iwl3945_addsta_cmd sta;
  445. struct iwl_tid_data tid[MAX_TID_COUNT];
  446. u8 used;
  447. u8 ps_status;
  448. struct iwl_hw_key keyinfo;
  449. };
  450. struct iwl_station_entry {
  451. struct iwl_addsta_cmd sta;
  452. struct iwl_tid_data tid[MAX_TID_COUNT];
  453. u8 used;
  454. u8 ps_status;
  455. struct iwl_hw_key keyinfo;
  456. };
  457. /* one for each uCode image (inst/data, boot/init/runtime) */
  458. struct fw_desc {
  459. void *v_addr; /* access by driver */
  460. dma_addr_t p_addr; /* access by card's busmaster DMA */
  461. u32 len; /* bytes */
  462. };
  463. /* uCode file layout */
  464. struct iwl_ucode {
  465. __le32 ver; /* major/minor/API/serial */
  466. __le32 inst_size; /* bytes of runtime instructions */
  467. __le32 data_size; /* bytes of runtime data */
  468. __le32 init_size; /* bytes of initialization instructions */
  469. __le32 init_data_size; /* bytes of initialization data */
  470. __le32 boot_size; /* bytes of bootstrap instructions */
  471. u8 data[0]; /* data in same order as "size" elements */
  472. };
  473. struct iwl4965_ibss_seq {
  474. u8 mac[ETH_ALEN];
  475. u16 seq_num;
  476. u16 frag_num;
  477. unsigned long packet_time;
  478. struct list_head list;
  479. };
  480. struct iwl_sensitivity_ranges {
  481. u16 min_nrg_cck;
  482. u16 max_nrg_cck;
  483. u16 nrg_th_cck;
  484. u16 nrg_th_ofdm;
  485. u16 auto_corr_min_ofdm;
  486. u16 auto_corr_min_ofdm_mrc;
  487. u16 auto_corr_min_ofdm_x1;
  488. u16 auto_corr_min_ofdm_mrc_x1;
  489. u16 auto_corr_max_ofdm;
  490. u16 auto_corr_max_ofdm_mrc;
  491. u16 auto_corr_max_ofdm_x1;
  492. u16 auto_corr_max_ofdm_mrc_x1;
  493. u16 auto_corr_max_cck;
  494. u16 auto_corr_max_cck_mrc;
  495. u16 auto_corr_min_cck;
  496. u16 auto_corr_min_cck_mrc;
  497. };
  498. #define KELVIN_TO_CELSIUS(x) ((x)-273)
  499. #define CELSIUS_TO_KELVIN(x) ((x)+273)
  500. /**
  501. * struct iwl_hw_params
  502. * @max_txq_num: Max # Tx queues supported
  503. * @dma_chnl_num: Number of Tx DMA/FIFO channels
  504. * @scd_bc_tbls_size: size of scheduler byte count tables
  505. * @tfd_size: TFD size
  506. * @tx/rx_chains_num: Number of TX/RX chains
  507. * @valid_tx/rx_ant: usable antennas
  508. * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
  509. * @max_rxq_log: Log-base-2 of max_rxq_size
  510. * @rx_buf_size: Rx buffer size
  511. * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
  512. * @max_stations:
  513. * @bcast_sta_id:
  514. * @fat_channel: is 40MHz width possible in band 2.4
  515. * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ)
  516. * @sw_crypto: 0 for hw, 1 for sw
  517. * @max_xxx_size: for ucode uses
  518. * @ct_kill_threshold: temperature threshold
  519. * @calib_init_cfg: setup initial calibrations for the hw
  520. * @struct iwl_sensitivity_ranges: range of sensitivity values
  521. */
  522. struct iwl_hw_params {
  523. u8 max_txq_num;
  524. u8 dma_chnl_num;
  525. u16 scd_bc_tbls_size;
  526. u32 tfd_size;
  527. u8 tx_chains_num;
  528. u8 rx_chains_num;
  529. u8 valid_tx_ant;
  530. u8 valid_rx_ant;
  531. u16 max_rxq_size;
  532. u16 max_rxq_log;
  533. u32 rx_buf_size;
  534. u32 rx_wrt_ptr_reg;
  535. u32 max_pkt_size;
  536. u8 max_stations;
  537. u8 bcast_sta_id;
  538. u8 fat_channel;
  539. u8 sw_crypto;
  540. u32 max_inst_size;
  541. u32 max_data_size;
  542. u32 max_bsm_size;
  543. u32 ct_kill_threshold; /* value in hw-dependent units */
  544. u32 calib_init_cfg;
  545. const struct iwl_sensitivity_ranges *sens;
  546. };
  547. /******************************************************************************
  548. *
  549. * Functions implemented in core module which are forward declared here
  550. * for use by iwl-[4-5].c
  551. *
  552. * NOTE: The implementation of these functions are not hardware specific
  553. * which is why they are in the core module files.
  554. *
  555. * Naming convention --
  556. * iwl_ <-- Is part of iwlwifi
  557. * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
  558. * iwl4965_bg_ <-- Called from work queue context
  559. * iwl4965_mac_ <-- mac80211 callback
  560. *
  561. ****************************************************************************/
  562. extern void iwl_update_chain_flags(struct iwl_priv *priv);
  563. extern int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
  564. extern const u8 iwl_bcast_addr[ETH_ALEN];
  565. extern int iwl_rxq_stop(struct iwl_priv *priv);
  566. extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
  567. extern int iwl_queue_space(const struct iwl_queue *q);
  568. static inline int iwl_queue_used(const struct iwl_queue *q, int i)
  569. {
  570. return q->write_ptr > q->read_ptr ?
  571. (i >= q->read_ptr && i < q->write_ptr) :
  572. !(i < q->read_ptr && i >= q->write_ptr);
  573. }
  574. static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
  575. {
  576. /* This is for scan command, the big buffer at end of command array */
  577. if (is_huge)
  578. return q->n_window; /* must be power of 2 */
  579. /* Otherwise, use normal size buffers */
  580. return index & (q->n_window - 1);
  581. }
  582. struct iwl_dma_ptr {
  583. dma_addr_t dma;
  584. void *addr;
  585. size_t size;
  586. };
  587. #define HT_SHORT_GI_20MHZ (1 << 0)
  588. #define HT_SHORT_GI_40MHZ (1 << 1)
  589. #define IWL_CHANNEL_WIDTH_20MHZ 0
  590. #define IWL_CHANNEL_WIDTH_40MHZ 1
  591. #define IWL_OPERATION_MODE_AUTO 0
  592. #define IWL_OPERATION_MODE_HT_ONLY 1
  593. #define IWL_OPERATION_MODE_MIXED 2
  594. #define IWL_OPERATION_MODE_20MHZ 3
  595. #define IWL_TX_CRC_SIZE 4
  596. #define IWL_TX_DELIMITER_SIZE 4
  597. #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
  598. /* Sensitivity and chain noise calibration */
  599. #define INITIALIZATION_VALUE 0xFFFF
  600. #define CAL_NUM_OF_BEACONS 20
  601. #define MAXIMUM_ALLOWED_PATHLOSS 15
  602. #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
  603. #define MAX_FA_OFDM 50
  604. #define MIN_FA_OFDM 5
  605. #define MAX_FA_CCK 50
  606. #define MIN_FA_CCK 5
  607. #define AUTO_CORR_STEP_OFDM 1
  608. #define AUTO_CORR_STEP_CCK 3
  609. #define AUTO_CORR_MAX_TH_CCK 160
  610. #define NRG_DIFF 2
  611. #define NRG_STEP_CCK 2
  612. #define NRG_MARGIN 8
  613. #define MAX_NUMBER_CCK_NO_FA 100
  614. #define AUTO_CORR_CCK_MIN_VAL_DEF (125)
  615. #define CHAIN_A 0
  616. #define CHAIN_B 1
  617. #define CHAIN_C 2
  618. #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4
  619. #define ALL_BAND_FILTER 0xFF00
  620. #define IN_BAND_FILTER 0xFF
  621. #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF
  622. #define NRG_NUM_PREV_STAT_L 20
  623. #define NUM_RX_CHAINS 3
  624. enum iwl4965_false_alarm_state {
  625. IWL_FA_TOO_MANY = 0,
  626. IWL_FA_TOO_FEW = 1,
  627. IWL_FA_GOOD_RANGE = 2,
  628. };
  629. enum iwl4965_chain_noise_state {
  630. IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */
  631. IWL_CHAIN_NOISE_ACCUMULATE,
  632. IWL_CHAIN_NOISE_CALIBRATED,
  633. IWL_CHAIN_NOISE_DONE,
  634. };
  635. enum iwl4965_calib_enabled_state {
  636. IWL_CALIB_DISABLED = 0, /* must be 0 */
  637. IWL_CALIB_ENABLED = 1,
  638. };
  639. /*
  640. * enum iwl_calib
  641. * defines the order in which results of initial calibrations
  642. * should be sent to the runtime uCode
  643. */
  644. enum iwl_calib {
  645. IWL_CALIB_XTAL,
  646. IWL_CALIB_DC,
  647. IWL_CALIB_LO,
  648. IWL_CALIB_TX_IQ,
  649. IWL_CALIB_TX_IQ_PERD,
  650. IWL_CALIB_BASE_BAND,
  651. IWL_CALIB_MAX
  652. };
  653. /* Opaque calibration results */
  654. struct iwl_calib_result {
  655. void *buf;
  656. size_t buf_len;
  657. };
  658. enum ucode_type {
  659. UCODE_NONE = 0,
  660. UCODE_INIT,
  661. UCODE_RT
  662. };
  663. /* Sensitivity calib data */
  664. struct iwl_sensitivity_data {
  665. u32 auto_corr_ofdm;
  666. u32 auto_corr_ofdm_mrc;
  667. u32 auto_corr_ofdm_x1;
  668. u32 auto_corr_ofdm_mrc_x1;
  669. u32 auto_corr_cck;
  670. u32 auto_corr_cck_mrc;
  671. u32 last_bad_plcp_cnt_ofdm;
  672. u32 last_fa_cnt_ofdm;
  673. u32 last_bad_plcp_cnt_cck;
  674. u32 last_fa_cnt_cck;
  675. u32 nrg_curr_state;
  676. u32 nrg_prev_state;
  677. u32 nrg_value[10];
  678. u8 nrg_silence_rssi[NRG_NUM_PREV_STAT_L];
  679. u32 nrg_silence_ref;
  680. u32 nrg_energy_idx;
  681. u32 nrg_silence_idx;
  682. u32 nrg_th_cck;
  683. s32 nrg_auto_corr_silence_diff;
  684. u32 num_in_cck_no_fa;
  685. u32 nrg_th_ofdm;
  686. };
  687. /* Chain noise (differential Rx gain) calib data */
  688. struct iwl_chain_noise_data {
  689. u32 active_chains;
  690. u32 chain_noise_a;
  691. u32 chain_noise_b;
  692. u32 chain_noise_c;
  693. u32 chain_signal_a;
  694. u32 chain_signal_b;
  695. u32 chain_signal_c;
  696. u16 beacon_count;
  697. u8 disconn_array[NUM_RX_CHAINS];
  698. u8 delta_gain_code[NUM_RX_CHAINS];
  699. u8 radio_write;
  700. u8 state;
  701. };
  702. #define EEPROM_SEM_TIMEOUT 10 /* milliseconds */
  703. #define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */
  704. enum {
  705. MEASUREMENT_READY = (1 << 0),
  706. MEASUREMENT_ACTIVE = (1 << 1),
  707. };
  708. enum iwl_nvm_type {
  709. NVM_DEVICE_TYPE_EEPROM = 0,
  710. NVM_DEVICE_TYPE_OTP,
  711. };
  712. /* interrupt statistics */
  713. struct isr_statistics {
  714. u32 hw;
  715. u32 sw;
  716. u32 sw_err;
  717. u32 sch;
  718. u32 alive;
  719. u32 rfkill;
  720. u32 ctkill;
  721. u32 wakeup;
  722. u32 rx;
  723. u32 rx_handlers[REPLY_MAX];
  724. u32 tx;
  725. u32 unhandled;
  726. };
  727. #define IWL_MAX_NUM_QUEUES 20 /* FIXME: do dynamic allocation */
  728. struct iwl_priv {
  729. /* ieee device used by generic ieee processing code */
  730. struct ieee80211_hw *hw;
  731. struct ieee80211_channel *ieee_channels;
  732. struct ieee80211_rate *ieee_rates;
  733. struct iwl_cfg *cfg;
  734. /* temporary frame storage list */
  735. struct list_head free_frames;
  736. int frames_count;
  737. enum ieee80211_band band;
  738. int alloc_rxb_skb;
  739. void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
  740. struct iwl_rx_mem_buffer *rxb);
  741. struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
  742. #if defined(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) || defined(CONFIG_IWL3945_SPECTRUM_MEASUREMENT)
  743. /* spectrum measurement report caching */
  744. struct iwl_spectrum_notification measure_report;
  745. u8 measurement_status;
  746. #endif
  747. /* ucode beacon time */
  748. u32 ucode_beacon_time;
  749. /* we allocate array of iwl4965_channel_info for NIC's valid channels.
  750. * Access via channel # using indirect index array */
  751. struct iwl_channel_info *channel_info; /* channel info array */
  752. u8 channel_count; /* # of channels */
  753. /* each calibration channel group in the EEPROM has a derived
  754. * clip setting for each rate. 3945 only.*/
  755. const struct iwl3945_clip_group clip39_groups[5];
  756. /* thermal calibration */
  757. s32 temperature; /* degrees Kelvin */
  758. s32 last_temperature;
  759. /* init calibration results */
  760. struct iwl_calib_result calib_results[IWL_CALIB_MAX];
  761. /* Scan related variables */
  762. unsigned long last_scan_jiffies;
  763. unsigned long next_scan_jiffies;
  764. unsigned long scan_start;
  765. unsigned long scan_pass_start;
  766. unsigned long scan_start_tsf;
  767. void *scan;
  768. int scan_bands;
  769. struct cfg80211_scan_request *scan_request;
  770. u8 scan_tx_ant[IEEE80211_NUM_BANDS];
  771. u8 mgmt_tx_ant;
  772. /* spinlock */
  773. spinlock_t lock; /* protect general shared data */
  774. spinlock_t hcmd_lock; /* protect hcmd */
  775. spinlock_t reg_lock; /* protect hw register access */
  776. struct mutex mutex;
  777. /* basic pci-network driver stuff */
  778. struct pci_dev *pci_dev;
  779. /* pci hardware address support */
  780. void __iomem *hw_base;
  781. u32 hw_rev;
  782. u32 hw_wa_rev;
  783. u8 rev_id;
  784. /* uCode images, save to reload in case of failure */
  785. u32 ucode_ver; /* version of ucode, copy of
  786. iwl_ucode.ver */
  787. struct fw_desc ucode_code; /* runtime inst */
  788. struct fw_desc ucode_data; /* runtime data original */
  789. struct fw_desc ucode_data_backup; /* runtime data save/restore */
  790. struct fw_desc ucode_init; /* initialization inst */
  791. struct fw_desc ucode_init_data; /* initialization data */
  792. struct fw_desc ucode_boot; /* bootstrap inst */
  793. enum ucode_type ucode_type;
  794. u8 ucode_write_complete; /* the image write is complete */
  795. struct iwl_rxon_time_cmd rxon_timing;
  796. /* We declare this const so it can only be
  797. * changed via explicit cast within the
  798. * routines that actually update the physical
  799. * hardware */
  800. const struct iwl_rxon_cmd active_rxon;
  801. struct iwl_rxon_cmd staging_rxon;
  802. struct iwl_rxon_cmd recovery_rxon;
  803. /* 1st responses from initialize and runtime uCode images.
  804. * 4965's initialize alive response contains some calibration data. */
  805. struct iwl_init_alive_resp card_alive_init;
  806. struct iwl_alive_resp card_alive;
  807. #ifdef CONFIG_IWLWIFI_LEDS
  808. unsigned long last_blink_time;
  809. u8 last_blink_rate;
  810. u8 allow_blinking;
  811. u64 led_tpt;
  812. struct iwl_led led[IWL_LED_TRG_MAX];
  813. unsigned int rxtxpackets;
  814. #endif
  815. u16 active_rate;
  816. u16 active_rate_basic;
  817. u8 assoc_station_added;
  818. u8 start_calib;
  819. struct iwl_sensitivity_data sensitivity_data;
  820. struct iwl_chain_noise_data chain_noise_data;
  821. __le16 sensitivity_tbl[HD_TABLE_SIZE];
  822. struct iwl_ht_info current_ht_config;
  823. u8 last_phy_res[100];
  824. /* Rate scaling data */
  825. s8 data_retry_limit;
  826. u8 retry_rate;
  827. wait_queue_head_t wait_command_queue;
  828. int activity_timer_active;
  829. /* Rx and Tx DMA processing queues */
  830. struct iwl_rx_queue rxq;
  831. struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES];
  832. unsigned long txq_ctx_active_msk;
  833. struct iwl_dma_ptr kw; /* keep warm address */
  834. struct iwl_dma_ptr scd_bc_tbls;
  835. u32 scd_base_addr; /* scheduler sram base address */
  836. unsigned long status;
  837. int last_rx_rssi; /* From Rx packet statistics */
  838. int last_rx_noise; /* From beacon statistics */
  839. /* counts mgmt, ctl, and data packets */
  840. struct traffic_stats {
  841. u32 cnt;
  842. u64 bytes;
  843. } tx_stats[3], rx_stats[3];
  844. /* counts interrupts */
  845. struct isr_statistics isr_stats;
  846. struct iwl_power_mgr power_data;
  847. struct iwl_notif_statistics statistics;
  848. unsigned long last_statistics_time;
  849. /* context information */
  850. u16 rates_mask;
  851. u32 power_mode;
  852. u8 bssid[ETH_ALEN];
  853. u16 rts_threshold;
  854. u8 mac_addr[ETH_ALEN];
  855. /*station table variables */
  856. spinlock_t sta_lock;
  857. int num_stations;
  858. struct iwl_station_entry stations[IWL_STATION_COUNT];
  859. struct iwl_wep_key wep_keys[WEP_KEYS_MAX];
  860. u8 default_wep_key;
  861. u8 key_mapping_key;
  862. unsigned long ucode_key_table;
  863. /* queue refcounts */
  864. #define IWL_MAX_HW_QUEUES 32
  865. unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
  866. /* for each AC */
  867. atomic_t queue_stop_count[4];
  868. /* Indication if ieee80211_ops->open has been called */
  869. u8 is_open;
  870. u8 mac80211_registered;
  871. /* Rx'd packet timing information */
  872. u32 last_beacon_time;
  873. u64 last_tsf;
  874. /* eeprom */
  875. u8 *eeprom;
  876. int nvm_device_type;
  877. struct iwl_eeprom_calib_info *calib_info;
  878. enum nl80211_iftype iw_mode;
  879. struct sk_buff *ibss_beacon;
  880. /* Last Rx'd beacon timestamp */
  881. u64 timestamp;
  882. u16 beacon_int;
  883. struct ieee80211_vif *vif;
  884. /*Added for 3945 */
  885. void *shared_virt;
  886. dma_addr_t shared_phys;
  887. /*End*/
  888. struct iwl_hw_params hw_params;
  889. /* INT ICT Table */
  890. u32 *ict_tbl;
  891. dma_addr_t ict_tbl_dma;
  892. dma_addr_t aligned_ict_tbl_dma;
  893. int ict_index;
  894. void *ict_tbl_vir;
  895. u32 inta;
  896. bool use_ict;
  897. u32 inta_mask;
  898. /* Current association information needed to configure the
  899. * hardware */
  900. u16 assoc_id;
  901. u16 assoc_capability;
  902. struct iwl_qos_info qos_data;
  903. struct workqueue_struct *workqueue;
  904. struct work_struct up;
  905. struct work_struct restart;
  906. struct work_struct calibrated_work;
  907. struct work_struct scan_completed;
  908. struct work_struct rx_replenish;
  909. struct work_struct abort_scan;
  910. struct work_struct update_link_led;
  911. struct work_struct auth_work;
  912. struct work_struct report_work;
  913. struct work_struct request_scan;
  914. struct work_struct beacon_update;
  915. struct tasklet_struct irq_tasklet;
  916. struct delayed_work init_alive_start;
  917. struct delayed_work alive_start;
  918. struct delayed_work scan_check;
  919. /*For 3945 only*/
  920. struct delayed_work thermal_periodic;
  921. struct delayed_work rfkill_poll;
  922. /* TX Power */
  923. s8 tx_power_user_lmt;
  924. s8 tx_power_channel_lmt;
  925. #ifdef CONFIG_IWLWIFI_DEBUG
  926. /* debugging info */
  927. u32 debug_level;
  928. u32 framecnt_to_us;
  929. atomic_t restrict_refcnt;
  930. #ifdef CONFIG_IWLWIFI_DEBUGFS
  931. /* debugfs */
  932. struct iwl_debugfs *dbgfs;
  933. #endif /* CONFIG_IWLWIFI_DEBUGFS */
  934. #endif /* CONFIG_IWLWIFI_DEBUG */
  935. struct work_struct txpower_work;
  936. u32 disable_sens_cal;
  937. u32 disable_chain_noise_cal;
  938. u32 disable_tx_power_cal;
  939. struct work_struct run_time_calib_work;
  940. struct timer_list statistics_periodic;
  941. bool hw_ready;
  942. /*For 3945*/
  943. #define IWL_DEFAULT_TX_POWER 0x0F
  944. struct iwl3945_notif_statistics statistics_39;
  945. u32 sta_supp_rates;
  946. }; /*iwl_priv */
  947. static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
  948. {
  949. set_bit(txq_id, &priv->txq_ctx_active_msk);
  950. }
  951. static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id)
  952. {
  953. clear_bit(txq_id, &priv->txq_ctx_active_msk);
  954. }
  955. #ifdef CONFIG_IWLWIFI_DEBUG
  956. const char *iwl_get_tx_fail_reason(u32 status);
  957. #else
  958. static inline const char *iwl_get_tx_fail_reason(u32 status) { return ""; }
  959. #endif
  960. static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv,
  961. int txq_id, int idx)
  962. {
  963. if (priv->txq[txq_id].txb[idx].skb[0])
  964. return (struct ieee80211_hdr *)priv->txq[txq_id].
  965. txb[idx].skb[0]->data;
  966. return NULL;
  967. }
  968. static inline int iwl_is_associated(struct iwl_priv *priv)
  969. {
  970. return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
  971. }
  972. static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
  973. {
  974. if (ch_info == NULL)
  975. return 0;
  976. return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
  977. }
  978. static inline int is_channel_radar(const struct iwl_channel_info *ch_info)
  979. {
  980. return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
  981. }
  982. static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info)
  983. {
  984. return ch_info->band == IEEE80211_BAND_5GHZ;
  985. }
  986. static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info)
  987. {
  988. return ch_info->band == IEEE80211_BAND_2GHZ;
  989. }
  990. static inline int is_channel_passive(const struct iwl_channel_info *ch)
  991. {
  992. return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
  993. }
  994. static inline int is_channel_ibss(const struct iwl_channel_info *ch)
  995. {
  996. return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
  997. }
  998. #endif /* __iwl_dev_h__ */