blob: 8d902d6a7dc4f965b8baaf8291b0aa90414d24e7 [file] [log] [blame]
Solomon Peachya910e4a2013-05-24 20:04:38 -04001/*
2 * WSM host interface (HI) interface for ST-Ericsson CW1200 mac80211 drivers
3 *
4 * Copyright (c) 2010, ST-Ericsson
5 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
6 *
7 * Based on CW1200 UMAC WSM API, which is
8 * Copyright (C) ST-Ericsson SA 2010
9 * Author: Stewart Mathers <stewart.mathers@stericsson.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef CW1200_WSM_H_INCLUDED
17#define CW1200_WSM_H_INCLUDED
18
19#include <linux/spinlock.h>
20
21struct cw1200_common;
22
23/* Bands */
24/* Radio band 2.412 -2.484 GHz. */
25#define WSM_PHY_BAND_2_4G (0)
26
27/* Radio band 4.9375-5.8250 GHz. */
28#define WSM_PHY_BAND_5G (1)
29
30/* Transmit rates */
31/* 1 Mbps ERP-DSSS */
32#define WSM_TRANSMIT_RATE_1 (0)
33
34/* 2 Mbps ERP-DSSS */
35#define WSM_TRANSMIT_RATE_2 (1)
36
37/* 5.5 Mbps ERP-CCK */
38#define WSM_TRANSMIT_RATE_5 (2)
39
40/* 11 Mbps ERP-CCK */
41#define WSM_TRANSMIT_RATE_11 (3)
42
43/* 22 Mbps ERP-PBCC (Not supported) */
44/* #define WSM_TRANSMIT_RATE_22 (4) */
45
46/* 33 Mbps ERP-PBCC (Not supported) */
47/* #define WSM_TRANSMIT_RATE_33 (5) */
48
49/* 6 Mbps (3 Mbps) ERP-OFDM, BPSK coding rate 1/2 */
50#define WSM_TRANSMIT_RATE_6 (6)
51
52/* 9 Mbps (4.5 Mbps) ERP-OFDM, BPSK coding rate 3/4 */
53#define WSM_TRANSMIT_RATE_9 (7)
54
55/* 12 Mbps (6 Mbps) ERP-OFDM, QPSK coding rate 1/2 */
56#define WSM_TRANSMIT_RATE_12 (8)
57
58/* 18 Mbps (9 Mbps) ERP-OFDM, QPSK coding rate 3/4 */
59#define WSM_TRANSMIT_RATE_18 (9)
60
61/* 24 Mbps (12 Mbps) ERP-OFDM, 16QAM coding rate 1/2 */
62#define WSM_TRANSMIT_RATE_24 (10)
63
64/* 36 Mbps (18 Mbps) ERP-OFDM, 16QAM coding rate 3/4 */
65#define WSM_TRANSMIT_RATE_36 (11)
66
67/* 48 Mbps (24 Mbps) ERP-OFDM, 64QAM coding rate 1/2 */
68#define WSM_TRANSMIT_RATE_48 (12)
69
70/* 54 Mbps (27 Mbps) ERP-OFDM, 64QAM coding rate 3/4 */
71#define WSM_TRANSMIT_RATE_54 (13)
72
73/* 6.5 Mbps HT-OFDM, BPSK coding rate 1/2 */
74#define WSM_TRANSMIT_RATE_HT_6 (14)
75
76/* 13 Mbps HT-OFDM, QPSK coding rate 1/2 */
77#define WSM_TRANSMIT_RATE_HT_13 (15)
78
79/* 19.5 Mbps HT-OFDM, QPSK coding rate 3/4 */
80#define WSM_TRANSMIT_RATE_HT_19 (16)
81
82/* 26 Mbps HT-OFDM, 16QAM coding rate 1/2 */
83#define WSM_TRANSMIT_RATE_HT_26 (17)
84
85/* 39 Mbps HT-OFDM, 16QAM coding rate 3/4 */
86#define WSM_TRANSMIT_RATE_HT_39 (18)
87
88/* 52 Mbps HT-OFDM, 64QAM coding rate 2/3 */
89#define WSM_TRANSMIT_RATE_HT_52 (19)
90
91/* 58.5 Mbps HT-OFDM, 64QAM coding rate 3/4 */
92#define WSM_TRANSMIT_RATE_HT_58 (20)
93
94/* 65 Mbps HT-OFDM, 64QAM coding rate 5/6 */
95#define WSM_TRANSMIT_RATE_HT_65 (21)
96
97/* Scan types */
98/* Foreground scan */
99#define WSM_SCAN_TYPE_FOREGROUND (0)
100
101/* Background scan */
102#define WSM_SCAN_TYPE_BACKGROUND (1)
103
104/* Auto scan */
105#define WSM_SCAN_TYPE_AUTO (2)
106
107/* Scan flags */
108/* Forced background scan means if the station cannot */
109/* enter the power-save mode, it shall force to perform a */
110/* background scan. Only valid when ScanType is */
111/* background scan. */
112#define WSM_SCAN_FLAG_FORCE_BACKGROUND (BIT(0))
113
114/* The WLAN device scans one channel at a time so */
115/* that disturbance to the data traffic is minimized. */
116#define WSM_SCAN_FLAG_SPLIT_METHOD (BIT(1))
117
118/* Preamble Type. Long if not set. */
119#define WSM_SCAN_FLAG_SHORT_PREAMBLE (BIT(2))
120
121/* 11n Tx Mode. Mixed if not set. */
122#define WSM_SCAN_FLAG_11N_GREENFIELD (BIT(3))
123
124/* Scan constraints */
125/* Maximum number of channels to be scanned. */
126#define WSM_SCAN_MAX_NUM_OF_CHANNELS (48)
127
128/* The maximum number of SSIDs that the device can scan for. */
129#define WSM_SCAN_MAX_NUM_OF_SSIDS (2)
130
131/* Power management modes */
132/* 802.11 Active mode */
133#define WSM_PSM_ACTIVE (0)
134
135/* 802.11 PS mode */
136#define WSM_PSM_PS BIT(0)
137
138/* Fast Power Save bit */
139#define WSM_PSM_FAST_PS_FLAG BIT(7)
140
141/* Dynamic aka Fast power save */
142#define WSM_PSM_FAST_PS (BIT(0) | BIT(7))
143
144/* Undetermined */
145/* Note : Undetermined status is reported when the */
146/* NULL data frame used to advertise the PM mode to */
147/* the AP at Pre or Post Background Scan is not Acknowledged */
148#define WSM_PSM_UNKNOWN BIT(1)
149
150/* Queue IDs */
151/* best effort/legacy */
152#define WSM_QUEUE_BEST_EFFORT (0)
153
154/* background */
155#define WSM_QUEUE_BACKGROUND (1)
156
157/* video */
158#define WSM_QUEUE_VIDEO (2)
159
160/* voice */
161#define WSM_QUEUE_VOICE (3)
162
163/* HT TX parameters */
164/* Non-HT */
165#define WSM_HT_TX_NON_HT (0)
166
167/* Mixed format */
168#define WSM_HT_TX_MIXED (1)
169
170/* Greenfield format */
171#define WSM_HT_TX_GREENFIELD (2)
172
173/* STBC allowed */
174#define WSM_HT_TX_STBC (BIT(7))
175
176/* EPTA prioirty flags for BT Coex */
177/* default epta priority */
178#define WSM_EPTA_PRIORITY_DEFAULT 4
179/* use for normal data */
180#define WSM_EPTA_PRIORITY_DATA 4
181/* use for connect/disconnect/roaming*/
182#define WSM_EPTA_PRIORITY_MGT 5
183/* use for action frames */
184#define WSM_EPTA_PRIORITY_ACTION 5
185/* use for AC_VI data */
186#define WSM_EPTA_PRIORITY_VIDEO 5
187/* use for AC_VO data */
188#define WSM_EPTA_PRIORITY_VOICE 6
189/* use for EAPOL exchange */
190#define WSM_EPTA_PRIORITY_EAPOL 7
191
192/* TX status */
193/* Frame was sent aggregated */
194/* Only valid for WSM_SUCCESS status. */
195#define WSM_TX_STATUS_AGGREGATION (BIT(0))
196
197/* Host should requeue this frame later. */
198/* Valid only when status is WSM_REQUEUE. */
199#define WSM_TX_STATUS_REQUEUE (BIT(1))
200
201/* Normal Ack */
202#define WSM_TX_STATUS_NORMAL_ACK (0<<2)
203
204/* No Ack */
205#define WSM_TX_STATUS_NO_ACK (1<<2)
206
207/* No explicit acknowledgement */
208#define WSM_TX_STATUS_NO_EXPLICIT_ACK (2<<2)
209
210/* Block Ack */
211/* Only valid for WSM_SUCCESS status. */
212#define WSM_TX_STATUS_BLOCK_ACK (3<<2)
213
214/* RX status */
215/* Unencrypted */
216#define WSM_RX_STATUS_UNENCRYPTED (0<<0)
217
218/* WEP */
219#define WSM_RX_STATUS_WEP (1<<0)
220
221/* TKIP */
222#define WSM_RX_STATUS_TKIP (2<<0)
223
224/* AES */
225#define WSM_RX_STATUS_AES (3<<0)
226
227/* WAPI */
228#define WSM_RX_STATUS_WAPI (4<<0)
229
230/* Macro to fetch encryption subfield. */
231#define WSM_RX_STATUS_ENCRYPTION(status) ((status) & 0x07)
232
233/* Frame was part of an aggregation */
234#define WSM_RX_STATUS_AGGREGATE (BIT(3))
235
236/* Frame was first in the aggregation */
237#define WSM_RX_STATUS_AGGREGATE_FIRST (BIT(4))
238
239/* Frame was last in the aggregation */
240#define WSM_RX_STATUS_AGGREGATE_LAST (BIT(5))
241
242/* Indicates a defragmented frame */
243#define WSM_RX_STATUS_DEFRAGMENTED (BIT(6))
244
245/* Indicates a Beacon frame */
246#define WSM_RX_STATUS_BEACON (BIT(7))
247
248/* Indicates STA bit beacon TIM field */
249#define WSM_RX_STATUS_TIM (BIT(8))
250
251/* Indicates Beacon frame's virtual bitmap contains multicast bit */
252#define WSM_RX_STATUS_MULTICAST (BIT(9))
253
254/* Indicates frame contains a matching SSID */
255#define WSM_RX_STATUS_MATCHING_SSID (BIT(10))
256
257/* Indicates frame contains a matching BSSI */
258#define WSM_RX_STATUS_MATCHING_BSSI (BIT(11))
259
260/* Indicates More bit set in Framectl field */
261#define WSM_RX_STATUS_MORE_DATA (BIT(12))
262
263/* Indicates frame received during a measurement process */
264#define WSM_RX_STATUS_MEASUREMENT (BIT(13))
265
266/* Indicates frame received as an HT packet */
267#define WSM_RX_STATUS_HT (BIT(14))
268
269/* Indicates frame received with STBC */
270#define WSM_RX_STATUS_STBC (BIT(15))
271
272/* Indicates Address 1 field matches dot11StationId */
273#define WSM_RX_STATUS_ADDRESS1 (BIT(16))
274
275/* Indicates Group address present in the Address 1 field */
276#define WSM_RX_STATUS_GROUP (BIT(17))
277
278/* Indicates Broadcast address present in the Address 1 field */
279#define WSM_RX_STATUS_BROADCAST (BIT(18))
280
281/* Indicates group key used with encrypted frames */
282#define WSM_RX_STATUS_GROUP_KEY (BIT(19))
283
284/* Macro to fetch encryption key index. */
285#define WSM_RX_STATUS_KEY_IDX(status) (((status >> 20)) & 0x0F)
286
287/* Indicates TSF inclusion after 802.11 frame body */
288#define WSM_RX_STATUS_TSF_INCLUDED (BIT(24))
289
290/* Frame Control field starts at Frame offset + 2 */
291#define WSM_TX_2BYTES_SHIFT (BIT(7))
292
293/* Join mode */
294/* IBSS */
295#define WSM_JOIN_MODE_IBSS (0)
296
297/* BSS */
298#define WSM_JOIN_MODE_BSS (1)
299
300/* PLCP preamble type */
301/* For long preamble */
302#define WSM_JOIN_PREAMBLE_LONG (0)
303
304/* For short preamble (Long for 1Mbps) */
305#define WSM_JOIN_PREAMBLE_SHORT (1)
306
307/* For short preamble (Long for 1 and 2Mbps) */
308#define WSM_JOIN_PREAMBLE_SHORT_2 (2)
309
310/* Join flags */
311/* Unsynchronized */
312#define WSM_JOIN_FLAGS_UNSYNCRONIZED BIT(0)
313/* The BSS owner is a P2P GO */
314#define WSM_JOIN_FLAGS_P2P_GO BIT(1)
315/* Force to join BSS with the BSSID and the
316 * SSID specified without waiting for beacons. The
317 * ProbeForJoin parameter is ignored. */
318#define WSM_JOIN_FLAGS_FORCE BIT(2)
319/* Give probe request/response higher
320 * priority over the BT traffic */
321#define WSM_JOIN_FLAGS_PRIO BIT(3)
322/* Issue immediate join confirmation and use
323 * join complete to notify about completion */
324#define WSM_JOIN_FLAGS_FORCE_WITH_COMPLETE_IND BIT(5)
325
326/* Key types */
327#define WSM_KEY_TYPE_WEP_DEFAULT (0)
328#define WSM_KEY_TYPE_WEP_PAIRWISE (1)
329#define WSM_KEY_TYPE_TKIP_GROUP (2)
330#define WSM_KEY_TYPE_TKIP_PAIRWISE (3)
331#define WSM_KEY_TYPE_AES_GROUP (4)
332#define WSM_KEY_TYPE_AES_PAIRWISE (5)
333#define WSM_KEY_TYPE_WAPI_GROUP (6)
334#define WSM_KEY_TYPE_WAPI_PAIRWISE (7)
335
336/* Key indexes */
337#define WSM_KEY_MAX_INDEX (10)
338
339/* ACK policy */
340#define WSM_ACK_POLICY_NORMAL (0)
341#define WSM_ACK_POLICY_NO_ACK (1)
342
343/* Start modes */
344#define WSM_START_MODE_AP (0) /* Mini AP */
345#define WSM_START_MODE_P2P_GO (1) /* P2P GO */
346#define WSM_START_MODE_P2P_DEV (2) /* P2P device */
347
348/* SetAssociationMode MIB flags */
349#define WSM_ASSOCIATION_MODE_USE_PREAMBLE_TYPE (BIT(0))
350#define WSM_ASSOCIATION_MODE_USE_HT_MODE (BIT(1))
351#define WSM_ASSOCIATION_MODE_USE_BASIC_RATE_SET (BIT(2))
352#define WSM_ASSOCIATION_MODE_USE_MPDU_START_SPACING (BIT(3))
353#define WSM_ASSOCIATION_MODE_SNOOP_ASSOC_FRAMES (BIT(4))
354
355/* RcpiRssiThreshold MIB flags */
356#define WSM_RCPI_RSSI_THRESHOLD_ENABLE (BIT(0))
357#define WSM_RCPI_RSSI_USE_RSSI (BIT(1))
358#define WSM_RCPI_RSSI_DONT_USE_UPPER (BIT(2))
359#define WSM_RCPI_RSSI_DONT_USE_LOWER (BIT(3))
360
361/* Update-ie constants */
362#define WSM_UPDATE_IE_BEACON (BIT(0))
363#define WSM_UPDATE_IE_PROBE_RESP (BIT(1))
364#define WSM_UPDATE_IE_PROBE_REQ (BIT(2))
365
366/* WSM events */
367/* Error */
368#define WSM_EVENT_ERROR (0)
369
370/* BSS lost */
371#define WSM_EVENT_BSS_LOST (1)
372
373/* BSS regained */
374#define WSM_EVENT_BSS_REGAINED (2)
375
376/* Radar detected */
377#define WSM_EVENT_RADAR_DETECTED (3)
378
379/* RCPI or RSSI threshold triggered */
380#define WSM_EVENT_RCPI_RSSI (4)
381
382/* BT inactive */
383#define WSM_EVENT_BT_INACTIVE (5)
384
385/* BT active */
386#define WSM_EVENT_BT_ACTIVE (6)
387
388/* MIB IDs */
389/* 4.1 dot11StationId */
390#define WSM_MIB_ID_DOT11_STATION_ID 0x0000
391
392/* 4.2 dot11MaxtransmitMsduLifeTime */
393#define WSM_MIB_ID_DOT11_MAX_TRANSMIT_LIFTIME 0x0001
394
395/* 4.3 dot11MaxReceiveLifeTime */
396#define WSM_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME 0x0002
397
398/* 4.4 dot11SlotTime */
399#define WSM_MIB_ID_DOT11_SLOT_TIME 0x0003
400
401/* 4.5 dot11GroupAddressesTable */
402#define WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE 0x0004
403#define WSM_MAX_GRP_ADDRTABLE_ENTRIES 8
404
405/* 4.6 dot11WepDefaultKeyId */
406#define WSM_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID 0x0005
407
408/* 4.7 dot11CurrentTxPowerLevel */
409#define WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL 0x0006
410
411/* 4.8 dot11RTSThreshold */
412#define WSM_MIB_ID_DOT11_RTS_THRESHOLD 0x0007
413
414/* 4.9 NonErpProtection */
415#define WSM_MIB_ID_NON_ERP_PROTECTION 0x1000
416
417/* 4.10 ArpIpAddressesTable */
418#define WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE 0x1001
419#define WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES 1
420
421/* 4.11 TemplateFrame */
422#define WSM_MIB_ID_TEMPLATE_FRAME 0x1002
423
424/* 4.12 RxFilter */
425#define WSM_MIB_ID_RX_FILTER 0x1003
426
427/* 4.13 BeaconFilterTable */
428#define WSM_MIB_ID_BEACON_FILTER_TABLE 0x1004
429
430/* 4.14 BeaconFilterEnable */
431#define WSM_MIB_ID_BEACON_FILTER_ENABLE 0x1005
432
433/* 4.15 OperationalPowerMode */
434#define WSM_MIB_ID_OPERATIONAL_POWER_MODE 0x1006
435
436/* 4.16 BeaconWakeUpPeriod */
437#define WSM_MIB_ID_BEACON_WAKEUP_PERIOD 0x1007
438
439/* 4.17 RcpiRssiThreshold */
440#define WSM_MIB_ID_RCPI_RSSI_THRESHOLD 0x1009
441
442/* 4.18 StatisticsTable */
443#define WSM_MIB_ID_STATISTICS_TABLE 0x100A
444
445/* 4.19 IbssPsConfig */
446#define WSM_MIB_ID_IBSS_PS_CONFIG 0x100B
447
448/* 4.20 CountersTable */
449#define WSM_MIB_ID_COUNTERS_TABLE 0x100C
450
451/* 4.21 BlockAckPolicy */
452#define WSM_MIB_ID_BLOCK_ACK_POLICY 0x100E
453
454/* 4.22 OverrideInternalTxRate */
455#define WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE 0x100F
456
457/* 4.23 SetAssociationMode */
458#define WSM_MIB_ID_SET_ASSOCIATION_MODE 0x1010
459
460/* 4.24 UpdateEptaConfigData */
461#define WSM_MIB_ID_UPDATE_EPTA_CONFIG_DATA 0x1011
462
463/* 4.25 SelectCcaMethod */
464#define WSM_MIB_ID_SELECT_CCA_METHOD 0x1012
465
466/* 4.26 SetUpasdInformation */
467#define WSM_MIB_ID_SET_UAPSD_INFORMATION 0x1013
468
469/* 4.27 SetAutoCalibrationMode WBF00004073 */
470#define WSM_MIB_ID_SET_AUTO_CALIBRATION_MODE 0x1015
471
472/* 4.28 SetTxRateRetryPolicy */
473#define WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY 0x1016
474
475/* 4.29 SetHostMessageTypeFilter */
476#define WSM_MIB_ID_SET_HOST_MSG_TYPE_FILTER 0x1017
477
478/* 4.30 P2PFindInfo */
479#define WSM_MIB_ID_P2P_FIND_INFO 0x1018
480
481/* 4.31 P2PPsModeInfo */
482#define WSM_MIB_ID_P2P_PS_MODE_INFO 0x1019
483
484/* 4.32 SetEtherTypeDataFrameFilter */
485#define WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER 0x101A
486
487/* 4.33 SetUDPPortDataFrameFilter */
488#define WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER 0x101B
489
490/* 4.34 SetMagicDataFrameFilter */
491#define WSM_MIB_ID_SET_MAGIC_DATAFRAME_FILTER 0x101C
492
493/* 4.35 P2PDeviceInfo */
494#define WSM_MIB_ID_P2P_DEVICE_INFO 0x101D
495
496/* 4.36 SetWCDMABand */
497#define WSM_MIB_ID_SET_WCDMA_BAND 0x101E
498
499/* 4.37 GroupTxSequenceCounter */
500#define WSM_MIB_ID_GRP_SEQ_COUNTER 0x101F
501
502/* 4.38 ProtectedMgmtPolicy */
503#define WSM_MIB_ID_PROTECTED_MGMT_POLICY 0x1020
504
505/* 4.39 SetHtProtection */
506#define WSM_MIB_ID_SET_HT_PROTECTION 0x1021
507
508/* 4.40 GPIO Command */
509#define WSM_MIB_ID_GPIO_COMMAND 0x1022
510
511/* 4.41 TSF Counter Value */
512#define WSM_MIB_ID_TSF_COUNTER 0x1023
513
514/* Test Purposes Only */
515#define WSM_MIB_ID_BLOCK_ACK_INFO 0x100D
516
517/* 4.42 UseMultiTxConfMessage */
518#define WSM_MIB_USE_MULTI_TX_CONF 0x1024
519
520/* 4.43 Keep-alive period */
521#define WSM_MIB_ID_KEEP_ALIVE_PERIOD 0x1025
522
523/* 4.44 Disable BSSID filter */
524#define WSM_MIB_ID_DISABLE_BSSID_FILTER 0x1026
525
526/* Frame template types */
527#define WSM_FRAME_TYPE_PROBE_REQUEST (0)
528#define WSM_FRAME_TYPE_BEACON (1)
529#define WSM_FRAME_TYPE_NULL (2)
530#define WSM_FRAME_TYPE_QOS_NULL (3)
531#define WSM_FRAME_TYPE_PS_POLL (4)
532#define WSM_FRAME_TYPE_PROBE_RESPONSE (5)
533
534#define WSM_FRAME_GREENFIELD (0x80) /* See 4.11 */
535
536/* Status */
537/* The WSM firmware has completed a request */
538/* successfully. */
539#define WSM_STATUS_SUCCESS (0)
540
541/* This is a generic failure code if other error codes do */
542/* not apply. */
543#define WSM_STATUS_FAILURE (1)
544
545/* A request contains one or more invalid parameters. */
546#define WSM_INVALID_PARAMETER (2)
547
548/* The request cannot perform because the device is in */
549/* an inappropriate mode. */
550#define WSM_ACCESS_DENIED (3)
551
552/* The frame received includes a decryption error. */
553#define WSM_STATUS_DECRYPTFAILURE (4)
554
555/* A MIC failure is detected in the received packets. */
556#define WSM_STATUS_MICFAILURE (5)
557
558/* The transmit request failed due to retry limit being */
559/* exceeded. */
560#define WSM_STATUS_RETRY_EXCEEDED (6)
561
562/* The transmit request failed due to MSDU life time */
563/* being exceeded. */
564#define WSM_STATUS_TX_LIFETIME_EXCEEDED (7)
565
566/* The link to the AP is lost. */
567#define WSM_STATUS_LINK_LOST (8)
568
569/* No key was found for the encrypted frame */
570#define WSM_STATUS_NO_KEY_FOUND (9)
571
572/* Jammer was detected when transmitting this frame */
573#define WSM_STATUS_JAMMER_DETECTED (10)
574
575/* The message should be requeued later. */
576/* This is applicable only to Transmit */
577#define WSM_REQUEUE (11)
578
579/* Advanced filtering options */
580#define WSM_MAX_FILTER_ELEMENTS (4)
581
582#define WSM_FILTER_ACTION_IGNORE (0)
583#define WSM_FILTER_ACTION_FILTER_IN (1)
584#define WSM_FILTER_ACTION_FILTER_OUT (2)
585
586#define WSM_FILTER_PORT_TYPE_DST (0)
587#define WSM_FILTER_PORT_TYPE_SRC (1)
588
589/* Actual header of WSM messages */
590struct wsm_hdr {
591 __le16 len;
592 __le16 id;
593};
594
595#define WSM_TX_SEQ_MAX (7)
596#define WSM_TX_SEQ(seq) \
597 ((seq & WSM_TX_SEQ_MAX) << 13)
598#define WSM_TX_LINK_ID_MAX (0x0F)
599#define WSM_TX_LINK_ID(link_id) \
600 ((link_id & WSM_TX_LINK_ID_MAX) << 6)
601
602#define MAX_BEACON_SKIP_TIME_MS 1000
603
604#define WSM_CMD_LAST_CHANCE_TIMEOUT (HZ * 3 / 2)
605
606/* ******************************************************************** */
607/* WSM capability */
608
609#define WSM_STARTUP_IND_ID 0x0801
610
611struct wsm_startup_ind {
612 u16 input_buffers;
613 u16 input_buffer_size;
614 u16 status;
615 u16 hw_id;
616 u16 hw_subid;
617 u16 fw_cap;
618 u16 fw_type;
619 u16 fw_api;
620 u16 fw_build;
621 u16 fw_ver;
622 char fw_label[128];
623 u32 config[4];
624};
625
626/* ******************************************************************** */
627/* WSM commands */
628
629/* 3.1 */
630#define WSM_CONFIGURATION_REQ_ID 0x0009
631#define WSM_CONFIGURATION_RESP_ID 0x0409
632
633struct wsm_tx_power_range {
634 int min_power_level;
635 int max_power_level;
636 u32 stepping;
637};
638
639struct wsm_configuration {
640 /* [in] */ u32 dot11MaxTransmitMsduLifeTime;
641 /* [in] */ u32 dot11MaxReceiveLifeTime;
642 /* [in] */ u32 dot11RtsThreshold;
643 /* [in, out] */ u8 *dot11StationId;
644 /* [in] */ const void *dpdData;
645 /* [in] */ size_t dpdData_size;
646 /* [out] */ u8 dot11FrequencyBandsSupported;
647 /* [out] */ u32 supportedRateMask;
648 /* [out] */ struct wsm_tx_power_range txPowerRange[2];
649};
650
651int wsm_configuration(struct cw1200_common *priv,
652 struct wsm_configuration *arg);
653
654/* 3.3 */
655#define WSM_RESET_REQ_ID 0x000A
656#define WSM_RESET_RESP_ID 0x040A
657struct wsm_reset {
658 /* [in] */ int link_id;
659 /* [in] */ bool reset_statistics;
660};
661
662int wsm_reset(struct cw1200_common *priv, const struct wsm_reset *arg);
663
664/* 3.5 */
665#define WSM_READ_MIB_REQ_ID 0x0005
666#define WSM_READ_MIB_RESP_ID 0x0405
667int wsm_read_mib(struct cw1200_common *priv, u16 mib_id, void *buf,
668 size_t buf_size);
669
670/* 3.7 */
671#define WSM_WRITE_MIB_REQ_ID 0x0006
672#define WSM_WRITE_MIB_RESP_ID 0x0406
673int wsm_write_mib(struct cw1200_common *priv, u16 mib_id, void *buf,
674 size_t buf_size);
675
676/* 3.9 */
677#define WSM_START_SCAN_REQ_ID 0x0007
678#define WSM_START_SCAN_RESP_ID 0x0407
679
680struct wsm_ssid {
681 u8 ssid[32];
682 u32 length;
683};
684
685struct wsm_scan_ch {
686 u16 number;
687 u32 min_chan_time;
688 u32 max_chan_time;
689 u32 tx_power_level;
690};
691
692struct wsm_scan {
693 /* WSM_PHY_BAND_... */
694 u8 band;
695
696 /* WSM_SCAN_TYPE_... */
697 u8 type;
698
699 /* WSM_SCAN_FLAG_... */
700 u8 flags;
701
702 /* WSM_TRANSMIT_RATE_... */
703 u8 max_tx_rate;
704
705 /* Interval period in TUs that the device shall the re- */
706 /* execute the requested scan. Max value supported by the device */
707 /* is 256s. */
708 u32 auto_scan_interval;
709
710 /* Number of probe requests (per SSID) sent to one (1) */
711 /* channel. Zero (0) means that none is send, which */
712 /* means that a passive scan is to be done. Value */
713 /* greater than zero (0) means that an active scan is to */
714 /* be done. */
715 u32 num_probes;
716
717 /* Number of channels to be scanned. */
718 /* Maximum value is WSM_SCAN_MAX_NUM_OF_CHANNELS. */
719 u8 num_channels;
720
721 /* Number of SSID provided in the scan command (this */
722 /* is zero (0) in broadcast scan) */
723 /* The maximum number of SSIDs is WSM_SCAN_MAX_NUM_OF_SSIDS. */
724 u8 num_ssids;
725
726 /* The delay time (in microseconds) period */
727 /* before sending a probe-request. */
728 u8 probe_delay;
729
730 /* SSIDs to be scanned [numOfSSIDs]; */
731 struct wsm_ssid *ssids;
732
733 /* Channels to be scanned [numOfChannels]; */
734 struct wsm_scan_ch *ch;
735};
736
737int wsm_scan(struct cw1200_common *priv, const struct wsm_scan *arg);
738
739/* 3.11 */
740#define WSM_STOP_SCAN_REQ_ID 0x0008
741#define WSM_STOP_SCAN_RESP_ID 0x0408
742int wsm_stop_scan(struct cw1200_common *priv);
743
744/* 3.13 */
745#define WSM_SCAN_COMPLETE_IND_ID 0x0806
746struct wsm_scan_complete {
747 /* WSM_STATUS_... */
748 u32 status;
749
750 /* WSM_PSM_... */
751 u8 psm;
752
753 /* Number of channels that the scan operation completed. */
754 u8 num_channels;
755};
756
757/* 3.14 */
758#define WSM_TX_CONFIRM_IND_ID 0x0404
759#define WSM_MULTI_TX_CONFIRM_ID 0x041E
760
761struct wsm_tx_confirm {
762 /* Packet identifier used in wsm_tx. */
763 u32 packet_id;
764
765 /* WSM_STATUS_... */
766 u32 status;
767
768 /* WSM_TRANSMIT_RATE_... */
769 u8 tx_rate;
770
771 /* The number of times the frame was transmitted */
772 /* without receiving an acknowledgement. */
773 u8 ack_failures;
774
775 /* WSM_TX_STATUS_... */
776 u16 flags;
777
778 /* The total time in microseconds that the frame spent in */
779 /* the WLAN device before transmission as completed. */
780 u32 media_delay;
781
782 /* The total time in microseconds that the frame spent in */
783 /* the WLAN device before transmission was started. */
784 u32 tx_queue_delay;
785};
786
787/* 3.15 */
788typedef void (*wsm_tx_confirm_cb) (struct cw1200_common *priv,
789 struct wsm_tx_confirm *arg);
790
791/* Note that ideology of wsm_tx struct is different against the rest of
792 * WSM API. wsm_hdr is /not/ a caller-adapted struct to be used as an input
793 * argument for WSM call, but a prepared bytestream to be sent to firmware.
794 * It is filled partly in cw1200_tx, partly in low-level WSM code.
795 * Please pay attention once again: ideology is different.
796 *
797 * Legend:
798 * - [in]: cw1200_tx must fill this field.
799 * - [wsm]: the field is filled by low-level WSM.
800 */
801struct wsm_tx {
802 /* common WSM header */
803 struct wsm_hdr hdr;
804
805 /* Packet identifier that meant to be used in completion. */
806 __le32 packet_id;
807
808 /* WSM_TRANSMIT_RATE_... */
809 u8 max_tx_rate;
810
811 /* WSM_QUEUE_... */
812 u8 queue_id;
813
814 /* True: another packet is pending on the host for transmission. */
815 u8 more;
816
817 /* Bit 0 = 0 - Start expiry time from first Tx attempt (default) */
818 /* Bit 0 = 1 - Start expiry time from receipt of Tx Request */
819 /* Bits 3:1 - PTA Priority */
820 /* Bits 6:4 - Tx Rate Retry Policy */
821 /* Bit 7 - Reserved */
822 u8 flags;
823
824 /* Should be 0. */
825 __le32 reserved;
826
827 /* The elapsed time in TUs, after the initial transmission */
828 /* of an MSDU, after which further attempts to transmit */
829 /* the MSDU shall be terminated. Overrides the global */
830 /* dot11MaxTransmitMsduLifeTime setting [optional] */
831 /* Device will set the default value if this is 0. */
832 __le32 expire_time;
833
834 /* WSM_HT_TX_... */
835 __le32 ht_tx_parameters;
836};
837
838/* = sizeof(generic hi hdr) + sizeof(wsm hdr) + sizeof(alignment) */
839#define WSM_TX_EXTRA_HEADROOM (28)
840
841/* 3.16 */
842#define WSM_RECEIVE_IND_ID 0x0804
843
844struct wsm_rx {
845 /* WSM_STATUS_... */
846 __le32 status;
847
848 /* Specifies the channel of the received packet. */
849 __le16 channel_number;
850
851 /* WSM_TRANSMIT_RATE_... */
852 u8 rx_rate;
853
854 /* This value is expressed in signed Q8.0 format for */
855 /* RSSI and unsigned Q7.1 format for RCPI. */
856 u8 rcpi_rssi;
857
858 /* WSM_RX_STATUS_... */
859 __le32 flags;
860
861 /* Payload */
862 u8 data[0];
863} __packed;
864
865/* = sizeof(generic hi hdr) + sizeof(wsm hdr) */
866#define WSM_RX_EXTRA_HEADROOM (16)
867
868typedef void (*wsm_rx_cb) (struct cw1200_common *priv, struct wsm_rx *arg,
869 struct sk_buff **skb_p);
870
871/* 3.17 */
872struct wsm_event {
873 /* WSM_STATUS_... */
874 /* [out] */ u32 id;
875
876 /* Indication parameters. */
877 /* For error indication, this shall be a 32-bit WSM status. */
878 /* For RCPI or RSSI indication, this should be an 8-bit */
879 /* RCPI or RSSI value. */
880 /* [out] */ u32 data;
881};
882
883struct cw1200_wsm_event {
884 struct list_head link;
885 struct wsm_event evt;
886};
887
888/* 3.18 - 3.22 */
889/* Measurement. Skipped for now. Irrelevent. */
890
891typedef void (*wsm_event_cb) (struct cw1200_common *priv,
892 struct wsm_event *arg);
893
894/* 3.23 */
895#define WSM_JOIN_REQ_ID 0x000B
896#define WSM_JOIN_RESP_ID 0x040B
897
898struct wsm_join {
899 /* WSM_JOIN_MODE_... */
900 u8 mode;
901
902 /* WSM_PHY_BAND_... */
903 u8 band;
904
905 /* Specifies the channel number to join. The channel */
906 /* number will be mapped to an actual frequency */
907 /* according to the band */
908 u16 channel_number;
909
910 /* Specifies the BSSID of the BSS or IBSS to be joined */
911 /* or the IBSS to be started. */
912 u8 bssid[6];
913
914 /* ATIM window of IBSS */
915 /* When ATIM window is zero the initiated IBSS does */
916 /* not support power saving. */
917 u16 atim_window;
918
919 /* WSM_JOIN_PREAMBLE_... */
920 u8 preamble_type;
921
922 /* Specifies if a probe request should be send with the */
923 /* specified SSID when joining to the network. */
924 u8 probe_for_join;
925
926 /* DTIM Period (In multiples of beacon interval) */
927 u8 dtim_period;
928
929 /* WSM_JOIN_FLAGS_... */
930 u8 flags;
931
932 /* Length of the SSID */
933 u32 ssid_len;
934
935 /* Specifies the SSID of the IBSS to join or start */
936 u8 ssid[32];
937
938 /* Specifies the time between TBTTs in TUs */
939 u32 beacon_interval;
940
941 /* A bit mask that defines the BSS basic rate set. */
942 u32 basic_rate_set;
943};
944
945struct wsm_join_cnf {
946 u32 status;
947
948 /* Minimum transmission power level in units of 0.1dBm */
949 u32 min_power_level;
950
951 /* Maximum transmission power level in units of 0.1dBm */
952 u32 max_power_level;
953};
954
955int wsm_join(struct cw1200_common *priv, struct wsm_join *arg);
956
957/* 3.24 */
958struct wsm_join_complete {
959 /* WSM_STATUS_... */
960 u32 status;
961};
962
963/* 3.25 */
964#define WSM_SET_PM_REQ_ID 0x0010
965#define WSM_SET_PM_RESP_ID 0x0410
966struct wsm_set_pm {
967 /* WSM_PSM_... */
968 u8 mode;
969
970 /* in unit of 500us; 0 to use default */
971 u8 fast_psm_idle_period;
972
973 /* in unit of 500us; 0 to use default */
974 u8 ap_psm_change_period;
975
976 /* in unit of 500us; 0 to disable auto-pspoll */
977 u8 min_auto_pspoll_period;
978};
979
980int wsm_set_pm(struct cw1200_common *priv, const struct wsm_set_pm *arg);
981
982/* 3.27 */
983struct wsm_set_pm_complete {
984 u8 psm; /* WSM_PSM_... */
985};
986
987/* 3.28 */
988#define WSM_SET_BSS_PARAMS_REQ_ID 0x0011
989#define WSM_SET_BSS_PARAMS_RESP_ID 0x0411
990struct wsm_set_bss_params {
991 /* This resets the beacon loss counters only */
992 u8 reset_beacon_loss;
993
994 /* The number of lost consecutive beacons after which */
995 /* the WLAN device should indicate the BSS-Lost event */
996 /* to the WLAN host driver. */
997 u8 beacon_lost_count;
998
999 /* The AID received during the association process. */
1000 u16 aid;
1001
1002 /* The operational rate set mask */
1003 u32 operational_rate_set;
1004};
1005
1006int wsm_set_bss_params(struct cw1200_common *priv,
1007 const struct wsm_set_bss_params *arg);
1008
1009/* 3.30 */
1010#define WSM_ADD_KEY_REQ_ID 0x000C
1011#define WSM_ADD_KEY_RESP_ID 0x040C
1012struct wsm_add_key {
1013 u8 type; /* WSM_KEY_TYPE_... */
1014 u8 index; /* Key entry index: 0 -- WSM_KEY_MAX_INDEX */
1015 u16 reserved;
1016 union {
1017 struct {
1018 u8 peer[6]; /* MAC address of the
1019 * peer station */
1020 u8 reserved;
1021 u8 keylen; /* Key length in bytes */
1022 u8 keydata[16]; /* Key data */
1023 } __packed wep_pairwise;
1024 struct {
1025 u8 keyid; /* Unique per key identifier
1026 * (0..3) */
1027 u8 keylen; /* Key length in bytes */
1028 u16 reserved;
1029 u8 keydata[16]; /* Key data */
1030 } __packed wep_group;
1031 struct {
1032 u8 peer[6]; /* MAC address of the
1033 * peer station */
1034 u16 reserved;
1035 u8 keydata[16]; /* TKIP key data */
1036 u8 rx_mic_key[8]; /* Rx MIC key */
1037 u8 tx_mic_key[8]; /* Tx MIC key */
1038 } __packed tkip_pairwise;
1039 struct {
1040 u8 keydata[16]; /* TKIP key data */
1041 u8 rx_mic_key[8]; /* Rx MIC key */
1042 u8 keyid; /* Key ID */
1043 u8 reserved[3];
1044 u8 rx_seqnum[8]; /* Receive Sequence Counter */
1045 } __packed tkip_group;
1046 struct {
1047 u8 peer[6]; /* MAC address of the
1048 * peer station */
1049 u16 reserved;
1050 u8 keydata[16]; /* AES key data */
1051 } __packed aes_pairwise;
1052 struct {
1053 u8 keydata[16]; /* AES key data */
1054 u8 keyid; /* Key ID */
1055 u8 reserved[3];
1056 u8 rx_seqnum[8]; /* Receive Sequence Counter */
1057 } __packed aes_group;
1058 struct {
1059 u8 peer[6]; /* MAC address of the
1060 * peer station */
1061 u8 keyid; /* Key ID */
1062 u8 reserved;
1063 u8 keydata[16]; /* WAPI key data */
1064 u8 mic_key[16]; /* MIC key data */
1065 } __packed wapi_pairwise;
1066 struct {
1067 u8 keydata[16]; /* WAPI key data */
1068 u8 mic_key[16]; /* MIC key data */
1069 u8 keyid; /* Key ID */
1070 u8 reserved[3];
1071 } __packed wapi_group;
1072 } __packed;
1073} __packed;
1074
1075int wsm_add_key(struct cw1200_common *priv, const struct wsm_add_key *arg);
1076
1077/* 3.32 */
1078#define WSM_REMOVE_KEY_REQ_ID 0x000D
1079#define WSM_REMOVE_KEY_RESP_ID 0x040D
1080struct wsm_remove_key {
1081 u8 index; /* Key entry index : 0-10 */
1082};
1083
1084int wsm_remove_key(struct cw1200_common *priv,
1085 const struct wsm_remove_key *arg);
1086
1087/* 3.34 */
1088struct wsm_set_tx_queue_params {
1089 /* WSM_ACK_POLICY_... */
1090 u8 ackPolicy;
1091
1092 /* Medium Time of TSPEC (in 32us units) allowed per */
1093 /* One Second Averaging Period for this queue. */
1094 u16 allowedMediumTime;
1095
1096 /* dot11MaxTransmitMsduLifetime to be used for the */
1097 /* specified queue. */
1098 u32 maxTransmitLifetime;
1099};
1100
1101struct wsm_tx_queue_params {
1102 /* NOTE: index is a linux queue id. */
1103 struct wsm_set_tx_queue_params params[4];
1104};
1105
1106
1107#define WSM_TX_QUEUE_SET(queue_params, queue, ack_policy, allowed_time,\
1108 max_life_time) \
1109do { \
1110 struct wsm_set_tx_queue_params *p = &(queue_params)->params[queue]; \
1111 p->ackPolicy = (ack_policy); \
1112 p->allowedMediumTime = (allowed_time); \
1113 p->maxTransmitLifetime = (max_life_time); \
1114} while (0)
1115
1116int wsm_set_tx_queue_params(struct cw1200_common *priv,
1117 const struct wsm_set_tx_queue_params *arg, u8 id);
1118
1119/* 3.36 */
1120#define WSM_EDCA_PARAMS_REQ_ID 0x0013
1121#define WSM_EDCA_PARAMS_RESP_ID 0x0413
1122struct wsm_edca_queue_params {
1123 /* CWmin (in slots) for the access class. */
1124 __le16 cwmin;
1125
1126 /* CWmax (in slots) for the access class. */
1127 __le16 cwmax;
1128
1129 /* AIFS (in slots) for the access class. */
1130 __le16 aifns;
1131
1132 /* TX OP Limit (in microseconds) for the access class. */
1133 __le16 txop_limit;
1134
1135 /* dot11MaxReceiveLifetime to be used for the specified */
1136 /* the access class. Overrides the global */
1137 /* dot11MaxReceiveLifetime value */
1138 __le32 max_rx_lifetime;
1139} __packed;
1140
1141struct wsm_edca_params {
1142 /* NOTE: index is a linux queue id. */
1143 struct wsm_edca_queue_params params[4];
1144 bool uapsd_enable[4];
1145};
1146
1147#define TXOP_UNIT 32
1148#define WSM_EDCA_SET(__edca, __queue, __aifs, __cw_min, __cw_max, __txop, __lifetime,\
1149 __uapsd) \
1150 do { \
1151 struct wsm_edca_queue_params *p = &(__edca)->params[__queue]; \
1152 p->cwmin = (__cw_min); \
1153 p->cwmax = (__cw_max); \
1154 p->aifns = (__aifs); \
1155 p->txop_limit = ((__txop) * TXOP_UNIT); \
1156 p->max_rx_lifetime = (__lifetime); \
1157 (__edca)->uapsd_enable[__queue] = (__uapsd); \
1158 } while (0)
1159
1160int wsm_set_edca_params(struct cw1200_common *priv,
1161 const struct wsm_edca_params *arg);
1162
1163int wsm_set_uapsd_param(struct cw1200_common *priv,
1164 const struct wsm_edca_params *arg);
1165
1166/* 3.38 */
1167/* Set-System info. Skipped for now. Irrelevent. */
1168
1169/* 3.40 */
1170#define WSM_SWITCH_CHANNEL_REQ_ID 0x0016
1171#define WSM_SWITCH_CHANNEL_RESP_ID 0x0416
1172
1173struct wsm_switch_channel {
1174 /* 1 - means the STA shall not transmit any further */
1175 /* frames until the channel switch has completed */
1176 u8 mode;
1177
1178 /* Number of TBTTs until channel switch occurs. */
1179 /* 0 - indicates switch shall occur at any time */
1180 /* 1 - occurs immediately before the next TBTT */
1181 u8 switch_count;
1182
1183 /* The new channel number to switch to. */
1184 /* Note this is defined as per section 2.7. */
1185 u16 channel_number;
1186};
1187
1188int wsm_switch_channel(struct cw1200_common *priv,
1189 const struct wsm_switch_channel *arg);
1190
1191typedef void (*wsm_channel_switch_cb) (struct cw1200_common *priv);
1192
1193#define WSM_START_REQ_ID 0x0017
1194#define WSM_START_RESP_ID 0x0417
1195
1196struct wsm_start {
1197 /* WSM_START_MODE_... */
1198 /* [in] */ u8 mode;
1199
1200 /* WSM_PHY_BAND_... */
1201 /* [in] */ u8 band;
1202
1203 /* Channel number */
1204 /* [in] */ u16 channel_number;
1205
1206 /* Client Traffic window in units of TU */
1207 /* Valid only when mode == ..._P2P */
1208 /* [in] */ u32 ct_window;
1209
1210 /* Interval between two consecutive */
1211 /* beacon transmissions in TU. */
1212 /* [in] */ u32 beacon_interval;
1213
1214 /* DTIM period in terms of beacon intervals */
1215 /* [in] */ u8 dtim_period;
1216
1217 /* WSM_JOIN_PREAMBLE_... */
1218 /* [in] */ u8 preamble;
1219
1220 /* The delay time (in microseconds) period */
1221 /* before sending a probe-request. */
1222 /* [in] */ u8 probe_delay;
1223
1224 /* Length of the SSID */
1225 /* [in] */ u8 ssid_len;
1226
1227 /* SSID of the BSS or P2P_GO to be started now. */
1228 /* [in] */ u8 ssid[32];
1229
1230 /* The basic supported rates for the MiniAP. */
1231 /* [in] */ u32 basic_rate_set;
1232};
1233
1234int wsm_start(struct cw1200_common *priv, const struct wsm_start *arg);
1235
1236#define WSM_BEACON_TRANSMIT_REQ_ID 0x0018
1237#define WSM_BEACON_TRANSMIT_RESP_ID 0x0418
1238
1239struct wsm_beacon_transmit {
1240 /* 1: enable; 0: disable */
1241 /* [in] */ u8 enable_beaconing;
1242};
1243
1244int wsm_beacon_transmit(struct cw1200_common *priv,
1245 const struct wsm_beacon_transmit *arg);
1246
1247int wsm_start_find(struct cw1200_common *priv);
1248
1249int wsm_stop_find(struct cw1200_common *priv);
1250
1251typedef void (*wsm_find_complete_cb) (struct cw1200_common *priv, u32 status);
1252
1253struct wsm_suspend_resume {
1254 /* See 3.52 */
1255 /* Link ID */
1256 /* [out] */ int link_id;
1257 /* Stop sending further Tx requests down to device for this link */
1258 /* [out] */ bool stop;
1259 /* Transmit multicast Frames */
1260 /* [out] */ bool multicast;
1261 /* The AC on which Tx to be suspended /resumed. */
1262 /* This is applicable only for U-APSD */
1263 /* WSM_QUEUE_... */
1264 /* [out] */ int queue;
1265};
1266
1267typedef void (*wsm_suspend_resume_cb) (struct cw1200_common *priv,
1268 struct wsm_suspend_resume *arg);
1269
1270/* 3.54 Update-IE request. */
1271struct wsm_update_ie {
1272 /* WSM_UPDATE_IE_... */
1273 /* [in] */ u16 what;
1274 /* [in] */ u16 count;
1275 /* [in] */ u8 *ies;
1276 /* [in] */ size_t length;
1277};
1278
1279int wsm_update_ie(struct cw1200_common *priv,
1280 const struct wsm_update_ie *arg);
1281
1282/* 3.56 */
1283struct wsm_map_link {
1284 /* MAC address of the remote device */
1285 /* [in] */ u8 mac_addr[6];
1286 /* [in] */ u8 link_id;
1287};
1288
1289int wsm_map_link(struct cw1200_common *priv, const struct wsm_map_link *arg);
1290
1291/* ******************************************************************** */
1292/* MIB shortcats */
1293
1294static inline int wsm_set_output_power(struct cw1200_common *priv,
1295 int power_level)
1296{
1297 __le32 val = __cpu_to_le32(power_level);
1298 return wsm_write_mib(priv, WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL,
1299 &val, sizeof(val));
1300}
1301
1302static inline int wsm_set_beacon_wakeup_period(struct cw1200_common *priv,
1303 unsigned dtim_interval,
1304 unsigned listen_interval)
1305{
1306 struct {
1307 u8 numBeaconPeriods;
1308 u8 reserved;
1309 __le16 listenInterval;
1310 } val = {
1311 dtim_interval, 0, __cpu_to_le16(listen_interval)
1312 };
1313
1314 if (dtim_interval > 0xFF || listen_interval > 0xFFFF)
1315 return -EINVAL;
1316 else
1317 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_WAKEUP_PERIOD,
1318 &val, sizeof(val));
1319}
1320
1321struct wsm_rcpi_rssi_threshold {
1322 u8 rssiRcpiMode; /* WSM_RCPI_RSSI_... */
1323 u8 lowerThreshold;
1324 u8 upperThreshold;
1325 u8 rollingAverageCount;
1326};
1327
1328static inline int wsm_set_rcpi_rssi_threshold(struct cw1200_common *priv,
1329 struct wsm_rcpi_rssi_threshold *arg)
1330{
1331 return wsm_write_mib(priv, WSM_MIB_ID_RCPI_RSSI_THRESHOLD, arg,
1332 sizeof(*arg));
1333}
1334
1335struct wsm_mib_counters_table {
1336 __le32 plcp_errors;
1337 __le32 fcs_errors;
1338 __le32 tx_packets;
1339 __le32 rx_packets;
1340 __le32 rx_packet_errors;
1341 __le32 rx_decryption_failures;
1342 __le32 rx_mic_failures;
1343 __le32 rx_no_key_failures;
1344 __le32 tx_multicast_frames;
1345 __le32 tx_frames_success;
1346 __le32 tx_frame_failures;
1347 __le32 tx_frames_retried;
1348 __le32 tx_frames_multi_retried;
1349 __le32 rx_frame_duplicates;
1350 __le32 rts_success;
1351 __le32 rts_failures;
1352 __le32 ack_failures;
1353 __le32 rx_multicast_frames;
1354 __le32 rx_frames_success;
1355 __le32 rx_cmac_icv_errors;
1356 __le32 rx_cmac_replays;
1357 __le32 rx_mgmt_ccmp_replays;
1358} __packed;
1359
1360static inline int wsm_get_counters_table(struct cw1200_common *priv,
1361 struct wsm_mib_counters_table *arg)
1362{
1363 return wsm_read_mib(priv, WSM_MIB_ID_COUNTERS_TABLE,
1364 arg, sizeof(*arg));
1365}
1366
1367static inline int wsm_get_station_id(struct cw1200_common *priv, u8 *mac)
1368{
1369 return wsm_read_mib(priv, WSM_MIB_ID_DOT11_STATION_ID, mac, ETH_ALEN);
1370}
1371
1372struct wsm_rx_filter {
1373 bool promiscuous;
1374 bool bssid;
1375 bool fcs;
1376 bool probeResponder;
1377};
1378
1379static inline int wsm_set_rx_filter(struct cw1200_common *priv,
1380 const struct wsm_rx_filter *arg)
1381{
1382 __le32 val = 0;
1383 if (arg->promiscuous)
1384 val |= __cpu_to_le32(BIT(0));
1385 if (arg->bssid)
1386 val |= __cpu_to_le32(BIT(1));
1387 if (arg->fcs)
1388 val |= __cpu_to_le32(BIT(2));
1389 if (arg->probeResponder)
1390 val |= __cpu_to_le32(BIT(3));
1391 return wsm_write_mib(priv, WSM_MIB_ID_RX_FILTER, &val, sizeof(val));
1392}
1393
1394int wsm_set_probe_responder(struct cw1200_common *priv, bool enable);
1395
1396#define WSM_BEACON_FILTER_IE_HAS_CHANGED BIT(0)
1397#define WSM_BEACON_FILTER_IE_NO_LONGER_PRESENT BIT(1)
1398#define WSM_BEACON_FILTER_IE_HAS_APPEARED BIT(2)
1399
1400struct wsm_beacon_filter_table_entry {
1401 u8 ie_id;
1402 u8 flags;
1403 u8 oui[3];
1404 u8 match_data[3];
1405} __packed;
1406
1407struct wsm_mib_beacon_filter_table {
1408 __le32 num;
1409 struct wsm_beacon_filter_table_entry entry[10];
1410} __packed;
1411
1412static inline int wsm_set_beacon_filter_table(struct cw1200_common *priv,
1413 struct wsm_mib_beacon_filter_table *ft)
1414{
1415 size_t size = __le32_to_cpu(ft->num) *
1416 sizeof(struct wsm_beacon_filter_table_entry) +
1417 sizeof(__le32);
1418
1419 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_TABLE, ft, size);
1420}
1421
1422#define WSM_BEACON_FILTER_ENABLE BIT(0) /* Enable/disable beacon filtering */
1423#define WSM_BEACON_FILTER_AUTO_ERP BIT(1) /* If 1 FW will handle ERP IE changes internally */
1424
1425struct wsm_beacon_filter_control {
1426 int enabled;
1427 int bcn_count;
1428};
1429
1430static inline int wsm_beacon_filter_control(struct cw1200_common *priv,
1431 struct wsm_beacon_filter_control *arg)
1432{
1433 struct {
1434 __le32 enabled;
1435 __le32 bcn_count;
1436 } val;
1437 val.enabled = __cpu_to_le32(arg->enabled);
1438 val.bcn_count = __cpu_to_le32(arg->bcn_count);
1439 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_ENABLE, &val,
1440 sizeof(val));
1441}
1442
1443enum wsm_power_mode {
1444 wsm_power_mode_active = 0,
1445 wsm_power_mode_doze = 1,
1446 wsm_power_mode_quiescent = 2,
1447};
1448
1449struct wsm_operational_mode {
1450 enum wsm_power_mode power_mode;
1451 int disable_more_flag_usage;
1452 int perform_ant_diversity;
1453};
1454
1455static inline int wsm_set_operational_mode(struct cw1200_common *priv,
1456 const struct wsm_operational_mode *arg)
1457{
1458 u8 val = arg->power_mode;
1459 if (arg->disable_more_flag_usage)
1460 val |= BIT(4);
1461 if (arg->perform_ant_diversity)
1462 val |= BIT(5);
1463 return wsm_write_mib(priv, WSM_MIB_ID_OPERATIONAL_POWER_MODE, &val,
1464 sizeof(val));
1465}
1466
1467struct wsm_template_frame {
1468 u8 frame_type;
1469 u8 rate;
1470 struct sk_buff *skb;
1471};
1472
1473static inline int wsm_set_template_frame(struct cw1200_common *priv,
1474 struct wsm_template_frame *arg)
1475{
1476 int ret;
1477 u8 *p = skb_push(arg->skb, 4);
1478 p[0] = arg->frame_type;
1479 p[1] = arg->rate;
1480 ((u16 *)p)[1] = __cpu_to_le16(arg->skb->len - 4);
1481 ret = wsm_write_mib(priv, WSM_MIB_ID_TEMPLATE_FRAME, p, arg->skb->len);
1482 skb_pull(arg->skb, 4);
1483 return ret;
1484}
1485
1486
1487struct wsm_protected_mgmt_policy {
1488 bool protectedMgmtEnable;
1489 bool unprotectedMgmtFramesAllowed;
1490 bool encryptionForAuthFrame;
1491};
1492
1493static inline int wsm_set_protected_mgmt_policy(struct cw1200_common *priv,
1494 struct wsm_protected_mgmt_policy *arg)
1495{
1496 __le32 val = 0;
1497 int ret;
1498 if (arg->protectedMgmtEnable)
1499 val |= __cpu_to_le32(BIT(0));
1500 if (arg->unprotectedMgmtFramesAllowed)
1501 val |= __cpu_to_le32(BIT(1));
1502 if (arg->encryptionForAuthFrame)
1503 val |= __cpu_to_le32(BIT(2));
1504 ret = wsm_write_mib(priv, WSM_MIB_ID_PROTECTED_MGMT_POLICY,
1505 &val, sizeof(val));
1506 return ret;
1507}
1508
1509struct wsm_mib_block_ack_policy {
1510 u8 tx_tid;
1511 u8 reserved1;
1512 u8 rx_tid;
1513 u8 reserved2;
1514} __packed;
1515
1516static inline int wsm_set_block_ack_policy(struct cw1200_common *priv,
1517 u8 tx_tid_policy,
1518 u8 rx_tid_policy)
1519{
1520 struct wsm_mib_block_ack_policy val = {
1521 .tx_tid = tx_tid_policy,
1522 .rx_tid = rx_tid_policy,
1523 };
1524 return wsm_write_mib(priv, WSM_MIB_ID_BLOCK_ACK_POLICY, &val,
1525 sizeof(val));
1526}
1527
1528struct wsm_mib_association_mode {
1529 u8 flags; /* WSM_ASSOCIATION_MODE_... */
1530 u8 preamble; /* WSM_JOIN_PREAMBLE_... */
1531 u8 greenfield; /* 1 for greenfield */
1532 u8 mpdu_start_spacing;
1533 __le32 basic_rate_set;
1534} __packed;
1535
1536static inline int wsm_set_association_mode(struct cw1200_common *priv,
1537 struct wsm_mib_association_mode *arg)
1538{
1539 return wsm_write_mib(priv, WSM_MIB_ID_SET_ASSOCIATION_MODE, arg,
1540 sizeof(*arg));
1541}
1542
1543#define WSM_TX_RATE_POLICY_FLAG_TERMINATE_WHEN_FINISHED BIT(2)
1544#define WSM_TX_RATE_POLICY_FLAG_COUNT_INITIAL_TRANSMIT BIT(3)
1545struct wsm_tx_rate_retry_policy {
1546 u8 index;
1547 u8 short_retries;
1548 u8 long_retries;
1549 /* BIT(2) - Terminate retries when Tx rate retry policy
1550 * finishes.
1551 * BIT(3) - Count initial frame transmission as part of
1552 * rate retry counting but not as a retry
1553 * attempt */
1554 u8 flags;
1555 u8 rate_recoveries;
1556 u8 reserved[3];
1557 __le32 rate_count_indices[3];
1558} __packed;
1559
1560struct wsm_set_tx_rate_retry_policy {
1561 u8 num;
1562 u8 reserved[3];
1563 struct wsm_tx_rate_retry_policy tbl[8];
1564} __packed;
1565
1566static inline int wsm_set_tx_rate_retry_policy(struct cw1200_common *priv,
1567 struct wsm_set_tx_rate_retry_policy *arg)
1568{
1569 size_t size = 4 + arg->num * sizeof(struct wsm_tx_rate_retry_policy);
1570 return wsm_write_mib(priv, WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg,
1571 size);
1572}
1573
1574/* 4.32 SetEtherTypeDataFrameFilter */
1575struct wsm_ether_type_filter_hdr {
1576 u8 num; /* Up to WSM_MAX_FILTER_ELEMENTS */
1577 u8 reserved[3];
1578} __packed;
1579
1580struct wsm_ether_type_filter {
1581 u8 action; /* WSM_FILTER_ACTION_XXX */
1582 u8 reserved;
1583 __le16 type; /* Type of ethernet frame */
1584} __packed;
1585
1586static inline int wsm_set_ether_type_filter(struct cw1200_common *priv,
1587 struct wsm_ether_type_filter_hdr *arg)
1588{
1589 size_t size = sizeof(struct wsm_ether_type_filter_hdr) +
1590 arg->num * sizeof(struct wsm_ether_type_filter);
1591 return wsm_write_mib(priv, WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER,
1592 arg, size);
1593}
1594
1595/* 4.33 SetUDPPortDataFrameFilter */
1596struct wsm_udp_port_filter_hdr {
1597 u8 num; /* Up to WSM_MAX_FILTER_ELEMENTS */
1598 u8 reserved[3];
1599} __packed;
1600
1601struct wsm_udp_port_filter {
1602 u8 action; /* WSM_FILTER_ACTION_XXX */
1603 u8 type; /* WSM_FILTER_PORT_TYPE_XXX */
1604 __le16 port; /* Port number */
1605} __packed;
1606
1607static inline int wsm_set_udp_port_filter(struct cw1200_common *priv,
1608 struct wsm_udp_port_filter_hdr *arg)
1609{
1610 size_t size = sizeof(struct wsm_udp_port_filter_hdr) +
1611 arg->num * sizeof(struct wsm_udp_port_filter);
1612 return wsm_write_mib(priv, WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER,
1613 arg, size);
1614}
1615
1616/* Undocumented MIBs: */
1617/* 4.35 P2PDeviceInfo */
1618#define D11_MAX_SSID_LEN (32)
1619
1620struct wsm_p2p_device_type {
1621 __le16 categoryId;
1622 u8 oui[4];
1623 __le16 subCategoryId;
1624} __packed;
1625
1626struct wsm_p2p_device_info {
1627 struct wsm_p2p_device_type primaryDevice;
1628 u8 reserved1[3];
1629 u8 devNameSize;
1630 u8 localDevName[D11_MAX_SSID_LEN];
1631 u8 reserved2[3];
1632 u8 numSecDevSupported;
1633 struct wsm_p2p_device_type secondaryDevices[0];
1634} __packed;
1635
1636/* 4.36 SetWCDMABand - WO */
1637struct wsm_cdma_band {
1638 u8 WCDMA_Band;
1639 u8 reserved[3];
1640} __packed;
1641
1642/* 4.37 GroupTxSequenceCounter - RO */
1643struct wsm_group_tx_seq {
1644 __le32 bits_47_16;
1645 __le16 bits_15_00;
1646 __le16 reserved;
1647} __packed;
1648
1649/* 4.39 SetHtProtection - WO */
1650#define WSM_DUAL_CTS_PROT_ENB (1 << 0)
1651#define WSM_NON_GREENFIELD_STA_PRESENT (1 << 1)
1652#define WSM_HT_PROT_MODE__NO_PROT (0 << 2)
1653#define WSM_HT_PROT_MODE__NON_MEMBER (1 << 2)
1654#define WSM_HT_PROT_MODE__20_MHZ (2 << 2)
1655#define WSM_HT_PROT_MODE__NON_HT_MIXED (3 << 2)
1656#define WSM_LSIG_TXOP_PROT_FULL (1 << 4)
1657#define WSM_LARGE_L_LENGTH_PROT (1 << 5)
1658
1659struct wsm_ht_protection {
1660 __le32 flags;
1661} __packed;
1662
1663/* 4.40 GPIO Command - R/W */
1664#define WSM_GPIO_COMMAND_SETUP 0
1665#define WSM_GPIO_COMMAND_READ 1
1666#define WSM_GPIO_COMMAND_WRITE 2
1667#define WSM_GPIO_COMMAND_RESET 3
1668#define WSM_GPIO_ALL_PINS 0xFF
1669
1670struct wsm_gpio_command {
1671 u8 GPIO_Command;
1672 u8 pin;
1673 __le16 config;
1674} __packed;
1675
1676/* 4.41 TSFCounter - RO */
1677struct wsm_tsf_counter {
1678 __le64 TSF_Counter;
1679} __packed;
1680
1681/* 4.43 Keep alive period */
1682struct wsm_keep_alive_period {
1683 __le16 keepAlivePeriod;
1684 u8 reserved[2];
1685} __packed;
1686
1687static inline int wsm_keep_alive_period(struct cw1200_common *priv,
1688 int period)
1689{
1690 struct wsm_keep_alive_period arg = {
1691 .keepAlivePeriod = __cpu_to_le16(period),
1692 };
1693 return wsm_write_mib(priv, WSM_MIB_ID_KEEP_ALIVE_PERIOD,
1694 &arg, sizeof(arg));
1695};
1696
1697/* BSSID filtering */
1698struct wsm_set_bssid_filtering {
1699 u8 filter;
1700 u8 reserved[3];
1701} __packed;
1702
1703static inline int wsm_set_bssid_filtering(struct cw1200_common *priv,
1704 bool enabled)
1705{
1706 struct wsm_set_bssid_filtering arg = {
1707 .filter = !enabled,
1708 };
1709 return wsm_write_mib(priv, WSM_MIB_ID_DISABLE_BSSID_FILTER,
1710 &arg, sizeof(arg));
1711}
1712
1713/* Multicast filtering - 4.5 */
1714struct wsm_mib_multicast_filter {
1715 __le32 enable;
1716 __le32 num_addrs;
1717 u8 macaddrs[WSM_MAX_GRP_ADDRTABLE_ENTRIES][ETH_ALEN];
1718} __packed;
1719
1720static inline int wsm_set_multicast_filter(struct cw1200_common *priv,
1721 struct wsm_mib_multicast_filter *fp)
1722{
1723 return wsm_write_mib(priv, WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE,
1724 fp, sizeof(*fp));
1725}
1726
1727/* ARP IPv4 filtering - 4.10 */
1728struct wsm_mib_arp_ipv4_filter {
1729 __le32 enable;
1730 __be32 ipv4addrs[WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES];
1731} __packed;
1732
1733static inline int wsm_set_arp_ipv4_filter(struct cw1200_common *priv,
1734 struct wsm_mib_arp_ipv4_filter *fp)
1735{
1736 return wsm_write_mib(priv, WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE,
1737 fp, sizeof(*fp));
1738}
1739
1740/* P2P Power Save Mode Info - 4.31 */
1741struct wsm_p2p_ps_modeinfo {
1742 u8 oppPsCTWindow;
1743 u8 count;
1744 u8 reserved;
1745 u8 dtimCount;
1746 __le32 duration;
1747 __le32 interval;
1748 __le32 startTime;
1749} __packed;
1750
1751static inline int wsm_set_p2p_ps_modeinfo(struct cw1200_common *priv,
1752 struct wsm_p2p_ps_modeinfo *mi)
1753{
1754 return wsm_write_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
1755 mi, sizeof(*mi));
1756}
1757
1758static inline int wsm_get_p2p_ps_modeinfo(struct cw1200_common *priv,
1759 struct wsm_p2p_ps_modeinfo *mi)
1760{
1761 return wsm_read_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
1762 mi, sizeof(*mi));
1763}
1764
1765/* UseMultiTxConfMessage */
1766
1767static inline int wsm_use_multi_tx_conf(struct cw1200_common *priv,
1768 bool enabled)
1769{
1770 __le32 arg = enabled ? __cpu_to_le32(1) : 0;
1771
1772 return wsm_write_mib(priv, WSM_MIB_USE_MULTI_TX_CONF,
1773 &arg, sizeof(arg));
1774}
1775
1776
1777/* 4.26 SetUpasdInformation */
1778struct wsm_uapsd_info {
1779 __le16 uapsd_flags;
1780 __le16 min_auto_trigger_interval;
1781 __le16 max_auto_trigger_interval;
1782 __le16 auto_trigger_step;
1783};
1784
1785static inline int wsm_set_uapsd_info(struct cw1200_common *priv,
1786 struct wsm_uapsd_info *arg)
1787{
1788 return wsm_write_mib(priv, WSM_MIB_ID_SET_UAPSD_INFORMATION,
1789 arg, sizeof(*arg));
1790}
1791
1792/* 4.22 OverrideInternalTxRate */
1793struct wsm_override_internal_txrate {
1794 u8 internalTxRate;
1795 u8 nonErpInternalTxRate;
1796 u8 reserved[2];
1797} __packed;
1798
1799static inline int wsm_set_override_internal_txrate(struct cw1200_common *priv,
1800 struct wsm_override_internal_txrate *arg)
1801{
1802 return wsm_write_mib(priv, WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE,
1803 arg, sizeof(*arg));
1804}
1805
1806/* ******************************************************************** */
1807/* WSM TX port control */
1808
1809void wsm_lock_tx(struct cw1200_common *priv);
1810void wsm_lock_tx_async(struct cw1200_common *priv);
1811bool wsm_flush_tx(struct cw1200_common *priv);
1812void wsm_unlock_tx(struct cw1200_common *priv);
1813
1814/* ******************************************************************** */
1815/* WSM / BH API */
1816
1817int wsm_handle_exception(struct cw1200_common *priv, u8 *data, size_t len);
1818int wsm_handle_rx(struct cw1200_common *priv, u16 id, struct wsm_hdr *wsm,
1819 struct sk_buff **skb_p);
1820
1821/* ******************************************************************** */
1822/* wsm_buf API */
1823
1824struct wsm_buf {
1825 u8 *begin;
1826 u8 *data;
1827 u8 *end;
1828};
1829
1830void wsm_buf_init(struct wsm_buf *buf);
1831void wsm_buf_deinit(struct wsm_buf *buf);
1832
1833/* ******************************************************************** */
1834/* wsm_cmd API */
1835
1836struct wsm_cmd {
1837 spinlock_t lock; /* Protect structure from multiple access */
1838 int done;
1839 u8 *ptr;
1840 size_t len;
1841 void *arg;
1842 int ret;
1843 u16 cmd;
1844};
1845
1846/* ******************************************************************** */
1847/* WSM TX buffer access */
1848
1849int wsm_get_tx(struct cw1200_common *priv, u8 **data,
1850 size_t *tx_len, int *burst);
1851void wsm_txed(struct cw1200_common *priv, u8 *data);
1852
1853/* ******************************************************************** */
1854/* Queue mapping: WSM <---> linux */
1855/* Linux: VO VI BE BK */
1856/* WSM: BE BK VI VO */
1857
1858static inline u8 wsm_queue_id_to_linux(u8 queue_id)
1859{
1860 static const u8 queue_mapping[] = {
1861 2, 3, 1, 0
1862 };
1863 return queue_mapping[queue_id];
1864}
1865
1866static inline u8 wsm_queue_id_to_wsm(u8 queue_id)
1867{
1868 static const u8 queue_mapping[] = {
1869 3, 2, 0, 1
1870 };
1871 return queue_mapping[queue_id];
1872}
1873
1874
1875#ifdef CONFIG_CW1200_ETF
1876int wsm_raw_cmd(struct cw1200_common *priv, u8 *data, size_t len);
1877#endif
1878
1879#endif /* CW1200_HWIO_H_INCLUDED */