1 /*
2 * wsm interfaces for XRadio drivers
3 *
4 * Copyright (c) 2013
5 * Xradio Technology Co., Ltd. <www.xradiotech.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12 #ifndef XRADIO_WSM_H_INCLUDED
13 #define XRADIO_WSM_H_INCLUDED
14
15 #include <linux/spinlock.h>
16
17 struct xradio_common;
18
19 #define WSM_MSG_ID_MASK (0x0C3F)
20
21 /* Bands */
22 /* Radio band 2.412 -2.484 GHz. */
23 #define WSM_PHY_BAND_2_4G (0)
24
25 /* Radio band 4.9375-5.8250 GHz. */
26 #define WSM_PHY_BAND_5G (1)
27
28 /* Transmit rates */
29 /* 1 Mbps ERP-DSSS */
30 #define WSM_TRANSMIT_RATE_1 (0)
31
32 /* 2 Mbps ERP-DSSS */
33 #define WSM_TRANSMIT_RATE_2 (1)
34
35 /* 5.5 Mbps ERP-CCK, ERP-PBCC (Not supported) */
36 /* #define WSM_TRANSMIT_RATE_5 (2) */
37
38 /* 11 Mbps ERP-CCK, ERP-PBCC (Not supported) */
39 /* #define WSM_TRANSMIT_RATE_11 (3) */
40
41 /* 22 Mbps ERP-PBCC (Not supported) */
42 /* #define WSM_TRANSMIT_RATE_22 (4) */
43
44 /* 33 Mbps ERP-PBCC (Not supported) */
45 /* #define WSM_TRANSMIT_RATE_33 (5) */
46
47 /* 6 Mbps (3 Mbps) ERP-OFDM, BPSK coding rate 1/2 */
48 #define WSM_TRANSMIT_RATE_6 (6)
49
50 /* 9 Mbps (4.5 Mbps) ERP-OFDM, BPSK coding rate 3/4 */
51 #define WSM_TRANSMIT_RATE_9 (7)
52
53 /* 12 Mbps (6 Mbps) ERP-OFDM, QPSK coding rate 1/2 */
54 #define WSM_TRANSMIT_RATE_12 (8)
55
56 /* 18 Mbps (9 Mbps) ERP-OFDM, QPSK coding rate 3/4 */
57 #define WSM_TRANSMIT_RATE_18 (9)
58
59 /* 24 Mbps (12 Mbps) ERP-OFDM, 16QAM coding rate 1/2 */
60 #define WSM_TRANSMIT_RATE_24 (10)
61
62 /* 36 Mbps (18 Mbps) ERP-OFDM, 16QAM coding rate 3/4 */
63 #define WSM_TRANSMIT_RATE_36 (11)
64
65 /* 48 Mbps (24 Mbps) ERP-OFDM, 64QAM coding rate 1/2 */
66 #define WSM_TRANSMIT_RATE_48 (12)
67
68 /* 54 Mbps (27 Mbps) ERP-OFDM, 64QAM coding rate 3/4 */
69 #define WSM_TRANSMIT_RATE_54 (13)
70
71 /* 6.5 Mbps HT-OFDM, BPSK coding rate 1/2 */
72 #define WSM_TRANSMIT_RATE_HT_6 (14)
73
74 /* 13 Mbps HT-OFDM, QPSK coding rate 1/2 */
75 #define WSM_TRANSMIT_RATE_HT_13 (15)
76
77 /* 19.5 Mbps HT-OFDM, QPSK coding rate 3/4 */
78 #define WSM_TRANSMIT_RATE_HT_19 (16)
79
80 /* 26 Mbps HT-OFDM, 16QAM coding rate 1/2 */
81 #define WSM_TRANSMIT_RATE_HT_26 (17)
82
83 /* 39 Mbps HT-OFDM, 16QAM coding rate 3/4 */
84 #define WSM_TRANSMIT_RATE_HT_39 (18)
85
86 /* 52 Mbps HT-OFDM, 64QAM coding rate 2/3 */
87 #define WSM_TRANSMIT_RATE_HT_52 (19)
88
89 /* 58.5 Mbps HT-OFDM, 64QAM coding rate 3/4 */
90 #define WSM_TRANSMIT_RATE_HT_58 (20)
91
92 /* 65 Mbps HT-OFDM, 64QAM coding rate 5/6 */
93 #define WSM_TRANSMIT_RATE_HT_65 (21)
94
95 /* Scan types */
96 /* Foreground scan */
97 #define WSM_SCAN_TYPE_FOREGROUND (0)
98
99 /* Background scan */
100 #define WSM_SCAN_TYPE_BACKGROUND (1)
101
102 /* Auto scan */
103 #define WSM_SCAN_TYPE_AUTO (2)
104
105 /* Scan flags */
106 /* Forced background scan means if the station cannot */
107 /* enter the power-save mode, it shall force to perform a */
108 /* background scan. Only valid when ScanType is */
109 /* background scan. */
110 #define WSM_SCAN_FLAG_FORCE_BACKGROUND (BIT(0))
111
112 /* The WLAN device scans one channel at a time so */
113 /* that disturbance to the data traffic is minimized. */
114 #define WSM_SCAN_FLAG_SPLIT_METHOD (BIT(1))
115
116 /* Preamble Type. Long if not set. */
117 #define WSM_SCAN_FLAG_SHORT_PREAMBLE (BIT(2))
118
119 /* 11n Tx Mode. Mixed if not set. */
120 #define WSM_SCAN_FLAG_11N_GREENFIELD (BIT(3))
121
122 #define WSM_FLAG_MAC_INSTANCE_1 (BIT(4))
123
124 #define WSM_FLAG_MAC_INSTANCE_0 (~(BIT(4)))
125
126 /* Scan constraints */
127 /* Maximum number of channels to be scanned. */
128 #define WSM_SCAN_MAX_NUM_OF_CHANNELS (48)
129
130 /* The maximum number of SSIDs that the device can scan for. */
131 #define WSM_SCAN_MAX_NUM_OF_SSIDS (2)
132 #ifdef CONFIG_XRADIO_TESTMODE
133 /* Transmit flags */
134 /* Start Expiry time from the receipt of tx request */
135 #define WSM_TX_FLAG_EXPIRY_TIME (BIT(0))
136 #endif /*CONFIG_XRADIO_TESTMODE*/
137
138 /* Power management modes */
139 /* 802.11 Active mode */
140 #define WSM_PSM_ACTIVE (0)
141
142 /* 802.11 PS mode */
143 #define WSM_PSM_PS BIT(0)
144
145 /* Fast Power Save bit */
146 #define WSM_PSM_FAST_PS_FLAG BIT(7)
147
148 /* IP ALLOCATED bit, used to control firmware power-save state */
149 #define WSM_PSM_IP_ALLOCATED BIT(2)
150
151 /* Dynamic aka Fast power save */
152 #define WSM_PSM_FAST_PS (BIT(0) | BIT(7))
153
154 /* Undetermined */
155 /* Note : Undetermined status is reported when the */
156 /* NULL data frame used to advertise the PM mode to */
157 /* the AP at Pre or Post Background Scan is not Acknowledged */
158 #define WSM_PSM_UNKNOWN BIT(1)
159
160 /* Queue IDs */
161 /* best effort/legacy */
162 #define WSM_QUEUE_BEST_EFFORT (0)
163
164 /* background */
165 #define WSM_QUEUE_BACKGROUND (1)
166
167 /* video */
168 #define WSM_QUEUE_VIDEO (2)
169
170 /* voice */
171 #define WSM_QUEUE_VOICE (3)
172
173 /* HT TX parameters */
174 /* Non-HT */
175 #define WSM_HT_TX_NON_HT (0)
176
177 /* Mixed format */
178 #define WSM_HT_TX_MIXED (1)
179
180 /* Greenfield format */
181 #define WSM_HT_TX_GREENFIELD (2)
182
183 /* STBC allowed */
184 #define WSM_HT_TX_STBC (BIT(7))
185
186 /* EPTA prioirty flags for BT Coex */
187 /* default epta priority */
188 #define WSM_EPTA_PRIORITY_DEFAULT 4
189 /* use for normal data */
190 #define WSM_EPTA_PRIORITY_DATA 4
191 /* use for connect/disconnect/roaming*/
192 #define WSM_EPTA_PRIORITY_MGT 5
193 /* use for action frames */
194 #define WSM_EPTA_PRIORITY_ACTION 5
195 /* use for AC_VI data */
196 #define WSM_EPTA_PRIORITY_VIDEO 5
197 /* use for AC_VO data */
198 #define WSM_EPTA_PRIORITY_VOICE 6
199 /* use for EAPOL exchange */
200 #define WSM_EPTA_PRIORITY_EAPOL 7
201
202 /* TX status */
203 /* Frame was sent aggregated */
204 /* Only valid for WSM_SUCCESS status. */
205 #define WSM_TX_STATUS_AGGREGATION (BIT(0))
206
207 /* Host should requeue this frame later. */
208 /* Valid only when status is WSM_REQUEUE. */
209 #define WSM_TX_STATUS_REQUEUE (BIT(1))
210
211 /* Normal Ack */
212 #define WSM_TX_STATUS_NORMAL_ACK (0<<2)
213
214 /* No Ack */
215 #define WSM_TX_STATUS_NO_ACK (1<<2)
216
217 /* No explicit acknowledgement */
218 #define WSM_TX_STATUS_NO_EXPLICIT_ACK (2<<2)
219
220 /* Block Ack */
221 /* Only valid for WSM_SUCCESS status. */
222 #define WSM_TX_STATUS_BLOCK_ACK (3<<2)
223
224 /* RX status */
225 /* Unencrypted */
226 #define WSM_RX_STATUS_UNENCRYPTED (0<<0)
227
228 /* WEP */
229 #define WSM_RX_STATUS_WEP (1<<0)
230
231 /* TKIP */
232 #define WSM_RX_STATUS_TKIP (2<<0)
233
234 /* AES */
235 #define WSM_RX_STATUS_AES (3<<0)
236
237 /* WAPI */
238 #define WSM_RX_STATUS_WAPI (4<<0)
239
240 /* Macro to fetch encryption subfield. */
241 #define WSM_RX_STATUS_ENCRYPTION(status) ((status) & 0x07)
242
243 /* Frame was part of an aggregation */
244 #define WSM_RX_STATUS_AGGREGATE (BIT(3))
245
246 /* Frame was first in the aggregation */
247 #define WSM_RX_STATUS_AGGREGATE_FIRST (BIT(4))
248
249 /* Frame was last in the aggregation */
250 #define WSM_RX_STATUS_AGGREGATE_LAST (BIT(5))
251
252 /* Indicates a defragmented frame */
253 #define WSM_RX_STATUS_DEFRAGMENTED (BIT(6))
254
255 /* Indicates a Beacon frame */
256 #define WSM_RX_STATUS_BEACON (BIT(7))
257
258 /* Indicates STA bit beacon TIM field */
259 #define WSM_RX_STATUS_TIM (BIT(8))
260
261 /* Indicates Beacon frame's virtual bitmap contains multicast bit */
262 #define WSM_RX_STATUS_MULTICAST (BIT(9))
263
264 /* Indicates frame contains a matching SSID */
265 #define WSM_RX_STATUS_MATCHING_SSID (BIT(10))
266
267 /* Indicates frame contains a matching BSSI */
268 #define WSM_RX_STATUS_MATCHING_BSSI (BIT(11))
269
270 /* Indicates More bit set in Framectl field */
271 #define WSM_RX_STATUS_MORE_DATA (BIT(12))
272
273 /* Indicates frame received during a measurement process */
274 #define WSM_RX_STATUS_MEASUREMENT (BIT(13))
275
276 /* Indicates frame received as an HT packet */
277 #define WSM_RX_STATUS_HT (BIT(14))
278
279 /* Indicates frame received with STBC */
280 #define WSM_RX_STATUS_STBC (BIT(15))
281
282 /* Indicates Address 1 field matches dot11StationId */
283 #define WSM_RX_STATUS_ADDRESS1 (BIT(16))
284
285 /* Indicates Group address present in the Address 1 field */
286 #define WSM_RX_STATUS_GROUP (BIT(17))
287
288 /* Indicates Broadcast address present in the Address 1 field */
289 #define WSM_RX_STATUS_BROADCAST (BIT(18))
290
291 /* Indicates group key used with encrypted frames */
292 #define WSM_RX_STATUS_GROUP_KEY (BIT(19))
293
294 /* Macro to fetch encryption key index. */
295 #define WSM_RX_STATUS_KEY_IDX(status) (((status) >> 20) & 0x0F)
296
297 #ifdef SUPPORT_HT40
298
299 #define WSM_RX_LINK_ID_GET(f) (((f) >> 25) & 0x0f) /* bit28:25 */
300
301 #define WSM_RX_BANDWIDTH_GET(f) (((f) >> 29) & 0x03) /* bit30:29 */
302 #define WSM_RX_BANDWIDTH_20M 0x0
303 #define WSM_RX_BANDWIDTH_40M 0x1
304 #define WSM_RX_BANDWIDTH_80M 0x2
305
306 #endif
307
308 /* Frame Control field starts at Frame offset + 2 */
309 #define WSM_TX_2BYTES_SHIFT (BIT(7))
310
311 /* Join mode */
312 /* IBSS */
313 #define WSM_JOIN_MODE_IBSS (0)
314
315 /* BSS */
316 #define WSM_JOIN_MODE_BSS (1)
317
318 /* PLCP preamble type */
319 /* For long preamble */
320 #define WSM_JOIN_PREAMBLE_LONG (0)
321
322 /* For short preamble (Long for 1Mbps) */
323 #define WSM_JOIN_PREAMBLE_SHORT (1)
324
325 /* For short preamble (Long for 1 and 2Mbps) */
326 #define WSM_JOIN_PREAMBLE_SHORT_2 (2)
327
328 /* Join flags */
329 /* Unsynchronized */
330 #define WSM_JOIN_FLAGS_UNSYNCRONIZED BIT(0)
331 /* The BSS owner is a P2P GO */
332 #define WSM_JOIN_FLAGS_P2P_GO BIT(1)
333 /* Force to join BSS with the BSSID and the
334 * SSID specified without waiting for beacons. The
335 * ProbeForJoin parameter is ignored. */
336 #define WSM_JOIN_FLAGS_FORCE BIT(2)
337 /* Give probe request/response higher
338 * priority over the BT traffic */
339 #define WSM_JOIN_FLAGS_PRIO BIT(3)
340
341 /* Key types */
342 #define WSM_KEY_TYPE_WEP_DEFAULT (0)
343 #define WSM_KEY_TYPE_WEP_PAIRWISE (1)
344 #define WSM_KEY_TYPE_TKIP_GROUP (2)
345 #define WSM_KEY_TYPE_TKIP_PAIRWISE (3)
346 #define WSM_KEY_TYPE_AES_GROUP (4)
347 #define WSM_KEY_TYPE_AES_PAIRWISE (5)
348 #define WSM_KEY_TYPE_WAPI_GROUP (6)
349 #define WSM_KEY_TYPE_WAPI_PAIRWISE (7)
350 #define WSM_KEY_TYPE_IGTK_GROUP (8)
351
352 /* Key indexes */
353 #define WSM_KEY_MAX_INDEX (10)
354
355 /* ACK policy */
356 #define WSM_ACK_POLICY_NORMAL (0)
357 #define WSM_ACK_POLICY_NO_ACK (1)
358
359 /* Start modes */
360 #define WSM_START_MODE_AP (0) /* Mini AP */
361 #define WSM_START_MODE_P2P_GO (1) /* P2P GO */
362 #define WSM_START_MODE_P2P_DEV (2) /* P2P device */
363 #define WSM_START_MODE_MONITOR (3) /* Monitor */
364
365 /* SetAssociationMode MIB flags */
366 #ifdef SUPPORT_HT40
367
368 #define WSM_ASSOCIATION_MODE_USE_PHY_MODE_CFG (BIT(0))
369 #define WSM_ASSOCIATION_MODE_USE_BASIC_RATE_SET (BIT(1))
370 #define WSM_ASSOCIATION_MODE_USE_MPDU_START_SPACING (BIT(2))
371
372 #else
373
374 #define WSM_ASSOCIATION_MODE_USE_PREAMBLE_TYPE (BIT(0))
375 #define WSM_ASSOCIATION_MODE_USE_HT_MODE (BIT(1))
376 #define WSM_ASSOCIATION_MODE_USE_BASIC_RATE_SET (BIT(2))
377 #define WSM_ASSOCIATION_MODE_USE_MPDU_START_SPACING (BIT(3))
378 #define WSM_ASSOCIATION_MODE_SNOOP_ASSOC_FRAMES (BIT(4))
379
380 #endif
381
382 /* RcpiRssiThreshold MIB flags */
383 #define WSM_RCPI_RSSI_THRESHOLD_ENABLE (BIT(0))
384 #define WSM_RCPI_RSSI_USE_RSSI (BIT(1))
385 #define WSM_RCPI_RSSI_DONT_USE_UPPER (BIT(2))
386 #define WSM_RCPI_RSSI_DONT_USE_LOWER (BIT(3))
387
388 /* Update-ie constants */
389 #define WSM_UPDATE_IE_BEACON (BIT(0))
390 #define WSM_UPDATE_IE_PROBE_RESP (BIT(1))
391 #define WSM_UPDATE_IE_PROBE_REQ (BIT(2))
392
393 /* BT defines */
394 #define BT_LINK_TPYE_INQUIRY 9
395 #define BT_LINK_TYPE_DEFAULT 73
396 #define BT_MAX_BLOCK_TIME 15000 /* ms */
397
398 /* WSM events */
399 /* Error */
400 #define WSM_EVENT_ERROR (0)
401
402 /* BSS lost */
403 #define WSM_EVENT_BSS_LOST (1)
404
405 /* BSS regained */
406 #define WSM_EVENT_BSS_REGAINED (2)
407
408 /* Radar detected */
409 #define WSM_EVENT_RADAR_DETECTED (3)
410
411 /* RCPI or RSSI threshold triggered */
412 #define WSM_EVENT_RCPI_RSSI (4)
413
414 /* BT inactive */
415 #define WSM_EVENT_BT_INACTIVE (5)
416
417 /* BT active */
418 #define WSM_EVENT_BT_ACTIVE (6)
419
420 #define WSM_EVENT_PS_MODE_ERROR (7)
421
422 #define WSM_EVENT_PAS_EVENT (8)
423
424 #define WSM_EVENT_INACTIVITY (9)
425
426 /* MAC Addr Filter */
427 #define WSM_MIB_ID_MAC_ADDR_FILTER 0x1030
428
429 /* MIB IDs */
430 /* 4.1 dot11StationId */
431 #define WSM_MIB_ID_DOT11_STATION_ID 0x0000
432
433 /* 4.2 dot11MaxtransmitMsduLifeTime */
434 #define WSM_MIB_ID_DOT11_MAX_TRANSMIT_LIFTIME 0x0001
435
436 /* 4.3 dot11MaxReceiveLifeTime */
437 #define WSM_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME 0x0002
438
439 /* 4.4 dot11SlotTime */
440 #define WSM_MIB_ID_DOT11_SLOT_TIME 0x0003
441
442 /* 4.5 dot11GroupAddressesTable */
443 #define WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE 0x0004
444 #define WSM_MAX_GRP_ADDRTABLE_ENTRIES 8
445
446 /* 4.6 dot11WepDefaultKeyId */
447 #define WSM_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID 0x0005
448
449 /* 4.7 dot11CurrentTxPowerLevel */
450 #define WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL 0x0006
451
452 /* 4.8 dot11RTSThreshold */
453 #define WSM_MIB_ID_DOT11_RTS_THRESHOLD 0x0007
454
455 /* Huanglu add for firmware debug control */
456 #define WSM_MIB_ID_FW_DEBUG_CONTROL 0x0008
457
458 /* for read/write registers from firmware*/
459 #define WSM_MIB_ID_RW_FW_REG 0x0009
460
461 /* for Set max number of mpdus in a-mpdu*/
462 #define WSM_MIB_ID_SET_AMPDU_NUM 0x000a
463
464 /* for tx-ampdu-len-adaption */
465 #define WSM_MIB_ID_SET_TALA_PARA 0x000b
466
467 /* for set TPA param */
468 #define WSM_MIB_ID_SET_TPA_PARAM 0x000c
469
470 /* 4.9 NonErpProtection */
471 #define WSM_MIB_ID_NON_ERP_PROTECTION 0x1000
472
473 /* 4.10 ArpIpAddressesTable */
474 #define WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE 0x1001
475 #define WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES 1
476
477 /* 4.11 TemplateFrame */
478 #define WSM_MIB_ID_TEMPLATE_FRAME 0x1002
479
480 /* 4.12 RxFilter */
481 #define WSM_MIB_ID_RX_FILTER 0x1003
482
483 /* 4.13 BeaconFilterTable */
484 #define WSM_MIB_ID_BEACON_FILTER_TABLE 0x1004
485
486 /* 4.14 BeaconFilterEnable */
487 #define WSM_MIB_ID_BEACON_FILTER_ENABLE 0x1005
488
489 /* 4.15 OperationalPowerMode */
490 #define WSM_MIB_ID_OPERATIONAL_POWER_MODE 0x1006
491
492 /* 4.16 BeaconWakeUpPeriod */
493 #define WSM_MIB_ID_BEACON_WAKEUP_PERIOD 0x1007
494
495 /* 4.17 RcpiRssiThreshold */
496 #define WSM_MIB_ID_RCPI_RSSI_THRESHOLD 0x1009
497
498 /* 4.18 StatisticsTable */
499 #define WSM_MIB_ID_STATISTICS_TABLE 0x100A
500
501 /* 4.19 IbssPsConfig */
502 #define WSM_MIB_ID_IBSS_PS_CONFIG 0x100B
503
504 /* 4.20 CountersTable */
505 #define WSM_MIB_ID_COUNTERS_TABLE 0x100C
506 #define WSM_MIB_ID_AMPDUCOUNTERS_TABLE 0x1036
507 #define WSM_MIB_ID_TXPIPE_TABLE 0x1037
508 #define WSM_MIB_ID_BACKOFF_DBG 0x1038
509 #define WSM_MIB_ID_BACKOFF_CTRL 0x1039
510
511 /*requery packet status*/
512 #define WSM_MIB_ID_REQ_PKT_STATUS 0x1040
513
514 /*TPA debug informations*/
515 #define WSM_MIB_ID_TPA_DEBUG_INFO 0x1041
516
517 /*tx power informations*/
518 #define WSM_MIB_ID_TX_POWER_INFO 0x1042
519
520 /*some hardware information*/
521 #define WSM_MIB_ID_HW_INFO 0x1043
522
523 /*use for changing mac address of interface*/
524 #define WSM_MIB_ID_CHANGE_MAC 0x1046
525
526 /*epta status information*/
527 #define WSM_MIB_ID_EPTA_STAT 0x1060
528 #define WSM_MIB_ID_EPTA_STAT_CTRL 0x1061
529
530 /*get device temperature*/
531 #define WSM_MIB_ID_GET_TEMPERATURE 0x1080
532
533 /* 4.21 BlockAckPolicy */
534 #define WSM_MIB_ID_BLOCK_ACK_POLICY 0x100E
535
536 /* 4.22 OverrideInternalTxRate */
537 #define WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE 0x100F
538
539 /* 4.23 SetAssociationMode */
540 #define WSM_MIB_ID_SET_ASSOCIATION_MODE 0x1010
541
542 /* 4.24 UpdateEptaConfigData */
543 #define WSM_MIB_ID_UPDATE_EPTA_CONFIG_DATA 0x1011
544
545 /* 4.25 SelectCcaMethod */
546 #define WSM_MIB_ID_SELECT_CCA_METHOD 0x1012
547
548 /* 4.26 SetUpasdInformation */
549 #define WSM_MIB_ID_SET_UAPSD_INFORMATION 0x1013
550
551 /* 4.27 SetAutoCalibrationMode WBF00004073 */
552 #define WSM_MIB_ID_SET_AUTO_CALIBRATION_MODE 0x1015
553
554 /* 4.28 SetTxRateRetryPolicy */
555 #define WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY 0x1016
556
557 /* 4.29 SetHostMessageTypeFilter */
558 #define WSM_MIB_ID_SET_HOST_MSG_TYPE_FILTER 0x1017
559
560 /* 4.30 P2PFindInfo */
561 #define WSM_MIB_ID_P2P_FIND_INFO 0x1018
562
563 /* 4.31 P2PPsModeInfo */
564 #define WSM_MIB_ID_P2P_PS_MODE_INFO 0x1019
565
566 /* 4.32 SetEtherTypeDataFrameFilter */
567 #define WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER 0x101A
568
569 /* 4.33 SetUDPPortDataFrameFilter */
570 #define WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER 0x101B
571
572 /* 4.34 SetMagicDataFrameFilter */
573 #define WSM_MIB_ID_SET_MAGIC_DATAFRAME_FILTER 0x101C
574 #define WSM_MIB_ID_SET_HOST_SLEEP 0x1050
575
576 /* This is the end of specification. */
577
578 /* 4.35 P2PDeviceInfo */
579 #define WSM_MIB_ID_P2P_DEVICE_INFO 0x101D
580
581 /* 4.36 SetWCDMABand */
582 #define WSM_MIB_ID_SET_WCDMA_BAND 0x101E
583
584 /* 4.37 GroupTxSequenceCounter */
585 #define WSM_MIB_ID_GRP_SEQ_COUNTER 0x101F
586
587 /* 4.38 ProtectedMgmtPolicy */
588 #define WSM_MIB_ID_PROTECTED_MGMT_POLICY 0x1020
589
590 /* 4.39 SetHtProtection */
591 #define WSM_MID_ID_SET_HT_PROTECTION 0x1021
592
593 /* 4.40 GPIO Command */
594 #define WSM_MIB_ID_GPIO_COMMAND 0x1022
595
596 /* 4.41 TSF Counter Value */
597 #define WSM_MIB_ID_TSF_COUNTER 0x1023
598
599 /* Test Purposes Only */
600 #define WSM_MIB_ID_BLOCK_ACK_INFO 0x100D
601
602 /* 4.42 UseMultiTxConfMessage */
603 #define WSM_MIB_USE_MULTI_TX_CONF 0x1024
604
605 /* 4.43 Keep-alive period */
606 #define WSM_MIB_ID_KEEP_ALIVE_PERIOD 0x1025
607
608 /* 4.44 Disable BSSID filter */
609 #define WSM_MIB_ID_DISABLE_BSSID_FILTER 0x1026
610
611 /* Inactivity */
612 #define WSM_MIB_ID_SET_INACTIVITY 0x1035
613
614 /* MAC Addr Filter */
615 #define WSM_MIB_ID_MAC_ADDR_FILTER 0x1030
616
617 #ifdef MCAST_FWDING
618 /* 4.51 Set Forwarding Offload */
619 #define WSM_MIB_ID_FORWARDING_OFFLOAD 0x1033
620 #endif
621
622 #ifdef IPV6_FILTERING
623 /* IpV6 Addr Filter */
624 /* 4.52 Neighbor solicitation IPv6 address table */
625 #define WSM_MIB_IP_IPV6_ADDR_FILTER 0x1032
626 #define WSM_MIB_ID_NS_IP_ADDRESSES_TABLE 0x1034
627 #define WSM_MAX_NDP_IP_ADDRTABLE_ENTRIES 1
628 #endif /*IPV6_FILTERING*/
629
630 /* Frame template types */
631 #define WSM_FRAME_TYPE_PROBE_REQUEST (0)
632 #define WSM_FRAME_TYPE_BEACON (1)
633 #define WSM_FRAME_TYPE_NULL (2)
634 #define WSM_FRAME_TYPE_QOS_NULL (3)
635 #define WSM_FRAME_TYPE_PS_POLL (4)
636 #define WSM_FRAME_TYPE_PROBE_RESPONSE (5)
637 #define WSM_FRAME_TYPE_ARP_REPLY (6)
638
639 #ifdef IPV6_FILTERING
640 #define WSM_FRAME_TYPE_NA (7)
641 #endif /*IPV6_FILTERING*/
642
643 #define WSM_FRAME_GREENFIELD (0x80) /* See 4.11 */
644
645 /* Status */
646 /* The WSM firmware has completed a request */
647 /* successfully. */
648 #define WSM_STATUS_SUCCESS (0)
649
650 /* This is a generic failure code if other error codes do */
651 /* not apply. */
652 #define WSM_STATUS_FAILURE (1)
653
654 /* A request contains one or more invalid parameters. */
655 #define WSM_INVALID_PARAMETER (2)
656
657 /* The request cannot perform because the device is in */
658 /* an inappropriate mode. */
659 #define WSM_ACCESS_DENIED (3)
660
661 /* The frame received includes a decryption error. */
662 #define WSM_STATUS_DECRYPTFAILURE (4)
663
664 /* A MIC failure is detected in the received packets. */
665 #define WSM_STATUS_MICFAILURE (5)
666
667 /* The transmit request failed due to retry limit being */
668 /* exceeded. */
669 #define WSM_STATUS_RETRY_EXCEEDED (6)
670
671 /* The transmit request failed due to MSDU life time */
672 /* being exceeded. */
673 #define WSM_STATUS_TX_LIFETIME_EXCEEDED (7)
674
675 /* The link to the AP is lost. */
676 #define WSM_STATUS_LINK_LOST (8)
677
678 /* No key was found for the encrypted frame */
679 #define WSM_STATUS_NO_KEY_FOUND (9)
680
681 /* Jammer was detected when transmitting this frame */
682 #define WSM_STATUS_JAMMER_DETECTED (10)
683
684 /* The message should be requeued later. */
685 /* This is applicable only to Transmit */
686 #define WSM_REQUEUE (11)
687
688 /* Advanced filtering options */
689 #define WSM_MAX_FILTER_ELEMENTS (4)
690
691 #define WSM_FILTER_ACTION_IGNORE (0)
692 #define WSM_FILTER_ACTION_FILTER_IN (1)
693 #define WSM_FILTER_ACTION_FILTER_OUT (2)
694
695 #define WSM_FILTER_PORT_TYPE_DST (0)
696 #define WSM_FILTER_PORT_TYPE_SRC (1)
697
698
699
700 struct wsm_hdr {
701 __le16 len;
702 __le16 id;
703 };
704
705 #define WSM_TX_SEQ_MAX (7)
706 #define WSM_TX_SEQ(seq) \
707 ((seq & WSM_TX_SEQ_MAX) << 13)
708 #define WSM_TX_LINK_ID_MAX (0x0F)
709 #define WSM_TX_LINK_ID(link_id) \
710 ((link_id & WSM_TX_LINK_ID_MAX) << 6)
711
712 #define WSM_TX_IF_ID_MAX (0x0F)
713 #define WSM_TX_IF_ID(if_id) \
714 ((if_id & WSM_TX_IF_ID_MAX) << 6)
715
716 #define MAX_BEACON_SKIP_TIME_MS 1000
717
718 #ifdef FPGA_SETUP
719 #define WSM_CMD_LAST_CHANCE_TIMEOUT (HZ * 9 / 2)
720 #else
721 #define WSM_CMD_LAST_CHANCE_TIMEOUT (HZ * 15)
722 #endif
723 #define WSM_CMD_EXTENDED_TIMEOUT (HZ * 20 / 2)
724
725 #define WSM_RI_GET_PEER_ID_FROM_FLAGS(_f) (((_f)&(0xF<<25)>>25))
726
727
728 /* ******************************************************************** */
729
730 #ifdef SUPPORT_HT40
731
732 #define MODEM_F_B_DSSS (0x01)
733 #define MODEM_F_A_OFDM (0x02)
734 #define MODEM_F_N_OFDM (0x04)
735 #define MODEM_F_V_OFDM (0x08)
736
737 #define PRIMARY_CH_1ST (0x00)
738 #define PRIMARY_CH_2ND (0x01)
739 #define PRIMARY_CH_3RD (0x02)
740 #define PRIMARY_CH_4TH (0x03)
741
742 #define PREAMBLE_L (0x00)
743 #define PREAMBLE_S_L1 (0x01)
744 #define PREAMBLE_S_L12 (0x02)
745
746 #define CHAN_WIDTH_20MHz (0x00)
747 #define CHAN_WIDTH_10MHz (0x01)
748 #define CHAN_WIDTH_40MHz (0x02)
749
750 struct phy_mode_cfg {
751 u16 ModemFlags:4,
752 ChWidthCfg:2,
753 PriChCfg:2,
754 BandCfg:1,
755 Reserved:2,
756 STBC_Enable:1,
757 PreambleCfg:2,
758 SGI_Enable:1,
759 GF_Enable:1;
760 };
761
762 #endif
763
764 /* ******************************************************************** */
765 /* WSM capcbility */
766 #define WSM_FW_LABEL 128
767 struct wsm_caps {
768 u16 numInpChBufs;
769 u16 sizeInpChBuf;
770 u16 hardwareId;
771 u16 hardwareSubId;
772 u16 firmwareCap;
773 u16 firmwareType;
774 u16 firmwareApiVer;
775 u16 firmwareBuildNumber;
776 u16 firmwareVersion;
777 char fw_label[WSM_FW_LABEL+2];
778 u32 firmwareConfig[4];
779 int firmwareReady;
780 };
wsm_version(u32 ver,u32 build)781 static inline u32 wsm_version(u32 ver, u32 build)
782 {
783 return (u32)((ver<<16) | build);
784 }
785 #define GET_WSM_VERSION(wsm) wsm_version(wsm.firmwareVersion, wsm.firmwareBuildNumber)
786 #define WSM_VERSION_BF(wsm, v, b) (GET_WSM_VERSION(wsm) < wsm_version(v, b))
787 #define WSM_VERSION_AF(wsm, v, b) (GET_WSM_VERSION(wsm) > wsm_version(v, b))
788 #define WSM_VERSION_EQ(wsm, v, b) (GET_WSM_VERSION(wsm) == wsm_version(v, b))
789
790 #define WSM_CAPS_2_4_GHZ(wsm) (wsm.firmwareCap & (1<<0))
791 #define WSM_CAPS_5_0_GHZ(wsm) (wsm.firmwareCap & (1<<1))
792 #define WSM_CAPS_11N_TO_11BG(wsm) (wsm.firmwareCap & (1<<5))
793
794 /* ******************************************************************** */
795 /* WSM commands */
796
797 struct wsm_tx_power_range {
798 int min_power_level;
799 int max_power_level;
800 u32 stepping;
801 };
802
803 /* 3.1 */
804 struct wsm_configuration {
805 /* [in] */ u32 dot11MaxTransmitMsduLifeTime;
806 /* [in] */ u32 dot11MaxReceiveLifeTime;
807 /* [in] */ u32 dot11RtsThreshold;
808 /* [in, out] */ u8 *dot11StationId;
809 /* [in] */ const void *dpdData;
810 /* [in] */ size_t dpdData_size;
811 /* [out] */ u8 dot11FrequencyBandsSupported;
812 /* [out] */ u32 supportedRateMask;
813 /* [out] */ struct wsm_tx_power_range txPowerRange[2];
814 };
815
816 int wsm_configuration(struct xradio_common *hw_priv,
817 struct wsm_configuration *arg,
818 int if_id);
819
820 /* 3.3 */
821 struct wsm_reset {
822 /* [in] */ int link_id;
823 /* [in] */ bool reset_statistics;
824 };
825
826 int wsm_reset(struct xradio_common *hw_priv, const struct wsm_reset *arg,
827 int if_id);
828 void wsm_upper_restart(struct xradio_common *hw_priv);
829 void wsm_query_work(struct work_struct *work);
830
831 /* 3.5 */
832 int wsm_read_mib(struct xradio_common *hw_priv, u16 mibId, void *buf,
833 size_t buf_size, size_t arg_size);
834
835 /* 3.7 */
836 int wsm_write_mib(struct xradio_common *hw_priv, u16 mibId, void *buf,
837 size_t buf_size, int if_id);
838
839 /* 3.9 */
840 struct wsm_ssid {
841 u8 ssid[32];
842 u32 length;
843 };
844
845 struct wsm_scan_ch {
846 u16 number;
847 u32 minChannelTime;
848 u32 maxChannelTime;
849 u32 txPowerLevel;
850 };
851
852 /* 3.13 */
853 struct wsm_scan_complete {
854 /* WSM_STATUS_... */
855 u32 status;
856
857 /* WSM_PSM_... */
858 u8 psm;
859
860 /* Number of channels that the scan operation completed. */
861 u8 numChannels;
862 #ifdef ROAM_OFFLOAD
863 u16 reserved;
864 #endif /*ROAM_OFFLOAD*/
865 };
866
867 typedef void (*wsm_scan_complete_cb) (struct xradio_common *hw_priv,
868 struct wsm_scan_complete *arg);
869
870 /* 3.9 */
871
872 #ifdef SUPPORT_HT40
873
874 #define SCANTYPE_MASK 0x03
875 #define SCANTYPE_SHIFT 6
876 #define SCANFLAG_MASK 0x3f
877
SET_SCAN_TYPE(u8 * flag,u8 t)878 static inline void SET_SCAN_TYPE(u8 *flag, u8 t)
879 {
880 *flag &= ~(SCANTYPE_MASK << SCANTYPE_SHIFT);
881 *flag |= (t & SCANTYPE_MASK) << SCANTYPE_SHIFT;
882 }
883
SET_SCAN_FLAG(u8 * flag,u8 f)884 static inline void SET_SCAN_FLAG(u8 *flag, u8 f)
885 {
886 *flag |= (f & SCANFLAG_MASK);
887 }
888
CLR_SCAN_FLAG(u8 * flag,u8 f)889 static inline void CLR_SCAN_FLAG(u8 *flag, u8 f)
890 {
891 *flag &= ~(f & SCANFLAG_MASK);
892 }
893
894 #endif
895
896 #ifdef SUPPORT_HT40
897
898 struct wsm_scan {
899 /* WSM_PHY_BAND_... */
900 /* [in] */ u8 band;
901
902 /* bit7:6--WSM_SCAN_TYPE... */
903 /* bit5:0--WSM_SCAN_FLAG... */
904 /* [in] */ u8 scanFlags;
905
906 /* WSM_TRANSMIT_RATE_... */
907 /* [in] */ u16 TransmitRateEntry;
908
909 /* Interval period in TUs that the device shall the re- */
910 /* execute the requested scan. Max value supported by the device */
911 /* is 256s. */
912 /* [in] */ u32 autoScanInterval;
913
914 /* Number of probe requests (per SSID) sent to one (1) */
915 /* channel. Zero (0) means that none is send, which */
916 /* means that a passive scan is to be done. Value */
917 /* greater than zero (0) means that an active scan is to */
918 /* be done. */
919 /* [in] */ u8 numOfProbeRequests;
920
921 /* Number of channels to be scanned. */
922 /* Maximum value is WSM_SCAN_MAX_NUM_OF_CHANNELS. */
923 /* [in] */ u8 numOfChannels;
924
925 /* Number of SSID provided in the scan command (this */
926 /* is zero (0) in broadcast scan) */
927 /* The maximum number of SSIDs is WSM_SCAN_MAX_NUM_OF_SSIDS. */
928 /* [in] */ u8 numOfSSIDs;
929
930 /* The delay time (in microseconds) period */
931 /* before sending a probe-request. */
932 /* [in] */ u8 probeDelay;
933
934 /* SSIDs to be scanned [numOfSSIDs]; */
935 /* [in] */ struct wsm_ssid *ssids;
936
937 /* Channels to be scanned [numOfChannels]; */
938 /* [in] */ struct wsm_scan_ch *ch;
939 };
940
941 #else
942
943 struct wsm_scan {
944 /* WSM_PHY_BAND_... */
945 /* [in] */ u8 band;
946
947 /* WSM_SCAN_TYPE_... */
948 /* [in] */ u8 scanType;
949
950 /* WSM_SCAN_FLAG_... */
951 /* [in] */ u8 scanFlags;
952
953 /* WSM_TRANSMIT_RATE_... */
954 /* [in] */ u8 maxTransmitRate;
955
956 /* Interval period in TUs that the device shall the re- */
957 /* execute the requested scan. Max value supported by the device */
958 /* is 256s. */
959 /* [in] */ u32 autoScanInterval;
960
961 /* Number of probe requests (per SSID) sent to one (1) */
962 /* channel. Zero (0) means that none is send, which */
963 /* means that a passive scan is to be done. Value */
964 /* greater than zero (0) means that an active scan is to */
965 /* be done. */
966 /* [in] */ u32 numOfProbeRequests;
967
968 /* Number of channels to be scanned. */
969 /* Maximum value is WSM_SCAN_MAX_NUM_OF_CHANNELS. */
970 /* [in] */ u8 numOfChannels;
971
972 /* Number of SSID provided in the scan command (this */
973 /* is zero (0) in broadcast scan) */
974 /* The maximum number of SSIDs is WSM_SCAN_MAX_NUM_OF_SSIDS. */
975 /* [in] */ u8 numOfSSIDs;
976
977 /* The delay time (in microseconds) period */
978 /* before sending a probe-request. */
979 /* [in] */ u8 probeDelay;
980
981 /* SSIDs to be scanned [numOfSSIDs]; */
982 /* [in] */ struct wsm_ssid *ssids;
983
984 /* Channels to be scanned [numOfChannels]; */
985 /* [in] */ struct wsm_scan_ch *ch;
986 };
987
988 #endif
989
990 int wsm_scan(struct xradio_common *hw_priv, const struct wsm_scan *arg,
991 int if_id);
992
993 /* 3.11 */
994 int wsm_stop_scan(struct xradio_common *hw_priv, int if_id);
995
996 /* 3.14 */
997
998 #ifdef SUPPORT_HT40
999
1000 struct wsm_tx_confirm {
1001 /* Packet identifier used in wsm_tx. */
1002 /* [out] */ u32 packetID;
1003
1004 /* WSM_STATUS_... */
1005 /* [out] */ u32 status;
1006
1007 /* WSM_TRANSMIT_RATE_... */
1008 /* [out] */ u16 txedRateEntry;
1009
1010 /* The number of times the frame was transmitted */
1011 /* without receiving an acknowledgement. */
1012 /* [out] */ u8 ackFailures;
1013
1014 /* WSM_TX_STATUS_... */
1015 /* [out] */ u8 flags;
1016
1017 /* rate feed back */
1018 /* [out] u32 rate_try[3]; */
1019
1020 u16 RateTry[6];
1021
1022 /* The total time in microseconds that the frame spent in */
1023 /* the WLAN device before transmission as completed. */
1024 /* [out] */ u32 mediaDelay;
1025
1026 /* The total time in microseconds that the frame spent in */
1027 /* the WLAN device before transmission was started. */
1028 /* [out] */ u32 txQueueDelay;
1029
1030 /* [out]*/ u32 link_id;
1031
1032 /*[out]*/ int if_id;
1033 };
1034
1035 #else
1036
1037 struct wsm_tx_confirm {
1038 /* Packet identifier used in wsm_tx. */
1039 /* [out] */ u32 packetID;
1040
1041 /* WSM_STATUS_... */
1042 /* [out] */ u32 status;
1043
1044 /* WSM_TRANSMIT_RATE_... */
1045 /* [out] */ u8 txedRate;
1046
1047 /* The number of times the frame was transmitted */
1048 /* without receiving an acknowledgement. */
1049 /* [out] */ u8 ackFailures;
1050
1051 /* WSM_TX_STATUS_... */
1052 /* [out] */ u16 flags;
1053
1054 /*rate feed back*/
1055 /* [out] */ u32 rate_try[3];
1056
1057 /* The total time in microseconds that the frame spent in */
1058 /* the WLAN device before transmission as completed. */
1059 /* [out] */ u32 mediaDelay;
1060
1061 /* The total time in microseconds that the frame spent in */
1062 /* the WLAN device before transmission was started. */
1063 /* [out] */ u32 txQueueDelay;
1064
1065 /* [out]*/ u32 link_id;
1066
1067 /*[out]*/ int if_id;
1068 };
1069
1070 #endif
1071
1072 /* 3.15 */
1073 typedef void (*wsm_tx_confirm_cb) (struct xradio_common *hw_priv,
1074 struct wsm_tx_confirm *arg);
1075
1076 /* Note that ideology of wsm_tx struct is different against the rest of
1077 * WSM API. wsm_hdr is /not/ a caller-adapted struct to be used as an input
1078 * argument for WSM call, but a prepared bytestream to be sent to firmware.
1079 * It is filled partly in xradio_tx, partly in low-level WSM code.
1080 * Please pay attention once again: ideology is different.
1081 *
1082 * Legend:
1083 * - [in]: xradio_tx must fill this field.
1084 * - [wsm]: the field is filled by low-level WSM.
1085 */
1086
1087 #ifdef SUPPORT_HT40
1088
1089 struct wsm_tx {
1090 /* common WSM header */
1091 /* [in/wsm] */ struct wsm_hdr hdr;
1092
1093 /* Packet identifier that meant to be used in completion. */
1094 /* [in] */ __le32 packetID;
1095
1096 /* WSM_QUEUE_... */
1097 /* [in] */ u8 queueId;
1098
1099 /* True: another packet is pending on the host for transmission. */
1100 /* [wsm] */ u8 more;
1101
1102 /* [in] */ u8 DataOffset;
1103
1104 /* PTA Priority */
1105 /* [in] */ u8 EptaPriority;
1106
1107 /* WSM_TRANSMIT_RATE_... */
1108 /* [in] */ u16 TxRateEntry; /* first rate entry. */
1109
1110 /* Tx Rate Retry Policy */
1111 /* [in] */ u8 TxPolicyIndex;
1112
1113 /* 0 - Start expiry time from first Tx attempt (default) */
1114 /* 1 - Start expiry time from receipt of Tx Request */
1115 /* [in] */ u8 ExpireTimeSetting;
1116
1117 /* The elapsed time in TUs, after the initial transmission */
1118 /* of an MSDU, after which further attempts to transmit */
1119 /* the MSDU shall be terminated. Overrides the global */
1120 /* dot11MaxTransmitMsduLifeTime setting [optional] */
1121 /* Device will set the default value if this is 0. */
1122 /* [wsm] */ __le32 expireTime;
1123
1124 /* Should be 0. */
1125 /* [in] */ __le32 reserved;
1126 };
1127
1128 #else
1129
1130 struct wsm_tx {
1131 /* common WSM header */
1132 /* [in/wsm] */ struct wsm_hdr hdr;
1133
1134 /* Packet identifier that meant to be used in completion. */
1135 /* [in] */ __le32 packetID;
1136
1137 /* WSM_TRANSMIT_RATE_... */
1138 /* [in] */ u8 maxTxRate;
1139
1140 /* WSM_QUEUE_... */
1141 /* [in] */ u8 queueId;
1142
1143 /* True: another packet is pending on the host for transmission. */
1144 /* [wsm] */ u8 more;
1145
1146 /* Bit 0 = 0 - Start expiry time from first Tx attempt (default) */
1147 /* Bit 0 = 1 - Start expiry time from receipt of Tx Request */
1148 /* Bits 3:1 - PTA Priority */
1149 /* Bits 6:4 - Tx Rate Retry Policy */
1150 /* Bit 7 - Reserved */
1151 /* [in] */ u8 flags;
1152
1153 /* Should be 0. */
1154 /* [in] */ __le32 reserved;
1155
1156 /* The elapsed time in TUs, after the initial transmission */
1157 /* of an MSDU, after which further attempts to transmit */
1158 /* the MSDU shall be terminated. Overrides the global */
1159 /* dot11MaxTransmitMsduLifeTime setting [optional] */
1160 /* Device will set the default value if this is 0. */
1161 /* [wsm] */ __le32 expireTime;
1162
1163 /* WSM_HT_TX_... */
1164 /* [in] */ __le32 htTxParameters;
1165 };
1166
1167 #endif
1168
1169 /* = sizeof(generic hi hdr) + sizeof(wsm hdr) + sizeof(alignment) */
1170 #define WSM_TX_EXTRA_HEADROOM (28)
1171
1172 /* 3.16 */
1173 struct wsm_rx {
1174 /* WSM_STATUS_... */
1175 /* [out] */ u32 status;
1176
1177 /* Specifies the channel of the received packet. */
1178 /* [out] */ u16 channelNumber;
1179
1180 #ifdef SUPPORT_HT40
1181
1182 /* WSM_TRANSMIT_RATE_... */
1183 /* [out] */ u16 rxedRateEntry;
1184 u8 Reserved[3];
1185
1186
1187 #else
1188
1189 /* WSM_TRANSMIT_RATE_... */
1190 /* [out] */ u8 rxedRate;
1191
1192 #endif
1193
1194 /* This value is expressed in signed Q8.0 format for */
1195 /* RSSI and unsigned Q7.1 format for RCPI. */
1196 /* [out] */ u8 rcpiRssi;
1197
1198 /* WSM_RX_STATUS_... */
1199 /* [out] */ u32 flags;
1200
1201 /* An 802.11 frame. */
1202 /* [out] */ void *frame;
1203
1204 /* Size of the frame */
1205 /* [out] */ size_t frame_size;
1206
1207 /* Link ID */
1208 /* [out] */ int link_id;
1209 /* [out] */ int if_id;
1210 };
1211
1212 /* = sizeof(generic hi hdr) + sizeof(wsm hdr) */
1213 #define WSM_RX_EXTRA_HEADROOM (16)
1214 #ifdef USE_RSSI_OFFSET
1215 #define WSM_RSSI_OFFSET (-5)
1216 #endif
1217
1218 typedef void (*wsm_rx_cb) (struct xradio_vif *priv, struct wsm_rx *arg,
1219 struct sk_buff **skb_p);
1220
1221 /* 3.17 */
1222 struct wsm_event {
1223 /* WSM_STATUS_... */
1224 /* [out] */ u32 eventId;
1225
1226 /* Indication parameters. */
1227 /* For error indication, this shall be a 32-bit WSM status. */
1228 /* For RCPI or RSSI indication, this should be an 8-bit */
1229 /* RCPI or RSSI value. */
1230 /* [out] */ u32 eventData;
1231 };
1232
1233 struct xradio_wsm_event {
1234 struct list_head link;
1235 struct wsm_event evt;
1236 u8 if_id;
1237 };
1238
1239 /* 3.18 - 3.22 */
1240 /* Measurement. Skipped for now. Irrelevent. */
1241
1242 typedef void (*wsm_event_cb) (struct xradio_common *hw_priv,
1243 struct wsm_event *arg);
1244
1245 /* 3.23 */
1246
1247 #ifdef SUPPORT_HT40
1248
1249 struct wsm_join {
1250 /* Phy Mode Configuraion */
1251 /* [in] */struct phy_mode_cfg PhyModeCfg;
1252
1253 /* Specifies the channel number to join. The channel */
1254 /* number will be mapped to an actual frequency */
1255 /* according to the band */
1256 /* [in] */ u16 channelNumber;
1257
1258 /* Specifies the BSSID of the BSS or IBSS to be joined */
1259 /* or the IBSS to be started. */
1260 /* [in] */ u8 bssid[6];
1261
1262 /* ATIM window of IBSS */
1263 /* When ATIM window is zero the initiated IBSS does */
1264 /* not support power saving. */
1265 /* [in] */ u16 atimWindow;
1266
1267 /* WSM_JOIN_MODE_... */
1268 /* [in] */ u8 mode;
1269
1270 /* Specifies if a probe request should be send with the */
1271 /* specified SSID when joining to the network. */
1272 /* [in] */ u8 probeForJoin;
1273
1274 /* DTIM Period (In multiples of beacon interval) */
1275 /* [in] */ u8 dtimPeriod;
1276
1277 /* WSM_JOIN_FLAGS_... */
1278 /* [in] */ u8 flags;
1279
1280 /* Length of the SSID */
1281 /* [in] */ u32 ssidLength;
1282
1283 /* Specifies the SSID of the IBSS to join or start */
1284 /* [in] */ u8 ssid[32];
1285
1286 /* Specifies the time between TBTTs in TUs */
1287 /* [in] */ u32 beaconInterval;
1288
1289 /* A bit mask that defines the BSS basic rate set. */
1290 /* [in] */ u32 basicRateSet;
1291
1292 /* Minimum transmission power level in units of 0.1dBm */
1293 /* [out] */ int minPowerLevel;
1294
1295 /* Maximum transmission power level in units of 0.1dBm */
1296 /* [out] */ int maxPowerLevel;
1297 };
1298
1299 #else
1300
1301 struct wsm_join {
1302 /* WSM_JOIN_MODE_... */
1303 /* [in] */ u8 mode;
1304
1305 /* WSM_PHY_BAND_... */
1306 /* [in] */ u8 band;
1307
1308 /* Specifies the channel number to join. The channel */
1309 /* number will be mapped to an actual frequency */
1310 /* according to the band */
1311 /* [in] */ u16 channelNumber;
1312
1313 /* Specifies the BSSID of the BSS or IBSS to be joined */
1314 /* or the IBSS to be started. */
1315 /* [in] */ u8 bssid[6];
1316
1317 /* ATIM window of IBSS */
1318 /* When ATIM window is zero the initiated IBSS does */
1319 /* not support power saving. */
1320 /* [in] */ u16 atimWindow;
1321
1322 /* WSM_JOIN_PREAMBLE_... */
1323 /* [in] */ u8 preambleType;
1324
1325 /* Specifies if a probe request should be send with the */
1326 /* specified SSID when joining to the network. */
1327 /* [in] */ u8 probeForJoin;
1328
1329 /* DTIM Period (In multiples of beacon interval) */
1330 /* [in] */ u8 dtimPeriod;
1331
1332 /* WSM_JOIN_FLAGS_... */
1333 /* [in] */ u8 flags;
1334
1335 /* Length of the SSID */
1336 /* [in] */ u32 ssidLength;
1337
1338 /* Specifies the SSID of the IBSS to join or start */
1339 /* [in] */ u8 ssid[32];
1340
1341 /* Specifies the time between TBTTs in TUs */
1342 /* [in] */ u32 beaconInterval;
1343
1344 /* A bit mask that defines the BSS basic rate set. */
1345 /* [in] */ u32 basicRateSet;
1346
1347 /* Minimum transmission power level in units of 0.1dBm */
1348 /* [out] */ int minPowerLevel;
1349
1350 /* Maximum transmission power level in units of 0.1dBm */
1351 /* [out] */ int maxPowerLevel;
1352 };
1353
1354 #endif
1355
1356 int wsm_join(struct xradio_common *hw_priv, struct wsm_join *arg, int if_id);
1357
1358 /* 3.25 */
1359 struct wsm_set_pm {
1360 /* WSM_PSM_... */
1361 /* [in] */ u8 pmMode;
1362
1363 /* in unit of 500us; 0 to use default */
1364 /* [in] */ u8 fastPsmIdlePeriod;
1365
1366 /* in unit of 500us; 0 to use default */
1367 /* [in] */ u8 apPsmChangePeriod;
1368
1369 /* in unit of 500us; 0 to disable auto-pspoll */
1370 /* [in] */ u8 minAutoPsPollPeriod;
1371 };
1372
1373 int wsm_set_pm(struct xradio_common *hw_priv, const struct wsm_set_pm *arg,
1374 int if_id);
1375
1376 /* 3.27 */
1377 struct wsm_set_pm_complete {
1378 u8 psm; /* WSM_PSM_... */
1379 };
1380
1381 typedef void (*wsm_set_pm_complete_cb) (struct xradio_common *hw_priv,
1382 struct wsm_set_pm_complete *arg);
1383
1384 /* 3.28 */
1385 struct wsm_set_bss_params {
1386 /* The number of lost consecutive beacons after which */
1387 /* the WLAN device should indicate the BSS-Lost event */
1388 /* to the WLAN host driver. */
1389 u8 beaconLostCount;
1390
1391 /* The AID received during the association process. */
1392 u16 aid;
1393
1394 /* The operational rate set mask */
1395 u32 operationalRateSet;
1396 };
1397
1398 int wsm_set_bss_params(struct xradio_common *hw_priv,
1399 const struct wsm_set_bss_params *arg, int if_id);
1400
1401 /* 3.30 */
1402 struct wsm_add_key {
1403 u8 type; /* WSM_KEY_TYPE_... */
1404 u8 entryIndex; /* Key entry index: 0 -- WSM_KEY_MAX_INDEX */
1405 u16 reserved;
1406 union {
1407 struct {
1408 u8 peerAddress[6]; /* MAC address of the
1409 * peer station */
1410 u8 reserved;
1411 u8 keyLength; /* Key length in bytes */
1412 u8 keyData[16]; /* Key data */
1413 } __packed wepPairwiseKey;
1414 struct {
1415 u8 keyId; /* Unique per key identifier
1416 * (0..3) */
1417 u8 keyLength; /* Key length in bytes */
1418 u16 reserved;
1419 u8 keyData[16]; /* Key data */
1420 } __packed wepGroupKey;
1421 struct {
1422 u8 peerAddress[6]; /* MAC address of the
1423 * peer station */
1424 u8 reserved[2];
1425 u8 tkipKeyData[16]; /* TKIP key data */
1426 u8 rxMicKey[8]; /* Rx MIC key */
1427 u8 txMicKey[8]; /* Tx MIC key */
1428 } __packed tkipPairwiseKey;
1429 struct {
1430 u8 tkipKeyData[16]; /* TKIP key data */
1431 u8 rxMicKey[8]; /* Rx MIC key */
1432 u8 keyId; /* Key ID */
1433 u8 reserved[3];
1434 u8 rxSeqCounter[8]; /* Receive Sequence Counter */
1435 } __packed tkipGroupKey;
1436 struct {
1437 u8 peerAddress[6]; /* MAC address of the
1438 * peer station */
1439 u16 reserved;
1440 u8 aesKeyData[16]; /* AES key data */
1441 } __packed aesPairwiseKey;
1442 struct {
1443 u8 aesKeyData[16]; /* AES key data */
1444 u8 keyId; /* Key ID */
1445 u8 reserved[3];
1446 u8 rxSeqCounter[8]; /* Receive Sequence Counter */
1447 } __packed aesGroupKey;
1448 struct {
1449 u8 peerAddress[6]; /* MAC address of the
1450 * peer station */
1451 u8 keyId; /* Key ID */
1452 u8 reserved;
1453 u8 wapiKeyData[16]; /* WAPI key data */
1454 u8 micKeyData[16]; /* MIC key data */
1455 } __packed wapiPairwiseKey;
1456 struct {
1457 u8 wapiKeyData[16]; /* WAPI key data */
1458 u8 micKeyData[16]; /* MIC key data */
1459 u8 keyId; /* Key ID */
1460 u8 reserved[3];
1461 } __packed wapiGroupKey;
1462 struct {
1463 u8 igtkKeyData[16]; /* IGTK key data */
1464 u8 keyId; /* Key ID */
1465 u8 reserved[3];
1466 u8 ipn[8]; /* IGTK packet number */
1467 } __packed igtkGroupKey;
1468 } __packed;
1469 } __packed;
1470
1471 int wsm_add_key(struct xradio_common *hw_priv, const struct wsm_add_key *arg,
1472 int if_id);
1473
1474 /* 3.32 */
1475 struct wsm_remove_key {
1476 /* Key entry index : 0-10 */
1477 u8 entryIndex;
1478 };
1479
1480 int wsm_remove_key(struct xradio_common *hw_priv,
1481 const struct wsm_remove_key *arg, int if_id);
1482
1483 /* 3.34 */
1484 struct wsm_set_tx_queue_params {
1485 /* WSM_ACK_POLICY_... */
1486 u8 ackPolicy;
1487
1488 /* Medium Time of TSPEC (in 32us units) allowed per */
1489 /* One Second Averaging Period for this queue. */
1490 u16 allowedMediumTime;
1491
1492 /* dot11MaxTransmitMsduLifetime to be used for the */
1493 /* specified queue. */
1494 u32 maxTransmitLifetime;
1495 };
1496
1497 struct wsm_tx_queue_params {
1498 /* NOTE: index is a linux queue id. */
1499 struct wsm_set_tx_queue_params params[4];
1500 };
1501
1502 #define WSM_TX_QUEUE_SET(queue_params, queue, ack_policy, allowed_time, \
1503 max_life_time) \
1504 do { \
1505 struct wsm_set_tx_queue_params *p = &(queue_params)->params[queue]; \
1506 p->ackPolicy = (ack_policy); \
1507 p->allowedMediumTime = (allowed_time); \
1508 p->maxTransmitLifetime = (max_life_time); \
1509 } while (0)
1510
1511 int wsm_set_tx_queue_params(struct xradio_common *hw_priv,
1512 const struct wsm_set_tx_queue_params *arg,
1513 u8 id, int if_id);
1514
1515 /* 3.36 */
1516 struct wsm_edca_queue_params {
1517 /* CWmin (in slots) for the access class. */
1518 /* [in] */ u16 cwMin;
1519
1520 /* CWmax (in slots) for the access class. */
1521 /* [in] */ u16 cwMax;
1522
1523 /* AIFS (in slots) for the access class. */
1524 /* [in] */ u8 aifns;
1525
1526 /* TX OP Limit (in microseconds) for the access class. */
1527 /* [in] */ u16 txOpLimit;
1528
1529 /* dot11MaxReceiveLifetime to be used for the specified */
1530 /* the access class. Overrides the global */
1531 /* dot11MaxReceiveLifetime value */
1532 /* [in] */ u32 maxReceiveLifetime;
1533
1534 /* UAPSD trigger support for the access class. */
1535 /* [in] */ bool uapsdEnable;
1536 };
1537
1538 struct wsm_edca_params {
1539 /* NOTE: index is a linux queue id. */
1540 struct wsm_edca_queue_params params[4];
1541 };
1542
1543 #define TXOP_UNIT 32
1544 #define WSM_EDCA_SET(edca, queue, aifs, cw_min, cw_max, txop, life_time, \
1545 uapsd) \
1546 do { \
1547 struct wsm_edca_queue_params *p = &(edca)->params[queue]; \
1548 p->cwMin = (cw_min); \
1549 p->cwMax = (cw_max); \
1550 p->aifns = (aifs); \
1551 p->txOpLimit = ((txop) * TXOP_UNIT); \
1552 p->maxReceiveLifetime = (life_time); \
1553 p->uapsdEnable = (uapsd); \
1554 } while (0)
1555
1556 int wsm_set_edca_params(struct xradio_common *hw_priv,
1557 const struct wsm_edca_params *arg, int if_id);
1558
1559 int wsm_set_uapsd_param(struct xradio_common *hw_priv,
1560 const struct wsm_edca_params *arg);
1561
1562 /* 3.38 */
1563 /* Set-System info. Skipped for now. Irrelevent. */
1564
1565 /* 3.40 */
1566 struct wsm_switch_channel {
1567 /* 1 - means the STA shall not transmit any further */
1568 /* frames until the channel switch has completed */
1569 /* [in] */ u8 channelMode;
1570
1571 /* Number of TBTTs until channel switch occurs. */
1572 /* 0 - indicates switch shall occur at any time */
1573 /* 1 - occurs immediately before the next TBTT */
1574 /* [in] */ u8 channelSwitchCount;
1575
1576 /* The new channel number to switch to. */
1577 /* Note this is defined as per section 2.7. */
1578 /* [in] */ u16 newChannelNumber;
1579 };
1580
1581 int wsm_switch_channel(struct xradio_common *hw_priv,
1582 const struct wsm_switch_channel *arg, int if_id);
1583
1584 typedef void (*wsm_channel_switch_cb) (struct xradio_common *hw_priv);
1585
1586
1587 #ifdef SUPPORT_HT40
1588
1589 struct wsm_start {
1590 /* Phy Mode Configuraion */
1591 /* [in] */ struct phy_mode_cfg PhyModeCfg;
1592
1593 /* Channel number */
1594 /* [in] */ u16 channelNumber;
1595
1596 /* Client Traffic window in units of TU */
1597 /* Valid only when mode == ..._P2P */
1598 /* [in] */ u32 CTWindow;
1599
1600 /* Interval between two consecutive */
1601 /* beacon transmissions in TU. */
1602 /* [in] */ u32 beaconInterval;
1603
1604 /* WSM_START_MODE_... */
1605 /* [in] */ u8 mode;
1606
1607 /* DTIM period in terms of beacon intervals */
1608 /* [in] */ u8 DTIMPeriod;
1609
1610 /* The delay time (in microseconds) period */
1611 /* before sending a probe-request. */
1612 /* [in] */ u8 probeDelay;
1613
1614 /* Length of the SSID */
1615 /* [in] */ u8 ssidLength;
1616
1617 /* SSID of the BSS or P2P_GO to be started now. */
1618 /* [in] */ u8 ssid[32];
1619
1620 /* The basic supported rates for the MiniAP. */
1621 /* [in] */ u32 basicRateSet;
1622 };
1623
1624 #else
1625
1626 struct wsm_start {
1627 /* WSM_START_MODE_... */
1628 /* [in] */ u8 mode;
1629
1630 /* WSM_PHY_BAND_... */
1631 /* [in] */ u8 band;
1632
1633 /* Channel number */
1634 /* [in] */ u16 channelNumber;
1635
1636 /* Client Traffic window in units of TU */
1637 /* Valid only when mode == ..._P2P */
1638 /* [in] */ u32 CTWindow;
1639
1640 /* Interval between two consecutive */
1641 /* beacon transmissions in TU. */
1642 /* [in] */ u32 beaconInterval;
1643
1644 /* DTIM period in terms of beacon intervals */
1645 /* [in] */ u8 DTIMPeriod;
1646
1647 /* WSM_JOIN_PREAMBLE_... */
1648 /* [in] */ u8 preambleType;
1649
1650 /* The delay time (in microseconds) period */
1651 /* before sending a probe-request. */
1652 /* [in] */ u8 probeDelay;
1653
1654 /* Length of the SSID */
1655 /* [in] */ u8 ssidLength;
1656
1657 /* SSID of the BSS or P2P_GO to be started now. */
1658 /* [in] */ u8 ssid[32];
1659
1660 /* The basic supported rates for the MiniAP. */
1661 /* [in] */ u32 basicRateSet;
1662 };
1663
1664 #endif
1665
1666 int wsm_start(struct xradio_common *hw_priv, const struct wsm_start *arg,
1667 int if_id);
1668
1669 #if 0
1670 struct wsm_beacon_transmit {
1671 /* 1: enable; 0: disable */
1672 /* [in] */ u8 enableBeaconing;
1673 };
1674
1675 int wsm_beacon_transmit(struct xradio_common *hw_priv,
1676 const struct wsm_beacon_transmit *arg,
1677 int if_id);
1678 #endif
1679
1680 int wsm_start_find(struct xradio_common *hw_priv, int if_id);
1681
1682 int wsm_stop_find(struct xradio_common *hw_priv, int if_id);
1683
1684 typedef void (*wsm_find_complete_cb) (struct xradio_common *hw_priv,
1685 u32 status);
1686
1687 struct wsm_suspend_resume {
1688 /* See 3.52 */
1689 /* Link ID */
1690 /* [out] */ int link_id;
1691 /* Stop sending further Tx requests down to device for this link */
1692 /* [out] */ bool stop;
1693 /* Transmit multicast Frames */
1694 /* [out] */ bool multicast;
1695 /* The AC on which Tx to be suspended /resumed. */
1696 /* This is applicable only for U-APSD */
1697 /* WSM_QUEUE_... */
1698 /* [out] */ int queue;
1699 /* [out] */ int if_id;
1700 };
1701
1702 typedef void (*wsm_suspend_resume_cb) (struct xradio_vif *priv,
1703 struct wsm_suspend_resume *arg);
1704
1705 /* 3.54 Update-IE request. */
1706 struct wsm_update_ie {
1707 /* WSM_UPDATE_IE_... */
1708 /* [in] */ u16 what;
1709 /* [in] */ u16 count;
1710 /* [in] */ u8 *ies;
1711 /* [in] */ size_t length;
1712 };
1713
1714 int wsm_update_ie(struct xradio_common *hw_priv,
1715 const struct wsm_update_ie *arg, int if_id);
1716
1717 /* 3.56 */
1718 struct wsm_map_link {
1719 /* MAC address of the remote device */
1720 /* [in] */ u8 mac_addr[6];
1721 /* [in] */ u8 unmap;
1722 /* [in] */ u8 link_id;
1723 };
1724
1725 int wsm_map_link(struct xradio_common *hw_priv, const struct wsm_map_link *arg,
1726 int if_id);
1727
1728 struct wsm_cbc {
1729 wsm_scan_complete_cb scan_complete;
1730 wsm_tx_confirm_cb tx_confirm;
1731 wsm_rx_cb rx;
1732 wsm_event_cb event;
1733 wsm_set_pm_complete_cb set_pm_complete;
1734 wsm_channel_switch_cb channel_switch;
1735 wsm_find_complete_cb find_complete;
1736 wsm_suspend_resume_cb suspend_resume;
1737 };
1738 #ifdef MCAST_FWDING
1739
1740 /* 3.65 Give Buffer Request */
1741 int wsm_init_release_buffer_request(struct xradio_common *priv);
1742
1743 /* 3.65 fixed memory leakage*/
1744 void wsm_deinit_release_buffer(struct xradio_common *hw_priv);
1745
1746 /* 3.67 Request Buffer Request */
1747 int wsm_request_buffer_request(struct xradio_vif *priv,
1748 u8 *arg);
1749 #endif
1750 /* ******************************************************************** */
1751 /* MIB shortcats */
1752 #define XR_RRM 1
1753 #ifdef XR_RRM /*RadioResourceMeasurement*/
1754 /* RadioResourceMeasurement Request*/
1755 #define MEAS_CCA 0
1756 #define MEAS_CHANNELLOAD 1
1757 typedef struct LMAC_MEAS_CHANNEL_LOAD_PARAMS_S {
1758 u8 Reserved;
1759 u8 ChannelLoadCCA;
1760 u16 ChannelNum;
1761 u16 RandomInterval;
1762 u16 MeasurementDuration;
1763 u32 MeasurementStartTimel;
1764 u32 MeasurementStartTimeh;
1765 } LMAC_MEAS_CHANNEL_LOAD_PARAMS;
1766
1767 #define MEAS_RPI 0
1768 #define MEAS_IPI 1
1769
1770 typedef struct LMAC_MEAS_NOISE_HISTOGRAM_PARAMS_S {
1771 u8 Reserved;
1772 u8 IpiRpi;
1773 u16 ChannelNum;
1774 u16 RandomInterval;
1775 u16 MeasurementDuration;
1776 u32 MeasurementStartTimel;
1777 u32 MeasurementStartTimeh;
1778 } LMAC_MEAS_NOISE_HISTOGRAM_PARAMS;
1779
1780 #define LMAC_MAX_SSIDS 16
1781 #define LMAC_MAX_SSID_LENGTH 32
1782 typedef struct LMAC_CHANNELS_S {
1783 u32 ChannelNum;
1784 u32 MinChannelTime;
1785 u32 MaxChannelTime;
1786 s32 TxPowerLevel;
1787 } LMAC_CHANNELS;
1788
1789 typedef struct LMAC_SSIDS_S {
1790 u32 SSIDLength;
1791 u8 SSID[LMAC_MAX_SSID_LENGTH];
1792 } LMAC_SSIDS;
1793
1794 #ifdef SUPPORT_HT40
1795
1796 typedef struct LMAC_MEAS_BEACON_PARAMS_S {
1797 /*u8 RegulatoryClass;*/
1798 /*u8 MeasurementMode;*/
1799 /*u16 ChannelNum;*/
1800 u16 RandomInterval;
1801 /*u16 MeasurementDuration;*/
1802 /*u8 Bssid[6];*/
1803 u16 Reserved;
1804 /*SCAN_PARAMETERS ScanParameters;*/
1805 u8 Band;
1806 /* bit7:6--WSM_SCAN_TYPE... */
1807 /* bit5:0--WSM_SCAN_FLAG... */
1808 u8 ScanFlags;
1809 u16 TransmitRateEntry;
1810 u32 AutoScanInterval;
1811 u8 NumOfProbeRequests;
1812 u8 NumOfChannels;
1813 u8 NumOfSSIDs;
1814 u8 ProbeDelay;
1815 LMAC_CHANNELS Channels;
1816 LMAC_SSIDS Ssids; /*here for SCAN_PARAMETER sizing purposes*/
1817 } LMAC_MEAS_BEACON_PARAMS;
1818
1819 #else
1820
1821 typedef struct LMAC_MEAS_BEACON_PARAMS_S {
1822 /*u8 RegulatoryClass;*/
1823 /*u8 MeasurementMode;*/
1824 /*u16 ChannelNum;*/
1825 u16 RandomInterval;
1826 /*u16 MeasurementDuration;*/
1827 /*u8 Bssid[6];*/
1828 u16 Reserved;
1829 /*SCAN_PARAMETERS ScanParameters;*/
1830 u8 Band;
1831 u8 ScanType;
1832 u8 ScanFlags;
1833 u8 MaxTransmitRate;
1834 u32 AutoScanInterval;
1835 u8 NumOfProbeRequests;
1836 u8 NumOfChannels;
1837 u8 NumOfSSIDs;
1838 u8 ProbeDelay;
1839 LMAC_CHANNELS Channels;
1840 LMAC_SSIDS Ssids; /*here for SCAN_PARAMETER sizing purposes*/
1841 } LMAC_MEAS_BEACON_PARAMS;
1842
1843 #endif
1844
1845 typedef struct LMAC_MEAS_STA_STATS_PARAMS_S {
1846 u8 PeerMacAddress[6];
1847 u16 RandomInterval;
1848 u16 MeasurementDuration;
1849 u8 GroupId;
1850 u8 Reserved;
1851 } LMAC_MEAS_STA_STATS_PARAMS;
1852
1853 typedef struct LMAC_MEAS_LINK_MEASUREMENT_PARAMS_S {
1854 u8 Reserved[4];
1855 } LMAC_MEAS_LINK_MEASUREMENT_PARAMS;
1856
1857 typedef union LMAC_MEAS_REQUEST_U {
1858 LMAC_MEAS_CHANNEL_LOAD_PARAMS ChannelLoadParams;
1859 LMAC_MEAS_NOISE_HISTOGRAM_PARAMS NoisHistogramParams;
1860 LMAC_MEAS_BEACON_PARAMS BeaconParams;
1861 LMAC_MEAS_STA_STATS_PARAMS StaStatsParams;
1862 LMAC_MEAS_LINK_MEASUREMENT_PARAMS LinkMeasurementParams;
1863 } LMAC_MEAS_REQUEST;
1864
1865 /*
1866 * This struct is a copy of WSM_HI_START_MEASUREMENT_REQ,
1867 * except that MsgLen and MsgId is not included.
1868 */
1869 typedef struct MEASUREMENT_PARAMETERS_S {
1870 s32 TxPowerLevel;
1871 u8 DurationMandatory;
1872 u8 MeasurementType;
1873 u8 MeasurementRequestLength;
1874 u8 Reserved[5];
1875 LMAC_MEAS_REQUEST MeasurementRequest;
1876 } MEASUREMENT_PARAMETERS;
1877
1878 /* RadioResourceMeasurement Result*/
1879 typedef struct LMAC_MEAS_CHANNEL_LOAD_RESULTS_S {
1880 u8 Reserved;
1881 u8 ChannelLoadCCA;
1882 u16 ChannelNum;
1883 u32 ActualMeasurementStartTimel;
1884 u32 ActualMeasurementStartTimeh;
1885 u16 MeasurementDuration;
1886 u8 CCAbusyFraction;
1887 u8 ChannelLoad;
1888 } LMAC_MEAS_CHANNEL_LOAD_RESULTS;
1889
1890 typedef struct LMAC_MEAS_NOISE_HISTOGRAM_RESULTS_S {
1891 u16 Reserved;
1892 u16 ChannelNum;
1893 u32 ActualMeasurementStartTimel;
1894 u32 ActualMeasurementStartTimeh;
1895 u16 MeasurementDuration;
1896 u8 AntennaID;
1897 u8 IpiRpi;
1898 u8 PI_0_Density;
1899 u8 PI_1_Density;
1900 u8 PI_2_Density;
1901 u8 PI_3_Density;
1902 u8 PI_4_Density;
1903 u8 PI_5_Density;
1904 u8 PI_6_Density;
1905 u8 PI_7_Density;
1906 u8 PI_8_Density;
1907 u8 PI_9_Density;
1908 u8 PI_10_Density;
1909 u8 Reserved2;
1910 } LMAC_MEAS_NOISE_HISTOGRAM_RESULTS;
1911
1912 #ifdef SUPPORT_HT40
1913
1914 typedef struct LMAC_MEAS_BEACON_RESULTS_S {
1915 u16 MeasurementDuration;
1916 u16 Reserved;
1917 u32 StartTsfl;
1918 u32 StartTsfh;
1919 u32 Durationl;
1920 u32 Durationh;
1921 /*SCAN_PARAMETERS ScanParameters;*/
1922 u8 Band;
1923 /* bit7:6--WSM_SCAN_TYPE... */
1924 /* bit5:0--WSM_SCAN_FLAG... */
1925 u8 ScanFlags;
1926 u16 TransmitRateEntry;
1927 u32 AutoScanInterval;
1928 u8 NumOfProbeRequests;
1929 u8 NumOfChannels;
1930 u8 NumOfSSIDs;
1931 u8 ProbeDelay;
1932 LMAC_CHANNELS Channels;
1933 LMAC_SSIDS Ssids;
1934 } LMAC_MEAS_BEACON_RESULTS;
1935
1936 #else
1937
1938 typedef struct LMAC_MEAS_BEACON_RESULTS_S {
1939 u16 MeasurementDuration;
1940 u16 Reserved;
1941 u32 StartTsfl;
1942 u32 StartTsfh;
1943 u32 Durationl;
1944 u32 Durationh;
1945 /*SCAN_PARAMETERS ScanParameters;*/
1946 u8 Band;
1947 u8 ScanType;
1948 u8 ScanFlags;
1949 u8 MaxTransmitRate;
1950 u32 AutoScanInterval;
1951 u8 NumOfProbeRequests;
1952 u8 NumOfChannels;
1953 u8 NumOfSSIDs;
1954 u8 ProbeDelay;
1955 LMAC_CHANNELS Channels;
1956 LMAC_SSIDS Ssids;
1957 } LMAC_MEAS_BEACON_RESULTS;
1958
1959 #endif
1960
1961 typedef struct LMAC_MEAS_STA_STATS_RESULTS_S {
1962 u16 MeasurementDuration;
1963 u8 GroupId;
1964 u8 StatisticsGroupDataLength;
1965 u8 StatisticsGroupData[52];
1966 } LMAC_MEAS_STA_STATS_RESULTS;
1967
1968 typedef struct LMAC_MEAS_LINK_MEASUREMENT_RESULTS_S {
1969 s16 TransmitPower;
1970 u8 RxAntennaID;
1971 u8 TxAntennaID;
1972 s32 NoiseLeveldBm;
1973 s8 LatestRssi;
1974 u8 Reserved1;
1975 u8 Reserved2;
1976 u8 Reserved3;
1977 } LMAC_MEAS_LINK_MEASUREMENT_RESULTS;
1978
1979 typedef union LMAC_MEAS_REPORT_U {
1980 LMAC_MEAS_CHANNEL_LOAD_RESULTS ChannelLoadResults;
1981 LMAC_MEAS_NOISE_HISTOGRAM_RESULTS NoiseHistogramResults;
1982 LMAC_MEAS_BEACON_RESULTS BeaconResults;
1983 LMAC_MEAS_STA_STATS_RESULTS StaStatsResults;
1984 LMAC_MEAS_LINK_MEASUREMENT_RESULTS LinkMeasurementResults;
1985 } LMAC_MEAS_REPORT;
1986 /*
1987 * Note: eMeasurementTypes MUST match the
1988 * #define WSM_MEASURE_TYPE_XXX from wsm_api.h.
1989 */
1990 typedef enum {
1991 ChannelLoadMeasurement = 0,
1992 NoiseHistrogramMeasurement,
1993 BeaconReport,
1994 STAstatisticsReport,
1995 LinkMeasurement
1996 } eMeasurementTypes;
1997
1998 typedef struct MEASUREMENT_COMPLETE_S {
1999 /*u16 RandomInterval;*/
2000 /*u16 Reserved0;*/
2001 /* From here WSM_HI_MEASURE_CMPL_IND and
2002 * MEASUREMENT_COMPLETE_S must be identical.
2003 */
2004 u8 Dot11PowerMgmtMode;
2005 u8 MeasurementType;
2006
2007 /* Set to 1 if more indications are to follow
2008 * for this measurement, otherwise 0; */
2009 u16 MoreInd;
2010 u32 Status;
2011 u8 MeasurementReportLength;
2012 u8 Reserved2[3];
2013 LMAC_MEAS_REPORT MeasurementReport;
2014 } MEASUREMENT_COMPLETE; /*Note: must be 32 bit aligned*/
2015
2016 #endif
2017 int wsm_11k_measure_requset(struct xradio_common *hw_priv,
2018 u8 measure_type,
2019 u16 ChannelNum,
2020 u16 Duration);
2021
2022
wsm_set_fw_debug_control(struct xradio_common * hw_priv,int debug_control,int if_id)2023 static inline int wsm_set_fw_debug_control(struct xradio_common *hw_priv,
2024 int debug_control, int if_id)
2025 {
2026 __le32 val = __cpu_to_le32(debug_control);
2027 return wsm_write_mib(hw_priv, WSM_MIB_ID_FW_DEBUG_CONTROL,
2028 &val, sizeof(val), if_id);
2029 }
2030
wsm_set_host_sleep(struct xradio_common * hw_priv,u8 host_sleep,int if_id)2031 static inline int wsm_set_host_sleep(struct xradio_common *hw_priv,
2032 u8 host_sleep, int if_id)
2033 {
2034 return wsm_write_mib(hw_priv, WSM_MIB_ID_SET_HOST_SLEEP,
2035 &host_sleep, sizeof(host_sleep), if_id);
2036 }
2037
wsm_set_output_power(struct xradio_common * hw_priv,int power_level,int if_id)2038 static inline int wsm_set_output_power(struct xradio_common *hw_priv,
2039 int power_level, int if_id)
2040 {
2041 __le32 val = __cpu_to_le32(power_level);
2042 return wsm_write_mib(hw_priv, WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL,
2043 &val, sizeof(val), if_id);
2044 }
2045
wsm_set_beacon_wakeup_period(struct xradio_common * hw_priv,unsigned dtim_interval,unsigned listen_interval,int if_id)2046 static inline int wsm_set_beacon_wakeup_period(struct xradio_common *hw_priv,
2047 unsigned dtim_interval,
2048 unsigned listen_interval,
2049 int if_id)
2050 {
2051 struct {
2052 u8 numBeaconPeriods;
2053 u8 reserved;
2054 __le16 listenInterval;
2055 } val = {
2056 dtim_interval, 0, __cpu_to_le16(listen_interval)};
2057 if (dtim_interval > 0xFF || listen_interval > 0xFFFF)
2058 return -EINVAL;
2059 else
2060 return wsm_write_mib(hw_priv, WSM_MIB_ID_BEACON_WAKEUP_PERIOD,
2061 &val, sizeof(val), if_id);
2062 }
2063
2064 struct wsm_rcpi_rssi_threshold {
2065 u8 rssiRcpiMode; /* WSM_RCPI_RSSI_... */
2066 u8 lowerThreshold;
2067 u8 upperThreshold;
2068 u8 rollingAverageCount;
2069 };
2070
wsm_set_rcpi_rssi_threshold(struct xradio_common * hw_priv,struct wsm_rcpi_rssi_threshold * arg,int if_id)2071 static inline int wsm_set_rcpi_rssi_threshold(struct xradio_common *hw_priv,
2072 struct wsm_rcpi_rssi_threshold *arg,
2073 int if_id)
2074 {
2075 return wsm_write_mib(hw_priv, WSM_MIB_ID_RCPI_RSSI_THRESHOLD, arg,
2076 sizeof(*arg), if_id);
2077 }
2078
2079 struct wsm_counters_table {
2080 __le32 countPlcpErrors;
2081 __le32 countFcsErrors;
2082 __le32 countTxPackets;
2083 __le32 countRxPackets;
2084 __le32 countRxPacketErrors;
2085 __le32 countRtsSuccess;
2086 __le32 countRtsFailures;
2087 __le32 countRxFramesSuccess;
2088 __le32 countRxDecryptionFailures;
2089 __le32 countRxMicFailures;
2090 __le32 countRxNoKeyFailures;
2091 __le32 countTxMulticastFrames;
2092 __le32 countTxFramesSuccess;
2093 __le32 countTxFrameFailures;
2094 __le32 countTxFramesRetried;
2095 __le32 countTxFramesMultiRetried;
2096 __le32 countRxFrameDuplicates;
2097 __le32 countAckFailures;
2098 __le32 countRxMulticastFrames;
2099 __le32 countRxCMACICVErrors;
2100 __le32 countRxCMACReplays;
2101 __le32 countRxMgmtCCMPReplays;
2102 __le32 countRxBIPMICErrors;
2103
2104 __le32 countAllBeacons;
2105 __le32 countScanBeacons;
2106 __le32 countScanProbeRsps;
2107 __le32 countOutChanBeacons;
2108 __le32 countOutChanProbeRsps;
2109 __le32 countBssBeacons;
2110 __le32 countHostBeacons;
2111 __le32 countMissBeacons;
2112 __le32 countDTIMBeacons;
2113 };
2114
2115
2116 struct wsm_ampducounters_table {
2117 u32 countTxAMPDUs;
2118 u32 countTxMPDUsInAMPDUs;
2119 u32 countTxOctetsInAMPDUs_l32;
2120 u32 countTxOctetsInAMPDUs_h32;
2121 u32 countRxAMPDUs;
2122 u32 countRxMPDUsInAMPDUs;
2123 u32 countRxOctetsInAMPDUs_l32;
2124 u32 countRxOctetsInAMPDUs_h32;
2125 u32 countRxDelimeterCRCErrorCount;
2126 u32 countImplictBARFailures;
2127 u32 countExplictBARFailures;
2128 };
2129
2130 struct wsm_txpipe_counter {
2131 u32 count1;
2132 u32 count2;
2133 u32 count3;
2134 u32 count4;
2135 u32 count5;
2136 u32 count6;
2137 u32 count7;
2138 u32 count8;
2139 u32 count9;
2140 u32 counta;
2141 };
2142
2143 struct wsm_backoff_counter {
2144 u32 count0;
2145 u32 count1;
2146 u32 count2;
2147 u32 count3;
2148 u32 count4;
2149 u32 count5;
2150 u32 count6;
2151 u32 count7;
2152 u32 count8;
2153 u32 count9;
2154 };
2155
2156 #if (SUPPORT_EPTA)
2157 struct xradio_epta_bt_link_info {
2158 u8 link_id;
2159 u8 traffic_priority;
2160 u8 traffic_type;
2161 u8 master_or_slave;
2162 u8 curr_req_ongoing;
2163 u8 pad[3];
2164 u32 time_diff_req_start; //refer to curr_req_ongoing
2165 u32 rt_si;
2166 u32 rt_sw;
2167 u32 msg_si;
2168 u32 msg_sw;
2169 u32 requests;
2170 u32 granted_requests;
2171 u32 bt_tx_retry_num;
2172 u32 bt_caton_num;
2173 } __packed;
2174 struct xradio_epta_wl_req_info {
2175 u32 cnt_win;
2176 u32 cnt_lose;
2177 u16 cnt_grant_med_ret;
2178 u16 cnt_grant_timeout;
2179 u16 cnt_abort_miss_rx;
2180 u16 cnt_abort_expired;
2181 u32 granted_time;
2182 u32 gr_used_time;
2183 } __packed;
2184
2185 struct xradio_epta_stat {
2186 u16 msg_len;
2187 u16 msg_id;
2188 u32 status;
2189 u8 medium_state;
2190 u8 wlan_req_ongoing;
2191 u8 wlan_req_type;
2192 u8 wlan_req_priority;
2193 u32 wlan_req_request_dur;
2194
2195 // u32 grant_or_wait_time; //refer to medium_state
2196
2197 struct xradio_epta_wl_req_info wl_req_info[4];
2198
2199 u16 cnt_ex_grant_uapsd;
2200 u16 cnt_ex_abort_pspoll;
2201 u16 cnt_ex_abort_rx_bcn;
2202 u16 cnt_bt_abort;
2203 u16 cnt_bt_abort_tx;
2204 u16 cnt_bt_abort_tx_fix;
2205 // u8 pad1[2];
2206
2207 u32 nrt_wlan_quota_used;
2208 u32 nrt_bt_quota_used;
2209 u32 nrt_bt_requests;
2210 u32 nrt_bt_granted_requestd;
2211 u32 nrt_bt_granted_req_max_gap;
2212 u16 cnt_bt_tx_poll_pkt_req;
2213 u16 cnt_bt_tx_dm1_pkt_req;
2214 u16 cnt_bt_tx_br_pkt_req;
2215 u16 cnt_bt_tx_edr_pkt_req;
2216 u16 cnt_bt_tx_sco_pkt_req;
2217 u16 cnt_reserved;
2218 u8 num_active_rt_bt_links;
2219 u8 pad2[3];
2220 struct xradio_epta_bt_link_info bt_link_info[7];
2221 } __packed;
2222
2223 extern struct xradio_epta_stat debug_epta_stat;
2224
2225 #endif //SUPPORT_EPTA
2226
2227 /*for read/write fw registers*/
2228 #define WSM_REG_RW_F BIT(0) /*0:read, 1:write*/
2229 #define WSM_REG_RET_F BIT(1) /*results is valid.*/
2230 #define WSM_REG_BK_F BIT(4) /*operate in block mode.*/
2231
2232 struct reg_data {
2233 u32 reg_addr;
2234 u32 reg_val;
2235 };
2236
2237 typedef struct tag_wsm_reg_w {
2238 u16 flag;
2239 u16 data_size;
2240 struct reg_data arg[16];
2241 } WSM_REG_W;
2242
2243 typedef struct tag_wsm_reg_r {
2244 u16 flag;
2245 u16 data_size;
2246 u32 arg[16];
2247 } WSM_REG_R;
2248
2249 struct wsm_backoff_ctrl {
2250 u32 enable;
2251 u32 min;
2252 u32 max;
2253 };
2254 struct wsm_tala_para {
2255 u32 para;
2256 u32 thresh;
2257 };
wsm_get_counters_table(struct xradio_common * hw_priv,struct wsm_counters_table * arg)2258 static inline int wsm_get_counters_table(struct xradio_common *hw_priv,
2259 struct wsm_counters_table *arg)
2260 {
2261 return wsm_read_mib(hw_priv, WSM_MIB_ID_COUNTERS_TABLE,
2262 arg, sizeof(*arg), 0);
2263 }
2264
wsm_get_ampducounters_table(struct xradio_common * hw_priv,struct wsm_ampducounters_table * arg)2265 static inline int wsm_get_ampducounters_table(struct xradio_common *hw_priv,
2266 struct wsm_ampducounters_table *arg)
2267 {
2268 return wsm_read_mib(hw_priv, WSM_MIB_ID_AMPDUCOUNTERS_TABLE,
2269 arg, sizeof(*arg), 0);
2270 }
2271
wsm_get_txpipe_table(struct xradio_common * hw_priv,struct wsm_txpipe_counter * arg)2272 static inline int wsm_get_txpipe_table(struct xradio_common *hw_priv,
2273 struct wsm_txpipe_counter *arg)
2274 {
2275 return wsm_read_mib(hw_priv, WSM_MIB_ID_TXPIPE_TABLE,
2276 arg, sizeof(*arg), 0);
2277 }
2278
2279 #if (SUPPORT_EPTA)
wsm_get_epta_statistics(struct xradio_common * hw_priv,struct xradio_epta_stat * arg)2280 static inline int wsm_get_epta_statistics(struct xradio_common *hw_priv,
2281 struct xradio_epta_stat *arg)
2282 {
2283 return wsm_read_mib(hw_priv, WSM_MIB_ID_EPTA_STAT,
2284 arg, sizeof(*arg), 0);
2285 }
2286
count_ones(int n)2287 static inline int count_ones(int n)
2288 {
2289 int i = 0;
2290 while (n != 0) {
2291 i++;
2292 n = n & (n-1);
2293 }
2294 return i;
2295 }
wsm_set_epta_stat_dbg_ctrl(struct xradio_common * hw_priv,int epta_stat_ctrl)2296 static inline int wsm_set_epta_stat_dbg_ctrl(struct xradio_common *hw_priv, int epta_stat_ctrl)
2297 {
2298 __le32 val = __cpu_to_le32(epta_stat_ctrl);
2299 return wsm_write_mib(hw_priv, WSM_MIB_ID_EPTA_STAT_CTRL, &val, sizeof(val), 0);
2300 }
2301 #endif
2302
wsm_get_backoff_dbg(struct xradio_common * hw_priv,struct wsm_backoff_counter * arg)2303 static inline int wsm_get_backoff_dbg(struct xradio_common *hw_priv,
2304 struct wsm_backoff_counter *arg)
2305 {
2306 return wsm_read_mib(hw_priv, WSM_MIB_ID_BACKOFF_DBG,
2307 arg, sizeof(*arg), 0);
2308 }
2309
wsm_set_backoff_ctrl(struct xradio_common * hw_priv,struct wsm_backoff_ctrl * arg)2310 static inline int wsm_set_backoff_ctrl(struct xradio_common *hw_priv,
2311 struct wsm_backoff_ctrl *arg)
2312 {
2313 return wsm_write_mib(hw_priv, WSM_MIB_ID_BACKOFF_CTRL,
2314 arg, sizeof(*arg), 0);
2315 }
2316
wsm_set_tala(struct xradio_common * hw_priv,struct wsm_tala_para * arg)2317 static inline int wsm_set_tala(struct xradio_common *hw_priv,
2318 struct wsm_tala_para *arg)
2319 {
2320 return wsm_write_mib(hw_priv, WSM_MIB_ID_SET_TALA_PARA,
2321 arg, sizeof(*arg), 0);
2322 }
wsm_get_station_id(struct xradio_common * hw_priv,u8 * mac)2323 static inline int wsm_get_station_id(struct xradio_common *hw_priv, u8 *mac)
2324 {
2325 return wsm_read_mib(hw_priv, WSM_MIB_ID_DOT11_STATION_ID, mac,
2326 ETH_ALEN, 0);
2327 }
2328
2329 struct wsm_rx_filter {
2330 bool promiscuous;
2331 bool bssid;
2332 bool fcs;
2333 bool probeResponder;
2334 bool keepalive;
2335 };
2336
wsm_set_rx_filter(struct xradio_common * hw_priv,const struct wsm_rx_filter * arg,int if_id)2337 static inline int wsm_set_rx_filter(struct xradio_common *hw_priv,
2338 const struct wsm_rx_filter *arg,
2339 int if_id)
2340 {
2341 __le32 val = 0;
2342 if (arg->promiscuous)
2343 val |= __cpu_to_le32(BIT(0));
2344 if (arg->bssid)
2345 val |= __cpu_to_le32(BIT(1));
2346 if (arg->fcs)
2347 val |= __cpu_to_le32(BIT(2));
2348 if (arg->probeResponder)
2349 val |= __cpu_to_le32(BIT(3));
2350 if (arg->keepalive)
2351 val |= __cpu_to_le32(BIT(4));
2352 return wsm_write_mib(hw_priv, WSM_MIB_ID_RX_FILTER, &val, sizeof(val),
2353 if_id);
2354 }
2355
2356 int wsm_set_probe_responder(struct xradio_vif *priv, bool enable);
2357 int wsm_set_keepalive_filter(struct xradio_vif *priv, bool enable);
2358
2359 #define WSM_BEACON_FILTER_IE_HAS_CHANGED BIT(0)
2360 #define WSM_BEACON_FILTER_IE_NO_LONGER_PRESENT BIT(1)
2361 #define WSM_BEACON_FILTER_IE_HAS_APPEARED BIT(2)
2362
2363 struct wsm_beacon_filter_table_entry {
2364 u8 ieId;
2365 u8 actionFlags;
2366 u8 oui[3];
2367 u8 matchData[3];
2368 } __packed;
2369
2370 struct wsm_beacon_filter_table {
2371 __le32 numOfIEs;
2372 struct wsm_beacon_filter_table_entry entry[10];
2373 } __packed;
2374
wsm_set_beacon_filter_table(struct xradio_common * hw_priv,struct wsm_beacon_filter_table * ft,int if_id)2375 static inline int wsm_set_beacon_filter_table(struct xradio_common *hw_priv,
2376 struct wsm_beacon_filter_table *ft,
2377 int if_id)
2378 {
2379 size_t size = __le32_to_cpu(ft->numOfIEs) *
2380 sizeof(struct wsm_beacon_filter_table_entry) +
2381 sizeof(__le32);
2382
2383 return wsm_write_mib(hw_priv, WSM_MIB_ID_BEACON_FILTER_TABLE, ft, size,
2384 if_id);
2385 }
2386
2387 /* Enable/disable beacon filtering */
2388 #define WSM_BEACON_FILTER_ENABLE BIT(0)
2389 /* If 1 FW will handle ERP IE changes internally */
2390 #define WSM_BEACON_FILTER_AUTO_ERP BIT(1)
2391
2392 #ifdef SUPPORT_HT40
2393
2394 #define WSM_BEACON_FILTER_AUTO_HT BIT(2)
2395
2396 #endif
2397
2398 struct wsm_beacon_filter_control {
2399 int enabled;
2400 int bcn_count;
2401 };
2402
wsm_beacon_filter_control(struct xradio_common * hw_priv,struct wsm_beacon_filter_control * arg,int if_id)2403 static inline int wsm_beacon_filter_control(struct xradio_common *hw_priv,
2404 struct wsm_beacon_filter_control *arg,
2405 int if_id)
2406 {
2407 struct {
2408 __le32 enabled;
2409 __le32 bcn_count;
2410 } val;
2411 val.enabled = __cpu_to_le32(arg->enabled);
2412 val.bcn_count = __cpu_to_le32(arg->bcn_count);
2413 return wsm_write_mib(hw_priv, WSM_MIB_ID_BEACON_FILTER_ENABLE, &val,
2414 sizeof(val), if_id);
2415 }
2416
2417 enum wsm_power_mode {
2418 wsm_power_mode_active = 0,
2419 wsm_power_mode_doze = 1,
2420 wsm_power_mode_quiescent = 2,
2421 };
2422
2423 struct wsm_operational_mode {
2424 enum wsm_power_mode power_mode;
2425 int disableMoreFlagUsage;
2426 int performAntDiversity;
2427 };
2428
2429 #ifdef CONFIG_XRADIO_DEBUGFS
2430 extern u8 low_pwr_disable;
2431 #endif
2432
wsm_set_operational_mode(struct xradio_common * hw_priv,const struct wsm_operational_mode * arg,int if_id)2433 static inline int wsm_set_operational_mode(struct xradio_common *hw_priv,
2434 const struct wsm_operational_mode *arg,
2435 int if_id)
2436 {
2437 u32 val = arg->power_mode;
2438
2439 #ifdef CONFIG_XRADIO_DEBUGFS
2440 if (low_pwr_disable) /*disable low_power mode.*/
2441 val = wsm_power_mode_active;
2442 #endif
2443
2444 if (arg->disableMoreFlagUsage)
2445 val |= BIT(4);
2446 if (arg->performAntDiversity)
2447 val |= BIT(5);
2448 return wsm_write_mib(hw_priv, WSM_MIB_ID_OPERATIONAL_POWER_MODE, &val,
2449 sizeof(val), if_id);
2450 }
2451
2452 struct wsm_inactivity {
2453 u8 max_inactivity;
2454 u8 min_inactivity;
2455 };
2456
wsm_set_inactivity(struct xradio_common * hw_priv,const struct wsm_inactivity * arg,int if_id)2457 static inline int wsm_set_inactivity(struct xradio_common *hw_priv,
2458 const struct wsm_inactivity *arg,
2459 int if_id)
2460 {
2461 struct {
2462 u8 min_inactive;
2463 u8 max_inactive;
2464 u16 reserved;
2465 } val;
2466
2467 val.max_inactive = arg->max_inactivity;
2468 val.min_inactive = arg->min_inactivity;
2469 val.reserved = 0;
2470
2471 return wsm_write_mib(hw_priv, WSM_MIB_ID_SET_INACTIVITY, &val,
2472 sizeof(val), if_id);
2473 }
2474
2475 #ifdef SUPPORT_HT40
2476
2477 struct template_frame_hdr {
2478 u16 frame_type;
2479 u16 rate_entry;
2480 u32 frmlen; /* not include itself. */
2481 };
2482
2483 #endif
2484
2485 #ifdef SUPPORT_HT40
2486
2487 struct wsm_template_frame {
2488 u16 frame_type;
2489 u16 rate;
2490 bool disable;
2491 struct sk_buff *skb;
2492 };
2493
2494 #else
2495
2496 struct wsm_template_frame {
2497 u8 frame_type;
2498 u8 rate;
2499 bool disable;
2500 struct sk_buff *skb;
2501 };
2502
2503 #endif
2504
2505 #ifdef SUPPORT_HT40
2506
wsm_set_template_frame(struct xradio_common * hw_priv,struct wsm_template_frame * arg,int if_id)2507 static inline int wsm_set_template_frame(struct xradio_common *hw_priv,
2508 struct wsm_template_frame *arg,
2509 int if_id)
2510 {
2511 int ret;
2512 struct template_frame_hdr *tmp_hdr = NULL;
2513 tmp_hdr = (struct template_frame_hdr *)
2514 skb_push(arg->skb, sizeof(*tmp_hdr));
2515 tmp_hdr->frame_type = arg->frame_type;
2516 tmp_hdr->rate_entry = arg->rate;
2517 if (arg->disable)
2518 tmp_hdr->frmlen = 0;
2519 else
2520 tmp_hdr->frmlen =
2521 __cpu_to_le32(arg->skb->len - sizeof(*tmp_hdr));
2522
2523 ret = wsm_write_mib(hw_priv, WSM_MIB_ID_TEMPLATE_FRAME, (void *)tmp_hdr,
2524 arg->skb->len, if_id);
2525 skb_pull(arg->skb, sizeof(*tmp_hdr));
2526 return ret;
2527 }
2528
2529 #else
2530
wsm_set_template_frame(struct xradio_common * hw_priv,struct wsm_template_frame * arg,int if_id)2531 static inline int wsm_set_template_frame(struct xradio_common *hw_priv,
2532 struct wsm_template_frame *arg,
2533 int if_id)
2534 {
2535 int ret;
2536 u8 *p = skb_push(arg->skb, 4);
2537 p[0] = arg->frame_type;
2538 p[1] = arg->rate;
2539 if (arg->disable)
2540 ((u16 *) p)[1] = 0;
2541 else
2542 ((u16 *) p)[1] = __cpu_to_le16(arg->skb->len - 4);
2543 ret = wsm_write_mib(hw_priv, WSM_MIB_ID_TEMPLATE_FRAME, p,
2544 arg->skb->len, if_id);
2545 skb_pull(arg->skb, 4);
2546 return ret;
2547 }
2548
2549 #endif
2550
2551 struct wsm_protected_mgmt_policy {
2552 bool protectedMgmtEnable;
2553 bool unprotectedMgmtFramesAllowed;
2554 bool encryptionForAuthFrame;
2555 };
2556
2557 static inline int
wsm_set_protected_mgmt_policy(struct xradio_common * hw_priv,struct wsm_protected_mgmt_policy * arg,int if_id)2558 wsm_set_protected_mgmt_policy(struct xradio_common *hw_priv,
2559 struct wsm_protected_mgmt_policy *arg,
2560 int if_id)
2561 {
2562 __le32 val = 0;
2563 int ret;
2564 if (arg->protectedMgmtEnable)
2565 val |= __cpu_to_le32(BIT(0));
2566 if (arg->unprotectedMgmtFramesAllowed)
2567 val |= __cpu_to_le32(BIT(1));
2568 if (arg->encryptionForAuthFrame)
2569 val |= __cpu_to_le32(BIT(2));
2570 ret = wsm_write_mib(hw_priv, WSM_MIB_ID_PROTECTED_MGMT_POLICY, &val,
2571 sizeof(val), if_id);
2572 return ret;
2573 }
2574
wsm_set_block_ack_policy(struct xradio_common * hw_priv,u8 blockAckTxTidPolicy,u8 blockAckRxTidPolicy,int if_id)2575 static inline int wsm_set_block_ack_policy(struct xradio_common *hw_priv,
2576 u8 blockAckTxTidPolicy,
2577 u8 blockAckRxTidPolicy,
2578 int if_id)
2579 {
2580 struct {
2581 u8 blockAckTxTidPolicy;
2582 u8 reserved1;
2583 u8 blockAckRxTidPolicy;
2584 u8 reserved2;
2585 } val = {
2586 .blockAckTxTidPolicy = blockAckTxTidPolicy,
2587 .blockAckRxTidPolicy = blockAckRxTidPolicy,
2588 };
2589 return wsm_write_mib(hw_priv, WSM_MIB_ID_BLOCK_ACK_POLICY, &val,
2590 sizeof(val), if_id);
2591 }
2592
2593 #ifdef SUPPORT_HT40
2594
2595 struct wsm_association_mode {
2596 u8 flags; /* WSM_ASSOCIATION_MODE_... */
2597 /*u8 preambleType;*/ /* WSM_JOIN_PREAMBLE_... */
2598 /*u8 greenfieldMode;*/ /* 1 for greenfield */
2599 struct phy_mode_cfg PhyModeCfg;
2600 u8 mpduStartSpacing;
2601 __le32 basicRateSet;
2602 };
2603
2604 #else
2605
2606 struct wsm_association_mode {
2607 u8 flags; /* WSM_ASSOCIATION_MODE_... */
2608 u8 preambleType; /* WSM_JOIN_PREAMBLE_... */
2609 u8 greenfieldMode; /* 1 for greenfield */
2610 u8 mpduStartSpacing;
2611 __le32 basicRateSet;
2612 };
2613
2614 #endif
2615
wsm_set_association_mode(struct xradio_common * hw_priv,struct wsm_association_mode * arg,int if_id)2616 static inline int wsm_set_association_mode(struct xradio_common *hw_priv,
2617 struct wsm_association_mode *arg,
2618 int if_id)
2619 {
2620 return wsm_write_mib(hw_priv, WSM_MIB_ID_SET_ASSOCIATION_MODE, arg,
2621 sizeof(*arg), if_id);
2622 }
2623
2624 struct wsm_set_tx_rate_retry_policy_header {
2625 u8 numTxRatePolicies;
2626 u8 reserved[3];
2627 } __packed;
2628
2629 struct wsm_set_tx_rate_retry_policy_policy {
2630 u8 policyIndex;
2631 u8 shortRetryCount;
2632 u8 longRetryCount;
2633 u8 policyFlags;
2634 u8 rateRecoveryCount;
2635 u8 reserved[3];
2636
2637 #ifdef SUPPORT_HT40
2638
2639 /* [15, 14]:ModemType, [13, 12]:Bandwidth, [11, 8]:FormatFlag,
2640 * [7, 4]: RateIndex, [3:0]: MaxRetry*/
2641 __le16 rate_entrys[MAX_RATES_STAGE];
2642
2643 #else
2644
2645 __le32 rateCountIndices[3];
2646
2647 #endif
2648 } __packed;
2649
2650 #ifdef SUPPORT_HT40
2651 #define TX_POLICY_CACHE_SIZE (16)
2652 #else
2653 #define TX_POLICY_CACHE_SIZE (8)
2654 #endif
2655
2656 struct wsm_set_tx_rate_retry_policy {
2657 struct wsm_set_tx_rate_retry_policy_header hdr;
2658 struct wsm_set_tx_rate_retry_policy_policy tbl[TX_POLICY_CACHE_SIZE];
2659 } __packed;
2660
wsm_set_tx_rate_retry_policy(struct xradio_common * hw_priv,struct wsm_set_tx_rate_retry_policy * arg,int if_id)2661 static inline int wsm_set_tx_rate_retry_policy(struct xradio_common *hw_priv,
2662 struct wsm_set_tx_rate_retry_policy *arg,
2663 int if_id)
2664 {
2665 size_t size = sizeof(struct wsm_set_tx_rate_retry_policy_header) +
2666 arg->hdr.numTxRatePolicies *
2667 sizeof(struct wsm_set_tx_rate_retry_policy_policy);
2668 return wsm_write_mib(hw_priv, WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg,
2669 size, if_id);
2670 }
2671
2672 /* 4.32 SetEtherTypeDataFrameFilter */
2673 struct wsm_ether_type_filter_hdr {
2674 u8 nrFilters; /* Up to WSM_MAX_FILTER_ELEMENTS */
2675 u8 reserved[3];
2676 } __packed;
2677
2678 struct wsm_ether_type_filter {
2679 u8 filterAction; /* WSM_FILTER_ACTION_XXX */
2680 u8 reserved;
2681 __le16 etherType; /* Type of ethernet frame */
2682 } __packed;
2683
wsm_set_ether_type_filter(struct xradio_common * hw_priv,struct wsm_ether_type_filter_hdr * arg,int if_id)2684 static inline int wsm_set_ether_type_filter(struct xradio_common *hw_priv,
2685 struct wsm_ether_type_filter_hdr *arg,
2686 int if_id)
2687 {
2688 size_t size = sizeof(struct wsm_ether_type_filter_hdr) +
2689 arg->nrFilters * sizeof(struct wsm_ether_type_filter);
2690 return wsm_write_mib(hw_priv, WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER,
2691 arg, size, if_id);
2692 }
2693
2694
2695 /* 4.33 SetUDPPortDataFrameFilter */
2696 struct wsm_udp_port_filter_hdr {
2697 u8 nrFilters; /* Up to WSM_MAX_FILTER_ELEMENTS */
2698 u8 reserved[3];
2699 } __packed;
2700
2701 struct wsm_udp_port_filter {
2702 u8 filterAction; /* WSM_FILTER_ACTION_XXX */
2703 u8 portType; /* WSM_FILTER_PORT_TYPE_XXX */
2704 __le16 udpPort; /* Port number */
2705 } __packed;
2706
wsm_set_udp_port_filter(struct xradio_common * hw_priv,struct wsm_udp_port_filter_hdr * arg,int if_id)2707 static inline int wsm_set_udp_port_filter(struct xradio_common *hw_priv,
2708 struct wsm_udp_port_filter_hdr *arg,
2709 int if_id)
2710 {
2711 size_t size = sizeof(struct wsm_udp_port_filter_hdr) +
2712 arg->nrFilters * sizeof(struct wsm_udp_port_filter);
2713 return wsm_write_mib(hw_priv, WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER,
2714 arg, size, if_id);
2715 }
2716
2717 /* Undocumented MIBs: */
2718 /* 4.35 P2PDeviceInfo */
2719 #define D11_MAX_SSID_LEN (32)
2720
2721 struct wsm_p2p_device_type {
2722 __le16 categoryId;
2723 u8 oui[4];
2724 __le16 subCategoryId;
2725 } __packed;
2726
2727 struct wsm_p2p_device_info {
2728 struct wsm_p2p_device_type primaryDevice;
2729 u8 reserved1[3];
2730 u8 devNameSize;
2731 u8 localDevName[D11_MAX_SSID_LEN];
2732 u8 reserved2[3];
2733 u8 numSecDevSupported;
2734 struct wsm_p2p_device_type secondaryDevices[0];
2735 } __packed;
2736
2737 /* 4.36 SetWCDMABand - WO */
2738 struct wsm_cdma_band {
2739 u8 WCDMA_Band;
2740 u8 reserved[3];
2741 } __packed;
2742
2743 /* 4.37 GroupTxSequenceCounter - RO */
2744 struct wsm_group_tx_seq {
2745 __le32 bits_47_16;
2746 __le16 bits_15_00;
2747 __le16 reserved;
2748 } __packed;
2749
2750 /* 4.39 SetHtProtection - WO */
2751 #define WSM_DUAL_CTS_PROT_ENB (1 << 0)
2752 #define WSM_NON_GREENFIELD_STA (1 << 1)
2753 #define WSM_HT_PROT_MODE__NO_PROT (0 << 2)
2754 #define WSM_HT_PROT_MODE__NON_MEMBER (1 << 2)
2755 #define WSM_HT_PROT_MODE__20_MHZ (2 << 2)
2756 #define WSM_HT_PROT_MODE__NON_HT_MIXED (3 << 2)
2757 #define WSM_LSIG_TXOP_PROT_FULL (1 << 4)
2758 #define WSM_LARGE_L_LENGTH_PROT (1 << 5)
2759
2760 struct wsm_ht_protection {
2761 __le32 flags;
2762 } __packed;
2763
2764 /* 4.40 GPIO Command - R/W */
2765 #define WSM_GPIO_COMMAND_SETUP 0
2766 #define WSM_GPIO_COMMAND_READ 1
2767 #define WSM_GPIO_COMMAND_WRITE 2
2768 #define WSM_GPIO_COMMAND_RESET 3
2769 #define WSM_GPIO_ALL_PINS 0xFF
2770
2771 struct wsm_gpio_command {
2772 u8 GPIO_Command;
2773 u8 pin;
2774 __le16 config;
2775 } __packed;
2776
2777 /* 4.41 TSFCounter - RO */
2778 struct wsm_tsf_counter {
2779 __le64 TSF_Counter;
2780 } __packed;
2781
2782 /* 4.43 Keep alive period */
2783 struct wsm_keep_alive_period {
2784 __le16 keepAlivePeriod;
2785 u8 reserved[2];
2786 } __packed;
2787
wsm_keep_alive_period(struct xradio_common * hw_priv,int period,int if_id)2788 static inline int wsm_keep_alive_period(struct xradio_common *hw_priv,
2789 int period, int if_id)
2790 {
2791 struct wsm_keep_alive_period arg = {
2792 .keepAlivePeriod = __cpu_to_le16(period),
2793 };
2794 return wsm_write_mib(hw_priv, WSM_MIB_ID_KEEP_ALIVE_PERIOD,
2795 &arg, sizeof(arg), if_id);
2796 };
2797
2798 /* BSSID filtering */
2799 struct wsm_set_bssid_filtering {
2800 u8 filter;
2801 u8 reserved[3];
2802 } __packed;
2803
wsm_set_bssid_filtering(struct xradio_common * hw_priv,bool enabled,int if_id)2804 static inline int wsm_set_bssid_filtering(struct xradio_common *hw_priv,
2805 bool enabled, int if_id)
2806 {
2807 struct wsm_set_bssid_filtering arg = {
2808 .filter = !enabled,
2809 };
2810 return wsm_write_mib(hw_priv, WSM_MIB_ID_DISABLE_BSSID_FILTER,
2811 &arg, sizeof(arg), if_id);
2812 }
2813
2814 /* Multicat filtering - 4.5 */
2815 struct wsm_multicast_filter {
2816 __le32 enable;
2817 __le32 numOfAddresses;
2818 u8 macAddress[WSM_MAX_GRP_ADDRTABLE_ENTRIES][ETH_ALEN];
2819 } __packed;
2820
2821 /* Mac Addr Filter Info */
2822 struct wsm_mac_addr_info {
2823 u8 filter_mode;
2824 u8 address_mode;
2825 u8 MacAddr[6];
2826 } __packed;
2827
2828 /* Mac Addr Filter */
2829 struct wsm_mac_addr_filter {
2830 u8 numfilter;
2831 u8 action_mode;
2832 u8 Reserved[2];
2833 struct wsm_mac_addr_info macaddrfilter[0];
2834 } __packed;
2835
2836 /* Broadcast Addr Filter */
2837 struct wsm_broadcast_addr_filter {
2838 u8 action_mode;
2839 u8 nummacaddr;
2840 u8 filter_mode;
2841 u8 address_mode;
2842 u8 MacAddr[6];
2843 } __packed;
2844
wsm_set_multicast_filter(struct xradio_common * hw_priv,struct wsm_multicast_filter * fp,int if_id)2845 static inline int wsm_set_multicast_filter(struct xradio_common *hw_priv,
2846 struct wsm_multicast_filter *fp,
2847 int if_id)
2848 {
2849 return wsm_write_mib(hw_priv, WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE,
2850 fp, sizeof(*fp), if_id);
2851 }
2852
2853 /* ARP IPv4 filtering - 4.10 */
2854 struct wsm_arp_ipv4_filter {
2855 __le32 enable;
2856 __be32 ipv4Address[WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES];
2857 } __packed;
2858
2859 #ifdef IPV6_FILTERING
2860 /* NDP IPv6 filtering */
2861 struct wsm_ndp_ipv6_filter {
2862 __le32 enable;
2863 struct in6_addr ipv6Address[WSM_MAX_NDP_IP_ADDRTABLE_ENTRIES];
2864 } __packed;
2865 /* IPV6 Addr Filter Info */
2866 struct wsm_ip6_addr_info {
2867 u8 filter_mode;
2868 u8 address_mode;
2869 u8 Reserved[2];
2870 u8 ipv6[16];
2871 };
2872
2873 /* IPV6 Addr Filter */
2874 struct wsm_ipv6_filter {
2875 u8 numfilter;
2876 u8 action_mode;
2877 u8 Reserved[2];
2878 struct wsm_ip6_addr_info ipv6filter[0];
2879 } __packed;
2880 #endif /*IPV6_FILTERING*/
2881
wsm_set_arp_ipv4_filter(struct xradio_common * hw_priv,struct wsm_arp_ipv4_filter * fp,int if_id)2882 static inline int wsm_set_arp_ipv4_filter(struct xradio_common *hw_priv,
2883 struct wsm_arp_ipv4_filter *fp,
2884 int if_id)
2885 {
2886 return wsm_write_mib(hw_priv, WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE,
2887 fp, sizeof(*fp), if_id);
2888 }
2889
2890 #ifdef IPV6_FILTERING
wsm_set_ndp_ipv6_filter(struct xradio_common * priv,struct wsm_ndp_ipv6_filter * fp,int if_id)2891 static inline int wsm_set_ndp_ipv6_filter(struct xradio_common *priv,
2892 struct wsm_ndp_ipv6_filter *fp,
2893 int if_id)
2894 {
2895 return wsm_write_mib(priv, WSM_MIB_ID_NS_IP_ADDRESSES_TABLE,
2896 fp, sizeof(*fp), if_id);
2897 }
2898 #endif /*IPV6_FILTERING*/
2899
2900 /* P2P Power Save Mode Info - 4.31 */
2901 struct wsm_p2p_ps_modeinfo {
2902 u8 oppPsCTWindow;
2903 u8 count;
2904 u8 reserved;
2905 u8 dtimCount;
2906 __le32 duration;
2907 __le32 interval;
2908 __le32 startTime;
2909 } __packed;
2910
wsm_set_p2p_ps_modeinfo(struct xradio_common * hw_priv,struct wsm_p2p_ps_modeinfo * mi,int if_id)2911 static inline int wsm_set_p2p_ps_modeinfo(struct xradio_common *hw_priv,
2912 struct wsm_p2p_ps_modeinfo *mi,
2913 int if_id)
2914 {
2915 return wsm_write_mib(hw_priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
2916 mi, sizeof(*mi), if_id);
2917 }
2918
wsm_get_p2p_ps_modeinfo(struct xradio_common * hw_priv,struct wsm_p2p_ps_modeinfo * mi)2919 static inline int wsm_get_p2p_ps_modeinfo(struct xradio_common *hw_priv,
2920 struct wsm_p2p_ps_modeinfo *mi)
2921 {
2922 return wsm_read_mib(hw_priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
2923 mi, sizeof(*mi), 0);
2924 }
2925
2926 /* UseMultiTxConfMessage */
2927
wsm_use_multi_tx_conf(struct xradio_common * hw_priv,u32 enable,int if_id)2928 static inline int wsm_use_multi_tx_conf(struct xradio_common *hw_priv,
2929 u32 enable, int if_id)
2930 {
2931 __le32 arg = enable;
2932 return wsm_write_mib(hw_priv, WSM_MIB_USE_MULTI_TX_CONF,
2933 &arg, sizeof(arg), if_id);
2934 }
2935
2936
2937 /* 4.26 SetUpasdInformation */
2938 struct wsm_uapsd_info {
2939 __le16 uapsdFlags;
2940 __le16 minAutoTriggerInterval;
2941 __le16 maxAutoTriggerInterval;
2942 __le16 autoTriggerStep;
2943 };
2944
wsm_set_uapsd_info(struct xradio_common * hw_priv,struct wsm_uapsd_info * arg,int if_id)2945 static inline int wsm_set_uapsd_info(struct xradio_common *hw_priv,
2946 struct wsm_uapsd_info *arg,
2947 int if_id)
2948 {
2949 /* TODO:COMBO:UAPSD will be supported only on one interface */
2950 return wsm_write_mib(hw_priv, WSM_MIB_ID_SET_UAPSD_INFORMATION,
2951 arg, sizeof(*arg), if_id);
2952 }
2953
2954 /* 4.22 OverrideInternalTxRate */
2955 #ifdef SUPPORT_HT40
2956
2957 struct wsm_override_internal_txrate {
2958 u16 internalTxRateEntry;
2959 u16 nonErpInterTxRateEntry;
2960 } __packed;
2961
2962 #else
2963
2964 struct wsm_override_internal_txrate {
2965 u8 internalTxRate;
2966 u8 nonErpInternalTxRate;
2967 u8 reserved[2];
2968 } __packed;
2969
2970 #endif
2971
2972 static inline int
wsm_set_override_internal_txrate(struct xradio_common * hw_priv,struct wsm_override_internal_txrate * arg,int if_id)2973 wsm_set_override_internal_txrate(struct xradio_common *hw_priv,
2974 struct wsm_override_internal_txrate *arg,
2975 int if_id)
2976 {
2977 return wsm_write_mib(hw_priv, WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE,
2978 arg, sizeof(*arg), if_id);
2979 }
2980 #ifdef MCAST_FWDING
2981 /* 4.51 SetForwardingOffload */
2982 struct wsm_forwarding_offload {
2983 u8 fwenable;
2984 u8 flags;
2985 u8 reserved[2];
2986 } __packed;
2987
wsm_set_forwarding_offlad(struct xradio_common * hw_priv,struct wsm_forwarding_offload * arg,int if_id)2988 static inline int wsm_set_forwarding_offlad(struct xradio_common *hw_priv,
2989 struct wsm_forwarding_offload *arg, int if_id)
2990 {
2991 return wsm_write_mib(hw_priv, WSM_MIB_ID_FORWARDING_OFFLOAD,
2992 arg, sizeof(*arg), if_id);
2993 }
2994
2995 #endif
2996 /* ******************************************************************** */
2997 /* WSM TX port control */
2998
2999 void wsm_lock_tx(struct xradio_common *hw_priv);
3000 void wsm_vif_lock_tx(struct xradio_vif *priv);
3001 void wsm_lock_tx_async(struct xradio_common *hw_priv);
3002 bool wsm_flush_tx(struct xradio_common *hw_priv);
3003 bool wsm_vif_flush_tx(struct xradio_vif *priv);
3004 void wsm_unlock_tx(struct xradio_common *hw_priv);
3005
3006 /* ******************************************************************** */
3007 /* WSM / BH API */
3008
3009 int wsm_handle_exception(struct xradio_common *hw_priv, u8 *data, size_t len);
3010 int wsm_handle_rx(struct xradio_common *hw_priv, u8 flags, struct sk_buff **skb_p);
3011 void wsm_send_deauth_to_self(struct xradio_common *hw_priv,
3012 struct xradio_vif *priv);
3013 void wsm_send_disassoc_to_self(struct xradio_common *hw_priv,
3014 struct xradio_vif *priv);
3015
3016 /* ******************************************************************** */
3017 /* wsm_buf API */
3018
3019 struct wsm_buf {
3020 u8 *begin;
3021 u8 *data;
3022 u8 *end;
3023 };
3024
3025 void wsm_buf_init(struct wsm_buf *buf, int size);
3026 void wsm_buf_deinit(struct wsm_buf *buf);
3027
3028 /* ******************************************************************** */
3029 /* wsm_cmd API */
3030
3031 struct wsm_cmd {
3032 spinlock_t lock;
3033 int done;
3034 u8 *ptr;
3035 size_t len;
3036 void *arg;
3037 int ret;
3038 u16 cmd;
3039 u16 seq;
3040 };
3041
3042 /* ******************************************************************** */
3043 /* WSM TX buffer access */
3044
3045 int wsm_get_tx(struct xradio_common *hw_priv, u8 **data,
3046 size_t *tx_len, int *burst, int *vif_selected);
3047 void wsm_txed(struct xradio_common *hw_priv, u8 *data);
3048
3049 /* ******************************************************************** */
3050 /* Queue mapping: WSM <---> linux */
3051 /* Linux: VO VI BE BK */
3052 /* WSM: BE BK VI VO */
3053
wsm_queue_id_to_linux(u8 queueId)3054 static inline u8 wsm_queue_id_to_linux(u8 queueId)
3055 {
3056 static const u8 queue_mapping[] = {
3057 2, 3, 1, 0
3058 };
3059 return queue_mapping[queueId];
3060 }
3061
wsm_queue_id_to_wsm(u8 queueId)3062 static inline u8 wsm_queue_id_to_wsm(u8 queueId)
3063 {
3064 static const u8 queue_mapping[] = {
3065 3, 2, 0, 1
3066 };
3067 return queue_mapping[queueId];
3068 }
3069
3070 /***********WSM API**************/
3071
3072 /*
3073 * return the length of wsm frame
3074 */
wsm_get_len(struct wsm_hdr * wsm)3075 static inline u16 wsm_get_len(struct wsm_hdr *wsm)
3076 {
3077 return wsm->len;
3078 }
3079
3080 /*
3081 * return the id of wsm frame
3082 */
wsm_get_id(struct wsm_hdr * wsm)3083 static inline u16 wsm_get_id(struct wsm_hdr *wsm)
3084 {
3085 return ((wsm->id) & WSM_MSG_ID_MASK);
3086 }
3087
3088 /*
3089 * return the 80211 frame ptr in wsm tx frame
3090 * only use it in a complete wsm tx frame.
3091 */
wsm_get_80211_frame(struct wsm_hdr * wsm)3092 static inline u8 *wsm_get_80211_frame(struct wsm_hdr *wsm)
3093 {
3094 struct wsm_tx *wsm_frame = (struct wsm_tx *)wsm;
3095
3096 /*Todo: When HT40 is undefine, how to get frame?*/
3097 return (u8 *)wsm_frame + wsm_frame->DataOffset;
3098 }
3099
3100 #endif /* XRADIO_HWIO_H_INCLUDED */
3101