iwl-priv.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2003 - 2007 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. * James P. Ketrenos <ipw2100-admin@linux.intel.com>
  23. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  24. *
  25. *****************************************************************************/
  26. #ifndef __iwl_priv_h__
  27. #define __iwl_priv_h__
  28. #include <linux/workqueue.h>
  29. #ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT
  30. enum {
  31. MEASUREMENT_READY = (1 << 0),
  32. MEASUREMENT_ACTIVE = (1 << 1),
  33. };
  34. #endif
  35. struct iwl_priv {
  36. /* ieee device used by generic ieee processing code */
  37. struct ieee80211_hw *hw;
  38. struct ieee80211_channel *ieee_channels;
  39. struct ieee80211_rate *ieee_rates;
  40. /* temporary frame storage list */
  41. struct list_head free_frames;
  42. int frames_count;
  43. u8 phymode;
  44. int alloc_rxb_skb;
  45. void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
  46. struct iwl_rx_mem_buffer *rxb);
  47. const struct ieee80211_hw_mode *modes;
  48. #ifdef CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT
  49. /* spectrum measurement report caching */
  50. struct iwl_spectrum_notification measure_report;
  51. u8 measurement_status;
  52. #endif
  53. /* ucode beacon time */
  54. u32 ucode_beacon_time;
  55. /* we allocate array of iwl_channel_info for NIC's valid channels.
  56. * Access via channel # using indirect index array */
  57. struct iwl_channel_info *channel_info; /* channel info array */
  58. u8 channel_count; /* # of channels */
  59. /* each calibration channel group in the EEPROM has a derived
  60. * clip setting for each rate. */
  61. const struct iwl_clip_group clip_groups[5];
  62. /* thermal calibration */
  63. s32 temperature; /* degrees Kelvin */
  64. s32 last_temperature;
  65. /* Scan related variables */
  66. unsigned long last_scan_jiffies;
  67. unsigned long scan_start;
  68. unsigned long scan_pass_start;
  69. unsigned long scan_start_tsf;
  70. int scan_bands;
  71. int one_direct_scan;
  72. u8 direct_ssid_len;
  73. u8 direct_ssid[IW_ESSID_MAX_SIZE];
  74. struct iwl_scan_cmd *scan;
  75. u8 only_active_channel;
  76. /* spinlock */
  77. spinlock_t lock; /* protect general shared data */
  78. spinlock_t hcmd_lock; /* protect hcmd */
  79. struct mutex mutex;
  80. /* basic pci-network driver stuff */
  81. struct pci_dev *pci_dev;
  82. /* pci hardware address support */
  83. void __iomem *hw_base;
  84. /* uCode images, save to reload in case of failure */
  85. struct fw_image_desc ucode_code; /* runtime inst */
  86. struct fw_image_desc ucode_data; /* runtime data original */
  87. struct fw_image_desc ucode_data_backup; /* runtime data save/restore */
  88. struct fw_image_desc ucode_init; /* initialization inst */
  89. struct fw_image_desc ucode_init_data; /* initialization data */
  90. struct fw_image_desc ucode_boot; /* bootstrap inst */
  91. struct iwl_rxon_time_cmd rxon_timing;
  92. /* We declare this const so it can only be
  93. * changed via explicit cast within the
  94. * routines that actually update the physical
  95. * hardware */
  96. const struct iwl_rxon_cmd active_rxon;
  97. struct iwl_rxon_cmd staging_rxon;
  98. int error_recovering;
  99. struct iwl_rxon_cmd recovery_rxon;
  100. /* 1st responses from initialize and runtime uCode images.
  101. * 4965's initialize alive response contains some calibration data. */
  102. struct iwl_init_alive_resp card_alive_init;
  103. struct iwl_alive_resp card_alive;
  104. #ifdef LED
  105. /* LED related variables */
  106. struct iwl_activity_blink activity;
  107. unsigned long led_packets;
  108. int led_state;
  109. #endif
  110. u16 active_rate;
  111. u16 active_rate_basic;
  112. u8 call_post_assoc_from_beacon;
  113. u8 assoc_station_added;
  114. #if IWL == 4965
  115. u8 use_ant_b_for_management_frame; /* Tx antenna selection */
  116. /* HT variables */
  117. u8 is_dup;
  118. u8 is_ht_enabled;
  119. u8 channel_width; /* 0=20MHZ, 1=40MHZ */
  120. u8 current_channel_width;
  121. u8 valid_antenna; /* Bit mask of antennas actually connected */
  122. #ifdef CONFIG_IWLWIFI_SENSITIVITY
  123. struct iwl_sensitivity_data sensitivity_data;
  124. struct iwl_chain_noise_data chain_noise_data;
  125. u8 start_calib;
  126. __le16 sensitivity_tbl[HD_TABLE_SIZE];
  127. #endif /*CONFIG_IWLWIFI_SENSITIVITY*/
  128. #ifdef CONFIG_IWLWIFI_HT
  129. struct sta_ht_info current_assoc_ht;
  130. #endif
  131. u8 active_rate_ht[2];
  132. u8 last_phy_res[100];
  133. /* Rate scaling data */
  134. struct iwl_lq_mngr lq_mngr;
  135. #endif
  136. /* Rate scaling data */
  137. s8 data_retry_limit;
  138. u8 retry_rate;
  139. wait_queue_head_t wait_command_queue;
  140. int activity_timer_active;
  141. /* Rx and Tx DMA processing queues */
  142. struct iwl_rx_queue rxq;
  143. struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES];
  144. #if IWL == 4965
  145. unsigned long txq_ctx_active_msk;
  146. struct iwl_kw kw; /* keep warm address */
  147. u32 scd_base_addr; /* scheduler sram base address */
  148. #endif
  149. unsigned long status;
  150. u32 config;
  151. int last_rx_rssi; /* From Rx packet statisitics */
  152. int last_rx_noise; /* From beacon statistics */
  153. struct iwl_power_mgr power_data;
  154. struct iwl_notif_statistics statistics;
  155. unsigned long last_statistics_time;
  156. /* context information */
  157. u8 essid[IW_ESSID_MAX_SIZE];
  158. u8 essid_len;
  159. u16 rates_mask;
  160. u32 power_mode;
  161. u32 antenna;
  162. u8 bssid[ETH_ALEN];
  163. u16 rts_threshold;
  164. u8 mac_addr[ETH_ALEN];
  165. /*station table variables */
  166. spinlock_t sta_lock;
  167. int num_stations;
  168. struct iwl_station_entry stations[IWL_STATION_COUNT];
  169. /* Indication if ieee80211_ops->open has been called */
  170. int is_open;
  171. u8 mac80211_registered;
  172. int is_abg;
  173. u32 notif_missed_beacons;
  174. /* Rx'd packet timing information */
  175. u32 last_beacon_time;
  176. u64 last_tsf;
  177. /* Duplicate packet detection */
  178. u16 last_seq_num;
  179. u16 last_frag_num;
  180. unsigned long last_packet_time;
  181. struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE];
  182. /* eeprom */
  183. struct iwl_eeprom eeprom;
  184. int iw_mode;
  185. struct sk_buff *ibss_beacon;
  186. /* Last Rx'd beacon timestamp */
  187. u32 timestamp0;
  188. u32 timestamp1;
  189. u16 beacon_int;
  190. struct iwl_driver_hw_info hw_setting;
  191. int interface_id;
  192. /* Current association information needed to configure the
  193. * hardware */
  194. u16 assoc_id;
  195. u16 assoc_capability;
  196. u8 ps_mode;
  197. #ifdef CONFIG_IWLWIFI_QOS
  198. struct iwl_qos_info qos_data;
  199. #endif /*CONFIG_IWLWIFI_QOS */
  200. struct workqueue_struct *workqueue;
  201. struct work_struct up;
  202. struct work_struct restart;
  203. struct work_struct calibrated_work;
  204. struct work_struct scan_completed;
  205. struct work_struct rx_replenish;
  206. struct work_struct rf_kill;
  207. struct work_struct abort_scan;
  208. struct work_struct update_link_led;
  209. struct work_struct auth_work;
  210. struct work_struct report_work;
  211. struct work_struct request_scan;
  212. struct work_struct beacon_update;
  213. struct tasklet_struct irq_tasklet;
  214. struct delayed_work init_alive_start;
  215. struct delayed_work alive_start;
  216. struct delayed_work activity_timer;
  217. struct delayed_work thermal_periodic;
  218. struct delayed_work gather_stats;
  219. struct delayed_work scan_check;
  220. struct delayed_work post_associate;
  221. #define IWL_DEFAULT_TX_POWER 0x0F
  222. s8 user_txpower_limit;
  223. s8 max_channel_txpower_limit;
  224. u32 cck_power_index_compensation;
  225. #ifdef CONFIG_PM
  226. u32 pm_state[16];
  227. #endif
  228. #ifdef CONFIG_IWLWIFI_DEBUG
  229. /* debugging info */
  230. u32 framecnt_to_us;
  231. atomic_t restrict_refcnt;
  232. #endif
  233. #if IWL == 4965
  234. struct work_struct txpower_work;
  235. #ifdef CONFIG_IWLWIFI_SENSITIVITY
  236. struct work_struct sensitivity_work;
  237. #endif
  238. struct work_struct statistics_work;
  239. struct timer_list statistics_periodic;
  240. #ifdef CONFIG_IWLWIFI_HT_AGG
  241. struct work_struct agg_work;
  242. #endif
  243. #endif /* 4965 */
  244. }; /*iwl_priv */
  245. #endif /* __iwl_priv_h__ */