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