This source file includes following definitions.
- wl12xx_vif_to_data
- wl12xx_wlvif_to_vif
- wlcore_is_p2p_mgmt
1
2
3
4
5
6
7
8
9
10
11 #ifndef __WLCORE_I_H__
12 #define __WLCORE_I_H__
13
14 #include <linux/mutex.h>
15 #include <linux/completion.h>
16 #include <linux/spinlock.h>
17 #include <linux/list.h>
18 #include <linux/bitops.h>
19 #include <net/mac80211.h>
20
21 #include "conf.h"
22 #include "ini.h"
23
24 struct wilink_family_data {
25 const char *name;
26 const char *nvs_name;
27 const char *cfg_name;
28 };
29
30 #define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
31 #define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
32 #define WL1271_TX_SQN_POST_RECOVERY_PADDING 0xff
33
34 #define WL1271_TX_SQN_POST_RECOVERY_PADDING_GEM 0x20
35
36
37 #define WL1271_CIPHER_SUITE_GEM 0x00147201
38
39 #define WL1271_BUSY_WORD_CNT 1
40 #define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32))
41
42 #define WL1271_ELP_HW_STATE_ASLEEP 0
43 #define WL1271_ELP_HW_STATE_IRQ 1
44
45 #define WL1271_DEFAULT_BEACON_INT 100
46 #define WL1271_DEFAULT_DTIM_PERIOD 1
47
48 #define WL12XX_MAX_ROLES 4
49 #define WL12XX_INVALID_ROLE_ID 0xff
50 #define WL12XX_INVALID_LINK_ID 0xff
51
52
53
54
55
56 #define WLCORE_MAX_LINKS 16
57
58
59 #define WLCORE_NUM_BANDS 2
60
61 #define WL12XX_MAX_RATE_POLICIES 16
62 #define WLCORE_MAX_KLV_TEMPLATES 4
63
64
65 #define WL12XX_SYSTEM_HLID 0
66
67
68
69
70
71
72
73
74
75 #define WL1271_PS_STA_MAX_PACKETS 2
76
77 #define WL1271_AP_BSS_INDEX 0
78 #define WL1271_AP_DEF_BEACON_EXP 20
79
80 enum wlcore_state {
81 WLCORE_STATE_OFF,
82 WLCORE_STATE_RESTARTING,
83 WLCORE_STATE_ON,
84 };
85
86 enum wl12xx_fw_type {
87 WL12XX_FW_TYPE_NONE,
88 WL12XX_FW_TYPE_NORMAL,
89 WL12XX_FW_TYPE_MULTI,
90 WL12XX_FW_TYPE_PLT,
91 };
92
93 struct wl1271;
94
95 enum {
96 FW_VER_CHIP,
97 FW_VER_IF_TYPE,
98 FW_VER_MAJOR,
99 FW_VER_SUBTYPE,
100 FW_VER_MINOR,
101
102 NUM_FW_VER
103 };
104
105 struct wl1271_chip {
106 u32 id;
107 char fw_ver_str[ETHTOOL_FWVERS_LEN];
108 unsigned int fw_ver[NUM_FW_VER];
109 char phy_fw_ver_str[ETHTOOL_FWVERS_LEN];
110 };
111
112 #define NUM_TX_QUEUES 4
113
114 struct wl_fw_status {
115 u32 intr;
116 u8 fw_rx_counter;
117 u8 drv_rx_counter;
118 u8 tx_results_counter;
119 __le32 *rx_pkt_descs;
120
121 u32 fw_localtime;
122
123
124
125
126
127 u32 link_ps_bitmap;
128
129
130
131
132
133 u32 link_fast_bitmap;
134
135
136 u32 total_released_blks;
137
138
139 u32 tx_total;
140
141 struct {
142
143
144
145
146 u8 *tx_released_pkts;
147
148
149
150
151
152 u8 *tx_lnk_free_pkts;
153
154
155 u8 tx_voice_released_blks;
156
157
158 u8 tx_last_rate;
159
160
161 u8 tx_last_rate_mbps;
162
163
164 u8 hlid;
165 } counters;
166
167 u32 log_start_addr;
168
169
170 void *priv;
171 };
172
173 #define WL1271_MAX_CHANNELS 64
174 struct wl1271_scan {
175 struct cfg80211_scan_request *req;
176 unsigned long scanned_ch[BITS_TO_LONGS(WL1271_MAX_CHANNELS)];
177 bool failed;
178 u8 state;
179 u8 ssid[IEEE80211_MAX_SSID_LEN+1];
180 size_t ssid_len;
181 };
182
183 struct wl1271_if_operations {
184 int __must_check (*read)(struct device *child, int addr, void *buf,
185 size_t len, bool fixed);
186 int __must_check (*write)(struct device *child, int addr, void *buf,
187 size_t len, bool fixed);
188 void (*reset)(struct device *child);
189 void (*init)(struct device *child);
190 int (*power)(struct device *child, bool enable);
191 void (*set_block_size) (struct device *child, unsigned int blksz);
192 };
193
194 struct wlcore_platdev_data {
195 struct wl1271_if_operations *if_ops;
196 const struct wilink_family_data *family;
197
198 bool ref_clock_xtal;
199 u32 ref_clock_freq;
200 u32 tcxo_clock_freq;
201 bool pwr_in_suspend;
202 };
203
204 #define MAX_NUM_KEYS 14
205 #define MAX_KEY_SIZE 32
206
207 struct wl1271_ap_key {
208 u8 id;
209 u8 key_type;
210 u8 key_size;
211 u8 key[MAX_KEY_SIZE];
212 u8 hlid;
213 u32 tx_seq_32;
214 u16 tx_seq_16;
215 };
216
217 enum wl12xx_flags {
218 WL1271_FLAG_GPIO_POWER,
219 WL1271_FLAG_TX_QUEUE_STOPPED,
220 WL1271_FLAG_TX_PENDING,
221 WL1271_FLAG_IN_ELP,
222 WL1271_FLAG_IRQ_RUNNING,
223 WL1271_FLAG_FW_TX_BUSY,
224 WL1271_FLAG_DUMMY_PACKET_PENDING,
225 WL1271_FLAG_SUSPENDED,
226 WL1271_FLAG_PENDING_WORK,
227 WL1271_FLAG_SOFT_GEMINI,
228 WL1271_FLAG_RECOVERY_IN_PROGRESS,
229 WL1271_FLAG_VIF_CHANGE_IN_PROGRESS,
230 WL1271_FLAG_INTENDED_FW_RECOVERY,
231 WL1271_FLAG_IO_FAILED,
232 WL1271_FLAG_REINIT_TX_WDOG,
233 };
234
235 enum wl12xx_vif_flags {
236 WLVIF_FLAG_INITIALIZED,
237 WLVIF_FLAG_STA_ASSOCIATED,
238 WLVIF_FLAG_STA_AUTHORIZED,
239 WLVIF_FLAG_IBSS_JOINED,
240 WLVIF_FLAG_AP_STARTED,
241 WLVIF_FLAG_IN_PS,
242 WLVIF_FLAG_STA_STATE_SENT,
243 WLVIF_FLAG_RX_STREAMING_STARTED,
244 WLVIF_FLAG_PSPOLL_FAILURE,
245 WLVIF_FLAG_CS_PROGRESS,
246 WLVIF_FLAG_AP_PROBE_RESP_SET,
247 WLVIF_FLAG_IN_USE,
248 WLVIF_FLAG_ACTIVE,
249 WLVIF_FLAG_BEACON_DISABLED,
250 };
251
252 struct wl12xx_vif;
253
254 struct wl1271_link {
255
256 struct sk_buff_head tx_queue[NUM_TX_QUEUES];
257
258
259 u8 allocated_pkts;
260 u8 prev_freed_pkts;
261
262 u8 addr[ETH_ALEN];
263
264
265 u8 ba_bitmap;
266
267
268 u8 fw_rate_idx;
269
270
271 u8 fw_rate_mbps;
272
273
274 struct wl12xx_vif *wlvif;
275
276
277
278
279
280
281 u64 total_freed_pkts;
282 };
283
284 #define WL1271_MAX_RX_FILTERS 5
285 #define WL1271_RX_FILTER_MAX_FIELDS 8
286
287 #define WL1271_RX_FILTER_ETH_HEADER_SIZE 14
288 #define WL1271_RX_FILTER_MAX_FIELDS_SIZE 95
289 #define RX_FILTER_FIELD_OVERHEAD \
290 (sizeof(struct wl12xx_rx_filter_field) - sizeof(u8 *))
291 #define WL1271_RX_FILTER_MAX_PATTERN_SIZE \
292 (WL1271_RX_FILTER_MAX_FIELDS_SIZE - RX_FILTER_FIELD_OVERHEAD)
293
294 #define WL1271_RX_FILTER_FLAG_MASK BIT(0)
295 #define WL1271_RX_FILTER_FLAG_IP_HEADER 0
296 #define WL1271_RX_FILTER_FLAG_ETHERNET_HEADER BIT(1)
297
298 enum rx_filter_action {
299 FILTER_DROP = 0,
300 FILTER_SIGNAL = 1,
301 FILTER_FW_HANDLE = 2
302 };
303
304 enum plt_mode {
305 PLT_OFF = 0,
306 PLT_ON = 1,
307 PLT_FEM_DETECT = 2,
308 PLT_CHIP_AWAKE = 3
309 };
310
311 struct wl12xx_rx_filter_field {
312 __le16 offset;
313 u8 len;
314 u8 flags;
315 u8 *pattern;
316 } __packed;
317
318 struct wl12xx_rx_filter {
319 u8 action;
320 int num_fields;
321 struct wl12xx_rx_filter_field fields[WL1271_RX_FILTER_MAX_FIELDS];
322 };
323
324 struct wl1271_station {
325 u8 hlid;
326 bool in_connection;
327
328
329
330
331
332
333
334 u64 total_freed_pkts;
335 };
336
337 struct wl12xx_vif {
338 struct wl1271 *wl;
339 struct list_head list;
340 unsigned long flags;
341 u8 bss_type;
342 u8 p2p;
343 u8 role_id;
344
345
346 u8 dev_role_id;
347 u8 dev_hlid;
348
349 union {
350 struct {
351 u8 hlid;
352
353 u8 basic_rate_idx;
354 u8 ap_rate_idx;
355 u8 p2p_rate_idx;
356
357 u8 klv_template_id;
358
359 bool qos;
360
361 enum nl80211_channel_type role_chan_type;
362 } sta;
363 struct {
364 u8 global_hlid;
365 u8 bcast_hlid;
366
367
368 unsigned long sta_hlid_map[BITS_TO_LONGS(
369 WLCORE_MAX_LINKS)];
370
371
372 struct wl1271_ap_key *recorded_keys[MAX_NUM_KEYS];
373
374 u8 mgmt_rate_idx;
375 u8 bcast_rate_idx;
376 u8 ucast_rate_idx[CONF_TX_MAX_AC_COUNT];
377 } ap;
378 };
379
380
381 int last_tx_hlid;
382
383
384 int tx_queue_count[NUM_TX_QUEUES];
385
386 unsigned long links_map[BITS_TO_LONGS(WLCORE_MAX_LINKS)];
387
388 u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
389 u8 ssid_len;
390
391
392 enum nl80211_band band;
393 int channel;
394 enum nl80211_channel_type channel_type;
395
396 u32 bitrate_masks[WLCORE_NUM_BANDS];
397 u32 basic_rate_set;
398
399
400
401
402
403
404
405 u32 basic_rate;
406 u32 rate_set;
407
408
409 struct sk_buff *probereq;
410
411
412 u32 beacon_int;
413
414
415 u32 default_key;
416
417
418 u16 aid;
419
420
421 u8 psm_entry_retry;
422
423
424 int power_level;
425
426 int rssi_thold;
427 int last_rssi_event;
428
429
430 u8 encryption_type;
431 __be32 ip_addr;
432
433
434 bool ba_support;
435 bool ba_allowed;
436
437 bool wmm_enabled;
438
439 bool radar_enabled;
440
441
442 struct work_struct rx_streaming_enable_work;
443 struct work_struct rx_streaming_disable_work;
444 struct timer_list rx_streaming_timer;
445
446 struct delayed_work channel_switch_work;
447 struct delayed_work connection_loss_work;
448
449
450 int inconn_count;
451
452
453
454
455
456
457
458
459 int hw_queue_base;
460
461
462 bool ap_pending_auth_reply;
463
464
465 unsigned long pending_auth_reply_time;
466
467
468 struct delayed_work pending_auth_complete_work;
469
470
471 enum ieee80211_sta_rx_bandwidth rc_update_bw;
472 struct ieee80211_sta_ht_cap rc_ht_cap;
473 struct work_struct rc_update_work;
474
475
476
477
478
479
480 u64 total_freed_pkts;
481
482
483
484
485
486
487 struct {
488 u8 persistent[0];
489 };
490 };
491
492 static inline struct wl12xx_vif *wl12xx_vif_to_data(struct ieee80211_vif *vif)
493 {
494 WARN_ON(!vif);
495 return (struct wl12xx_vif *)vif->drv_priv;
496 }
497
498 static inline
499 struct ieee80211_vif *wl12xx_wlvif_to_vif(struct wl12xx_vif *wlvif)
500 {
501 return container_of((void *)wlvif, struct ieee80211_vif, drv_priv);
502 }
503
504 static inline bool wlcore_is_p2p_mgmt(struct wl12xx_vif *wlvif)
505 {
506 return wl12xx_wlvif_to_vif(wlvif)->type == NL80211_IFTYPE_P2P_DEVICE;
507 }
508
509 #define wl12xx_for_each_wlvif(wl, wlvif) \
510 list_for_each_entry(wlvif, &wl->wlvif_list, list)
511
512 #define wl12xx_for_each_wlvif_continue(wl, wlvif) \
513 list_for_each_entry_continue(wlvif, &wl->wlvif_list, list)
514
515 #define wl12xx_for_each_wlvif_bss_type(wl, wlvif, _bss_type) \
516 wl12xx_for_each_wlvif(wl, wlvif) \
517 if (wlvif->bss_type == _bss_type)
518
519 #define wl12xx_for_each_wlvif_sta(wl, wlvif) \
520 wl12xx_for_each_wlvif_bss_type(wl, wlvif, BSS_TYPE_STA_BSS)
521
522 #define wl12xx_for_each_wlvif_ap(wl, wlvif) \
523 wl12xx_for_each_wlvif_bss_type(wl, wlvif, BSS_TYPE_AP_BSS)
524
525 int wl1271_plt_start(struct wl1271 *wl, const enum plt_mode plt_mode);
526 int wl1271_plt_stop(struct wl1271 *wl);
527 int wl1271_recalc_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif);
528 void wl12xx_queue_recovery_work(struct wl1271 *wl);
529 size_t wl12xx_copy_fwlog(struct wl1271 *wl, u8 *memblock, size_t maxlen);
530 int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter,
531 u16 offset, u8 flags,
532 const u8 *pattern, u8 len);
533 void wl1271_rx_filter_free(struct wl12xx_rx_filter *filter);
534 struct wl12xx_rx_filter *wl1271_rx_filter_alloc(void);
535 int wl1271_rx_filter_get_fields_size(struct wl12xx_rx_filter *filter);
536 void wl1271_rx_filter_flatten_fields(struct wl12xx_rx_filter *filter,
537 u8 *buf);
538
539 #define JOIN_TIMEOUT 5000
540
541 #define SESSION_COUNTER_MAX 6
542 #define SESSION_COUNTER_INVALID 7
543
544 #define WL1271_DEFAULT_POWER_LEVEL 0
545
546 #define WL1271_TX_QUEUE_LOW_WATERMARK 32
547 #define WL1271_TX_QUEUE_HIGH_WATERMARK 256
548
549 #define WL1271_DEFERRED_QUEUE_LIMIT 64
550
551
552
553 #define WL1271_PRE_POWER_ON_SLEEP 20
554 #define WL1271_POWER_ON_SLEEP 200
555
556
557 #define HW_BG_RATES_MASK 0xffff
558 #define HW_HT_RATES_OFFSET 16
559 #define HW_MIMO_RATES_OFFSET 24
560
561 #endif