]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/net/wireless/iwlegacy/iwl-4965.h
iwlegacy: add accidentally removed comments
[mirror_ubuntu-bionic-kernel.git] / drivers / net / wireless / iwlegacy / iwl-4965.h
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) 2008 - 2011 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 - 2011 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 #ifndef __il_4965_h__
64 #define __il_4965_h__
65
66 #include "iwl-dev.h"
67
68 /* configuration for the _4965 devices */
69 extern struct il_cfg il4965_cfg;
70
71 extern struct il_mod_params il4965_mod_params;
72
73 extern struct ieee80211_ops il4965_hw_ops;
74
75 /* tx queue */
76 void il4965_free_tfds_in_queue(struct il_priv *il,
77 int sta_id, int tid, int freed);
78
79 /* RXON */
80 void il4965_set_rxon_chain(struct il_priv *il,
81 struct il_rxon_context *ctx);
82
83 /* uCode */
84 int il4965_verify_ucode(struct il_priv *il);
85
86 /* lib */
87 void il4965_check_abort_status(struct il_priv *il,
88 u8 frame_count, u32 status);
89
90 void il4965_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq);
91 int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq);
92 int il4965_hw_nic_init(struct il_priv *il);
93 int il4965_dump_fh(struct il_priv *il, char **buf, bool display);
94
95 /* rx */
96 void il4965_rx_queue_restock(struct il_priv *il);
97 void il4965_rx_replenish(struct il_priv *il);
98 void il4965_rx_replenish_now(struct il_priv *il);
99 void il4965_rx_queue_free(struct il_priv *il, struct il_rx_queue *rxq);
100 int il4965_rxq_stop(struct il_priv *il);
101 int il4965_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band);
102 void il4965_rx_reply_rx(struct il_priv *il,
103 struct il_rx_buf *rxb);
104 void il4965_rx_reply_rx_phy(struct il_priv *il,
105 struct il_rx_buf *rxb);
106 void il4965_rx_handle(struct il_priv *il);
107
108 /* tx */
109 void il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq);
110 int il4965_hw_txq_attach_buf_to_tfd(struct il_priv *il,
111 struct il_tx_queue *txq,
112 dma_addr_t addr, u16 len, u8 reset, u8 pad);
113 int il4965_hw_tx_queue_init(struct il_priv *il,
114 struct il_tx_queue *txq);
115 void il4965_hwrate_to_tx_control(struct il_priv *il, u32 rate_n_flags,
116 struct ieee80211_tx_info *info);
117 int il4965_tx_skb(struct il_priv *il, struct sk_buff *skb);
118 int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif,
119 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
120 int il4965_tx_agg_stop(struct il_priv *il, struct ieee80211_vif *vif,
121 struct ieee80211_sta *sta, u16 tid);
122 int il4965_txq_check_empty(struct il_priv *il,
123 int sta_id, u8 tid, int txq_id);
124 void il4965_rx_reply_compressed_ba(struct il_priv *il,
125 struct il_rx_buf *rxb);
126 int il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx);
127 void il4965_hw_txq_ctx_free(struct il_priv *il);
128 int il4965_txq_ctx_alloc(struct il_priv *il);
129 void il4965_txq_ctx_reset(struct il_priv *il);
130 void il4965_txq_ctx_stop(struct il_priv *il);
131 void il4965_txq_set_sched(struct il_priv *il, u32 mask);
132
133 /*
134 * Acquire il->lock before calling this function !
135 */
136 void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx);
137 /**
138 * il4965_tx_queue_set_status - (optionally) start Tx/Cmd queue
139 * @tx_fifo_id: Tx DMA/FIFO channel (range 0-7) that the queue will feed
140 * @scd_retry: (1) Indicates queue will be used in aggregation mode
141 *
142 * NOTE: Acquire il->lock before calling this function !
143 */
144 void il4965_tx_queue_set_status(struct il_priv *il,
145 struct il_tx_queue *txq,
146 int tx_fifo_id, int scd_retry);
147
148 static inline u32 il4965_tx_status_to_mac80211(u32 status)
149 {
150 status &= TX_STATUS_MSK;
151
152 switch (status) {
153 case TX_STATUS_SUCCESS:
154 case TX_STATUS_DIRECT_DONE:
155 return IEEE80211_TX_STAT_ACK;
156 case TX_STATUS_FAIL_DEST_PS:
157 return IEEE80211_TX_STAT_TX_FILTERED;
158 default:
159 return 0;
160 }
161 }
162
163 static inline bool il4965_is_tx_success(u32 status)
164 {
165 status &= TX_STATUS_MSK;
166 return (status == TX_STATUS_SUCCESS ||
167 status == TX_STATUS_DIRECT_DONE);
168 }
169
170 u8 il4965_toggle_tx_ant(struct il_priv *il, u8 ant_idx, u8 valid);
171
172 /* rx */
173 void il4965_rx_missed_beacon_notif(struct il_priv *il,
174 struct il_rx_buf *rxb);
175 bool il4965_good_plcp_health(struct il_priv *il,
176 struct il_rx_pkt *pkt);
177 void il4965_rx_stats(struct il_priv *il,
178 struct il_rx_buf *rxb);
179 void il4965_reply_stats(struct il_priv *il,
180 struct il_rx_buf *rxb);
181
182 /* scan */
183 int il4965_request_scan(struct il_priv *il, struct ieee80211_vif *vif);
184
185 /* station mgmt */
186 int il4965_manage_ibss_station(struct il_priv *il,
187 struct ieee80211_vif *vif, bool add);
188
189 /* hcmd */
190 int il4965_send_beacon_cmd(struct il_priv *il);
191
192 #ifdef CONFIG_IWLEGACY_DEBUG
193 const char *il4965_get_tx_fail_reason(u32 status);
194 #else
195 static inline const char *
196 il4965_get_tx_fail_reason(u32 status) { return ""; }
197 #endif
198
199 /* station management */
200 int il4965_alloc_bcast_station(struct il_priv *il,
201 struct il_rxon_context *ctx);
202 int il4965_add_bssid_station(struct il_priv *il,
203 struct il_rxon_context *ctx,
204 const u8 *addr, u8 *sta_id_r);
205 int il4965_remove_default_wep_key(struct il_priv *il,
206 struct il_rxon_context *ctx,
207 struct ieee80211_key_conf *key);
208 int il4965_set_default_wep_key(struct il_priv *il,
209 struct il_rxon_context *ctx,
210 struct ieee80211_key_conf *key);
211 int il4965_restore_default_wep_keys(struct il_priv *il,
212 struct il_rxon_context *ctx);
213 int il4965_set_dynamic_key(struct il_priv *il,
214 struct il_rxon_context *ctx,
215 struct ieee80211_key_conf *key, u8 sta_id);
216 int il4965_remove_dynamic_key(struct il_priv *il,
217 struct il_rxon_context *ctx,
218 struct ieee80211_key_conf *key, u8 sta_id);
219 void il4965_update_tkip_key(struct il_priv *il,
220 struct il_rxon_context *ctx,
221 struct ieee80211_key_conf *keyconf,
222 struct ieee80211_sta *sta, u32 iv32, u16 *phase1key);
223 int il4965_sta_tx_modify_enable_tid(struct il_priv *il,
224 int sta_id, int tid);
225 int il4965_sta_rx_agg_start(struct il_priv *il, struct ieee80211_sta *sta,
226 int tid, u16 ssn);
227 int il4965_sta_rx_agg_stop(struct il_priv *il, struct ieee80211_sta *sta,
228 int tid);
229 void il4965_sta_modify_sleep_tx_count(struct il_priv *il,
230 int sta_id, int cnt);
231 int il4965_update_bcast_stations(struct il_priv *il);
232
233 /* rate */
234 static inline u32 il4965_ant_idx_to_flags(u8 ant_idx)
235 {
236 return BIT(ant_idx) << RATE_MCS_ANT_POS;
237 }
238
239 static inline u8 il4965_hw_get_rate(__le32 rate_n_flags)
240 {
241 return le32_to_cpu(rate_n_flags) & 0xFF;
242 }
243
244 static inline __le32 il4965_hw_set_rate_n_flags(u8 rate, u32 flags)
245 {
246 return cpu_to_le32(flags|(u32)rate);
247 }
248
249 /* eeprom */
250 void il4965_eeprom_get_mac(const struct il_priv *il, u8 *mac);
251 int il4965_eeprom_acquire_semaphore(struct il_priv *il);
252 void il4965_eeprom_release_semaphore(struct il_priv *il);
253 int il4965_eeprom_check_version(struct il_priv *il);
254
255 /* mac80211 handlers (for 4965) */
256 void il4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
257 int il4965_mac_start(struct ieee80211_hw *hw);
258 void il4965_mac_stop(struct ieee80211_hw *hw);
259 void il4965_configure_filter(struct ieee80211_hw *hw,
260 unsigned int changed_flags,
261 unsigned int *total_flags,
262 u64 multicast);
263 int il4965_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
264 struct ieee80211_vif *vif, struct ieee80211_sta *sta,
265 struct ieee80211_key_conf *key);
266 void il4965_mac_update_tkip_key(struct ieee80211_hw *hw,
267 struct ieee80211_vif *vif,
268 struct ieee80211_key_conf *keyconf,
269 struct ieee80211_sta *sta,
270 u32 iv32, u16 *phase1key);
271 int il4965_mac_ampdu_action(struct ieee80211_hw *hw,
272 struct ieee80211_vif *vif,
273 enum ieee80211_ampdu_mlme_action action,
274 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
275 u8 buf_size);
276 int il4965_mac_sta_add(struct ieee80211_hw *hw,
277 struct ieee80211_vif *vif,
278 struct ieee80211_sta *sta);
279 void il4965_mac_channel_switch(struct ieee80211_hw *hw,
280 struct ieee80211_channel_switch *ch_switch);
281
282 void il4965_led_enable(struct il_priv *il);
283
284 #endif /* __il_4965_h__ */