Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /* Copyright (c) 2015-2016 Quantenna Communications. All rights reserved. */
0003 
0004 #ifndef _QTN_QLINK_H_
0005 #define _QTN_QLINK_H_
0006 
0007 #include <linux/ieee80211.h>
0008 
0009 #define QLINK_PROTO_VER_MAJOR_M     0xFFFF
0010 #define QLINK_PROTO_VER_MAJOR_S     16
0011 #define QLINK_PROTO_VER_MINOR_M     0xFFFF
0012 #define QLINK_VER_MINOR(_ver)   ((_ver) & QLINK_PROTO_VER_MINOR_M)
0013 #define QLINK_VER_MAJOR(_ver)   \
0014     (((_ver) >> QLINK_PROTO_VER_MAJOR_S) & QLINK_PROTO_VER_MAJOR_M)
0015 #define QLINK_VER(_maj, _min)   (((_maj) << QLINK_PROTO_VER_MAJOR_S) | (_min))
0016 
0017 #define QLINK_PROTO_VER_MAJOR       18
0018 #define QLINK_PROTO_VER_MINOR       1
0019 #define QLINK_PROTO_VER     \
0020     QLINK_VER(QLINK_PROTO_VER_MAJOR, QLINK_PROTO_VER_MINOR)
0021 
0022 #define QLINK_ALIGN 4
0023 
0024 #define QLINK_MACID_RSVD        0xFF
0025 #define QLINK_VIFID_RSVD        0xFF
0026 
0027 /* Common QLINK protocol messages definitions.
0028  */
0029 
0030 /**
0031  * enum qlink_msg_type - QLINK message types
0032  *
0033  * Used to distinguish between message types of QLINK protocol.
0034  *
0035  * @QLINK_MSG_TYPE_CMD: Message is carrying data of a command sent from
0036  *  driver to wireless hardware.
0037  * @QLINK_MSG_TYPE_CMDRSP: Message is carrying data of a response to a command.
0038  *  Sent from wireless HW to driver in reply to previously issued command.
0039  * @QLINK_MSG_TYPE_EVENT: Data for an event originated in wireless hardware and
0040  *  sent asynchronously to driver.
0041  */
0042 enum qlink_msg_type {
0043     QLINK_MSG_TYPE_CMD  = 1,
0044     QLINK_MSG_TYPE_CMDRSP   = 2,
0045     QLINK_MSG_TYPE_EVENT    = 3
0046 };
0047 
0048 /**
0049  * struct qlink_msg_header - common QLINK protocol message header
0050  *
0051  * Portion of QLINK protocol header common for all message types.
0052  *
0053  * @type: Message type, one of &enum qlink_msg_type.
0054  * @len: Total length of message including all headers.
0055  */
0056 struct qlink_msg_header {
0057     __le16 type;
0058     __le16 len;
0059 } __packed;
0060 
0061 /* Generic definitions of data and information carried in QLINK messages
0062  */
0063 
0064 /**
0065  * enum qlink_hw_capab - device capabilities.
0066  *
0067  * @QLINK_HW_CAPAB_REG_UPDATE: device can update it's regulatory region.
0068  * @QLINK_HW_CAPAB_STA_INACT_TIMEOUT: device implements a logic to kick-out
0069  *  associated STAs due to inactivity. Inactivity timeout period is taken
0070  *  from QLINK_CMD_START_AP parameters.
0071  * @QLINK_HW_CAPAB_DFS_OFFLOAD: device implements DFS offload functionality
0072  * @QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR: device supports MAC Address
0073  *  Randomization in probe requests.
0074  * @QLINK_HW_CAPAB_OBSS_SCAN: device can perform OBSS scanning.
0075  * @QLINK_HW_CAPAB_HW_BRIDGE: device has hardware switch capabilities.
0076  */
0077 enum qlink_hw_capab {
0078     QLINK_HW_CAPAB_REG_UPDATE = 0,
0079     QLINK_HW_CAPAB_STA_INACT_TIMEOUT,
0080     QLINK_HW_CAPAB_DFS_OFFLOAD,
0081     QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR,
0082     QLINK_HW_CAPAB_PWR_MGMT,
0083     QLINK_HW_CAPAB_OBSS_SCAN,
0084     QLINK_HW_CAPAB_SCAN_DWELL,
0085     QLINK_HW_CAPAB_SAE,
0086     QLINK_HW_CAPAB_HW_BRIDGE,
0087     QLINK_HW_CAPAB_NUM
0088 };
0089 
0090 /**
0091  * enum qlink_driver_capab - host driver capabilities.
0092  *
0093  */
0094 enum qlink_driver_capab {
0095     QLINK_DRV_CAPAB_NUM = 0
0096 };
0097 
0098 enum qlink_iface_type {
0099     QLINK_IFTYPE_AP     = 1,
0100     QLINK_IFTYPE_STATION    = 2,
0101     QLINK_IFTYPE_ADHOC  = 3,
0102     QLINK_IFTYPE_MONITOR    = 4,
0103     QLINK_IFTYPE_WDS    = 5,
0104     QLINK_IFTYPE_AP_VLAN    = 6,
0105 };
0106 
0107 /**
0108  * struct qlink_intf_info - information on virtual interface.
0109  *
0110  * Data describing a single virtual interface.
0111  *
0112  * @if_type: Mode of interface operation, one of &enum qlink_iface_type
0113  * @vlanid: VLAN ID for AP_VLAN interface type
0114  * @mac_addr: MAC address of virtual interface.
0115  */
0116 struct qlink_intf_info {
0117     __le16 if_type;
0118     __le16 vlanid;
0119     u8 mac_addr[ETH_ALEN];
0120     u8 use4addr;
0121     u8 rsvd[1];
0122 } __packed;
0123 
0124 enum qlink_sta_flags {
0125     QLINK_STA_FLAG_INVALID      = 0,
0126     QLINK_STA_FLAG_AUTHORIZED       = BIT(0),
0127     QLINK_STA_FLAG_SHORT_PREAMBLE   = BIT(1),
0128     QLINK_STA_FLAG_WME          = BIT(2),
0129     QLINK_STA_FLAG_MFP          = BIT(3),
0130     QLINK_STA_FLAG_AUTHENTICATED        = BIT(4),
0131     QLINK_STA_FLAG_TDLS_PEER        = BIT(5),
0132     QLINK_STA_FLAG_ASSOCIATED       = BIT(6),
0133 };
0134 
0135 enum qlink_channel_width {
0136     QLINK_CHAN_WIDTH_5 = 0,
0137     QLINK_CHAN_WIDTH_10,
0138     QLINK_CHAN_WIDTH_20_NOHT,
0139     QLINK_CHAN_WIDTH_20,
0140     QLINK_CHAN_WIDTH_40,
0141     QLINK_CHAN_WIDTH_80,
0142     QLINK_CHAN_WIDTH_80P80,
0143     QLINK_CHAN_WIDTH_160,
0144 };
0145 
0146 /**
0147  * struct qlink_channel - qlink control channel definition
0148  *
0149  * @hw_value: hardware-specific value for the channel
0150  * @center_freq: center frequency in MHz
0151  * @flags: channel flags from &enum qlink_channel_flags
0152  * @band: band this channel belongs to
0153  * @max_antenna_gain: maximum antenna gain in dBi
0154  * @max_power: maximum transmission power (in dBm)
0155  * @max_reg_power: maximum regulatory transmission power (in dBm)
0156  * @dfs_state: current state of this channel.
0157  *      Only relevant if radar is required on this channel.
0158  * @beacon_found: helper to regulatory code to indicate when a beacon
0159  *  has been found on this channel. Use regulatory_hint_found_beacon()
0160  *  to enable this, this is useful only on 5 GHz band.
0161  */
0162 struct qlink_channel {
0163     __le16 hw_value;
0164     __le16 center_freq;
0165     __le32 flags;
0166     u8 band;
0167     u8 max_antenna_gain;
0168     u8 max_power;
0169     u8 max_reg_power;
0170     __le32 dfs_cac_ms;
0171     u8 dfs_state;
0172     u8 beacon_found;
0173     u8 rsvd[2];
0174 } __packed;
0175 
0176 /**
0177  * struct qlink_chandef - qlink channel definition
0178  *
0179  * @chan: primary channel definition
0180  * @center_freq1: center frequency of first segment
0181  * @center_freq2: center frequency of second segment (80+80 only)
0182  * @width: channel width, one of @enum qlink_channel_width
0183  */
0184 struct qlink_chandef {
0185     struct qlink_channel chan;
0186     __le16 center_freq1;
0187     __le16 center_freq2;
0188     u8 width;
0189     u8 rsvd[3];
0190 } __packed;
0191 
0192 #define QLINK_MAX_NR_CIPHER_SUITES            5
0193 #define QLINK_MAX_NR_AKM_SUITES               2
0194 
0195 struct qlink_auth_encr {
0196     __le32 wpa_versions;
0197     __le32 cipher_group;
0198     __le32 n_ciphers_pairwise;
0199     __le32 ciphers_pairwise[QLINK_MAX_NR_CIPHER_SUITES];
0200     __le32 n_akm_suites;
0201     __le32 akm_suites[QLINK_MAX_NR_AKM_SUITES];
0202     __le16 control_port_ethertype;
0203     u8 auth_type;
0204     u8 privacy;
0205     u8 control_port;
0206     u8 control_port_no_encrypt;
0207     u8 rsvd[2];
0208 } __packed;
0209 
0210 /**
0211  * struct qlink_sta_info_state - station flags mask/value
0212  *
0213  * @mask: STA flags mask, bitmap of &enum qlink_sta_flags
0214  * @value: STA flags values, bitmap of &enum qlink_sta_flags
0215  */
0216 struct qlink_sta_info_state {
0217     __le32 mask;
0218     __le32 value;
0219 } __packed;
0220 
0221 /**
0222  * enum qlink_sr_ctrl_flags - control flags for spatial reuse parameter set
0223  *
0224  * @QLINK_SR_PSR_DISALLOWED: indicates whether or not PSR-based spatial reuse
0225  * transmissions are allowed for STAs associated with the AP
0226  * @QLINK_SR_NON_SRG_OBSS_PD_SR_DISALLOWED: indicates whether or not
0227  * Non-SRG OBSS PD spatial reuse transmissions are allowed for STAs associated
0228  * with the AP
0229  * @NON_SRG_OFFSET_PRESENT: indicates whether or not Non-SRG OBSS PD Max offset
0230  * field is valid in the element
0231  * @QLINK_SR_SRG_INFORMATION_PRESENT: indicates whether or not SRG OBSS PD
0232  * Min/Max offset fields ore valid in the element
0233  */
0234 enum qlink_sr_ctrl_flags {
0235     QLINK_SR_PSR_DISALLOWED                = BIT(0),
0236     QLINK_SR_NON_SRG_OBSS_PD_SR_DISALLOWED = BIT(1),
0237     QLINK_SR_NON_SRG_OFFSET_PRESENT        = BIT(2),
0238     QLINK_SR_SRG_INFORMATION_PRESENT       = BIT(3),
0239 };
0240 
0241 /**
0242  * struct qlink_sr_params - spatial reuse parameters
0243  *
0244  * @sr_control: spatial reuse control field; flags contained in this field are
0245  * defined in @qlink_sr_ctrl_flags
0246  * @non_srg_obss_pd_max: added to -82 dBm to generate the value of the
0247  * Non-SRG OBSS PD Max parameter
0248  * @srg_obss_pd_min_offset: added to -82 dBm to generate the value of the
0249  * SRG OBSS PD Min parameter
0250  * @srg_obss_pd_max_offset: added to -82 dBm to generate the value of the
0251  * SRG PBSS PD Max parameter
0252  */
0253 struct qlink_sr_params {
0254     u8 sr_control;
0255     u8 non_srg_obss_pd_max;
0256     u8 srg_obss_pd_min_offset;
0257     u8 srg_obss_pd_max_offset;
0258 } __packed;
0259 
0260 /* QLINK Command messages related definitions
0261  */
0262 
0263 /**
0264  * enum qlink_cmd_type - list of supported commands
0265  *
0266  * Commands are QLINK messages of type @QLINK_MSG_TYPE_CMD, sent by driver to
0267  * wireless network device for processing. Device is expected to send back a
0268  * reply message of type &QLINK_MSG_TYPE_CMDRSP, containing at least command
0269  * execution status (one of &enum qlink_cmd_result). Reply message
0270  * may also contain data payload specific to the command type.
0271  *
0272  * @QLINK_CMD_SEND_FRAME: send specified frame over the air; firmware will
0273  *  encapsulate 802.3 packet into 802.11 frame automatically.
0274  * @QLINK_CMD_BAND_INFO_GET: for the specified MAC and specified band, get
0275  *  the band's description including number of operational channels and
0276  *  info on each channel, HT/VHT capabilities, supported rates etc.
0277  *  This command is generic to a specified MAC, interface index must be set
0278  *  to QLINK_VIFID_RSVD in command header.
0279  * @QLINK_CMD_REG_NOTIFY: notify device about regulatory domain change. This
0280  *  command is supported only if device reports QLINK_HW_SUPPORTS_REG_UPDATE
0281  *  capability.
0282  * @QLINK_CMD_START_CAC: start radar detection procedure on a specified channel.
0283  * @QLINK_CMD_TXPWR: get or set current channel transmit power for
0284  *  the specified MAC.
0285  * @QLINK_CMD_NDEV_EVENT: signalizes changes made with a corresponding network
0286  *  device.
0287  */
0288 enum qlink_cmd_type {
0289     QLINK_CMD_FW_INIT       = 0x0001,
0290     QLINK_CMD_FW_DEINIT     = 0x0002,
0291     QLINK_CMD_REGISTER_MGMT     = 0x0003,
0292     QLINK_CMD_SEND_FRAME        = 0x0004,
0293     QLINK_CMD_MGMT_SET_APPIE    = 0x0005,
0294     QLINK_CMD_PHY_PARAMS_SET    = 0x0012,
0295     QLINK_CMD_GET_HW_INFO       = 0x0013,
0296     QLINK_CMD_MAC_INFO      = 0x0014,
0297     QLINK_CMD_ADD_INTF      = 0x0015,
0298     QLINK_CMD_DEL_INTF      = 0x0016,
0299     QLINK_CMD_CHANGE_INTF       = 0x0017,
0300     QLINK_CMD_UPDOWN_INTF       = 0x0018,
0301     QLINK_CMD_REG_NOTIFY        = 0x0019,
0302     QLINK_CMD_BAND_INFO_GET     = 0x001A,
0303     QLINK_CMD_CHAN_SWITCH       = 0x001B,
0304     QLINK_CMD_CHAN_GET      = 0x001C,
0305     QLINK_CMD_START_CAC     = 0x001D,
0306     QLINK_CMD_START_AP      = 0x0021,
0307     QLINK_CMD_STOP_AP       = 0x0022,
0308     QLINK_CMD_SET_MAC_ACL       = 0x0023,
0309     QLINK_CMD_GET_STA_INFO      = 0x0030,
0310     QLINK_CMD_ADD_KEY       = 0x0040,
0311     QLINK_CMD_DEL_KEY       = 0x0041,
0312     QLINK_CMD_SET_DEFAULT_KEY   = 0x0042,
0313     QLINK_CMD_SET_DEFAULT_MGMT_KEY  = 0x0043,
0314     QLINK_CMD_CHANGE_STA        = 0x0051,
0315     QLINK_CMD_DEL_STA       = 0x0052,
0316     QLINK_CMD_SCAN          = 0x0053,
0317     QLINK_CMD_CHAN_STATS        = 0x0054,
0318     QLINK_CMD_NDEV_EVENT        = 0x0055,
0319     QLINK_CMD_CONNECT       = 0x0060,
0320     QLINK_CMD_DISCONNECT        = 0x0061,
0321     QLINK_CMD_PM_SET        = 0x0062,
0322     QLINK_CMD_WOWLAN_SET        = 0x0063,
0323     QLINK_CMD_EXTERNAL_AUTH     = 0x0066,
0324     QLINK_CMD_TXPWR         = 0x0067,
0325     QLINK_CMD_UPDATE_OWE        = 0x0068,
0326 };
0327 
0328 /**
0329  * struct qlink_cmd - QLINK command message header
0330  *
0331  * Header used for QLINK messages of QLINK_MSG_TYPE_CMD type.
0332  *
0333  * @mhdr: Common QLINK message header.
0334  * @cmd_id: command id, one of &enum qlink_cmd_type.
0335  * @seq_num: sequence number of command message, used for matching with
0336  *  response message.
0337  * @macid: index of physical radio device the command is destined to or
0338  *  QLINK_MACID_RSVD if not applicable.
0339  * @vifid: index of virtual wireless interface on specified @macid the command
0340  *  is destined to or QLINK_VIFID_RSVD if not applicable.
0341  */
0342 struct qlink_cmd {
0343     struct qlink_msg_header mhdr;
0344     __le16 cmd_id;
0345     __le16 seq_num;
0346     u8 macid;
0347     u8 vifid;
0348     u8 rsvd[2];
0349 } __packed;
0350 
0351 /**
0352  * struct qlink_cmd_init_fw - data for QLINK_CMD_FW_INIT
0353  *
0354  * Initialize firmware based on specified host configuration. This is the first
0355  * command sent to wifi card and it's fixed part should never be changed, any
0356  * additions must be done by appending TLVs.
0357  * If wifi card can not operate with a specified parameters it will return
0358  * error.
0359  *
0360  * @qlink_proto_ver: QLINK protocol version used by host driver.
0361  */
0362 struct qlink_cmd_init_fw {
0363     struct qlink_cmd chdr;
0364     __le32 qlink_proto_ver;
0365     u8 var_info[];
0366 } __packed;
0367 
0368 /**
0369  * struct qlink_cmd_manage_intf - interface management command
0370  *
0371  * Data for interface management commands QLINK_CMD_ADD_INTF, QLINK_CMD_DEL_INTF
0372  * and QLINK_CMD_CHANGE_INTF.
0373  *
0374  * @intf_info: interface description.
0375  */
0376 struct qlink_cmd_manage_intf {
0377     struct qlink_cmd chdr;
0378     struct qlink_intf_info intf_info;
0379 } __packed;
0380 
0381 enum qlink_mgmt_frame_type {
0382     QLINK_MGMT_FRAME_ASSOC_REQ  = 0x00,
0383     QLINK_MGMT_FRAME_ASSOC_RESP = 0x01,
0384     QLINK_MGMT_FRAME_REASSOC_REQ    = 0x02,
0385     QLINK_MGMT_FRAME_REASSOC_RESP   = 0x03,
0386     QLINK_MGMT_FRAME_PROBE_REQ  = 0x04,
0387     QLINK_MGMT_FRAME_PROBE_RESP = 0x05,
0388     QLINK_MGMT_FRAME_BEACON     = 0x06,
0389     QLINK_MGMT_FRAME_ATIM       = 0x07,
0390     QLINK_MGMT_FRAME_DISASSOC   = 0x08,
0391     QLINK_MGMT_FRAME_AUTH       = 0x09,
0392     QLINK_MGMT_FRAME_DEAUTH     = 0x0A,
0393     QLINK_MGMT_FRAME_ACTION     = 0x0B,
0394 
0395     QLINK_MGMT_FRAME_TYPE_COUNT
0396 };
0397 
0398 /**
0399  * struct qlink_cmd_mgmt_frame_register - data for QLINK_CMD_REGISTER_MGMT
0400  *
0401  * @frame_type: MGMT frame type the registration request describes, one of
0402  *  &enum qlink_mgmt_frame_type.
0403  * @do_register: 0 - unregister, otherwise register for reception of specified
0404  *  MGMT frame type.
0405  */
0406 struct qlink_cmd_mgmt_frame_register {
0407     struct qlink_cmd chdr;
0408     __le16 frame_type;
0409     u8 do_register;
0410     u8 rsvd[1];
0411 } __packed;
0412 
0413 /**
0414  * @QLINK_FRAME_TX_FLAG_8023: frame has a 802.3 header; if not set, frame
0415  *  is a 802.11 encapsulated.
0416  */
0417 enum qlink_frame_tx_flags {
0418     QLINK_FRAME_TX_FLAG_OFFCHAN = BIT(0),
0419     QLINK_FRAME_TX_FLAG_NO_CCK  = BIT(1),
0420     QLINK_FRAME_TX_FLAG_ACK_NOWAIT  = BIT(2),
0421     QLINK_FRAME_TX_FLAG_8023    = BIT(3),
0422 };
0423 
0424 /**
0425  * struct qlink_cmd_frame_tx - data for QLINK_CMD_SEND_FRAME command
0426  *
0427  * @cookie: opaque request identifier.
0428  * @freq: Frequency to use for frame transmission.
0429  * @flags: Transmission flags, one of &enum qlink_frame_tx_flags.
0430  * @frame_data: frame to transmit.
0431  */
0432 struct qlink_cmd_frame_tx {
0433     struct qlink_cmd chdr;
0434     __le32 cookie;
0435     __le16 freq;
0436     __le16 flags;
0437     u8 frame_data[];
0438 } __packed;
0439 
0440 /**
0441  * struct qlink_cmd_get_sta_info - data for QLINK_CMD_GET_STA_INFO command
0442  *
0443  * @sta_addr: MAC address of the STA statistics is requested for.
0444  */
0445 struct qlink_cmd_get_sta_info {
0446     struct qlink_cmd chdr;
0447     u8 sta_addr[ETH_ALEN];
0448     u8 rsvd[2];
0449 } __packed;
0450 
0451 /**
0452  * struct qlink_cmd_add_key - data for QLINK_CMD_ADD_KEY command.
0453  *
0454  * @key_index: index of the key being installed.
0455  * @pairwise: whether to use pairwise key.
0456  * @addr: MAC address of a STA key is being installed to.
0457  * @cipher: cipher suite.
0458  * @vlanid: VLAN ID for AP_VLAN interface type
0459  * @key_data: key data itself.
0460  */
0461 struct qlink_cmd_add_key {
0462     struct qlink_cmd chdr;
0463     u8 key_index;
0464     u8 pairwise;
0465     u8 addr[ETH_ALEN];
0466     __le32 cipher;
0467     __le16 vlanid;
0468     u8 rsvd[2];
0469     u8 key_data[];
0470 } __packed;
0471 
0472 /**
0473  * struct qlink_cmd_del_key_req - data for QLINK_CMD_DEL_KEY command
0474  *
0475  * @key_index: index of the key being removed.
0476  * @pairwise: whether to use pairwise key.
0477  * @addr: MAC address of a STA for which a key is removed.
0478  */
0479 struct qlink_cmd_del_key {
0480     struct qlink_cmd chdr;
0481     u8 key_index;
0482     u8 pairwise;
0483     u8 addr[ETH_ALEN];
0484 } __packed;
0485 
0486 /**
0487  * struct qlink_cmd_set_def_key - data for QLINK_CMD_SET_DEFAULT_KEY command
0488  *
0489  * @key_index: index of the key to be set as default one.
0490  * @unicast: key is unicast.
0491  * @multicast: key is multicast.
0492  */
0493 struct qlink_cmd_set_def_key {
0494     struct qlink_cmd chdr;
0495     u8 key_index;
0496     u8 unicast;
0497     u8 multicast;
0498     u8 rsvd[1];
0499 } __packed;
0500 
0501 /**
0502  * struct qlink_cmd_set_def_mgmt_key - data for QLINK_CMD_SET_DEFAULT_MGMT_KEY
0503  *
0504  * @key_index: index of the key to be set as default MGMT key.
0505  */
0506 struct qlink_cmd_set_def_mgmt_key {
0507     struct qlink_cmd chdr;
0508     u8 key_index;
0509     u8 rsvd[3];
0510 } __packed;
0511 
0512 /**
0513  * struct qlink_cmd_change_sta - data for QLINK_CMD_CHANGE_STA command
0514  *
0515  * @flag_update: STA flags to update
0516  * @if_type: Mode of interface operation, one of &enum qlink_iface_type
0517  * @vlanid: VLAN ID to assign to specific STA
0518  * @sta_addr: address of the STA for which parameters are set.
0519  */
0520 struct qlink_cmd_change_sta {
0521     struct qlink_cmd chdr;
0522     struct qlink_sta_info_state flag_update;
0523     __le16 if_type;
0524     __le16 vlanid;
0525     u8 sta_addr[ETH_ALEN];
0526     u8 rsvd[2];
0527 } __packed;
0528 
0529 /**
0530  * struct qlink_cmd_del_sta - data for QLINK_CMD_DEL_STA command.
0531  *
0532  * See &struct station_del_parameters
0533  */
0534 struct qlink_cmd_del_sta {
0535     struct qlink_cmd chdr;
0536     __le16 reason_code;
0537     u8 sta_addr[ETH_ALEN];
0538     u8 subtype;
0539     u8 rsvd[3];
0540 } __packed;
0541 
0542 enum qlink_sta_connect_flags {
0543     QLINK_STA_CONNECT_DISABLE_HT    = BIT(0),
0544     QLINK_STA_CONNECT_DISABLE_VHT   = BIT(1),
0545     QLINK_STA_CONNECT_USE_RRM   = BIT(2),
0546 };
0547 
0548 /**
0549  * struct qlink_cmd_connect - data for QLINK_CMD_CONNECT command
0550  *
0551  * @bssid: BSSID of the BSS to connect to.
0552  * @bssid_hint: recommended AP BSSID for initial connection to the BSS or
0553  *  00:00:00:00:00:00 if not specified.
0554  * @prev_bssid: previous BSSID, if specified (not 00:00:00:00:00:00) indicates
0555  *  a request to reassociate.
0556  * @bg_scan_period: period of background scan.
0557  * @flags: one of &enum qlink_sta_connect_flags.
0558  * @ht_capa: HT Capabilities overrides.
0559  * @ht_capa_mask: The bits of ht_capa which are to be used.
0560  * @vht_capa: VHT Capability overrides
0561  * @vht_capa_mask: The bits of vht_capa which are to be used.
0562  * @aen: authentication information.
0563  * @mfp: whether to use management frame protection.
0564  * @payload: variable portion of connection request.
0565  */
0566 struct qlink_cmd_connect {
0567     struct qlink_cmd chdr;
0568     u8 bssid[ETH_ALEN];
0569     u8 bssid_hint[ETH_ALEN];
0570     u8 prev_bssid[ETH_ALEN];
0571     __le16 bg_scan_period;
0572     __le32 flags;
0573     struct ieee80211_ht_cap ht_capa;
0574     struct ieee80211_ht_cap ht_capa_mask;
0575     struct ieee80211_vht_cap vht_capa;
0576     struct ieee80211_vht_cap vht_capa_mask;
0577     struct qlink_auth_encr aen;
0578     u8 mfp;
0579     u8 pbss;
0580     u8 rsvd[2];
0581     u8 payload[];
0582 } __packed;
0583 
0584 /**
0585  * struct qlink_cmd_external_auth - data for QLINK_CMD_EXTERNAL_AUTH command
0586  *
0587  * @bssid: BSSID of the BSS to connect to
0588  * @status: authentication status code
0589  * @payload: variable portion of connection request.
0590  */
0591 struct qlink_cmd_external_auth {
0592     struct qlink_cmd chdr;
0593     u8 peer[ETH_ALEN];
0594     __le16 status;
0595     u8 payload[];
0596 } __packed;
0597 
0598 /**
0599  * struct qlink_cmd_disconnect - data for QLINK_CMD_DISCONNECT command
0600  *
0601  * @reason: code of the reason of disconnect, see &enum ieee80211_reasoncode.
0602  */
0603 struct qlink_cmd_disconnect {
0604     struct qlink_cmd chdr;
0605     __le16 reason;
0606     u8 rsvd[2];
0607 } __packed;
0608 
0609 /**
0610  * struct qlink_cmd_updown - data for QLINK_CMD_UPDOWN_INTF command
0611  *
0612  * @if_up: bring specified interface DOWN (if_up==0) or UP (otherwise).
0613  *  Interface is specified in common command header @chdr.
0614  */
0615 struct qlink_cmd_updown {
0616     struct qlink_cmd chdr;
0617     u8 if_up;
0618     u8 rsvd[3];
0619 } __packed;
0620 
0621 /**
0622  * enum qlink_band - a list of frequency bands
0623  *
0624  * @QLINK_BAND_2GHZ: 2.4GHz band
0625  * @QLINK_BAND_5GHZ: 5GHz band
0626  * @QLINK_BAND_60GHZ: 60GHz band
0627  */
0628 enum qlink_band {
0629     QLINK_BAND_2GHZ = BIT(0),
0630     QLINK_BAND_5GHZ = BIT(1),
0631     QLINK_BAND_60GHZ = BIT(2),
0632 };
0633 
0634 /**
0635  * struct qlink_cmd_band_info_get - data for QLINK_CMD_BAND_INFO_GET command
0636  *
0637  * @band: a PHY band for which information is queried, one of @enum qlink_band
0638  */
0639 struct qlink_cmd_band_info_get {
0640     struct qlink_cmd chdr;
0641     u8 band;
0642     u8 rsvd[3];
0643 } __packed;
0644 
0645 /**
0646  * struct qlink_cmd_get_chan_stats - data for QLINK_CMD_CHAN_STATS command
0647  *
0648  * @channel_freq: channel center frequency
0649  */
0650 struct qlink_cmd_get_chan_stats {
0651     struct qlink_cmd chdr;
0652     __le32 channel_freq;
0653 } __packed;
0654 
0655 /**
0656  * enum qlink_reg_initiator - Indicates the initiator of a reg domain request
0657  *
0658  * See &enum nl80211_reg_initiator for more info.
0659  */
0660 enum qlink_reg_initiator {
0661     QLINK_REGDOM_SET_BY_CORE,
0662     QLINK_REGDOM_SET_BY_USER,
0663     QLINK_REGDOM_SET_BY_DRIVER,
0664     QLINK_REGDOM_SET_BY_COUNTRY_IE,
0665 };
0666 
0667 /**
0668  * enum qlink_user_reg_hint_type - type of user regulatory hint
0669  *
0670  * See &enum nl80211_user_reg_hint_type for more info.
0671  */
0672 enum qlink_user_reg_hint_type {
0673     QLINK_USER_REG_HINT_USER    = 0,
0674     QLINK_USER_REG_HINT_CELL_BASE   = 1,
0675     QLINK_USER_REG_HINT_INDOOR  = 2,
0676 };
0677 
0678 /**
0679  * struct qlink_cmd_reg_notify - data for QLINK_CMD_REG_NOTIFY command
0680  *
0681  * @alpha2: the ISO / IEC 3166 alpha2 country code.
0682  * @initiator: which entity sent the request, one of &enum qlink_reg_initiator.
0683  * @user_reg_hint_type: type of hint for QLINK_REGDOM_SET_BY_USER request, one
0684  *  of &enum qlink_user_reg_hint_type.
0685  * @num_channels: number of &struct qlink_tlv_channel in a variable portion of a
0686  *  payload.
0687  * @dfs_region: one of &enum qlink_dfs_regions.
0688  * @slave_radar: whether slave device should enable radar detection.
0689  * @dfs_offload: enable or disable DFS offload to firmware.
0690  * @info: variable portion of regulatory notifier callback.
0691  */
0692 struct qlink_cmd_reg_notify {
0693     struct qlink_cmd chdr;
0694     u8 alpha2[2];
0695     u8 initiator;
0696     u8 user_reg_hint_type;
0697     u8 num_channels;
0698     u8 dfs_region;
0699     u8 slave_radar;
0700     u8 dfs_offload;
0701     u8 info[];
0702 } __packed;
0703 
0704 /**
0705  * enum qlink_chan_sw_flags - channel switch control flags
0706  *
0707  * @QLINK_CHAN_SW_RADAR_REQUIRED: whether radar detection is required on a new
0708  *  channel.
0709  * @QLINK_CHAN_SW_BLOCK_TX: whether transmissions should be blocked while
0710  *  changing a channel.
0711  */
0712 enum qlink_chan_sw_flags {
0713     QLINK_CHAN_SW_RADAR_REQUIRED = BIT(0),
0714     QLINK_CHAN_SW_BLOCK_TX = BIT(1),
0715 };
0716 
0717 /**
0718  * struct qlink_cmd_chan_switch - data for QLINK_CMD_CHAN_SWITCH command
0719  *
0720  * @channel: channel to switch to.
0721  * @flags: flags to control channel switch, bitmap of &enum qlink_chan_sw_flags.
0722  * @beacon_count: number of beacons until switch
0723  */
0724 struct qlink_cmd_chan_switch {
0725     struct qlink_cmd chdr;
0726     struct qlink_chandef channel;
0727     __le64 flags;
0728     __le32 n_counter_offsets_beacon;
0729     __le32 n_counter_offsets_presp;
0730     u8 beacon_count;
0731     u8 rsvd[3];
0732 } __packed;
0733 
0734 /**
0735  * enum qlink_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID
0736  *
0737  * Refer to &enum nl80211_hidden_ssid
0738  */
0739 enum qlink_hidden_ssid {
0740     QLINK_HIDDEN_SSID_NOT_IN_USE,
0741     QLINK_HIDDEN_SSID_ZERO_LEN,
0742     QLINK_HIDDEN_SSID_ZERO_CONTENTS
0743 };
0744 
0745 /**
0746  * struct qlink_cmd_start_ap - data for QLINK_CMD_START_AP command
0747  *
0748  * @beacon_interval: beacon interval
0749  * @inactivity_timeout: station's inactivity period in seconds
0750  * @dtim_period: DTIM period
0751  * @hidden_ssid: whether to hide the SSID, one of &enum qlink_hidden_ssid
0752  * @smps_mode: SMPS mode
0753  * @ht_required: stations must support HT
0754  * @vht_required: stations must support VHT
0755  * @aen: encryption info
0756  * @sr_params: spatial reuse parameters
0757  * @twt_responder: enable Target Wake Time
0758  * @info: variable configurations
0759  */
0760 struct qlink_cmd_start_ap {
0761     struct qlink_cmd chdr;
0762     __le16 beacon_interval;
0763     __le16 inactivity_timeout;
0764     u8 dtim_period;
0765     u8 hidden_ssid;
0766     u8 smps_mode;
0767     u8 p2p_ctwindow;
0768     u8 p2p_opp_ps;
0769     u8 pbss;
0770     u8 ht_required;
0771     u8 vht_required;
0772     struct qlink_auth_encr aen;
0773     struct qlink_sr_params sr_params;
0774     u8 twt_responder;
0775     u8 rsvd[3];
0776     u8 info[];
0777 } __packed;
0778 
0779 /**
0780  * struct qlink_cmd_start_cac - data for QLINK_CMD_START_CAC command
0781  *
0782  * @chan: a channel to start a radar detection procedure on.
0783  * @cac_time_ms: CAC time.
0784  */
0785 struct qlink_cmd_start_cac {
0786     struct qlink_cmd chdr;
0787     struct qlink_chandef chan;
0788     __le32 cac_time_ms;
0789 } __packed;
0790 
0791 enum qlink_acl_policy {
0792     QLINK_ACL_POLICY_ACCEPT_UNLESS_LISTED,
0793     QLINK_ACL_POLICY_DENY_UNLESS_LISTED,
0794 };
0795 
0796 struct qlink_mac_address {
0797     u8 addr[ETH_ALEN];
0798 } __packed;
0799 
0800 /**
0801  * struct qlink_acl_data - ACL data
0802  *
0803  * @policy: filter policy, one of &enum qlink_acl_policy.
0804  * @num_entries: number of MAC addresses in array.
0805  * @mac_address: MAC addresses array.
0806  */
0807 struct qlink_acl_data {
0808     __le32 policy;
0809     __le32 num_entries;
0810     struct qlink_mac_address mac_addrs[];
0811 } __packed;
0812 
0813 /**
0814  * enum qlink_pm_mode - Power Management mode
0815  *
0816  * @QLINK_PM_OFF: normal mode, no power saving enabled
0817  * @QLINK_PM_AUTO_STANDBY: enable auto power save mode
0818  */
0819 enum qlink_pm_mode {
0820     QLINK_PM_OFF        = 0,
0821     QLINK_PM_AUTO_STANDBY   = 1,
0822 };
0823 
0824 /**
0825  * struct qlink_cmd_pm_set - data for QLINK_CMD_PM_SET command
0826  *
0827  * @pm_standby timer: period of network inactivity in seconds before
0828  *  putting a radio in power save mode
0829  * @pm_mode: power management mode
0830  */
0831 struct qlink_cmd_pm_set {
0832     struct qlink_cmd chdr;
0833     __le32 pm_standby_timer;
0834     u8 pm_mode;
0835     u8 rsvd[3];
0836 } __packed;
0837 
0838 /**
0839  * enum qlink_txpwr_op - transmit power operation type
0840  * @QLINK_TXPWR_SET: set tx power
0841  * @QLINK_TXPWR_GET: get current tx power setting
0842  */
0843 enum qlink_txpwr_op {
0844     QLINK_TXPWR_SET,
0845     QLINK_TXPWR_GET
0846 };
0847 
0848 /**
0849  * struct qlink_cmd_txpwr - get or set current transmit power
0850  *
0851  * @txpwr: new transmit power setting, in mBm
0852  * @txpwr_setting: transmit power setting type, one of
0853  *  &enum nl80211_tx_power_setting
0854  * @op_type: type of operation, one of &enum qlink_txpwr_op
0855  */
0856 struct qlink_cmd_txpwr {
0857     struct qlink_cmd chdr;
0858     __le32 txpwr;
0859     u8 txpwr_setting;
0860     u8 op_type;
0861     u8 rsvd[2];
0862 } __packed;
0863 
0864 /**
0865  * enum qlink_wowlan_trigger
0866  *
0867  * @QLINK_WOWLAN_TRIG_DISCONNECT: wakeup on disconnect
0868  * @QLINK_WOWLAN_TRIG_MAGIC_PKT: wakeup on magic packet
0869  * @QLINK_WOWLAN_TRIG_PATTERN_PKT: wakeup on user-defined packet
0870  */
0871 enum qlink_wowlan_trigger {
0872     QLINK_WOWLAN_TRIG_DISCONNECT    = BIT(0),
0873     QLINK_WOWLAN_TRIG_MAGIC_PKT = BIT(1),
0874     QLINK_WOWLAN_TRIG_PATTERN_PKT   = BIT(2),
0875 };
0876 
0877 /**
0878  * struct qlink_cmd_wowlan_set - data for QLINK_CMD_WOWLAN_SET command
0879  *
0880  * @triggers: requested bitmask of WoWLAN triggers
0881  */
0882 struct qlink_cmd_wowlan_set {
0883     struct qlink_cmd chdr;
0884     __le32 triggers;
0885     u8 data[];
0886 } __packed;
0887 
0888 enum qlink_ndev_event_type {
0889     QLINK_NDEV_EVENT_CHANGEUPPER,
0890 };
0891 
0892 /**
0893  * struct qlink_cmd_ndev_event - data for QLINK_CMD_NDEV_EVENT command
0894  *
0895  * @event: type of event, one of &enum qlink_ndev_event_type
0896  */
0897 struct qlink_cmd_ndev_event {
0898     struct qlink_cmd chdr;
0899     __le16 event;
0900     u8 rsvd[2];
0901 } __packed;
0902 
0903 enum qlink_ndev_upper_type {
0904     QLINK_NDEV_UPPER_TYPE_NONE,
0905     QLINK_NDEV_UPPER_TYPE_BRIDGE,
0906 };
0907 
0908 /**
0909  * struct qlink_cmd_ndev_changeupper - data for QLINK_NDEV_EVENT_CHANGEUPPER
0910  *
0911  * @br_domain: layer 2 broadcast domain ID that ndev is a member of
0912  * @upper_type: type of upper device, one of &enum qlink_ndev_upper_type
0913  */
0914 struct qlink_cmd_ndev_changeupper {
0915     struct qlink_cmd_ndev_event nehdr;
0916     __le64 flags;
0917     __le32 br_domain;
0918     __le32 netspace_id;
0919     __le16 vlanid;
0920     u8 upper_type;
0921     u8 rsvd[1];
0922 } __packed;
0923 
0924 /**
0925  * enum qlink_scan_flags -  scan request control flags
0926  *
0927  * Scan flags are used to control QLINK_CMD_SCAN behavior.
0928  *
0929  * @QLINK_SCAN_FLAG_FLUSH: flush cache before scanning.
0930  */
0931 enum qlink_scan_flags {
0932     QLINK_SCAN_FLAG_FLUSH = BIT(0),
0933     QLINK_SCAN_FLAG_DURATION_MANDATORY = BIT(1),
0934 };
0935 
0936 /**
0937  * struct qlink_cmd_scan - data for QLINK_CMD_SCAN command
0938  *
0939  * @flags: scan flags, a bitmap of &enum qlink_scan_flags.
0940  * @n_ssids: number of WLAN_EID_SSID TLVs expected in variable portion of the
0941  *  command.
0942  * @n_channels: number of QTN_TLV_ID_CHANNEL TLVs expected in variable payload.
0943  * @active_dwell: time spent on a single channel for an active scan.
0944  * @passive_dwell: time spent on a single channel for a passive scan.
0945  * @sample_duration: total duration of sampling a single channel during a scan
0946  *  including off-channel dwell time and operating channel time.
0947  * @bssid: specific BSSID to scan for or a broadcast BSSID.
0948  * @scan_width: channel width to use, one of &enum qlink_channel_width.
0949  */
0950 struct qlink_cmd_scan {
0951     struct qlink_cmd chdr;
0952     __le64 flags;
0953     __le16 n_ssids;
0954     __le16 n_channels;
0955     __le16 active_dwell;
0956     __le16 passive_dwell;
0957     __le16 sample_duration;
0958     u8 bssid[ETH_ALEN];
0959     u8 scan_width;
0960     u8 rsvd[3];
0961     u8 var_info[];
0962 } __packed;
0963 
0964 /**
0965  * struct qlink_cmd_update_owe - data for QLINK_CMD_UPDATE_OWE_INFO command
0966  *
0967  * @peer: MAC of the peer device for which OWE processing has been completed
0968  * @status: OWE external processing status code
0969  * @ies: IEs for the peer constructed by the user space
0970  */
0971 struct qlink_cmd_update_owe {
0972     struct qlink_cmd chdr;
0973     u8 peer[ETH_ALEN];
0974     __le16 status;
0975     u8 ies[];
0976 } __packed;
0977 
0978 /* QLINK Command Responses messages related definitions
0979  */
0980 
0981 enum qlink_cmd_result {
0982     QLINK_CMD_RESULT_OK = 0,
0983     QLINK_CMD_RESULT_INVALID,
0984     QLINK_CMD_RESULT_ENOTSUPP,
0985     QLINK_CMD_RESULT_ENOTFOUND,
0986     QLINK_CMD_RESULT_EALREADY,
0987     QLINK_CMD_RESULT_EADDRINUSE,
0988     QLINK_CMD_RESULT_EADDRNOTAVAIL,
0989     QLINK_CMD_RESULT_EBUSY,
0990 };
0991 
0992 /**
0993  * struct qlink_resp - QLINK command response message header
0994  *
0995  * Header used for QLINK messages of QLINK_MSG_TYPE_CMDRSP type.
0996  *
0997  * @mhdr: see &struct qlink_msg_header.
0998  * @cmd_id: command ID the response corresponds to, one of &enum qlink_cmd_type.
0999  * @seq_num: sequence number of command message, used for matching with
1000  *  response message.
1001  * @result: result of the command execution, one of &enum qlink_cmd_result.
1002  * @macid: index of physical radio device the response is sent from or
1003  *  QLINK_MACID_RSVD if not applicable.
1004  * @vifid: index of virtual wireless interface on specified @macid the response
1005  *  is sent from or QLINK_VIFID_RSVD if not applicable.
1006  */
1007 struct qlink_resp {
1008     struct qlink_msg_header mhdr;
1009     __le16 cmd_id;
1010     __le16 seq_num;
1011     __le16 result;
1012     u8 macid;
1013     u8 vifid;
1014 } __packed;
1015 
1016 /**
1017  * struct qlink_resp_init_fw - response for QLINK_CMD_FW_INIT
1018  *
1019  * @qlink_proto_ver: QLINK protocol version used by wifi card firmware.
1020  */
1021 struct qlink_resp_init_fw {
1022     struct qlink_resp rhdr;
1023     __le32 qlink_proto_ver;
1024 } __packed;
1025 
1026 /**
1027  * enum qlink_dfs_regions - regulatory DFS regions
1028  *
1029  * Corresponds to &enum nl80211_dfs_regions.
1030  */
1031 enum qlink_dfs_regions {
1032     QLINK_DFS_UNSET = 0,
1033     QLINK_DFS_FCC   = 1,
1034     QLINK_DFS_ETSI  = 2,
1035     QLINK_DFS_JP    = 3,
1036 };
1037 
1038 /**
1039  * struct qlink_resp_get_mac_info - response for QLINK_CMD_MAC_INFO command
1040  *
1041  * Data describing specific physical device providing wireless MAC
1042  * functionality.
1043  *
1044  * @dev_mac: MAC address of physical WMAC device (used for first BSS on
1045  *  specified WMAC).
1046  * @num_tx_chain: Number of transmit chains used by WMAC.
1047  * @num_rx_chain: Number of receive chains used by WMAC.
1048  * @vht_cap_mod_mask: mask specifying which VHT capabilities can be altered.
1049  * @ht_cap_mod_mask: mask specifying which HT capabilities can be altered.
1050  * @max_scan_ssids: maximum number of SSIDs the device can scan for in any scan.
1051  * @bands_cap: wireless bands WMAC can operate in, bitmap of &enum qlink_band.
1052  * @max_ap_assoc_sta: Maximum number of associations supported by WMAC.
1053  * @radar_detect_widths: bitmask of channels BW for which WMAC can detect radar.
1054  * @alpha2: country code ID firmware is configured to.
1055  * @n_reg_rules: number of regulatory rules TLVs in variable portion of the
1056  *  message.
1057  * @dfs_region: regulatory DFS region, one of &enum qlink_dfs_regions.
1058  * @var_info: variable-length WMAC info data.
1059  */
1060 struct qlink_resp_get_mac_info {
1061     struct qlink_resp rhdr;
1062     u8 dev_mac[ETH_ALEN];
1063     u8 num_tx_chain;
1064     u8 num_rx_chain;
1065     struct ieee80211_vht_cap vht_cap_mod_mask;
1066     struct ieee80211_ht_cap ht_cap_mod_mask;
1067 
1068     __le16 max_ap_assoc_sta;
1069     __le32 hw_version;
1070     __le32 probe_resp_offload;
1071     __le32 bss_select_support;
1072     __le16 n_addresses;
1073     __le16 radar_detect_widths;
1074     __le16 max_remain_on_channel_duration;
1075     __le16 max_acl_mac_addrs;
1076 
1077     __le32 frag_threshold;
1078     __le32 rts_threshold;
1079     u8 retry_short;
1080     u8 retry_long;
1081     u8 coverage_class;
1082 
1083     u8 max_scan_ssids;
1084     u8 max_sched_scan_reqs;
1085     u8 max_sched_scan_ssids;
1086     u8 max_match_sets;
1087     u8 max_adj_channel_rssi_comp;
1088 
1089     __le16 max_scan_ie_len;
1090     __le16 max_sched_scan_ie_len;
1091     __le32 max_sched_scan_plans;
1092     __le32 max_sched_scan_plan_interval;
1093     __le32 max_sched_scan_plan_iterations;
1094 
1095     u8 n_cipher_suites;
1096     u8 n_akm_suites;
1097     u8 max_num_pmkids;
1098     u8 num_iftype_ext_capab;
1099     u8 extended_capabilities_len;
1100     u8 max_data_retry_count;
1101     u8 n_iface_combinations;
1102     u8 max_num_csa_counters;
1103 
1104     u8 bands_cap;
1105     u8 alpha2[2];
1106     u8 n_reg_rules;
1107     u8 dfs_region;
1108     u8 rsvd[3];
1109     u8 var_info[];
1110 } __packed;
1111 
1112 /**
1113  * struct qlink_resp_get_hw_info - response for QLINK_CMD_GET_HW_INFO command
1114  *
1115  * Description of wireless hardware capabilities and features.
1116  *
1117  * @fw_ver: wireless hardware firmware version.
1118  * @num_mac: Number of separate physical radio devices provided by hardware.
1119  * @mac_bitmap: Bitmap of MAC IDs that are active and can be used in firmware.
1120  * @total_tx_chains: total number of transmit chains used by device.
1121  * @total_rx_chains: total number of receive chains.
1122  * @info: variable-length HW info.
1123  */
1124 struct qlink_resp_get_hw_info {
1125     struct qlink_resp rhdr;
1126     __le32 fw_ver;
1127     __le32 bld_tmstamp;
1128     __le32 plat_id;
1129     __le32 hw_ver;
1130     u8 num_mac;
1131     u8 mac_bitmap;
1132     u8 total_tx_chain;
1133     u8 total_rx_chain;
1134     u8 info[];
1135 } __packed;
1136 
1137 /**
1138  * struct qlink_resp_manage_intf - response for interface management commands
1139  *
1140  * Response data for QLINK_CMD_ADD_INTF and QLINK_CMD_CHANGE_INTF commands.
1141  *
1142  * @rhdr: Common Command Response message header.
1143  * @intf_info: interface description.
1144  */
1145 struct qlink_resp_manage_intf {
1146     struct qlink_resp rhdr;
1147     struct qlink_intf_info intf_info;
1148 } __packed;
1149 
1150 enum qlink_sta_info_rate_flags {
1151     QLINK_STA_INFO_RATE_FLAG_HT_MCS     = BIT(0),
1152     QLINK_STA_INFO_RATE_FLAG_VHT_MCS    = BIT(1),
1153     QLINK_STA_INFO_RATE_FLAG_SHORT_GI   = BIT(2),
1154     QLINK_STA_INFO_RATE_FLAG_60G        = BIT(3),
1155     QLINK_STA_INFO_RATE_FLAG_HE_MCS     = BIT(4),
1156 };
1157 
1158 /**
1159  * struct qlink_resp_get_sta_info - response for QLINK_CMD_GET_STA_INFO command
1160  *
1161  * Response data containing statistics for specified STA.
1162  *
1163  * @sta_addr: MAC address of STA the response carries statistic for.
1164  * @info: variable statistics for specified STA.
1165  */
1166 struct qlink_resp_get_sta_info {
1167     struct qlink_resp rhdr;
1168     u8 sta_addr[ETH_ALEN];
1169     u8 rsvd[2];
1170     u8 info[];
1171 } __packed;
1172 
1173 /**
1174  * struct qlink_resp_band_info_get - response for QLINK_CMD_BAND_INFO_GET cmd
1175  *
1176  * @band: frequency band that the response describes, one of @enum qlink_band.
1177  * @num_chans: total number of channels info TLVs contained in reply.
1178  * @num_bitrates: total number of bitrate TLVs contained in reply.
1179  * @info: variable-length info portion.
1180  */
1181 struct qlink_resp_band_info_get {
1182     struct qlink_resp rhdr;
1183     u8 band;
1184     u8 num_chans;
1185     u8 num_bitrates;
1186     u8 rsvd[1];
1187     u8 info[];
1188 } __packed;
1189 
1190 /**
1191  * struct qlink_resp_get_chan_stats - response for QLINK_CMD_CHAN_STATS cmd
1192  *
1193  * @chan_freq: center frequency for a channel the report is sent for.
1194  * @info: variable-length channel info.
1195  */
1196 struct qlink_resp_get_chan_stats {
1197     struct qlink_resp rhdr;
1198     __le32 chan_freq;
1199     u8 info[];
1200 } __packed;
1201 
1202 /**
1203  * struct qlink_resp_channel_get - response for QLINK_CMD_CHAN_GET command
1204  *
1205  * @chan: definition of current operating channel.
1206  */
1207 struct qlink_resp_channel_get {
1208     struct qlink_resp rhdr;
1209     struct qlink_chandef chan;
1210 } __packed;
1211 
1212 /**
1213  * struct qlink_resp_txpwr - response for QLINK_CMD_TXPWR command
1214  *
1215  * This response is intended for QLINK_TXPWR_GET operation and does not
1216  * contain any meaningful information in case of QLINK_TXPWR_SET operation.
1217  *
1218  * @txpwr: current transmit power setting, in mBm
1219  */
1220 struct qlink_resp_txpwr {
1221     struct qlink_resp rhdr;
1222     __le32 txpwr;
1223 } __packed;
1224 
1225 /* QLINK Events messages related definitions
1226  */
1227 
1228 enum qlink_event_type {
1229     QLINK_EVENT_STA_ASSOCIATED  = 0x0021,
1230     QLINK_EVENT_STA_DEAUTH      = 0x0022,
1231     QLINK_EVENT_MGMT_RECEIVED   = 0x0023,
1232     QLINK_EVENT_SCAN_RESULTS    = 0x0024,
1233     QLINK_EVENT_SCAN_COMPLETE   = 0x0025,
1234     QLINK_EVENT_BSS_JOIN        = 0x0026,
1235     QLINK_EVENT_BSS_LEAVE       = 0x0027,
1236     QLINK_EVENT_FREQ_CHANGE     = 0x0028,
1237     QLINK_EVENT_RADAR       = 0x0029,
1238     QLINK_EVENT_EXTERNAL_AUTH   = 0x0030,
1239     QLINK_EVENT_MIC_FAILURE     = 0x0031,
1240     QLINK_EVENT_UPDATE_OWE      = 0x0032,
1241 };
1242 
1243 /**
1244  * struct qlink_event - QLINK event message header
1245  *
1246  * Header used for QLINK messages of QLINK_MSG_TYPE_EVENT type.
1247  *
1248  * @mhdr: Common QLINK message header.
1249  * @event_id: Specifies specific event ID, one of &enum qlink_event_type.
1250  * @macid: index of physical radio device the event was generated on or
1251  *  QLINK_MACID_RSVD if not applicable.
1252  * @vifid: index of virtual wireless interface on specified @macid the event
1253  *  was generated on or QLINK_VIFID_RSVD if not applicable.
1254  */
1255 struct qlink_event {
1256     struct qlink_msg_header mhdr;
1257     __le16 event_id;
1258     u8 macid;
1259     u8 vifid;
1260 } __packed;
1261 
1262 /**
1263  * struct qlink_event_sta_assoc - data for QLINK_EVENT_STA_ASSOCIATED event
1264  *
1265  * @sta_addr: Address of a STA for which new association event was generated
1266  * @frame_control: control bits from 802.11 ASSOC_REQUEST header.
1267  * @payload: IEs from association request.
1268  */
1269 struct qlink_event_sta_assoc {
1270     struct qlink_event ehdr;
1271     u8 sta_addr[ETH_ALEN];
1272     __le16 frame_control;
1273     u8 ies[];
1274 } __packed;
1275 
1276 /**
1277  * struct qlink_event_sta_deauth - data for QLINK_EVENT_STA_DEAUTH event
1278  *
1279  * @sta_addr: Address of a deauthenticated STA.
1280  * @reason: reason for deauthentication.
1281  */
1282 struct qlink_event_sta_deauth {
1283     struct qlink_event ehdr;
1284     u8 sta_addr[ETH_ALEN];
1285     __le16 reason;
1286 } __packed;
1287 
1288 /**
1289  * struct qlink_event_bss_join - data for QLINK_EVENT_BSS_JOIN event
1290  *
1291  * @chan: new operating channel definition
1292  * @bssid: BSSID of a BSS which interface tried to joined.
1293  * @status: status of joining attempt, see &enum ieee80211_statuscode.
1294  */
1295 struct qlink_event_bss_join {
1296     struct qlink_event ehdr;
1297     struct qlink_chandef chan;
1298     u8 bssid[ETH_ALEN];
1299     __le16 status;
1300     u8 ies[];
1301 } __packed;
1302 
1303 /**
1304  * struct qlink_event_bss_leave - data for QLINK_EVENT_BSS_LEAVE event
1305  *
1306  * @reason: reason of disconnecting from BSS.
1307  */
1308 struct qlink_event_bss_leave {
1309     struct qlink_event ehdr;
1310     __le16 reason;
1311     u8 rsvd[2];
1312 } __packed;
1313 
1314 /**
1315  * struct qlink_event_freq_change - data for QLINK_EVENT_FREQ_CHANGE event
1316  *
1317  * @chan: new operating channel definition
1318  */
1319 struct qlink_event_freq_change {
1320     struct qlink_event ehdr;
1321     struct qlink_chandef chan;
1322 } __packed;
1323 
1324 enum qlink_rxmgmt_flags {
1325     QLINK_RXMGMT_FLAG_ANSWERED = 1 << 0,
1326 };
1327 
1328 /**
1329  * struct qlink_event_rxmgmt - data for QLINK_EVENT_MGMT_RECEIVED event
1330  *
1331  * @freq: Frequency on which the frame was received in MHz.
1332  * @flags: bitmap of &enum qlink_rxmgmt_flags.
1333  * @sig_dbm: signal strength in dBm.
1334  * @frame_data: data of Rx'd frame itself.
1335  */
1336 struct qlink_event_rxmgmt {
1337     struct qlink_event ehdr;
1338     __le32 freq;
1339     __le32 flags;
1340     s8 sig_dbm;
1341     u8 rsvd[3];
1342     u8 frame_data[];
1343 } __packed;
1344 
1345 /**
1346  * struct qlink_event_scan_result - data for QLINK_EVENT_SCAN_RESULTS event
1347  *
1348  * @tsf: TSF timestamp indicating when scan results were generated.
1349  * @freq: Center frequency of the channel where BSS for which the scan result
1350  *  event was generated was discovered.
1351  * @capab: capabilities field.
1352  * @bintval: beacon interval announced by discovered BSS.
1353  * @sig_dbm: signal strength in dBm.
1354  * @bssid: BSSID announced by discovered BSS.
1355  * @ssid_len: length of SSID announced by BSS.
1356  * @ssid: SSID announced by discovered BSS.
1357  * @payload: IEs that are announced by discovered BSS in its MGMt frames.
1358  */
1359 struct qlink_event_scan_result {
1360     struct qlink_event ehdr;
1361     __le64 tsf;
1362     __le16 freq;
1363     __le16 capab;
1364     __le16 bintval;
1365     s8 sig_dbm;
1366     u8 ssid_len;
1367     u8 ssid[IEEE80211_MAX_SSID_LEN];
1368     u8 bssid[ETH_ALEN];
1369     u8 rsvd[2];
1370     u8 payload[];
1371 } __packed;
1372 
1373 /**
1374  * enum qlink_scan_complete_flags - indicates result of scan request.
1375  *
1376  * @QLINK_SCAN_NONE: Scan request was processed.
1377  * @QLINK_SCAN_ABORTED: Scan was aborted.
1378  */
1379 enum qlink_scan_complete_flags {
1380     QLINK_SCAN_NONE     = 0,
1381     QLINK_SCAN_ABORTED  = BIT(0),
1382 };
1383 
1384 /**
1385  * struct qlink_event_scan_complete - data for QLINK_EVENT_SCAN_COMPLETE event
1386  *
1387  * @flags: flags indicating the status of pending scan request,
1388  *  see &enum qlink_scan_complete_flags.
1389  */
1390 struct qlink_event_scan_complete {
1391     struct qlink_event ehdr;
1392     __le32 flags;
1393 } __packed;
1394 
1395 enum qlink_radar_event {
1396     QLINK_RADAR_DETECTED,
1397     QLINK_RADAR_CAC_FINISHED,
1398     QLINK_RADAR_CAC_ABORTED,
1399     QLINK_RADAR_NOP_FINISHED,
1400     QLINK_RADAR_PRE_CAC_EXPIRED,
1401     QLINK_RADAR_CAC_STARTED,
1402 };
1403 
1404 /**
1405  * struct qlink_event_radar - data for QLINK_EVENT_RADAR event
1406  *
1407  * @chan: channel on which radar event happened.
1408  * @event: radar event type, one of &enum qlink_radar_event.
1409  */
1410 struct qlink_event_radar {
1411     struct qlink_event ehdr;
1412     struct qlink_chandef chan;
1413     u8 event;
1414     u8 rsvd[3];
1415 } __packed;
1416 
1417 /**
1418  * struct qlink_event_external_auth - data for QLINK_EVENT_EXTERNAL_AUTH event
1419  *
1420  * @ssid: SSID announced by BSS
1421  * @ssid_len: SSID length
1422  * @bssid: BSSID of the BSS to connect to
1423  * @akm_suite: AKM suite for external authentication
1424  * @action: action type/trigger for external authentication
1425  */
1426 struct qlink_event_external_auth {
1427     struct qlink_event ehdr;
1428     __le32 akm_suite;
1429     u8 ssid[IEEE80211_MAX_SSID_LEN];
1430     u8 bssid[ETH_ALEN];
1431     u8 ssid_len;
1432     u8 action;
1433 } __packed;
1434 
1435 /**
1436  * struct qlink_event_mic_failure - data for QLINK_EVENT_MIC_FAILURE event
1437  *
1438  * @src: source MAC address of the frame
1439  * @key_index: index of the key being reported
1440  * @pairwise: whether the key is pairwise or group
1441  */
1442 struct qlink_event_mic_failure {
1443     struct qlink_event ehdr;
1444     u8 src[ETH_ALEN];
1445     u8 key_index;
1446     u8 pairwise;
1447 } __packed;
1448 
1449 /**
1450  * struct qlink_event_update_owe - data for QLINK_EVENT_UPDATE_OWE event
1451  *
1452  * @peer: MAC addr of the peer device for which OWE processing needs to be done
1453  * @ies: IEs from the peer
1454  */
1455 struct qlink_event_update_owe {
1456     struct qlink_event ehdr;
1457     u8 peer[ETH_ALEN];
1458     u8 rsvd[2];
1459     u8 ies[];
1460 } __packed;
1461 
1462 /* QLINK TLVs (Type-Length Values) definitions
1463  */
1464 
1465 /**
1466  * enum qlink_tlv_id - list of TLVs that Qlink messages can carry
1467  *
1468  * @QTN_TLV_ID_BITMAP: a data representing a bitmap that is used together with
1469  *  other TLVs:
1470  *  &enum qlink_sta_info used to indicate which statistic carried in
1471  *  QTN_TLV_ID_STA_STATS is valid.
1472  *  &enum qlink_hw_capab listing wireless card capabilities.
1473  *  &enum qlink_driver_capab listing driver/host system capabilities.
1474  *  &enum qlink_chan_stat used to indicate which statistic carried in
1475  *  QTN_TLV_ID_CHANNEL_STATS is valid.
1476  * @QTN_TLV_ID_STA_STATS: per-STA statistics as defined by
1477  *  &struct qlink_sta_stats. Valid values are marked as such in a bitmap
1478  *  carried by QTN_TLV_ID_BITMAP.
1479  * @QTN_TLV_ID_IFTYPE_DATA: supported band data.
1480  */
1481 enum qlink_tlv_id {
1482     QTN_TLV_ID_FRAG_THRESH      = 0x0201,
1483     QTN_TLV_ID_RTS_THRESH       = 0x0202,
1484     QTN_TLV_ID_SRETRY_LIMIT     = 0x0203,
1485     QTN_TLV_ID_LRETRY_LIMIT     = 0x0204,
1486     QTN_TLV_ID_REG_RULE     = 0x0207,
1487     QTN_TLV_ID_CHANNEL      = 0x020F,
1488     QTN_TLV_ID_CHANDEF      = 0x0210,
1489     QTN_TLV_ID_BITMAP       = 0x0211,
1490     QTN_TLV_ID_STA_STATS        = 0x0212,
1491     QTN_TLV_ID_COVERAGE_CLASS   = 0x0213,
1492     QTN_TLV_ID_IFACE_LIMIT      = 0x0214,
1493     QTN_TLV_ID_CHANNEL_STATS    = 0x0216,
1494     QTN_TLV_ID_KEY          = 0x0302,
1495     QTN_TLV_ID_SEQ          = 0x0303,
1496     QTN_TLV_ID_IE_SET       = 0x0305,
1497     QTN_TLV_ID_EXT_CAPABILITY_MASK  = 0x0306,
1498     QTN_TLV_ID_ACL_DATA     = 0x0307,
1499     QTN_TLV_ID_BUILD_NAME       = 0x0401,
1500     QTN_TLV_ID_BUILD_REV        = 0x0402,
1501     QTN_TLV_ID_BUILD_TYPE       = 0x0403,
1502     QTN_TLV_ID_BUILD_LABEL      = 0x0404,
1503     QTN_TLV_ID_HW_ID        = 0x0405,
1504     QTN_TLV_ID_CALIBRATION_VER  = 0x0406,
1505     QTN_TLV_ID_UBOOT_VER        = 0x0407,
1506     QTN_TLV_ID_RANDOM_MAC_ADDR  = 0x0408,
1507     QTN_TLV_ID_WOWLAN_CAPAB     = 0x0410,
1508     QTN_TLV_ID_WOWLAN_PATTERN   = 0x0411,
1509     QTN_TLV_ID_IFTYPE_DATA      = 0x0418,
1510 };
1511 
1512 struct qlink_tlv_hdr {
1513     __le16 type;
1514     __le16 len;
1515     u8 val[];
1516 } __packed;
1517 
1518 struct qlink_iface_limit {
1519     __le16 max_num;
1520     __le16 type;
1521 } __packed;
1522 
1523 struct qlink_iface_limit_record {
1524     __le16 max_interfaces;
1525     u8 num_different_channels;
1526     u8 n_limits;
1527     struct qlink_iface_limit limits[];
1528 } __packed;
1529 
1530 #define QLINK_RSSI_OFFSET   120
1531 
1532 /**
1533  * enum qlink_reg_rule_flags - regulatory rule flags
1534  *
1535  * See description of &enum nl80211_reg_rule_flags
1536  */
1537 enum qlink_reg_rule_flags {
1538     QLINK_RRF_NO_OFDM   = BIT(0),
1539     QLINK_RRF_NO_CCK    = BIT(1),
1540     QLINK_RRF_NO_INDOOR = BIT(2),
1541     QLINK_RRF_NO_OUTDOOR    = BIT(3),
1542     QLINK_RRF_DFS       = BIT(4),
1543     QLINK_RRF_PTP_ONLY  = BIT(5),
1544     QLINK_RRF_PTMP_ONLY = BIT(6),
1545     QLINK_RRF_NO_IR     = BIT(7),
1546     QLINK_RRF_AUTO_BW   = BIT(8),
1547     QLINK_RRF_IR_CONCURRENT = BIT(9),
1548     QLINK_RRF_NO_HT40MINUS  = BIT(10),
1549     QLINK_RRF_NO_HT40PLUS   = BIT(11),
1550     QLINK_RRF_NO_80MHZ  = BIT(12),
1551     QLINK_RRF_NO_160MHZ = BIT(13),
1552 };
1553 
1554 /**
1555  * struct qlink_tlv_reg_rule - data for QTN_TLV_ID_REG_RULE TLV
1556  *
1557  * Regulatory rule description.
1558  *
1559  * @start_freq_khz: start frequency of the range the rule is attributed to.
1560  * @end_freq_khz: end frequency of the range the rule is attributed to.
1561  * @max_bandwidth_khz: max bandwidth that channels in specified range can be
1562  *  configured to.
1563  * @max_antenna_gain: max antenna gain that can be used in the specified
1564  *  frequency range, dBi.
1565  * @max_eirp: maximum EIRP.
1566  * @flags: regulatory rule flags in &enum qlink_reg_rule_flags.
1567  * @dfs_cac_ms: DFS CAC period.
1568  */
1569 struct qlink_tlv_reg_rule {
1570     struct qlink_tlv_hdr hdr;
1571     __le32 start_freq_khz;
1572     __le32 end_freq_khz;
1573     __le32 max_bandwidth_khz;
1574     __le32 max_antenna_gain;
1575     __le32 max_eirp;
1576     __le32 flags;
1577     __le32 dfs_cac_ms;
1578 } __packed;
1579 
1580 enum qlink_channel_flags {
1581     QLINK_CHAN_DISABLED     = BIT(0),
1582     QLINK_CHAN_NO_IR        = BIT(1),
1583     QLINK_CHAN_RADAR        = BIT(3),
1584     QLINK_CHAN_NO_HT40PLUS      = BIT(4),
1585     QLINK_CHAN_NO_HT40MINUS     = BIT(5),
1586     QLINK_CHAN_NO_OFDM      = BIT(6),
1587     QLINK_CHAN_NO_80MHZ     = BIT(7),
1588     QLINK_CHAN_NO_160MHZ        = BIT(8),
1589     QLINK_CHAN_INDOOR_ONLY      = BIT(9),
1590     QLINK_CHAN_IR_CONCURRENT    = BIT(10),
1591     QLINK_CHAN_NO_20MHZ     = BIT(11),
1592     QLINK_CHAN_NO_10MHZ     = BIT(12),
1593 };
1594 
1595 enum qlink_dfs_state {
1596     QLINK_DFS_USABLE,
1597     QLINK_DFS_UNAVAILABLE,
1598     QLINK_DFS_AVAILABLE,
1599 };
1600 
1601 /**
1602  * struct qlink_tlv_channel - data for QTN_TLV_ID_CHANNEL TLV
1603  *
1604  * Channel settings.
1605  *
1606  * @channel: ieee80211 channel settings.
1607  */
1608 struct qlink_tlv_channel {
1609     struct qlink_tlv_hdr hdr;
1610     struct qlink_channel chan;
1611 } __packed;
1612 
1613 /**
1614  * struct qlink_tlv_chandef - data for QTN_TLV_ID_CHANDEF TLV
1615  *
1616  * Channel definition.
1617  *
1618  * @chan: channel definition data.
1619  */
1620 struct qlink_tlv_chandef {
1621     struct qlink_tlv_hdr hdr;
1622     struct qlink_chandef chdef;
1623 } __packed;
1624 
1625 enum qlink_ie_set_type {
1626     QLINK_IE_SET_UNKNOWN,
1627     QLINK_IE_SET_ASSOC_REQ,
1628     QLINK_IE_SET_ASSOC_RESP,
1629     QLINK_IE_SET_PROBE_REQ,
1630     QLINK_IE_SET_SCAN,
1631     QLINK_IE_SET_BEACON_HEAD,
1632     QLINK_IE_SET_BEACON_TAIL,
1633     QLINK_IE_SET_BEACON_IES,
1634     QLINK_IE_SET_PROBE_RESP,
1635     QLINK_IE_SET_PROBE_RESP_IES,
1636 };
1637 
1638 /**
1639  * struct qlink_tlv_ie_set - data for QTN_TLV_ID_IE_SET
1640  *
1641  * @type: type of MGMT frame IEs belong to, one of &enum qlink_ie_set_type.
1642  * @flags: for future use.
1643  * @ie_data: IEs data.
1644  */
1645 struct qlink_tlv_ie_set {
1646     struct qlink_tlv_hdr hdr;
1647     u8 type;
1648     u8 flags;
1649     u8 rsvd[2];
1650     u8 ie_data[];
1651 } __packed;
1652 
1653 /**
1654  * struct qlink_tlv_ext_ie - extension IE
1655  *
1656  * @eid_ext: element ID extension, one of &enum ieee80211_eid_ext.
1657  * @ie_data: IEs data.
1658  */
1659 struct qlink_tlv_ext_ie {
1660     struct qlink_tlv_hdr hdr;
1661     u8 eid_ext;
1662     u8 rsvd[3];
1663     u8 ie_data[];
1664 } __packed;
1665 
1666 #define IEEE80211_HE_PPE_THRES_MAX_LEN      25
1667 struct qlink_sband_iftype_data {
1668     __le16 types_mask;
1669     struct ieee80211_he_cap_elem he_cap_elem;
1670     struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
1671     u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
1672 } __packed;
1673 
1674 /**
1675  * struct qlink_tlv_iftype_data - data for QTN_TLV_ID_IFTYPE_DATA
1676  *
1677  * @n_iftype_data: number of entries in iftype_data.
1678  * @iftype_data: interface type data entries.
1679  */
1680 struct qlink_tlv_iftype_data {
1681     struct qlink_tlv_hdr hdr;
1682     u8 n_iftype_data;
1683     u8 rsvd[3];
1684     struct qlink_sband_iftype_data iftype_data[];
1685 } __packed;
1686 
1687 /**
1688  * enum qlink_chan_stat - channel statistics bitmap
1689  *
1690  * Used to indicate which statistics values in &struct qlink_chan_stats
1691  * are valid. Individual values are used to fill a bitmap carried in a
1692  * payload of QTN_TLV_ID_BITMAP.
1693  *
1694  * @QLINK_CHAN_STAT_TIME_ON: time_on value is valid.
1695  * @QLINK_CHAN_STAT_TIME_TX: time_tx value is valid.
1696  * @QLINK_CHAN_STAT_TIME_RX: time_rx value is valid.
1697  * @QLINK_CHAN_STAT_CCA_BUSY: cca_busy value is valid.
1698  * @QLINK_CHAN_STAT_CCA_BUSY_EXT: cca_busy_ext value is valid.
1699  * @QLINK_CHAN_STAT_TIME_SCAN: time_scan value is valid.
1700  * @QLINK_CHAN_STAT_CHAN_NOISE: chan_noise value is valid.
1701  */
1702 enum qlink_chan_stat {
1703     QLINK_CHAN_STAT_TIME_ON,
1704     QLINK_CHAN_STAT_TIME_TX,
1705     QLINK_CHAN_STAT_TIME_RX,
1706     QLINK_CHAN_STAT_CCA_BUSY,
1707     QLINK_CHAN_STAT_CCA_BUSY_EXT,
1708     QLINK_CHAN_STAT_TIME_SCAN,
1709     QLINK_CHAN_STAT_CHAN_NOISE,
1710     QLINK_CHAN_STAT_NUM,
1711 };
1712 
1713 /**
1714  * struct qlink_chan_stats - data for QTN_TLV_ID_CHANNEL_STATS
1715  *
1716  * Carries a per-channel statistics. Not all fields may be filled with
1717  * valid values. Valid fields should be indicated as such using a bitmap of
1718  * &enum qlink_chan_stat. Bitmap is carried separately in a payload of
1719  * QTN_TLV_ID_BITMAP.
1720  *
1721  * @time_on: amount of time radio operated on that channel.
1722  * @time_tx: amount of time radio spent transmitting on the channel.
1723  * @time_rx: amount of time radio spent receiving on the channel.
1724  * @cca_busy: amount of time the primary channel was busy.
1725  * @cca_busy_ext: amount of time the secondary channel was busy.
1726  * @time_scan: amount of radio spent scanning on the channel.
1727  * @chan_noise: channel noise.
1728  */
1729 struct qlink_chan_stats {
1730     __le64 time_on;
1731     __le64 time_tx;
1732     __le64 time_rx;
1733     __le64 cca_busy;
1734     __le64 cca_busy_ext;
1735     __le64 time_scan;
1736     s8 chan_noise;
1737     u8 rsvd[3];
1738 } __packed;
1739 
1740 /**
1741  * enum qlink_sta_info - station information bitmap
1742  *
1743  * Used to indicate which statistics values in &struct qlink_sta_stats
1744  * are valid. Individual values are used to fill a bitmap carried in a
1745  * payload of QTN_TLV_ID_BITMAP.
1746  *
1747  * @QLINK_STA_INFO_CONNECTED_TIME: connected_time value is valid.
1748  * @QLINK_STA_INFO_INACTIVE_TIME: inactive_time value is valid.
1749  * @QLINK_STA_INFO_RX_BYTES: lower 32 bits of rx_bytes value are valid.
1750  * @QLINK_STA_INFO_TX_BYTES: lower 32 bits of tx_bytes value are valid.
1751  * @QLINK_STA_INFO_RX_BYTES64: rx_bytes value is valid.
1752  * @QLINK_STA_INFO_TX_BYTES64: tx_bytes value is valid.
1753  * @QLINK_STA_INFO_RX_DROP_MISC: rx_dropped_misc value is valid.
1754  * @QLINK_STA_INFO_BEACON_RX: rx_beacon value is valid.
1755  * @QLINK_STA_INFO_SIGNAL: signal value is valid.
1756  * @QLINK_STA_INFO_SIGNAL_AVG: signal_avg value is valid.
1757  * @QLINK_STA_INFO_RX_BITRATE: rxrate value is valid.
1758  * @QLINK_STA_INFO_TX_BITRATE: txrate value is valid.
1759  * @QLINK_STA_INFO_RX_PACKETS: rx_packets value is valid.
1760  * @QLINK_STA_INFO_TX_PACKETS: tx_packets value is valid.
1761  * @QLINK_STA_INFO_TX_RETRIES: tx_retries value is valid.
1762  * @QLINK_STA_INFO_TX_FAILED: tx_failed value is valid.
1763  * @QLINK_STA_INFO_STA_FLAGS: sta_flags value is valid.
1764  */
1765 enum qlink_sta_info {
1766     QLINK_STA_INFO_CONNECTED_TIME,
1767     QLINK_STA_INFO_INACTIVE_TIME,
1768     QLINK_STA_INFO_RX_BYTES,
1769     QLINK_STA_INFO_TX_BYTES,
1770     QLINK_STA_INFO_RX_BYTES64,
1771     QLINK_STA_INFO_TX_BYTES64,
1772     QLINK_STA_INFO_RX_DROP_MISC,
1773     QLINK_STA_INFO_BEACON_RX,
1774     QLINK_STA_INFO_SIGNAL,
1775     QLINK_STA_INFO_SIGNAL_AVG,
1776     QLINK_STA_INFO_RX_BITRATE,
1777     QLINK_STA_INFO_TX_BITRATE,
1778     QLINK_STA_INFO_RX_PACKETS,
1779     QLINK_STA_INFO_TX_PACKETS,
1780     QLINK_STA_INFO_TX_RETRIES,
1781     QLINK_STA_INFO_TX_FAILED,
1782     QLINK_STA_INFO_STA_FLAGS,
1783     QLINK_STA_INFO_NUM,
1784 };
1785 
1786 /**
1787  * struct qlink_sta_info_rate - STA rate statistics
1788  *
1789  * @rate: data rate in Mbps.
1790  * @flags: bitmap of &enum qlink_sta_info_rate_flags.
1791  * @mcs: 802.11-defined MCS index.
1792  * nss: Number of Spatial Streams.
1793  * @bw: bandwidth, one of &enum qlink_channel_width.
1794  */
1795 struct qlink_sta_info_rate {
1796     __le16 rate;
1797     u8 flags;
1798     u8 mcs;
1799     u8 nss;
1800     u8 bw;
1801 } __packed;
1802 
1803 /**
1804  * struct qlink_sta_stats - data for QTN_TLV_ID_STA_STATS
1805  *
1806  * Carries statistics of a STA. Not all fields may be filled with
1807  * valid values. Valid fields should be indicated as such using a bitmap of
1808  * &enum qlink_sta_info. Bitmap is carried separately in a payload of
1809  * QTN_TLV_ID_BITMAP.
1810  */
1811 struct qlink_sta_stats {
1812     __le64 rx_bytes;
1813     __le64 tx_bytes;
1814     __le64 rx_beacon;
1815     __le64 rx_duration;
1816     __le64 t_offset;
1817     __le32 connected_time;
1818     __le32 inactive_time;
1819     __le32 rx_packets;
1820     __le32 tx_packets;
1821     __le32 tx_retries;
1822     __le32 tx_failed;
1823     __le32 rx_dropped_misc;
1824     __le32 beacon_loss_count;
1825     __le32 expected_throughput;
1826     struct qlink_sta_info_state sta_flags;
1827     struct qlink_sta_info_rate txrate;
1828     struct qlink_sta_info_rate rxrate;
1829     __le16 llid;
1830     __le16 plid;
1831     u8 local_pm;
1832     u8 peer_pm;
1833     u8 nonpeer_pm;
1834     u8 rx_beacon_signal_avg;
1835     u8 plink_state;
1836     u8 signal;
1837     u8 signal_avg;
1838     u8 rsvd[1];
1839 };
1840 
1841 /**
1842  * struct qlink_random_mac_addr - data for QTN_TLV_ID_RANDOM_MAC_ADDR TLV
1843  *
1844  * Specifies MAC address mask/value for generation random MAC address
1845  * during scan.
1846  *
1847  * @mac_addr: MAC address used with randomisation
1848  * @mac_addr_mask: MAC address mask used with randomisation, bits that
1849  *  are 0 in the mask should be randomised, bits that are 1 should
1850  *  be taken from the @mac_addr
1851  */
1852 struct qlink_random_mac_addr {
1853     u8 mac_addr[ETH_ALEN];
1854     u8 mac_addr_mask[ETH_ALEN];
1855 } __packed;
1856 
1857 /**
1858  * struct qlink_wowlan_capab_data - data for QTN_TLV_ID_WOWLAN_CAPAB TLV
1859  *
1860  * WoWLAN capabilities supported by cards.
1861  *
1862  * @version: version of WoWLAN data structure, to ensure backward
1863  *  compatibility for firmwares with limited WoWLAN support
1864  * @len: Total length of WoWLAN data
1865  * @data: supported WoWLAN features
1866  */
1867 struct qlink_wowlan_capab_data {
1868     __le16 version;
1869     __le16 len;
1870     u8 data[];
1871 } __packed;
1872 
1873 /**
1874  * struct qlink_wowlan_support - supported WoWLAN capabilities
1875  *
1876  * @n_patterns: number of supported wakeup patterns
1877  * @pattern_max_len: maximum length of each pattern
1878  * @pattern_min_len: minimum length of each pattern
1879  */
1880 struct qlink_wowlan_support {
1881     __le32 n_patterns;
1882     __le32 pattern_max_len;
1883     __le32 pattern_min_len;
1884 } __packed;
1885 
1886 #endif /* _QTN_QLINK_H_ */