Merge tag 'batman-adv-for-davem' of git://git.open-mesh.org/linux-merge
[deliverable/linux.git] / drivers / net / wireless / wl12xx / wl12xx.h
CommitLineData
f5fc0f86
LC
1/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 1998-2009 Texas Instruments. All rights reserved.
5 * Copyright (C) 2008-2009 Nokia Corporation
6 *
7 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
00d20100
SL
25#ifndef __WL12XX_H__
26#define __WL12XX_H__
f5fc0f86
LC
27
28#include <linux/mutex.h>
29#include <linux/completion.h>
30#include <linux/spinlock.h>
31#include <linux/list.h>
32#include <linux/bitops.h>
33#include <net/mac80211.h>
34
00d20100
SL
35#include "conf.h"
36#include "ini.h"
2b60100b 37
4549d09c
EP
38#define WL127X_FW_NAME_MULTI "ti-connectivity/wl127x-fw-4-mr.bin"
39#define WL127X_FW_NAME_SINGLE "ti-connectivity/wl127x-fw-4-sr.bin"
40
41#define WL128X_FW_NAME_MULTI "ti-connectivity/wl128x-fw-4-mr.bin"
42#define WL128X_FW_NAME_SINGLE "ti-connectivity/wl128x-fw-4-sr.bin"
43
3fcdab70
EP
44#define WL127X_PLT_FW_NAME "ti-connectivity/wl127x-fw-4-plt.bin"
45#define WL128X_PLT_FW_NAME "ti-connectivity/wl128x-fw-4-plt.bin"
166d504e 46
5aa42346
SL
47/*
48 * wl127x and wl128x are using the same NVS file name. However, the
49 * ini parameters between them are different. The driver validates
50 * the correct NVS size in wl1271_boot_upload_nvs().
51 */
52#define WL12XX_NVS_NAME "ti-connectivity/wl1271-nvs.bin"
152ee6e0 53
04e36fc5
JO
54#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
55#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
b992c682 56#define WL1271_TX_SQN_POST_RECOVERY_PADDING 0xff
04e36fc5 57
7a55724e
JO
58#define WL1271_CIPHER_SUITE_GEM 0x00147201
59
259da430 60#define WL1271_BUSY_WORD_CNT 1
545f1da8 61#define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32))
f5fc0f86
LC
62
63#define WL1271_ELP_HW_STATE_ASLEEP 0
64#define WL1271_ELP_HW_STATE_IRQ 1
65
d94cd297
JO
66#define WL1271_DEFAULT_BEACON_INT 100
67#define WL1271_DEFAULT_DTIM_PERIOD 1
68
c690ec81 69#define WL12XX_MAX_ROLES 4
f80c2d12 70#define WL12XX_MAX_LINKS 12
7f097988
EP
71#define WL12XX_INVALID_ROLE_ID 0xff
72#define WL12XX_INVALID_LINK_ID 0xff
e51ae9be 73
e5a359f8
EP
74#define WL12XX_MAX_RATE_POLICIES 16
75
e51ae9be 76/* Defined by FW as 0. Will not be freed or allocated. */
f4df1bd5 77#define WL12XX_SYSTEM_HLID 0
e51ae9be 78
b622d992 79/*
9b17f1b3 80 * When in AP-mode, we allow (at least) this number of packets
b622d992
AN
81 * to be transmitted to FW for a STA in PS-mode. Only when packets are
82 * present in the FW buffers it will wake the sleeping STA. We want to put
83 * enough packets for the driver to transmit all of its buffered data before
9b17f1b3 84 * the STA goes to sleep again. But we don't want to take too much memory
b622d992 85 * as it might hurt the throughput of active STAs.
b622d992 86 */
9b17f1b3 87#define WL1271_PS_STA_MAX_PACKETS 2
b622d992 88
98bdaabb 89#define WL1271_AP_BSS_INDEX 0
98bdaabb
AN
90#define WL1271_AP_DEF_BEACON_EXP 20
91
79b122dc 92#define ACX_TX_DESCRIPTORS 16
be7078c2 93
1f37cbc9
IY
94#define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
95
f5fc0f86
LC
96enum wl1271_state {
97 WL1271_STATE_OFF,
98 WL1271_STATE_ON,
3fcdab70
EP
99};
100
101enum wl12xx_fw_type {
102 WL12XX_FW_TYPE_NONE,
103 WL12XX_FW_TYPE_NORMAL,
4549d09c 104 WL12XX_FW_TYPE_MULTI,
3fcdab70 105 WL12XX_FW_TYPE_PLT,
f5fc0f86
LC
106};
107
108enum wl1271_partition_type {
109 PART_DOWN,
110 PART_WORK,
111 PART_DRPW,
112
113 PART_TABLE_LEN
114};
115
116struct wl1271_partition {
117 u32 size;
118 u32 start;
119};
120
121struct wl1271_partition_set {
122 struct wl1271_partition mem;
123 struct wl1271_partition reg;
451de97a
JO
124 struct wl1271_partition mem2;
125 struct wl1271_partition mem3;
f5fc0f86
LC
126};
127
128struct wl1271;
129
e7ddf549
LC
130enum {
131 FW_VER_CHIP,
132 FW_VER_IF_TYPE,
133 FW_VER_MAJOR,
134 FW_VER_SUBTYPE,
135 FW_VER_MINOR,
136
137 NUM_FW_VER
138};
139
140#define FW_VER_CHIP_WL127X 6
141#define FW_VER_CHIP_WL128X 7
142
143#define FW_VER_IF_TYPE_STA 1
144#define FW_VER_IF_TYPE_AP 2
145
146#define FW_VER_MINOR_1_SPARE_STA_MIN 58
147#define FW_VER_MINOR_1_SPARE_AP_MIN 47
4b7fac77 148
95dac04f
IY
149#define FW_VER_MINOR_FWLOG_STA_MIN 70
150
f5fc0f86
LC
151struct wl1271_chip {
152 u32 id;
4b7fac77 153 char fw_ver_str[ETHTOOL_BUSINFO_LEN];
e7ddf549 154 unsigned int fw_ver[NUM_FW_VER];
f5fc0f86
LC
155};
156
157struct wl1271_stats {
158 struct acx_statistics *fw_stats;
159 unsigned long fw_stats_update;
160
161 unsigned int retry_count;
162 unsigned int excessive_retries;
163};
164
f5fc0f86
LC
165#define NUM_TX_QUEUES 4
166#define NUM_RX_PKT_DESC 8
167
c47e8229 168#define AP_MAX_STATIONS 8
beb6c880 169
4d56ad9c
EP
170/* FW status registers */
171struct wl12xx_fw_status {
d0f63b20 172 __le32 intr;
f5fc0f86
LC
173 u8 fw_rx_counter;
174 u8 drv_rx_counter;
175 u8 reserved;
176 u8 tx_results_counter;
d0f63b20 177 __le32 rx_pkt_descs[NUM_RX_PKT_DESC];
d0f63b20 178 __le32 fw_localtime;
beb6c880
AN
179
180 /*
181 * A bitmap (where each bit represents a single HLID)
182 * to indicate if the station is in PS mode.
183 */
184 __le32 link_ps_bitmap;
185
4d56ad9c
EP
186 /*
187 * A bitmap (where each bit represents a single HLID) to indicate
188 * if the station is in Fast mode
189 */
190 __le32 link_fast_bitmap;
f5fc0f86 191
4d56ad9c
EP
192 /* Cumulative counter of total released mem blocks since FW-reset */
193 __le32 total_released_blks;
c8bde243 194
4d56ad9c
EP
195 /* Size (in Memory Blocks) of TX pool */
196 __le32 tx_total;
c8bde243 197
bf54e301
AN
198 /* Cumulative counter of released packets per AC */
199 u8 tx_released_pkts[NUM_TX_QUEUES];
c8bde243 200
9b17f1b3
AN
201 /* Cumulative counter of freed packets per HLID */
202 u8 tx_lnk_free_pkts[WL12XX_MAX_LINKS];
4d56ad9c
EP
203
204 /* Cumulative counter of released Voice memory blocks */
205 u8 tx_voice_released_blks;
f80c2d12 206 u8 padding_1[3];
4d56ad9c
EP
207 __le32 log_start_addr;
208} __packed;
c8bde243 209
f5fc0f86
LC
210struct wl1271_rx_mem_pool_addr {
211 u32 addr;
212 u32 addr_extra;
213};
214
4a31c11c 215#define WL1271_MAX_CHANNELS 64
abb0b3bf 216struct wl1271_scan {
4fb26fa9 217 struct cfg80211_scan_request *req;
4a31c11c 218 unsigned long scanned_ch[BITS_TO_LONGS(WL1271_MAX_CHANNELS)];
78abd320 219 bool failed;
abb0b3bf 220 u8 state;
3b40c040 221 u8 ssid[IEEE80211_MAX_SSID_LEN+1];
abb0b3bf 222 size_t ssid_len;
abb0b3bf
TP
223};
224
8197b711 225struct wl1271_if_operations {
a390e85c 226 void (*read)(struct device *child, int addr, void *buf, size_t len,
8197b711 227 bool fixed);
a390e85c 228 void (*write)(struct device *child, int addr, void *buf, size_t len,
8197b711 229 bool fixed);
a390e85c
FB
230 void (*reset)(struct device *child);
231 void (*init)(struct device *child);
232 int (*power)(struct device *child, bool enable);
233 void (*set_block_size) (struct device *child, unsigned int blksz);
8197b711
TP
234};
235
7f179b46
AN
236#define MAX_NUM_KEYS 14
237#define MAX_KEY_SIZE 32
238
239struct wl1271_ap_key {
240 u8 id;
241 u8 key_type;
242 u8 key_size;
243 u8 key[MAX_KEY_SIZE];
244 u8 hlid;
245 u32 tx_seq_32;
246 u16 tx_seq_16;
247};
248
72c2d9e5 249enum wl12xx_flags {
72c2d9e5
EP
250 WL1271_FLAG_GPIO_POWER,
251 WL1271_FLAG_TX_QUEUE_STOPPED,
b07d4037 252 WL1271_FLAG_TX_PENDING,
72c2d9e5 253 WL1271_FLAG_IN_ELP,
a665d6e2 254 WL1271_FLAG_ELP_REQUESTED,
72c2d9e5 255 WL1271_FLAG_IRQ_RUNNING,
72c2d9e5 256 WL1271_FLAG_FW_TX_BUSY,
990f5de7 257 WL1271_FLAG_DUMMY_PACKET_PENDING,
f44e5868
EP
258 WL1271_FLAG_SUSPENDED,
259 WL1271_FLAG_PENDING_WORK,
77ddaa10 260 WL1271_FLAG_SOFT_GEMINI,
baacb9ae 261 WL1271_FLAG_RECOVERY_IN_PROGRESS,
4549d09c 262 WL1271_FLAG_VIF_CHANGE_IN_PROGRESS,
e9ba7152 263 WL1271_FLAG_INTENDED_FW_RECOVERY,
72c2d9e5
EP
264};
265
ba8447f6 266enum wl12xx_vif_flags {
10c8cd01 267 WLVIF_FLAG_INITIALIZED,
ba8447f6 268 WLVIF_FLAG_STA_ASSOCIATED,
9fd6f21b 269 WLVIF_FLAG_STA_AUTHORIZED,
eee514e3 270 WLVIF_FLAG_IBSS_JOINED,
53d40d0b 271 WLVIF_FLAG_AP_STARTED,
5c0dc2fc 272 WLVIF_FLAG_IN_PS,
8181aecc 273 WLVIF_FLAG_STA_STATE_SENT,
0744bdb6 274 WLVIF_FLAG_RX_STREAMING_STARTED,
836d6600 275 WLVIF_FLAG_PSPOLL_FAILURE,
52630c5d 276 WLVIF_FLAG_CS_PROGRESS,
560f0024 277 WLVIF_FLAG_AP_PROBE_RESP_SET,
a0c7b782 278 WLVIF_FLAG_IN_USE,
ba8447f6
EP
279};
280
a8c0ddb5
AN
281struct wl1271_link {
282 /* AP-mode - TX queue per AC in link */
283 struct sk_buff_head tx_queue[NUM_TX_QUEUES];
09039f42 284
9b17f1b3
AN
285 /* accounting for allocated / freed packets in FW */
286 u8 allocated_pkts;
287 u8 prev_freed_pkts;
b622d992
AN
288
289 u8 addr[ETH_ALEN];
0f9c8250
AN
290
291 /* bitmap of TIDs where RX BA sessions are active for this link */
292 u8 ba_bitmap;
a8c0ddb5
AN
293};
294
f5fc0f86
LC
295struct wl1271 {
296 struct ieee80211_hw *hw;
297 bool mac80211_registered;
298
a390e85c
FB
299 struct device *dev;
300
8197b711
TP
301 void *if_priv;
302
303 struct wl1271_if_operations *if_ops;
f5fc0f86
LC
304
305 void (*set_power)(bool enable);
306 int irq;
15cea993 307 int ref_clock;
f5fc0f86
LC
308
309 spinlock_t wl_lock;
310
311 enum wl1271_state state;
3fcdab70
EP
312 enum wl12xx_fw_type fw_type;
313 bool plt;
4549d09c 314 u8 last_vif_count;
f5fc0f86
LC
315 struct mutex mutex;
316
830fb67b
JO
317 unsigned long flags;
318
451de97a 319 struct wl1271_partition_set part;
f5fc0f86
LC
320
321 struct wl1271_chip chip;
322
323 int cmd_box_addr;
324 int event_box_addr;
325
326 u8 *fw;
327 size_t fw_len;
bc765bf3 328 void *nvs;
02fabb0e 329 size_t nvs_len;
f5fc0f86 330
d717fd61
JO
331 s8 hw_pg_ver;
332
5e037e74
LC
333 /* address read from the fuse ROM */
334 u32 fuse_oui_addr;
335 u32 fuse_nic_addr;
336
337 /* we have up to 2 MAC addresses */
338 struct mac_address addresses[2];
f5fc0f86 339 int channel;
f4df1bd5 340 u8 system_hlid;
c690ec81
EP
341
342 unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)];
343 unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
251c177f 344 unsigned long roc_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
e5a359f8
EP
345 unsigned long rate_policies_map[
346 BITS_TO_LONGS(WL12XX_MAX_RATE_POLICIES)];
f5fc0f86 347
87627214 348 struct list_head wlvif_list;
e5a359f8 349
a4e4130d
EP
350 u8 sta_count;
351 u8 ap_count;
87627214 352
f5fc0f86
LC
353 struct wl1271_acx_mem_map *target_mem_map;
354
355 /* Accounting for allocated / available TX blocks on HW */
4d56ad9c 356 u32 tx_blocks_freed;
f5fc0f86 357 u32 tx_blocks_available;
7bb5d6ce 358 u32 tx_allocated_blocks;
ffb591cd 359 u32 tx_results_count;
f5fc0f86 360
e9eb8cbe
GE
361 /* amount of spare TX blocks to use */
362 u32 tx_spare_blocks;
363
bf54e301
AN
364 /* Accounting for allocated / available Tx packets in HW */
365 u32 tx_pkts_freed[NUM_TX_QUEUES];
742246f8 366 u32 tx_allocated_pkts[NUM_TX_QUEUES];
bf54e301 367
f5fc0f86 368 /* Transmitted TX packets counter for chipset interface */
ffb591cd 369 u32 tx_packets_count;
f5fc0f86
LC
370
371 /* Time-offset between host and chipset clocks */
ac5e1e39 372 s64 time_offset;
f5fc0f86 373
f5fc0f86 374 /* Frames scheduled for transmission, not handled yet */
f1a46384 375 int tx_queue_count[NUM_TX_QUEUES];
708bb3cf 376 long stopped_queues_map;
f5fc0f86 377
a620865e
IY
378 /* Frames received, not handled yet by mac80211 */
379 struct sk_buff_head deferred_rx_queue;
380
381 /* Frames sent, not returned yet to mac80211 */
382 struct sk_buff_head deferred_tx_queue;
383
f5fc0f86 384 struct work_struct tx_work;
92ef8960 385 struct workqueue_struct *freezable_wq;
c87dec9f 386
f5fc0f86 387 /* Pending TX frames */
25eeb9e3 388 unsigned long tx_frames_map[BITS_TO_LONGS(ACX_TX_DESCRIPTORS)];
be7078c2 389 struct sk_buff *tx_frames[ACX_TX_DESCRIPTORS];
781608c4 390 int tx_frames_cnt;
f5fc0f86
LC
391
392 /* FW Rx counter */
393 u32 rx_counter;
394
395 /* Rx memory pool address */
396 struct wl1271_rx_mem_pool_addr rx_mem_pool_addr;
397
1f37cbc9
IY
398 /* Intermediate buffer, used for packet aggregation */
399 u8 *aggr_buf;
400
990f5de7
IY
401 /* Reusable dummy packet template */
402 struct sk_buff *dummy_packet;
403
a620865e
IY
404 /* Network stack work */
405 struct work_struct netstack_work;
f5fc0f86 406
95dac04f
IY
407 /* FW log buffer */
408 u8 *fwlog;
409
410 /* Number of valid bytes in the FW log buffer */
411 ssize_t fwlog_size;
412
413 /* Sysfs FW log entry readers wait queue */
414 wait_queue_head_t fwlog_waitq;
415
52b0e7a6
JO
416 /* Hardware recovery work */
417 struct work_struct recovery_work;
418
f5fc0f86
LC
419 /* The mbox event mask */
420 u32 event_mask;
421
422 /* Mailbox pointers */
423 u32 mbox_ptr[2];
424
425 /* Are we currently scanning */
784f694d 426 struct ieee80211_vif *scan_vif;
abb0b3bf 427 struct wl1271_scan scan;
78abd320 428 struct delayed_work scan_complete_work;
f5fc0f86 429
33c2c06c
LC
430 bool sched_scanning;
431
8a5a37a6
JO
432 /* The current band */
433 enum ieee80211_band band;
434
f5fc0f86 435 struct completion *elp_compl;
37b70a81 436 struct delayed_work elp_work;
90494a90 437
f5fc0f86
LC
438 /* in dBm */
439 int power_level;
440
441 struct wl1271_stats stats;
f5fc0f86 442
554d7209 443 __le32 buffer_32;
f5fc0f86 444 u32 buffer_cmd;
545f1da8 445 u32 buffer_busyword[WL1271_BUSY_WORD_CNT];
f5fc0f86 446
4d56ad9c 447 struct wl12xx_fw_status *fw_status;
f5fc0f86 448 struct wl1271_tx_hw_res_if *tx_res_if;
b771eee5 449
2b60100b
JO
450 /* Current chipset configuration */
451 struct conf_drv_settings conf;
01c09162 452
7fc3a864
JO
453 bool sg_enabled;
454
02fabb0e
JO
455 bool enable_11a;
456
ece550d0
JL
457 /* Most recently reported noise in dBm */
458 s8 noise;
f84f7d78 459
a8aaaf53
LC
460 /* bands supported by this instance of wl12xx */
461 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
4b7fac77 462
5ea417ae 463 int tcxo_clock;
48a61477 464
402e4861
EP
465 /*
466 * wowlan trigger was configured during suspend.
467 * (currently, only "ANY" trigger is supported)
468 */
469 bool wow_enabled;
6bb04332 470 bool irq_wake_enabled;
402e4861 471
a8c0ddb5
AN
472 /*
473 * AP-mode - links indexed by HLID. The global and broadcast links
474 * are always active.
475 */
c7ffb902 476 struct wl1271_link links[WL12XX_MAX_LINKS];
a8c0ddb5 477
b622d992
AN
478 /* AP-mode - a bitmap of links currently in PS mode according to FW */
479 u32 ap_fw_ps_map;
480
481 /* AP-mode - a bitmap of links currently in PS mode in mac80211 */
482 unsigned long ap_ps_map;
606ea9fa
IY
483
484 /* Quirks of specific hardware revisions */
485 unsigned int quirks;
341b7cde
IY
486
487 /* Platform limitations */
488 unsigned int platform_quirks;
0f9c8250
AN
489
490 /* number of currently active RX BA sessions */
491 int ba_rx_session_count;
da03209e
AN
492
493 /* AP-mode - number of currently connected stations */
494 int active_sta_count;
e4120df9
EP
495
496 /* last wlvif we transmitted from */
497 struct wl12xx_vif *last_wlvif;
55df5afb
AN
498
499 /* work to fire when Tx is stuck */
500 struct delayed_work tx_watchdog_work;
f84f7d78
AN
501};
502
503struct wl1271_station {
504 u8 hlid;
f5fc0f86
LC
505};
506
87fbcb0f 507struct wl12xx_vif {
252efa4f 508 struct wl1271 *wl;
87627214 509 struct list_head list;
ba8447f6 510 unsigned long flags;
536129c8 511 u8 bss_type;
fb0e707c 512 u8 p2p; /* we are using p2p role */
0603d891 513 u8 role_id;
536129c8 514
7edebf56
EP
515 /* sta/ibss specific */
516 u8 dev_role_id;
afaf8bdb 517 u8 dev_hlid;
7edebf56 518
154da67c
EP
519 union {
520 struct {
521 u8 hlid;
d0802abd 522 u8 ba_rx_bitmap;
e5a359f8
EP
523
524 u8 basic_rate_idx;
525 u8 ap_rate_idx;
526 u8 p2p_rate_idx;
5ec8a448
EP
527
528 bool qos;
154da67c 529 } sta;
a8ab39a4
EP
530 struct {
531 u8 global_hlid;
532 u8 bcast_hlid;
c7ffb902
EP
533
534 /* HLIDs bitmap of associated stations */
535 unsigned long sta_hlid_map[BITS_TO_LONGS(
536 WL12XX_MAX_LINKS)];
170d0e67
EP
537
538 /* recoreded keys - set here before AP startup */
539 struct wl1271_ap_key *recorded_keys[MAX_NUM_KEYS];
e5a359f8
EP
540
541 u8 mgmt_rate_idx;
542 u8 bcast_rate_idx;
543 u8 ucast_rate_idx[CONF_TX_MAX_AC_COUNT];
a8ab39a4 544 } ap;
154da67c
EP
545 };
546
4438aca9
EP
547 /* the hlid of the last transmitted skb */
548 int last_tx_hlid;
549
c7ffb902
EP
550 unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)];
551
1fe9f161
EP
552 u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
553 u8 ssid_len;
554
1b92f15e
EP
555 /* The current band */
556 enum ieee80211_band band;
61f845f4 557 int channel;
1b92f15e 558
83587505 559 u32 bitrate_masks[IEEE80211_NUM_BANDS];
87fbcb0f 560 u32 basic_rate_set;
30d0c8fd
EP
561
562 /*
563 * currently configured rate set:
564 * bits 0-15 - 802.11abg rates
565 * bits 16-23 - 802.11n MCS index mask
566 * support only 1 stream, thus only 8 bits for the MCS rates (0-7).
567 */
d2d66c56 568 u32 basic_rate;
30d0c8fd 569 u32 rate_set;
bddb29b8
EP
570
571 /* probe-req template for the current AP */
572 struct sk_buff *probereq;
6840e37a 573
6a899796
EP
574 /* Beaconing interval (needed for ad-hoc) */
575 u32 beacon_int;
576
f75c753f
EP
577 /* Default key (for WEP) */
578 u32 default_key;
579
6840e37a
EP
580 /* Our association ID */
581 u16 aid;
98b86253
EP
582
583 /* Session counter for the chipset */
584 int session_counter;
252efa4f 585
74ec8395
EP
586 /* retry counter for PSM entries */
587 u8 psm_entry_retry;
04324d99 588
6bd65029
EP
589 /* in dBm */
590 int power_level;
591
04324d99
EP
592 int rssi_thold;
593 int last_rssi_event;
d0802abd 594
5ec8a448
EP
595 /* save the current encryption type for auto-arp config */
596 u8 encryption_type;
597 __be32 ip_addr;
598
d0802abd
EP
599 /* RX BA constraint value */
600 bool ba_support;
601 bool ba_allowed;
48e93e40 602
9eb599e9
EP
603 /* Rx Streaming */
604 struct work_struct rx_streaming_enable_work;
605 struct work_struct rx_streaming_disable_work;
606 struct timer_list rx_streaming_timer;
607
48e93e40
EP
608 /*
609 * This struct must be last!
610 * data that has to be saved acrossed reconfigs (e.g. recovery)
611 * should be declared in this struct.
612 */
613 struct {
614 u8 persistent[0];
615 /*
616 * Security sequence number
617 * bits 0-15: lower 16 bits part of sequence number
618 * bits 16-47: higher 32 bits part of sequence number
619 * bits 48-63: not in use
620 */
621 u64 tx_security_seq;
622
623 /* 8 bits of the last sequence number in use */
624 u8 tx_security_last_seq_lsb;
625 };
87fbcb0f
EP
626};
627
628static inline struct wl12xx_vif *wl12xx_vif_to_data(struct ieee80211_vif *vif)
629{
630 return (struct wl12xx_vif *)vif->drv_priv;
631}
632
633static inline
634struct ieee80211_vif *wl12xx_wlvif_to_vif(struct wl12xx_vif *wlvif)
635{
636 return container_of((void *)wlvif, struct ieee80211_vif, drv_priv);
637}
638
87627214
EP
639#define wl12xx_for_each_wlvif(wl, wlvif) \
640 list_for_each_entry(wlvif, &wl->wlvif_list, list)
641
e4120df9
EP
642#define wl12xx_for_each_wlvif_continue(wl, wlvif) \
643 list_for_each_entry_continue(wlvif, &wl->wlvif_list, list)
644
4b730b6a
EP
645#define wl12xx_for_each_wlvif_bss_type(wl, wlvif, _bss_type) \
646 wl12xx_for_each_wlvif(wl, wlvif) \
647 if (wlvif->bss_type == _bss_type)
648
649#define wl12xx_for_each_wlvif_sta(wl, wlvif) \
650 wl12xx_for_each_wlvif_bss_type(wl, wlvif, BSS_TYPE_STA_BSS)
651
652#define wl12xx_for_each_wlvif_ap(wl, wlvif) \
653 wl12xx_for_each_wlvif_bss_type(wl, wlvif, BSS_TYPE_AP_BSS)
654
f5fc0f86
LC
655int wl1271_plt_start(struct wl1271 *wl);
656int wl1271_plt_stop(struct wl1271 *wl);
9eb599e9 657int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif);
baacb9ae 658void wl12xx_queue_recovery_work(struct wl1271 *wl);
95dac04f 659size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen);
f5fc0f86
LC
660
661#define JOIN_TIMEOUT 5000 /* 5000 milliseconds to join */
662
98b86253
EP
663#define SESSION_COUNTER_MAX 6 /* maximum value for the session counter */
664#define SESSION_COUNTER_INVALID 7 /* used with dummy_packet */
f5fc0f86
LC
665
666#define WL1271_DEFAULT_POWER_LEVEL 0
667
787b2dc4
IY
668#define WL1271_TX_QUEUE_LOW_WATERMARK 32
669#define WL1271_TX_QUEUE_HIGH_WATERMARK 256
f5fc0f86 670
a620865e
IY
671#define WL1271_DEFERRED_QUEUE_LIMIT 64
672
01ac17ec
JO
673/* WL1271 needs a 200ms sleep after power on, and a 20ms sleep before power
674 on in case is has been shut down shortly before */
e8a8b252
SW
675#define WL1271_PRE_POWER_ON_SLEEP 20 /* in milliseconds */
676#define WL1271_POWER_ON_SLEEP 200 /* in milliseconds */
f5fc0f86 677
e8b03a2b
SL
678/* Macros to handle wl1271.sta_rate_set */
679#define HW_BG_RATES_MASK 0xffff
680#define HW_HT_RATES_OFFSET 16
681
606ea9fa
IY
682/* Quirks */
683
684/* Each RX/TX transaction requires an end-of-transaction transfer */
0da13da7 685#define WL12XX_QUIRK_END_OF_TRANSACTION BIT(0)
606ea9fa 686
ce39defb
LC
687/* wl127x and SPI don't support SDIO block size alignment */
688#define WL12XX_QUIRK_NO_BLOCKSIZE_ALIGNMENT BIT(2)
e7ddf549 689
95dac04f
IY
690/* Older firmwares did not implement the FW logger over bus feature */
691#define WL12XX_QUIRK_FWLOG_NOT_IMPLEMENTED BIT(4)
692
693#define WL12XX_HW_BLOCK_SIZE 256
694
f5fc0f86 695#endif
This page took 0.469393 seconds and 5 git commands to generate.