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