iwl-dev.h 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2011 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. */
  30. #ifndef __iwl_dev_h__
  31. #define __iwl_dev_h__
  32. #include <linux/pci.h> /* for struct pci_device_id */
  33. #include <linux/kernel.h>
  34. #include <linux/wait.h>
  35. #include <linux/leds.h>
  36. #include <net/ieee80211_radiotap.h>
  37. #include "iwl-eeprom.h"
  38. #include "iwl-csr.h"
  39. #include "iwl-prph.h"
  40. #include "iwl-fh.h"
  41. #include "iwl-debug.h"
  42. #include "iwl-agn-hw.h"
  43. #include "iwl-led.h"
  44. #include "iwl-power.h"
  45. #include "iwl-agn-rs.h"
  46. #include "iwl-agn-tt.h"
  47. #define DRV_NAME "iwlagn"
  48. struct iwl_tx_queue;
  49. /* CT-KILL constants */
  50. #define CT_KILL_THRESHOLD_LEGACY 110 /* in Celsius */
  51. #define CT_KILL_THRESHOLD 114 /* in Celsius */
  52. #define CT_KILL_EXIT_THRESHOLD 95 /* in Celsius */
  53. /* Default noise level to report when noise measurement is not available.
  54. * This may be because we're:
  55. * 1) Not associated (4965, no beacon statistics being sent to driver)
  56. * 2) Scanning (noise measurement does not apply to associated channel)
  57. * 3) Receiving CCK (3945 delivers noise info only for OFDM frames)
  58. * Use default noise value of -127 ... this is below the range of measurable
  59. * Rx dBm for either 3945 or 4965, so it can indicate "unmeasurable" to user.
  60. * Also, -127 works better than 0 when averaging frames with/without
  61. * noise info (e.g. averaging might be done in app); measured dBm values are
  62. * always negative ... using a negative value as the default keeps all
  63. * averages within an s8's (used in some apps) range of negative values. */
  64. #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
  65. /*
  66. * RTS threshold here is total size [2347] minus 4 FCS bytes
  67. * Per spec:
  68. * a value of 0 means RTS on all data/management packets
  69. * a value > max MSDU size means no RTS
  70. * else RTS for data/management frames where MPDU is larger
  71. * than RTS value.
  72. */
  73. #define DEFAULT_RTS_THRESHOLD 2347U
  74. #define MIN_RTS_THRESHOLD 0U
  75. #define MAX_RTS_THRESHOLD 2347U
  76. #define MAX_MSDU_SIZE 2304U
  77. #define MAX_MPDU_SIZE 2346U
  78. #define DEFAULT_BEACON_INTERVAL 200U
  79. #define DEFAULT_SHORT_RETRY_LIMIT 7U
  80. #define DEFAULT_LONG_RETRY_LIMIT 4U
  81. struct iwl_rx_mem_buffer {
  82. dma_addr_t page_dma;
  83. struct page *page;
  84. struct list_head list;
  85. };
  86. #define rxb_addr(r) page_address(r->page)
  87. /* defined below */
  88. struct iwl_device_cmd;
  89. struct iwl_cmd_meta {
  90. /* only for SYNC commands, iff the reply skb is wanted */
  91. struct iwl_host_cmd *source;
  92. /*
  93. * only for ASYNC commands
  94. * (which is somewhat stupid -- look at iwl-sta.c for instance
  95. * which duplicates a bunch of code because the callback isn't
  96. * invoked for SYNC commands, if it were and its result passed
  97. * through it would be simpler...)
  98. */
  99. void (*callback)(struct iwl_priv *priv,
  100. struct iwl_device_cmd *cmd,
  101. struct iwl_rx_packet *pkt);
  102. u32 flags;
  103. DEFINE_DMA_UNMAP_ADDR(mapping);
  104. DEFINE_DMA_UNMAP_LEN(len);
  105. };
  106. /*
  107. * Generic queue structure
  108. *
  109. * Contains common data for Rx and Tx queues.
  110. *
  111. * Note the difference between n_bd and n_window: the hardware
  112. * always assumes 256 descriptors, so n_bd is always 256 (unless
  113. * there might be HW changes in the future). For the normal TX
  114. * queues, n_window, which is the size of the software queue data
  115. * is also 256; however, for the command queue, n_window is only
  116. * 32 since we don't need so many commands pending. Since the HW
  117. * still uses 256 BDs for DMA though, n_bd stays 256. As a result,
  118. * the software buffers (in the variables @meta, @txb in struct
  119. * iwl_tx_queue) only have 32 entries, while the HW buffers (@tfds
  120. * in the same struct) have 256.
  121. * This means that we end up with the following:
  122. * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 |
  123. * SW entries: | 0 | ... | 31 |
  124. * where N is a number between 0 and 7. This means that the SW
  125. * data is a window overlayed over the HW queue.
  126. */
  127. struct iwl_queue {
  128. int n_bd; /* number of BDs in this queue */
  129. int write_ptr; /* 1-st empty entry (index) host_w*/
  130. int read_ptr; /* last used entry (index) host_r*/
  131. /* use for monitoring and recovering the stuck queue */
  132. dma_addr_t dma_addr; /* physical addr for BD's */
  133. int n_window; /* safe queue window */
  134. u32 id;
  135. int low_mark; /* low watermark, resume queue if free
  136. * space more than this */
  137. int high_mark; /* high watermark, stop queue if free
  138. * space less than this */
  139. };
  140. /* One for each TFD */
  141. struct iwl_tx_info {
  142. struct sk_buff *skb;
  143. struct iwl_rxon_context *ctx;
  144. };
  145. /**
  146. * struct iwl_tx_queue - Tx Queue for DMA
  147. * @q: generic Rx/Tx queue descriptor
  148. * @bd: base of circular buffer of TFDs
  149. * @cmd: array of command/TX buffer pointers
  150. * @meta: array of meta data for each command/tx buffer
  151. * @dma_addr_cmd: physical address of cmd/tx buffer array
  152. * @txb: array of per-TFD driver data
  153. * @time_stamp: time (in jiffies) of last read_ptr change
  154. * @need_update: indicates need to update read/write index
  155. * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled
  156. *
  157. * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
  158. * descriptors) and required locking structures.
  159. */
  160. #define TFD_TX_CMD_SLOTS 256
  161. #define TFD_CMD_SLOTS 32
  162. struct iwl_tx_queue {
  163. struct iwl_queue q;
  164. struct iwl_tfd *tfds;
  165. struct iwl_device_cmd **cmd;
  166. struct iwl_cmd_meta *meta;
  167. struct iwl_tx_info *txb;
  168. unsigned long time_stamp;
  169. u8 need_update;
  170. u8 sched_retry;
  171. u8 active;
  172. u8 swq_id;
  173. };
  174. #define IWL_NUM_SCAN_RATES (2)
  175. /*
  176. * One for each channel, holds all channel setup data
  177. * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
  178. * with one another!
  179. */
  180. struct iwl_channel_info {
  181. struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */
  182. struct iwl_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for
  183. * HT40 channel */
  184. u8 channel; /* channel number */
  185. u8 flags; /* flags copied from EEPROM */
  186. s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
  187. s8 curr_txpow; /* (dBm) regulatory/spectrum/user (not h/w) limit */
  188. s8 min_power; /* always 0 */
  189. s8 scan_power; /* (dBm) regul. eeprom, direct scans, any rate */
  190. u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */
  191. u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */
  192. enum ieee80211_band band;
  193. /* HT40 channel info */
  194. s8 ht40_max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
  195. u8 ht40_flags; /* flags copied from EEPROM */
  196. u8 ht40_extension_channel; /* HT_IE_EXT_CHANNEL_* */
  197. };
  198. #define IWL_TX_FIFO_BK 0 /* shared */
  199. #define IWL_TX_FIFO_BE 1
  200. #define IWL_TX_FIFO_VI 2 /* shared */
  201. #define IWL_TX_FIFO_VO 3
  202. #define IWL_TX_FIFO_BK_IPAN IWL_TX_FIFO_BK
  203. #define IWL_TX_FIFO_BE_IPAN 4
  204. #define IWL_TX_FIFO_VI_IPAN IWL_TX_FIFO_VI
  205. #define IWL_TX_FIFO_VO_IPAN 5
  206. #define IWL_TX_FIFO_UNUSED -1
  207. /* Minimum number of queues. MAX_NUM is defined in hw specific files.
  208. * Set the minimum to accommodate the 4 standard TX queues, 1 command
  209. * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */
  210. #define IWL_MIN_NUM_QUEUES 10
  211. /*
  212. * Command queue depends on iPAN support.
  213. */
  214. #define IWL_DEFAULT_CMD_QUEUE_NUM 4
  215. #define IWL_IPAN_CMD_QUEUE_NUM 9
  216. /*
  217. * This queue number is required for proper operation
  218. * because the ucode will stop/start the scheduler as
  219. * required.
  220. */
  221. #define IWL_IPAN_MCAST_QUEUE 8
  222. #define IEEE80211_DATA_LEN 2304
  223. #define IEEE80211_4ADDR_LEN 30
  224. #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
  225. #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
  226. #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
  227. #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
  228. #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
  229. enum {
  230. CMD_SYNC = 0,
  231. CMD_ASYNC = BIT(0),
  232. CMD_WANT_SKB = BIT(1),
  233. CMD_ON_DEMAND = BIT(2),
  234. };
  235. #define DEF_CMD_PAYLOAD_SIZE 320
  236. /**
  237. * struct iwl_device_cmd
  238. *
  239. * For allocation of the command and tx queues, this establishes the overall
  240. * size of the largest command we send to uCode, except for commands that
  241. * aren't fully copied and use other TFD space.
  242. */
  243. struct iwl_device_cmd {
  244. struct iwl_cmd_header hdr; /* uCode API */
  245. union {
  246. u32 flags;
  247. u8 val8;
  248. u16 val16;
  249. u32 val32;
  250. struct iwl_tx_cmd tx;
  251. struct iwl6000_channel_switch_cmd chswitch;
  252. u8 payload[DEF_CMD_PAYLOAD_SIZE];
  253. } __packed cmd;
  254. } __packed;
  255. #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
  256. #define IWL_MAX_CMD_TFDS 2
  257. enum iwl_hcmd_dataflag {
  258. IWL_HCMD_DFL_NOCOPY = BIT(0),
  259. };
  260. /**
  261. * struct iwl_host_cmd - Host command to the uCode
  262. * @data: array of chunks that composes the data of the host command
  263. * @reply_page: pointer to the page that holds the response to the host command
  264. * @callback:
  265. * @flags: can be CMD_* note CMD_WANT_SKB is incompatible withe CMD_ASYNC
  266. * @len: array of the lenths of the chunks in data
  267. * @dataflags:
  268. * @id: id of the host command
  269. */
  270. struct iwl_host_cmd {
  271. const void *data[IWL_MAX_CMD_TFDS];
  272. unsigned long reply_page;
  273. void (*callback)(struct iwl_priv *priv,
  274. struct iwl_device_cmd *cmd,
  275. struct iwl_rx_packet *pkt);
  276. u32 flags;
  277. u16 len[IWL_MAX_CMD_TFDS];
  278. u8 dataflags[IWL_MAX_CMD_TFDS];
  279. u8 id;
  280. };
  281. #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
  282. #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
  283. #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
  284. /**
  285. * struct iwl_rx_queue - Rx queue
  286. * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
  287. * @bd_dma: bus address of buffer of receive buffer descriptors (rbd)
  288. * @read: Shared index to newest available Rx buffer
  289. * @write: Shared index to oldest written Rx packet
  290. * @free_count: Number of pre-allocated buffers in rx_free
  291. * @rx_free: list of free SKBs for use
  292. * @rx_used: List of Rx buffers with no SKB
  293. * @need_update: flag to indicate we need to update read/write index
  294. * @rb_stts: driver's pointer to receive buffer status
  295. * @rb_stts_dma: bus address of receive buffer status
  296. *
  297. * NOTE: rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
  298. */
  299. struct iwl_rx_queue {
  300. __le32 *bd;
  301. dma_addr_t bd_dma;
  302. struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
  303. struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
  304. u32 read;
  305. u32 write;
  306. u32 free_count;
  307. u32 write_actual;
  308. struct list_head rx_free;
  309. struct list_head rx_used;
  310. int need_update;
  311. struct iwl_rb_status *rb_stts;
  312. dma_addr_t rb_stts_dma;
  313. spinlock_t lock;
  314. };
  315. #define IWL_SUPPORTED_RATES_IE_LEN 8
  316. #define MAX_TID_COUNT 9
  317. #define IWL_INVALID_RATE 0xFF
  318. #define IWL_INVALID_VALUE -1
  319. /**
  320. * struct iwl_ht_agg -- aggregation status while waiting for block-ack
  321. * @txq_id: Tx queue used for Tx attempt
  322. * @frame_count: # frames attempted by Tx command
  323. * @wait_for_ba: Expect block-ack before next Tx reply
  324. * @start_idx: Index of 1st Transmit Frame Descriptor (TFD) in Tx window
  325. * @bitmap0: Low order bitmap, one bit for each frame pending ACK in Tx window
  326. * @bitmap1: High order, one bit for each frame pending ACK in Tx window
  327. * @rate_n_flags: Rate at which Tx was attempted
  328. *
  329. * If REPLY_TX indicates that aggregation was attempted, driver must wait
  330. * for block ack (REPLY_COMPRESSED_BA). This struct stores tx reply info
  331. * until block ack arrives.
  332. */
  333. struct iwl_ht_agg {
  334. u16 txq_id;
  335. u16 frame_count;
  336. u16 wait_for_ba;
  337. u16 start_idx;
  338. u64 bitmap;
  339. u32 rate_n_flags;
  340. #define IWL_AGG_OFF 0
  341. #define IWL_AGG_ON 1
  342. #define IWL_EMPTYING_HW_QUEUE_ADDBA 2
  343. #define IWL_EMPTYING_HW_QUEUE_DELBA 3
  344. u8 state;
  345. u8 tx_fifo;
  346. };
  347. struct iwl_tid_data {
  348. u16 seq_number; /* agn only */
  349. u16 tfds_in_queue;
  350. struct iwl_ht_agg agg;
  351. };
  352. struct iwl_hw_key {
  353. u32 cipher;
  354. int keylen;
  355. u8 keyidx;
  356. u8 key[32];
  357. };
  358. union iwl_ht_rate_supp {
  359. u16 rates;
  360. struct {
  361. u8 siso_rate;
  362. u8 mimo_rate;
  363. };
  364. };
  365. #define CFG_HT_RX_AMPDU_FACTOR_8K (0x0)
  366. #define CFG_HT_RX_AMPDU_FACTOR_16K (0x1)
  367. #define CFG_HT_RX_AMPDU_FACTOR_32K (0x2)
  368. #define CFG_HT_RX_AMPDU_FACTOR_64K (0x3)
  369. #define CFG_HT_RX_AMPDU_FACTOR_DEF CFG_HT_RX_AMPDU_FACTOR_64K
  370. #define CFG_HT_RX_AMPDU_FACTOR_MAX CFG_HT_RX_AMPDU_FACTOR_64K
  371. #define CFG_HT_RX_AMPDU_FACTOR_MIN CFG_HT_RX_AMPDU_FACTOR_8K
  372. /*
  373. * Maximal MPDU density for TX aggregation
  374. * 4 - 2us density
  375. * 5 - 4us density
  376. * 6 - 8us density
  377. * 7 - 16us density
  378. */
  379. #define CFG_HT_MPDU_DENSITY_2USEC (0x4)
  380. #define CFG_HT_MPDU_DENSITY_4USEC (0x5)
  381. #define CFG_HT_MPDU_DENSITY_8USEC (0x6)
  382. #define CFG_HT_MPDU_DENSITY_16USEC (0x7)
  383. #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC
  384. #define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC
  385. #define CFG_HT_MPDU_DENSITY_MIN (0x1)
  386. struct iwl_ht_config {
  387. bool single_chain_sufficient;
  388. enum ieee80211_smps_mode smps; /* current smps mode */
  389. };
  390. /* QoS structures */
  391. struct iwl_qos_info {
  392. int qos_active;
  393. struct iwl_qosparam_cmd def_qos_parm;
  394. };
  395. /*
  396. * Structure should be accessed with sta_lock held. When station addition
  397. * is in progress (IWL_STA_UCODE_INPROGRESS) it is possible to access only
  398. * the commands (iwl_addsta_cmd and iwl_link_quality_cmd) without sta_lock
  399. * held.
  400. */
  401. struct iwl_station_entry {
  402. struct iwl_addsta_cmd sta;
  403. struct iwl_tid_data tid[MAX_TID_COUNT];
  404. u8 used, ctxid;
  405. struct iwl_hw_key keyinfo;
  406. struct iwl_link_quality_cmd *lq;
  407. };
  408. struct iwl_station_priv_common {
  409. struct iwl_rxon_context *ctx;
  410. u8 sta_id;
  411. };
  412. /*
  413. * iwl_station_priv: Driver's private station information
  414. *
  415. * When mac80211 creates a station it reserves some space (hw->sta_data_size)
  416. * in the structure for use by driver. This structure is places in that
  417. * space.
  418. */
  419. struct iwl_station_priv {
  420. struct iwl_station_priv_common common;
  421. struct iwl_lq_sta lq_sta;
  422. atomic_t pending_frames;
  423. bool client;
  424. bool asleep;
  425. u8 max_agg_bufsize;
  426. };
  427. /**
  428. * struct iwl_vif_priv - driver's private per-interface information
  429. *
  430. * When mac80211 allocates a virtual interface, it can allocate
  431. * space for us to put data into.
  432. */
  433. struct iwl_vif_priv {
  434. struct iwl_rxon_context *ctx;
  435. u8 ibss_bssid_sta_id;
  436. };
  437. /* one for each uCode image (inst/data, boot/init/runtime) */
  438. struct fw_desc {
  439. void *v_addr; /* access by driver */
  440. dma_addr_t p_addr; /* access by card's busmaster DMA */
  441. u32 len; /* bytes */
  442. };
  443. struct fw_img {
  444. struct fw_desc code, data;
  445. };
  446. /* v1/v2 uCode file layout */
  447. struct iwl_ucode_header {
  448. __le32 ver; /* major/minor/API/serial */
  449. union {
  450. struct {
  451. __le32 inst_size; /* bytes of runtime code */
  452. __le32 data_size; /* bytes of runtime data */
  453. __le32 init_size; /* bytes of init code */
  454. __le32 init_data_size; /* bytes of init data */
  455. __le32 boot_size; /* bytes of bootstrap code */
  456. u8 data[0]; /* in same order as sizes */
  457. } v1;
  458. struct {
  459. __le32 build; /* build number */
  460. __le32 inst_size; /* bytes of runtime code */
  461. __le32 data_size; /* bytes of runtime data */
  462. __le32 init_size; /* bytes of init code */
  463. __le32 init_data_size; /* bytes of init data */
  464. __le32 boot_size; /* bytes of bootstrap code */
  465. u8 data[0]; /* in same order as sizes */
  466. } v2;
  467. } u;
  468. };
  469. /*
  470. * new TLV uCode file layout
  471. *
  472. * The new TLV file format contains TLVs, that each specify
  473. * some piece of data. To facilitate "groups", for example
  474. * different instruction image with different capabilities,
  475. * bundled with the same init image, an alternative mechanism
  476. * is provided:
  477. * When the alternative field is 0, that means that the item
  478. * is always valid. When it is non-zero, then it is only
  479. * valid in conjunction with items of the same alternative,
  480. * in which case the driver (user) selects one alternative
  481. * to use.
  482. */
  483. enum iwl_ucode_tlv_type {
  484. IWL_UCODE_TLV_INVALID = 0, /* unused */
  485. IWL_UCODE_TLV_INST = 1,
  486. IWL_UCODE_TLV_DATA = 2,
  487. IWL_UCODE_TLV_INIT = 3,
  488. IWL_UCODE_TLV_INIT_DATA = 4,
  489. IWL_UCODE_TLV_BOOT = 5,
  490. IWL_UCODE_TLV_PROBE_MAX_LEN = 6, /* a u32 value */
  491. IWL_UCODE_TLV_PAN = 7,
  492. IWL_UCODE_TLV_RUNT_EVTLOG_PTR = 8,
  493. IWL_UCODE_TLV_RUNT_EVTLOG_SIZE = 9,
  494. IWL_UCODE_TLV_RUNT_ERRLOG_PTR = 10,
  495. IWL_UCODE_TLV_INIT_EVTLOG_PTR = 11,
  496. IWL_UCODE_TLV_INIT_EVTLOG_SIZE = 12,
  497. IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13,
  498. IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14,
  499. IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15,
  500. /* 16 and 17 reserved for future use */
  501. IWL_UCODE_TLV_FLAGS = 18,
  502. };
  503. /**
  504. * enum iwl_ucode_tlv_flag - ucode API flags
  505. * @IWL_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously
  506. * was a separate TLV but moved here to save space.
  507. * @IWL_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID,
  508. * treats good CRC threshold as a boolean
  509. * @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
  510. */
  511. enum iwl_ucode_tlv_flag {
  512. IWL_UCODE_TLV_FLAGS_PAN = BIT(0),
  513. IWL_UCODE_TLV_FLAGS_NEWSCAN = BIT(1),
  514. IWL_UCODE_TLV_FLAGS_MFP = BIT(2),
  515. };
  516. struct iwl_ucode_tlv {
  517. __le16 type; /* see above */
  518. __le16 alternative; /* see comment */
  519. __le32 length; /* not including type/length fields */
  520. u8 data[0];
  521. } __packed;
  522. #define IWL_TLV_UCODE_MAGIC 0x0a4c5749
  523. struct iwl_tlv_ucode_header {
  524. /*
  525. * The TLV style ucode header is distinguished from
  526. * the v1/v2 style header by first four bytes being
  527. * zero, as such is an invalid combination of
  528. * major/minor/API/serial versions.
  529. */
  530. __le32 zero;
  531. __le32 magic;
  532. u8 human_readable[64];
  533. __le32 ver; /* major/minor/API/serial */
  534. __le32 build;
  535. __le64 alternatives; /* bitmask of valid alternatives */
  536. /*
  537. * The data contained herein has a TLV layout,
  538. * see above for the TLV header and types.
  539. * Note that each TLV is padded to a length
  540. * that is a multiple of 4 for alignment.
  541. */
  542. u8 data[0];
  543. };
  544. struct iwl_sensitivity_ranges {
  545. u16 min_nrg_cck;
  546. u16 max_nrg_cck;
  547. u16 nrg_th_cck;
  548. u16 nrg_th_ofdm;
  549. u16 auto_corr_min_ofdm;
  550. u16 auto_corr_min_ofdm_mrc;
  551. u16 auto_corr_min_ofdm_x1;
  552. u16 auto_corr_min_ofdm_mrc_x1;
  553. u16 auto_corr_max_ofdm;
  554. u16 auto_corr_max_ofdm_mrc;
  555. u16 auto_corr_max_ofdm_x1;
  556. u16 auto_corr_max_ofdm_mrc_x1;
  557. u16 auto_corr_max_cck;
  558. u16 auto_corr_max_cck_mrc;
  559. u16 auto_corr_min_cck;
  560. u16 auto_corr_min_cck_mrc;
  561. u16 barker_corr_th_min;
  562. u16 barker_corr_th_min_mrc;
  563. u16 nrg_th_cca;
  564. };
  565. #define KELVIN_TO_CELSIUS(x) ((x)-273)
  566. #define CELSIUS_TO_KELVIN(x) ((x)+273)
  567. /**
  568. * struct iwl_hw_params
  569. * @max_txq_num: Max # Tx queues supported
  570. * @scd_bc_tbls_size: size of scheduler byte count tables
  571. * @tfd_size: TFD size
  572. * @tx/rx_chains_num: Number of TX/RX chains
  573. * @valid_tx/rx_ant: usable antennas
  574. * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
  575. * @max_rxq_log: Log-base-2 of max_rxq_size
  576. * @rx_page_order: Rx buffer page order
  577. * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
  578. * @max_stations:
  579. * @ht40_channel: is 40MHz width possible in band 2.4
  580. * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ)
  581. * @sw_crypto: 0 for hw, 1 for sw
  582. * @max_xxx_size: for ucode uses
  583. * @ct_kill_threshold: temperature threshold
  584. * @beacon_time_tsf_bits: number of valid tsf bits for beacon time
  585. * @calib_init_cfg: setup initial calibrations for the hw
  586. * @calib_rt_cfg: setup runtime calibrations for the hw
  587. * @struct iwl_sensitivity_ranges: range of sensitivity values
  588. */
  589. struct iwl_hw_params {
  590. u8 max_txq_num;
  591. u16 scd_bc_tbls_size;
  592. u32 tfd_size;
  593. u8 tx_chains_num;
  594. u8 rx_chains_num;
  595. u8 valid_tx_ant;
  596. u8 valid_rx_ant;
  597. u16 max_rxq_size;
  598. u16 max_rxq_log;
  599. u32 rx_page_order;
  600. u8 max_stations;
  601. u8 ht40_channel;
  602. u8 max_beacon_itrvl; /* in 1024 ms */
  603. u32 max_inst_size;
  604. u32 max_data_size;
  605. u32 ct_kill_threshold; /* value in hw-dependent units */
  606. u32 ct_kill_exit_threshold; /* value in hw-dependent units */
  607. /* for 1000, 6000 series and up */
  608. u16 beacon_time_tsf_bits;
  609. u32 calib_init_cfg;
  610. u32 calib_rt_cfg;
  611. const struct iwl_sensitivity_ranges *sens;
  612. };
  613. /******************************************************************************
  614. *
  615. * Functions implemented in core module which are forward declared here
  616. * for use by iwl-[4-5].c
  617. *
  618. * NOTE: The implementation of these functions are not hardware specific
  619. * which is why they are in the core module files.
  620. *
  621. * Naming convention --
  622. * iwl_ <-- Is part of iwlwifi
  623. * iwlXXXX_ <-- Hardware specific (implemented in iwl-XXXX.c for XXXX)
  624. *
  625. ****************************************************************************/
  626. extern void iwl_update_chain_flags(struct iwl_priv *priv);
  627. extern const u8 iwl_bcast_addr[ETH_ALEN];
  628. extern int iwl_queue_space(const struct iwl_queue *q);
  629. static inline int iwl_queue_used(const struct iwl_queue *q, int i)
  630. {
  631. return q->write_ptr >= q->read_ptr ?
  632. (i >= q->read_ptr && i < q->write_ptr) :
  633. !(i < q->read_ptr && i >= q->write_ptr);
  634. }
  635. static inline u8 get_cmd_index(struct iwl_queue *q, u32 index)
  636. {
  637. return index & (q->n_window - 1);
  638. }
  639. struct iwl_dma_ptr {
  640. dma_addr_t dma;
  641. void *addr;
  642. size_t size;
  643. };
  644. #define IWL_OPERATION_MODE_AUTO 0
  645. #define IWL_OPERATION_MODE_HT_ONLY 1
  646. #define IWL_OPERATION_MODE_MIXED 2
  647. #define IWL_OPERATION_MODE_20MHZ 3
  648. #define IWL_TX_CRC_SIZE 4
  649. #define IWL_TX_DELIMITER_SIZE 4
  650. #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
  651. /* Sensitivity and chain noise calibration */
  652. #define INITIALIZATION_VALUE 0xFFFF
  653. #define IWL_CAL_NUM_BEACONS 16
  654. #define MAXIMUM_ALLOWED_PATHLOSS 15
  655. #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
  656. #define MAX_FA_OFDM 50
  657. #define MIN_FA_OFDM 5
  658. #define MAX_FA_CCK 50
  659. #define MIN_FA_CCK 5
  660. #define AUTO_CORR_STEP_OFDM 1
  661. #define AUTO_CORR_STEP_CCK 3
  662. #define AUTO_CORR_MAX_TH_CCK 160
  663. #define NRG_DIFF 2
  664. #define NRG_STEP_CCK 2
  665. #define NRG_MARGIN 8
  666. #define MAX_NUMBER_CCK_NO_FA 100
  667. #define AUTO_CORR_CCK_MIN_VAL_DEF (125)
  668. #define CHAIN_A 0
  669. #define CHAIN_B 1
  670. #define CHAIN_C 2
  671. #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4
  672. #define ALL_BAND_FILTER 0xFF00
  673. #define IN_BAND_FILTER 0xFF
  674. #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF
  675. #define NRG_NUM_PREV_STAT_L 20
  676. #define NUM_RX_CHAINS 3
  677. enum iwlagn_false_alarm_state {
  678. IWL_FA_TOO_MANY = 0,
  679. IWL_FA_TOO_FEW = 1,
  680. IWL_FA_GOOD_RANGE = 2,
  681. };
  682. enum iwlagn_chain_noise_state {
  683. IWL_CHAIN_NOISE_ALIVE = 0, /* must be 0 */
  684. IWL_CHAIN_NOISE_ACCUMULATE,
  685. IWL_CHAIN_NOISE_CALIBRATED,
  686. IWL_CHAIN_NOISE_DONE,
  687. };
  688. /*
  689. * enum iwl_calib
  690. * defines the order in which results of initial calibrations
  691. * should be sent to the runtime uCode
  692. */
  693. enum iwl_calib {
  694. IWL_CALIB_XTAL,
  695. IWL_CALIB_DC,
  696. IWL_CALIB_LO,
  697. IWL_CALIB_TX_IQ,
  698. IWL_CALIB_TX_IQ_PERD,
  699. IWL_CALIB_BASE_BAND,
  700. IWL_CALIB_TEMP_OFFSET,
  701. IWL_CALIB_MAX
  702. };
  703. /* Opaque calibration results */
  704. struct iwl_calib_result {
  705. void *buf;
  706. size_t buf_len;
  707. };
  708. /* Sensitivity calib data */
  709. struct iwl_sensitivity_data {
  710. u32 auto_corr_ofdm;
  711. u32 auto_corr_ofdm_mrc;
  712. u32 auto_corr_ofdm_x1;
  713. u32 auto_corr_ofdm_mrc_x1;
  714. u32 auto_corr_cck;
  715. u32 auto_corr_cck_mrc;
  716. u32 last_bad_plcp_cnt_ofdm;
  717. u32 last_fa_cnt_ofdm;
  718. u32 last_bad_plcp_cnt_cck;
  719. u32 last_fa_cnt_cck;
  720. u32 nrg_curr_state;
  721. u32 nrg_prev_state;
  722. u32 nrg_value[10];
  723. u8 nrg_silence_rssi[NRG_NUM_PREV_STAT_L];
  724. u32 nrg_silence_ref;
  725. u32 nrg_energy_idx;
  726. u32 nrg_silence_idx;
  727. u32 nrg_th_cck;
  728. s32 nrg_auto_corr_silence_diff;
  729. u32 num_in_cck_no_fa;
  730. u32 nrg_th_ofdm;
  731. u16 barker_corr_th_min;
  732. u16 barker_corr_th_min_mrc;
  733. u16 nrg_th_cca;
  734. };
  735. /* Chain noise (differential Rx gain) calib data */
  736. struct iwl_chain_noise_data {
  737. u32 active_chains;
  738. u32 chain_noise_a;
  739. u32 chain_noise_b;
  740. u32 chain_noise_c;
  741. u32 chain_signal_a;
  742. u32 chain_signal_b;
  743. u32 chain_signal_c;
  744. u16 beacon_count;
  745. u8 disconn_array[NUM_RX_CHAINS];
  746. u8 delta_gain_code[NUM_RX_CHAINS];
  747. u8 radio_write;
  748. u8 state;
  749. };
  750. #define EEPROM_SEM_TIMEOUT 10 /* milliseconds */
  751. #define EEPROM_SEM_RETRY_LIMIT 1000 /* number of attempts (not time) */
  752. #define IWL_TRAFFIC_ENTRIES (256)
  753. #define IWL_TRAFFIC_ENTRY_SIZE (64)
  754. enum {
  755. MEASUREMENT_READY = (1 << 0),
  756. MEASUREMENT_ACTIVE = (1 << 1),
  757. };
  758. enum iwl_nvm_type {
  759. NVM_DEVICE_TYPE_EEPROM = 0,
  760. NVM_DEVICE_TYPE_OTP,
  761. };
  762. /*
  763. * Two types of OTP memory access modes
  764. * IWL_OTP_ACCESS_ABSOLUTE - absolute address mode,
  765. * based on physical memory addressing
  766. * IWL_OTP_ACCESS_RELATIVE - relative address mode,
  767. * based on logical memory addressing
  768. */
  769. enum iwl_access_mode {
  770. IWL_OTP_ACCESS_ABSOLUTE,
  771. IWL_OTP_ACCESS_RELATIVE,
  772. };
  773. /**
  774. * enum iwl_pa_type - Power Amplifier type
  775. * @IWL_PA_SYSTEM: based on uCode configuration
  776. * @IWL_PA_INTERNAL: use Internal only
  777. */
  778. enum iwl_pa_type {
  779. IWL_PA_SYSTEM = 0,
  780. IWL_PA_INTERNAL = 1,
  781. };
  782. /* interrupt statistics */
  783. struct isr_statistics {
  784. u32 hw;
  785. u32 sw;
  786. u32 err_code;
  787. u32 sch;
  788. u32 alive;
  789. u32 rfkill;
  790. u32 ctkill;
  791. u32 wakeup;
  792. u32 rx;
  793. u32 rx_handlers[REPLY_MAX];
  794. u32 tx;
  795. u32 unhandled;
  796. };
  797. /* reply_tx_statistics (for _agn devices) */
  798. struct reply_tx_error_statistics {
  799. u32 pp_delay;
  800. u32 pp_few_bytes;
  801. u32 pp_bt_prio;
  802. u32 pp_quiet_period;
  803. u32 pp_calc_ttak;
  804. u32 int_crossed_retry;
  805. u32 short_limit;
  806. u32 long_limit;
  807. u32 fifo_underrun;
  808. u32 drain_flow;
  809. u32 rfkill_flush;
  810. u32 life_expire;
  811. u32 dest_ps;
  812. u32 host_abort;
  813. u32 bt_retry;
  814. u32 sta_invalid;
  815. u32 frag_drop;
  816. u32 tid_disable;
  817. u32 fifo_flush;
  818. u32 insuff_cf_poll;
  819. u32 fail_hw_drop;
  820. u32 sta_color_mismatch;
  821. u32 unknown;
  822. };
  823. /* reply_agg_tx_statistics (for _agn devices) */
  824. struct reply_agg_tx_error_statistics {
  825. u32 underrun;
  826. u32 bt_prio;
  827. u32 few_bytes;
  828. u32 abort;
  829. u32 last_sent_ttl;
  830. u32 last_sent_try;
  831. u32 last_sent_bt_kill;
  832. u32 scd_query;
  833. u32 bad_crc32;
  834. u32 response;
  835. u32 dump_tx;
  836. u32 delay_tx;
  837. u32 unknown;
  838. };
  839. /* management statistics */
  840. enum iwl_mgmt_stats {
  841. MANAGEMENT_ASSOC_REQ = 0,
  842. MANAGEMENT_ASSOC_RESP,
  843. MANAGEMENT_REASSOC_REQ,
  844. MANAGEMENT_REASSOC_RESP,
  845. MANAGEMENT_PROBE_REQ,
  846. MANAGEMENT_PROBE_RESP,
  847. MANAGEMENT_BEACON,
  848. MANAGEMENT_ATIM,
  849. MANAGEMENT_DISASSOC,
  850. MANAGEMENT_AUTH,
  851. MANAGEMENT_DEAUTH,
  852. MANAGEMENT_ACTION,
  853. MANAGEMENT_MAX,
  854. };
  855. /* control statistics */
  856. enum iwl_ctrl_stats {
  857. CONTROL_BACK_REQ = 0,
  858. CONTROL_BACK,
  859. CONTROL_PSPOLL,
  860. CONTROL_RTS,
  861. CONTROL_CTS,
  862. CONTROL_ACK,
  863. CONTROL_CFEND,
  864. CONTROL_CFENDACK,
  865. CONTROL_MAX,
  866. };
  867. struct traffic_stats {
  868. #ifdef CONFIG_IWLWIFI_DEBUGFS
  869. u32 mgmt[MANAGEMENT_MAX];
  870. u32 ctrl[CONTROL_MAX];
  871. u32 data_cnt;
  872. u64 data_bytes;
  873. #endif
  874. };
  875. /*
  876. * schedule the timer to wake up every UCODE_TRACE_PERIOD milliseconds
  877. * to perform continuous uCode event logging operation if enabled
  878. */
  879. #define UCODE_TRACE_PERIOD (100)
  880. /*
  881. * iwl_event_log: current uCode event log position
  882. *
  883. * @ucode_trace: enable/disable ucode continuous trace timer
  884. * @num_wraps: how many times the event buffer wraps
  885. * @next_entry: the entry just before the next one that uCode would fill
  886. * @non_wraps_count: counter for no wrap detected when dump ucode events
  887. * @wraps_once_count: counter for wrap once detected when dump ucode events
  888. * @wraps_more_count: counter for wrap more than once detected
  889. * when dump ucode events
  890. */
  891. struct iwl_event_log {
  892. bool ucode_trace;
  893. u32 num_wraps;
  894. u32 next_entry;
  895. int non_wraps_count;
  896. int wraps_once_count;
  897. int wraps_more_count;
  898. };
  899. /*
  900. * host interrupt timeout value
  901. * used with setting interrupt coalescing timer
  902. * the CSR_INT_COALESCING is an 8 bit register in 32-usec unit
  903. *
  904. * default interrupt coalescing timer is 64 x 32 = 2048 usecs
  905. * default interrupt coalescing calibration timer is 16 x 32 = 512 usecs
  906. */
  907. #define IWL_HOST_INT_TIMEOUT_MAX (0xFF)
  908. #define IWL_HOST_INT_TIMEOUT_DEF (0x40)
  909. #define IWL_HOST_INT_TIMEOUT_MIN (0x0)
  910. #define IWL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF)
  911. #define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10)
  912. #define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0)
  913. /*
  914. * This is the threshold value of plcp error rate per 100mSecs. It is
  915. * used to set and check for the validity of plcp_delta.
  916. */
  917. #define IWL_MAX_PLCP_ERR_THRESHOLD_MIN (1)
  918. #define IWL_MAX_PLCP_ERR_THRESHOLD_DEF (50)
  919. #define IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF (100)
  920. #define IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF (200)
  921. #define IWL_MAX_PLCP_ERR_THRESHOLD_MAX (255)
  922. #define IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE (0)
  923. #define IWL_DELAY_NEXT_FORCE_RF_RESET (HZ*3)
  924. #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5)
  925. /* TX queue watchdog timeouts in mSecs */
  926. #define IWL_DEF_WD_TIMEOUT (2000)
  927. #define IWL_LONG_WD_TIMEOUT (10000)
  928. #define IWL_MAX_WD_TIMEOUT (120000)
  929. /* BT Antenna Coupling Threshold (dB) */
  930. #define IWL_BT_ANTENNA_COUPLING_THRESHOLD (35)
  931. /* Firmware reload counter and Timestamp */
  932. #define IWL_MIN_RELOAD_DURATION 1000 /* 1000 ms */
  933. #define IWL_MAX_CONTINUE_RELOAD_CNT 4
  934. enum iwl_reset {
  935. IWL_RF_RESET = 0,
  936. IWL_FW_RESET,
  937. IWL_MAX_FORCE_RESET,
  938. };
  939. struct iwl_force_reset {
  940. int reset_request_count;
  941. int reset_success_count;
  942. int reset_reject_count;
  943. unsigned long reset_duration;
  944. unsigned long last_force_reset_jiffies;
  945. };
  946. /* extend beacon time format bit shifting */
  947. /*
  948. * for _agn devices
  949. * bits 31:22 - extended
  950. * bits 21:0 - interval
  951. */
  952. #define IWLAGN_EXT_BEACON_TIME_POS 22
  953. /**
  954. * struct iwl_notification_wait - notification wait entry
  955. * @list: list head for global list
  956. * @fn: function called with the notification
  957. * @cmd: command ID
  958. *
  959. * This structure is not used directly, to wait for a
  960. * notification declare it on the stack, and call
  961. * iwlagn_init_notification_wait() with appropriate
  962. * parameters. Then do whatever will cause the ucode
  963. * to notify the driver, and to wait for that then
  964. * call iwlagn_wait_notification().
  965. *
  966. * Each notification is one-shot. If at some point we
  967. * need to support multi-shot notifications (which
  968. * can't be allocated on the stack) we need to modify
  969. * the code for them.
  970. */
  971. struct iwl_notification_wait {
  972. struct list_head list;
  973. void (*fn)(struct iwl_priv *priv, struct iwl_rx_packet *pkt,
  974. void *data);
  975. void *fn_data;
  976. u8 cmd;
  977. bool triggered, aborted;
  978. };
  979. enum iwl_rxon_context_id {
  980. IWL_RXON_CTX_BSS,
  981. IWL_RXON_CTX_PAN,
  982. NUM_IWL_RXON_CTX
  983. };
  984. struct iwl_rxon_context {
  985. struct ieee80211_vif *vif;
  986. const u8 *ac_to_fifo;
  987. const u8 *ac_to_queue;
  988. u8 mcast_queue;
  989. /*
  990. * We could use the vif to indicate active, but we
  991. * also need it to be active during disabling when
  992. * we already removed the vif for type setting.
  993. */
  994. bool always_active, is_active;
  995. bool ht_need_multiple_chains;
  996. enum iwl_rxon_context_id ctxid;
  997. u32 interface_modes, exclusive_interface_modes;
  998. u8 unused_devtype, ap_devtype, ibss_devtype, station_devtype;
  999. /*
  1000. * We declare this const so it can only be
  1001. * changed via explicit cast within the
  1002. * routines that actually update the physical
  1003. * hardware.
  1004. */
  1005. const struct iwl_rxon_cmd active;
  1006. struct iwl_rxon_cmd staging;
  1007. struct iwl_rxon_time_cmd timing;
  1008. struct iwl_qos_info qos_data;
  1009. u8 bcast_sta_id, ap_sta_id;
  1010. u8 rxon_cmd, rxon_assoc_cmd, rxon_timing_cmd;
  1011. u8 qos_cmd;
  1012. u8 wep_key_cmd;
  1013. struct iwl_wep_key wep_keys[WEP_KEYS_MAX];
  1014. u8 key_mapping_keys;
  1015. __le32 station_flags;
  1016. struct {
  1017. bool non_gf_sta_present;
  1018. u8 protection;
  1019. bool enabled, is_40mhz;
  1020. u8 extension_chan_offset;
  1021. } ht;
  1022. bool last_tx_rejected;
  1023. };
  1024. enum iwl_scan_type {
  1025. IWL_SCAN_NORMAL,
  1026. IWL_SCAN_RADIO_RESET,
  1027. IWL_SCAN_OFFCH_TX,
  1028. };
  1029. enum iwlagn_ucode_type {
  1030. IWL_UCODE_NONE,
  1031. IWL_UCODE_REGULAR,
  1032. IWL_UCODE_INIT,
  1033. IWL_UCODE_WOWLAN,
  1034. };
  1035. #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL
  1036. struct iwl_testmode_trace {
  1037. u32 buff_size;
  1038. u32 total_size;
  1039. u32 num_chunks;
  1040. u8 *cpu_addr;
  1041. u8 *trace_addr;
  1042. dma_addr_t dma_addr;
  1043. bool trace_enabled;
  1044. };
  1045. #endif
  1046. struct iwl_bus;
  1047. /**
  1048. * struct iwl_bus_ops - bus specific operations
  1049. * @get_pm_support: must returns true if the bus can go to sleep
  1050. * @apm_config: will be called during the config of the APM configuration
  1051. * @set_drv_data: set the priv pointer to the bus layer
  1052. * @get_dev: returns the device struct
  1053. * @get_irq: returns the irq number
  1054. * @get_hw_id: prints the hw_id in the provided buffer
  1055. * @write8: write a byte to register at offset ofs
  1056. * @write32: write a dword to register at offset ofs
  1057. * @wread32: read a dword at register at offset ofs
  1058. */
  1059. struct iwl_bus_ops {
  1060. bool (*get_pm_support)(struct iwl_bus *bus);
  1061. void (*apm_config)(struct iwl_bus *bus);
  1062. void (*set_drv_data)(struct iwl_bus *bus, void *priv);
  1063. struct device *(*get_dev)(const struct iwl_bus *bus);
  1064. unsigned int (*get_irq)(const struct iwl_bus *bus);
  1065. void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len);
  1066. void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
  1067. void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
  1068. u32 (*read32)(struct iwl_bus *bus, u32 ofs);
  1069. };
  1070. struct iwl_bus {
  1071. /* pointer to bus specific struct */
  1072. void *bus_specific;
  1073. /* Common data to all buses */
  1074. struct iwl_priv *priv; /* driver's context */
  1075. struct device *dev;
  1076. struct iwl_bus_ops *ops;
  1077. unsigned int irq;
  1078. };
  1079. struct iwl_trans;
  1080. /**
  1081. * struct iwl_trans_ops - transport specific operations
  1082. * @rx_init: inits the rx memory, allocate it if needed
  1083. * @rx_free: frees the rx memory
  1084. * @tx_init:inits the tx memory, allocate if needed
  1085. * @tx_free: frees the tx memory
  1086. * @stop_device:stops the whole device (embedded CPU put to reset)
  1087. * @send_cmd:send a host command
  1088. * @send_cmd_pdu:send a host command: flags can be CMD_*
  1089. * @get_tx_cmd: returns a pointer to a new Tx cmd for the upper layer use
  1090. * @tx: send an skb
  1091. * @sync_irq: the upper layer will typically disable interrupt and call this
  1092. * handler. After this handler returns, it is guaranteed that all
  1093. * the ISR / tasklet etc... have finished running and the transport
  1094. * layer shall not pass any Rx.
  1095. * @free: release all the ressource for the transport layer itself such as
  1096. * irq, tasklet etc...
  1097. */
  1098. struct iwl_trans_ops {
  1099. int (*rx_init)(struct iwl_priv *priv);
  1100. void (*rx_free)(struct iwl_priv *priv);
  1101. int (*tx_init)(struct iwl_priv *priv);
  1102. void (*tx_free)(struct iwl_priv *priv);
  1103. void (*stop_device)(struct iwl_priv *priv);
  1104. int (*send_cmd)(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
  1105. int (*send_cmd_pdu)(struct iwl_priv *priv, u8 id, u32 flags, u16 len,
  1106. const void *data);
  1107. struct iwl_tx_cmd * (*get_tx_cmd)(struct iwl_priv *priv, int txq_id);
  1108. int (*tx)(struct iwl_priv *priv, struct sk_buff *skb,
  1109. struct iwl_tx_cmd *tx_cmd, int txq_id, __le16 fc, bool ampdu,
  1110. struct iwl_rxon_context *ctx);
  1111. void (*sync_irq)(struct iwl_priv *priv);
  1112. void (*free)(struct iwl_priv *priv);
  1113. };
  1114. struct iwl_trans {
  1115. const struct iwl_trans_ops *ops;
  1116. };
  1117. /* uCode ownership */
  1118. #define IWL_OWNERSHIP_DRIVER 0
  1119. #define IWL_OWNERSHIP_TM 1
  1120. struct iwl_priv {
  1121. /* ieee device used by generic ieee processing code */
  1122. struct ieee80211_hw *hw;
  1123. struct ieee80211_channel *ieee_channels;
  1124. struct ieee80211_rate *ieee_rates;
  1125. struct iwl_cfg *cfg;
  1126. enum ieee80211_band band;
  1127. void (*pre_rx_handler)(struct iwl_priv *priv,
  1128. struct iwl_rx_mem_buffer *rxb);
  1129. void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
  1130. struct iwl_rx_mem_buffer *rxb);
  1131. struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
  1132. /* spectrum measurement report caching */
  1133. struct iwl_spectrum_notification measure_report;
  1134. u8 measurement_status;
  1135. /* ucode beacon time */
  1136. u32 ucode_beacon_time;
  1137. int missed_beacon_threshold;
  1138. /* track IBSS manager (last beacon) status */
  1139. u32 ibss_manager;
  1140. /* jiffies when last recovery from statistics was performed */
  1141. unsigned long rx_statistics_jiffies;
  1142. /* force reset */
  1143. struct iwl_force_reset force_reset[IWL_MAX_FORCE_RESET];
  1144. /* firmware reload counter and timestamp */
  1145. unsigned long reload_jiffies;
  1146. int reload_count;
  1147. /* we allocate array of iwl_channel_info for NIC's valid channels.
  1148. * Access via channel # using indirect index array */
  1149. struct iwl_channel_info *channel_info; /* channel info array */
  1150. u8 channel_count; /* # of channels */
  1151. /* thermal calibration */
  1152. s32 temperature; /* degrees Kelvin */
  1153. s32 last_temperature;
  1154. /* init calibration results */
  1155. struct iwl_calib_result calib_results[IWL_CALIB_MAX];
  1156. /* Scan related variables */
  1157. unsigned long scan_start;
  1158. unsigned long scan_start_tsf;
  1159. void *scan_cmd;
  1160. enum ieee80211_band scan_band;
  1161. struct cfg80211_scan_request *scan_request;
  1162. struct ieee80211_vif *scan_vif;
  1163. enum iwl_scan_type scan_type;
  1164. u8 scan_tx_ant[IEEE80211_NUM_BANDS];
  1165. u8 mgmt_tx_ant;
  1166. /* spinlock */
  1167. spinlock_t lock; /* protect general shared data */
  1168. spinlock_t hcmd_lock; /* protect hcmd */
  1169. spinlock_t reg_lock; /* protect hw register access */
  1170. struct mutex mutex;
  1171. struct iwl_bus bus; /* bus specific data */
  1172. struct iwl_trans trans;
  1173. /* microcode/device supports multiple contexts */
  1174. u8 valid_contexts;
  1175. /* command queue number */
  1176. u8 cmd_queue;
  1177. /* max number of station keys */
  1178. u8 sta_key_max_num;
  1179. bool new_scan_threshold_behaviour;
  1180. /* EEPROM MAC addresses */
  1181. struct mac_address addresses[2];
  1182. /* uCode images, save to reload in case of failure */
  1183. int fw_index; /* firmware we're trying to load */
  1184. u32 ucode_ver; /* version of ucode, copy of
  1185. iwl_ucode.ver */
  1186. /* uCode owner: default: IWL_OWNERSHIP_DRIVER */
  1187. u8 ucode_owner;
  1188. struct fw_img ucode_rt;
  1189. struct fw_img ucode_init;
  1190. enum iwlagn_ucode_type ucode_type;
  1191. u8 ucode_write_complete; /* the image write is complete */
  1192. char firmware_name[25];
  1193. struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
  1194. __le16 switch_channel;
  1195. struct {
  1196. u32 error_event_table;
  1197. u32 log_event_table;
  1198. } device_pointers;
  1199. u16 active_rate;
  1200. u8 start_calib;
  1201. struct iwl_sensitivity_data sensitivity_data;
  1202. struct iwl_chain_noise_data chain_noise_data;
  1203. bool enhance_sensitivity_table;
  1204. __le16 sensitivity_tbl[HD_TABLE_SIZE];
  1205. __le16 enhance_sensitivity_tbl[ENHANCE_HD_TABLE_ENTRIES];
  1206. struct iwl_ht_config current_ht_config;
  1207. /* Rate scaling data */
  1208. u8 retry_rate;
  1209. wait_queue_head_t wait_command_queue;
  1210. int activity_timer_active;
  1211. /* Rx and Tx DMA processing queues */
  1212. struct iwl_rx_queue rxq;
  1213. struct iwl_tx_queue *txq;
  1214. unsigned long txq_ctx_active_msk;
  1215. struct iwl_dma_ptr kw; /* keep warm address */
  1216. struct iwl_dma_ptr scd_bc_tbls;
  1217. u32 scd_base_addr; /* scheduler sram base address */
  1218. unsigned long status;
  1219. /* counts mgmt, ctl, and data packets */
  1220. struct traffic_stats tx_stats;
  1221. struct traffic_stats rx_stats;
  1222. /* counts interrupts */
  1223. struct isr_statistics isr_stats;
  1224. struct iwl_power_mgr power_data;
  1225. struct iwl_tt_mgmt thermal_throttle;
  1226. /* station table variables */
  1227. /* Note: if lock and sta_lock are needed, lock must be acquired first */
  1228. spinlock_t sta_lock;
  1229. int num_stations;
  1230. struct iwl_station_entry stations[IWLAGN_STATION_COUNT];
  1231. unsigned long ucode_key_table;
  1232. /* queue refcounts */
  1233. #define IWL_MAX_HW_QUEUES 32
  1234. unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
  1235. /* for each AC */
  1236. atomic_t queue_stop_count[4];
  1237. /* Indication if ieee80211_ops->open has been called */
  1238. u8 is_open;
  1239. u8 mac80211_registered;
  1240. /* eeprom -- this is in the card's little endian byte order */
  1241. u8 *eeprom;
  1242. int nvm_device_type;
  1243. struct iwl_eeprom_calib_info *calib_info;
  1244. enum nl80211_iftype iw_mode;
  1245. /* Last Rx'd beacon timestamp */
  1246. u64 timestamp;
  1247. struct {
  1248. __le32 flag;
  1249. struct statistics_general_common common;
  1250. struct statistics_rx_non_phy rx_non_phy;
  1251. struct statistics_rx_phy rx_ofdm;
  1252. struct statistics_rx_ht_phy rx_ofdm_ht;
  1253. struct statistics_rx_phy rx_cck;
  1254. struct statistics_tx tx;
  1255. #ifdef CONFIG_IWLWIFI_DEBUGFS
  1256. struct statistics_bt_activity bt_activity;
  1257. __le32 num_bt_kills, accum_num_bt_kills;
  1258. #endif
  1259. } statistics;
  1260. #ifdef CONFIG_IWLWIFI_DEBUGFS
  1261. struct {
  1262. struct statistics_general_common common;
  1263. struct statistics_rx_non_phy rx_non_phy;
  1264. struct statistics_rx_phy rx_ofdm;
  1265. struct statistics_rx_ht_phy rx_ofdm_ht;
  1266. struct statistics_rx_phy rx_cck;
  1267. struct statistics_tx tx;
  1268. struct statistics_bt_activity bt_activity;
  1269. } accum_stats, delta_stats, max_delta_stats;
  1270. #endif
  1271. struct {
  1272. /* INT ICT Table */
  1273. __le32 *ict_tbl;
  1274. void *ict_tbl_vir;
  1275. dma_addr_t ict_tbl_dma;
  1276. dma_addr_t aligned_ict_tbl_dma;
  1277. int ict_index;
  1278. u32 inta;
  1279. bool use_ict;
  1280. /*
  1281. * reporting the number of tids has AGG on. 0 means
  1282. * no AGGREGATION
  1283. */
  1284. u8 agg_tids_count;
  1285. struct iwl_rx_phy_res last_phy_res;
  1286. bool last_phy_res_valid;
  1287. struct completion firmware_loading_complete;
  1288. u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
  1289. u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
  1290. /*
  1291. * chain noise reset and gain commands are the
  1292. * two extra calibration commands follows the standard
  1293. * phy calibration commands
  1294. */
  1295. u8 phy_calib_chain_noise_reset_cmd;
  1296. u8 phy_calib_chain_noise_gain_cmd;
  1297. /* counts reply_tx error */
  1298. struct reply_tx_error_statistics reply_tx_stats;
  1299. struct reply_agg_tx_error_statistics reply_agg_tx_stats;
  1300. /* notification wait support */
  1301. struct list_head notif_waits;
  1302. spinlock_t notif_wait_lock;
  1303. wait_queue_head_t notif_waitq;
  1304. /* remain-on-channel offload support */
  1305. struct ieee80211_channel *hw_roc_channel;
  1306. struct delayed_work hw_roc_work;
  1307. enum nl80211_channel_type hw_roc_chantype;
  1308. int hw_roc_duration;
  1309. bool hw_roc_setup;
  1310. struct sk_buff *offchan_tx_skb;
  1311. int offchan_tx_timeout;
  1312. struct ieee80211_channel *offchan_tx_chan;
  1313. } _agn;
  1314. /* bt coex */
  1315. u8 bt_enable_flag;
  1316. u8 bt_status;
  1317. u8 bt_traffic_load, last_bt_traffic_load;
  1318. bool bt_ch_announce;
  1319. bool bt_full_concurrent;
  1320. bool bt_ant_couple_ok;
  1321. __le32 kill_ack_mask;
  1322. __le32 kill_cts_mask;
  1323. __le16 bt_valid;
  1324. u16 bt_on_thresh;
  1325. u16 bt_duration;
  1326. u16 dynamic_frag_thresh;
  1327. u8 bt_ci_compliance;
  1328. struct work_struct bt_traffic_change_work;
  1329. bool bt_enable_pspoll;
  1330. struct iwl_rxon_context *cur_rssi_ctx;
  1331. bool bt_is_sco;
  1332. struct iwl_hw_params hw_params;
  1333. u32 inta_mask;
  1334. struct workqueue_struct *workqueue;
  1335. struct work_struct restart;
  1336. struct work_struct scan_completed;
  1337. struct work_struct rx_replenish;
  1338. struct work_struct abort_scan;
  1339. struct work_struct beacon_update;
  1340. struct iwl_rxon_context *beacon_ctx;
  1341. struct sk_buff *beacon_skb;
  1342. void *beacon_cmd;
  1343. struct work_struct tt_work;
  1344. struct work_struct ct_enter;
  1345. struct work_struct ct_exit;
  1346. struct work_struct start_internal_scan;
  1347. struct work_struct tx_flush;
  1348. struct work_struct bt_full_concurrency;
  1349. struct work_struct bt_runtime_config;
  1350. struct tasklet_struct irq_tasklet;
  1351. struct delayed_work scan_check;
  1352. /* TX Power */
  1353. s8 tx_power_user_lmt;
  1354. s8 tx_power_device_lmt;
  1355. s8 tx_power_lmt_in_half_dbm; /* max tx power in half-dBm format */
  1356. s8 tx_power_next;
  1357. #ifdef CONFIG_IWLWIFI_DEBUG
  1358. /* debugging info */
  1359. u32 debug_level; /* per device debugging will override global
  1360. iwl_debug_level if set */
  1361. #endif /* CONFIG_IWLWIFI_DEBUG */
  1362. #ifdef CONFIG_IWLWIFI_DEBUGFS
  1363. /* debugfs */
  1364. u16 tx_traffic_idx;
  1365. u16 rx_traffic_idx;
  1366. u8 *tx_traffic;
  1367. u8 *rx_traffic;
  1368. struct dentry *debugfs_dir;
  1369. u32 dbgfs_sram_offset, dbgfs_sram_len;
  1370. bool disable_ht40;
  1371. #endif /* CONFIG_IWLWIFI_DEBUGFS */
  1372. struct work_struct txpower_work;
  1373. u32 disable_sens_cal;
  1374. u32 disable_chain_noise_cal;
  1375. struct work_struct run_time_calib_work;
  1376. struct timer_list statistics_periodic;
  1377. struct timer_list ucode_trace;
  1378. struct timer_list watchdog;
  1379. struct iwl_event_log event_log;
  1380. struct led_classdev led;
  1381. unsigned long blink_on, blink_off;
  1382. bool led_registered;
  1383. #ifdef CONFIG_IWLWIFI_DEVICE_SVTOOL
  1384. struct iwl_testmode_trace testmode_trace;
  1385. #endif
  1386. u32 tm_fixed_rate;
  1387. }; /*iwl_priv */
  1388. static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
  1389. {
  1390. set_bit(txq_id, &priv->txq_ctx_active_msk);
  1391. }
  1392. static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id)
  1393. {
  1394. clear_bit(txq_id, &priv->txq_ctx_active_msk);
  1395. }
  1396. #ifdef CONFIG_IWLWIFI_DEBUG
  1397. /*
  1398. * iwl_get_debug_level: Return active debug level for device
  1399. *
  1400. * Using sysfs it is possible to set per device debug level. This debug
  1401. * level will be used if set, otherwise the global debug level which can be
  1402. * set via module parameter is used.
  1403. */
  1404. static inline u32 iwl_get_debug_level(struct iwl_priv *priv)
  1405. {
  1406. if (priv->debug_level)
  1407. return priv->debug_level;
  1408. else
  1409. return iwl_debug_level;
  1410. }
  1411. #else
  1412. static inline u32 iwl_get_debug_level(struct iwl_priv *priv)
  1413. {
  1414. return iwl_debug_level;
  1415. }
  1416. #endif
  1417. static inline struct ieee80211_hdr *iwl_tx_queue_get_hdr(struct iwl_priv *priv,
  1418. int txq_id, int idx)
  1419. {
  1420. if (priv->txq[txq_id].txb[idx].skb)
  1421. return (struct ieee80211_hdr *)priv->txq[txq_id].
  1422. txb[idx].skb->data;
  1423. return NULL;
  1424. }
  1425. static inline struct iwl_rxon_context *
  1426. iwl_rxon_ctx_from_vif(struct ieee80211_vif *vif)
  1427. {
  1428. struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
  1429. return vif_priv->ctx;
  1430. }
  1431. #define for_each_context(priv, ctx) \
  1432. for (ctx = &priv->contexts[IWL_RXON_CTX_BSS]; \
  1433. ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \
  1434. if (priv->valid_contexts & BIT(ctx->ctxid))
  1435. static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx)
  1436. {
  1437. return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
  1438. }
  1439. static inline int iwl_is_associated(struct iwl_priv *priv,
  1440. enum iwl_rxon_context_id ctxid)
  1441. {
  1442. return iwl_is_associated_ctx(&priv->contexts[ctxid]);
  1443. }
  1444. static inline int iwl_is_any_associated(struct iwl_priv *priv)
  1445. {
  1446. struct iwl_rxon_context *ctx;
  1447. for_each_context(priv, ctx)
  1448. if (iwl_is_associated_ctx(ctx))
  1449. return true;
  1450. return false;
  1451. }
  1452. static inline int is_channel_valid(const struct iwl_channel_info *ch_info)
  1453. {
  1454. if (ch_info == NULL)
  1455. return 0;
  1456. return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
  1457. }
  1458. static inline int is_channel_radar(const struct iwl_channel_info *ch_info)
  1459. {
  1460. return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
  1461. }
  1462. static inline u8 is_channel_a_band(const struct iwl_channel_info *ch_info)
  1463. {
  1464. return ch_info->band == IEEE80211_BAND_5GHZ;
  1465. }
  1466. static inline u8 is_channel_bg_band(const struct iwl_channel_info *ch_info)
  1467. {
  1468. return ch_info->band == IEEE80211_BAND_2GHZ;
  1469. }
  1470. static inline int is_channel_passive(const struct iwl_channel_info *ch)
  1471. {
  1472. return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
  1473. }
  1474. static inline int is_channel_ibss(const struct iwl_channel_info *ch)
  1475. {
  1476. return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
  1477. }
  1478. static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page)
  1479. {
  1480. __free_pages(page, priv->hw_params.rx_page_order);
  1481. }
  1482. static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page)
  1483. {
  1484. free_pages(page, priv->hw_params.rx_page_order);
  1485. }
  1486. #endif /* __iwl_dev_h__ */