diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-shared.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-shared.h | 146 |
1 files changed, 100 insertions, 46 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h index d987bee5e6ce..8747bbdf8983 100644 --- a/drivers/net/wireless/iwlwifi/iwl-shared.h +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h | |||
@@ -72,8 +72,27 @@ | |||
72 | 72 | ||
73 | #include "iwl-commands.h" | 73 | #include "iwl-commands.h" |
74 | 74 | ||
75 | /*This files includes all the types / functions that are exported by the | 75 | /** |
76 | * upper layer to the bus and transport layer */ | 76 | * DOC: shared area - role and goal |
77 | * | ||
78 | * The shared area contains all the data exported by the upper layer to the | ||
79 | * other layers. Since the bus and transport layer shouldn't dereference | ||
80 | * iwl_priv, all the data needed by the upper layer and the transport / bus | ||
81 | * layer must be here. | ||
82 | * The shared area also holds pointer to all the other layers. This allows a | ||
83 | * layer to call a function from another layer. | ||
84 | * | ||
85 | * NOTE: All the layers hold a pointer to the shared area which must be shrd. | ||
86 | * A few macros assume that (_m)->shrd points to the shared area no matter | ||
87 | * what _m is. | ||
88 | * | ||
89 | * gets notifications about enumeration, suspend, resume. | ||
90 | * For the moment, the bus layer is not a linux kernel module as itself, and | ||
91 | * the module_init function of the driver must call the bus specific | ||
92 | * registration functions. These functions are listed at the end of this file. | ||
93 | * For the moment, there is only one implementation of this interface: PCI-e. | ||
94 | * This implementation is iwl-pci.c | ||
95 | */ | ||
77 | 96 | ||
78 | struct iwl_cfg; | 97 | struct iwl_cfg; |
79 | struct iwl_bus; | 98 | struct iwl_bus; |
@@ -90,6 +109,9 @@ extern struct iwl_mod_params iwlagn_mod_params; | |||
90 | 109 | ||
91 | /** | 110 | /** |
92 | * struct iwl_mod_params | 111 | * struct iwl_mod_params |
112 | * | ||
113 | * Holds the module parameters | ||
114 | * | ||
93 | * @sw_crypto: using hardware encryption, default = 0 | 115 | * @sw_crypto: using hardware encryption, default = 0 |
94 | * @num_of_queues: number of tx queue, HW dependent | 116 | * @num_of_queues: number of tx queue, HW dependent |
95 | * @disable_11n: 11n capabilities enabled, default = 0 | 117 | * @disable_11n: 11n capabilities enabled, default = 0 |
@@ -134,20 +156,24 @@ struct iwl_mod_params { | |||
134 | 156 | ||
135 | /** | 157 | /** |
136 | * struct iwl_hw_params | 158 | * struct iwl_hw_params |
159 | * | ||
160 | * Holds the module parameters | ||
161 | * | ||
137 | * @max_txq_num: Max # Tx queues supported | 162 | * @max_txq_num: Max # Tx queues supported |
138 | * @num_ampdu_queues: num of ampdu queues | 163 | * @num_ampdu_queues: num of ampdu queues |
139 | * @tx/rx_chains_num: Number of TX/RX chains | 164 | * @tx_chains_num: Number of TX chains |
140 | * @valid_tx/rx_ant: usable antennas | 165 | * @rx_chains_num: Number of RX chains |
141 | * @max_stations: | 166 | * @valid_tx_ant: usable antennas for TX |
142 | * @ht40_channel: is 40MHz width possible in band 2.4 | 167 | * @valid_rx_ant: usable antennas for RX |
143 | * @beacon_time_tsf_bits: number of valid tsf bits for beacon time | 168 | * @max_stations: the maximal number of stations |
144 | * @sku: | 169 | * @ht40_channel: is 40MHz width possible: BIT(IEEE80211_BAND_XXX) |
170 | * @sku: sku read from EEPROM | ||
145 | * @rx_page_order: Rx buffer page order | 171 | * @rx_page_order: Rx buffer page order |
146 | * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR | 172 | * @max_inst_size: for ucode use |
147 | * BIT(IEEE80211_BAND_5GHZ) BIT(IEEE80211_BAND_5GHZ) | 173 | * @max_data_size: for ucode use |
148 | * @sw_crypto: 0 for hw, 1 for sw | 174 | * @ct_kill_threshold: temperature threshold - in hw dependent unit |
149 | * @max_xxx_size: for ucode uses | 175 | * @ct_kill_exit_threshold: when to reeable the device - in hw dependent unit |
150 | * @ct_kill_threshold: temperature threshold | 176 | * relevant for 1000, 6000 and up |
151 | * @wd_timeout: TX queues watchdog timeout | 177 | * @wd_timeout: TX queues watchdog timeout |
152 | * @calib_init_cfg: setup initial calibrations for the hw | 178 | * @calib_init_cfg: setup initial calibrations for the hw |
153 | * @calib_rt_cfg: setup runtime calibrations for the hw | 179 | * @calib_rt_cfg: setup runtime calibrations for the hw |
@@ -163,14 +189,12 @@ struct iwl_hw_params { | |||
163 | u8 max_stations; | 189 | u8 max_stations; |
164 | u8 ht40_channel; | 190 | u8 ht40_channel; |
165 | bool shadow_reg_enable; | 191 | bool shadow_reg_enable; |
166 | u16 beacon_time_tsf_bits; | ||
167 | u16 sku; | 192 | u16 sku; |
168 | u32 rx_page_order; | 193 | u32 rx_page_order; |
169 | u32 max_inst_size; | 194 | u32 max_inst_size; |
170 | u32 max_data_size; | 195 | u32 max_data_size; |
171 | u32 ct_kill_threshold; /* value in hw-dependent units */ | 196 | u32 ct_kill_threshold; |
172 | u32 ct_kill_exit_threshold; /* value in hw-dependent units */ | 197 | u32 ct_kill_exit_threshold; |
173 | /* for 1000, 6000 series and up */ | ||
174 | unsigned int wd_timeout; | 198 | unsigned int wd_timeout; |
175 | 199 | ||
176 | u32 calib_init_cfg; | 200 | u32 calib_init_cfg; |
@@ -179,28 +203,59 @@ struct iwl_hw_params { | |||
179 | }; | 203 | }; |
180 | 204 | ||
181 | /** | 205 | /** |
182 | * struct iwl_ht_agg - aggregation status while waiting for block-ack | 206 | * enum iwl_agg_state |
183 | * @txq_id: Tx queue used for Tx attempt | ||
184 | * @wait_for_ba: Expect block-ack before next Tx reply | ||
185 | * @rate_n_flags: Rate at which Tx was attempted | ||
186 | * | 207 | * |
187 | * If REPLY_TX indicates that aggregation was attempted, driver must wait | 208 | * The state machine of the BA agreement establishment / tear down. |
188 | * for block ack (REPLY_COMPRESSED_BA). This struct stores tx reply info | 209 | * These states relate to a specific RA / TID. |
189 | * until block ack arrives. | 210 | * |
211 | * @IWL_AGG_OFF: aggregation is not used | ||
212 | * @IWL_AGG_ON: aggregation session is up | ||
213 | * @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the | ||
214 | * HW queue to be empty from packets for this RA /TID. | ||
215 | * @IWL_EMPTYING_HW_QUEUE_DELBA: tearing down a BA session - waiting for the | ||
216 | * HW queue to be empty from packets for this RA /TID. | ||
217 | */ | ||
218 | enum iwl_agg_state { | ||
219 | IWL_AGG_OFF = 0, | ||
220 | IWL_AGG_ON, | ||
221 | IWL_EMPTYING_HW_QUEUE_ADDBA, | ||
222 | IWL_EMPTYING_HW_QUEUE_DELBA, | ||
223 | }; | ||
224 | |||
225 | /** | ||
226 | * struct iwl_ht_agg - aggregation state machine | ||
227 | |||
228 | * This structs holds the states for the BA agreement establishment and tear | ||
229 | * down. It also holds the state during the BA session itself. This struct is | ||
230 | * duplicated for each RA / TID. | ||
231 | |||
232 | * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the | ||
233 | * Tx response (REPLY_TX), and the block ack notification | ||
234 | * (REPLY_COMPRESSED_BA). | ||
235 | * @state: state of the BA agreement establishment / tear down. | ||
236 | * @txq_id: Tx queue used by the BA session - used by the transport layer. | ||
237 | * Needed by the upper layer for debugfs only. | ||
238 | * @wait_for_ba: Expect block-ack before next Tx reply | ||
190 | */ | 239 | */ |
191 | struct iwl_ht_agg { | 240 | struct iwl_ht_agg { |
192 | u16 txq_id; | ||
193 | u16 wait_for_ba; | ||
194 | u32 rate_n_flags; | 241 | u32 rate_n_flags; |
195 | #define IWL_AGG_OFF 0 | 242 | enum iwl_agg_state state; |
196 | #define IWL_AGG_ON 1 | 243 | u16 txq_id; |
197 | #define IWL_EMPTYING_HW_QUEUE_ADDBA 2 | 244 | bool wait_for_ba; |
198 | #define IWL_EMPTYING_HW_QUEUE_DELBA 3 | ||
199 | u8 state; | ||
200 | }; | 245 | }; |
201 | 246 | ||
247 | /** | ||
248 | * struct iwl_tid_data - one for each RA / TID | ||
249 | |||
250 | * This structs holds the states for each RA / TID. | ||
251 | |||
252 | * @seq_number: the next WiFi sequence number to use | ||
253 | * @tfds_in_queue: number of packets sent to the HW queues. | ||
254 | * Exported for debugfs only | ||
255 | * @agg: aggregation state machine | ||
256 | */ | ||
202 | struct iwl_tid_data { | 257 | struct iwl_tid_data { |
203 | u16 seq_number; /* agn only */ | 258 | u16 seq_number; |
204 | u16 tfds_in_queue; | 259 | u16 tfds_in_queue; |
205 | struct iwl_ht_agg agg; | 260 | struct iwl_ht_agg agg; |
206 | }; | 261 | }; |
@@ -246,12 +301,6 @@ struct iwl_shared { | |||
246 | spinlock_t sta_lock; | 301 | spinlock_t sta_lock; |
247 | struct mutex mutex; | 302 | struct mutex mutex; |
248 | 303 | ||
249 | /*these 2 shouldn't really be here, but they are needed for | ||
250 | * iwl_queue_stop, which is called from the upper layer too | ||
251 | */ | ||
252 | u8 mac80211_registered; | ||
253 | struct ieee80211_hw *hw; | ||
254 | |||
255 | struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT]; | 304 | struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT]; |
256 | 305 | ||
257 | wait_queue_head_t wait_command_queue; | 306 | wait_queue_head_t wait_command_queue; |
@@ -371,16 +420,14 @@ enum iwl_rxon_context_id { | |||
371 | NUM_IWL_RXON_CTX | 420 | NUM_IWL_RXON_CTX |
372 | }; | 421 | }; |
373 | 422 | ||
374 | #ifdef CONFIG_PM | ||
375 | int iwl_suspend(struct iwl_priv *priv); | ||
376 | int iwl_resume(struct iwl_priv *priv); | ||
377 | #endif /* !CONFIG_PM */ | ||
378 | |||
379 | int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, | 423 | int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops, |
380 | struct iwl_cfg *cfg); | 424 | struct iwl_cfg *cfg); |
381 | void __devexit iwl_remove(struct iwl_priv * priv); | 425 | void __devexit iwl_remove(struct iwl_priv * priv); |
426 | struct iwl_device_cmd; | ||
427 | int __must_check iwl_rx_dispatch(struct iwl_priv *priv, | ||
428 | struct iwl_rx_mem_buffer *rxb, | ||
429 | struct iwl_device_cmd *cmd); | ||
382 | 430 | ||
383 | void iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); | ||
384 | int iwlagn_hw_valid_rtc_data_addr(u32 addr); | 431 | int iwlagn_hw_valid_rtc_data_addr(u32 addr); |
385 | void iwl_start_tx_ba_trans_ready(struct iwl_priv *priv, | 432 | void iwl_start_tx_ba_trans_ready(struct iwl_priv *priv, |
386 | enum iwl_rxon_context_id ctx, | 433 | enum iwl_rxon_context_id ctx, |
@@ -390,20 +437,26 @@ void iwl_stop_tx_ba_trans_ready(struct iwl_priv *priv, | |||
390 | u8 sta_id, u8 tid); | 437 | u8 sta_id, u8 tid); |
391 | void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state); | 438 | void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state); |
392 | void iwl_nic_config(struct iwl_priv *priv); | 439 | void iwl_nic_config(struct iwl_priv *priv); |
440 | void iwl_free_skb(struct iwl_priv *priv, struct sk_buff *skb); | ||
393 | void iwl_apm_stop(struct iwl_priv *priv); | 441 | void iwl_apm_stop(struct iwl_priv *priv); |
394 | int iwl_apm_init(struct iwl_priv *priv); | 442 | int iwl_apm_init(struct iwl_priv *priv); |
395 | void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand); | 443 | void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand); |
396 | const char *get_cmd_string(u8 cmd); | 444 | const char *get_cmd_string(u8 cmd); |
397 | bool iwl_check_for_ct_kill(struct iwl_priv *priv); | 445 | bool iwl_check_for_ct_kill(struct iwl_priv *priv); |
398 | 446 | ||
447 | void iwl_stop_sw_queue(struct iwl_priv *priv, u8 ac); | ||
448 | void iwl_wake_sw_queue(struct iwl_priv *priv, u8 ac); | ||
449 | |||
399 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 450 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
400 | void iwl_reset_traffic_log(struct iwl_priv *priv); | 451 | void iwl_reset_traffic_log(struct iwl_priv *priv); |
401 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ | 452 | #endif /* CONFIG_IWLWIFI_DEBUGFS */ |
402 | 453 | ||
403 | #ifdef CONFIG_IWLWIFI_DEBUG | 454 | #ifdef CONFIG_IWLWIFI_DEBUG |
404 | void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid); | 455 | void iwl_print_rx_config_cmd(struct iwl_priv *priv, |
456 | enum iwl_rxon_context_id ctxid); | ||
405 | #else | 457 | #else |
406 | static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid) | 458 | static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, |
459 | enum iwl_rxon_context_id ctxid) | ||
407 | { | 460 | { |
408 | } | 461 | } |
409 | #endif | 462 | #endif |
@@ -436,6 +489,7 @@ static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid) | |||
436 | #define STATUS_FW_ERROR 17 | 489 | #define STATUS_FW_ERROR 17 |
437 | #define STATUS_DEVICE_ENABLED 18 | 490 | #define STATUS_DEVICE_ENABLED 18 |
438 | #define STATUS_CHANNEL_SWITCH_PENDING 19 | 491 | #define STATUS_CHANNEL_SWITCH_PENDING 19 |
492 | #define STATUS_SCAN_COMPLETE 20 | ||
439 | 493 | ||
440 | static inline int iwl_is_ready(struct iwl_shared *shrd) | 494 | static inline int iwl_is_ready(struct iwl_shared *shrd) |
441 | { | 495 | { |