1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef _QTN_QLINK_H_
18#define _QTN_QLINK_H_
19
20#include <linux/ieee80211.h>
21
22#define QLINK_PROTO_VER 3
23
24#define QLINK_MACID_RSVD 0xFF
25#define QLINK_VIFID_RSVD 0xFF
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42enum qlink_msg_type {
43 QLINK_MSG_TYPE_CMD = 1,
44 QLINK_MSG_TYPE_CMDRSP = 2,
45 QLINK_MSG_TYPE_EVENT = 3
46};
47
48
49
50
51
52
53
54
55
56struct qlink_msg_header {
57 __le16 type;
58 __le16 len;
59} __packed;
60
61
62
63
64enum qlink_hw_capab {
65 QLINK_HW_SUPPORTS_REG_UPDATE = BIT(0),
66};
67
68enum qlink_phy_mode {
69 QLINK_PHYMODE_BGN = BIT(0),
70 QLINK_PHYMODE_AN = BIT(1),
71 QLINK_PHYMODE_AC = BIT(2),
72};
73
74enum qlink_iface_type {
75 QLINK_IFTYPE_AP = 1,
76 QLINK_IFTYPE_STATION = 2,
77 QLINK_IFTYPE_ADHOC = 3,
78 QLINK_IFTYPE_MONITOR = 4,
79 QLINK_IFTYPE_WDS = 5,
80};
81
82
83
84
85
86
87
88
89
90
91struct qlink_intf_info {
92 __le16 if_type;
93 __le16 flags;
94 u8 mac_addr[ETH_ALEN];
95 u8 rsvd[2];
96} __packed;
97
98enum qlink_sta_flags {
99 QLINK_STA_FLAG_INVALID = 0,
100 QLINK_STA_FLAG_AUTHORIZED = BIT(0),
101 QLINK_STA_FLAG_SHORT_PREAMBLE = BIT(1),
102 QLINK_STA_FLAG_WME = BIT(2),
103 QLINK_STA_FLAG_MFP = BIT(3),
104 QLINK_STA_FLAG_AUTHENTICATED = BIT(4),
105 QLINK_STA_FLAG_TDLS_PEER = BIT(5),
106 QLINK_STA_FLAG_ASSOCIATED = BIT(6),
107};
108
109enum qlink_channel_width {
110 QLINK_CHAN_WIDTH_5 = BIT(0),
111 QLINK_CHAN_WIDTH_10 = BIT(1),
112 QLINK_CHAN_WIDTH_20_NOHT = BIT(2),
113 QLINK_CHAN_WIDTH_20 = BIT(3),
114 QLINK_CHAN_WIDTH_40 = BIT(4),
115 QLINK_CHAN_WIDTH_80 = BIT(5),
116 QLINK_CHAN_WIDTH_80P80 = BIT(6),
117 QLINK_CHAN_WIDTH_160 = BIT(7),
118};
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137enum qlink_cmd_type {
138 QLINK_CMD_FW_INIT = 0x0001,
139 QLINK_CMD_FW_DEINIT = 0x0002,
140 QLINK_CMD_REGISTER_MGMT = 0x0003,
141 QLINK_CMD_SEND_MGMT_FRAME = 0x0004,
142 QLINK_CMD_MGMT_SET_APPIE = 0x0005,
143 QLINK_CMD_PHY_PARAMS_GET = 0x0011,
144 QLINK_CMD_PHY_PARAMS_SET = 0x0012,
145 QLINK_CMD_GET_HW_INFO = 0x0013,
146 QLINK_CMD_MAC_INFO = 0x0014,
147 QLINK_CMD_ADD_INTF = 0x0015,
148 QLINK_CMD_DEL_INTF = 0x0016,
149 QLINK_CMD_CHANGE_INTF = 0x0017,
150 QLINK_CMD_UPDOWN_INTF = 0x0018,
151 QLINK_CMD_REG_REGION = 0x0019,
152 QLINK_CMD_CHANS_INFO_GET = 0x001A,
153 QLINK_CMD_CONFIG_AP = 0x0020,
154 QLINK_CMD_START_AP = 0x0021,
155 QLINK_CMD_STOP_AP = 0x0022,
156 QLINK_CMD_GET_STA_INFO = 0x0030,
157 QLINK_CMD_ADD_KEY = 0x0040,
158 QLINK_CMD_DEL_KEY = 0x0041,
159 QLINK_CMD_SET_DEFAULT_KEY = 0x0042,
160 QLINK_CMD_SET_DEFAULT_MGMT_KEY = 0x0043,
161 QLINK_CMD_CHANGE_STA = 0x0051,
162 QLINK_CMD_DEL_STA = 0x0052,
163 QLINK_CMD_SCAN = 0x0053,
164 QLINK_CMD_CONNECT = 0x0060,
165 QLINK_CMD_DISCONNECT = 0x0061,
166};
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182struct qlink_cmd {
183 struct qlink_msg_header mhdr;
184 __le16 cmd_id;
185 __le16 seq_num;
186 u8 rsvd[2];
187 u8 macid;
188 u8 vifid;
189} __packed;
190
191
192
193
194
195
196
197
198
199struct qlink_cmd_manage_intf {
200 struct qlink_cmd chdr;
201 struct qlink_intf_info intf_info;
202} __packed;
203
204enum qlink_mgmt_frame_type {
205 QLINK_MGMT_FRAME_ASSOC_REQ = 0x00,
206 QLINK_MGMT_FRAME_ASSOC_RESP = 0x01,
207 QLINK_MGMT_FRAME_REASSOC_REQ = 0x02,
208 QLINK_MGMT_FRAME_REASSOC_RESP = 0x03,
209 QLINK_MGMT_FRAME_PROBE_REQ = 0x04,
210 QLINK_MGMT_FRAME_PROBE_RESP = 0x05,
211 QLINK_MGMT_FRAME_BEACON = 0x06,
212 QLINK_MGMT_FRAME_ATIM = 0x07,
213 QLINK_MGMT_FRAME_DISASSOC = 0x08,
214 QLINK_MGMT_FRAME_AUTH = 0x09,
215 QLINK_MGMT_FRAME_DEAUTH = 0x0A,
216 QLINK_MGMT_FRAME_ACTION = 0x0B,
217
218 QLINK_MGMT_FRAME_TYPE_COUNT
219};
220
221
222
223
224
225
226
227
228
229struct qlink_cmd_mgmt_frame_register {
230 struct qlink_cmd chdr;
231 __le16 frame_type;
232 u8 do_register;
233} __packed;
234
235enum qlink_mgmt_frame_tx_flags {
236 QLINK_MGMT_FRAME_TX_FLAG_NONE = 0,
237 QLINK_MGMT_FRAME_TX_FLAG_OFFCHAN = BIT(0),
238 QLINK_MGMT_FRAME_TX_FLAG_NO_CCK = BIT(1),
239 QLINK_MGMT_FRAME_TX_FLAG_ACK_NOWAIT = BIT(2),
240};
241
242
243
244
245
246
247
248
249
250struct qlink_cmd_mgmt_frame_tx {
251 struct qlink_cmd chdr;
252 __le32 cookie;
253 __le16 freq;
254 __le16 flags;
255 u8 frame_data[0];
256} __packed;
257
258
259
260
261
262
263
264
265
266struct qlink_cmd_mgmt_append_ie {
267 struct qlink_cmd chdr;
268 u8 type;
269 u8 flags;
270 u8 ie_data[0];
271} __packed;
272
273
274
275
276
277
278struct qlink_cmd_get_sta_info {
279 struct qlink_cmd chdr;
280 u8 sta_addr[ETH_ALEN];
281} __packed;
282
283
284
285
286
287
288
289
290
291
292struct qlink_cmd_add_key {
293 struct qlink_cmd chdr;
294 u8 key_index;
295 u8 pairwise;
296 u8 addr[ETH_ALEN];
297 __le32 cipher;
298 u8 key_data[0];
299} __packed;
300
301
302
303
304
305
306
307
308struct qlink_cmd_del_key {
309 struct qlink_cmd chdr;
310 u8 key_index;
311 u8 pairwise;
312 u8 addr[ETH_ALEN];
313} __packed;
314
315
316
317
318
319
320
321
322struct qlink_cmd_set_def_key {
323 struct qlink_cmd chdr;
324 u8 key_index;
325 u8 unicast;
326 u8 multicast;
327} __packed;
328
329
330
331
332
333
334struct qlink_cmd_set_def_mgmt_key {
335 struct qlink_cmd chdr;
336 u8 key_index;
337} __packed;
338
339
340
341
342
343
344
345
346struct qlink_cmd_change_sta {
347 struct qlink_cmd chdr;
348 __le32 sta_flags_mask;
349 __le32 sta_flags_set;
350 u8 sta_addr[ETH_ALEN];
351} __packed;
352
353
354
355
356
357
358struct qlink_cmd_del_sta {
359 struct qlink_cmd chdr;
360 __le16 reason_code;
361 u8 subtype;
362 u8 sta_addr[ETH_ALEN];
363} __packed;
364
365enum qlink_sta_connect_flags {
366 QLINK_STA_CONNECT_DISABLE_HT = BIT(0),
367 QLINK_STA_CONNECT_DISABLE_VHT = BIT(1),
368 QLINK_STA_CONNECT_USE_RRM = BIT(2),
369};
370
371
372
373
374
375
376
377
378
379
380struct qlink_cmd_connect {
381 struct qlink_cmd chdr;
382 __le32 flags;
383 __le16 freq;
384 __le16 bg_scan_period;
385 u8 bssid[ETH_ALEN];
386 u8 payload[0];
387} __packed;
388
389
390
391
392
393
394struct qlink_cmd_disconnect {
395 struct qlink_cmd chdr;
396 __le16 reason;
397} __packed;
398
399
400
401
402
403
404
405struct qlink_cmd_updown {
406 struct qlink_cmd chdr;
407 u8 if_up;
408} __packed;
409
410
411
412
413
414
415
416
417enum qlink_band {
418 QLINK_BAND_2GHZ = BIT(0),
419 QLINK_BAND_5GHZ = BIT(1),
420 QLINK_BAND_60GHZ = BIT(2),
421};
422
423
424
425
426
427
428struct qlink_cmd_chans_info_get {
429 struct qlink_cmd chdr;
430 u8 band;
431} __packed;
432
433
434
435
436enum qlink_cmd_result {
437 QLINK_CMD_RESULT_OK = 0,
438 QLINK_CMD_RESULT_INVALID,
439 QLINK_CMD_RESULT_ENOTSUPP,
440 QLINK_CMD_RESULT_ENOTFOUND,
441};
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458struct qlink_resp {
459 struct qlink_msg_header mhdr;
460 __le16 cmd_id;
461 __le16 seq_num;
462 __le16 result;
463 u8 macid;
464 u8 vifid;
465} __packed;
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485struct qlink_resp_get_mac_info {
486 struct qlink_resp rhdr;
487 u8 dev_mac[ETH_ALEN];
488 u8 num_tx_chain;
489 u8 num_rx_chain;
490 struct ieee80211_vht_cap vht_cap;
491 struct ieee80211_ht_cap ht_cap;
492 u8 bands_cap;
493 u8 phymode_cap;
494 __le16 max_ap_assoc_sta;
495 __le16 radar_detect_widths;
496 u8 var_info[0];
497} __packed;
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513struct qlink_resp_get_hw_info {
514 struct qlink_resp rhdr;
515 __le32 fw_ver;
516 __le32 hw_capab;
517 __le16 ql_proto_ver;
518 u8 alpha2_code[2];
519 u8 num_mac;
520 u8 mac_bitmap;
521 u8 total_tx_chain;
522 u8 total_rx_chain;
523} __packed;
524
525
526
527
528
529
530
531
532
533struct qlink_resp_manage_intf {
534 struct qlink_resp rhdr;
535 struct qlink_intf_info intf_info;
536} __packed;
537
538
539
540
541
542
543
544
545
546struct qlink_resp_get_sta_info {
547 struct qlink_resp rhdr;
548 u8 sta_addr[ETH_ALEN];
549 u8 info[0];
550} __packed;
551
552
553
554
555
556
557
558
559struct qlink_resp_get_chan_info {
560 struct qlink_resp rhdr;
561 u8 band;
562 u8 num_chans;
563 u8 rsvd[2];
564 u8 info[0];
565} __packed;
566
567
568
569
570
571
572struct qlink_resp_phy_params {
573 struct qlink_resp rhdr;
574 u8 info[0];
575} __packed;
576
577
578
579
580enum qlink_event_type {
581 QLINK_EVENT_STA_ASSOCIATED = 0x0021,
582 QLINK_EVENT_STA_DEAUTH = 0x0022,
583 QLINK_EVENT_MGMT_RECEIVED = 0x0023,
584 QLINK_EVENT_SCAN_RESULTS = 0x0024,
585 QLINK_EVENT_SCAN_COMPLETE = 0x0025,
586 QLINK_EVENT_BSS_JOIN = 0x0026,
587 QLINK_EVENT_BSS_LEAVE = 0x0027,
588};
589
590
591
592
593
594
595
596
597
598
599
600
601
602struct qlink_event {
603 struct qlink_msg_header mhdr;
604 __le16 event_id;
605 u8 macid;
606 u8 vifid;
607} __packed;
608
609
610
611
612
613
614
615
616struct qlink_event_sta_assoc {
617 struct qlink_event ehdr;
618 u8 sta_addr[ETH_ALEN];
619 __le16 frame_control;
620 u8 ies[0];
621} __packed;
622
623
624
625
626
627
628
629struct qlink_event_sta_deauth {
630 struct qlink_event ehdr;
631 u8 sta_addr[ETH_ALEN];
632 __le16 reason;
633} __packed;
634
635
636
637
638
639
640
641struct qlink_event_bss_join {
642 struct qlink_event ehdr;
643 u8 bssid[ETH_ALEN];
644 __le16 status;
645} __packed;
646
647
648
649
650
651
652struct qlink_event_bss_leave {
653 struct qlink_event ehdr;
654 u16 reason;
655} __packed;
656
657enum qlink_rxmgmt_flags {
658 QLINK_RXMGMT_FLAG_ANSWERED = 1 << 0,
659};
660
661
662
663
664
665
666
667
668
669struct qlink_event_rxmgmt {
670 struct qlink_event ehdr;
671 __le32 freq;
672 __le32 sig_dbm;
673 __le32 flags;
674 u8 frame_data[0];
675} __packed;
676
677enum qlink_frame_type {
678 QLINK_BSS_FTYPE_UNKNOWN,
679 QLINK_BSS_FTYPE_BEACON,
680 QLINK_BSS_FTYPE_PRESP,
681};
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698struct qlink_event_scan_result {
699 struct qlink_event ehdr;
700 __le64 tsf;
701 __le16 freq;
702 __le16 capab;
703 __le16 bintval;
704 s8 signal;
705 u8 frame_type;
706 u8 bssid[ETH_ALEN];
707 u8 ssid_len;
708 u8 ssid[IEEE80211_MAX_SSID_LEN];
709 u8 payload[0];
710} __packed;
711
712
713
714
715
716
717
718enum qlink_scan_complete_flags {
719 QLINK_SCAN_NONE = 0,
720 QLINK_SCAN_ABORTED = BIT(0),
721};
722
723
724
725
726
727
728
729struct qlink_event_scan_complete {
730 struct qlink_event ehdr;
731 __le32 flags;
732} __packed;
733
734
735
736
737enum qlink_tlv_id {
738 QTN_TLV_ID_FRAG_THRESH = 0x0201,
739 QTN_TLV_ID_RTS_THRESH = 0x0202,
740 QTN_TLV_ID_SRETRY_LIMIT = 0x0203,
741 QTN_TLV_ID_LRETRY_LIMIT = 0x0204,
742 QTN_TLV_ID_BCN_PERIOD = 0x0205,
743 QTN_TLV_ID_DTIM = 0x0206,
744 QTN_TLV_ID_CHANNEL = 0x020F,
745 QTN_TLV_ID_COVERAGE_CLASS = 0x0213,
746 QTN_TLV_ID_IFACE_LIMIT = 0x0214,
747 QTN_TLV_ID_NUM_IFACE_COMB = 0x0215,
748 QTN_TLV_ID_STA_BASIC_COUNTERS = 0x0300,
749 QTN_TLV_ID_STA_GENERIC_INFO = 0x0301,
750 QTN_TLV_ID_KEY = 0x0302,
751 QTN_TLV_ID_SEQ = 0x0303,
752 QTN_TLV_ID_CRYPTO = 0x0304,
753 QTN_TLV_ID_IE_SET = 0x0305,
754};
755
756struct qlink_tlv_hdr {
757 __le16 type;
758 __le16 len;
759 u8 val[0];
760} __packed;
761
762struct qlink_iface_limit {
763 __le16 max_num;
764 __le16 type_mask;
765} __packed;
766
767struct qlink_iface_comb_num {
768 __le16 iface_comb_num;
769} __packed;
770
771struct qlink_sta_stat_basic_counters {
772 __le64 rx_bytes;
773 __le64 tx_bytes;
774 __le64 rx_beacons;
775 __le32 rx_packets;
776 __le32 tx_packets;
777 __le32 rx_dropped;
778 __le32 tx_failed;
779} __packed;
780
781enum qlink_sta_info_rate_flags {
782 QLINK_STA_INFO_RATE_FLAG_INVALID = 0,
783 QLINK_STA_INFO_RATE_FLAG_HT_MCS = BIT(0),
784 QLINK_STA_INFO_RATE_FLAG_VHT_MCS = BIT(1),
785 QLINK_STA_INFO_RATE_FLAG_SHORT_GI = BIT(2),
786 QLINK_STA_INFO_RATE_FLAG_60G = BIT(3),
787};
788
789enum qlink_sta_info_rate_bw {
790 QLINK_STA_INFO_RATE_BW_5 = 0,
791 QLINK_STA_INFO_RATE_BW_10 = 1,
792 QLINK_STA_INFO_RATE_BW_20 = 2,
793 QLINK_STA_INFO_RATE_BW_40 = 3,
794 QLINK_STA_INFO_RATE_BW_80 = 4,
795 QLINK_STA_INFO_RATE_BW_160 = 5,
796};
797
798
799
800
801
802
803
804
805
806
807struct qlink_sta_info_rate {
808 __le16 rate;
809 u8 flags;
810 u8 mcs;
811 u8 nss;
812 u8 bw;
813} __packed;
814
815struct qlink_sta_info_state {
816 __le32 mask;
817 __le32 value;
818} __packed;
819
820#define QLINK_RSSI_OFFSET 120
821
822struct qlink_sta_info_generic {
823 struct qlink_sta_info_state state;
824 __le32 connected_time;
825 __le32 inactive_time;
826 struct qlink_sta_info_rate rx_rate;
827 struct qlink_sta_info_rate tx_rate;
828 u8 rssi;
829 u8 rssi_avg;
830} __packed;
831
832struct qlink_tlv_frag_rts_thr {
833 struct qlink_tlv_hdr hdr;
834 __le16 thr;
835} __packed;
836
837struct qlink_tlv_rlimit {
838 struct qlink_tlv_hdr hdr;
839 u8 rlimit;
840} __packed;
841
842struct qlink_tlv_cclass {
843 struct qlink_tlv_hdr hdr;
844 u8 cclass;
845} __packed;
846
847enum qlink_dfs_state {
848 QLINK_DFS_USABLE,
849 QLINK_DFS_UNAVAILABLE,
850 QLINK_DFS_AVAILABLE,
851};
852
853enum qlink_channel_flags {
854 QLINK_CHAN_DISABLED = BIT(0),
855 QLINK_CHAN_NO_IR = BIT(1),
856 QLINK_CHAN_RADAR = BIT(3),
857 QLINK_CHAN_NO_HT40PLUS = BIT(4),
858 QLINK_CHAN_NO_HT40MINUS = BIT(5),
859 QLINK_CHAN_NO_OFDM = BIT(6),
860 QLINK_CHAN_NO_80MHZ = BIT(7),
861 QLINK_CHAN_NO_160MHZ = BIT(8),
862 QLINK_CHAN_INDOOR_ONLY = BIT(9),
863 QLINK_CHAN_IR_CONCURRENT = BIT(10),
864 QLINK_CHAN_NO_20MHZ = BIT(11),
865 QLINK_CHAN_NO_10MHZ = BIT(12),
866};
867
868struct qlink_tlv_channel {
869 struct qlink_tlv_hdr hdr;
870 __le16 hw_value;
871 __le16 center_freq;
872 __le32 flags;
873 u8 band;
874 u8 max_antenna_gain;
875 u8 max_power;
876 u8 max_reg_power;
877 __le32 dfs_cac_ms;
878 u8 dfs_state;
879 u8 beacon_found;
880 u8 rsvd[2];
881} __packed;
882
883#define QLINK_MAX_NR_CIPHER_SUITES 5
884#define QLINK_MAX_NR_AKM_SUITES 2
885
886struct qlink_auth_encr {
887 __le32 wpa_versions;
888 __le32 cipher_group;
889 __le32 n_ciphers_pairwise;
890 __le32 ciphers_pairwise[QLINK_MAX_NR_CIPHER_SUITES];
891 __le32 n_akm_suites;
892 __le32 akm_suites[QLINK_MAX_NR_AKM_SUITES];
893 __le16 control_port_ethertype;
894 u8 auth_type;
895 u8 privacy;
896 u8 mfp;
897 u8 control_port;
898 u8 control_port_no_encrypt;
899} __packed;
900
901#endif
902