aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.h166
1 files changed, 85 insertions, 81 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index cb484e273b93..3780a03f2716 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -82,20 +82,26 @@ void iwl_cancel_deferred_work(struct iwl_priv *priv);
82void iwlagn_prepare_restart(struct iwl_priv *priv); 82void iwlagn_prepare_restart(struct iwl_priv *priv);
83void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb); 83void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb);
84int __must_check iwl_rx_dispatch(struct iwl_op_mode *op_mode, 84int __must_check iwl_rx_dispatch(struct iwl_op_mode *op_mode,
85 struct iwl_rx_mem_buffer *rxb, 85 struct iwl_rx_cmd_buffer *rxb,
86 struct iwl_device_cmd *cmd); 86 struct iwl_device_cmd *cmd);
87void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, u8 ac);
88void iwl_wake_sw_queue(struct iwl_op_mode *op_mode, u8 ac);
89void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state); 87void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state);
90void iwl_stop_sw_queue(struct iwl_op_mode *op_mode, u8 ac);
91void iwl_nic_error(struct iwl_op_mode *op_mode); 88void iwl_nic_error(struct iwl_op_mode *op_mode);
92 89
90bool iwl_check_for_ct_kill(struct iwl_priv *priv);
91
92void iwlagn_lift_passive_no_rx(struct iwl_priv *priv);
93
93/* MAC80211 */ 94/* MAC80211 */
94struct ieee80211_hw *iwl_alloc_all(void); 95struct ieee80211_hw *iwl_alloc_all(void);
95int iwlagn_mac_setup_register(struct iwl_priv *priv, 96int iwlagn_mac_setup_register(struct iwl_priv *priv,
96 struct iwl_ucode_capabilities *capa); 97 const struct iwl_ucode_capabilities *capa);
97void iwlagn_mac_unregister(struct iwl_priv *priv); 98void iwlagn_mac_unregister(struct iwl_priv *priv);
98 99
100/* commands */
101int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
102int iwl_dvm_send_cmd_pdu(struct iwl_priv *priv, u8 id,
103 u32 flags, u16 len, const void *data);
104
99/* RXON */ 105/* RXON */
100int iwlagn_set_pan_params(struct iwl_priv *priv); 106int iwlagn_set_pan_params(struct iwl_priv *priv);
101int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx); 107int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
@@ -110,9 +116,18 @@ void iwlagn_config_ht40(struct ieee80211_conf *conf,
110 116
111/* uCode */ 117/* uCode */
112int iwlagn_rx_calib_result(struct iwl_priv *priv, 118int iwlagn_rx_calib_result(struct iwl_priv *priv,
113 struct iwl_rx_mem_buffer *rxb, 119 struct iwl_rx_cmd_buffer *rxb,
114 struct iwl_device_cmd *cmd); 120 struct iwl_device_cmd *cmd);
115void iwl_init_context(struct iwl_priv *priv, u32 ucode_flags); 121int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type);
122void iwl_send_prio_tbl(struct iwl_priv *priv);
123int iwl_init_alive_start(struct iwl_priv *priv);
124int iwl_run_init_ucode(struct iwl_priv *priv);
125int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
126 enum iwl_ucode_type ucode_type);
127int iwl_send_calib_results(struct iwl_priv *priv);
128int iwl_calib_set(struct iwl_priv *priv,
129 const struct iwl_calib_hdr *cmd, int len);
130void iwl_calib_free_results(struct iwl_priv *priv);
116 131
117/* lib */ 132/* lib */
118int iwlagn_send_tx_power(struct iwl_priv *priv); 133int iwlagn_send_tx_power(struct iwl_priv *priv);
@@ -124,8 +139,7 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
124#ifdef CONFIG_PM_SLEEP 139#ifdef CONFIG_PM_SLEEP
125int iwlagn_send_patterns(struct iwl_priv *priv, 140int iwlagn_send_patterns(struct iwl_priv *priv,
126 struct cfg80211_wowlan *wowlan); 141 struct cfg80211_wowlan *wowlan);
127int iwlagn_suspend(struct iwl_priv *priv, 142int iwlagn_suspend(struct iwl_priv *priv, struct cfg80211_wowlan *wowlan);
128 struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
129#endif 143#endif
130 144
131/* rx */ 145/* rx */
@@ -142,9 +156,9 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif,
142int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif, 156int iwlagn_tx_agg_stop(struct iwl_priv *priv, struct ieee80211_vif *vif,
143 struct ieee80211_sta *sta, u16 tid); 157 struct ieee80211_sta *sta, u16 tid);
144int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv, 158int iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
145 struct iwl_rx_mem_buffer *rxb, 159 struct iwl_rx_cmd_buffer *rxb,
146 struct iwl_device_cmd *cmd); 160 struct iwl_device_cmd *cmd);
147int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, 161int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
148 struct iwl_device_cmd *cmd); 162 struct iwl_device_cmd *cmd);
149 163
150static inline u32 iwl_tx_status_to_mac80211(u32 status) 164static inline u32 iwl_tx_status_to_mac80211(u32 status)
@@ -179,7 +193,7 @@ void iwlagn_disable_roc(struct iwl_priv *priv);
179/* bt coex */ 193/* bt coex */
180void iwlagn_send_advance_bt_config(struct iwl_priv *priv); 194void iwlagn_send_advance_bt_config(struct iwl_priv *priv);
181int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv, 195int iwlagn_bt_coex_profile_notif(struct iwl_priv *priv,
182 struct iwl_rx_mem_buffer *rxb, 196 struct iwl_rx_cmd_buffer *rxb,
183 struct iwl_device_cmd *cmd); 197 struct iwl_device_cmd *cmd);
184void iwlagn_bt_rx_handler_setup(struct iwl_priv *priv); 198void iwlagn_bt_rx_handler_setup(struct iwl_priv *priv);
185void iwlagn_bt_setup_deferred_work(struct iwl_priv *priv); 199void iwlagn_bt_setup_deferred_work(struct iwl_priv *priv);
@@ -220,6 +234,8 @@ int iwl_add_station_common(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
220 struct ieee80211_sta *sta, u8 *sta_id_r); 234 struct ieee80211_sta *sta, u8 *sta_id_r);
221int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id, 235int iwl_remove_station(struct iwl_priv *priv, const u8 sta_id,
222 const u8 *addr); 236 const u8 *addr);
237void iwl_deactivate_station(struct iwl_priv *priv, const u8 sta_id,
238 const u8 *addr);
223u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 239u8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
224 const u8 *addr, bool is_ap, struct ieee80211_sta *sta); 240 const u8 *addr, bool is_ap, struct ieee80211_sta *sta);
225 241
@@ -227,46 +243,12 @@ void iwl_sta_fill_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
227 u8 sta_id, struct iwl_link_quality_cmd *link_cmd); 243 u8 sta_id, struct iwl_link_quality_cmd *link_cmd);
228int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 244int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
229 struct iwl_link_quality_cmd *lq, u8 flags, bool init); 245 struct iwl_link_quality_cmd *lq, u8 flags, bool init);
230void iwl_reprogram_ap_sta(struct iwl_priv *priv, struct iwl_rxon_context *ctx); 246int iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
231int iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb,
232 struct iwl_device_cmd *cmd); 247 struct iwl_device_cmd *cmd);
248int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
249 struct ieee80211_sta *sta);
233 250
234 251
235/**
236 * iwl_clear_driver_stations - clear knowledge of all stations from driver
237 * @priv: iwl priv struct
238 *
239 * This is called during iwl_down() to make sure that in the case
240 * we're coming there from a hardware restart mac80211 will be
241 * able to reconfigure stations -- if we're getting there in the
242 * normal down flow then the stations will already be cleared.
243 */
244static inline void iwl_clear_driver_stations(struct iwl_priv *priv)
245{
246 unsigned long flags;
247 struct iwl_rxon_context *ctx;
248
249 spin_lock_irqsave(&priv->shrd->sta_lock, flags);
250 memset(priv->stations, 0, sizeof(priv->stations));
251 priv->num_stations = 0;
252
253 priv->ucode_key_table = 0;
254
255 for_each_context(priv, ctx) {
256 /*
257 * Remove all key information that is not stored as part
258 * of station information since mac80211 may not have had
259 * a chance to remove all the keys. When device is
260 * reconfigured by mac80211 after an error all keys will
261 * be reconfigured.
262 */
263 memset(ctx->wep_keys, 0, sizeof(ctx->wep_keys));
264 ctx->key_mapping_keys = 0;
265 }
266
267 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
268}
269
270static inline int iwl_sta_id(struct ieee80211_sta *sta) 252static inline int iwl_sta_id(struct ieee80211_sta *sta)
271{ 253{
272 if (WARN_ON(!sta)) 254 if (WARN_ON(!sta))
@@ -275,37 +257,6 @@ static inline int iwl_sta_id(struct ieee80211_sta *sta)
275 return ((struct iwl_station_priv *)sta->drv_priv)->sta_id; 257 return ((struct iwl_station_priv *)sta->drv_priv)->sta_id;
276} 258}
277 259
278/**
279 * iwl_sta_id_or_broadcast - return sta_id or broadcast sta
280 * @priv: iwl priv
281 * @context: the current context
282 * @sta: mac80211 station
283 *
284 * In certain circumstances mac80211 passes a station pointer
285 * that may be %NULL, for example during TX or key setup. In
286 * that case, we need to use the broadcast station, so this
287 * inline wraps that pattern.
288 */
289static inline int iwl_sta_id_or_broadcast(struct iwl_priv *priv,
290 struct iwl_rxon_context *context,
291 struct ieee80211_sta *sta)
292{
293 int sta_id;
294
295 if (!sta)
296 return context->bcast_sta_id;
297
298 sta_id = iwl_sta_id(sta);
299
300 /*
301 * mac80211 should not be passing a partially
302 * initialised station!
303 */
304 WARN_ON(sta_id == IWL_INVALID_STATION);
305
306 return sta_id;
307}
308
309int iwlagn_alloc_bcast_station(struct iwl_priv *priv, 260int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
310 struct iwl_rxon_context *ctx); 261 struct iwl_rxon_context *ctx);
311int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, 262int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
@@ -355,7 +306,6 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags)
355} 306}
356 307
357/* eeprom */ 308/* eeprom */
358void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv);
359void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac); 309void iwl_eeprom_get_mac(const struct iwl_shared *shrd, u8 *mac);
360 310
361extern int iwl_alive_start(struct iwl_priv *priv); 311extern int iwl_alive_start(struct iwl_priv *priv);
@@ -402,4 +352,58 @@ static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,
402} 352}
403#endif 353#endif
404 354
355/* status checks */
356
357static inline int iwl_is_ready(struct iwl_priv *priv)
358{
359 /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
360 * set but EXIT_PENDING is not */
361 return test_bit(STATUS_READY, &priv->status) &&
362 test_bit(STATUS_GEO_CONFIGURED, &priv->status) &&
363 !test_bit(STATUS_EXIT_PENDING, &priv->status);
364}
365
366static inline int iwl_is_alive(struct iwl_priv *priv)
367{
368 return test_bit(STATUS_ALIVE, &priv->status);
369}
370
371static inline int iwl_is_rfkill(struct iwl_priv *priv)
372{
373 return test_bit(STATUS_RF_KILL_HW, &priv->status);
374}
375
376static inline int iwl_is_ctkill(struct iwl_priv *priv)
377{
378 return test_bit(STATUS_CT_KILL, &priv->status);
379}
380
381static inline int iwl_is_ready_rf(struct iwl_priv *priv)
382{
383 if (iwl_is_rfkill(priv))
384 return 0;
385
386 return iwl_is_ready(priv);
387}
388
389#ifdef CONFIG_IWLWIFI_DEBUG
390#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
391do { \
392 if (!iwl_is_rfkill((m))) \
393 IWL_ERR(m, fmt, ##args); \
394 else \
395 __iwl_err(trans(m)->dev, true, \
396 !iwl_have_debug_level(IWL_DL_RADIO), \
397 fmt, ##args); \
398} while (0)
399#else
400#define IWL_DEBUG_QUIET_RFKILL(m, fmt, args...) \
401do { \
402 if (!iwl_is_rfkill((m))) \
403 IWL_ERR(m, fmt, ##args); \
404 else \
405 __iwl_err(trans(m)->dev, true, true, fmt, ##args); \
406} while (0)
407#endif /* CONFIG_IWLWIFI_DEBUG */
408
405#endif /* __iwl_agn_h__ */ 409#endif /* __iwl_agn_h__ */