blob: 2816171f7a1dafae322555608ea7e05d1406daa0 [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
Solomon Peachy8b3e7be2013-06-11 09:49:40 -0400317 * ProbeForJoin parameter is ignored.
318 */
Solomon Peachya910e4a2013-05-24 20:04:38 -0400319#define WSM_JOIN_FLAGS_FORCE BIT(2)
320/* Give probe request/response higher
Solomon Peachy8b3e7be2013-06-11 09:49:40 -0400321 * priority over the BT traffic
322 */
Solomon Peachya910e4a2013-05-24 20:04:38 -0400323#define WSM_JOIN_FLAGS_PRIO BIT(3)
324/* Issue immediate join confirmation and use
Solomon Peachy8b3e7be2013-06-11 09:49:40 -0400325 * join complete to notify about completion
326 */
Solomon Peachya910e4a2013-05-24 20:04:38 -0400327#define WSM_JOIN_FLAGS_FORCE_WITH_COMPLETE_IND BIT(5)
328
329/* Key types */
330#define WSM_KEY_TYPE_WEP_DEFAULT (0)
331#define WSM_KEY_TYPE_WEP_PAIRWISE (1)
332#define WSM_KEY_TYPE_TKIP_GROUP (2)
333#define WSM_KEY_TYPE_TKIP_PAIRWISE (3)
334#define WSM_KEY_TYPE_AES_GROUP (4)
335#define WSM_KEY_TYPE_AES_PAIRWISE (5)
336#define WSM_KEY_TYPE_WAPI_GROUP (6)
337#define WSM_KEY_TYPE_WAPI_PAIRWISE (7)
338
339/* Key indexes */
340#define WSM_KEY_MAX_INDEX (10)
341
342/* ACK policy */
343#define WSM_ACK_POLICY_NORMAL (0)
344#define WSM_ACK_POLICY_NO_ACK (1)
345
346/* Start modes */
347#define WSM_START_MODE_AP (0) /* Mini AP */
348#define WSM_START_MODE_P2P_GO (1) /* P2P GO */
349#define WSM_START_MODE_P2P_DEV (2) /* P2P device */
350
351/* SetAssociationMode MIB flags */
352#define WSM_ASSOCIATION_MODE_USE_PREAMBLE_TYPE (BIT(0))
353#define WSM_ASSOCIATION_MODE_USE_HT_MODE (BIT(1))
354#define WSM_ASSOCIATION_MODE_USE_BASIC_RATE_SET (BIT(2))
355#define WSM_ASSOCIATION_MODE_USE_MPDU_START_SPACING (BIT(3))
356#define WSM_ASSOCIATION_MODE_SNOOP_ASSOC_FRAMES (BIT(4))
357
358/* RcpiRssiThreshold MIB flags */
359#define WSM_RCPI_RSSI_THRESHOLD_ENABLE (BIT(0))
360#define WSM_RCPI_RSSI_USE_RSSI (BIT(1))
361#define WSM_RCPI_RSSI_DONT_USE_UPPER (BIT(2))
362#define WSM_RCPI_RSSI_DONT_USE_LOWER (BIT(3))
363
364/* Update-ie constants */
365#define WSM_UPDATE_IE_BEACON (BIT(0))
366#define WSM_UPDATE_IE_PROBE_RESP (BIT(1))
367#define WSM_UPDATE_IE_PROBE_REQ (BIT(2))
368
369/* WSM events */
370/* Error */
371#define WSM_EVENT_ERROR (0)
372
373/* BSS lost */
374#define WSM_EVENT_BSS_LOST (1)
375
376/* BSS regained */
377#define WSM_EVENT_BSS_REGAINED (2)
378
379/* Radar detected */
380#define WSM_EVENT_RADAR_DETECTED (3)
381
382/* RCPI or RSSI threshold triggered */
383#define WSM_EVENT_RCPI_RSSI (4)
384
385/* BT inactive */
386#define WSM_EVENT_BT_INACTIVE (5)
387
388/* BT active */
389#define WSM_EVENT_BT_ACTIVE (6)
390
391/* MIB IDs */
392/* 4.1 dot11StationId */
393#define WSM_MIB_ID_DOT11_STATION_ID 0x0000
394
395/* 4.2 dot11MaxtransmitMsduLifeTime */
396#define WSM_MIB_ID_DOT11_MAX_TRANSMIT_LIFTIME 0x0001
397
398/* 4.3 dot11MaxReceiveLifeTime */
399#define WSM_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME 0x0002
400
401/* 4.4 dot11SlotTime */
402#define WSM_MIB_ID_DOT11_SLOT_TIME 0x0003
403
404/* 4.5 dot11GroupAddressesTable */
405#define WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE 0x0004
406#define WSM_MAX_GRP_ADDRTABLE_ENTRIES 8
407
408/* 4.6 dot11WepDefaultKeyId */
409#define WSM_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID 0x0005
410
411/* 4.7 dot11CurrentTxPowerLevel */
412#define WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL 0x0006
413
414/* 4.8 dot11RTSThreshold */
415#define WSM_MIB_ID_DOT11_RTS_THRESHOLD 0x0007
416
417/* 4.9 NonErpProtection */
418#define WSM_MIB_ID_NON_ERP_PROTECTION 0x1000
419
420/* 4.10 ArpIpAddressesTable */
421#define WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE 0x1001
422#define WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES 1
423
424/* 4.11 TemplateFrame */
425#define WSM_MIB_ID_TEMPLATE_FRAME 0x1002
426
427/* 4.12 RxFilter */
428#define WSM_MIB_ID_RX_FILTER 0x1003
429
430/* 4.13 BeaconFilterTable */
431#define WSM_MIB_ID_BEACON_FILTER_TABLE 0x1004
432
433/* 4.14 BeaconFilterEnable */
434#define WSM_MIB_ID_BEACON_FILTER_ENABLE 0x1005
435
436/* 4.15 OperationalPowerMode */
437#define WSM_MIB_ID_OPERATIONAL_POWER_MODE 0x1006
438
439/* 4.16 BeaconWakeUpPeriod */
440#define WSM_MIB_ID_BEACON_WAKEUP_PERIOD 0x1007
441
442/* 4.17 RcpiRssiThreshold */
443#define WSM_MIB_ID_RCPI_RSSI_THRESHOLD 0x1009
444
445/* 4.18 StatisticsTable */
446#define WSM_MIB_ID_STATISTICS_TABLE 0x100A
447
448/* 4.19 IbssPsConfig */
449#define WSM_MIB_ID_IBSS_PS_CONFIG 0x100B
450
451/* 4.20 CountersTable */
452#define WSM_MIB_ID_COUNTERS_TABLE 0x100C
453
454/* 4.21 BlockAckPolicy */
455#define WSM_MIB_ID_BLOCK_ACK_POLICY 0x100E
456
457/* 4.22 OverrideInternalTxRate */
458#define WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE 0x100F
459
460/* 4.23 SetAssociationMode */
461#define WSM_MIB_ID_SET_ASSOCIATION_MODE 0x1010
462
463/* 4.24 UpdateEptaConfigData */
464#define WSM_MIB_ID_UPDATE_EPTA_CONFIG_DATA 0x1011
465
466/* 4.25 SelectCcaMethod */
467#define WSM_MIB_ID_SELECT_CCA_METHOD 0x1012
468
469/* 4.26 SetUpasdInformation */
470#define WSM_MIB_ID_SET_UAPSD_INFORMATION 0x1013
471
472/* 4.27 SetAutoCalibrationMode WBF00004073 */
473#define WSM_MIB_ID_SET_AUTO_CALIBRATION_MODE 0x1015
474
475/* 4.28 SetTxRateRetryPolicy */
476#define WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY 0x1016
477
478/* 4.29 SetHostMessageTypeFilter */
479#define WSM_MIB_ID_SET_HOST_MSG_TYPE_FILTER 0x1017
480
481/* 4.30 P2PFindInfo */
482#define WSM_MIB_ID_P2P_FIND_INFO 0x1018
483
484/* 4.31 P2PPsModeInfo */
485#define WSM_MIB_ID_P2P_PS_MODE_INFO 0x1019
486
487/* 4.32 SetEtherTypeDataFrameFilter */
488#define WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER 0x101A
489
490/* 4.33 SetUDPPortDataFrameFilter */
491#define WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER 0x101B
492
493/* 4.34 SetMagicDataFrameFilter */
494#define WSM_MIB_ID_SET_MAGIC_DATAFRAME_FILTER 0x101C
495
496/* 4.35 P2PDeviceInfo */
497#define WSM_MIB_ID_P2P_DEVICE_INFO 0x101D
498
499/* 4.36 SetWCDMABand */
500#define WSM_MIB_ID_SET_WCDMA_BAND 0x101E
501
502/* 4.37 GroupTxSequenceCounter */
503#define WSM_MIB_ID_GRP_SEQ_COUNTER 0x101F
504
505/* 4.38 ProtectedMgmtPolicy */
506#define WSM_MIB_ID_PROTECTED_MGMT_POLICY 0x1020
507
508/* 4.39 SetHtProtection */
509#define WSM_MIB_ID_SET_HT_PROTECTION 0x1021
510
511/* 4.40 GPIO Command */
512#define WSM_MIB_ID_GPIO_COMMAND 0x1022
513
514/* 4.41 TSF Counter Value */
515#define WSM_MIB_ID_TSF_COUNTER 0x1023
516
517/* Test Purposes Only */
518#define WSM_MIB_ID_BLOCK_ACK_INFO 0x100D
519
520/* 4.42 UseMultiTxConfMessage */
521#define WSM_MIB_USE_MULTI_TX_CONF 0x1024
522
523/* 4.43 Keep-alive period */
524#define WSM_MIB_ID_KEEP_ALIVE_PERIOD 0x1025
525
526/* 4.44 Disable BSSID filter */
527#define WSM_MIB_ID_DISABLE_BSSID_FILTER 0x1026
528
529/* Frame template types */
530#define WSM_FRAME_TYPE_PROBE_REQUEST (0)
531#define WSM_FRAME_TYPE_BEACON (1)
532#define WSM_FRAME_TYPE_NULL (2)
533#define WSM_FRAME_TYPE_QOS_NULL (3)
534#define WSM_FRAME_TYPE_PS_POLL (4)
535#define WSM_FRAME_TYPE_PROBE_RESPONSE (5)
536
537#define WSM_FRAME_GREENFIELD (0x80) /* See 4.11 */
538
539/* Status */
540/* The WSM firmware has completed a request */
541/* successfully. */
542#define WSM_STATUS_SUCCESS (0)
543
544/* This is a generic failure code if other error codes do */
545/* not apply. */
546#define WSM_STATUS_FAILURE (1)
547
548/* A request contains one or more invalid parameters. */
549#define WSM_INVALID_PARAMETER (2)
550
551/* The request cannot perform because the device is in */
552/* an inappropriate mode. */
553#define WSM_ACCESS_DENIED (3)
554
555/* The frame received includes a decryption error. */
556#define WSM_STATUS_DECRYPTFAILURE (4)
557
558/* A MIC failure is detected in the received packets. */
559#define WSM_STATUS_MICFAILURE (5)
560
561/* The transmit request failed due to retry limit being */
562/* exceeded. */
563#define WSM_STATUS_RETRY_EXCEEDED (6)
564
565/* The transmit request failed due to MSDU life time */
566/* being exceeded. */
567#define WSM_STATUS_TX_LIFETIME_EXCEEDED (7)
568
569/* The link to the AP is lost. */
570#define WSM_STATUS_LINK_LOST (8)
571
572/* No key was found for the encrypted frame */
573#define WSM_STATUS_NO_KEY_FOUND (9)
574
575/* Jammer was detected when transmitting this frame */
576#define WSM_STATUS_JAMMER_DETECTED (10)
577
578/* The message should be requeued later. */
579/* This is applicable only to Transmit */
580#define WSM_REQUEUE (11)
581
582/* Advanced filtering options */
583#define WSM_MAX_FILTER_ELEMENTS (4)
584
585#define WSM_FILTER_ACTION_IGNORE (0)
586#define WSM_FILTER_ACTION_FILTER_IN (1)
587#define WSM_FILTER_ACTION_FILTER_OUT (2)
588
589#define WSM_FILTER_PORT_TYPE_DST (0)
590#define WSM_FILTER_PORT_TYPE_SRC (1)
591
592/* Actual header of WSM messages */
593struct wsm_hdr {
594 __le16 len;
595 __le16 id;
596};
597
598#define WSM_TX_SEQ_MAX (7)
599#define WSM_TX_SEQ(seq) \
600 ((seq & WSM_TX_SEQ_MAX) << 13)
601#define WSM_TX_LINK_ID_MAX (0x0F)
602#define WSM_TX_LINK_ID(link_id) \
603 ((link_id & WSM_TX_LINK_ID_MAX) << 6)
604
605#define MAX_BEACON_SKIP_TIME_MS 1000
606
607#define WSM_CMD_LAST_CHANCE_TIMEOUT (HZ * 3 / 2)
608
609/* ******************************************************************** */
610/* WSM capability */
611
612#define WSM_STARTUP_IND_ID 0x0801
613
614struct wsm_startup_ind {
615 u16 input_buffers;
616 u16 input_buffer_size;
617 u16 status;
618 u16 hw_id;
619 u16 hw_subid;
620 u16 fw_cap;
621 u16 fw_type;
622 u16 fw_api;
623 u16 fw_build;
624 u16 fw_ver;
625 char fw_label[128];
626 u32 config[4];
627};
628
629/* ******************************************************************** */
630/* WSM commands */
631
632/* 3.1 */
633#define WSM_CONFIGURATION_REQ_ID 0x0009
634#define WSM_CONFIGURATION_RESP_ID 0x0409
635
636struct wsm_tx_power_range {
637 int min_power_level;
638 int max_power_level;
639 u32 stepping;
640};
641
642struct wsm_configuration {
643 /* [in] */ u32 dot11MaxTransmitMsduLifeTime;
644 /* [in] */ u32 dot11MaxReceiveLifeTime;
645 /* [in] */ u32 dot11RtsThreshold;
646 /* [in, out] */ u8 *dot11StationId;
647 /* [in] */ const void *dpdData;
648 /* [in] */ size_t dpdData_size;
649 /* [out] */ u8 dot11FrequencyBandsSupported;
650 /* [out] */ u32 supportedRateMask;
651 /* [out] */ struct wsm_tx_power_range txPowerRange[2];
652};
653
654int wsm_configuration(struct cw1200_common *priv,
655 struct wsm_configuration *arg);
656
657/* 3.3 */
658#define WSM_RESET_REQ_ID 0x000A
659#define WSM_RESET_RESP_ID 0x040A
660struct wsm_reset {
661 /* [in] */ int link_id;
662 /* [in] */ bool reset_statistics;
663};
664
665int wsm_reset(struct cw1200_common *priv, const struct wsm_reset *arg);
666
667/* 3.5 */
668#define WSM_READ_MIB_REQ_ID 0x0005
669#define WSM_READ_MIB_RESP_ID 0x0405
670int wsm_read_mib(struct cw1200_common *priv, u16 mib_id, void *buf,
671 size_t buf_size);
672
673/* 3.7 */
674#define WSM_WRITE_MIB_REQ_ID 0x0006
675#define WSM_WRITE_MIB_RESP_ID 0x0406
676int wsm_write_mib(struct cw1200_common *priv, u16 mib_id, void *buf,
677 size_t buf_size);
678
679/* 3.9 */
680#define WSM_START_SCAN_REQ_ID 0x0007
681#define WSM_START_SCAN_RESP_ID 0x0407
682
683struct wsm_ssid {
684 u8 ssid[32];
685 u32 length;
686};
687
688struct wsm_scan_ch {
689 u16 number;
690 u32 min_chan_time;
691 u32 max_chan_time;
692 u32 tx_power_level;
693};
694
695struct wsm_scan {
696 /* WSM_PHY_BAND_... */
697 u8 band;
698
699 /* WSM_SCAN_TYPE_... */
700 u8 type;
701
702 /* WSM_SCAN_FLAG_... */
703 u8 flags;
704
705 /* WSM_TRANSMIT_RATE_... */
706 u8 max_tx_rate;
707
708 /* Interval period in TUs that the device shall the re- */
709 /* execute the requested scan. Max value supported by the device */
710 /* is 256s. */
711 u32 auto_scan_interval;
712
713 /* Number of probe requests (per SSID) sent to one (1) */
714 /* channel. Zero (0) means that none is send, which */
715 /* means that a passive scan is to be done. Value */
716 /* greater than zero (0) means that an active scan is to */
717 /* be done. */
718 u32 num_probes;
719
720 /* Number of channels to be scanned. */
721 /* Maximum value is WSM_SCAN_MAX_NUM_OF_CHANNELS. */
722 u8 num_channels;
723
724 /* Number of SSID provided in the scan command (this */
725 /* is zero (0) in broadcast scan) */
726 /* The maximum number of SSIDs is WSM_SCAN_MAX_NUM_OF_SSIDS. */
727 u8 num_ssids;
728
729 /* The delay time (in microseconds) period */
730 /* before sending a probe-request. */
731 u8 probe_delay;
732
733 /* SSIDs to be scanned [numOfSSIDs]; */
734 struct wsm_ssid *ssids;
735
736 /* Channels to be scanned [numOfChannels]; */
737 struct wsm_scan_ch *ch;
738};
739
740int wsm_scan(struct cw1200_common *priv, const struct wsm_scan *arg);
741
742/* 3.11 */
743#define WSM_STOP_SCAN_REQ_ID 0x0008
744#define WSM_STOP_SCAN_RESP_ID 0x0408
745int wsm_stop_scan(struct cw1200_common *priv);
746
747/* 3.13 */
748#define WSM_SCAN_COMPLETE_IND_ID 0x0806
749struct wsm_scan_complete {
750 /* WSM_STATUS_... */
751 u32 status;
752
753 /* WSM_PSM_... */
754 u8 psm;
755
756 /* Number of channels that the scan operation completed. */
757 u8 num_channels;
758};
759
760/* 3.14 */
761#define WSM_TX_CONFIRM_IND_ID 0x0404
762#define WSM_MULTI_TX_CONFIRM_ID 0x041E
763
764struct wsm_tx_confirm {
765 /* Packet identifier used in wsm_tx. */
766 u32 packet_id;
767
768 /* WSM_STATUS_... */
769 u32 status;
770
771 /* WSM_TRANSMIT_RATE_... */
772 u8 tx_rate;
773
774 /* The number of times the frame was transmitted */
775 /* without receiving an acknowledgement. */
776 u8 ack_failures;
777
778 /* WSM_TX_STATUS_... */
779 u16 flags;
780
781 /* The total time in microseconds that the frame spent in */
782 /* the WLAN device before transmission as completed. */
783 u32 media_delay;
784
785 /* The total time in microseconds that the frame spent in */
786 /* the WLAN device before transmission was started. */
787 u32 tx_queue_delay;
788};
789
790/* 3.15 */
791typedef void (*wsm_tx_confirm_cb) (struct cw1200_common *priv,
792 struct wsm_tx_confirm *arg);
793
794/* Note that ideology of wsm_tx struct is different against the rest of
795 * WSM API. wsm_hdr is /not/ a caller-adapted struct to be used as an input
796 * argument for WSM call, but a prepared bytestream to be sent to firmware.
797 * It is filled partly in cw1200_tx, partly in low-level WSM code.
798 * Please pay attention once again: ideology is different.
799 *
800 * Legend:
801 * - [in]: cw1200_tx must fill this field.
802 * - [wsm]: the field is filled by low-level WSM.
803 */
804struct wsm_tx {
805 /* common WSM header */
806 struct wsm_hdr hdr;
807
808 /* Packet identifier that meant to be used in completion. */
809 __le32 packet_id;
810
811 /* WSM_TRANSMIT_RATE_... */
812 u8 max_tx_rate;
813
814 /* WSM_QUEUE_... */
815 u8 queue_id;
816
817 /* True: another packet is pending on the host for transmission. */
818 u8 more;
819
820 /* Bit 0 = 0 - Start expiry time from first Tx attempt (default) */
821 /* Bit 0 = 1 - Start expiry time from receipt of Tx Request */
822 /* Bits 3:1 - PTA Priority */
823 /* Bits 6:4 - Tx Rate Retry Policy */
824 /* Bit 7 - Reserved */
825 u8 flags;
826
827 /* Should be 0. */
828 __le32 reserved;
829
830 /* The elapsed time in TUs, after the initial transmission */
831 /* of an MSDU, after which further attempts to transmit */
832 /* the MSDU shall be terminated. Overrides the global */
833 /* dot11MaxTransmitMsduLifeTime setting [optional] */
834 /* Device will set the default value if this is 0. */
835 __le32 expire_time;
836
837 /* WSM_HT_TX_... */
838 __le32 ht_tx_parameters;
839};
840
841/* = sizeof(generic hi hdr) + sizeof(wsm hdr) + sizeof(alignment) */
842#define WSM_TX_EXTRA_HEADROOM (28)
843
844/* 3.16 */
845#define WSM_RECEIVE_IND_ID 0x0804
846
847struct wsm_rx {
848 /* WSM_STATUS_... */
849 __le32 status;
850
851 /* Specifies the channel of the received packet. */
852 __le16 channel_number;
853
854 /* WSM_TRANSMIT_RATE_... */
855 u8 rx_rate;
856
857 /* This value is expressed in signed Q8.0 format for */
858 /* RSSI and unsigned Q7.1 format for RCPI. */
859 u8 rcpi_rssi;
860
861 /* WSM_RX_STATUS_... */
862 __le32 flags;
863
864 /* Payload */
865 u8 data[0];
866} __packed;
867
868/* = sizeof(generic hi hdr) + sizeof(wsm hdr) */
869#define WSM_RX_EXTRA_HEADROOM (16)
870
871typedef void (*wsm_rx_cb) (struct cw1200_common *priv, struct wsm_rx *arg,
872 struct sk_buff **skb_p);
873
874/* 3.17 */
875struct wsm_event {
876 /* WSM_STATUS_... */
877 /* [out] */ u32 id;
878
879 /* Indication parameters. */
880 /* For error indication, this shall be a 32-bit WSM status. */
881 /* For RCPI or RSSI indication, this should be an 8-bit */
882 /* RCPI or RSSI value. */
883 /* [out] */ u32 data;
884};
885
886struct cw1200_wsm_event {
887 struct list_head link;
888 struct wsm_event evt;
889};
890
891/* 3.18 - 3.22 */
892/* Measurement. Skipped for now. Irrelevent. */
893
894typedef void (*wsm_event_cb) (struct cw1200_common *priv,
895 struct wsm_event *arg);
896
897/* 3.23 */
898#define WSM_JOIN_REQ_ID 0x000B
899#define WSM_JOIN_RESP_ID 0x040B
900
901struct wsm_join {
902 /* WSM_JOIN_MODE_... */
903 u8 mode;
904
905 /* WSM_PHY_BAND_... */
906 u8 band;
907
908 /* Specifies the channel number to join. The channel */
909 /* number will be mapped to an actual frequency */
910 /* according to the band */
911 u16 channel_number;
912
913 /* Specifies the BSSID of the BSS or IBSS to be joined */
914 /* or the IBSS to be started. */
915 u8 bssid[6];
916
917 /* ATIM window of IBSS */
918 /* When ATIM window is zero the initiated IBSS does */
919 /* not support power saving. */
920 u16 atim_window;
921
922 /* WSM_JOIN_PREAMBLE_... */
923 u8 preamble_type;
924
925 /* Specifies if a probe request should be send with the */
926 /* specified SSID when joining to the network. */
927 u8 probe_for_join;
928
929 /* DTIM Period (In multiples of beacon interval) */
930 u8 dtim_period;
931
932 /* WSM_JOIN_FLAGS_... */
933 u8 flags;
934
935 /* Length of the SSID */
936 u32 ssid_len;
937
938 /* Specifies the SSID of the IBSS to join or start */
939 u8 ssid[32];
940
941 /* Specifies the time between TBTTs in TUs */
942 u32 beacon_interval;
943
944 /* A bit mask that defines the BSS basic rate set. */
945 u32 basic_rate_set;
946};
947
948struct wsm_join_cnf {
949 u32 status;
950
951 /* Minimum transmission power level in units of 0.1dBm */
952 u32 min_power_level;
953
954 /* Maximum transmission power level in units of 0.1dBm */
955 u32 max_power_level;
956};
957
958int wsm_join(struct cw1200_common *priv, struct wsm_join *arg);
959
960/* 3.24 */
961struct wsm_join_complete {
962 /* WSM_STATUS_... */
963 u32 status;
964};
965
966/* 3.25 */
967#define WSM_SET_PM_REQ_ID 0x0010
968#define WSM_SET_PM_RESP_ID 0x0410
969struct wsm_set_pm {
970 /* WSM_PSM_... */
971 u8 mode;
972
973 /* in unit of 500us; 0 to use default */
974 u8 fast_psm_idle_period;
975
976 /* in unit of 500us; 0 to use default */
977 u8 ap_psm_change_period;
978
979 /* in unit of 500us; 0 to disable auto-pspoll */
980 u8 min_auto_pspoll_period;
981};
982
983int wsm_set_pm(struct cw1200_common *priv, const struct wsm_set_pm *arg);
984
985/* 3.27 */
986struct wsm_set_pm_complete {
987 u8 psm; /* WSM_PSM_... */
988};
989
990/* 3.28 */
991#define WSM_SET_BSS_PARAMS_REQ_ID 0x0011
992#define WSM_SET_BSS_PARAMS_RESP_ID 0x0411
993struct wsm_set_bss_params {
994 /* This resets the beacon loss counters only */
995 u8 reset_beacon_loss;
996
997 /* The number of lost consecutive beacons after which */
998 /* the WLAN device should indicate the BSS-Lost event */
999 /* to the WLAN host driver. */
1000 u8 beacon_lost_count;
1001
1002 /* The AID received during the association process. */
1003 u16 aid;
1004
1005 /* The operational rate set mask */
1006 u32 operational_rate_set;
1007};
1008
1009int wsm_set_bss_params(struct cw1200_common *priv,
1010 const struct wsm_set_bss_params *arg);
1011
1012/* 3.30 */
1013#define WSM_ADD_KEY_REQ_ID 0x000C
1014#define WSM_ADD_KEY_RESP_ID 0x040C
1015struct wsm_add_key {
1016 u8 type; /* WSM_KEY_TYPE_... */
1017 u8 index; /* Key entry index: 0 -- WSM_KEY_MAX_INDEX */
1018 u16 reserved;
1019 union {
1020 struct {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001021 u8 peer[6]; /* MAC address of the peer station */
Solomon Peachya910e4a2013-05-24 20:04:38 -04001022 u8 reserved;
1023 u8 keylen; /* Key length in bytes */
1024 u8 keydata[16]; /* Key data */
1025 } __packed wep_pairwise;
1026 struct {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001027 u8 keyid; /* Unique per key identifier (0..3) */
Solomon Peachya910e4a2013-05-24 20:04:38 -04001028 u8 keylen; /* Key length in bytes */
1029 u16 reserved;
1030 u8 keydata[16]; /* Key data */
1031 } __packed wep_group;
1032 struct {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001033 u8 peer[6]; /* MAC address of the peer station */
Solomon Peachya910e4a2013-05-24 20:04:38 -04001034 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 {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001047 u8 peer[6]; /* MAC address of the peer station */
Solomon Peachya910e4a2013-05-24 20:04:38 -04001048 u16 reserved;
1049 u8 keydata[16]; /* AES key data */
1050 } __packed aes_pairwise;
1051 struct {
1052 u8 keydata[16]; /* AES key data */
1053 u8 keyid; /* Key ID */
1054 u8 reserved[3];
1055 u8 rx_seqnum[8]; /* Receive Sequence Counter */
1056 } __packed aes_group;
1057 struct {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001058 u8 peer[6]; /* MAC address of the peer station */
Solomon Peachya910e4a2013-05-24 20:04:38 -04001059 u8 keyid; /* Key ID */
1060 u8 reserved;
1061 u8 keydata[16]; /* WAPI key data */
1062 u8 mic_key[16]; /* MIC key data */
1063 } __packed wapi_pairwise;
1064 struct {
1065 u8 keydata[16]; /* WAPI key data */
1066 u8 mic_key[16]; /* MIC key data */
1067 u8 keyid; /* Key ID */
1068 u8 reserved[3];
1069 } __packed wapi_group;
1070 } __packed;
1071} __packed;
1072
1073int wsm_add_key(struct cw1200_common *priv, const struct wsm_add_key *arg);
1074
1075/* 3.32 */
1076#define WSM_REMOVE_KEY_REQ_ID 0x000D
1077#define WSM_REMOVE_KEY_RESP_ID 0x040D
1078struct wsm_remove_key {
1079 u8 index; /* Key entry index : 0-10 */
1080};
1081
1082int wsm_remove_key(struct cw1200_common *priv,
1083 const struct wsm_remove_key *arg);
1084
1085/* 3.34 */
1086struct wsm_set_tx_queue_params {
1087 /* WSM_ACK_POLICY_... */
1088 u8 ackPolicy;
1089
1090 /* Medium Time of TSPEC (in 32us units) allowed per */
1091 /* One Second Averaging Period for this queue. */
1092 u16 allowedMediumTime;
1093
1094 /* dot11MaxTransmitMsduLifetime to be used for the */
1095 /* specified queue. */
1096 u32 maxTransmitLifetime;
1097};
1098
1099struct wsm_tx_queue_params {
1100 /* NOTE: index is a linux queue id. */
1101 struct wsm_set_tx_queue_params params[4];
1102};
1103
1104
1105#define WSM_TX_QUEUE_SET(queue_params, queue, ack_policy, allowed_time,\
1106 max_life_time) \
1107do { \
1108 struct wsm_set_tx_queue_params *p = &(queue_params)->params[queue]; \
1109 p->ackPolicy = (ack_policy); \
1110 p->allowedMediumTime = (allowed_time); \
1111 p->maxTransmitLifetime = (max_life_time); \
1112} while (0)
1113
1114int wsm_set_tx_queue_params(struct cw1200_common *priv,
1115 const struct wsm_set_tx_queue_params *arg, u8 id);
1116
1117/* 3.36 */
1118#define WSM_EDCA_PARAMS_REQ_ID 0x0013
1119#define WSM_EDCA_PARAMS_RESP_ID 0x0413
1120struct wsm_edca_queue_params {
1121 /* CWmin (in slots) for the access class. */
1122 __le16 cwmin;
1123
1124 /* CWmax (in slots) for the access class. */
1125 __le16 cwmax;
1126
1127 /* AIFS (in slots) for the access class. */
1128 __le16 aifns;
1129
1130 /* TX OP Limit (in microseconds) for the access class. */
1131 __le16 txop_limit;
1132
1133 /* dot11MaxReceiveLifetime to be used for the specified */
1134 /* the access class. Overrides the global */
1135 /* dot11MaxReceiveLifetime value */
1136 __le32 max_rx_lifetime;
1137} __packed;
1138
1139struct wsm_edca_params {
1140 /* NOTE: index is a linux queue id. */
1141 struct wsm_edca_queue_params params[4];
1142 bool uapsd_enable[4];
1143};
1144
1145#define TXOP_UNIT 32
1146#define WSM_EDCA_SET(__edca, __queue, __aifs, __cw_min, __cw_max, __txop, __lifetime,\
1147 __uapsd) \
1148 do { \
1149 struct wsm_edca_queue_params *p = &(__edca)->params[__queue]; \
1150 p->cwmin = (__cw_min); \
1151 p->cwmax = (__cw_max); \
1152 p->aifns = (__aifs); \
1153 p->txop_limit = ((__txop) * TXOP_UNIT); \
1154 p->max_rx_lifetime = (__lifetime); \
1155 (__edca)->uapsd_enable[__queue] = (__uapsd); \
1156 } while (0)
1157
1158int wsm_set_edca_params(struct cw1200_common *priv,
1159 const struct wsm_edca_params *arg);
1160
1161int wsm_set_uapsd_param(struct cw1200_common *priv,
1162 const struct wsm_edca_params *arg);
1163
1164/* 3.38 */
1165/* Set-System info. Skipped for now. Irrelevent. */
1166
1167/* 3.40 */
1168#define WSM_SWITCH_CHANNEL_REQ_ID 0x0016
1169#define WSM_SWITCH_CHANNEL_RESP_ID 0x0416
1170
1171struct wsm_switch_channel {
1172 /* 1 - means the STA shall not transmit any further */
1173 /* frames until the channel switch has completed */
1174 u8 mode;
1175
1176 /* Number of TBTTs until channel switch occurs. */
1177 /* 0 - indicates switch shall occur at any time */
1178 /* 1 - occurs immediately before the next TBTT */
1179 u8 switch_count;
1180
1181 /* The new channel number to switch to. */
1182 /* Note this is defined as per section 2.7. */
1183 u16 channel_number;
1184};
1185
1186int wsm_switch_channel(struct cw1200_common *priv,
1187 const struct wsm_switch_channel *arg);
1188
1189typedef void (*wsm_channel_switch_cb) (struct cw1200_common *priv);
1190
1191#define WSM_START_REQ_ID 0x0017
1192#define WSM_START_RESP_ID 0x0417
1193
1194struct wsm_start {
1195 /* WSM_START_MODE_... */
1196 /* [in] */ u8 mode;
1197
1198 /* WSM_PHY_BAND_... */
1199 /* [in] */ u8 band;
1200
1201 /* Channel number */
1202 /* [in] */ u16 channel_number;
1203
1204 /* Client Traffic window in units of TU */
1205 /* Valid only when mode == ..._P2P */
1206 /* [in] */ u32 ct_window;
1207
1208 /* Interval between two consecutive */
1209 /* beacon transmissions in TU. */
1210 /* [in] */ u32 beacon_interval;
1211
1212 /* DTIM period in terms of beacon intervals */
1213 /* [in] */ u8 dtim_period;
1214
1215 /* WSM_JOIN_PREAMBLE_... */
1216 /* [in] */ u8 preamble;
1217
1218 /* The delay time (in microseconds) period */
1219 /* before sending a probe-request. */
1220 /* [in] */ u8 probe_delay;
1221
1222 /* Length of the SSID */
1223 /* [in] */ u8 ssid_len;
1224
1225 /* SSID of the BSS or P2P_GO to be started now. */
1226 /* [in] */ u8 ssid[32];
1227
1228 /* The basic supported rates for the MiniAP. */
1229 /* [in] */ u32 basic_rate_set;
1230};
1231
1232int wsm_start(struct cw1200_common *priv, const struct wsm_start *arg);
1233
1234#define WSM_BEACON_TRANSMIT_REQ_ID 0x0018
1235#define WSM_BEACON_TRANSMIT_RESP_ID 0x0418
1236
1237struct wsm_beacon_transmit {
1238 /* 1: enable; 0: disable */
1239 /* [in] */ u8 enable_beaconing;
1240};
1241
1242int wsm_beacon_transmit(struct cw1200_common *priv,
1243 const struct wsm_beacon_transmit *arg);
1244
1245int wsm_start_find(struct cw1200_common *priv);
1246
1247int wsm_stop_find(struct cw1200_common *priv);
1248
1249typedef void (*wsm_find_complete_cb) (struct cw1200_common *priv, u32 status);
1250
1251struct wsm_suspend_resume {
1252 /* See 3.52 */
1253 /* Link ID */
1254 /* [out] */ int link_id;
1255 /* Stop sending further Tx requests down to device for this link */
1256 /* [out] */ bool stop;
1257 /* Transmit multicast Frames */
1258 /* [out] */ bool multicast;
1259 /* The AC on which Tx to be suspended /resumed. */
1260 /* This is applicable only for U-APSD */
1261 /* WSM_QUEUE_... */
1262 /* [out] */ int queue;
1263};
1264
1265typedef void (*wsm_suspend_resume_cb) (struct cw1200_common *priv,
1266 struct wsm_suspend_resume *arg);
1267
1268/* 3.54 Update-IE request. */
1269struct wsm_update_ie {
1270 /* WSM_UPDATE_IE_... */
1271 /* [in] */ u16 what;
1272 /* [in] */ u16 count;
1273 /* [in] */ u8 *ies;
1274 /* [in] */ size_t length;
1275};
1276
1277int wsm_update_ie(struct cw1200_common *priv,
1278 const struct wsm_update_ie *arg);
1279
1280/* 3.56 */
1281struct wsm_map_link {
1282 /* MAC address of the remote device */
1283 /* [in] */ u8 mac_addr[6];
1284 /* [in] */ u8 link_id;
1285};
1286
1287int wsm_map_link(struct cw1200_common *priv, const struct wsm_map_link *arg);
1288
1289/* ******************************************************************** */
1290/* MIB shortcats */
1291
1292static inline int wsm_set_output_power(struct cw1200_common *priv,
1293 int power_level)
1294{
1295 __le32 val = __cpu_to_le32(power_level);
1296 return wsm_write_mib(priv, WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL,
1297 &val, sizeof(val));
1298}
1299
1300static inline int wsm_set_beacon_wakeup_period(struct cw1200_common *priv,
1301 unsigned dtim_interval,
1302 unsigned listen_interval)
1303{
1304 struct {
1305 u8 numBeaconPeriods;
1306 u8 reserved;
1307 __le16 listenInterval;
1308 } val = {
1309 dtim_interval, 0, __cpu_to_le16(listen_interval)
1310 };
1311
1312 if (dtim_interval > 0xFF || listen_interval > 0xFFFF)
1313 return -EINVAL;
1314 else
1315 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_WAKEUP_PERIOD,
1316 &val, sizeof(val));
1317}
1318
1319struct wsm_rcpi_rssi_threshold {
1320 u8 rssiRcpiMode; /* WSM_RCPI_RSSI_... */
1321 u8 lowerThreshold;
1322 u8 upperThreshold;
1323 u8 rollingAverageCount;
1324};
1325
1326static inline int wsm_set_rcpi_rssi_threshold(struct cw1200_common *priv,
1327 struct wsm_rcpi_rssi_threshold *arg)
1328{
1329 return wsm_write_mib(priv, WSM_MIB_ID_RCPI_RSSI_THRESHOLD, arg,
1330 sizeof(*arg));
1331}
1332
1333struct wsm_mib_counters_table {
1334 __le32 plcp_errors;
1335 __le32 fcs_errors;
1336 __le32 tx_packets;
1337 __le32 rx_packets;
1338 __le32 rx_packet_errors;
1339 __le32 rx_decryption_failures;
1340 __le32 rx_mic_failures;
1341 __le32 rx_no_key_failures;
1342 __le32 tx_multicast_frames;
1343 __le32 tx_frames_success;
1344 __le32 tx_frame_failures;
1345 __le32 tx_frames_retried;
1346 __le32 tx_frames_multi_retried;
1347 __le32 rx_frame_duplicates;
1348 __le32 rts_success;
1349 __le32 rts_failures;
1350 __le32 ack_failures;
1351 __le32 rx_multicast_frames;
1352 __le32 rx_frames_success;
1353 __le32 rx_cmac_icv_errors;
1354 __le32 rx_cmac_replays;
1355 __le32 rx_mgmt_ccmp_replays;
1356} __packed;
1357
1358static inline int wsm_get_counters_table(struct cw1200_common *priv,
1359 struct wsm_mib_counters_table *arg)
1360{
1361 return wsm_read_mib(priv, WSM_MIB_ID_COUNTERS_TABLE,
1362 arg, sizeof(*arg));
1363}
1364
1365static inline int wsm_get_station_id(struct cw1200_common *priv, u8 *mac)
1366{
1367 return wsm_read_mib(priv, WSM_MIB_ID_DOT11_STATION_ID, mac, ETH_ALEN);
1368}
1369
1370struct wsm_rx_filter {
1371 bool promiscuous;
1372 bool bssid;
1373 bool fcs;
1374 bool probeResponder;
1375};
1376
1377static inline int wsm_set_rx_filter(struct cw1200_common *priv,
1378 const struct wsm_rx_filter *arg)
1379{
1380 __le32 val = 0;
1381 if (arg->promiscuous)
1382 val |= __cpu_to_le32(BIT(0));
1383 if (arg->bssid)
1384 val |= __cpu_to_le32(BIT(1));
1385 if (arg->fcs)
1386 val |= __cpu_to_le32(BIT(2));
1387 if (arg->probeResponder)
1388 val |= __cpu_to_le32(BIT(3));
1389 return wsm_write_mib(priv, WSM_MIB_ID_RX_FILTER, &val, sizeof(val));
1390}
1391
1392int wsm_set_probe_responder(struct cw1200_common *priv, bool enable);
1393
1394#define WSM_BEACON_FILTER_IE_HAS_CHANGED BIT(0)
1395#define WSM_BEACON_FILTER_IE_NO_LONGER_PRESENT BIT(1)
1396#define WSM_BEACON_FILTER_IE_HAS_APPEARED BIT(2)
1397
1398struct wsm_beacon_filter_table_entry {
1399 u8 ie_id;
1400 u8 flags;
1401 u8 oui[3];
1402 u8 match_data[3];
1403} __packed;
1404
1405struct wsm_mib_beacon_filter_table {
1406 __le32 num;
1407 struct wsm_beacon_filter_table_entry entry[10];
1408} __packed;
1409
1410static inline int wsm_set_beacon_filter_table(struct cw1200_common *priv,
1411 struct wsm_mib_beacon_filter_table *ft)
1412{
1413 size_t size = __le32_to_cpu(ft->num) *
1414 sizeof(struct wsm_beacon_filter_table_entry) +
1415 sizeof(__le32);
1416
1417 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_TABLE, ft, size);
1418}
1419
1420#define WSM_BEACON_FILTER_ENABLE BIT(0) /* Enable/disable beacon filtering */
1421#define WSM_BEACON_FILTER_AUTO_ERP BIT(1) /* If 1 FW will handle ERP IE changes internally */
1422
1423struct wsm_beacon_filter_control {
1424 int enabled;
1425 int bcn_count;
1426};
1427
1428static inline int wsm_beacon_filter_control(struct cw1200_common *priv,
1429 struct wsm_beacon_filter_control *arg)
1430{
1431 struct {
1432 __le32 enabled;
1433 __le32 bcn_count;
1434 } val;
1435 val.enabled = __cpu_to_le32(arg->enabled);
1436 val.bcn_count = __cpu_to_le32(arg->bcn_count);
1437 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_ENABLE, &val,
1438 sizeof(val));
1439}
1440
1441enum wsm_power_mode {
1442 wsm_power_mode_active = 0,
1443 wsm_power_mode_doze = 1,
1444 wsm_power_mode_quiescent = 2,
1445};
1446
1447struct wsm_operational_mode {
1448 enum wsm_power_mode power_mode;
1449 int disable_more_flag_usage;
1450 int perform_ant_diversity;
1451};
1452
1453static inline int wsm_set_operational_mode(struct cw1200_common *priv,
1454 const struct wsm_operational_mode *arg)
1455{
1456 u8 val = arg->power_mode;
1457 if (arg->disable_more_flag_usage)
1458 val |= BIT(4);
1459 if (arg->perform_ant_diversity)
1460 val |= BIT(5);
1461 return wsm_write_mib(priv, WSM_MIB_ID_OPERATIONAL_POWER_MODE, &val,
1462 sizeof(val));
1463}
1464
1465struct wsm_template_frame {
1466 u8 frame_type;
1467 u8 rate;
1468 struct sk_buff *skb;
1469};
1470
1471static inline int wsm_set_template_frame(struct cw1200_common *priv,
1472 struct wsm_template_frame *arg)
1473{
1474 int ret;
1475 u8 *p = skb_push(arg->skb, 4);
1476 p[0] = arg->frame_type;
1477 p[1] = arg->rate;
1478 ((u16 *)p)[1] = __cpu_to_le16(arg->skb->len - 4);
1479 ret = wsm_write_mib(priv, WSM_MIB_ID_TEMPLATE_FRAME, p, arg->skb->len);
1480 skb_pull(arg->skb, 4);
1481 return ret;
1482}
1483
1484
1485struct wsm_protected_mgmt_policy {
1486 bool protectedMgmtEnable;
1487 bool unprotectedMgmtFramesAllowed;
1488 bool encryptionForAuthFrame;
1489};
1490
1491static inline int wsm_set_protected_mgmt_policy(struct cw1200_common *priv,
1492 struct wsm_protected_mgmt_policy *arg)
1493{
1494 __le32 val = 0;
1495 int ret;
1496 if (arg->protectedMgmtEnable)
1497 val |= __cpu_to_le32(BIT(0));
1498 if (arg->unprotectedMgmtFramesAllowed)
1499 val |= __cpu_to_le32(BIT(1));
1500 if (arg->encryptionForAuthFrame)
1501 val |= __cpu_to_le32(BIT(2));
1502 ret = wsm_write_mib(priv, WSM_MIB_ID_PROTECTED_MGMT_POLICY,
1503 &val, sizeof(val));
1504 return ret;
1505}
1506
1507struct wsm_mib_block_ack_policy {
1508 u8 tx_tid;
1509 u8 reserved1;
1510 u8 rx_tid;
1511 u8 reserved2;
1512} __packed;
1513
1514static inline int wsm_set_block_ack_policy(struct cw1200_common *priv,
1515 u8 tx_tid_policy,
1516 u8 rx_tid_policy)
1517{
1518 struct wsm_mib_block_ack_policy val = {
1519 .tx_tid = tx_tid_policy,
1520 .rx_tid = rx_tid_policy,
1521 };
1522 return wsm_write_mib(priv, WSM_MIB_ID_BLOCK_ACK_POLICY, &val,
1523 sizeof(val));
1524}
1525
1526struct wsm_mib_association_mode {
1527 u8 flags; /* WSM_ASSOCIATION_MODE_... */
1528 u8 preamble; /* WSM_JOIN_PREAMBLE_... */
1529 u8 greenfield; /* 1 for greenfield */
1530 u8 mpdu_start_spacing;
1531 __le32 basic_rate_set;
1532} __packed;
1533
1534static inline int wsm_set_association_mode(struct cw1200_common *priv,
1535 struct wsm_mib_association_mode *arg)
1536{
1537 return wsm_write_mib(priv, WSM_MIB_ID_SET_ASSOCIATION_MODE, arg,
1538 sizeof(*arg));
1539}
1540
1541#define WSM_TX_RATE_POLICY_FLAG_TERMINATE_WHEN_FINISHED BIT(2)
1542#define WSM_TX_RATE_POLICY_FLAG_COUNT_INITIAL_TRANSMIT BIT(3)
1543struct wsm_tx_rate_retry_policy {
1544 u8 index;
1545 u8 short_retries;
1546 u8 long_retries;
1547 /* BIT(2) - Terminate retries when Tx rate retry policy
1548 * finishes.
1549 * BIT(3) - Count initial frame transmission as part of
1550 * rate retry counting but not as a retry
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001551 * attempt
1552 */
Solomon Peachya910e4a2013-05-24 20:04:38 -04001553 u8 flags;
1554 u8 rate_recoveries;
1555 u8 reserved[3];
1556 __le32 rate_count_indices[3];
1557} __packed;
1558
1559struct wsm_set_tx_rate_retry_policy {
1560 u8 num;
1561 u8 reserved[3];
1562 struct wsm_tx_rate_retry_policy tbl[8];
1563} __packed;
1564
1565static inline int wsm_set_tx_rate_retry_policy(struct cw1200_common *priv,
1566 struct wsm_set_tx_rate_retry_policy *arg)
1567{
1568 size_t size = 4 + arg->num * sizeof(struct wsm_tx_rate_retry_policy);
1569 return wsm_write_mib(priv, WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg,
1570 size);
1571}
1572
1573/* 4.32 SetEtherTypeDataFrameFilter */
1574struct wsm_ether_type_filter_hdr {
1575 u8 num; /* Up to WSM_MAX_FILTER_ELEMENTS */
1576 u8 reserved[3];
1577} __packed;
1578
1579struct wsm_ether_type_filter {
1580 u8 action; /* WSM_FILTER_ACTION_XXX */
1581 u8 reserved;
1582 __le16 type; /* Type of ethernet frame */
1583} __packed;
1584
1585static inline int wsm_set_ether_type_filter(struct cw1200_common *priv,
1586 struct wsm_ether_type_filter_hdr *arg)
1587{
1588 size_t size = sizeof(struct wsm_ether_type_filter_hdr) +
1589 arg->num * sizeof(struct wsm_ether_type_filter);
1590 return wsm_write_mib(priv, WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER,
1591 arg, size);
1592}
1593
1594/* 4.33 SetUDPPortDataFrameFilter */
1595struct wsm_udp_port_filter_hdr {
1596 u8 num; /* Up to WSM_MAX_FILTER_ELEMENTS */
1597 u8 reserved[3];
1598} __packed;
1599
1600struct wsm_udp_port_filter {
1601 u8 action; /* WSM_FILTER_ACTION_XXX */
1602 u8 type; /* WSM_FILTER_PORT_TYPE_XXX */
1603 __le16 port; /* Port number */
1604} __packed;
1605
1606static inline int wsm_set_udp_port_filter(struct cw1200_common *priv,
1607 struct wsm_udp_port_filter_hdr *arg)
1608{
1609 size_t size = sizeof(struct wsm_udp_port_filter_hdr) +
1610 arg->num * sizeof(struct wsm_udp_port_filter);
1611 return wsm_write_mib(priv, WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER,
1612 arg, size);
1613}
1614
1615/* Undocumented MIBs: */
1616/* 4.35 P2PDeviceInfo */
1617#define D11_MAX_SSID_LEN (32)
1618
1619struct wsm_p2p_device_type {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001620 __le16 category_id;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001621 u8 oui[4];
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001622 __le16 subcategory_id;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001623} __packed;
1624
1625struct wsm_p2p_device_info {
1626 struct wsm_p2p_device_type primaryDevice;
1627 u8 reserved1[3];
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001628 u8 devname_size;
1629 u8 local_devname[D11_MAX_SSID_LEN];
Solomon Peachya910e4a2013-05-24 20:04:38 -04001630 u8 reserved2[3];
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001631 u8 num_secdev_supported;
1632 struct wsm_p2p_device_type secdevs[0];
Solomon Peachya910e4a2013-05-24 20:04:38 -04001633} __packed;
1634
1635/* 4.36 SetWCDMABand - WO */
1636struct wsm_cdma_band {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001637 u8 wcdma_band;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001638 u8 reserved[3];
1639} __packed;
1640
1641/* 4.37 GroupTxSequenceCounter - RO */
1642struct wsm_group_tx_seq {
1643 __le32 bits_47_16;
1644 __le16 bits_15_00;
1645 __le16 reserved;
1646} __packed;
1647
1648/* 4.39 SetHtProtection - WO */
1649#define WSM_DUAL_CTS_PROT_ENB (1 << 0)
1650#define WSM_NON_GREENFIELD_STA_PRESENT (1 << 1)
1651#define WSM_HT_PROT_MODE__NO_PROT (0 << 2)
1652#define WSM_HT_PROT_MODE__NON_MEMBER (1 << 2)
1653#define WSM_HT_PROT_MODE__20_MHZ (2 << 2)
1654#define WSM_HT_PROT_MODE__NON_HT_MIXED (3 << 2)
1655#define WSM_LSIG_TXOP_PROT_FULL (1 << 4)
1656#define WSM_LARGE_L_LENGTH_PROT (1 << 5)
1657
1658struct wsm_ht_protection {
1659 __le32 flags;
1660} __packed;
1661
1662/* 4.40 GPIO Command - R/W */
1663#define WSM_GPIO_COMMAND_SETUP 0
1664#define WSM_GPIO_COMMAND_READ 1
1665#define WSM_GPIO_COMMAND_WRITE 2
1666#define WSM_GPIO_COMMAND_RESET 3
1667#define WSM_GPIO_ALL_PINS 0xFF
1668
1669struct wsm_gpio_command {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001670 u8 command;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001671 u8 pin;
1672 __le16 config;
1673} __packed;
1674
1675/* 4.41 TSFCounter - RO */
1676struct wsm_tsf_counter {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001677 __le64 tsf_counter;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001678} __packed;
1679
1680/* 4.43 Keep alive period */
1681struct wsm_keep_alive_period {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001682 __le16 period;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001683 u8 reserved[2];
1684} __packed;
1685
1686static inline int wsm_keep_alive_period(struct cw1200_common *priv,
1687 int period)
1688{
1689 struct wsm_keep_alive_period arg = {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001690 .period = __cpu_to_le16(period),
Solomon Peachya910e4a2013-05-24 20:04:38 -04001691 };
1692 return wsm_write_mib(priv, WSM_MIB_ID_KEEP_ALIVE_PERIOD,
1693 &arg, sizeof(arg));
1694};
1695
1696/* BSSID filtering */
1697struct wsm_set_bssid_filtering {
1698 u8 filter;
1699 u8 reserved[3];
1700} __packed;
1701
1702static inline int wsm_set_bssid_filtering(struct cw1200_common *priv,
1703 bool enabled)
1704{
1705 struct wsm_set_bssid_filtering arg = {
1706 .filter = !enabled,
1707 };
1708 return wsm_write_mib(priv, WSM_MIB_ID_DISABLE_BSSID_FILTER,
1709 &arg, sizeof(arg));
1710}
1711
1712/* Multicast filtering - 4.5 */
1713struct wsm_mib_multicast_filter {
1714 __le32 enable;
1715 __le32 num_addrs;
1716 u8 macaddrs[WSM_MAX_GRP_ADDRTABLE_ENTRIES][ETH_ALEN];
1717} __packed;
1718
1719static inline int wsm_set_multicast_filter(struct cw1200_common *priv,
1720 struct wsm_mib_multicast_filter *fp)
1721{
1722 return wsm_write_mib(priv, WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE,
1723 fp, sizeof(*fp));
1724}
1725
1726/* ARP IPv4 filtering - 4.10 */
1727struct wsm_mib_arp_ipv4_filter {
1728 __le32 enable;
1729 __be32 ipv4addrs[WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES];
1730} __packed;
1731
1732static inline int wsm_set_arp_ipv4_filter(struct cw1200_common *priv,
1733 struct wsm_mib_arp_ipv4_filter *fp)
1734{
1735 return wsm_write_mib(priv, WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE,
1736 fp, sizeof(*fp));
1737}
1738
1739/* P2P Power Save Mode Info - 4.31 */
1740struct wsm_p2p_ps_modeinfo {
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001741 u8 opp_ps_ct_window;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001742 u8 count;
1743 u8 reserved;
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001744 u8 dtim_count;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001745 __le32 duration;
1746 __le32 interval;
Solomon Peachy8b3e7be2013-06-11 09:49:40 -04001747 __le32 start_time;
Solomon Peachya910e4a2013-05-24 20:04:38 -04001748} __packed;
1749
1750static inline int wsm_set_p2p_ps_modeinfo(struct cw1200_common *priv,
1751 struct wsm_p2p_ps_modeinfo *mi)
1752{
1753 return wsm_write_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
1754 mi, sizeof(*mi));
1755}
1756
1757static inline int wsm_get_p2p_ps_modeinfo(struct cw1200_common *priv,
1758 struct wsm_p2p_ps_modeinfo *mi)
1759{
1760 return wsm_read_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
1761 mi, sizeof(*mi));
1762}
1763
1764/* UseMultiTxConfMessage */
1765
1766static inline int wsm_use_multi_tx_conf(struct cw1200_common *priv,
1767 bool enabled)
1768{
1769 __le32 arg = enabled ? __cpu_to_le32(1) : 0;
1770
1771 return wsm_write_mib(priv, WSM_MIB_USE_MULTI_TX_CONF,
1772 &arg, sizeof(arg));
1773}
1774
1775
1776/* 4.26 SetUpasdInformation */
1777struct wsm_uapsd_info {
1778 __le16 uapsd_flags;
1779 __le16 min_auto_trigger_interval;
1780 __le16 max_auto_trigger_interval;
1781 __le16 auto_trigger_step;
1782};
1783
1784static inline int wsm_set_uapsd_info(struct cw1200_common *priv,
1785 struct wsm_uapsd_info *arg)
1786{
1787 return wsm_write_mib(priv, WSM_MIB_ID_SET_UAPSD_INFORMATION,
1788 arg, sizeof(*arg));
1789}
1790
1791/* 4.22 OverrideInternalTxRate */
1792struct wsm_override_internal_txrate {
1793 u8 internalTxRate;
1794 u8 nonErpInternalTxRate;
1795 u8 reserved[2];
1796} __packed;
1797
1798static inline int wsm_set_override_internal_txrate(struct cw1200_common *priv,
1799 struct wsm_override_internal_txrate *arg)
1800{
1801 return wsm_write_mib(priv, WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE,
1802 arg, sizeof(*arg));
1803}
1804
1805/* ******************************************************************** */
1806/* WSM TX port control */
1807
1808void wsm_lock_tx(struct cw1200_common *priv);
1809void wsm_lock_tx_async(struct cw1200_common *priv);
1810bool wsm_flush_tx(struct cw1200_common *priv);
1811void wsm_unlock_tx(struct cw1200_common *priv);
1812
1813/* ******************************************************************** */
1814/* WSM / BH API */
1815
1816int wsm_handle_exception(struct cw1200_common *priv, u8 *data, size_t len);
1817int wsm_handle_rx(struct cw1200_common *priv, u16 id, struct wsm_hdr *wsm,
1818 struct sk_buff **skb_p);
1819
1820/* ******************************************************************** */
1821/* wsm_buf API */
1822
1823struct wsm_buf {
1824 u8 *begin;
1825 u8 *data;
1826 u8 *end;
1827};
1828
1829void wsm_buf_init(struct wsm_buf *buf);
1830void wsm_buf_deinit(struct wsm_buf *buf);
1831
1832/* ******************************************************************** */
1833/* wsm_cmd API */
1834
1835struct wsm_cmd {
1836 spinlock_t lock; /* Protect structure from multiple access */
1837 int done;
1838 u8 *ptr;
1839 size_t len;
1840 void *arg;
1841 int ret;
1842 u16 cmd;
1843};
1844
1845/* ******************************************************************** */
1846/* WSM TX buffer access */
1847
1848int wsm_get_tx(struct cw1200_common *priv, u8 **data,
1849 size_t *tx_len, int *burst);
1850void wsm_txed(struct cw1200_common *priv, u8 *data);
1851
1852/* ******************************************************************** */
1853/* Queue mapping: WSM <---> linux */
1854/* Linux: VO VI BE BK */
1855/* WSM: BE BK VI VO */
1856
1857static inline u8 wsm_queue_id_to_linux(u8 queue_id)
1858{
1859 static const u8 queue_mapping[] = {
1860 2, 3, 1, 0
1861 };
1862 return queue_mapping[queue_id];
1863}
1864
1865static inline u8 wsm_queue_id_to_wsm(u8 queue_id)
1866{
1867 static const u8 queue_mapping[] = {
1868 3, 2, 0, 1
1869 };
1870 return queue_mapping[queue_id];
1871}
1872
Solomon Peachya910e4a2013-05-24 20:04:38 -04001873#endif /* CW1200_HWIO_H_INCLUDED */