1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef CW1200_WSM_H_INCLUDED
14#define CW1200_WSM_H_INCLUDED
15
16#include <linux/spinlock.h>
17
18struct cw1200_common;
19
20
21
22#define WSM_PHY_BAND_2_4G (0)
23
24
25#define WSM_PHY_BAND_5G (1)
26
27
28
29#define WSM_TRANSMIT_RATE_1 (0)
30
31
32#define WSM_TRANSMIT_RATE_2 (1)
33
34
35#define WSM_TRANSMIT_RATE_5 (2)
36
37
38#define WSM_TRANSMIT_RATE_11 (3)
39
40
41
42
43
44
45
46
47#define WSM_TRANSMIT_RATE_6 (6)
48
49
50#define WSM_TRANSMIT_RATE_9 (7)
51
52
53#define WSM_TRANSMIT_RATE_12 (8)
54
55
56#define WSM_TRANSMIT_RATE_18 (9)
57
58
59#define WSM_TRANSMIT_RATE_24 (10)
60
61
62#define WSM_TRANSMIT_RATE_36 (11)
63
64
65#define WSM_TRANSMIT_RATE_48 (12)
66
67
68#define WSM_TRANSMIT_RATE_54 (13)
69
70
71#define WSM_TRANSMIT_RATE_HT_6 (14)
72
73
74#define WSM_TRANSMIT_RATE_HT_13 (15)
75
76
77#define WSM_TRANSMIT_RATE_HT_19 (16)
78
79
80#define WSM_TRANSMIT_RATE_HT_26 (17)
81
82
83#define WSM_TRANSMIT_RATE_HT_39 (18)
84
85
86#define WSM_TRANSMIT_RATE_HT_52 (19)
87
88
89#define WSM_TRANSMIT_RATE_HT_58 (20)
90
91
92#define WSM_TRANSMIT_RATE_HT_65 (21)
93
94
95
96#define WSM_SCAN_TYPE_FOREGROUND (0)
97
98
99#define WSM_SCAN_TYPE_BACKGROUND (1)
100
101
102#define WSM_SCAN_TYPE_AUTO (2)
103
104
105
106
107
108
109#define WSM_SCAN_FLAG_FORCE_BACKGROUND (BIT(0))
110
111
112
113#define WSM_SCAN_FLAG_SPLIT_METHOD (BIT(1))
114
115
116#define WSM_SCAN_FLAG_SHORT_PREAMBLE (BIT(2))
117
118
119#define WSM_SCAN_FLAG_11N_GREENFIELD (BIT(3))
120
121
122
123#define WSM_SCAN_MAX_NUM_OF_CHANNELS (48)
124
125
126#define WSM_SCAN_MAX_NUM_OF_SSIDS (2)
127
128
129
130#define WSM_PSM_ACTIVE (0)
131
132
133#define WSM_PSM_PS BIT(0)
134
135
136#define WSM_PSM_FAST_PS_FLAG BIT(7)
137
138
139#define WSM_PSM_FAST_PS (BIT(0) | BIT(7))
140
141
142
143
144
145#define WSM_PSM_UNKNOWN BIT(1)
146
147
148
149#define WSM_QUEUE_BEST_EFFORT (0)
150
151
152#define WSM_QUEUE_BACKGROUND (1)
153
154
155#define WSM_QUEUE_VIDEO (2)
156
157
158#define WSM_QUEUE_VOICE (3)
159
160
161
162#define WSM_HT_TX_NON_HT (0)
163
164
165#define WSM_HT_TX_MIXED (1)
166
167
168#define WSM_HT_TX_GREENFIELD (2)
169
170
171#define WSM_HT_TX_STBC (BIT(7))
172
173
174
175#define WSM_EPTA_PRIORITY_DEFAULT 4
176
177#define WSM_EPTA_PRIORITY_DATA 4
178
179#define WSM_EPTA_PRIORITY_MGT 5
180
181#define WSM_EPTA_PRIORITY_ACTION 5
182
183#define WSM_EPTA_PRIORITY_VIDEO 5
184
185#define WSM_EPTA_PRIORITY_VOICE 6
186
187#define WSM_EPTA_PRIORITY_EAPOL 7
188
189
190
191
192#define WSM_TX_STATUS_AGGREGATION (BIT(0))
193
194
195
196#define WSM_TX_STATUS_REQUEUE (BIT(1))
197
198
199#define WSM_TX_STATUS_NORMAL_ACK (0<<2)
200
201
202#define WSM_TX_STATUS_NO_ACK (1<<2)
203
204
205#define WSM_TX_STATUS_NO_EXPLICIT_ACK (2<<2)
206
207
208
209#define WSM_TX_STATUS_BLOCK_ACK (3<<2)
210
211
212
213#define WSM_RX_STATUS_UNENCRYPTED (0<<0)
214
215
216#define WSM_RX_STATUS_WEP (1<<0)
217
218
219#define WSM_RX_STATUS_TKIP (2<<0)
220
221
222#define WSM_RX_STATUS_AES (3<<0)
223
224
225#define WSM_RX_STATUS_WAPI (4<<0)
226
227
228#define WSM_RX_STATUS_ENCRYPTION(status) ((status) & 0x07)
229
230
231#define WSM_RX_STATUS_AGGREGATE (BIT(3))
232
233
234#define WSM_RX_STATUS_AGGREGATE_FIRST (BIT(4))
235
236
237#define WSM_RX_STATUS_AGGREGATE_LAST (BIT(5))
238
239
240#define WSM_RX_STATUS_DEFRAGMENTED (BIT(6))
241
242
243#define WSM_RX_STATUS_BEACON (BIT(7))
244
245
246#define WSM_RX_STATUS_TIM (BIT(8))
247
248
249#define WSM_RX_STATUS_MULTICAST (BIT(9))
250
251
252#define WSM_RX_STATUS_MATCHING_SSID (BIT(10))
253
254
255#define WSM_RX_STATUS_MATCHING_BSSI (BIT(11))
256
257
258#define WSM_RX_STATUS_MORE_DATA (BIT(12))
259
260
261#define WSM_RX_STATUS_MEASUREMENT (BIT(13))
262
263
264#define WSM_RX_STATUS_HT (BIT(14))
265
266
267#define WSM_RX_STATUS_STBC (BIT(15))
268
269
270#define WSM_RX_STATUS_ADDRESS1 (BIT(16))
271
272
273#define WSM_RX_STATUS_GROUP (BIT(17))
274
275
276#define WSM_RX_STATUS_BROADCAST (BIT(18))
277
278
279#define WSM_RX_STATUS_GROUP_KEY (BIT(19))
280
281
282#define WSM_RX_STATUS_KEY_IDX(status) (((status >> 20)) & 0x0F)
283
284
285#define WSM_RX_STATUS_TSF_INCLUDED (BIT(24))
286
287
288#define WSM_TX_2BYTES_SHIFT (BIT(7))
289
290
291
292#define WSM_JOIN_MODE_IBSS (0)
293
294
295#define WSM_JOIN_MODE_BSS (1)
296
297
298
299#define WSM_JOIN_PREAMBLE_LONG (0)
300
301
302#define WSM_JOIN_PREAMBLE_SHORT (1)
303
304
305#define WSM_JOIN_PREAMBLE_SHORT_2 (2)
306
307
308
309#define WSM_JOIN_FLAGS_UNSYNCRONIZED BIT(0)
310
311#define WSM_JOIN_FLAGS_P2P_GO BIT(1)
312
313
314
315
316#define WSM_JOIN_FLAGS_FORCE BIT(2)
317
318
319
320#define WSM_JOIN_FLAGS_PRIO BIT(3)
321
322
323
324#define WSM_JOIN_FLAGS_FORCE_WITH_COMPLETE_IND BIT(5)
325
326
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
337#define WSM_KEY_MAX_INDEX (10)
338
339
340#define WSM_ACK_POLICY_NORMAL (0)
341#define WSM_ACK_POLICY_NO_ACK (1)
342
343
344#define WSM_START_MODE_AP (0)
345#define WSM_START_MODE_P2P_GO (1)
346#define WSM_START_MODE_P2P_DEV (2)
347
348
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
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
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
367
368#define WSM_EVENT_ERROR (0)
369
370
371#define WSM_EVENT_BSS_LOST (1)
372
373
374#define WSM_EVENT_BSS_REGAINED (2)
375
376
377#define WSM_EVENT_RADAR_DETECTED (3)
378
379
380#define WSM_EVENT_RCPI_RSSI (4)
381
382
383#define WSM_EVENT_BT_INACTIVE (5)
384
385
386#define WSM_EVENT_BT_ACTIVE (6)
387
388
389
390#define WSM_MIB_ID_DOT11_STATION_ID 0x0000
391
392
393#define WSM_MIB_ID_DOT11_MAX_TRANSMIT_LIFTIME 0x0001
394
395
396#define WSM_MIB_ID_DOT11_MAX_RECEIVE_LIFETIME 0x0002
397
398
399#define WSM_MIB_ID_DOT11_SLOT_TIME 0x0003
400
401
402#define WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE 0x0004
403#define WSM_MAX_GRP_ADDRTABLE_ENTRIES 8
404
405
406#define WSM_MIB_ID_DOT11_WEP_DEFAULT_KEY_ID 0x0005
407
408
409#define WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL 0x0006
410
411
412#define WSM_MIB_ID_DOT11_RTS_THRESHOLD 0x0007
413
414
415#define WSM_MIB_ID_NON_ERP_PROTECTION 0x1000
416
417
418#define WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE 0x1001
419#define WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES 1
420
421
422#define WSM_MIB_ID_TEMPLATE_FRAME 0x1002
423
424
425#define WSM_MIB_ID_RX_FILTER 0x1003
426
427
428#define WSM_MIB_ID_BEACON_FILTER_TABLE 0x1004
429
430
431#define WSM_MIB_ID_BEACON_FILTER_ENABLE 0x1005
432
433
434#define WSM_MIB_ID_OPERATIONAL_POWER_MODE 0x1006
435
436
437#define WSM_MIB_ID_BEACON_WAKEUP_PERIOD 0x1007
438
439
440#define WSM_MIB_ID_RCPI_RSSI_THRESHOLD 0x1009
441
442
443#define WSM_MIB_ID_STATISTICS_TABLE 0x100A
444
445
446#define WSM_MIB_ID_IBSS_PS_CONFIG 0x100B
447
448
449#define WSM_MIB_ID_COUNTERS_TABLE 0x100C
450
451
452#define WSM_MIB_ID_BLOCK_ACK_POLICY 0x100E
453
454
455#define WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE 0x100F
456
457
458#define WSM_MIB_ID_SET_ASSOCIATION_MODE 0x1010
459
460
461#define WSM_MIB_ID_UPDATE_EPTA_CONFIG_DATA 0x1011
462
463
464#define WSM_MIB_ID_SELECT_CCA_METHOD 0x1012
465
466
467#define WSM_MIB_ID_SET_UAPSD_INFORMATION 0x1013
468
469
470#define WSM_MIB_ID_SET_AUTO_CALIBRATION_MODE 0x1015
471
472
473#define WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY 0x1016
474
475
476#define WSM_MIB_ID_SET_HOST_MSG_TYPE_FILTER 0x1017
477
478
479#define WSM_MIB_ID_P2P_FIND_INFO 0x1018
480
481
482#define WSM_MIB_ID_P2P_PS_MODE_INFO 0x1019
483
484
485#define WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER 0x101A
486
487
488#define WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER 0x101B
489
490
491#define WSM_MIB_ID_SET_MAGIC_DATAFRAME_FILTER 0x101C
492
493
494#define WSM_MIB_ID_P2P_DEVICE_INFO 0x101D
495
496
497#define WSM_MIB_ID_SET_WCDMA_BAND 0x101E
498
499
500#define WSM_MIB_ID_GRP_SEQ_COUNTER 0x101F
501
502
503#define WSM_MIB_ID_PROTECTED_MGMT_POLICY 0x1020
504
505
506#define WSM_MIB_ID_SET_HT_PROTECTION 0x1021
507
508
509#define WSM_MIB_ID_GPIO_COMMAND 0x1022
510
511
512#define WSM_MIB_ID_TSF_COUNTER 0x1023
513
514
515#define WSM_MIB_ID_BLOCK_ACK_INFO 0x100D
516
517
518#define WSM_MIB_USE_MULTI_TX_CONF 0x1024
519
520
521#define WSM_MIB_ID_KEEP_ALIVE_PERIOD 0x1025
522
523
524#define WSM_MIB_ID_DISABLE_BSSID_FILTER 0x1026
525
526
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)
535
536
537
538
539#define WSM_STATUS_SUCCESS (0)
540
541
542
543#define WSM_STATUS_FAILURE (1)
544
545
546#define WSM_INVALID_PARAMETER (2)
547
548
549
550#define WSM_ACCESS_DENIED (3)
551
552
553#define WSM_STATUS_DECRYPTFAILURE (4)
554
555
556#define WSM_STATUS_MICFAILURE (5)
557
558
559
560#define WSM_STATUS_RETRY_EXCEEDED (6)
561
562
563
564#define WSM_STATUS_TX_LIFETIME_EXCEEDED (7)
565
566
567#define WSM_STATUS_LINK_LOST (8)
568
569
570#define WSM_STATUS_NO_KEY_FOUND (9)
571
572
573#define WSM_STATUS_JAMMER_DETECTED (10)
574
575
576
577#define WSM_REQUEUE (11)
578
579
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
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
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
628
629
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 u32 dot11MaxTransmitMsduLifeTime;
641 u32 dot11MaxReceiveLifeTime;
642 u32 dot11RtsThreshold;
643 u8 *dot11StationId;
644 const void *dpdData;
645 size_t dpdData_size;
646 u8 dot11FrequencyBandsSupported;
647 u32 supportedRateMask;
648 struct wsm_tx_power_range txPowerRange[2];
649};
650
651int wsm_configuration(struct cw1200_common *priv,
652 struct wsm_configuration *arg);
653
654
655#define WSM_RESET_REQ_ID 0x000A
656#define WSM_RESET_RESP_ID 0x040A
657struct wsm_reset {
658 int link_id;
659 bool reset_statistics;
660};
661
662int wsm_reset(struct cw1200_common *priv, const struct wsm_reset *arg);
663
664
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
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
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
694 u8 band;
695
696
697 u8 type;
698
699
700 u8 flags;
701
702
703 u8 max_tx_rate;
704
705
706
707
708 u32 auto_scan_interval;
709
710
711
712
713
714
715 u32 num_probes;
716
717
718
719 u8 num_channels;
720
721
722
723
724 u8 num_ssids;
725
726
727
728 u8 probe_delay;
729
730
731 struct wsm_ssid *ssids;
732
733
734 struct wsm_scan_ch *ch;
735};
736
737int wsm_scan(struct cw1200_common *priv, const struct wsm_scan *arg);
738
739
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
745#define WSM_SCAN_COMPLETE_IND_ID 0x0806
746struct wsm_scan_complete {
747
748 u32 status;
749
750
751 u8 psm;
752
753
754 u8 num_channels;
755};
756
757
758#define WSM_TX_CONFIRM_IND_ID 0x0404
759#define WSM_MULTI_TX_CONFIRM_ID 0x041E
760
761struct wsm_tx_confirm {
762
763 u32 packet_id;
764
765
766 u32 status;
767
768
769 u8 tx_rate;
770
771
772
773 u8 ack_failures;
774
775
776 u16 flags;
777
778
779
780 u32 media_delay;
781
782
783
784 u32 tx_queue_delay;
785};
786
787
788typedef void (*wsm_tx_confirm_cb) (struct cw1200_common *priv,
789 struct wsm_tx_confirm *arg);
790
791
792
793
794
795
796
797
798
799
800
801struct wsm_tx {
802
803 struct wsm_hdr hdr;
804
805
806 u32 packet_id;
807
808
809 u8 max_tx_rate;
810
811
812 u8 queue_id;
813
814
815 u8 more;
816
817
818
819
820
821
822 u8 flags;
823
824
825 u32 reserved;
826
827
828
829
830
831
832 __le32 expire_time;
833
834
835 __le32 ht_tx_parameters;
836} __packed;
837
838
839#define WSM_TX_EXTRA_HEADROOM (28)
840
841
842#define WSM_RECEIVE_IND_ID 0x0804
843
844struct wsm_rx {
845
846 u32 status;
847
848
849 u16 channel_number;
850
851
852 u8 rx_rate;
853
854
855
856 u8 rcpi_rssi;
857
858
859 u32 flags;
860};
861
862
863#define WSM_RX_EXTRA_HEADROOM (16)
864
865typedef void (*wsm_rx_cb) (struct cw1200_common *priv, struct wsm_rx *arg,
866 struct sk_buff **skb_p);
867
868
869struct wsm_event {
870
871 u32 id;
872
873
874
875
876
877 u32 data;
878};
879
880struct cw1200_wsm_event {
881 struct list_head link;
882 struct wsm_event evt;
883};
884
885
886
887
888typedef void (*wsm_event_cb) (struct cw1200_common *priv,
889 struct wsm_event *arg);
890
891
892#define WSM_JOIN_REQ_ID 0x000B
893#define WSM_JOIN_RESP_ID 0x040B
894
895struct wsm_join {
896
897 u8 mode;
898
899
900 u8 band;
901
902
903
904
905 u16 channel_number;
906
907
908
909 u8 bssid[6];
910
911
912
913
914 u16 atim_window;
915
916
917 u8 preamble_type;
918
919
920
921 u8 probe_for_join;
922
923
924 u8 dtim_period;
925
926
927 u8 flags;
928
929
930 u32 ssid_len;
931
932
933 u8 ssid[32];
934
935
936 u32 beacon_interval;
937
938
939 u32 basic_rate_set;
940};
941
942struct wsm_join_cnf {
943 u32 status;
944
945
946 u32 min_power_level;
947
948
949 u32 max_power_level;
950};
951
952int wsm_join(struct cw1200_common *priv, struct wsm_join *arg);
953
954
955struct wsm_join_complete {
956
957 u32 status;
958};
959
960
961#define WSM_SET_PM_REQ_ID 0x0010
962#define WSM_SET_PM_RESP_ID 0x0410
963struct wsm_set_pm {
964
965 u8 mode;
966
967
968 u8 fast_psm_idle_period;
969
970
971 u8 ap_psm_change_period;
972
973
974 u8 min_auto_pspoll_period;
975};
976
977int wsm_set_pm(struct cw1200_common *priv, const struct wsm_set_pm *arg);
978
979
980struct wsm_set_pm_complete {
981 u8 psm;
982};
983
984
985#define WSM_SET_BSS_PARAMS_REQ_ID 0x0011
986#define WSM_SET_BSS_PARAMS_RESP_ID 0x0411
987struct wsm_set_bss_params {
988
989 u8 reset_beacon_loss;
990
991
992
993
994 u8 beacon_lost_count;
995
996
997 u16 aid;
998
999
1000 u32 operational_rate_set;
1001};
1002
1003int wsm_set_bss_params(struct cw1200_common *priv,
1004 const struct wsm_set_bss_params *arg);
1005
1006
1007#define WSM_ADD_KEY_REQ_ID 0x000C
1008#define WSM_ADD_KEY_RESP_ID 0x040C
1009struct wsm_add_key {
1010 u8 type;
1011 u8 index;
1012 u16 reserved;
1013 union {
1014 struct {
1015 u8 peer[6];
1016 u8 reserved;
1017 u8 keylen;
1018 u8 keydata[16];
1019 } __packed wep_pairwise;
1020 struct {
1021 u8 keyid;
1022 u8 keylen;
1023 u16 reserved;
1024 u8 keydata[16];
1025 } __packed wep_group;
1026 struct {
1027 u8 peer[6];
1028 u16 reserved;
1029 u8 keydata[16];
1030 u8 rx_mic_key[8];
1031 u8 tx_mic_key[8];
1032 } __packed tkip_pairwise;
1033 struct {
1034 u8 keydata[16];
1035 u8 rx_mic_key[8];
1036 u8 keyid;
1037 u8 reserved[3];
1038 u8 rx_seqnum[8];
1039 } __packed tkip_group;
1040 struct {
1041 u8 peer[6];
1042 u16 reserved;
1043 u8 keydata[16];
1044 } __packed aes_pairwise;
1045 struct {
1046 u8 keydata[16];
1047 u8 keyid;
1048 u8 reserved[3];
1049 u8 rx_seqnum[8];
1050 } __packed aes_group;
1051 struct {
1052 u8 peer[6];
1053 u8 keyid;
1054 u8 reserved;
1055 u8 keydata[16];
1056 u8 mic_key[16];
1057 } __packed wapi_pairwise;
1058 struct {
1059 u8 keydata[16];
1060 u8 mic_key[16];
1061 u8 keyid;
1062 u8 reserved[3];
1063 } __packed wapi_group;
1064 } __packed;
1065} __packed;
1066
1067int wsm_add_key(struct cw1200_common *priv, const struct wsm_add_key *arg);
1068
1069
1070#define WSM_REMOVE_KEY_REQ_ID 0x000D
1071#define WSM_REMOVE_KEY_RESP_ID 0x040D
1072struct wsm_remove_key {
1073 u8 index;
1074};
1075
1076int wsm_remove_key(struct cw1200_common *priv,
1077 const struct wsm_remove_key *arg);
1078
1079
1080struct wsm_set_tx_queue_params {
1081
1082 u8 ackPolicy;
1083
1084
1085
1086 u16 allowedMediumTime;
1087
1088
1089
1090 u32 maxTransmitLifetime;
1091};
1092
1093struct wsm_tx_queue_params {
1094
1095 struct wsm_set_tx_queue_params params[4];
1096};
1097
1098
1099#define WSM_TX_QUEUE_SET(queue_params, queue, ack_policy, allowed_time,\
1100 max_life_time) \
1101do { \
1102 struct wsm_set_tx_queue_params *p = &(queue_params)->params[queue]; \
1103 p->ackPolicy = (ack_policy); \
1104 p->allowedMediumTime = (allowed_time); \
1105 p->maxTransmitLifetime = (max_life_time); \
1106} while (0)
1107
1108int wsm_set_tx_queue_params(struct cw1200_common *priv,
1109 const struct wsm_set_tx_queue_params *arg, u8 id);
1110
1111
1112#define WSM_EDCA_PARAMS_REQ_ID 0x0013
1113#define WSM_EDCA_PARAMS_RESP_ID 0x0413
1114struct wsm_edca_queue_params {
1115
1116 u16 cwmin;
1117
1118
1119 u16 cwmax;
1120
1121
1122 u16 aifns;
1123
1124
1125 u16 txop_limit;
1126
1127
1128
1129
1130 u32 max_rx_lifetime;
1131};
1132
1133struct wsm_edca_params {
1134
1135 struct wsm_edca_queue_params params[4];
1136 bool uapsd_enable[4];
1137};
1138
1139#define TXOP_UNIT 32
1140#define WSM_EDCA_SET(__edca, __queue, __aifs, __cw_min, __cw_max, __txop, __lifetime,\
1141 __uapsd) \
1142 do { \
1143 struct wsm_edca_queue_params *p = &(__edca)->params[__queue]; \
1144 p->cwmin = __cw_min; \
1145 p->cwmax = __cw_max; \
1146 p->aifns = __aifs; \
1147 p->txop_limit = ((__txop) * TXOP_UNIT); \
1148 p->max_rx_lifetime = __lifetime; \
1149 (__edca)->uapsd_enable[__queue] = (__uapsd); \
1150 } while (0)
1151
1152int wsm_set_edca_params(struct cw1200_common *priv,
1153 const struct wsm_edca_params *arg);
1154
1155int wsm_set_uapsd_param(struct cw1200_common *priv,
1156 const struct wsm_edca_params *arg);
1157
1158
1159
1160
1161
1162#define WSM_SWITCH_CHANNEL_REQ_ID 0x0016
1163#define WSM_SWITCH_CHANNEL_RESP_ID 0x0416
1164
1165struct wsm_switch_channel {
1166
1167
1168 u8 mode;
1169
1170
1171
1172
1173 u8 switch_count;
1174
1175
1176
1177 u16 channel_number;
1178};
1179
1180int wsm_switch_channel(struct cw1200_common *priv,
1181 const struct wsm_switch_channel *arg);
1182
1183typedef void (*wsm_channel_switch_cb) (struct cw1200_common *priv);
1184
1185#define WSM_START_REQ_ID 0x0017
1186#define WSM_START_RESP_ID 0x0417
1187
1188struct wsm_start {
1189
1190 u8 mode;
1191
1192
1193 u8 band;
1194
1195
1196 u16 channel_number;
1197
1198
1199
1200 u32 ct_window;
1201
1202
1203
1204 u32 beacon_interval;
1205
1206
1207 u8 dtim_period;
1208
1209
1210 u8 preamble;
1211
1212
1213
1214 u8 probe_delay;
1215
1216
1217 u8 ssid_len;
1218
1219
1220 u8 ssid[32];
1221
1222
1223 u32 basic_rate_set;
1224};
1225
1226int wsm_start(struct cw1200_common *priv, const struct wsm_start *arg);
1227
1228#define WSM_BEACON_TRANSMIT_REQ_ID 0x0018
1229#define WSM_BEACON_TRANSMIT_RESP_ID 0x0418
1230
1231struct wsm_beacon_transmit {
1232
1233 u8 enable_beaconing;
1234};
1235
1236int wsm_beacon_transmit(struct cw1200_common *priv,
1237 const struct wsm_beacon_transmit *arg);
1238
1239int wsm_start_find(struct cw1200_common *priv);
1240
1241int wsm_stop_find(struct cw1200_common *priv);
1242
1243typedef void (*wsm_find_complete_cb) (struct cw1200_common *priv, u32 status);
1244
1245struct wsm_suspend_resume {
1246
1247
1248 int link_id;
1249
1250 bool stop;
1251
1252 bool multicast;
1253
1254
1255
1256 int queue;
1257};
1258
1259typedef void (*wsm_suspend_resume_cb) (struct cw1200_common *priv,
1260 struct wsm_suspend_resume *arg);
1261
1262
1263struct wsm_update_ie {
1264
1265 u16 what;
1266 u16 count;
1267 u8 *ies;
1268 size_t length;
1269};
1270
1271int wsm_update_ie(struct cw1200_common *priv,
1272 const struct wsm_update_ie *arg);
1273
1274
1275struct wsm_map_link {
1276
1277 u8 mac_addr[6];
1278 u8 link_id;
1279};
1280
1281int wsm_map_link(struct cw1200_common *priv, const struct wsm_map_link *arg);
1282
1283
1284
1285
1286static inline int wsm_set_output_power(struct cw1200_common *priv,
1287 int power_level)
1288{
1289 __le32 val = __cpu_to_le32(power_level);
1290 return wsm_write_mib(priv, WSM_MIB_ID_DOT11_CURRENT_TX_POWER_LEVEL,
1291 &val, sizeof(val));
1292}
1293
1294static inline int wsm_set_beacon_wakeup_period(struct cw1200_common *priv,
1295 unsigned dtim_interval,
1296 unsigned listen_interval)
1297{
1298 struct {
1299 u8 numBeaconPeriods;
1300 u8 reserved;
1301 __le16 listenInterval;
1302 } val = {
1303 dtim_interval, 0, __cpu_to_le16(listen_interval)
1304 };
1305
1306 if (dtim_interval > 0xFF || listen_interval > 0xFFFF)
1307 return -EINVAL;
1308 else
1309 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_WAKEUP_PERIOD,
1310 &val, sizeof(val));
1311}
1312
1313struct wsm_rcpi_rssi_threshold {
1314 u8 rssiRcpiMode;
1315 u8 lowerThreshold;
1316 u8 upperThreshold;
1317 u8 rollingAverageCount;
1318};
1319
1320static inline int wsm_set_rcpi_rssi_threshold(struct cw1200_common *priv,
1321 struct wsm_rcpi_rssi_threshold *arg)
1322{
1323 return wsm_write_mib(priv, WSM_MIB_ID_RCPI_RSSI_THRESHOLD, arg,
1324 sizeof(*arg));
1325}
1326
1327struct wsm_mib_counters_table {
1328 __le32 plcp_errors;
1329 __le32 fcs_errors;
1330 __le32 tx_packets;
1331 __le32 rx_packets;
1332 __le32 rx_packet_errors;
1333 __le32 rx_decryption_failures;
1334 __le32 rx_mic_failures;
1335 __le32 rx_no_key_failures;
1336 __le32 tx_multicast_frames;
1337 __le32 tx_frames_success;
1338 __le32 tx_frame_failures;
1339 __le32 tx_frames_retried;
1340 __le32 tx_frames_multi_retried;
1341 __le32 rx_frame_duplicates;
1342 __le32 rts_success;
1343 __le32 rts_failures;
1344 __le32 ack_failures;
1345 __le32 rx_multicast_frames;
1346 __le32 rx_frames_success;
1347 __le32 rx_cmac_icv_errors;
1348 __le32 rx_cmac_replays;
1349 __le32 rx_mgmt_ccmp_replays;
1350} __packed;
1351
1352static inline int wsm_get_counters_table(struct cw1200_common *priv,
1353 struct wsm_mib_counters_table *arg)
1354{
1355 return wsm_read_mib(priv, WSM_MIB_ID_COUNTERS_TABLE,
1356 arg, sizeof(*arg));
1357}
1358
1359static inline int wsm_get_station_id(struct cw1200_common *priv, u8 *mac)
1360{
1361 return wsm_read_mib(priv, WSM_MIB_ID_DOT11_STATION_ID, mac, ETH_ALEN);
1362}
1363
1364struct wsm_rx_filter {
1365 bool promiscuous;
1366 bool bssid;
1367 bool fcs;
1368 bool probeResponder;
1369};
1370
1371static inline int wsm_set_rx_filter(struct cw1200_common *priv,
1372 const struct wsm_rx_filter *arg)
1373{
1374 __le32 val = 0;
1375 if (arg->promiscuous)
1376 val |= __cpu_to_le32(BIT(0));
1377 if (arg->bssid)
1378 val |= __cpu_to_le32(BIT(1));
1379 if (arg->fcs)
1380 val |= __cpu_to_le32(BIT(2));
1381 if (arg->probeResponder)
1382 val |= __cpu_to_le32(BIT(3));
1383 return wsm_write_mib(priv, WSM_MIB_ID_RX_FILTER, &val, sizeof(val));
1384}
1385
1386int wsm_set_probe_responder(struct cw1200_common *priv, bool enable);
1387
1388#define WSM_BEACON_FILTER_IE_HAS_CHANGED BIT(0)
1389#define WSM_BEACON_FILTER_IE_NO_LONGER_PRESENT BIT(1)
1390#define WSM_BEACON_FILTER_IE_HAS_APPEARED BIT(2)
1391
1392struct wsm_beacon_filter_table_entry {
1393 u8 ie_id;
1394 u8 flags;
1395 u8 oui[3];
1396 u8 match_data[3];
1397} __packed;
1398
1399struct wsm_mib_beacon_filter_table {
1400 __le32 num;
1401 struct wsm_beacon_filter_table_entry entry[10];
1402} __packed;
1403
1404static inline int wsm_set_beacon_filter_table(struct cw1200_common *priv,
1405 struct wsm_mib_beacon_filter_table *ft)
1406{
1407 size_t size = __le32_to_cpu(ft->num) *
1408 sizeof(struct wsm_beacon_filter_table_entry) +
1409 sizeof(__le32);
1410
1411 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_TABLE, ft, size);
1412}
1413
1414#define WSM_BEACON_FILTER_ENABLE BIT(0)
1415#define WSM_BEACON_FILTER_AUTO_ERP BIT(1)
1416
1417struct wsm_beacon_filter_control {
1418 int enabled;
1419 int bcn_count;
1420};
1421
1422static inline int wsm_beacon_filter_control(struct cw1200_common *priv,
1423 struct wsm_beacon_filter_control *arg)
1424{
1425 struct {
1426 __le32 enabled;
1427 __le32 bcn_count;
1428 } val;
1429 val.enabled = __cpu_to_le32(arg->enabled);
1430 val.bcn_count = __cpu_to_le32(arg->bcn_count);
1431 return wsm_write_mib(priv, WSM_MIB_ID_BEACON_FILTER_ENABLE, &val,
1432 sizeof(val));
1433}
1434
1435enum wsm_power_mode {
1436 wsm_power_mode_active = 0,
1437 wsm_power_mode_doze = 1,
1438 wsm_power_mode_quiescent = 2,
1439};
1440
1441struct wsm_operational_mode {
1442 enum wsm_power_mode power_mode;
1443 int disable_more_flag_usage;
1444 int perform_ant_diversity;
1445};
1446
1447static inline int wsm_set_operational_mode(struct cw1200_common *priv,
1448 const struct wsm_operational_mode *arg)
1449{
1450 u8 val = arg->power_mode;
1451 if (arg->disable_more_flag_usage)
1452 val |= BIT(4);
1453 if (arg->perform_ant_diversity)
1454 val |= BIT(5);
1455 return wsm_write_mib(priv, WSM_MIB_ID_OPERATIONAL_POWER_MODE, &val,
1456 sizeof(val));
1457}
1458
1459struct wsm_template_frame {
1460 u8 frame_type;
1461 u8 rate;
1462 struct sk_buff *skb;
1463};
1464
1465static inline int wsm_set_template_frame(struct cw1200_common *priv,
1466 struct wsm_template_frame *arg)
1467{
1468 int ret;
1469 u8 *p = skb_push(arg->skb, 4);
1470 p[0] = arg->frame_type;
1471 p[1] = arg->rate;
1472 ((__le16 *)p)[1] = __cpu_to_le16(arg->skb->len - 4);
1473 ret = wsm_write_mib(priv, WSM_MIB_ID_TEMPLATE_FRAME, p, arg->skb->len);
1474 skb_pull(arg->skb, 4);
1475 return ret;
1476}
1477
1478
1479struct wsm_protected_mgmt_policy {
1480 bool protectedMgmtEnable;
1481 bool unprotectedMgmtFramesAllowed;
1482 bool encryptionForAuthFrame;
1483};
1484
1485static inline int wsm_set_protected_mgmt_policy(struct cw1200_common *priv,
1486 struct wsm_protected_mgmt_policy *arg)
1487{
1488 __le32 val = 0;
1489 int ret;
1490 if (arg->protectedMgmtEnable)
1491 val |= __cpu_to_le32(BIT(0));
1492 if (arg->unprotectedMgmtFramesAllowed)
1493 val |= __cpu_to_le32(BIT(1));
1494 if (arg->encryptionForAuthFrame)
1495 val |= __cpu_to_le32(BIT(2));
1496 ret = wsm_write_mib(priv, WSM_MIB_ID_PROTECTED_MGMT_POLICY,
1497 &val, sizeof(val));
1498 return ret;
1499}
1500
1501struct wsm_mib_block_ack_policy {
1502 u8 tx_tid;
1503 u8 reserved1;
1504 u8 rx_tid;
1505 u8 reserved2;
1506} __packed;
1507
1508static inline int wsm_set_block_ack_policy(struct cw1200_common *priv,
1509 u8 tx_tid_policy,
1510 u8 rx_tid_policy)
1511{
1512 struct wsm_mib_block_ack_policy val = {
1513 .tx_tid = tx_tid_policy,
1514 .rx_tid = rx_tid_policy,
1515 };
1516 return wsm_write_mib(priv, WSM_MIB_ID_BLOCK_ACK_POLICY, &val,
1517 sizeof(val));
1518}
1519
1520struct wsm_mib_association_mode {
1521 u8 flags;
1522 u8 preamble;
1523 u8 greenfield;
1524 u8 mpdu_start_spacing;
1525 __le32 basic_rate_set;
1526} __packed;
1527
1528static inline int wsm_set_association_mode(struct cw1200_common *priv,
1529 struct wsm_mib_association_mode *arg)
1530{
1531 return wsm_write_mib(priv, WSM_MIB_ID_SET_ASSOCIATION_MODE, arg,
1532 sizeof(*arg));
1533}
1534
1535#define WSM_TX_RATE_POLICY_FLAG_TERMINATE_WHEN_FINISHED BIT(2)
1536#define WSM_TX_RATE_POLICY_FLAG_COUNT_INITIAL_TRANSMIT BIT(3)
1537struct wsm_tx_rate_retry_policy {
1538 u8 index;
1539 u8 short_retries;
1540 u8 long_retries;
1541
1542
1543
1544
1545
1546
1547 u8 flags;
1548 u8 rate_recoveries;
1549 u8 reserved[3];
1550 __le32 rate_count_indices[3];
1551} __packed;
1552
1553struct wsm_set_tx_rate_retry_policy {
1554 u8 num;
1555 u8 reserved[3];
1556 struct wsm_tx_rate_retry_policy tbl[8];
1557} __packed;
1558
1559static inline int wsm_set_tx_rate_retry_policy(struct cw1200_common *priv,
1560 struct wsm_set_tx_rate_retry_policy *arg)
1561{
1562 size_t size = 4 + arg->num * sizeof(struct wsm_tx_rate_retry_policy);
1563 return wsm_write_mib(priv, WSM_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg,
1564 size);
1565}
1566
1567
1568struct wsm_ether_type_filter_hdr {
1569 u8 num;
1570 u8 reserved[3];
1571} __packed;
1572
1573struct wsm_ether_type_filter {
1574 u8 action;
1575 u8 reserved;
1576 __le16 type;
1577} __packed;
1578
1579static inline int wsm_set_ether_type_filter(struct cw1200_common *priv,
1580 struct wsm_ether_type_filter_hdr *arg)
1581{
1582 size_t size = sizeof(struct wsm_ether_type_filter_hdr) +
1583 arg->num * sizeof(struct wsm_ether_type_filter);
1584 return wsm_write_mib(priv, WSM_MIB_ID_SET_ETHERTYPE_DATAFRAME_FILTER,
1585 arg, size);
1586}
1587
1588
1589struct wsm_udp_port_filter_hdr {
1590 u8 num;
1591 u8 reserved[3];
1592} __packed;
1593
1594struct wsm_udp_port_filter {
1595 u8 action;
1596 u8 type;
1597 __le16 port;
1598} __packed;
1599
1600static inline int wsm_set_udp_port_filter(struct cw1200_common *priv,
1601 struct wsm_udp_port_filter_hdr *arg)
1602{
1603 size_t size = sizeof(struct wsm_udp_port_filter_hdr) +
1604 arg->num * sizeof(struct wsm_udp_port_filter);
1605 return wsm_write_mib(priv, WSM_MIB_ID_SET_UDPPORT_DATAFRAME_FILTER,
1606 arg, size);
1607}
1608
1609
1610
1611#define D11_MAX_SSID_LEN (32)
1612
1613struct wsm_p2p_device_type {
1614 __le16 category_id;
1615 u8 oui[4];
1616 __le16 subcategory_id;
1617} __packed;
1618
1619struct wsm_p2p_device_info {
1620 struct wsm_p2p_device_type primaryDevice;
1621 u8 reserved1[3];
1622 u8 devname_size;
1623 u8 local_devname[D11_MAX_SSID_LEN];
1624 u8 reserved2[3];
1625 u8 num_secdev_supported;
1626 struct wsm_p2p_device_type secdevs[0];
1627} __packed;
1628
1629
1630struct wsm_cdma_band {
1631 u8 wcdma_band;
1632 u8 reserved[3];
1633} __packed;
1634
1635
1636struct wsm_group_tx_seq {
1637 __le32 bits_47_16;
1638 __le16 bits_15_00;
1639 __le16 reserved;
1640} __packed;
1641
1642
1643#define WSM_DUAL_CTS_PROT_ENB (1 << 0)
1644#define WSM_NON_GREENFIELD_STA_PRESENT (1 << 1)
1645#define WSM_HT_PROT_MODE__NO_PROT (0 << 2)
1646#define WSM_HT_PROT_MODE__NON_MEMBER (1 << 2)
1647#define WSM_HT_PROT_MODE__20_MHZ (2 << 2)
1648#define WSM_HT_PROT_MODE__NON_HT_MIXED (3 << 2)
1649#define WSM_LSIG_TXOP_PROT_FULL (1 << 4)
1650#define WSM_LARGE_L_LENGTH_PROT (1 << 5)
1651
1652struct wsm_ht_protection {
1653 __le32 flags;
1654} __packed;
1655
1656
1657#define WSM_GPIO_COMMAND_SETUP 0
1658#define WSM_GPIO_COMMAND_READ 1
1659#define WSM_GPIO_COMMAND_WRITE 2
1660#define WSM_GPIO_COMMAND_RESET 3
1661#define WSM_GPIO_ALL_PINS 0xFF
1662
1663struct wsm_gpio_command {
1664 u8 command;
1665 u8 pin;
1666 __le16 config;
1667} __packed;
1668
1669
1670struct wsm_tsf_counter {
1671 __le64 tsf_counter;
1672} __packed;
1673
1674
1675struct wsm_keep_alive_period {
1676 __le16 period;
1677 u8 reserved[2];
1678} __packed;
1679
1680static inline int wsm_keep_alive_period(struct cw1200_common *priv,
1681 int period)
1682{
1683 struct wsm_keep_alive_period arg = {
1684 .period = __cpu_to_le16(period),
1685 };
1686 return wsm_write_mib(priv, WSM_MIB_ID_KEEP_ALIVE_PERIOD,
1687 &arg, sizeof(arg));
1688};
1689
1690
1691struct wsm_set_bssid_filtering {
1692 u8 filter;
1693 u8 reserved[3];
1694} __packed;
1695
1696static inline int wsm_set_bssid_filtering(struct cw1200_common *priv,
1697 bool enabled)
1698{
1699 struct wsm_set_bssid_filtering arg = {
1700 .filter = !enabled,
1701 };
1702 return wsm_write_mib(priv, WSM_MIB_ID_DISABLE_BSSID_FILTER,
1703 &arg, sizeof(arg));
1704}
1705
1706
1707struct wsm_mib_multicast_filter {
1708 __le32 enable;
1709 __le32 num_addrs;
1710 u8 macaddrs[WSM_MAX_GRP_ADDRTABLE_ENTRIES][ETH_ALEN];
1711} __packed;
1712
1713static inline int wsm_set_multicast_filter(struct cw1200_common *priv,
1714 struct wsm_mib_multicast_filter *fp)
1715{
1716 return wsm_write_mib(priv, WSM_MIB_ID_DOT11_GROUP_ADDRESSES_TABLE,
1717 fp, sizeof(*fp));
1718}
1719
1720
1721struct wsm_mib_arp_ipv4_filter {
1722 __le32 enable;
1723 __be32 ipv4addrs[WSM_MAX_ARP_IP_ADDRTABLE_ENTRIES];
1724} __packed;
1725
1726static inline int wsm_set_arp_ipv4_filter(struct cw1200_common *priv,
1727 struct wsm_mib_arp_ipv4_filter *fp)
1728{
1729 return wsm_write_mib(priv, WSM_MIB_ID_ARP_IP_ADDRESSES_TABLE,
1730 fp, sizeof(*fp));
1731}
1732
1733
1734struct wsm_p2p_ps_modeinfo {
1735 u8 opp_ps_ct_window;
1736 u8 count;
1737 u8 reserved;
1738 u8 dtim_count;
1739 __le32 duration;
1740 __le32 interval;
1741 __le32 start_time;
1742} __packed;
1743
1744static inline int wsm_set_p2p_ps_modeinfo(struct cw1200_common *priv,
1745 struct wsm_p2p_ps_modeinfo *mi)
1746{
1747 return wsm_write_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
1748 mi, sizeof(*mi));
1749}
1750
1751static inline int wsm_get_p2p_ps_modeinfo(struct cw1200_common *priv,
1752 struct wsm_p2p_ps_modeinfo *mi)
1753{
1754 return wsm_read_mib(priv, WSM_MIB_ID_P2P_PS_MODE_INFO,
1755 mi, sizeof(*mi));
1756}
1757
1758
1759
1760static inline int wsm_use_multi_tx_conf(struct cw1200_common *priv,
1761 bool enabled)
1762{
1763 __le32 arg = enabled ? __cpu_to_le32(1) : 0;
1764
1765 return wsm_write_mib(priv, WSM_MIB_USE_MULTI_TX_CONF,
1766 &arg, sizeof(arg));
1767}
1768
1769
1770
1771struct wsm_uapsd_info {
1772 __le16 uapsd_flags;
1773 __le16 min_auto_trigger_interval;
1774 __le16 max_auto_trigger_interval;
1775 __le16 auto_trigger_step;
1776};
1777
1778static inline int wsm_set_uapsd_info(struct cw1200_common *priv,
1779 struct wsm_uapsd_info *arg)
1780{
1781 return wsm_write_mib(priv, WSM_MIB_ID_SET_UAPSD_INFORMATION,
1782 arg, sizeof(*arg));
1783}
1784
1785
1786struct wsm_override_internal_txrate {
1787 u8 internalTxRate;
1788 u8 nonErpInternalTxRate;
1789 u8 reserved[2];
1790} __packed;
1791
1792static inline int wsm_set_override_internal_txrate(struct cw1200_common *priv,
1793 struct wsm_override_internal_txrate *arg)
1794{
1795 return wsm_write_mib(priv, WSM_MIB_ID_OVERRIDE_INTERNAL_TX_RATE,
1796 arg, sizeof(*arg));
1797}
1798
1799
1800
1801
1802void wsm_lock_tx(struct cw1200_common *priv);
1803void wsm_lock_tx_async(struct cw1200_common *priv);
1804bool wsm_flush_tx(struct cw1200_common *priv);
1805void wsm_unlock_tx(struct cw1200_common *priv);
1806
1807
1808
1809
1810int wsm_handle_exception(struct cw1200_common *priv, u8 *data, size_t len);
1811int wsm_handle_rx(struct cw1200_common *priv, u16 id, struct wsm_hdr *wsm,
1812 struct sk_buff **skb_p);
1813
1814
1815
1816
1817struct wsm_buf {
1818 u8 *begin;
1819 u8 *data;
1820 u8 *end;
1821};
1822
1823void wsm_buf_init(struct wsm_buf *buf);
1824void wsm_buf_deinit(struct wsm_buf *buf);
1825
1826
1827
1828
1829struct wsm_cmd {
1830 spinlock_t lock;
1831 int done;
1832 u8 *ptr;
1833 size_t len;
1834 void *arg;
1835 int ret;
1836 u16 cmd;
1837};
1838
1839
1840
1841
1842int wsm_get_tx(struct cw1200_common *priv, u8 **data,
1843 size_t *tx_len, int *burst);
1844void wsm_txed(struct cw1200_common *priv, u8 *data);
1845
1846
1847
1848
1849
1850
1851static inline u8 wsm_queue_id_to_linux(u8 queue_id)
1852{
1853 static const u8 queue_mapping[] = {
1854 2, 3, 1, 0
1855 };
1856 return queue_mapping[queue_id];
1857}
1858
1859static inline u8 wsm_queue_id_to_wsm(u8 queue_id)
1860{
1861 static const u8 queue_mapping[] = {
1862 3, 2, 0, 1
1863 };
1864 return queue_mapping[queue_id];
1865}
1866
1867#endif
1868