Commit | Line | Data |
---|---|---|
a0a954b1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
13a9930d WS |
2 | /* |
3 | * Driver for KeyStream IEEE802.11 b/g wireless LAN cards. | |
13a9930d WS |
4 | * |
5 | * Copyright (C) 2006-2008 KeyStream Corp. | |
6 | * Copyright (C) 2009 Renesas Technology Corp. | |
13a9930d WS |
7 | */ |
8 | ||
9 | #ifndef _KS_WLAN_H | |
10 | #define _KS_WLAN_H | |
11 | ||
e765861c | 12 | #include <linux/atomic.h> |
57c6f08d | 13 | #include <linux/circ_buf.h> |
e765861c SP |
14 | #include <linux/completion.h> |
15 | #include <linux/netdevice.h> | |
16 | #include <linux/sched.h> | |
17 | #include <linux/spinlock.h> | |
549f625c | 18 | #include <linux/wireless.h> |
13a9930d | 19 | |
13a9930d | 20 | struct ks_wlan_parameter { |
e765861c SP |
21 | u8 operation_mode; |
22 | u8 channel; | |
23 | u8 tx_rate; | |
13a9930d | 24 | struct { |
81710951 PV |
25 | u8 size; |
26 | u8 body[16]; | |
13a9930d | 27 | } rate_set; |
e765861c | 28 | u8 bssid[ETH_ALEN]; |
13a9930d | 29 | struct { |
81710951 PV |
30 | u8 size; |
31 | u8 body[32 + 1]; | |
e765861c SP |
32 | } ssid; |
33 | u8 preamble; | |
8fb8e05c | 34 | u8 power_mgmt; |
e765861c | 35 | u32 scan_type; |
13a9930d | 36 | #define BEACON_LOST_COUNT_MAX 65535 |
e765861c SP |
37 | u32 beacon_lost_count; |
38 | u32 rts; | |
39 | u32 fragment; | |
81710951 PV |
40 | u32 privacy_invoked; |
41 | u32 wep_index; | |
13a9930d | 42 | struct { |
81710951 PV |
43 | u8 size; |
44 | u8 val[13 * 2 + 1]; | |
13a9930d | 45 | } wep_key[4]; |
81710951 | 46 | u16 authenticate_type; |
e765861c SP |
47 | u16 phy_type; |
48 | u16 cts_mode; | |
49 | u16 phy_info_timer; | |
13a9930d WS |
50 | }; |
51 | ||
52 | enum { | |
53 | DEVICE_STATE_OFF = 0, /* this means hw_unavailable is != 0 */ | |
54 | DEVICE_STATE_PREBOOT, /* we are in a pre-boot state (empty RAM) */ | |
55 | DEVICE_STATE_BOOT, /* boot state (fw upload, run fw) */ | |
56 | DEVICE_STATE_PREINIT, /* pre-init state */ | |
57 | DEVICE_STATE_INIT, /* init state (restore MIB backup to device) */ | |
58 | DEVICE_STATE_READY, /* driver&device are in operational state */ | |
59 | DEVICE_STATE_SLEEP /* device in sleep mode */ | |
60 | }; | |
61 | ||
62 | /* SME flag */ | |
f3f45c73 SK |
63 | #define SME_MODE_SET BIT(0) |
64 | #define SME_RTS BIT(1) | |
65 | #define SME_FRAG BIT(2) | |
66 | #define SME_WEP_FLAG BIT(3) | |
67 | #define SME_WEP_INDEX BIT(4) | |
68 | #define SME_WEP_VAL1 BIT(5) | |
69 | #define SME_WEP_VAL2 BIT(6) | |
70 | #define SME_WEP_VAL3 BIT(7) | |
71 | #define SME_WEP_VAL4 BIT(8) | |
d1c4520d | 72 | #define SME_WEP_VAL_MASK GENMASK(8, 5) |
f3f45c73 SK |
73 | #define SME_RSN BIT(9) |
74 | #define SME_RSN_MULTICAST BIT(10) | |
75 | #define SME_RSN_UNICAST BIT(11) | |
76 | #define SME_RSN_AUTH BIT(12) | |
13a9930d | 77 | |
f3f45c73 SK |
78 | #define SME_AP_SCAN BIT(13) |
79 | #define SME_MULTICAST BIT(14) | |
13a9930d WS |
80 | |
81 | /* SME Event */ | |
82 | enum { | |
83 | SME_START, | |
84 | ||
85 | SME_MULTICAST_REQUEST, | |
86 | SME_MACADDRESS_SET_REQUEST, | |
87 | SME_BSS_SCAN_REQUEST, | |
88 | SME_SET_FLAG, | |
89 | SME_SET_TXKEY, | |
90 | SME_SET_KEY1, | |
91 | SME_SET_KEY2, | |
92 | SME_SET_KEY3, | |
93 | SME_SET_KEY4, | |
94 | SME_SET_PMK_TSC, | |
95 | SME_SET_GMK1_TSC, | |
96 | SME_SET_GMK2_TSC, | |
97 | SME_SET_GMK3_TSC, | |
98 | SME_SET_PMKSA, | |
99 | SME_POW_MNGMT_REQUEST, | |
100 | SME_PHY_INFO_REQUEST, | |
101 | SME_MIC_FAILURE_REQUEST, | |
102 | SME_GET_MAC_ADDRESS, | |
103 | SME_GET_PRODUCT_VERSION, | |
104 | SME_STOP_REQUEST, | |
105 | SME_RTS_THRESHOLD_REQUEST, | |
106 | SME_FRAGMENTATION_THRESHOLD_REQUEST, | |
107 | SME_WEP_INDEX_REQUEST, | |
108 | SME_WEP_KEY1_REQUEST, | |
109 | SME_WEP_KEY2_REQUEST, | |
110 | SME_WEP_KEY3_REQUEST, | |
111 | SME_WEP_KEY4_REQUEST, | |
112 | SME_WEP_FLAG_REQUEST, | |
113 | SME_RSN_UCAST_REQUEST, | |
114 | SME_RSN_MCAST_REQUEST, | |
115 | SME_RSN_AUTH_REQUEST, | |
116 | SME_RSN_ENABLED_REQUEST, | |
117 | SME_RSN_MODE_REQUEST, | |
13a9930d WS |
118 | SME_WPS_ENABLE_REQUEST, |
119 | SME_WPS_PROBE_REQUEST, | |
13a9930d WS |
120 | SME_SET_GAIN, |
121 | SME_GET_GAIN, | |
122 | SME_SLEEP_REQUEST, | |
123 | SME_SET_REGION, | |
124 | SME_MODE_SET_REQUEST, | |
125 | SME_START_REQUEST, | |
126 | SME_GET_EEPROM_CKSUM, | |
127 | ||
13a9930d WS |
128 | SME_MIC_FAILURE_CONFIRM, |
129 | SME_START_CONFIRM, | |
130 | ||
131 | SME_MULTICAST_CONFIRM, | |
132 | SME_BSS_SCAN_CONFIRM, | |
133 | SME_GET_CURRENT_AP, | |
134 | SME_POW_MNGMT_CONFIRM, | |
135 | SME_PHY_INFO_CONFIRM, | |
136 | SME_STOP_CONFIRM, | |
137 | SME_RTS_THRESHOLD_CONFIRM, | |
138 | SME_FRAGMENTATION_THRESHOLD_CONFIRM, | |
139 | SME_WEP_INDEX_CONFIRM, | |
140 | SME_WEP_KEY1_CONFIRM, | |
141 | SME_WEP_KEY2_CONFIRM, | |
142 | SME_WEP_KEY3_CONFIRM, | |
143 | SME_WEP_KEY4_CONFIRM, | |
144 | SME_WEP_FLAG_CONFIRM, | |
145 | SME_RSN_UCAST_CONFIRM, | |
146 | SME_RSN_MCAST_CONFIRM, | |
147 | SME_RSN_AUTH_CONFIRM, | |
148 | SME_RSN_ENABLED_CONFIRM, | |
149 | SME_RSN_MODE_CONFIRM, | |
150 | SME_MODE_SET_CONFIRM, | |
151 | SME_SLEEP_CONFIRM, | |
152 | ||
153 | SME_RSN_SET_CONFIRM, | |
154 | SME_WEP_SET_CONFIRM, | |
155 | SME_TERMINATE, | |
156 | ||
e765861c | 157 | SME_EVENT_SIZE |
13a9930d WS |
158 | }; |
159 | ||
160 | /* SME Status */ | |
161 | enum { | |
162 | SME_IDLE, | |
163 | SME_SETUP, | |
164 | SME_DISCONNECT, | |
165 | SME_CONNECT | |
166 | }; | |
167 | ||
168 | #define SME_EVENT_BUFF_SIZE 128 | |
169 | ||
d6e25e70 WS |
170 | struct sme_info { |
171 | int sme_status; | |
172 | int event_buff[SME_EVENT_BUFF_SIZE]; | |
173 | unsigned int qhead; | |
174 | unsigned int qtail; | |
d6e25e70 | 175 | spinlock_t sme_spin; |
13a9930d WS |
176 | unsigned long sme_flag; |
177 | }; | |
178 | ||
20a5ca23 | 179 | struct hostt { |
d6e25e70 WS |
180 | int buff[SME_EVENT_BUFF_SIZE]; |
181 | unsigned int qhead; | |
182 | unsigned int qtail; | |
13a9930d WS |
183 | }; |
184 | ||
185 | #define RSN_IE_BODY_MAX 64 | |
00284ea4 | 186 | struct rsn_ie { |
81710951 PV |
187 | u8 id; /* 0xdd = WPA or 0x30 = RSN */ |
188 | u8 size; /* max ? 255 ? */ | |
189 | u8 body[RSN_IE_BODY_MAX]; | |
2460563f | 190 | } __packed; |
13a9930d | 191 | |
1c800aab SP |
192 | #define WPA_INFO_ELEM_ID 0xdd |
193 | #define RSN_INFO_ELEM_ID 0x30 | |
194 | ||
13a9930d | 195 | #define WPS_IE_BODY_MAX 255 |
7383324f | 196 | struct wps_ie { |
81710951 PV |
197 | u8 id; /* 221 'dd <len> 00 50 F2 04' */ |
198 | u8 size; /* max ? 255 ? */ | |
199 | u8 body[WPS_IE_BODY_MAX]; | |
2460563f | 200 | } __packed; |
13a9930d | 201 | |
01d391d4 | 202 | struct local_ap { |
81710951 PV |
203 | u8 bssid[6]; |
204 | u8 rssi; | |
205 | u8 sq; | |
13a9930d | 206 | struct { |
81710951 PV |
207 | u8 size; |
208 | u8 body[32]; | |
209 | u8 ssid_pad; | |
13a9930d WS |
210 | } ssid; |
211 | struct { | |
81710951 PV |
212 | u8 size; |
213 | u8 body[16]; | |
214 | u8 rate_pad; | |
13a9930d | 215 | } rate_set; |
81710951 PV |
216 | u16 capability; |
217 | u8 channel; | |
218 | u8 noise; | |
00284ea4 QK |
219 | struct rsn_ie wpa_ie; |
220 | struct rsn_ie rsn_ie; | |
7383324f | 221 | struct wps_ie wps_ie; |
13a9930d WS |
222 | }; |
223 | ||
224 | #define LOCAL_APLIST_MAX 31 | |
225 | #define LOCAL_CURRENT_AP LOCAL_APLIST_MAX | |
f9ca0dea | 226 | struct local_aplist { |
13a9930d | 227 | int size; |
01d391d4 | 228 | struct local_ap ap[LOCAL_APLIST_MAX + 1]; |
13a9930d WS |
229 | }; |
230 | ||
431df21a | 231 | struct local_gain { |
93270634 JL |
232 | u8 tx_mode; |
233 | u8 rx_mode; | |
234 | u8 tx_gain; | |
235 | u8 rx_gain; | |
13a9930d WS |
236 | }; |
237 | ||
c83891b4 | 238 | struct local_eeprom_sum { |
81710951 PV |
239 | u8 type; |
240 | u8 result; | |
13a9930d WS |
241 | }; |
242 | ||
243 | enum { | |
244 | EEPROM_OK, | |
245 | EEPROM_CHECKSUM_NONE, | |
246 | EEPROM_FW_NOT_SUPPORT, | |
247 | EEPROM_NG, | |
248 | }; | |
249 | ||
13a9930d WS |
250 | /* Power Save Status */ |
251 | enum { | |
252 | PS_NONE, | |
253 | PS_ACTIVE_SET, | |
254 | PS_SAVE_SET, | |
255 | PS_CONF_WAIT, | |
256 | PS_SNOOZE, | |
257 | PS_WAKEUP | |
258 | }; | |
259 | ||
fa399ae2 | 260 | struct power_save_status { |
d6e25e70 | 261 | atomic_t status; /* initialvalue 0 */ |
13a9930d | 262 | struct completion wakeup_wait; |
d6e25e70 WS |
263 | atomic_t confirm_wait; |
264 | atomic_t snooze_guard; | |
13a9930d WS |
265 | }; |
266 | ||
cdc21381 | 267 | struct sleep_status { |
d6e25e70 WS |
268 | atomic_t status; /* initialvalue 0 */ |
269 | atomic_t doze_request; | |
270 | atomic_t wakeup_request; | |
13a9930d WS |
271 | }; |
272 | ||
273 | /* WPA */ | |
eafb5e29 | 274 | struct scan_ext { |
13a9930d | 275 | unsigned int flag; |
d6e25e70 | 276 | char ssid[IW_ESSID_MAX_SIZE + 1]; |
13a9930d WS |
277 | }; |
278 | ||
13a9930d WS |
279 | #define CIPHER_ID_WPA_NONE "\x00\x50\xf2\x00" |
280 | #define CIPHER_ID_WPA_WEP40 "\x00\x50\xf2\x01" | |
281 | #define CIPHER_ID_WPA_TKIP "\x00\x50\xf2\x02" | |
282 | #define CIPHER_ID_WPA_CCMP "\x00\x50\xf2\x04" | |
283 | #define CIPHER_ID_WPA_WEP104 "\x00\x50\xf2\x05" | |
284 | ||
285 | #define CIPHER_ID_WPA2_NONE "\x00\x0f\xac\x00" | |
286 | #define CIPHER_ID_WPA2_WEP40 "\x00\x0f\xac\x01" | |
287 | #define CIPHER_ID_WPA2_TKIP "\x00\x0f\xac\x02" | |
288 | #define CIPHER_ID_WPA2_CCMP "\x00\x0f\xac\x04" | |
289 | #define CIPHER_ID_WPA2_WEP104 "\x00\x0f\xac\x05" | |
290 | ||
291 | #define CIPHER_ID_LEN 4 | |
292 | ||
d6e25e70 | 293 | enum { |
13a9930d WS |
294 | KEY_MGMT_802_1X, |
295 | KEY_MGMT_PSK, | |
296 | KEY_MGMT_WPANONE, | |
297 | }; | |
298 | ||
299 | #define KEY_MGMT_ID_WPA_NONE "\x00\x50\xf2\x00" | |
300 | #define KEY_MGMT_ID_WPA_1X "\x00\x50\xf2\x01" | |
301 | #define KEY_MGMT_ID_WPA_PSK "\x00\x50\xf2\x02" | |
302 | #define KEY_MGMT_ID_WPA_WPANONE "\x00\x50\xf2\xff" | |
303 | ||
304 | #define KEY_MGMT_ID_WPA2_NONE "\x00\x0f\xac\x00" | |
305 | #define KEY_MGMT_ID_WPA2_1X "\x00\x0f\xac\x01" | |
306 | #define KEY_MGMT_ID_WPA2_PSK "\x00\x0f\xac\x02" | |
307 | #define KEY_MGMT_ID_WPA2_WPANONE "\x00\x0f\xac\xff" | |
308 | ||
309 | #define KEY_MGMT_ID_LEN 4 | |
310 | ||
311 | #define MIC_KEY_SIZE 8 | |
312 | ||
8b76eb09 | 313 | struct wpa_key { |
81710951 PV |
314 | u32 ext_flags; /* IW_ENCODE_EXT_xxx */ |
315 | u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ | |
316 | u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ | |
d6e25e70 WS |
317 | struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast |
318 | * (group) keys or unicast address for | |
483b1008 CS |
319 | * individual keys |
320 | */ | |
81710951 PV |
321 | u16 alg; |
322 | u16 key_len; /* WEP: 5 or 13, TKIP: 32, CCMP: 16 */ | |
323 | u8 key_val[IW_ENCODING_TOKEN_MAX]; | |
324 | u8 tx_mic_key[MIC_KEY_SIZE]; | |
325 | u8 rx_mic_key[MIC_KEY_SIZE]; | |
13a9930d | 326 | }; |
38fb7468 | 327 | |
13a9930d WS |
328 | #define WPA_KEY_INDEX_MAX 4 |
329 | #define WPA_RX_SEQ_LEN 6 | |
330 | ||
9b0b63a4 | 331 | struct mic_failure { |
81710951 PV |
332 | u16 failure; /* MIC Failure counter 0 or 1 or 2 */ |
333 | u16 counter; /* 1sec counter 0-60 */ | |
334 | u32 last_failure_time; | |
e765861c | 335 | int stop; |
13a9930d WS |
336 | }; |
337 | ||
04e9e06c | 338 | struct wpa_status { |
13a9930d | 339 | int wpa_enabled; |
d96f3a7c | 340 | bool rsn_enabled; |
13a9930d WS |
341 | int version; |
342 | int pairwise_suite; /* unicast cipher */ | |
343 | int group_suite; /* multicast cipher */ | |
e765861c | 344 | int key_mgmt_suite; |
13a9930d WS |
345 | int auth_alg; |
346 | int txkey; | |
8b76eb09 | 347 | struct wpa_key key[WPA_KEY_INDEX_MAX]; |
eafb5e29 | 348 | struct scan_ext scan_ext; |
9b0b63a4 | 349 | struct mic_failure mic_failure; |
13a9930d WS |
350 | }; |
351 | ||
352 | #include <linux/list.h> | |
353 | #define PMK_LIST_MAX 8 | |
956d23ae | 354 | struct pmk_list { |
81710951 | 355 | u16 size; |
13a9930d | 356 | struct list_head head; |
b7402474 | 357 | struct pmk { |
13a9930d | 358 | struct list_head list; |
81710951 PV |
359 | u8 bssid[ETH_ALEN]; |
360 | u8 pmkid[IW_PMKID_LEN]; | |
13a9930d WS |
361 | } pmk[PMK_LIST_MAX]; |
362 | }; | |
363 | ||
e7814c00 | 364 | struct wps_status { |
d6e25e70 WS |
365 | int wps_enabled; |
366 | int ielen; | |
81710951 | 367 | u8 ie[255]; |
13a9930d | 368 | }; |
13a9930d | 369 | |
57c6f08d SP |
370 | /* Tx Device struct */ |
371 | #define TX_DEVICE_BUFF_SIZE 1024 | |
372 | ||
373 | struct ks_wlan_private; | |
374 | ||
375 | /** | |
376 | * struct tx_device_buffer - Queue item for the tx queue. | |
377 | * @sendp: Pointer to the send request data. | |
378 | * @size: Size of @sendp data. | |
379 | * @complete_handler: Function called once data write to device is complete. | |
380 | * @arg1: First argument to @complete_handler. | |
381 | * @arg2: Second argument to @complete_handler. | |
382 | */ | |
383 | struct tx_device_buffer { | |
384 | unsigned char *sendp; | |
385 | unsigned int size; | |
386 | void (*complete_handler)(struct ks_wlan_private *priv, | |
387 | struct sk_buff *skb); | |
388 | struct sk_buff *skb; | |
389 | }; | |
390 | ||
391 | /** | |
392 | * struct tx_device - Tx buffer queue. | |
393 | * @tx_device_buffer: Queue buffer. | |
394 | * @qhead: Head of tx queue. | |
395 | * @qtail: Tail of tx queue. | |
396 | * @tx_dev_lock: Queue lock. | |
397 | */ | |
398 | struct tx_device { | |
399 | struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE]; | |
400 | unsigned int qhead; | |
401 | unsigned int qtail; | |
402 | spinlock_t tx_dev_lock; /* protect access to the queue */ | |
403 | }; | |
404 | ||
405 | /* Rx Device struct */ | |
406 | #define RX_DATA_SIZE (2 + 2 + 2347 + 1) | |
407 | #define RX_DEVICE_BUFF_SIZE 32 | |
408 | ||
409 | /** | |
410 | * struct rx_device_buffer - Queue item for the rx queue. | |
411 | * @data: rx data. | |
412 | * @size: Size of @data. | |
413 | */ | |
414 | struct rx_device_buffer { | |
415 | unsigned char data[RX_DATA_SIZE]; | |
416 | unsigned int size; | |
417 | }; | |
418 | ||
419 | /** | |
420 | * struct rx_device - Rx buffer queue. | |
421 | * @rx_device_buffer: Queue buffer. | |
422 | * @qhead: Head of rx queue. | |
423 | * @qtail: Tail of rx queue. | |
424 | * @rx_dev_lock: Queue lock. | |
425 | */ | |
426 | struct rx_device { | |
427 | struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE]; | |
428 | unsigned int qhead; | |
429 | unsigned int qtail; | |
430 | spinlock_t rx_dev_lock; /* protect access to the queue */ | |
431 | }; | |
432 | ||
feedcf1a | 433 | struct ks_wlan_private { |
18bd6dd1 | 434 | /* hardware information */ |
07511629 | 435 | void *if_hw; |
18bd6dd1 TH |
436 | struct workqueue_struct *wq; |
437 | struct delayed_work rw_dwork; | |
321dabdc | 438 | struct tasklet_struct rx_bh_task; |
13a9930d WS |
439 | |
440 | struct net_device *net_dev; | |
13a9930d WS |
441 | struct net_device_stats nstats; |
442 | struct iw_statistics wstats; | |
443 | ||
444 | struct completion confirm_wait; | |
445 | ||
d6e25e70 | 446 | /* trx device & sme */ |
13a9930d WS |
447 | struct tx_device tx_dev; |
448 | struct rx_device rx_dev; | |
d6e25e70 | 449 | struct sme_info sme_i; |
13a9930d | 450 | u8 *rxp; |
d6e25e70 | 451 | unsigned int rx_size; |
a2b0b416 | 452 | struct work_struct sme_work; |
07e483c1 | 453 | struct work_struct wakeup_work; |
13a9930d WS |
454 | int scan_ind_count; |
455 | ||
456 | unsigned char eth_addr[ETH_ALEN]; | |
457 | ||
f9ca0dea | 458 | struct local_aplist aplist; |
01d391d4 | 459 | struct local_ap current_ap; |
fa399ae2 | 460 | struct power_save_status psstatus; |
cdc21381 | 461 | struct sleep_status sleepstatus; |
04e9e06c | 462 | struct wpa_status wpa; |
956d23ae | 463 | struct pmk_list pmklist; |
d6e25e70 | 464 | /* wireless parameter */ |
13a9930d | 465 | struct ks_wlan_parameter reg; |
81710951 | 466 | u8 current_rate; |
13a9930d | 467 | |
d6e25e70 WS |
468 | char nick[IW_ESSID_MAX_SIZE + 1]; |
469 | ||
470 | spinlock_t multicast_spin; | |
13a9930d WS |
471 | |
472 | spinlock_t dev_read_lock; | |
d6e25e70 | 473 | wait_queue_head_t devread_wait; |
13a9930d | 474 | |
d6e25e70 | 475 | unsigned int need_commit; /* for ioctl */ |
13a9930d | 476 | |
d6e25e70 | 477 | /* DeviceIoControl */ |
d892cc1c | 478 | bool is_device_open; |
13a9930d | 479 | atomic_t event_count; |
d6e25e70 WS |
480 | atomic_t rec_count; |
481 | int dev_count; | |
13a9930d WS |
482 | #define DEVICE_STOCK_COUNT 20 |
483 | unsigned char *dev_data[DEVICE_STOCK_COUNT]; | |
484 | int dev_size[DEVICE_STOCK_COUNT]; | |
485 | ||
d6e25e70 WS |
486 | /* ioctl : IOCTL_FIRMWARE_VERSION */ |
487 | unsigned char firmware_version[128 + 1]; | |
13a9930d WS |
488 | int version_size; |
489 | ||
e765861c | 490 | bool mac_address_valid; |
13a9930d WS |
491 | |
492 | int dev_state; | |
493 | ||
494 | struct sk_buff *skb; | |
495 | unsigned int cur_rx; /* Index into the Rx buffer of next Rx pkt. */ | |
13a9930d WS |
496 | #define FORCE_DISCONNECT 0x80000000 |
497 | #define CONNECT_STATUS_MASK 0x7FFFFFFF | |
e765861c SP |
498 | u32 connect_status; |
499 | int infra_status; | |
81710951 PV |
500 | u8 scan_ssid_len; |
501 | u8 scan_ssid[IW_ESSID_MAX_SIZE + 1]; | |
431df21a | 502 | struct local_gain gain; |
e7814c00 | 503 | struct wps_status wps; |
81710951 | 504 | u8 sleep_mode; |
13a9930d | 505 | |
81710951 | 506 | u8 region; |
c83891b4 | 507 | struct local_eeprom_sum eeprom_sum; |
81710951 | 508 | u8 eeprom_checksum; |
13a9930d | 509 | |
20a5ca23 | 510 | struct hostt hostt; |
13a9930d WS |
511 | |
512 | unsigned long last_doze; | |
513 | unsigned long last_wakeup; | |
514 | ||
4cf2df75 | 515 | unsigned int wakeup_count; /* for detect wakeup loop */ |
d6e25e70 | 516 | }; |
13a9930d | 517 | |
57c6f08d SP |
518 | static inline void inc_txqhead(struct ks_wlan_private *priv) |
519 | { | |
520 | priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE; | |
521 | } | |
522 | ||
523 | static inline void inc_txqtail(struct ks_wlan_private *priv) | |
524 | { | |
525 | priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE; | |
526 | } | |
527 | ||
528 | static inline bool txq_has_space(struct ks_wlan_private *priv) | |
529 | { | |
530 | return (CIRC_SPACE(priv->tx_dev.qhead, priv->tx_dev.qtail, | |
531 | TX_DEVICE_BUFF_SIZE) > 0); | |
532 | } | |
533 | ||
534 | static inline void inc_rxqhead(struct ks_wlan_private *priv) | |
535 | { | |
536 | priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE; | |
537 | } | |
538 | ||
539 | static inline void inc_rxqtail(struct ks_wlan_private *priv) | |
540 | { | |
541 | priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE; | |
542 | } | |
543 | ||
544 | static inline bool rxq_has_space(struct ks_wlan_private *priv) | |
545 | { | |
546 | return (CIRC_SPACE(priv->rx_dev.qhead, priv->rx_dev.qtail, | |
547 | RX_DEVICE_BUFF_SIZE) > 0); | |
548 | } | |
549 | ||
550 | static inline unsigned int txq_count(struct ks_wlan_private *priv) | |
551 | { | |
552 | return CIRC_CNT_TO_END(priv->tx_dev.qhead, priv->tx_dev.qtail, | |
553 | TX_DEVICE_BUFF_SIZE); | |
554 | } | |
555 | ||
556 | static inline unsigned int rxq_count(struct ks_wlan_private *priv) | |
557 | { | |
558 | return CIRC_CNT_TO_END(priv->rx_dev.qhead, priv->rx_dev.qtail, | |
559 | RX_DEVICE_BUFF_SIZE); | |
560 | } | |
561 | ||
2751bc91 BG |
562 | int ks_wlan_net_start(struct net_device *dev); |
563 | int ks_wlan_net_stop(struct net_device *dev); | |
0e24eb8a TH |
564 | bool is_connect_status(u32 status); |
565 | bool is_disconnect_status(u32 status); | |
30776cf9 | 566 | |
13a9930d | 567 | #endif /* _KS_WLAN_H */ |