qtnfmac: SCAN results: retreive frame type information from "IE set" TLV
[linux-2.6/btrfs-unstable.git] / drivers / net / wireless / quantenna / qtnfmac / qlink.h
blob81effd21075c116bb6d041a24ca288808e7e28c3
1 /*
2 * Copyright (c) 2015-2016 Quantenna Communications, Inc.
3 * All rights reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #ifndef _QTN_QLINK_H_
18 #define _QTN_QLINK_H_
20 #include <linux/ieee80211.h>
22 #define QLINK_PROTO_VER 5
24 #define QLINK_MACID_RSVD 0xFF
25 #define QLINK_VIFID_RSVD 0xFF
27 /* Common QLINK protocol messages definitions.
30 /**
31 * enum qlink_msg_type - QLINK message types
33 * Used to distinguish between message types of QLINK protocol.
35 * @QLINK_MSG_TYPE_CMD: Message is carrying data of a command sent from
36 * driver to wireless hardware.
37 * @QLINK_MSG_TYPE_CMDRSP: Message is carrying data of a response to a command.
38 * Sent from wireless HW to driver in reply to previously issued command.
39 * @QLINK_MSG_TYPE_EVENT: Data for an event originated in wireless hardware and
40 * sent asynchronously to driver.
42 enum qlink_msg_type {
43 QLINK_MSG_TYPE_CMD = 1,
44 QLINK_MSG_TYPE_CMDRSP = 2,
45 QLINK_MSG_TYPE_EVENT = 3
48 /**
49 * struct qlink_msg_header - common QLINK protocol message header
51 * Portion of QLINK protocol header common for all message types.
53 * @type: Message type, one of &enum qlink_msg_type.
54 * @len: Total length of message including all headers.
56 struct qlink_msg_header {
57 __le16 type;
58 __le16 len;
59 } __packed;
61 /* Generic definitions of data and information carried in QLINK messages
64 /**
65 * enum qlink_hw_capab - device capabilities.
67 * @QLINK_HW_CAPAB_REG_UPDATE: device can update it's regulatory region.
68 * @QLINK_HW_CAPAB_STA_INACT_TIMEOUT: device implements a logic to kick-out
69 * associated STAs due to inactivity. Inactivity timeout period is taken
70 * from QLINK_CMD_START_AP parameters.
72 enum qlink_hw_capab {
73 QLINK_HW_CAPAB_REG_UPDATE = BIT(0),
74 QLINK_HW_CAPAB_STA_INACT_TIMEOUT = BIT(1),
77 enum qlink_iface_type {
78 QLINK_IFTYPE_AP = 1,
79 QLINK_IFTYPE_STATION = 2,
80 QLINK_IFTYPE_ADHOC = 3,
81 QLINK_IFTYPE_MONITOR = 4,
82 QLINK_IFTYPE_WDS = 5,
83 QLINK_IFTYPE_AP_VLAN = 6,
86 /**
87 * struct qlink_intf_info - information on virtual interface.
89 * Data describing a single virtual interface.
91 * @if_type: Mode of interface operation, one of &enum qlink_iface_type
92 * @vlanid: VLAN ID for AP_VLAN interface type
93 * @mac_addr: MAC address of virtual interface.
95 struct qlink_intf_info {
96 __le16 if_type;
97 __le16 vlanid;
98 u8 mac_addr[ETH_ALEN];
99 u8 rsvd[2];
100 } __packed;
102 enum qlink_sta_flags {
103 QLINK_STA_FLAG_INVALID = 0,
104 QLINK_STA_FLAG_AUTHORIZED = BIT(0),
105 QLINK_STA_FLAG_SHORT_PREAMBLE = BIT(1),
106 QLINK_STA_FLAG_WME = BIT(2),
107 QLINK_STA_FLAG_MFP = BIT(3),
108 QLINK_STA_FLAG_AUTHENTICATED = BIT(4),
109 QLINK_STA_FLAG_TDLS_PEER = BIT(5),
110 QLINK_STA_FLAG_ASSOCIATED = BIT(6),
113 enum qlink_channel_width {
114 QLINK_CHAN_WIDTH_5 = 0,
115 QLINK_CHAN_WIDTH_10,
116 QLINK_CHAN_WIDTH_20_NOHT,
117 QLINK_CHAN_WIDTH_20,
118 QLINK_CHAN_WIDTH_40,
119 QLINK_CHAN_WIDTH_80,
120 QLINK_CHAN_WIDTH_80P80,
121 QLINK_CHAN_WIDTH_160,
125 * struct qlink_chandef - qlink channel definition
127 * @center_freq1: center frequency of first segment
128 * @center_freq2: center frequency of second segment (80+80 only)
129 * @width: channel width, one of @enum qlink_channel_width
131 struct qlink_chandef {
132 __le16 center_freq1;
133 __le16 center_freq2;
134 u8 width;
135 u8 rsvd[3];
136 } __packed;
138 #define QLINK_MAX_NR_CIPHER_SUITES 5
139 #define QLINK_MAX_NR_AKM_SUITES 2
141 struct qlink_auth_encr {
142 __le32 wpa_versions;
143 __le32 cipher_group;
144 __le32 n_ciphers_pairwise;
145 __le32 ciphers_pairwise[QLINK_MAX_NR_CIPHER_SUITES];
146 __le32 n_akm_suites;
147 __le32 akm_suites[QLINK_MAX_NR_AKM_SUITES];
148 __le16 control_port_ethertype;
149 u8 auth_type;
150 u8 privacy;
151 u8 mfp;
152 u8 control_port;
153 u8 control_port_no_encrypt;
154 } __packed;
156 /* QLINK Command messages related definitions
160 * enum qlink_cmd_type - list of supported commands
162 * Commands are QLINK messages of type @QLINK_MSG_TYPE_CMD, sent by driver to
163 * wireless network device for processing. Device is expected to send back a
164 * reply message of type &QLINK_MSG_TYPE_CMDRSP, containing at least command
165 * execution status (one of &enum qlink_cmd_result). Reply message
166 * may also contain data payload specific to the command type.
168 * @QLINK_CMD_BAND_INFO_GET: for the specified MAC and specified band, get
169 * the band's description including number of operational channels and
170 * info on each channel, HT/VHT capabilities, supported rates etc.
171 * This command is generic to a specified MAC, interface index must be set
172 * to QLINK_VIFID_RSVD in command header.
173 * @QLINK_CMD_REG_NOTIFY: notify device about regulatory domain change. This
174 * command is supported only if device reports QLINK_HW_SUPPORTS_REG_UPDATE
175 * capability.
177 enum qlink_cmd_type {
178 QLINK_CMD_FW_INIT = 0x0001,
179 QLINK_CMD_FW_DEINIT = 0x0002,
180 QLINK_CMD_REGISTER_MGMT = 0x0003,
181 QLINK_CMD_SEND_MGMT_FRAME = 0x0004,
182 QLINK_CMD_MGMT_SET_APPIE = 0x0005,
183 QLINK_CMD_PHY_PARAMS_GET = 0x0011,
184 QLINK_CMD_PHY_PARAMS_SET = 0x0012,
185 QLINK_CMD_GET_HW_INFO = 0x0013,
186 QLINK_CMD_MAC_INFO = 0x0014,
187 QLINK_CMD_ADD_INTF = 0x0015,
188 QLINK_CMD_DEL_INTF = 0x0016,
189 QLINK_CMD_CHANGE_INTF = 0x0017,
190 QLINK_CMD_UPDOWN_INTF = 0x0018,
191 QLINK_CMD_REG_NOTIFY = 0x0019,
192 QLINK_CMD_BAND_INFO_GET = 0x001A,
193 QLINK_CMD_CHAN_SWITCH = 0x001B,
194 QLINK_CMD_CHAN_GET = 0x001C,
195 QLINK_CMD_CONFIG_AP = 0x0020,
196 QLINK_CMD_START_AP = 0x0021,
197 QLINK_CMD_STOP_AP = 0x0022,
198 QLINK_CMD_GET_STA_INFO = 0x0030,
199 QLINK_CMD_ADD_KEY = 0x0040,
200 QLINK_CMD_DEL_KEY = 0x0041,
201 QLINK_CMD_SET_DEFAULT_KEY = 0x0042,
202 QLINK_CMD_SET_DEFAULT_MGMT_KEY = 0x0043,
203 QLINK_CMD_CHANGE_STA = 0x0051,
204 QLINK_CMD_DEL_STA = 0x0052,
205 QLINK_CMD_SCAN = 0x0053,
206 QLINK_CMD_CHAN_STATS = 0x0054,
207 QLINK_CMD_CONNECT = 0x0060,
208 QLINK_CMD_DISCONNECT = 0x0061,
212 * struct qlink_cmd - QLINK command message header
214 * Header used for QLINK messages of QLINK_MSG_TYPE_CMD type.
216 * @mhdr: Common QLINK message header.
217 * @cmd_id: command id, one of &enum qlink_cmd_type.
218 * @seq_num: sequence number of command message, used for matching with
219 * response message.
220 * @macid: index of physical radio device the command is destined to or
221 * QLINK_MACID_RSVD if not applicable.
222 * @vifid: index of virtual wireless interface on specified @macid the command
223 * is destined to or QLINK_VIFID_RSVD if not applicable.
225 struct qlink_cmd {
226 struct qlink_msg_header mhdr;
227 __le16 cmd_id;
228 __le16 seq_num;
229 u8 rsvd[2];
230 u8 macid;
231 u8 vifid;
232 } __packed;
235 * struct qlink_cmd_manage_intf - interface management command
237 * Data for interface management commands QLINK_CMD_ADD_INTF, QLINK_CMD_DEL_INTF
238 * and QLINK_CMD_CHANGE_INTF.
240 * @intf_info: interface description.
242 struct qlink_cmd_manage_intf {
243 struct qlink_cmd chdr;
244 struct qlink_intf_info intf_info;
245 } __packed;
247 enum qlink_mgmt_frame_type {
248 QLINK_MGMT_FRAME_ASSOC_REQ = 0x00,
249 QLINK_MGMT_FRAME_ASSOC_RESP = 0x01,
250 QLINK_MGMT_FRAME_REASSOC_REQ = 0x02,
251 QLINK_MGMT_FRAME_REASSOC_RESP = 0x03,
252 QLINK_MGMT_FRAME_PROBE_REQ = 0x04,
253 QLINK_MGMT_FRAME_PROBE_RESP = 0x05,
254 QLINK_MGMT_FRAME_BEACON = 0x06,
255 QLINK_MGMT_FRAME_ATIM = 0x07,
256 QLINK_MGMT_FRAME_DISASSOC = 0x08,
257 QLINK_MGMT_FRAME_AUTH = 0x09,
258 QLINK_MGMT_FRAME_DEAUTH = 0x0A,
259 QLINK_MGMT_FRAME_ACTION = 0x0B,
261 QLINK_MGMT_FRAME_TYPE_COUNT
265 * struct qlink_cmd_mgmt_frame_register - data for QLINK_CMD_REGISTER_MGMT
267 * @frame_type: MGMT frame type the registration request describes, one of
268 * &enum qlink_mgmt_frame_type.
269 * @do_register: 0 - unregister, otherwise register for reception of specified
270 * MGMT frame type.
272 struct qlink_cmd_mgmt_frame_register {
273 struct qlink_cmd chdr;
274 __le16 frame_type;
275 u8 do_register;
276 } __packed;
278 enum qlink_mgmt_frame_tx_flags {
279 QLINK_MGMT_FRAME_TX_FLAG_NONE = 0,
280 QLINK_MGMT_FRAME_TX_FLAG_OFFCHAN = BIT(0),
281 QLINK_MGMT_FRAME_TX_FLAG_NO_CCK = BIT(1),
282 QLINK_MGMT_FRAME_TX_FLAG_ACK_NOWAIT = BIT(2),
286 * struct qlink_cmd_mgmt_frame_tx - data for QLINK_CMD_SEND_MGMT_FRAME command
288 * @cookie: opaque request identifier.
289 * @freq: Frequency to use for frame transmission.
290 * @flags: Transmission flags, one of &enum qlink_mgmt_frame_tx_flags.
291 * @frame_data: frame to transmit.
293 struct qlink_cmd_mgmt_frame_tx {
294 struct qlink_cmd chdr;
295 __le32 cookie;
296 __le16 freq;
297 __le16 flags;
298 u8 frame_data[0];
299 } __packed;
302 * struct qlink_cmd_mgmt_append_ie - data for QLINK_CMD_MGMT_SET_APPIE command
304 * @type: type of MGMT frame to appent requested IEs to, one of
305 * &enum qlink_mgmt_frame_type.
306 * @flags: for future use.
307 * @ie_data: IEs data to append.
309 struct qlink_cmd_mgmt_append_ie {
310 struct qlink_cmd chdr;
311 u8 type;
312 u8 flags;
313 u8 ie_data[0];
314 } __packed;
317 * struct qlink_cmd_get_sta_info - data for QLINK_CMD_GET_STA_INFO command
319 * @sta_addr: MAC address of the STA statistics is requested for.
321 struct qlink_cmd_get_sta_info {
322 struct qlink_cmd chdr;
323 u8 sta_addr[ETH_ALEN];
324 } __packed;
327 * struct qlink_cmd_add_key - data for QLINK_CMD_ADD_KEY command.
329 * @key_index: index of the key being installed.
330 * @pairwise: whether to use pairwise key.
331 * @addr: MAC address of a STA key is being installed to.
332 * @cipher: cipher suite.
333 * @vlanid: VLAN ID for AP_VLAN interface type
334 * @key_data: key data itself.
336 struct qlink_cmd_add_key {
337 struct qlink_cmd chdr;
338 u8 key_index;
339 u8 pairwise;
340 u8 addr[ETH_ALEN];
341 __le32 cipher;
342 __le16 vlanid;
343 u8 key_data[0];
344 } __packed;
347 * struct qlink_cmd_del_key_req - data for QLINK_CMD_DEL_KEY command
349 * @key_index: index of the key being removed.
350 * @pairwise: whether to use pairwise key.
351 * @addr: MAC address of a STA for which a key is removed.
353 struct qlink_cmd_del_key {
354 struct qlink_cmd chdr;
355 u8 key_index;
356 u8 pairwise;
357 u8 addr[ETH_ALEN];
358 } __packed;
361 * struct qlink_cmd_set_def_key - data for QLINK_CMD_SET_DEFAULT_KEY command
363 * @key_index: index of the key to be set as default one.
364 * @unicast: key is unicast.
365 * @multicast: key is multicast.
367 struct qlink_cmd_set_def_key {
368 struct qlink_cmd chdr;
369 u8 key_index;
370 u8 unicast;
371 u8 multicast;
372 } __packed;
375 * struct qlink_cmd_set_def_mgmt_key - data for QLINK_CMD_SET_DEFAULT_MGMT_KEY
377 * @key_index: index of the key to be set as default MGMT key.
379 struct qlink_cmd_set_def_mgmt_key {
380 struct qlink_cmd chdr;
381 u8 key_index;
382 } __packed;
385 * struct qlink_cmd_change_sta - data for QLINK_CMD_CHANGE_STA command
387 * @sta_flags_mask: STA flags mask, bitmap of &enum qlink_sta_flags
388 * @sta_flags_set: STA flags values, bitmap of &enum qlink_sta_flags
389 * @if_type: Mode of interface operation, one of &enum qlink_iface_type
390 * @vlanid: VLAN ID to assign to specific STA
391 * @sta_addr: address of the STA for which parameters are set.
393 struct qlink_cmd_change_sta {
394 struct qlink_cmd chdr;
395 __le32 sta_flags_mask;
396 __le32 sta_flags_set;
397 __le16 if_type;
398 __le16 vlanid;
399 u8 sta_addr[ETH_ALEN];
400 } __packed;
403 * struct qlink_cmd_del_sta - data for QLINK_CMD_DEL_STA command.
405 * See &struct station_del_parameters
407 struct qlink_cmd_del_sta {
408 struct qlink_cmd chdr;
409 __le16 reason_code;
410 u8 subtype;
411 u8 sta_addr[ETH_ALEN];
412 } __packed;
414 enum qlink_sta_connect_flags {
415 QLINK_STA_CONNECT_DISABLE_HT = BIT(0),
416 QLINK_STA_CONNECT_DISABLE_VHT = BIT(1),
417 QLINK_STA_CONNECT_USE_RRM = BIT(2),
421 * struct qlink_cmd_connect - data for QLINK_CMD_CONNECT command
423 * @flags: for future use.
424 * @channel: channel which should be used to connect.
425 * @bg_scan_period: period of background scan.
426 * @aen: authentication information.
427 * @bssid: BSSID of the BSS to connect to.
428 * @payload: variable portion of connection request.
430 struct qlink_cmd_connect {
431 struct qlink_cmd chdr;
432 __le32 flags;
433 __le16 channel;
434 __le16 bg_scan_period;
435 struct qlink_auth_encr aen;
436 u8 bssid[ETH_ALEN];
437 u8 payload[0];
438 } __packed;
441 * struct qlink_cmd_disconnect - data for QLINK_CMD_DISCONNECT command
443 * @reason: code of the reason of disconnect, see &enum ieee80211_reasoncode.
445 struct qlink_cmd_disconnect {
446 struct qlink_cmd chdr;
447 __le16 reason;
448 } __packed;
451 * struct qlink_cmd_updown - data for QLINK_CMD_UPDOWN_INTF command
453 * @if_up: bring specified interface DOWN (if_up==0) or UP (otherwise).
454 * Interface is specified in common command header @chdr.
456 struct qlink_cmd_updown {
457 struct qlink_cmd chdr;
458 u8 if_up;
459 } __packed;
462 * enum qlink_band - a list of frequency bands
464 * @QLINK_BAND_2GHZ: 2.4GHz band
465 * @QLINK_BAND_5GHZ: 5GHz band
466 * @QLINK_BAND_60GHZ: 60GHz band
468 enum qlink_band {
469 QLINK_BAND_2GHZ = BIT(0),
470 QLINK_BAND_5GHZ = BIT(1),
471 QLINK_BAND_60GHZ = BIT(2),
475 * struct qlink_cmd_band_info_get - data for QLINK_CMD_BAND_INFO_GET command
477 * @band: a PHY band for which information is queried, one of @enum qlink_band
479 struct qlink_cmd_band_info_get {
480 struct qlink_cmd chdr;
481 u8 band;
482 } __packed;
485 * struct qlink_cmd_get_chan_stats - data for QLINK_CMD_CHAN_STATS command
487 * @channel: channel number according to 802.11 17.3.8.3.2 and Annex J
489 struct qlink_cmd_get_chan_stats {
490 struct qlink_cmd chdr;
491 __le16 channel;
492 } __packed;
495 * enum qlink_reg_initiator - Indicates the initiator of a reg domain request
497 * See &enum nl80211_reg_initiator for more info.
499 enum qlink_reg_initiator {
500 QLINK_REGDOM_SET_BY_CORE,
501 QLINK_REGDOM_SET_BY_USER,
502 QLINK_REGDOM_SET_BY_DRIVER,
503 QLINK_REGDOM_SET_BY_COUNTRY_IE,
507 * enum qlink_user_reg_hint_type - type of user regulatory hint
509 * See &enum nl80211_user_reg_hint_type for more info.
511 enum qlink_user_reg_hint_type {
512 QLINK_USER_REG_HINT_USER = 0,
513 QLINK_USER_REG_HINT_CELL_BASE = 1,
514 QLINK_USER_REG_HINT_INDOOR = 2,
518 * struct qlink_cmd_reg_notify - data for QLINK_CMD_REG_NOTIFY command
520 * @alpha2: the ISO / IEC 3166 alpha2 country code.
521 * @initiator: which entity sent the request, one of &enum qlink_reg_initiator.
522 * @user_reg_hint_type: type of hint for QLINK_REGDOM_SET_BY_USER request, one
523 * of &enum qlink_user_reg_hint_type.
525 struct qlink_cmd_reg_notify {
526 struct qlink_cmd chdr;
527 u8 alpha2[2];
528 u8 initiator;
529 u8 user_reg_hint_type;
530 } __packed;
533 * struct qlink_cmd_chan_switch - data for QLINK_CMD_CHAN_SWITCH command
535 * @channel: channel number according to 802.11 17.3.8.3.2 and Annex J
536 * @radar_required: whether radar detection is required on the new channel
537 * @block_tx: whether transmissions should be blocked while changing
538 * @beacon_count: number of beacons until switch
540 struct qlink_cmd_chan_switch {
541 struct qlink_cmd chdr;
542 __le16 channel;
543 u8 radar_required;
544 u8 block_tx;
545 u8 beacon_count;
546 } __packed;
549 * enum qlink_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID
551 * Refer to &enum nl80211_hidden_ssid
553 enum qlink_hidden_ssid {
554 QLINK_HIDDEN_SSID_NOT_IN_USE,
555 QLINK_HIDDEN_SSID_ZERO_LEN,
556 QLINK_HIDDEN_SSID_ZERO_CONTENTS
560 * struct qlink_cmd_config_ap - data for QLINK_CMD_CONFIG_AP command
562 * @beacon_interval: beacon interval
563 * @inactivity_timeout: station's inactivity period in seconds
564 * @dtim_period: DTIM period
565 * @hidden_ssid: whether to hide the SSID, one of &enum qlink_hidden_ssid
566 * @smps_mode: SMPS mode
567 * @ht_required: stations must support HT
568 * @vht_required: stations must support VHT
569 * @aen: encryption info
570 * @info: variable configurations
572 struct qlink_cmd_config_ap {
573 struct qlink_cmd chdr;
574 __le16 beacon_interval;
575 __le16 inactivity_timeout;
576 u8 dtim_period;
577 u8 hidden_ssid;
578 u8 smps_mode;
579 u8 p2p_ctwindow;
580 u8 p2p_opp_ps;
581 u8 pbss;
582 u8 ht_required;
583 u8 vht_required;
584 struct qlink_auth_encr aen;
585 u8 info[0];
586 } __packed;
588 /* QLINK Command Responses messages related definitions
591 enum qlink_cmd_result {
592 QLINK_CMD_RESULT_OK = 0,
593 QLINK_CMD_RESULT_INVALID,
594 QLINK_CMD_RESULT_ENOTSUPP,
595 QLINK_CMD_RESULT_ENOTFOUND,
596 QLINK_CMD_RESULT_EALREADY,
600 * struct qlink_resp - QLINK command response message header
602 * Header used for QLINK messages of QLINK_MSG_TYPE_CMDRSP type.
604 * @mhdr: see &struct qlink_msg_header.
605 * @cmd_id: command ID the response corresponds to, one of &enum qlink_cmd_type.
606 * @seq_num: sequence number of command message, used for matching with
607 * response message.
608 * @result: result of the command execution, one of &enum qlink_cmd_result.
609 * @macid: index of physical radio device the response is sent from or
610 * QLINK_MACID_RSVD if not applicable.
611 * @vifid: index of virtual wireless interface on specified @macid the response
612 * is sent from or QLINK_VIFID_RSVD if not applicable.
614 struct qlink_resp {
615 struct qlink_msg_header mhdr;
616 __le16 cmd_id;
617 __le16 seq_num;
618 __le16 result;
619 u8 macid;
620 u8 vifid;
621 } __packed;
624 * struct qlink_resp_get_mac_info - response for QLINK_CMD_MAC_INFO command
626 * Data describing specific physical device providing wireless MAC
627 * functionality.
629 * @dev_mac: MAC address of physical WMAC device (used for first BSS on
630 * specified WMAC).
631 * @num_tx_chain: Number of transmit chains used by WMAC.
632 * @num_rx_chain: Number of receive chains used by WMAC.
633 * @vht_cap_mod_mask: mask specifying which VHT capabilities can be altered.
634 * @ht_cap_mod_mask: mask specifying which HT capabilities can be altered.
635 * @bands_cap: wireless bands WMAC can operate in, bitmap of &enum qlink_band.
636 * @max_ap_assoc_sta: Maximum number of associations supported by WMAC.
637 * @radar_detect_widths: bitmask of channels BW for which WMAC can detect radar.
638 * @var_info: variable-length WMAC info data.
640 struct qlink_resp_get_mac_info {
641 struct qlink_resp rhdr;
642 u8 dev_mac[ETH_ALEN];
643 u8 num_tx_chain;
644 u8 num_rx_chain;
645 struct ieee80211_vht_cap vht_cap_mod_mask;
646 struct ieee80211_ht_cap ht_cap_mod_mask;
647 __le16 max_ap_assoc_sta;
648 __le16 radar_detect_widths;
649 u8 bands_cap;
650 u8 rsvd[1];
651 u8 var_info[0];
652 } __packed;
655 * enum qlink_dfs_regions - regulatory DFS regions
657 * Corresponds to &enum nl80211_dfs_regions.
659 enum qlink_dfs_regions {
660 QLINK_DFS_UNSET = 0,
661 QLINK_DFS_FCC = 1,
662 QLINK_DFS_ETSI = 2,
663 QLINK_DFS_JP = 3,
667 * struct qlink_resp_get_hw_info - response for QLINK_CMD_GET_HW_INFO command
669 * Description of wireless hardware capabilities and features.
671 * @fw_ver: wireless hardware firmware version.
672 * @hw_capab: Bitmap of capabilities supported by firmware.
673 * @ql_proto_ver: Version of QLINK protocol used by firmware.
674 * @num_mac: Number of separate physical radio devices provided by hardware.
675 * @mac_bitmap: Bitmap of MAC IDs that are active and can be used in firmware.
676 * @total_tx_chains: total number of transmit chains used by device.
677 * @total_rx_chains: total number of receive chains.
678 * @alpha2: country code ID firmware is configured to.
679 * @n_reg_rules: number of regulatory rules TLVs in variable portion of the
680 * message.
681 * @dfs_region: regulatory DFS region, one of @enum qlink_dfs_region.
682 * @info: variable-length HW info, can contain QTN_TLV_ID_REG_RULE.
684 struct qlink_resp_get_hw_info {
685 struct qlink_resp rhdr;
686 __le32 fw_ver;
687 __le32 hw_capab;
688 __le16 ql_proto_ver;
689 u8 num_mac;
690 u8 mac_bitmap;
691 u8 total_tx_chain;
692 u8 total_rx_chain;
693 u8 alpha2[2];
694 u8 n_reg_rules;
695 u8 dfs_region;
696 u8 info[0];
697 } __packed;
700 * struct qlink_resp_manage_intf - response for interface management commands
702 * Response data for QLINK_CMD_ADD_INTF and QLINK_CMD_CHANGE_INTF commands.
704 * @rhdr: Common Command Response message header.
705 * @intf_info: interface description.
707 struct qlink_resp_manage_intf {
708 struct qlink_resp rhdr;
709 struct qlink_intf_info intf_info;
710 } __packed;
713 * struct qlink_resp_get_sta_info - response for QLINK_CMD_GET_STA_INFO command
715 * Response data containing statistics for specified STA.
717 * @sta_addr: MAC address of STA the response carries statistic for.
718 * @info: statistics for specified STA.
720 struct qlink_resp_get_sta_info {
721 struct qlink_resp rhdr;
722 u8 sta_addr[ETH_ALEN];
723 u8 info[0];
724 } __packed;
727 * struct qlink_resp_band_info_get - response for QLINK_CMD_BAND_INFO_GET cmd
729 * @band: frequency band that the response describes, one of @enum qlink_band.
730 * @num_chans: total number of channels info TLVs contained in reply.
731 * @num_bitrates: total number of bitrate TLVs contained in reply.
732 * @info: variable-length info portion.
734 struct qlink_resp_band_info_get {
735 struct qlink_resp rhdr;
736 u8 band;
737 u8 num_chans;
738 u8 num_bitrates;
739 u8 rsvd[1];
740 u8 info[0];
741 } __packed;
744 * struct qlink_resp_phy_params - response for QLINK_CMD_PHY_PARAMS_GET command
746 * @info: variable-length array of PHY params.
748 struct qlink_resp_phy_params {
749 struct qlink_resp rhdr;
750 u8 info[0];
751 } __packed;
754 * struct qlink_resp_get_chan_stats - response for QLINK_CMD_CHAN_STATS cmd
756 * @info: variable-length channel info.
758 struct qlink_resp_get_chan_stats {
759 struct qlink_cmd rhdr;
760 u8 info[0];
761 } __packed;
764 * struct qlink_resp_channel_get - response for QLINK_CMD_CHAN_GET command
766 * @chan: definition of current operating channel.
768 struct qlink_resp_channel_get {
769 struct qlink_resp rhdr;
770 struct qlink_chandef chan;
771 } __packed;
773 /* QLINK Events messages related definitions
776 enum qlink_event_type {
777 QLINK_EVENT_STA_ASSOCIATED = 0x0021,
778 QLINK_EVENT_STA_DEAUTH = 0x0022,
779 QLINK_EVENT_MGMT_RECEIVED = 0x0023,
780 QLINK_EVENT_SCAN_RESULTS = 0x0024,
781 QLINK_EVENT_SCAN_COMPLETE = 0x0025,
782 QLINK_EVENT_BSS_JOIN = 0x0026,
783 QLINK_EVENT_BSS_LEAVE = 0x0027,
784 QLINK_EVENT_FREQ_CHANGE = 0x0028,
788 * struct qlink_event - QLINK event message header
790 * Header used for QLINK messages of QLINK_MSG_TYPE_EVENT type.
792 * @mhdr: Common QLINK message header.
793 * @event_id: Specifies specific event ID, one of &enum qlink_event_type.
794 * @macid: index of physical radio device the event was generated on or
795 * QLINK_MACID_RSVD if not applicable.
796 * @vifid: index of virtual wireless interface on specified @macid the event
797 * was generated on or QLINK_VIFID_RSVD if not applicable.
799 struct qlink_event {
800 struct qlink_msg_header mhdr;
801 __le16 event_id;
802 u8 macid;
803 u8 vifid;
804 } __packed;
807 * struct qlink_event_sta_assoc - data for QLINK_EVENT_STA_ASSOCIATED event
809 * @sta_addr: Address of a STA for which new association event was generated
810 * @frame_control: control bits from 802.11 ASSOC_REQUEST header.
811 * @payload: IEs from association request.
813 struct qlink_event_sta_assoc {
814 struct qlink_event ehdr;
815 u8 sta_addr[ETH_ALEN];
816 __le16 frame_control;
817 u8 ies[0];
818 } __packed;
821 * struct qlink_event_sta_deauth - data for QLINK_EVENT_STA_DEAUTH event
823 * @sta_addr: Address of a deauthenticated STA.
824 * @reason: reason for deauthentication.
826 struct qlink_event_sta_deauth {
827 struct qlink_event ehdr;
828 u8 sta_addr[ETH_ALEN];
829 __le16 reason;
830 } __packed;
833 * struct qlink_event_bss_join - data for QLINK_EVENT_BSS_JOIN event
835 * @bssid: BSSID of a BSS which interface tried to joined.
836 * @status: status of joining attempt, see &enum ieee80211_statuscode.
838 struct qlink_event_bss_join {
839 struct qlink_event ehdr;
840 u8 bssid[ETH_ALEN];
841 __le16 status;
842 } __packed;
845 * struct qlink_event_bss_leave - data for QLINK_EVENT_BSS_LEAVE event
847 * @reason: reason of disconnecting from BSS.
849 struct qlink_event_bss_leave {
850 struct qlink_event ehdr;
851 __le16 reason;
852 } __packed;
855 * struct qlink_event_freq_change - data for QLINK_EVENT_FREQ_CHANGE event
857 * @chan: new operating channel definition
859 struct qlink_event_freq_change {
860 struct qlink_event ehdr;
861 struct qlink_chandef chan;
862 } __packed;
864 enum qlink_rxmgmt_flags {
865 QLINK_RXMGMT_FLAG_ANSWERED = 1 << 0,
869 * struct qlink_event_rxmgmt - data for QLINK_EVENT_MGMT_RECEIVED event
871 * @freq: Frequency on which the frame was received in MHz.
872 * @sig_dbm: signal strength in dBm.
873 * @flags: bitmap of &enum qlink_rxmgmt_flags.
874 * @frame_data: data of Rx'd frame itself.
876 struct qlink_event_rxmgmt {
877 struct qlink_event ehdr;
878 __le32 freq;
879 __le32 sig_dbm;
880 __le32 flags;
881 u8 frame_data[0];
882 } __packed;
885 * struct qlink_event_scan_result - data for QLINK_EVENT_SCAN_RESULTS event
887 * @tsf: TSF timestamp indicating when scan results were generated.
888 * @freq: Center frequency of the channel where BSS for which the scan result
889 * event was generated was discovered.
890 * @capab: capabilities field.
891 * @bintval: beacon interval announced by discovered BSS.
892 * @signal: signal strength.
893 * @bssid: BSSID announced by discovered BSS.
894 * @ssid_len: length of SSID announced by BSS.
895 * @ssid: SSID announced by discovered BSS.
896 * @payload: IEs that are announced by discovered BSS in its MGMt frames.
898 struct qlink_event_scan_result {
899 struct qlink_event ehdr;
900 __le64 tsf;
901 __le16 freq;
902 __le16 capab;
903 __le16 bintval;
904 s8 signal;
905 u8 ssid_len;
906 u8 ssid[IEEE80211_MAX_SSID_LEN];
907 u8 bssid[ETH_ALEN];
908 u8 rsvd[2];
909 u8 payload[0];
910 } __packed;
913 * enum qlink_scan_complete_flags - indicates result of scan request.
915 * @QLINK_SCAN_NONE: Scan request was processed.
916 * @QLINK_SCAN_ABORTED: Scan was aborted.
918 enum qlink_scan_complete_flags {
919 QLINK_SCAN_NONE = 0,
920 QLINK_SCAN_ABORTED = BIT(0),
924 * struct qlink_event_scan_complete - data for QLINK_EVENT_SCAN_COMPLETE event
926 * @flags: flags indicating the status of pending scan request,
927 * see &enum qlink_scan_complete_flags.
929 struct qlink_event_scan_complete {
930 struct qlink_event ehdr;
931 __le32 flags;
932 } __packed;
934 /* QLINK TLVs (Type-Length Values) definitions
937 enum qlink_tlv_id {
938 QTN_TLV_ID_FRAG_THRESH = 0x0201,
939 QTN_TLV_ID_RTS_THRESH = 0x0202,
940 QTN_TLV_ID_SRETRY_LIMIT = 0x0203,
941 QTN_TLV_ID_LRETRY_LIMIT = 0x0204,
942 QTN_TLV_ID_REG_RULE = 0x0207,
943 QTN_TLV_ID_CHANNEL = 0x020F,
944 QTN_TLV_ID_CHANDEF = 0x0210,
945 QTN_TLV_ID_COVERAGE_CLASS = 0x0213,
946 QTN_TLV_ID_IFACE_LIMIT = 0x0214,
947 QTN_TLV_ID_NUM_IFACE_COMB = 0x0215,
948 QTN_TLV_ID_CHANNEL_STATS = 0x0216,
949 QTN_TLV_ID_STA_BASIC_COUNTERS = 0x0300,
950 QTN_TLV_ID_STA_GENERIC_INFO = 0x0301,
951 QTN_TLV_ID_KEY = 0x0302,
952 QTN_TLV_ID_SEQ = 0x0303,
953 QTN_TLV_ID_IE_SET = 0x0305,
956 struct qlink_tlv_hdr {
957 __le16 type;
958 __le16 len;
959 u8 val[0];
960 } __packed;
962 struct qlink_iface_limit {
963 __le16 max_num;
964 __le16 type;
965 } __packed;
967 struct qlink_iface_comb_num {
968 __le16 iface_comb_num;
969 } __packed;
971 struct qlink_sta_stat_basic_counters {
972 __le64 rx_bytes;
973 __le64 tx_bytes;
974 __le64 rx_beacons;
975 __le32 rx_packets;
976 __le32 tx_packets;
977 __le32 rx_dropped;
978 __le32 tx_failed;
979 } __packed;
981 enum qlink_sta_info_rate_flags {
982 QLINK_STA_INFO_RATE_FLAG_INVALID = 0,
983 QLINK_STA_INFO_RATE_FLAG_HT_MCS = BIT(0),
984 QLINK_STA_INFO_RATE_FLAG_VHT_MCS = BIT(1),
985 QLINK_STA_INFO_RATE_FLAG_SHORT_GI = BIT(2),
986 QLINK_STA_INFO_RATE_FLAG_60G = BIT(3),
989 enum qlink_sta_info_rate_bw {
990 QLINK_STA_INFO_RATE_BW_5 = 0,
991 QLINK_STA_INFO_RATE_BW_10 = 1,
992 QLINK_STA_INFO_RATE_BW_20 = 2,
993 QLINK_STA_INFO_RATE_BW_40 = 3,
994 QLINK_STA_INFO_RATE_BW_80 = 4,
995 QLINK_STA_INFO_RATE_BW_160 = 5,
999 * struct qlink_sta_info_rate - STA rate statistics
1001 * @rate: data rate in Mbps.
1002 * @flags: bitmap of &enum qlink_sta_flags.
1003 * @mcs: 802.11-defined MCS index.
1004 * nss: Number of Spatial Streams.
1005 * @bw: bandwidth, one of &enum qlink_sta_info_rate_bw.
1007 struct qlink_sta_info_rate {
1008 __le16 rate;
1009 u8 flags;
1010 u8 mcs;
1011 u8 nss;
1012 u8 bw;
1013 } __packed;
1015 struct qlink_sta_info_state {
1016 __le32 mask;
1017 __le32 value;
1018 } __packed;
1020 #define QLINK_RSSI_OFFSET 120
1022 struct qlink_sta_info_generic {
1023 struct qlink_sta_info_state state;
1024 __le32 connected_time;
1025 __le32 inactive_time;
1026 struct qlink_sta_info_rate rx_rate;
1027 struct qlink_sta_info_rate tx_rate;
1028 u8 rssi;
1029 u8 rssi_avg;
1030 } __packed;
1032 struct qlink_tlv_frag_rts_thr {
1033 struct qlink_tlv_hdr hdr;
1034 __le16 thr;
1035 } __packed;
1037 struct qlink_tlv_rlimit {
1038 struct qlink_tlv_hdr hdr;
1039 u8 rlimit;
1040 } __packed;
1042 struct qlink_tlv_cclass {
1043 struct qlink_tlv_hdr hdr;
1044 u8 cclass;
1045 } __packed;
1048 * enum qlink_reg_rule_flags - regulatory rule flags
1050 * See description of &enum nl80211_reg_rule_flags
1052 enum qlink_reg_rule_flags {
1053 QLINK_RRF_NO_OFDM = BIT(0),
1054 QLINK_RRF_NO_CCK = BIT(1),
1055 QLINK_RRF_NO_INDOOR = BIT(2),
1056 QLINK_RRF_NO_OUTDOOR = BIT(3),
1057 QLINK_RRF_DFS = BIT(4),
1058 QLINK_RRF_PTP_ONLY = BIT(5),
1059 QLINK_RRF_PTMP_ONLY = BIT(6),
1060 QLINK_RRF_NO_IR = BIT(7),
1061 QLINK_RRF_AUTO_BW = BIT(8),
1062 QLINK_RRF_IR_CONCURRENT = BIT(9),
1063 QLINK_RRF_NO_HT40MINUS = BIT(10),
1064 QLINK_RRF_NO_HT40PLUS = BIT(11),
1065 QLINK_RRF_NO_80MHZ = BIT(12),
1066 QLINK_RRF_NO_160MHZ = BIT(13),
1070 * struct qlink_tlv_reg_rule - data for QTN_TLV_ID_REG_RULE TLV
1072 * Regulatory rule description.
1074 * @start_freq_khz: start frequency of the range the rule is attributed to.
1075 * @end_freq_khz: end frequency of the range the rule is attributed to.
1076 * @max_bandwidth_khz: max bandwidth that channels in specified range can be
1077 * configured to.
1078 * @max_antenna_gain: max antenna gain that can be used in the specified
1079 * frequency range, dBi.
1080 * @max_eirp: maximum EIRP.
1081 * @flags: regulatory rule flags in &enum qlink_reg_rule_flags.
1082 * @dfs_cac_ms: DFS CAC period.
1084 struct qlink_tlv_reg_rule {
1085 struct qlink_tlv_hdr hdr;
1086 __le32 start_freq_khz;
1087 __le32 end_freq_khz;
1088 __le32 max_bandwidth_khz;
1089 __le32 max_antenna_gain;
1090 __le32 max_eirp;
1091 __le32 flags;
1092 __le32 dfs_cac_ms;
1093 } __packed;
1095 enum qlink_channel_flags {
1096 QLINK_CHAN_DISABLED = BIT(0),
1097 QLINK_CHAN_NO_IR = BIT(1),
1098 QLINK_CHAN_RADAR = BIT(3),
1099 QLINK_CHAN_NO_HT40PLUS = BIT(4),
1100 QLINK_CHAN_NO_HT40MINUS = BIT(5),
1101 QLINK_CHAN_NO_OFDM = BIT(6),
1102 QLINK_CHAN_NO_80MHZ = BIT(7),
1103 QLINK_CHAN_NO_160MHZ = BIT(8),
1104 QLINK_CHAN_INDOOR_ONLY = BIT(9),
1105 QLINK_CHAN_IR_CONCURRENT = BIT(10),
1106 QLINK_CHAN_NO_20MHZ = BIT(11),
1107 QLINK_CHAN_NO_10MHZ = BIT(12),
1110 enum qlink_dfs_state {
1111 QLINK_DFS_USABLE,
1112 QLINK_DFS_UNAVAILABLE,
1113 QLINK_DFS_AVAILABLE,
1116 struct qlink_tlv_channel {
1117 struct qlink_tlv_hdr hdr;
1118 __le16 hw_value;
1119 __le16 center_freq;
1120 __le32 flags;
1121 u8 band;
1122 u8 max_antenna_gain;
1123 u8 max_power;
1124 u8 max_reg_power;
1125 __le32 dfs_cac_ms;
1126 u8 dfs_state;
1127 u8 beacon_found;
1128 u8 rsvd[2];
1129 } __packed;
1132 * struct qlink_tlv_chandef - data for QTN_TLV_ID_CHANDEF TLV
1134 * Channel definition.
1136 * @chan: channel definition data.
1138 struct qlink_tlv_chandef {
1139 struct qlink_tlv_hdr hdr;
1140 struct qlink_chandef chan;
1141 } __packed;
1143 enum qlink_ie_set_type {
1144 QLINK_IE_SET_UNKNOWN,
1145 QLINK_IE_SET_ASSOC_REQ,
1146 QLINK_IE_SET_ASSOC_RESP,
1147 QLINK_IE_SET_PROBE_REQ,
1148 QLINK_IE_SET_SCAN,
1149 QLINK_IE_SET_BEACON_HEAD,
1150 QLINK_IE_SET_BEACON_TAIL,
1151 QLINK_IE_SET_BEACON_IES,
1152 QLINK_IE_SET_PROBE_RESP,
1153 QLINK_IE_SET_PROBE_RESP_IES,
1157 * struct qlink_tlv_ie_set - data for QTN_TLV_ID_IE_SET
1159 * @type: type of MGMT frame IEs belong to, one of &enum qlink_ie_set_type.
1160 * @flags: for future use.
1161 * @ie_data: IEs data.
1163 struct qlink_tlv_ie_set {
1164 struct qlink_tlv_hdr hdr;
1165 u8 type;
1166 u8 flags;
1167 u8 ie_data[0];
1168 } __packed;
1170 struct qlink_chan_stats {
1171 __le32 chan_num;
1172 __le32 cca_tx;
1173 __le32 cca_rx;
1174 __le32 cca_busy;
1175 __le32 cca_try;
1176 s8 chan_noise;
1177 } __packed;
1179 #endif /* _QTN_QLINK_H_ */