2 * Copyright (c) 2015-2016 Quantenna Communications, Inc.
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.
20 #include <linux/ieee80211.h>
22 #define QLINK_PROTO_VER 11
24 #define QLINK_MACID_RSVD 0xFF
25 #define QLINK_VIFID_RSVD 0xFF
27 /* Common QLINK protocol messages definitions.
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.
43 QLINK_MSG_TYPE_CMD = 1,
44 QLINK_MSG_TYPE_CMDRSP = 2,
45 QLINK_MSG_TYPE_EVENT = 3
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 {
61 /* Generic definitions of data and information carried in QLINK messages
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.
71 * @QLINK_HW_CAPAB_DFS_OFFLOAD: device implements DFS offload functionality
72 * @QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR: device supports MAC Address
73 * Randomization in probe requests.
74 * @QLINK_HW_CAPAB_OBSS_SCAN: device can perform OBSS scanning.
77 QLINK_HW_CAPAB_REG_UPDATE = BIT(0),
78 QLINK_HW_CAPAB_STA_INACT_TIMEOUT = BIT(1),
79 QLINK_HW_CAPAB_DFS_OFFLOAD = BIT(2),
80 QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR = BIT(3),
81 QLINK_HW_CAPAB_PWR_MGMT = BIT(4),
82 QLINK_HW_CAPAB_OBSS_SCAN = BIT(5),
85 enum qlink_iface_type {
87 QLINK_IFTYPE_STATION = 2,
88 QLINK_IFTYPE_ADHOC = 3,
89 QLINK_IFTYPE_MONITOR = 4,
91 QLINK_IFTYPE_AP_VLAN = 6,
95 * struct qlink_intf_info - information on virtual interface.
97 * Data describing a single virtual interface.
99 * @if_type: Mode of interface operation, one of &enum qlink_iface_type
100 * @vlanid: VLAN ID for AP_VLAN interface type
101 * @mac_addr: MAC address of virtual interface.
103 struct qlink_intf_info {
106 u8 mac_addr[ETH_ALEN];
110 enum qlink_sta_flags {
111 QLINK_STA_FLAG_INVALID = 0,
112 QLINK_STA_FLAG_AUTHORIZED = BIT(0),
113 QLINK_STA_FLAG_SHORT_PREAMBLE = BIT(1),
114 QLINK_STA_FLAG_WME = BIT(2),
115 QLINK_STA_FLAG_MFP = BIT(3),
116 QLINK_STA_FLAG_AUTHENTICATED = BIT(4),
117 QLINK_STA_FLAG_TDLS_PEER = BIT(5),
118 QLINK_STA_FLAG_ASSOCIATED = BIT(6),
121 enum qlink_channel_width {
122 QLINK_CHAN_WIDTH_5 = 0,
124 QLINK_CHAN_WIDTH_20_NOHT,
128 QLINK_CHAN_WIDTH_80P80,
129 QLINK_CHAN_WIDTH_160,
133 * struct qlink_channel - qlink control channel definition
135 * @hw_value: hardware-specific value for the channel
136 * @center_freq: center frequency in MHz
137 * @flags: channel flags from &enum qlink_channel_flags
138 * @band: band this channel belongs to
139 * @max_antenna_gain: maximum antenna gain in dBi
140 * @max_power: maximum transmission power (in dBm)
141 * @max_reg_power: maximum regulatory transmission power (in dBm)
142 * @dfs_state: current state of this channel.
143 * Only relevant if radar is required on this channel.
144 * @beacon_found: helper to regulatory code to indicate when a beacon
145 * has been found on this channel. Use regulatory_hint_found_beacon()
146 * to enable this, this is useful only on 5 GHz band.
148 struct qlink_channel {
163 * struct qlink_chandef - qlink channel definition
165 * @chan: primary channel definition
166 * @center_freq1: center frequency of first segment
167 * @center_freq2: center frequency of second segment (80+80 only)
168 * @width: channel width, one of @enum qlink_channel_width
170 struct qlink_chandef {
171 struct qlink_channel chan;
178 #define QLINK_MAX_NR_CIPHER_SUITES 5
179 #define QLINK_MAX_NR_AKM_SUITES 2
181 struct qlink_auth_encr {
184 __le32 n_ciphers_pairwise;
185 __le32 ciphers_pairwise[QLINK_MAX_NR_CIPHER_SUITES];
187 __le32 akm_suites[QLINK_MAX_NR_AKM_SUITES];
188 __le16 control_port_ethertype;
192 u8 control_port_no_encrypt;
197 * struct qlink_sta_info_state - station flags mask/value
199 * @mask: STA flags mask, bitmap of &enum qlink_sta_flags
200 * @value: STA flags values, bitmap of &enum qlink_sta_flags
202 struct qlink_sta_info_state {
207 /* QLINK Command messages related definitions
211 * enum qlink_cmd_type - list of supported commands
213 * Commands are QLINK messages of type @QLINK_MSG_TYPE_CMD, sent by driver to
214 * wireless network device for processing. Device is expected to send back a
215 * reply message of type &QLINK_MSG_TYPE_CMDRSP, containing at least command
216 * execution status (one of &enum qlink_cmd_result). Reply message
217 * may also contain data payload specific to the command type.
219 * @QLINK_CMD_BAND_INFO_GET: for the specified MAC and specified band, get
220 * the band's description including number of operational channels and
221 * info on each channel, HT/VHT capabilities, supported rates etc.
222 * This command is generic to a specified MAC, interface index must be set
223 * to QLINK_VIFID_RSVD in command header.
224 * @QLINK_CMD_REG_NOTIFY: notify device about regulatory domain change. This
225 * command is supported only if device reports QLINK_HW_SUPPORTS_REG_UPDATE
227 * @QLINK_CMD_START_CAC: start radar detection procedure on a specified channel.
229 enum qlink_cmd_type {
230 QLINK_CMD_FW_INIT = 0x0001,
231 QLINK_CMD_FW_DEINIT = 0x0002,
232 QLINK_CMD_REGISTER_MGMT = 0x0003,
233 QLINK_CMD_SEND_MGMT_FRAME = 0x0004,
234 QLINK_CMD_MGMT_SET_APPIE = 0x0005,
235 QLINK_CMD_PHY_PARAMS_GET = 0x0011,
236 QLINK_CMD_PHY_PARAMS_SET = 0x0012,
237 QLINK_CMD_GET_HW_INFO = 0x0013,
238 QLINK_CMD_MAC_INFO = 0x0014,
239 QLINK_CMD_ADD_INTF = 0x0015,
240 QLINK_CMD_DEL_INTF = 0x0016,
241 QLINK_CMD_CHANGE_INTF = 0x0017,
242 QLINK_CMD_UPDOWN_INTF = 0x0018,
243 QLINK_CMD_REG_NOTIFY = 0x0019,
244 QLINK_CMD_BAND_INFO_GET = 0x001A,
245 QLINK_CMD_CHAN_SWITCH = 0x001B,
246 QLINK_CMD_CHAN_GET = 0x001C,
247 QLINK_CMD_START_CAC = 0x001D,
248 QLINK_CMD_START_AP = 0x0021,
249 QLINK_CMD_STOP_AP = 0x0022,
250 QLINK_CMD_SET_MAC_ACL = 0x0023,
251 QLINK_CMD_GET_STA_INFO = 0x0030,
252 QLINK_CMD_ADD_KEY = 0x0040,
253 QLINK_CMD_DEL_KEY = 0x0041,
254 QLINK_CMD_SET_DEFAULT_KEY = 0x0042,
255 QLINK_CMD_SET_DEFAULT_MGMT_KEY = 0x0043,
256 QLINK_CMD_CHANGE_STA = 0x0051,
257 QLINK_CMD_DEL_STA = 0x0052,
258 QLINK_CMD_SCAN = 0x0053,
259 QLINK_CMD_CHAN_STATS = 0x0054,
260 QLINK_CMD_CONNECT = 0x0060,
261 QLINK_CMD_DISCONNECT = 0x0061,
262 QLINK_CMD_PM_SET = 0x0062,
263 QLINK_CMD_WOWLAN_SET = 0x0063,
267 * struct qlink_cmd - QLINK command message header
269 * Header used for QLINK messages of QLINK_MSG_TYPE_CMD type.
271 * @mhdr: Common QLINK message header.
272 * @cmd_id: command id, one of &enum qlink_cmd_type.
273 * @seq_num: sequence number of command message, used for matching with
275 * @macid: index of physical radio device the command is destined to or
276 * QLINK_MACID_RSVD if not applicable.
277 * @vifid: index of virtual wireless interface on specified @macid the command
278 * is destined to or QLINK_VIFID_RSVD if not applicable.
281 struct qlink_msg_header mhdr;
290 * struct qlink_cmd_manage_intf - interface management command
292 * Data for interface management commands QLINK_CMD_ADD_INTF, QLINK_CMD_DEL_INTF
293 * and QLINK_CMD_CHANGE_INTF.
295 * @intf_info: interface description.
297 struct qlink_cmd_manage_intf {
298 struct qlink_cmd chdr;
299 struct qlink_intf_info intf_info;
302 enum qlink_mgmt_frame_type {
303 QLINK_MGMT_FRAME_ASSOC_REQ = 0x00,
304 QLINK_MGMT_FRAME_ASSOC_RESP = 0x01,
305 QLINK_MGMT_FRAME_REASSOC_REQ = 0x02,
306 QLINK_MGMT_FRAME_REASSOC_RESP = 0x03,
307 QLINK_MGMT_FRAME_PROBE_REQ = 0x04,
308 QLINK_MGMT_FRAME_PROBE_RESP = 0x05,
309 QLINK_MGMT_FRAME_BEACON = 0x06,
310 QLINK_MGMT_FRAME_ATIM = 0x07,
311 QLINK_MGMT_FRAME_DISASSOC = 0x08,
312 QLINK_MGMT_FRAME_AUTH = 0x09,
313 QLINK_MGMT_FRAME_DEAUTH = 0x0A,
314 QLINK_MGMT_FRAME_ACTION = 0x0B,
316 QLINK_MGMT_FRAME_TYPE_COUNT
320 * struct qlink_cmd_mgmt_frame_register - data for QLINK_CMD_REGISTER_MGMT
322 * @frame_type: MGMT frame type the registration request describes, one of
323 * &enum qlink_mgmt_frame_type.
324 * @do_register: 0 - unregister, otherwise register for reception of specified
327 struct qlink_cmd_mgmt_frame_register {
328 struct qlink_cmd chdr;
333 enum qlink_mgmt_frame_tx_flags {
334 QLINK_MGMT_FRAME_TX_FLAG_NONE = 0,
335 QLINK_MGMT_FRAME_TX_FLAG_OFFCHAN = BIT(0),
336 QLINK_MGMT_FRAME_TX_FLAG_NO_CCK = BIT(1),
337 QLINK_MGMT_FRAME_TX_FLAG_ACK_NOWAIT = BIT(2),
341 * struct qlink_cmd_mgmt_frame_tx - data for QLINK_CMD_SEND_MGMT_FRAME command
343 * @cookie: opaque request identifier.
344 * @freq: Frequency to use for frame transmission.
345 * @flags: Transmission flags, one of &enum qlink_mgmt_frame_tx_flags.
346 * @frame_data: frame to transmit.
348 struct qlink_cmd_mgmt_frame_tx {
349 struct qlink_cmd chdr;
357 * struct qlink_cmd_get_sta_info - data for QLINK_CMD_GET_STA_INFO command
359 * @sta_addr: MAC address of the STA statistics is requested for.
361 struct qlink_cmd_get_sta_info {
362 struct qlink_cmd chdr;
363 u8 sta_addr[ETH_ALEN];
367 * struct qlink_cmd_add_key - data for QLINK_CMD_ADD_KEY command.
369 * @key_index: index of the key being installed.
370 * @pairwise: whether to use pairwise key.
371 * @addr: MAC address of a STA key is being installed to.
372 * @cipher: cipher suite.
373 * @vlanid: VLAN ID for AP_VLAN interface type
374 * @key_data: key data itself.
376 struct qlink_cmd_add_key {
377 struct qlink_cmd chdr;
387 * struct qlink_cmd_del_key_req - data for QLINK_CMD_DEL_KEY command
389 * @key_index: index of the key being removed.
390 * @pairwise: whether to use pairwise key.
391 * @addr: MAC address of a STA for which a key is removed.
393 struct qlink_cmd_del_key {
394 struct qlink_cmd chdr;
401 * struct qlink_cmd_set_def_key - data for QLINK_CMD_SET_DEFAULT_KEY command
403 * @key_index: index of the key to be set as default one.
404 * @unicast: key is unicast.
405 * @multicast: key is multicast.
407 struct qlink_cmd_set_def_key {
408 struct qlink_cmd chdr;
415 * struct qlink_cmd_set_def_mgmt_key - data for QLINK_CMD_SET_DEFAULT_MGMT_KEY
417 * @key_index: index of the key to be set as default MGMT key.
419 struct qlink_cmd_set_def_mgmt_key {
420 struct qlink_cmd chdr;
425 * struct qlink_cmd_change_sta - data for QLINK_CMD_CHANGE_STA command
427 * @flag_update: STA flags to update
428 * @if_type: Mode of interface operation, one of &enum qlink_iface_type
429 * @vlanid: VLAN ID to assign to specific STA
430 * @sta_addr: address of the STA for which parameters are set.
432 struct qlink_cmd_change_sta {
433 struct qlink_cmd chdr;
434 struct qlink_sta_info_state flag_update;
437 u8 sta_addr[ETH_ALEN];
441 * struct qlink_cmd_del_sta - data for QLINK_CMD_DEL_STA command.
443 * See &struct station_del_parameters
445 struct qlink_cmd_del_sta {
446 struct qlink_cmd chdr;
449 u8 sta_addr[ETH_ALEN];
452 enum qlink_sta_connect_flags {
453 QLINK_STA_CONNECT_DISABLE_HT = BIT(0),
454 QLINK_STA_CONNECT_DISABLE_VHT = BIT(1),
455 QLINK_STA_CONNECT_USE_RRM = BIT(2),
459 * struct qlink_cmd_connect - data for QLINK_CMD_CONNECT command
461 * @bssid: BSSID of the BSS to connect to.
462 * @bssid_hint: recommended AP BSSID for initial connection to the BSS or
463 * 00:00:00:00:00:00 if not specified.
464 * @prev_bssid: previous BSSID, if specified (not 00:00:00:00:00:00) indicates
465 * a request to reassociate.
466 * @bg_scan_period: period of background scan.
467 * @flags: one of &enum qlink_sta_connect_flags.
468 * @ht_capa: HT Capabilities overrides.
469 * @ht_capa_mask: The bits of ht_capa which are to be used.
470 * @vht_capa: VHT Capability overrides
471 * @vht_capa_mask: The bits of vht_capa which are to be used.
472 * @aen: authentication information.
473 * @mfp: whether to use management frame protection.
474 * @payload: variable portion of connection request.
476 struct qlink_cmd_connect {
477 struct qlink_cmd chdr;
479 u8 bssid_hint[ETH_ALEN];
480 u8 prev_bssid[ETH_ALEN];
481 __le16 bg_scan_period;
483 struct ieee80211_ht_cap ht_capa;
484 struct ieee80211_ht_cap ht_capa_mask;
485 struct ieee80211_vht_cap vht_capa;
486 struct ieee80211_vht_cap vht_capa_mask;
487 struct qlink_auth_encr aen;
495 * struct qlink_cmd_disconnect - data for QLINK_CMD_DISCONNECT command
497 * @reason: code of the reason of disconnect, see &enum ieee80211_reasoncode.
499 struct qlink_cmd_disconnect {
500 struct qlink_cmd chdr;
505 * struct qlink_cmd_updown - data for QLINK_CMD_UPDOWN_INTF command
507 * @if_up: bring specified interface DOWN (if_up==0) or UP (otherwise).
508 * Interface is specified in common command header @chdr.
510 struct qlink_cmd_updown {
511 struct qlink_cmd chdr;
516 * enum qlink_band - a list of frequency bands
518 * @QLINK_BAND_2GHZ: 2.4GHz band
519 * @QLINK_BAND_5GHZ: 5GHz band
520 * @QLINK_BAND_60GHZ: 60GHz band
523 QLINK_BAND_2GHZ = BIT(0),
524 QLINK_BAND_5GHZ = BIT(1),
525 QLINK_BAND_60GHZ = BIT(2),
529 * struct qlink_cmd_band_info_get - data for QLINK_CMD_BAND_INFO_GET command
531 * @band: a PHY band for which information is queried, one of @enum qlink_band
533 struct qlink_cmd_band_info_get {
534 struct qlink_cmd chdr;
539 * struct qlink_cmd_get_chan_stats - data for QLINK_CMD_CHAN_STATS command
541 * @channel: channel number according to 802.11 17.3.8.3.2 and Annex J
543 struct qlink_cmd_get_chan_stats {
544 struct qlink_cmd chdr;
549 * enum qlink_reg_initiator - Indicates the initiator of a reg domain request
551 * See &enum nl80211_reg_initiator for more info.
553 enum qlink_reg_initiator {
554 QLINK_REGDOM_SET_BY_CORE,
555 QLINK_REGDOM_SET_BY_USER,
556 QLINK_REGDOM_SET_BY_DRIVER,
557 QLINK_REGDOM_SET_BY_COUNTRY_IE,
561 * enum qlink_user_reg_hint_type - type of user regulatory hint
563 * See &enum nl80211_user_reg_hint_type for more info.
565 enum qlink_user_reg_hint_type {
566 QLINK_USER_REG_HINT_USER = 0,
567 QLINK_USER_REG_HINT_CELL_BASE = 1,
568 QLINK_USER_REG_HINT_INDOOR = 2,
572 * struct qlink_cmd_reg_notify - data for QLINK_CMD_REG_NOTIFY command
574 * @alpha2: the ISO / IEC 3166 alpha2 country code.
575 * @initiator: which entity sent the request, one of &enum qlink_reg_initiator.
576 * @user_reg_hint_type: type of hint for QLINK_REGDOM_SET_BY_USER request, one
577 * of &enum qlink_user_reg_hint_type.
579 struct qlink_cmd_reg_notify {
580 struct qlink_cmd chdr;
583 u8 user_reg_hint_type;
587 * struct qlink_cmd_chan_switch - data for QLINK_CMD_CHAN_SWITCH command
589 * @channel: channel number according to 802.11 17.3.8.3.2 and Annex J
590 * @radar_required: whether radar detection is required on the new channel
591 * @block_tx: whether transmissions should be blocked while changing
592 * @beacon_count: number of beacons until switch
594 struct qlink_cmd_chan_switch {
595 struct qlink_cmd chdr;
603 * enum qlink_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID
605 * Refer to &enum nl80211_hidden_ssid
607 enum qlink_hidden_ssid {
608 QLINK_HIDDEN_SSID_NOT_IN_USE,
609 QLINK_HIDDEN_SSID_ZERO_LEN,
610 QLINK_HIDDEN_SSID_ZERO_CONTENTS
614 * struct qlink_cmd_start_ap - data for QLINK_CMD_START_AP command
616 * @beacon_interval: beacon interval
617 * @inactivity_timeout: station's inactivity period in seconds
618 * @dtim_period: DTIM period
619 * @hidden_ssid: whether to hide the SSID, one of &enum qlink_hidden_ssid
620 * @smps_mode: SMPS mode
621 * @ht_required: stations must support HT
622 * @vht_required: stations must support VHT
623 * @aen: encryption info
624 * @info: variable configurations
626 struct qlink_cmd_start_ap {
627 struct qlink_cmd chdr;
628 __le16 beacon_interval;
629 __le16 inactivity_timeout;
638 struct qlink_auth_encr aen;
643 * struct qlink_cmd_start_cac - data for QLINK_CMD_START_CAC command
645 * @chan: a channel to start a radar detection procedure on.
646 * @cac_time_ms: CAC time.
648 struct qlink_cmd_start_cac {
649 struct qlink_cmd chdr;
650 struct qlink_chandef chan;
654 enum qlink_acl_policy {
655 QLINK_ACL_POLICY_ACCEPT_UNLESS_LISTED,
656 QLINK_ACL_POLICY_DENY_UNLESS_LISTED,
659 struct qlink_mac_address {
664 * struct qlink_acl_data - ACL data
666 * @policy: filter policy, one of &enum qlink_acl_policy.
667 * @num_entries: number of MAC addresses in array.
668 * @mac_address: MAC addresses array.
670 struct qlink_acl_data {
673 struct qlink_mac_address mac_addrs[0];
677 * enum qlink_pm_mode - Power Management mode
679 * @QLINK_PM_OFF: normal mode, no power saving enabled
680 * @QLINK_PM_AUTO_STANDBY: enable auto power save mode
684 QLINK_PM_AUTO_STANDBY = 1,
688 * struct qlink_cmd_pm_set - data for QLINK_CMD_PM_SET command
690 * @pm_standby timer: period of network inactivity in seconds before
691 * putting a radio in power save mode
692 * @pm_mode: power management mode
694 struct qlink_cmd_pm_set {
695 struct qlink_cmd chdr;
696 __le32 pm_standby_timer;
701 * enum qlink_wowlan_trigger
703 * @QLINK_WOWLAN_TRIG_DISCONNECT: wakeup on disconnect
704 * @QLINK_WOWLAN_TRIG_MAGIC_PKT: wakeup on magic packet
705 * @QLINK_WOWLAN_TRIG_PATTERN_PKT: wakeup on user-defined packet
707 enum qlink_wowlan_trigger {
708 QLINK_WOWLAN_TRIG_DISCONNECT = BIT(0),
709 QLINK_WOWLAN_TRIG_MAGIC_PKT = BIT(1),
710 QLINK_WOWLAN_TRIG_PATTERN_PKT = BIT(2),
714 * struct qlink_cmd_wowlan_set - data for QLINK_CMD_WOWLAN_SET command
716 * @triggers: requested bitmask of WoWLAN triggers
718 struct qlink_cmd_wowlan_set {
719 struct qlink_cmd chdr;
724 /* QLINK Command Responses messages related definitions
727 enum qlink_cmd_result {
728 QLINK_CMD_RESULT_OK = 0,
729 QLINK_CMD_RESULT_INVALID,
730 QLINK_CMD_RESULT_ENOTSUPP,
731 QLINK_CMD_RESULT_ENOTFOUND,
732 QLINK_CMD_RESULT_EALREADY,
733 QLINK_CMD_RESULT_EADDRINUSE,
734 QLINK_CMD_RESULT_EADDRNOTAVAIL,
738 * struct qlink_resp - QLINK command response message header
740 * Header used for QLINK messages of QLINK_MSG_TYPE_CMDRSP type.
742 * @mhdr: see &struct qlink_msg_header.
743 * @cmd_id: command ID the response corresponds to, one of &enum qlink_cmd_type.
744 * @seq_num: sequence number of command message, used for matching with
746 * @result: result of the command execution, one of &enum qlink_cmd_result.
747 * @macid: index of physical radio device the response is sent from or
748 * QLINK_MACID_RSVD if not applicable.
749 * @vifid: index of virtual wireless interface on specified @macid the response
750 * is sent from or QLINK_VIFID_RSVD if not applicable.
753 struct qlink_msg_header mhdr;
762 * struct qlink_resp_get_mac_info - response for QLINK_CMD_MAC_INFO command
764 * Data describing specific physical device providing wireless MAC
767 * @dev_mac: MAC address of physical WMAC device (used for first BSS on
769 * @num_tx_chain: Number of transmit chains used by WMAC.
770 * @num_rx_chain: Number of receive chains used by WMAC.
771 * @vht_cap_mod_mask: mask specifying which VHT capabilities can be altered.
772 * @ht_cap_mod_mask: mask specifying which HT capabilities can be altered.
773 * @bands_cap: wireless bands WMAC can operate in, bitmap of &enum qlink_band.
774 * @max_ap_assoc_sta: Maximum number of associations supported by WMAC.
775 * @radar_detect_widths: bitmask of channels BW for which WMAC can detect radar.
776 * @var_info: variable-length WMAC info data.
778 struct qlink_resp_get_mac_info {
779 struct qlink_resp rhdr;
780 u8 dev_mac[ETH_ALEN];
783 struct ieee80211_vht_cap vht_cap_mod_mask;
784 struct ieee80211_ht_cap ht_cap_mod_mask;
785 __le16 max_ap_assoc_sta;
786 __le16 radar_detect_widths;
787 __le32 max_acl_mac_addrs;
794 * enum qlink_dfs_regions - regulatory DFS regions
796 * Corresponds to &enum nl80211_dfs_regions.
798 enum qlink_dfs_regions {
806 * struct qlink_resp_get_hw_info - response for QLINK_CMD_GET_HW_INFO command
808 * Description of wireless hardware capabilities and features.
810 * @fw_ver: wireless hardware firmware version.
811 * @hw_capab: Bitmap of capabilities supported by firmware.
812 * @ql_proto_ver: Version of QLINK protocol used by firmware.
813 * @num_mac: Number of separate physical radio devices provided by hardware.
814 * @mac_bitmap: Bitmap of MAC IDs that are active and can be used in firmware.
815 * @total_tx_chains: total number of transmit chains used by device.
816 * @total_rx_chains: total number of receive chains.
817 * @alpha2: country code ID firmware is configured to.
818 * @n_reg_rules: number of regulatory rules TLVs in variable portion of the
820 * @dfs_region: regulatory DFS region, one of @enum qlink_dfs_region.
821 * @info: variable-length HW info, can contain QTN_TLV_ID_REG_RULE.
823 struct qlink_resp_get_hw_info {
824 struct qlink_resp rhdr;
842 * struct qlink_resp_manage_intf - response for interface management commands
844 * Response data for QLINK_CMD_ADD_INTF and QLINK_CMD_CHANGE_INTF commands.
846 * @rhdr: Common Command Response message header.
847 * @intf_info: interface description.
849 struct qlink_resp_manage_intf {
850 struct qlink_resp rhdr;
851 struct qlink_intf_info intf_info;
854 enum qlink_sta_info_rate_flags {
855 QLINK_STA_INFO_RATE_FLAG_HT_MCS = BIT(0),
856 QLINK_STA_INFO_RATE_FLAG_VHT_MCS = BIT(1),
857 QLINK_STA_INFO_RATE_FLAG_SHORT_GI = BIT(2),
858 QLINK_STA_INFO_RATE_FLAG_60G = BIT(3),
862 * struct qlink_resp_get_sta_info - response for QLINK_CMD_GET_STA_INFO command
864 * Response data containing statistics for specified STA.
866 * @filled: a bitmask of &enum qlink_sta_info, specifies which info in response
868 * @sta_addr: MAC address of STA the response carries statistic for.
869 * @info: variable statistics for specified STA.
871 struct qlink_resp_get_sta_info {
872 struct qlink_resp rhdr;
873 u8 sta_addr[ETH_ALEN];
879 * struct qlink_resp_band_info_get - response for QLINK_CMD_BAND_INFO_GET cmd
881 * @band: frequency band that the response describes, one of @enum qlink_band.
882 * @num_chans: total number of channels info TLVs contained in reply.
883 * @num_bitrates: total number of bitrate TLVs contained in reply.
884 * @info: variable-length info portion.
886 struct qlink_resp_band_info_get {
887 struct qlink_resp rhdr;
896 * struct qlink_resp_phy_params - response for QLINK_CMD_PHY_PARAMS_GET command
898 * @info: variable-length array of PHY params.
900 struct qlink_resp_phy_params {
901 struct qlink_resp rhdr;
906 * struct qlink_resp_get_chan_stats - response for QLINK_CMD_CHAN_STATS cmd
908 * @info: variable-length channel info.
910 struct qlink_resp_get_chan_stats {
911 struct qlink_cmd rhdr;
916 * struct qlink_resp_channel_get - response for QLINK_CMD_CHAN_GET command
918 * @chan: definition of current operating channel.
920 struct qlink_resp_channel_get {
921 struct qlink_resp rhdr;
922 struct qlink_chandef chan;
925 /* QLINK Events messages related definitions
928 enum qlink_event_type {
929 QLINK_EVENT_STA_ASSOCIATED = 0x0021,
930 QLINK_EVENT_STA_DEAUTH = 0x0022,
931 QLINK_EVENT_MGMT_RECEIVED = 0x0023,
932 QLINK_EVENT_SCAN_RESULTS = 0x0024,
933 QLINK_EVENT_SCAN_COMPLETE = 0x0025,
934 QLINK_EVENT_BSS_JOIN = 0x0026,
935 QLINK_EVENT_BSS_LEAVE = 0x0027,
936 QLINK_EVENT_FREQ_CHANGE = 0x0028,
937 QLINK_EVENT_RADAR = 0x0029,
941 * struct qlink_event - QLINK event message header
943 * Header used for QLINK messages of QLINK_MSG_TYPE_EVENT type.
945 * @mhdr: Common QLINK message header.
946 * @event_id: Specifies specific event ID, one of &enum qlink_event_type.
947 * @macid: index of physical radio device the event was generated on or
948 * QLINK_MACID_RSVD if not applicable.
949 * @vifid: index of virtual wireless interface on specified @macid the event
950 * was generated on or QLINK_VIFID_RSVD if not applicable.
953 struct qlink_msg_header mhdr;
960 * struct qlink_event_sta_assoc - data for QLINK_EVENT_STA_ASSOCIATED event
962 * @sta_addr: Address of a STA for which new association event was generated
963 * @frame_control: control bits from 802.11 ASSOC_REQUEST header.
964 * @payload: IEs from association request.
966 struct qlink_event_sta_assoc {
967 struct qlink_event ehdr;
968 u8 sta_addr[ETH_ALEN];
969 __le16 frame_control;
974 * struct qlink_event_sta_deauth - data for QLINK_EVENT_STA_DEAUTH event
976 * @sta_addr: Address of a deauthenticated STA.
977 * @reason: reason for deauthentication.
979 struct qlink_event_sta_deauth {
980 struct qlink_event ehdr;
981 u8 sta_addr[ETH_ALEN];
986 * struct qlink_event_bss_join - data for QLINK_EVENT_BSS_JOIN event
988 * @bssid: BSSID of a BSS which interface tried to joined.
989 * @status: status of joining attempt, see &enum ieee80211_statuscode.
991 struct qlink_event_bss_join {
992 struct qlink_event ehdr;
998 * struct qlink_event_bss_leave - data for QLINK_EVENT_BSS_LEAVE event
1000 * @reason: reason of disconnecting from BSS.
1002 struct qlink_event_bss_leave {
1003 struct qlink_event ehdr;
1008 * struct qlink_event_freq_change - data for QLINK_EVENT_FREQ_CHANGE event
1010 * @chan: new operating channel definition
1012 struct qlink_event_freq_change {
1013 struct qlink_event ehdr;
1014 struct qlink_chandef chan;
1017 enum qlink_rxmgmt_flags {
1018 QLINK_RXMGMT_FLAG_ANSWERED = 1 << 0,
1022 * struct qlink_event_rxmgmt - data for QLINK_EVENT_MGMT_RECEIVED event
1024 * @freq: Frequency on which the frame was received in MHz.
1025 * @flags: bitmap of &enum qlink_rxmgmt_flags.
1026 * @sig_dbm: signal strength in dBm.
1027 * @frame_data: data of Rx'd frame itself.
1029 struct qlink_event_rxmgmt {
1030 struct qlink_event ehdr;
1039 * struct qlink_event_scan_result - data for QLINK_EVENT_SCAN_RESULTS event
1041 * @tsf: TSF timestamp indicating when scan results were generated.
1042 * @freq: Center frequency of the channel where BSS for which the scan result
1043 * event was generated was discovered.
1044 * @capab: capabilities field.
1045 * @bintval: beacon interval announced by discovered BSS.
1046 * @sig_dbm: signal strength in dBm.
1047 * @bssid: BSSID announced by discovered BSS.
1048 * @ssid_len: length of SSID announced by BSS.
1049 * @ssid: SSID announced by discovered BSS.
1050 * @payload: IEs that are announced by discovered BSS in its MGMt frames.
1052 struct qlink_event_scan_result {
1053 struct qlink_event ehdr;
1060 u8 ssid[IEEE80211_MAX_SSID_LEN];
1067 * enum qlink_scan_complete_flags - indicates result of scan request.
1069 * @QLINK_SCAN_NONE: Scan request was processed.
1070 * @QLINK_SCAN_ABORTED: Scan was aborted.
1072 enum qlink_scan_complete_flags {
1073 QLINK_SCAN_NONE = 0,
1074 QLINK_SCAN_ABORTED = BIT(0),
1078 * struct qlink_event_scan_complete - data for QLINK_EVENT_SCAN_COMPLETE event
1080 * @flags: flags indicating the status of pending scan request,
1081 * see &enum qlink_scan_complete_flags.
1083 struct qlink_event_scan_complete {
1084 struct qlink_event ehdr;
1088 enum qlink_radar_event {
1089 QLINK_RADAR_DETECTED,
1090 QLINK_RADAR_CAC_FINISHED,
1091 QLINK_RADAR_CAC_ABORTED,
1092 QLINK_RADAR_NOP_FINISHED,
1093 QLINK_RADAR_PRE_CAC_EXPIRED,
1094 QLINK_RADAR_CAC_STARTED,
1098 * struct qlink_event_radar - data for QLINK_EVENT_RADAR event
1100 * @chan: channel on which radar event happened.
1101 * @event: radar event type, one of &enum qlink_radar_event.
1103 struct qlink_event_radar {
1104 struct qlink_event ehdr;
1105 struct qlink_chandef chan;
1110 /* QLINK TLVs (Type-Length Values) definitions
1114 * enum qlink_tlv_id - list of TLVs that Qlink messages can carry
1116 * @QTN_TLV_ID_STA_STATS_MAP: a bitmap of &enum qlink_sta_info, used to
1117 * indicate which statistic carried in QTN_TLV_ID_STA_STATS is valid.
1118 * @QTN_TLV_ID_STA_STATS: per-STA statistics as defined by
1119 * &struct qlink_sta_stats. Valid values are marked as such in a bitmap
1120 * carried by QTN_TLV_ID_STA_STATS_MAP.
1121 * @QTN_TLV_ID_MAX_SCAN_SSIDS: maximum number of SSIDs the device can scan
1122 * for in any given scan.
1125 QTN_TLV_ID_FRAG_THRESH = 0x0201,
1126 QTN_TLV_ID_RTS_THRESH = 0x0202,
1127 QTN_TLV_ID_SRETRY_LIMIT = 0x0203,
1128 QTN_TLV_ID_LRETRY_LIMIT = 0x0204,
1129 QTN_TLV_ID_REG_RULE = 0x0207,
1130 QTN_TLV_ID_CHANNEL = 0x020F,
1131 QTN_TLV_ID_CHANDEF = 0x0210,
1132 QTN_TLV_ID_STA_STATS_MAP = 0x0211,
1133 QTN_TLV_ID_STA_STATS = 0x0212,
1134 QTN_TLV_ID_COVERAGE_CLASS = 0x0213,
1135 QTN_TLV_ID_IFACE_LIMIT = 0x0214,
1136 QTN_TLV_ID_NUM_IFACE_COMB = 0x0215,
1137 QTN_TLV_ID_CHANNEL_STATS = 0x0216,
1138 QTN_TLV_ID_KEY = 0x0302,
1139 QTN_TLV_ID_SEQ = 0x0303,
1140 QTN_TLV_ID_IE_SET = 0x0305,
1141 QTN_TLV_ID_EXT_CAPABILITY_MASK = 0x0306,
1142 QTN_TLV_ID_ACL_DATA = 0x0307,
1143 QTN_TLV_ID_BUILD_NAME = 0x0401,
1144 QTN_TLV_ID_BUILD_REV = 0x0402,
1145 QTN_TLV_ID_BUILD_TYPE = 0x0403,
1146 QTN_TLV_ID_BUILD_LABEL = 0x0404,
1147 QTN_TLV_ID_HW_ID = 0x0405,
1148 QTN_TLV_ID_CALIBRATION_VER = 0x0406,
1149 QTN_TLV_ID_UBOOT_VER = 0x0407,
1150 QTN_TLV_ID_RANDOM_MAC_ADDR = 0x0408,
1151 QTN_TLV_ID_MAX_SCAN_SSIDS = 0x0409,
1152 QTN_TLV_ID_WOWLAN_CAPAB = 0x0410,
1153 QTN_TLV_ID_WOWLAN_PATTERN = 0x0411,
1156 struct qlink_tlv_hdr {
1162 struct qlink_iface_comb_num {
1163 __le32 iface_comb_num;
1166 struct qlink_iface_limit {
1171 struct qlink_iface_limit_record {
1172 __le16 max_interfaces;
1173 u8 num_different_channels;
1175 struct qlink_iface_limit limits[0];
1178 #define QLINK_RSSI_OFFSET 120
1180 struct qlink_tlv_frag_rts_thr {
1181 struct qlink_tlv_hdr hdr;
1185 struct qlink_tlv_rlimit {
1186 struct qlink_tlv_hdr hdr;
1190 struct qlink_tlv_cclass {
1191 struct qlink_tlv_hdr hdr;
1196 * enum qlink_reg_rule_flags - regulatory rule flags
1198 * See description of &enum nl80211_reg_rule_flags
1200 enum qlink_reg_rule_flags {
1201 QLINK_RRF_NO_OFDM = BIT(0),
1202 QLINK_RRF_NO_CCK = BIT(1),
1203 QLINK_RRF_NO_INDOOR = BIT(2),
1204 QLINK_RRF_NO_OUTDOOR = BIT(3),
1205 QLINK_RRF_DFS = BIT(4),
1206 QLINK_RRF_PTP_ONLY = BIT(5),
1207 QLINK_RRF_PTMP_ONLY = BIT(6),
1208 QLINK_RRF_NO_IR = BIT(7),
1209 QLINK_RRF_AUTO_BW = BIT(8),
1210 QLINK_RRF_IR_CONCURRENT = BIT(9),
1211 QLINK_RRF_NO_HT40MINUS = BIT(10),
1212 QLINK_RRF_NO_HT40PLUS = BIT(11),
1213 QLINK_RRF_NO_80MHZ = BIT(12),
1214 QLINK_RRF_NO_160MHZ = BIT(13),
1218 * struct qlink_tlv_reg_rule - data for QTN_TLV_ID_REG_RULE TLV
1220 * Regulatory rule description.
1222 * @start_freq_khz: start frequency of the range the rule is attributed to.
1223 * @end_freq_khz: end frequency of the range the rule is attributed to.
1224 * @max_bandwidth_khz: max bandwidth that channels in specified range can be
1226 * @max_antenna_gain: max antenna gain that can be used in the specified
1227 * frequency range, dBi.
1228 * @max_eirp: maximum EIRP.
1229 * @flags: regulatory rule flags in &enum qlink_reg_rule_flags.
1230 * @dfs_cac_ms: DFS CAC period.
1232 struct qlink_tlv_reg_rule {
1233 struct qlink_tlv_hdr hdr;
1234 __le32 start_freq_khz;
1235 __le32 end_freq_khz;
1236 __le32 max_bandwidth_khz;
1237 __le32 max_antenna_gain;
1243 enum qlink_channel_flags {
1244 QLINK_CHAN_DISABLED = BIT(0),
1245 QLINK_CHAN_NO_IR = BIT(1),
1246 QLINK_CHAN_RADAR = BIT(3),
1247 QLINK_CHAN_NO_HT40PLUS = BIT(4),
1248 QLINK_CHAN_NO_HT40MINUS = BIT(5),
1249 QLINK_CHAN_NO_OFDM = BIT(6),
1250 QLINK_CHAN_NO_80MHZ = BIT(7),
1251 QLINK_CHAN_NO_160MHZ = BIT(8),
1252 QLINK_CHAN_INDOOR_ONLY = BIT(9),
1253 QLINK_CHAN_IR_CONCURRENT = BIT(10),
1254 QLINK_CHAN_NO_20MHZ = BIT(11),
1255 QLINK_CHAN_NO_10MHZ = BIT(12),
1258 enum qlink_dfs_state {
1260 QLINK_DFS_UNAVAILABLE,
1261 QLINK_DFS_AVAILABLE,
1265 * struct qlink_tlv_channel - data for QTN_TLV_ID_CHANNEL TLV
1269 * @channel: ieee80211 channel settings.
1271 struct qlink_tlv_channel {
1272 struct qlink_tlv_hdr hdr;
1273 struct qlink_channel chan;
1277 * struct qlink_tlv_chandef - data for QTN_TLV_ID_CHANDEF TLV
1279 * Channel definition.
1281 * @chan: channel definition data.
1283 struct qlink_tlv_chandef {
1284 struct qlink_tlv_hdr hdr;
1285 struct qlink_chandef chdef;
1288 enum qlink_ie_set_type {
1289 QLINK_IE_SET_UNKNOWN,
1290 QLINK_IE_SET_ASSOC_REQ,
1291 QLINK_IE_SET_ASSOC_RESP,
1292 QLINK_IE_SET_PROBE_REQ,
1294 QLINK_IE_SET_BEACON_HEAD,
1295 QLINK_IE_SET_BEACON_TAIL,
1296 QLINK_IE_SET_BEACON_IES,
1297 QLINK_IE_SET_PROBE_RESP,
1298 QLINK_IE_SET_PROBE_RESP_IES,
1302 * struct qlink_tlv_ie_set - data for QTN_TLV_ID_IE_SET
1304 * @type: type of MGMT frame IEs belong to, one of &enum qlink_ie_set_type.
1305 * @flags: for future use.
1306 * @ie_data: IEs data.
1308 struct qlink_tlv_ie_set {
1309 struct qlink_tlv_hdr hdr;
1315 struct qlink_chan_stats {
1325 * enum qlink_sta_info - station information bitmap
1327 * Used to indicate which statistics values in &struct qlink_sta_stats
1328 * are valid. Individual values are used to fill a bitmap carried in a
1329 * payload of QTN_TLV_ID_STA_STATS_MAP.
1331 * @QLINK_STA_INFO_CONNECTED_TIME: connected_time value is valid.
1332 * @QLINK_STA_INFO_INACTIVE_TIME: inactive_time value is valid.
1333 * @QLINK_STA_INFO_RX_BYTES: lower 32 bits of rx_bytes value are valid.
1334 * @QLINK_STA_INFO_TX_BYTES: lower 32 bits of tx_bytes value are valid.
1335 * @QLINK_STA_INFO_RX_BYTES64: rx_bytes value is valid.
1336 * @QLINK_STA_INFO_TX_BYTES64: tx_bytes value is valid.
1337 * @QLINK_STA_INFO_RX_DROP_MISC: rx_dropped_misc value is valid.
1338 * @QLINK_STA_INFO_BEACON_RX: rx_beacon value is valid.
1339 * @QLINK_STA_INFO_SIGNAL: signal value is valid.
1340 * @QLINK_STA_INFO_SIGNAL_AVG: signal_avg value is valid.
1341 * @QLINK_STA_INFO_RX_BITRATE: rxrate value is valid.
1342 * @QLINK_STA_INFO_TX_BITRATE: txrate value is valid.
1343 * @QLINK_STA_INFO_RX_PACKETS: rx_packets value is valid.
1344 * @QLINK_STA_INFO_TX_PACKETS: tx_packets value is valid.
1345 * @QLINK_STA_INFO_TX_RETRIES: tx_retries value is valid.
1346 * @QLINK_STA_INFO_TX_FAILED: tx_failed value is valid.
1347 * @QLINK_STA_INFO_STA_FLAGS: sta_flags value is valid.
1349 enum qlink_sta_info {
1350 QLINK_STA_INFO_CONNECTED_TIME,
1351 QLINK_STA_INFO_INACTIVE_TIME,
1352 QLINK_STA_INFO_RX_BYTES,
1353 QLINK_STA_INFO_TX_BYTES,
1354 QLINK_STA_INFO_RX_BYTES64,
1355 QLINK_STA_INFO_TX_BYTES64,
1356 QLINK_STA_INFO_RX_DROP_MISC,
1357 QLINK_STA_INFO_BEACON_RX,
1358 QLINK_STA_INFO_SIGNAL,
1359 QLINK_STA_INFO_SIGNAL_AVG,
1360 QLINK_STA_INFO_RX_BITRATE,
1361 QLINK_STA_INFO_TX_BITRATE,
1362 QLINK_STA_INFO_RX_PACKETS,
1363 QLINK_STA_INFO_TX_PACKETS,
1364 QLINK_STA_INFO_TX_RETRIES,
1365 QLINK_STA_INFO_TX_FAILED,
1366 QLINK_STA_INFO_STA_FLAGS,
1371 * struct qlink_sta_info_rate - STA rate statistics
1373 * @rate: data rate in Mbps.
1374 * @flags: bitmap of &enum qlink_sta_info_rate_flags.
1375 * @mcs: 802.11-defined MCS index.
1376 * nss: Number of Spatial Streams.
1377 * @bw: bandwidth, one of &enum qlink_channel_width.
1379 struct qlink_sta_info_rate {
1388 * struct qlink_sta_stats - data for QTN_TLV_ID_STA_STATS
1390 * Carries statistics of a STA. Not all fields may be filled with
1391 * valid values. Valid fields should be indicated as such using a bitmap of
1392 * &enum qlink_sta_info. Bitmap is carried separately in a payload of
1393 * QTN_TLV_ID_STA_STATS_MAP.
1395 struct qlink_sta_stats {
1401 __le32 connected_time;
1402 __le32 inactive_time;
1407 __le32 rx_dropped_misc;
1408 __le32 beacon_loss_count;
1409 __le32 expected_throughput;
1410 struct qlink_sta_info_state sta_flags;
1411 struct qlink_sta_info_rate txrate;
1412 struct qlink_sta_info_rate rxrate;
1418 u8 rx_beacon_signal_avg;
1426 * struct qlink_random_mac_addr - data for QTN_TLV_ID_RANDOM_MAC_ADDR TLV
1428 * Specifies MAC address mask/value for generation random MAC address
1431 * @mac_addr: MAC address used with randomisation
1432 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1433 * are 0 in the mask should be randomised, bits that are 1 should
1434 * be taken from the @mac_addr
1436 struct qlink_random_mac_addr {
1437 u8 mac_addr[ETH_ALEN];
1438 u8 mac_addr_mask[ETH_ALEN];
1442 * struct qlink_wowlan_capab_data - data for QTN_TLV_ID_WOWLAN_CAPAB TLV
1444 * WoWLAN capabilities supported by cards.
1446 * @version: version of WoWLAN data structure, to ensure backward
1447 * compatibility for firmwares with limited WoWLAN support
1448 * @len: Total length of WoWLAN data
1449 * @data: supported WoWLAN features
1451 struct qlink_wowlan_capab_data {
1458 * struct qlink_wowlan_support - supported WoWLAN capabilities
1460 * @n_patterns: number of supported wakeup patterns
1461 * @pattern_max_len: maximum length of each pattern
1462 * @pattern_min_len: minimum length of each pattern
1464 struct qlink_wowlan_support {
1466 __le32 pattern_max_len;
1467 __le32 pattern_min_len;
1470 #endif /* _QTN_QLINK_H_ */