iwl-3945-commands.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called LICENSE.GPL.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. /*
  64. * Please use this file (iwl-3945-commands.h) only for uCode API definitions.
  65. * Please use iwl-3945-hw.h for hardware-related definitions.
  66. * Please use iwl-3945.h for driver implementation definitions.
  67. */
  68. #ifndef __iwl_3945_commands_h__
  69. #define __iwl_3945_commands_h__
  70. /******************************************************************************
  71. * (0)
  72. * Commonly used structures and definitions:
  73. * Command header, txpower
  74. *
  75. *****************************************************************************/
  76. /**
  77. * struct iwl3945_tx_power
  78. *
  79. * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
  80. *
  81. * Each entry contains two values:
  82. * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
  83. * linear value that multiplies the output of the digital signal processor,
  84. * before being sent to the analog radio.
  85. * 2) Radio gain. This sets the analog gain of the radio Tx path.
  86. * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
  87. *
  88. * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
  89. */
  90. struct iwl3945_tx_power {
  91. u8 tx_gain; /* gain for analog radio */
  92. u8 dsp_atten; /* gain for DSP */
  93. } __attribute__ ((packed));
  94. /**
  95. * struct iwl3945_power_per_rate
  96. *
  97. * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
  98. */
  99. struct iwl3945_power_per_rate {
  100. u8 rate; /* plcp */
  101. struct iwl3945_tx_power tpc;
  102. u8 reserved;
  103. } __attribute__ ((packed));
  104. /******************************************************************************
  105. * (0a)
  106. * Alive and Error Commands & Responses:
  107. *
  108. *****************************************************************************/
  109. /*
  110. * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
  111. *
  112. * uCode issues this "initialize alive" notification once the initialization
  113. * uCode image has completed its work, and is ready to load the runtime image.
  114. * This is the *first* "alive" notification that the driver will receive after
  115. * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
  116. *
  117. * See comments documenting "BSM" (bootstrap state machine).
  118. */
  119. struct iwl3945_init_alive_resp {
  120. u8 ucode_minor;
  121. u8 ucode_major;
  122. __le16 reserved1;
  123. u8 sw_rev[8];
  124. u8 ver_type;
  125. u8 ver_subtype; /* "9" for initialize alive */
  126. __le16 reserved2;
  127. __le32 log_event_table_ptr;
  128. __le32 error_event_table_ptr;
  129. __le32 timestamp;
  130. __le32 is_valid;
  131. } __attribute__ ((packed));
  132. /**
  133. * REPLY_ALIVE = 0x1 (response only, not a command)
  134. *
  135. * uCode issues this "alive" notification once the runtime image is ready
  136. * to receive commands from the driver. This is the *second* "alive"
  137. * notification that the driver will receive after rebooting uCode;
  138. * this "alive" is indicated by subtype field != 9.
  139. *
  140. * See comments documenting "BSM" (bootstrap state machine).
  141. *
  142. * This response includes two pointers to structures within the device's
  143. * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
  144. *
  145. * 1) log_event_table_ptr indicates base of the event log. This traces
  146. * a 256-entry history of uCode execution within a circular buffer.
  147. *
  148. * 2) error_event_table_ptr indicates base of the error log. This contains
  149. * information about any uCode error that occurs.
  150. *
  151. * The Linux driver can print both logs to the system log when a uCode error
  152. * occurs.
  153. */
  154. struct iwl3945_alive_resp {
  155. u8 ucode_minor;
  156. u8 ucode_major;
  157. __le16 reserved1;
  158. u8 sw_rev[8];
  159. u8 ver_type;
  160. u8 ver_subtype; /* not "9" for runtime alive */
  161. __le16 reserved2;
  162. __le32 log_event_table_ptr; /* SRAM address for event log */
  163. __le32 error_event_table_ptr; /* SRAM address for error log */
  164. __le32 timestamp;
  165. __le32 is_valid;
  166. } __attribute__ ((packed));
  167. union tsf {
  168. u8 byte[8];
  169. __le16 word[4];
  170. __le32 dw[2];
  171. };
  172. /*
  173. * REPLY_ERROR = 0x2 (response only, not a command)
  174. */
  175. struct iwl3945_error_resp {
  176. __le32 error_type;
  177. u8 cmd_id;
  178. u8 reserved1;
  179. __le16 bad_cmd_seq_num;
  180. __le16 reserved2;
  181. __le32 error_info;
  182. union tsf timestamp;
  183. } __attribute__ ((packed));
  184. /******************************************************************************
  185. * (1)
  186. * RXON Commands & Responses:
  187. *
  188. *****************************************************************************/
  189. /**
  190. * REPLY_RXON = 0x10 (command, has simple generic response)
  191. *
  192. * RXON tunes the radio tuner to a service channel, and sets up a number
  193. * of parameters that are used primarily for Rx, but also for Tx operations.
  194. *
  195. * NOTE: When tuning to a new channel, driver must set the
  196. * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
  197. * info within the device, including the station tables, tx retry
  198. * rate tables, and txpower tables. Driver must build a new station
  199. * table and txpower table before transmitting anything on the RXON
  200. * channel.
  201. *
  202. * NOTE: All RXONs wipe clean the internal txpower table. Driver must
  203. * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
  204. * regardless of whether RXON_FILTER_ASSOC_MSK is set.
  205. */
  206. struct iwl3945_rxon_cmd {
  207. u8 node_addr[6];
  208. __le16 reserved1;
  209. u8 bssid_addr[6];
  210. __le16 reserved2;
  211. u8 wlap_bssid_addr[6];
  212. __le16 reserved3;
  213. u8 dev_type;
  214. u8 air_propagation;
  215. __le16 reserved4;
  216. u8 ofdm_basic_rates;
  217. u8 cck_basic_rates;
  218. __le16 assoc_id;
  219. __le32 flags;
  220. __le32 filter_flags;
  221. __le16 channel;
  222. __le16 reserved5;
  223. } __attribute__ ((packed));
  224. /*
  225. * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  226. */
  227. struct iwl3945_rxon_assoc_cmd {
  228. __le32 flags;
  229. __le32 filter_flags;
  230. u8 ofdm_basic_rates;
  231. u8 cck_basic_rates;
  232. __le16 reserved;
  233. } __attribute__ ((packed));
  234. /*
  235. * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  236. */
  237. struct iwl3945_rxon_time_cmd {
  238. union tsf timestamp;
  239. __le16 beacon_interval;
  240. __le16 atim_window;
  241. __le32 beacon_init_val;
  242. __le16 listen_interval;
  243. __le16 reserved;
  244. } __attribute__ ((packed));
  245. /*
  246. * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  247. */
  248. struct iwl3945_channel_switch_cmd {
  249. u8 band;
  250. u8 expect_beacon;
  251. __le16 channel;
  252. __le32 rxon_flags;
  253. __le32 rxon_filter_flags;
  254. __le32 switch_time;
  255. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  256. } __attribute__ ((packed));
  257. /******************************************************************************
  258. * (3)
  259. * Add/Modify Stations Commands & Responses:
  260. *
  261. *****************************************************************************/
  262. /*
  263. * REPLY_ADD_STA = 0x18 (command)
  264. *
  265. * The device contains an internal table of per-station information,
  266. * with info on security keys, aggregation parameters, and Tx rates for
  267. * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
  268. * 3945 uses REPLY_RATE_SCALE to set up rate tables).
  269. *
  270. * REPLY_ADD_STA sets up the table entry for one station, either creating
  271. * a new entry, or modifying a pre-existing one.
  272. *
  273. * NOTE: RXON command (without "associated" bit set) wipes the station table
  274. * clean. Moving into RF_KILL state does this also. Driver must set up
  275. * new station table before transmitting anything on the RXON channel
  276. * (except active scans or active measurements; those commands carry
  277. * their own txpower/rate setup data).
  278. *
  279. * When getting started on a new channel, driver must set up the
  280. * IWL_BROADCAST_ID entry (last entry in the table). For a client
  281. * station in a BSS, once an AP is selected, driver sets up the AP STA
  282. * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
  283. * are all that are needed for a BSS client station. If the device is
  284. * used as AP, or in an IBSS network, driver must set up station table
  285. * entries for all STAs in network, starting with index IWL_STA_ID.
  286. */
  287. struct iwl3945_addsta_cmd {
  288. u8 mode; /* 1: modify existing, 0: add new station */
  289. u8 reserved[3];
  290. struct sta_id_modify sta;
  291. struct iwl4965_keyinfo key;
  292. __le32 station_flags; /* STA_FLG_* */
  293. __le32 station_flags_msk; /* STA_FLG_* */
  294. /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
  295. * corresponding to bit (e.g. bit 5 controls TID 5).
  296. * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
  297. __le16 tid_disable_tx;
  298. __le16 rate_n_flags;
  299. /* TID for which to add block-ack support.
  300. * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
  301. u8 add_immediate_ba_tid;
  302. /* TID for which to remove block-ack support.
  303. * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
  304. u8 remove_immediate_ba_tid;
  305. /* Starting Sequence Number for added block-ack support.
  306. * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
  307. __le16 add_immediate_ba_ssn;
  308. } __attribute__ ((packed));
  309. /******************************************************************************
  310. * (4)
  311. * Rx Responses:
  312. *
  313. *****************************************************************************/
  314. struct iwl3945_rx_frame_stats {
  315. u8 phy_count;
  316. u8 id;
  317. u8 rssi;
  318. u8 agc;
  319. __le16 sig_avg;
  320. __le16 noise_diff;
  321. u8 payload[0];
  322. } __attribute__ ((packed));
  323. struct iwl3945_rx_frame_hdr {
  324. __le16 channel;
  325. __le16 phy_flags;
  326. u8 reserved1;
  327. u8 rate;
  328. __le16 len;
  329. u8 payload[0];
  330. } __attribute__ ((packed));
  331. struct iwl3945_rx_frame_end {
  332. __le32 status;
  333. __le64 timestamp;
  334. __le32 beacon_timestamp;
  335. } __attribute__ ((packed));
  336. /*
  337. * REPLY_3945_RX = 0x1b (response only, not a command)
  338. *
  339. * NOTE: DO NOT dereference from casts to this structure
  340. * It is provided only for calculating minimum data set size.
  341. * The actual offsets of the hdr and end are dynamic based on
  342. * stats.phy_count
  343. */
  344. struct iwl3945_rx_frame {
  345. struct iwl3945_rx_frame_stats stats;
  346. struct iwl3945_rx_frame_hdr hdr;
  347. struct iwl3945_rx_frame_end end;
  348. } __attribute__ ((packed));
  349. /******************************************************************************
  350. * (5)
  351. * Tx Commands & Responses:
  352. *
  353. * Driver must place each REPLY_TX command into one of the prioritized Tx
  354. * queues in host DRAM, shared between driver and device. When the device's
  355. * Tx scheduler and uCode are preparing to transmit, the device pulls the
  356. * Tx command over the PCI bus via one of the device's Tx DMA channels,
  357. * to fill an internal FIFO from which data will be transmitted.
  358. *
  359. * uCode handles all timing and protocol related to control frames
  360. * (RTS/CTS/ACK), based on flags in the Tx command.
  361. *
  362. * uCode handles retrying Tx when an ACK is expected but not received.
  363. * This includes trying lower data rates than the one requested in the Tx
  364. * command, as set up by the REPLY_RATE_SCALE (for 3945) or
  365. * REPLY_TX_LINK_QUALITY_CMD (4965).
  366. *
  367. * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
  368. * This command must be executed after every RXON command, before Tx can occur.
  369. *****************************************************************************/
  370. /*
  371. * REPLY_TX = 0x1c (command)
  372. */
  373. struct iwl3945_tx_cmd {
  374. /*
  375. * MPDU byte count:
  376. * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
  377. * + 8 byte IV for CCM or TKIP (not used for WEP)
  378. * + Data payload
  379. * + 8-byte MIC (not used for CCM/WEP)
  380. * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
  381. * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
  382. * Range: 14-2342 bytes.
  383. */
  384. __le16 len;
  385. /*
  386. * MPDU or MSDU byte count for next frame.
  387. * Used for fragmentation and bursting, but not 11n aggregation.
  388. * Same as "len", but for next frame. Set to 0 if not applicable.
  389. */
  390. __le16 next_frame_len;
  391. __le32 tx_flags; /* TX_CMD_FLG_* */
  392. u8 rate;
  393. /* Index of recipient station in uCode's station table */
  394. u8 sta_id;
  395. u8 tid_tspec;
  396. u8 sec_ctl;
  397. u8 key[16];
  398. union {
  399. u8 byte[8];
  400. __le16 word[4];
  401. __le32 dw[2];
  402. } tkip_mic;
  403. __le32 next_frame_info;
  404. union {
  405. __le32 life_time;
  406. __le32 attempt;
  407. } stop_time;
  408. u8 supp_rates[2];
  409. u8 rts_retry_limit; /*byte 50 */
  410. u8 data_retry_limit; /*byte 51 */
  411. union {
  412. __le16 pm_frame_timeout;
  413. __le16 attempt_duration;
  414. } timeout;
  415. /*
  416. * Duration of EDCA burst Tx Opportunity, in 32-usec units.
  417. * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
  418. */
  419. __le16 driver_txop;
  420. /*
  421. * MAC header goes here, followed by 2 bytes padding if MAC header
  422. * length is 26 or 30 bytes, followed by payload data
  423. */
  424. u8 payload[0];
  425. struct ieee80211_hdr hdr[0];
  426. } __attribute__ ((packed));
  427. /*
  428. * REPLY_TX = 0x1c (response)
  429. */
  430. struct iwl3945_tx_resp {
  431. u8 failure_rts;
  432. u8 failure_frame;
  433. u8 bt_kill_count;
  434. u8 rate;
  435. __le32 wireless_media_time;
  436. __le32 status; /* TX status */
  437. } __attribute__ ((packed));
  438. /*
  439. * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
  440. */
  441. struct iwl3945_txpowertable_cmd {
  442. u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
  443. u8 reserved;
  444. __le16 channel;
  445. struct iwl3945_power_per_rate power[IWL_MAX_RATES];
  446. } __attribute__ ((packed));
  447. struct iwl3945_rate_scaling_info {
  448. __le16 rate_n_flags;
  449. u8 try_cnt;
  450. u8 next_rate_index;
  451. } __attribute__ ((packed));
  452. /**
  453. * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
  454. *
  455. * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
  456. *
  457. * NOTE: The table of rates passed to the uCode via the
  458. * RATE_SCALE command sets up the corresponding order of
  459. * rates used for all related commands, including rate
  460. * masks, etc.
  461. *
  462. * For example, if you set 9MB (PLCP 0x0f) as the first
  463. * rate in the rate table, the bit mask for that rate
  464. * when passed through ofdm_basic_rates on the REPLY_RXON
  465. * command would be bit 0 (1 << 0)
  466. */
  467. struct iwl3945_rate_scaling_cmd {
  468. u8 table_id;
  469. u8 reserved[3];
  470. struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
  471. } __attribute__ ((packed));
  472. /******************************************************************************
  473. * (8)
  474. * Scan Commands, Responses, Notifications:
  475. *
  476. *****************************************************************************/
  477. /**
  478. * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
  479. *
  480. * One for each channel in the scan list.
  481. * Each channel can independently select:
  482. * 1) SSID for directed active scans
  483. * 2) Txpower setting (for rate specified within Tx command)
  484. * 3) How long to stay on-channel (behavior may be modified by quiet_time,
  485. * quiet_plcp_th, good_CRC_th)
  486. *
  487. * To avoid uCode errors, make sure the following are true (see comments
  488. * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
  489. * 1) If using passive_dwell (i.e. passive_dwell != 0):
  490. * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
  491. * 2) quiet_time <= active_dwell
  492. * 3) If restricting off-channel time (i.e. max_out_time !=0):
  493. * passive_dwell < max_out_time
  494. * active_dwell < max_out_time
  495. */
  496. struct iwl3945_scan_channel {
  497. /*
  498. * type is defined as:
  499. * 0:0 1 = active, 0 = passive
  500. * 1:4 SSID direct bit map; if a bit is set, then corresponding
  501. * SSID IE is transmitted in probe request.
  502. * 5:7 reserved
  503. */
  504. u8 type;
  505. u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
  506. struct iwl3945_tx_power tpc;
  507. __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
  508. __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
  509. } __attribute__ ((packed));
  510. /*
  511. * REPLY_SCAN_CMD = 0x80 (command)
  512. *
  513. * The hardware scan command is very powerful; the driver can set it up to
  514. * maintain (relatively) normal network traffic while doing a scan in the
  515. * background. The max_out_time and suspend_time control the ratio of how
  516. * long the device stays on an associated network channel ("service channel")
  517. * vs. how long it's away from the service channel, tuned to other channels
  518. * for scanning.
  519. *
  520. * max_out_time is the max time off-channel (in usec), and suspend_time
  521. * is how long (in "extended beacon" format) that the scan is "suspended"
  522. * after returning to the service channel. That is, suspend_time is the
  523. * time that we stay on the service channel, doing normal work, between
  524. * scan segments. The driver may set these parameters differently to support
  525. * scanning when associated vs. not associated, and light vs. heavy traffic
  526. * loads when associated.
  527. *
  528. * After receiving this command, the device's scan engine does the following;
  529. *
  530. * 1) Sends SCAN_START notification to driver
  531. * 2) Checks to see if it has time to do scan for one channel
  532. * 3) Sends NULL packet, with power-save (PS) bit set to 1,
  533. * to tell AP that we're going off-channel
  534. * 4) Tunes to first channel in scan list, does active or passive scan
  535. * 5) Sends SCAN_RESULT notification to driver
  536. * 6) Checks to see if it has time to do scan on *next* channel in list
  537. * 7) Repeats 4-6 until it no longer has time to scan the next channel
  538. * before max_out_time expires
  539. * 8) Returns to service channel
  540. * 9) Sends NULL packet with PS=0 to tell AP that we're back
  541. * 10) Stays on service channel until suspend_time expires
  542. * 11) Repeats entire process 2-10 until list is complete
  543. * 12) Sends SCAN_COMPLETE notification
  544. *
  545. * For fast, efficient scans, the scan command also has support for staying on
  546. * a channel for just a short time, if doing active scanning and getting no
  547. * responses to the transmitted probe request. This time is controlled by
  548. * quiet_time, and the number of received packets below which a channel is
  549. * considered "quiet" is controlled by quiet_plcp_threshold.
  550. *
  551. * For active scanning on channels that have regulatory restrictions against
  552. * blindly transmitting, the scan can listen before transmitting, to make sure
  553. * that there is already legitimate activity on the channel. If enough
  554. * packets are cleanly received on the channel (controlled by good_CRC_th,
  555. * typical value 1), the scan engine starts transmitting probe requests.
  556. *
  557. * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
  558. *
  559. * To avoid uCode errors, see timing restrictions described under
  560. * struct iwl3945_scan_channel.
  561. */
  562. struct iwl3945_scan_cmd {
  563. __le16 len;
  564. u8 reserved0;
  565. u8 channel_count; /* # channels in channel list */
  566. __le16 quiet_time; /* dwell only this # millisecs on quiet channel
  567. * (only for active scan) */
  568. __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
  569. __le16 good_CRC_th; /* passive -> active promotion threshold */
  570. __le16 reserved1;
  571. __le32 max_out_time; /* max usec to be away from associated (service)
  572. * channel */
  573. __le32 suspend_time; /* pause scan this long (in "extended beacon
  574. * format") when returning to service channel:
  575. * 3945; 31:24 # beacons, 19:0 additional usec,
  576. * 4965; 31:22 # beacons, 21:0 additional usec.
  577. */
  578. __le32 flags; /* RXON_FLG_* */
  579. __le32 filter_flags; /* RXON_FILTER_* */
  580. /* For active scans (set to all-0s for passive scans).
  581. * Does not include payload. Must specify Tx rate; no rate scaling. */
  582. struct iwl3945_tx_cmd tx_cmd;
  583. /* For directed active scans (set to all-0s otherwise) */
  584. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_API1];
  585. /*
  586. * Probe request frame, followed by channel list.
  587. *
  588. * Size of probe request frame is specified by byte count in tx_cmd.
  589. * Channel list follows immediately after probe request frame.
  590. * Number of channels in list is specified by channel_count.
  591. * Each channel in list is of type:
  592. *
  593. * struct iwl3945_scan_channel channels[0];
  594. *
  595. * NOTE: Only one band of channels can be scanned per pass. You
  596. * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
  597. * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
  598. * before requesting another scan.
  599. */
  600. u8 data[0];
  601. } __attribute__ ((packed));
  602. /******************************************************************************
  603. * (9)
  604. * IBSS/AP Commands and Notifications:
  605. *
  606. *****************************************************************************/
  607. /*
  608. * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  609. */
  610. struct iwl3945_beacon_notif {
  611. struct iwl3945_tx_resp beacon_notify_hdr;
  612. __le32 low_tsf;
  613. __le32 high_tsf;
  614. __le32 ibss_mgr_status;
  615. } __attribute__ ((packed));
  616. /*
  617. * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  618. */
  619. struct iwl3945_tx_beacon_cmd {
  620. struct iwl3945_tx_cmd tx;
  621. __le16 tim_idx;
  622. u8 tim_size;
  623. u8 reserved1;
  624. struct ieee80211_hdr frame[0]; /* beacon frame */
  625. } __attribute__ ((packed));
  626. /******************************************************************************
  627. * (10)
  628. * Statistics Commands and Notifications:
  629. *
  630. *****************************************************************************/
  631. struct iwl39_statistics_rx_phy {
  632. __le32 ina_cnt;
  633. __le32 fina_cnt;
  634. __le32 plcp_err;
  635. __le32 crc32_err;
  636. __le32 overrun_err;
  637. __le32 early_overrun_err;
  638. __le32 crc32_good;
  639. __le32 false_alarm_cnt;
  640. __le32 fina_sync_err_cnt;
  641. __le32 sfd_timeout;
  642. __le32 fina_timeout;
  643. __le32 unresponded_rts;
  644. __le32 rxe_frame_limit_overrun;
  645. __le32 sent_ack_cnt;
  646. __le32 sent_cts_cnt;
  647. } __attribute__ ((packed));
  648. struct iwl39_statistics_rx_non_phy {
  649. __le32 bogus_cts; /* CTS received when not expecting CTS */
  650. __le32 bogus_ack; /* ACK received when not expecting ACK */
  651. __le32 non_bssid_frames; /* number of frames with BSSID that
  652. * doesn't belong to the STA BSSID */
  653. __le32 filtered_frames; /* count frames that were dumped in the
  654. * filtering process */
  655. __le32 non_channel_beacons; /* beacons with our bss id but not on
  656. * our serving channel */
  657. } __attribute__ ((packed));
  658. struct iwl39_statistics_rx {
  659. struct iwl39_statistics_rx_phy ofdm;
  660. struct iwl39_statistics_rx_phy cck;
  661. struct iwl39_statistics_rx_non_phy general;
  662. } __attribute__ ((packed));
  663. struct iwl39_statistics_tx {
  664. __le32 preamble_cnt;
  665. __le32 rx_detected_cnt;
  666. __le32 bt_prio_defer_cnt;
  667. __le32 bt_prio_kill_cnt;
  668. __le32 few_bytes_cnt;
  669. __le32 cts_timeout;
  670. __le32 ack_timeout;
  671. __le32 expected_ack_cnt;
  672. __le32 actual_ack_cnt;
  673. } __attribute__ ((packed));
  674. struct iwl39_statistics_div {
  675. __le32 tx_on_a;
  676. __le32 tx_on_b;
  677. __le32 exec_time;
  678. __le32 probe_time;
  679. } __attribute__ ((packed));
  680. struct iwl39_statistics_general {
  681. __le32 temperature;
  682. struct statistics_dbg dbg;
  683. __le32 sleep_time;
  684. __le32 slots_out;
  685. __le32 slots_idle;
  686. __le32 ttl_timestamp;
  687. struct iwl39_statistics_div div;
  688. } __attribute__ ((packed));
  689. /*
  690. * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
  691. *
  692. * By default, uCode issues this notification after receiving a beacon
  693. * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
  694. * REPLY_STATISTICS_CMD 0x9c, above.
  695. *
  696. * Statistics counters continue to increment beacon after beacon, but are
  697. * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
  698. * 0x9c with CLEAR_STATS bit set (see above).
  699. *
  700. * uCode also issues this notification during scans. uCode clears statistics
  701. * appropriately so that each notification contains statistics for only the
  702. * one channel that has just been scanned.
  703. */
  704. struct iwl3945_notif_statistics {
  705. __le32 flag;
  706. struct statistics_rx rx;
  707. struct statistics_tx tx;
  708. struct statistics_general general;
  709. } __attribute__ ((packed));
  710. /******************************************************************************
  711. * (13)
  712. * Union of all expected notifications/responses:
  713. *
  714. *****************************************************************************/
  715. struct iwl3945_rx_packet {
  716. __le32 len;
  717. struct iwl_cmd_header hdr;
  718. union {
  719. struct iwl3945_alive_resp alive_frame;
  720. struct iwl3945_rx_frame rx_frame;
  721. struct iwl3945_tx_resp tx_resp;
  722. struct iwl_spectrum_notification spectrum_notif;
  723. struct iwl_csa_notification csa_notif;
  724. struct iwl3945_error_resp err_resp;
  725. struct iwl_card_state_notif card_state_notif;
  726. struct iwl3945_beacon_notif beacon_status;
  727. struct iwl_add_sta_resp add_sta;
  728. struct iwl_sleep_notification sleep_notif;
  729. struct iwl_spectrum_resp spectrum;
  730. struct iwl3945_notif_statistics stats;
  731. __le32 status;
  732. u8 raw[0];
  733. } u;
  734. } __attribute__ ((packed));
  735. #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
  736. #endif /* __iwl3945_3945_commands_h__ */