1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* Copyright (c) 2015-2016 Quantenna Communications. All rights reserved. */ 3 4 #ifndef _QTN_QLINK_H_ 5 #define _QTN_QLINK_H_ 6 7 #include <linux/ieee80211.h> 8 9 #define QLINK_PROTO_VER_MAJOR_M 0xFFFF 10 #define QLINK_PROTO_VER_MAJOR_S 16 11 #define QLINK_PROTO_VER_MINOR_M 0xFFFF 12 #define QLINK_VER_MINOR(_ver) ((_ver) & QLINK_PROTO_VER_MINOR_M) 13 #define QLINK_VER_MAJOR(_ver) \ 14 (((_ver) >> QLINK_PROTO_VER_MAJOR_S) & QLINK_PROTO_VER_MAJOR_M) 15 #define QLINK_VER(_maj, _min) (((_maj) << QLINK_PROTO_VER_MAJOR_S) | (_min)) 16 17 #define QLINK_PROTO_VER_MAJOR 18 18 #define QLINK_PROTO_VER_MINOR 0 19 #define QLINK_PROTO_VER \ 20 QLINK_VER(QLINK_PROTO_VER_MAJOR, QLINK_PROTO_VER_MINOR) 21 22 #define QLINK_ALIGN 4 23 24 #define QLINK_MACID_RSVD 0xFF 25 #define QLINK_VIFID_RSVD 0xFF 26 27 /* Common QLINK protocol messages definitions. 28 */ 29 30 /** 31 * enum qlink_msg_type - QLINK message types 32 * 33 * Used to distinguish between message types of QLINK protocol. 34 * 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. 41 */ 42 enum qlink_msg_type { 43 QLINK_MSG_TYPE_CMD = 1, 44 QLINK_MSG_TYPE_CMDRSP = 2, 45 QLINK_MSG_TYPE_EVENT = 3 46 }; 47 48 /** 49 * struct qlink_msg_header - common QLINK protocol message header 50 * 51 * Portion of QLINK protocol header common for all message types. 52 * 53 * @type: Message type, one of &enum qlink_msg_type. 54 * @len: Total length of message including all headers. 55 */ 56 struct qlink_msg_header { 57 __le16 type; 58 __le16 len; 59 } __packed; 60 61 /* Generic definitions of data and information carried in QLINK messages 62 */ 63 64 /** 65 * enum qlink_hw_capab - device capabilities. 66 * 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. 75 * @QLINK_HW_CAPAB_HW_BRIDGE: device has hardware switch capabilities. 76 */ 77 enum qlink_hw_capab { 78 QLINK_HW_CAPAB_REG_UPDATE = 0, 79 QLINK_HW_CAPAB_STA_INACT_TIMEOUT, 80 QLINK_HW_CAPAB_DFS_OFFLOAD, 81 QLINK_HW_CAPAB_SCAN_RANDOM_MAC_ADDR, 82 QLINK_HW_CAPAB_PWR_MGMT, 83 QLINK_HW_CAPAB_OBSS_SCAN, 84 QLINK_HW_CAPAB_SCAN_DWELL, 85 QLINK_HW_CAPAB_SAE, 86 QLINK_HW_CAPAB_HW_BRIDGE, 87 QLINK_HW_CAPAB_NUM 88 }; 89 90 /** 91 * enum qlink_driver_capab - host driver capabilities. 92 * 93 */ 94 enum qlink_driver_capab { 95 QLINK_DRV_CAPAB_NUM = 0 96 }; 97 98 enum qlink_iface_type { 99 QLINK_IFTYPE_AP = 1, 100 QLINK_IFTYPE_STATION = 2, 101 QLINK_IFTYPE_ADHOC = 3, 102 QLINK_IFTYPE_MONITOR = 4, 103 QLINK_IFTYPE_WDS = 5, 104 QLINK_IFTYPE_AP_VLAN = 6, 105 }; 106 107 /** 108 * struct qlink_intf_info - information on virtual interface. 109 * 110 * Data describing a single virtual interface. 111 * 112 * @if_type: Mode of interface operation, one of &enum qlink_iface_type 113 * @vlanid: VLAN ID for AP_VLAN interface type 114 * @mac_addr: MAC address of virtual interface. 115 */ 116 struct qlink_intf_info { 117 __le16 if_type; 118 __le16 vlanid; 119 u8 mac_addr[ETH_ALEN]; 120 u8 use4addr; 121 u8 rsvd[1]; 122 } __packed; 123 124 enum qlink_sta_flags { 125 QLINK_STA_FLAG_INVALID = 0, 126 QLINK_STA_FLAG_AUTHORIZED = BIT(0), 127 QLINK_STA_FLAG_SHORT_PREAMBLE = BIT(1), 128 QLINK_STA_FLAG_WME = BIT(2), 129 QLINK_STA_FLAG_MFP = BIT(3), 130 QLINK_STA_FLAG_AUTHENTICATED = BIT(4), 131 QLINK_STA_FLAG_TDLS_PEER = BIT(5), 132 QLINK_STA_FLAG_ASSOCIATED = BIT(6), 133 }; 134 135 enum qlink_channel_width { 136 QLINK_CHAN_WIDTH_5 = 0, 137 QLINK_CHAN_WIDTH_10, 138 QLINK_CHAN_WIDTH_20_NOHT, 139 QLINK_CHAN_WIDTH_20, 140 QLINK_CHAN_WIDTH_40, 141 QLINK_CHAN_WIDTH_80, 142 QLINK_CHAN_WIDTH_80P80, 143 QLINK_CHAN_WIDTH_160, 144 }; 145 146 /** 147 * struct qlink_channel - qlink control channel definition 148 * 149 * @hw_value: hardware-specific value for the channel 150 * @center_freq: center frequency in MHz 151 * @flags: channel flags from &enum qlink_channel_flags 152 * @band: band this channel belongs to 153 * @max_antenna_gain: maximum antenna gain in dBi 154 * @max_power: maximum transmission power (in dBm) 155 * @max_reg_power: maximum regulatory transmission power (in dBm) 156 * @dfs_state: current state of this channel. 157 * Only relevant if radar is required on this channel. 158 * @beacon_found: helper to regulatory code to indicate when a beacon 159 * has been found on this channel. Use regulatory_hint_found_beacon() 160 * to enable this, this is useful only on 5 GHz band. 161 */ 162 struct qlink_channel { 163 __le16 hw_value; 164 __le16 center_freq; 165 __le32 flags; 166 u8 band; 167 u8 max_antenna_gain; 168 u8 max_power; 169 u8 max_reg_power; 170 __le32 dfs_cac_ms; 171 u8 dfs_state; 172 u8 beacon_found; 173 u8 rsvd[2]; 174 } __packed; 175 176 /** 177 * struct qlink_chandef - qlink channel definition 178 * 179 * @chan: primary channel definition 180 * @center_freq1: center frequency of first segment 181 * @center_freq2: center frequency of second segment (80+80 only) 182 * @width: channel width, one of @enum qlink_channel_width 183 */ 184 struct qlink_chandef { 185 struct qlink_channel chan; 186 __le16 center_freq1; 187 __le16 center_freq2; 188 u8 width; 189 u8 rsvd[3]; 190 } __packed; 191 192 #define QLINK_MAX_NR_CIPHER_SUITES 5 193 #define QLINK_MAX_NR_AKM_SUITES 2 194 195 struct qlink_auth_encr { 196 __le32 wpa_versions; 197 __le32 cipher_group; 198 __le32 n_ciphers_pairwise; 199 __le32 ciphers_pairwise[QLINK_MAX_NR_CIPHER_SUITES]; 200 __le32 n_akm_suites; 201 __le32 akm_suites[QLINK_MAX_NR_AKM_SUITES]; 202 __le16 control_port_ethertype; 203 u8 auth_type; 204 u8 privacy; 205 u8 control_port; 206 u8 control_port_no_encrypt; 207 u8 rsvd[2]; 208 } __packed; 209 210 /** 211 * struct qlink_sta_info_state - station flags mask/value 212 * 213 * @mask: STA flags mask, bitmap of &enum qlink_sta_flags 214 * @value: STA flags values, bitmap of &enum qlink_sta_flags 215 */ 216 struct qlink_sta_info_state { 217 __le32 mask; 218 __le32 value; 219 } __packed; 220 221 /** 222 * enum qlink_sr_ctrl_flags - control flags for spatial reuse parameter set 223 * 224 * @QLINK_SR_PSR_DISALLOWED: indicates whether or not PSR-based spatial reuse 225 * transmissions are allowed for STAs associated with the AP 226 * @QLINK_SR_NON_SRG_OBSS_PD_SR_DISALLOWED: indicates whether or not 227 * Non-SRG OBSS PD spatial reuse transmissions are allowed for STAs associated 228 * with the AP 229 * @NON_SRG_OFFSET_PRESENT: indicates whether or not Non-SRG OBSS PD Max offset 230 * field is valid in the element 231 * @QLINK_SR_SRG_INFORMATION_PRESENT: indicates whether or not SRG OBSS PD 232 * Min/Max offset fields ore valid in the element 233 */ 234 enum qlink_sr_ctrl_flags { 235 QLINK_SR_PSR_DISALLOWED = BIT(0), 236 QLINK_SR_NON_SRG_OBSS_PD_SR_DISALLOWED = BIT(1), 237 QLINK_SR_NON_SRG_OFFSET_PRESENT = BIT(2), 238 QLINK_SR_SRG_INFORMATION_PRESENT = BIT(3), 239 }; 240 241 /** 242 * struct qlink_sr_params - spatial reuse parameters 243 * 244 * @sr_control: spatial reuse control field; flags contained in this field are 245 * defined in @qlink_sr_ctrl_flags 246 * @non_srg_obss_pd_max: added to -82 dBm to generate the value of the 247 * Non-SRG OBSS PD Max parameter 248 * @srg_obss_pd_min_offset: added to -82 dBm to generate the value of the 249 * SRG OBSS PD Min parameter 250 * @srg_obss_pd_max_offset: added to -82 dBm to generate the value of the 251 * SRG PBSS PD Max parameter 252 */ 253 struct qlink_sr_params { 254 u8 sr_control; 255 u8 non_srg_obss_pd_max; 256 u8 srg_obss_pd_min_offset; 257 u8 srg_obss_pd_max_offset; 258 } __packed; 259 260 /* QLINK Command messages related definitions 261 */ 262 263 /** 264 * enum qlink_cmd_type - list of supported commands 265 * 266 * Commands are QLINK messages of type @QLINK_MSG_TYPE_CMD, sent by driver to 267 * wireless network device for processing. Device is expected to send back a 268 * reply message of type &QLINK_MSG_TYPE_CMDRSP, containing at least command 269 * execution status (one of &enum qlink_cmd_result). Reply message 270 * may also contain data payload specific to the command type. 271 * 272 * @QLINK_CMD_SEND_FRAME: send specified frame over the air; firmware will 273 * encapsulate 802.3 packet into 802.11 frame automatically. 274 * @QLINK_CMD_BAND_INFO_GET: for the specified MAC and specified band, get 275 * the band's description including number of operational channels and 276 * info on each channel, HT/VHT capabilities, supported rates etc. 277 * This command is generic to a specified MAC, interface index must be set 278 * to QLINK_VIFID_RSVD in command header. 279 * @QLINK_CMD_REG_NOTIFY: notify device about regulatory domain change. This 280 * command is supported only if device reports QLINK_HW_SUPPORTS_REG_UPDATE 281 * capability. 282 * @QLINK_CMD_START_CAC: start radar detection procedure on a specified channel. 283 * @QLINK_CMD_TXPWR: get or set current channel transmit power for 284 * the specified MAC. 285 * @QLINK_CMD_NDEV_EVENT: signalizes changes made with a corresponding network 286 * device. 287 */ 288 enum qlink_cmd_type { 289 QLINK_CMD_FW_INIT = 0x0001, 290 QLINK_CMD_FW_DEINIT = 0x0002, 291 QLINK_CMD_REGISTER_MGMT = 0x0003, 292 QLINK_CMD_SEND_FRAME = 0x0004, 293 QLINK_CMD_MGMT_SET_APPIE = 0x0005, 294 QLINK_CMD_PHY_PARAMS_SET = 0x0012, 295 QLINK_CMD_GET_HW_INFO = 0x0013, 296 QLINK_CMD_MAC_INFO = 0x0014, 297 QLINK_CMD_ADD_INTF = 0x0015, 298 QLINK_CMD_DEL_INTF = 0x0016, 299 QLINK_CMD_CHANGE_INTF = 0x0017, 300 QLINK_CMD_UPDOWN_INTF = 0x0018, 301 QLINK_CMD_REG_NOTIFY = 0x0019, 302 QLINK_CMD_BAND_INFO_GET = 0x001A, 303 QLINK_CMD_CHAN_SWITCH = 0x001B, 304 QLINK_CMD_CHAN_GET = 0x001C, 305 QLINK_CMD_START_CAC = 0x001D, 306 QLINK_CMD_START_AP = 0x0021, 307 QLINK_CMD_STOP_AP = 0x0022, 308 QLINK_CMD_SET_MAC_ACL = 0x0023, 309 QLINK_CMD_GET_STA_INFO = 0x0030, 310 QLINK_CMD_ADD_KEY = 0x0040, 311 QLINK_CMD_DEL_KEY = 0x0041, 312 QLINK_CMD_SET_DEFAULT_KEY = 0x0042, 313 QLINK_CMD_SET_DEFAULT_MGMT_KEY = 0x0043, 314 QLINK_CMD_CHANGE_STA = 0x0051, 315 QLINK_CMD_DEL_STA = 0x0052, 316 QLINK_CMD_SCAN = 0x0053, 317 QLINK_CMD_CHAN_STATS = 0x0054, 318 QLINK_CMD_NDEV_EVENT = 0x0055, 319 QLINK_CMD_CONNECT = 0x0060, 320 QLINK_CMD_DISCONNECT = 0x0061, 321 QLINK_CMD_PM_SET = 0x0062, 322 QLINK_CMD_WOWLAN_SET = 0x0063, 323 QLINK_CMD_EXTERNAL_AUTH = 0x0066, 324 QLINK_CMD_TXPWR = 0x0067, 325 }; 326 327 /** 328 * struct qlink_cmd - QLINK command message header 329 * 330 * Header used for QLINK messages of QLINK_MSG_TYPE_CMD type. 331 * 332 * @mhdr: Common QLINK message header. 333 * @cmd_id: command id, one of &enum qlink_cmd_type. 334 * @seq_num: sequence number of command message, used for matching with 335 * response message. 336 * @macid: index of physical radio device the command is destined to or 337 * QLINK_MACID_RSVD if not applicable. 338 * @vifid: index of virtual wireless interface on specified @macid the command 339 * is destined to or QLINK_VIFID_RSVD if not applicable. 340 */ 341 struct qlink_cmd { 342 struct qlink_msg_header mhdr; 343 __le16 cmd_id; 344 __le16 seq_num; 345 u8 macid; 346 u8 vifid; 347 u8 rsvd[2]; 348 } __packed; 349 350 /** 351 * struct qlink_cmd_init_fw - data for QLINK_CMD_FW_INIT 352 * 353 * Initialize firmware based on specified host configuration. This is the first 354 * command sent to wifi card and it's fixed part should never be changed, any 355 * additions must be done by appending TLVs. 356 * If wifi card can not operate with a specified parameters it will return 357 * error. 358 * 359 * @qlink_proto_ver: QLINK protocol version used by host driver. 360 */ 361 struct qlink_cmd_init_fw { 362 struct qlink_cmd chdr; 363 __le32 qlink_proto_ver; 364 u8 var_info[0]; 365 } __packed; 366 367 /** 368 * struct qlink_cmd_manage_intf - interface management command 369 * 370 * Data for interface management commands QLINK_CMD_ADD_INTF, QLINK_CMD_DEL_INTF 371 * and QLINK_CMD_CHANGE_INTF. 372 * 373 * @intf_info: interface description. 374 */ 375 struct qlink_cmd_manage_intf { 376 struct qlink_cmd chdr; 377 struct qlink_intf_info intf_info; 378 } __packed; 379 380 enum qlink_mgmt_frame_type { 381 QLINK_MGMT_FRAME_ASSOC_REQ = 0x00, 382 QLINK_MGMT_FRAME_ASSOC_RESP = 0x01, 383 QLINK_MGMT_FRAME_REASSOC_REQ = 0x02, 384 QLINK_MGMT_FRAME_REASSOC_RESP = 0x03, 385 QLINK_MGMT_FRAME_PROBE_REQ = 0x04, 386 QLINK_MGMT_FRAME_PROBE_RESP = 0x05, 387 QLINK_MGMT_FRAME_BEACON = 0x06, 388 QLINK_MGMT_FRAME_ATIM = 0x07, 389 QLINK_MGMT_FRAME_DISASSOC = 0x08, 390 QLINK_MGMT_FRAME_AUTH = 0x09, 391 QLINK_MGMT_FRAME_DEAUTH = 0x0A, 392 QLINK_MGMT_FRAME_ACTION = 0x0B, 393 394 QLINK_MGMT_FRAME_TYPE_COUNT 395 }; 396 397 /** 398 * struct qlink_cmd_mgmt_frame_register - data for QLINK_CMD_REGISTER_MGMT 399 * 400 * @frame_type: MGMT frame type the registration request describes, one of 401 * &enum qlink_mgmt_frame_type. 402 * @do_register: 0 - unregister, otherwise register for reception of specified 403 * MGMT frame type. 404 */ 405 struct qlink_cmd_mgmt_frame_register { 406 struct qlink_cmd chdr; 407 __le16 frame_type; 408 u8 do_register; 409 u8 rsvd[1]; 410 } __packed; 411 412 /** 413 * @QLINK_FRAME_TX_FLAG_8023: frame has a 802.3 header; if not set, frame 414 * is a 802.11 encapsulated. 415 */ 416 enum qlink_frame_tx_flags { 417 QLINK_FRAME_TX_FLAG_OFFCHAN = BIT(0), 418 QLINK_FRAME_TX_FLAG_NO_CCK = BIT(1), 419 QLINK_FRAME_TX_FLAG_ACK_NOWAIT = BIT(2), 420 QLINK_FRAME_TX_FLAG_8023 = BIT(3), 421 }; 422 423 /** 424 * struct qlink_cmd_frame_tx - data for QLINK_CMD_SEND_FRAME command 425 * 426 * @cookie: opaque request identifier. 427 * @freq: Frequency to use for frame transmission. 428 * @flags: Transmission flags, one of &enum qlink_frame_tx_flags. 429 * @frame_data: frame to transmit. 430 */ 431 struct qlink_cmd_frame_tx { 432 struct qlink_cmd chdr; 433 __le32 cookie; 434 __le16 freq; 435 __le16 flags; 436 u8 frame_data[0]; 437 } __packed; 438 439 /** 440 * struct qlink_cmd_get_sta_info - data for QLINK_CMD_GET_STA_INFO command 441 * 442 * @sta_addr: MAC address of the STA statistics is requested for. 443 */ 444 struct qlink_cmd_get_sta_info { 445 struct qlink_cmd chdr; 446 u8 sta_addr[ETH_ALEN]; 447 u8 rsvd[2]; 448 } __packed; 449 450 /** 451 * struct qlink_cmd_add_key - data for QLINK_CMD_ADD_KEY command. 452 * 453 * @key_index: index of the key being installed. 454 * @pairwise: whether to use pairwise key. 455 * @addr: MAC address of a STA key is being installed to. 456 * @cipher: cipher suite. 457 * @vlanid: VLAN ID for AP_VLAN interface type 458 * @key_data: key data itself. 459 */ 460 struct qlink_cmd_add_key { 461 struct qlink_cmd chdr; 462 u8 key_index; 463 u8 pairwise; 464 u8 addr[ETH_ALEN]; 465 __le32 cipher; 466 __le16 vlanid; 467 u8 rsvd[2]; 468 u8 key_data[0]; 469 } __packed; 470 471 /** 472 * struct qlink_cmd_del_key_req - data for QLINK_CMD_DEL_KEY command 473 * 474 * @key_index: index of the key being removed. 475 * @pairwise: whether to use pairwise key. 476 * @addr: MAC address of a STA for which a key is removed. 477 */ 478 struct qlink_cmd_del_key { 479 struct qlink_cmd chdr; 480 u8 key_index; 481 u8 pairwise; 482 u8 addr[ETH_ALEN]; 483 } __packed; 484 485 /** 486 * struct qlink_cmd_set_def_key - data for QLINK_CMD_SET_DEFAULT_KEY command 487 * 488 * @key_index: index of the key to be set as default one. 489 * @unicast: key is unicast. 490 * @multicast: key is multicast. 491 */ 492 struct qlink_cmd_set_def_key { 493 struct qlink_cmd chdr; 494 u8 key_index; 495 u8 unicast; 496 u8 multicast; 497 u8 rsvd[1]; 498 } __packed; 499 500 /** 501 * struct qlink_cmd_set_def_mgmt_key - data for QLINK_CMD_SET_DEFAULT_MGMT_KEY 502 * 503 * @key_index: index of the key to be set as default MGMT key. 504 */ 505 struct qlink_cmd_set_def_mgmt_key { 506 struct qlink_cmd chdr; 507 u8 key_index; 508 u8 rsvd[3]; 509 } __packed; 510 511 /** 512 * struct qlink_cmd_change_sta - data for QLINK_CMD_CHANGE_STA command 513 * 514 * @flag_update: STA flags to update 515 * @if_type: Mode of interface operation, one of &enum qlink_iface_type 516 * @vlanid: VLAN ID to assign to specific STA 517 * @sta_addr: address of the STA for which parameters are set. 518 */ 519 struct qlink_cmd_change_sta { 520 struct qlink_cmd chdr; 521 struct qlink_sta_info_state flag_update; 522 __le16 if_type; 523 __le16 vlanid; 524 u8 sta_addr[ETH_ALEN]; 525 u8 rsvd[2]; 526 } __packed; 527 528 /** 529 * struct qlink_cmd_del_sta - data for QLINK_CMD_DEL_STA command. 530 * 531 * See &struct station_del_parameters 532 */ 533 struct qlink_cmd_del_sta { 534 struct qlink_cmd chdr; 535 __le16 reason_code; 536 u8 sta_addr[ETH_ALEN]; 537 u8 subtype; 538 u8 rsvd[3]; 539 } __packed; 540 541 enum qlink_sta_connect_flags { 542 QLINK_STA_CONNECT_DISABLE_HT = BIT(0), 543 QLINK_STA_CONNECT_DISABLE_VHT = BIT(1), 544 QLINK_STA_CONNECT_USE_RRM = BIT(2), 545 }; 546 547 /** 548 * struct qlink_cmd_connect - data for QLINK_CMD_CONNECT command 549 * 550 * @bssid: BSSID of the BSS to connect to. 551 * @bssid_hint: recommended AP BSSID for initial connection to the BSS or 552 * 00:00:00:00:00:00 if not specified. 553 * @prev_bssid: previous BSSID, if specified (not 00:00:00:00:00:00) indicates 554 * a request to reassociate. 555 * @bg_scan_period: period of background scan. 556 * @flags: one of &enum qlink_sta_connect_flags. 557 * @ht_capa: HT Capabilities overrides. 558 * @ht_capa_mask: The bits of ht_capa which are to be used. 559 * @vht_capa: VHT Capability overrides 560 * @vht_capa_mask: The bits of vht_capa which are to be used. 561 * @aen: authentication information. 562 * @mfp: whether to use management frame protection. 563 * @payload: variable portion of connection request. 564 */ 565 struct qlink_cmd_connect { 566 struct qlink_cmd chdr; 567 u8 bssid[ETH_ALEN]; 568 u8 bssid_hint[ETH_ALEN]; 569 u8 prev_bssid[ETH_ALEN]; 570 __le16 bg_scan_period; 571 __le32 flags; 572 struct ieee80211_ht_cap ht_capa; 573 struct ieee80211_ht_cap ht_capa_mask; 574 struct ieee80211_vht_cap vht_capa; 575 struct ieee80211_vht_cap vht_capa_mask; 576 struct qlink_auth_encr aen; 577 u8 mfp; 578 u8 pbss; 579 u8 rsvd[2]; 580 u8 payload[0]; 581 } __packed; 582 583 /** 584 * struct qlink_cmd_external_auth - data for QLINK_CMD_EXTERNAL_AUTH command 585 * 586 * @bssid: BSSID of the BSS to connect to 587 * @status: authentication status code 588 * @payload: variable portion of connection request. 589 */ 590 struct qlink_cmd_external_auth { 591 struct qlink_cmd chdr; 592 u8 bssid[ETH_ALEN]; 593 __le16 status; 594 u8 payload[0]; 595 } __packed; 596 597 /** 598 * struct qlink_cmd_disconnect - data for QLINK_CMD_DISCONNECT command 599 * 600 * @reason: code of the reason of disconnect, see &enum ieee80211_reasoncode. 601 */ 602 struct qlink_cmd_disconnect { 603 struct qlink_cmd chdr; 604 __le16 reason; 605 u8 rsvd[2]; 606 } __packed; 607 608 /** 609 * struct qlink_cmd_updown - data for QLINK_CMD_UPDOWN_INTF command 610 * 611 * @if_up: bring specified interface DOWN (if_up==0) or UP (otherwise). 612 * Interface is specified in common command header @chdr. 613 */ 614 struct qlink_cmd_updown { 615 struct qlink_cmd chdr; 616 u8 if_up; 617 u8 rsvd[3]; 618 } __packed; 619 620 /** 621 * enum qlink_band - a list of frequency bands 622 * 623 * @QLINK_BAND_2GHZ: 2.4GHz band 624 * @QLINK_BAND_5GHZ: 5GHz band 625 * @QLINK_BAND_60GHZ: 60GHz band 626 */ 627 enum qlink_band { 628 QLINK_BAND_2GHZ = BIT(0), 629 QLINK_BAND_5GHZ = BIT(1), 630 QLINK_BAND_60GHZ = BIT(2), 631 }; 632 633 /** 634 * struct qlink_cmd_band_info_get - data for QLINK_CMD_BAND_INFO_GET command 635 * 636 * @band: a PHY band for which information is queried, one of @enum qlink_band 637 */ 638 struct qlink_cmd_band_info_get { 639 struct qlink_cmd chdr; 640 u8 band; 641 u8 rsvd[3]; 642 } __packed; 643 644 /** 645 * struct qlink_cmd_get_chan_stats - data for QLINK_CMD_CHAN_STATS command 646 * 647 * @channel_freq: channel center frequency 648 */ 649 struct qlink_cmd_get_chan_stats { 650 struct qlink_cmd chdr; 651 __le32 channel_freq; 652 } __packed; 653 654 /** 655 * enum qlink_reg_initiator - Indicates the initiator of a reg domain request 656 * 657 * See &enum nl80211_reg_initiator for more info. 658 */ 659 enum qlink_reg_initiator { 660 QLINK_REGDOM_SET_BY_CORE, 661 QLINK_REGDOM_SET_BY_USER, 662 QLINK_REGDOM_SET_BY_DRIVER, 663 QLINK_REGDOM_SET_BY_COUNTRY_IE, 664 }; 665 666 /** 667 * enum qlink_user_reg_hint_type - type of user regulatory hint 668 * 669 * See &enum nl80211_user_reg_hint_type for more info. 670 */ 671 enum qlink_user_reg_hint_type { 672 QLINK_USER_REG_HINT_USER = 0, 673 QLINK_USER_REG_HINT_CELL_BASE = 1, 674 QLINK_USER_REG_HINT_INDOOR = 2, 675 }; 676 677 /** 678 * struct qlink_cmd_reg_notify - data for QLINK_CMD_REG_NOTIFY command 679 * 680 * @alpha2: the ISO / IEC 3166 alpha2 country code. 681 * @initiator: which entity sent the request, one of &enum qlink_reg_initiator. 682 * @user_reg_hint_type: type of hint for QLINK_REGDOM_SET_BY_USER request, one 683 * of &enum qlink_user_reg_hint_type. 684 * @num_channels: number of &struct qlink_tlv_channel in a variable portion of a 685 * payload. 686 * @dfs_region: one of &enum qlink_dfs_regions. 687 * @slave_radar: whether slave device should enable radar detection. 688 * @dfs_offload: enable or disable DFS offload to firmware. 689 * @info: variable portion of regulatory notifier callback. 690 */ 691 struct qlink_cmd_reg_notify { 692 struct qlink_cmd chdr; 693 u8 alpha2[2]; 694 u8 initiator; 695 u8 user_reg_hint_type; 696 u8 num_channels; 697 u8 dfs_region; 698 u8 slave_radar; 699 u8 dfs_offload; 700 u8 info[0]; 701 } __packed; 702 703 /** 704 * enum qlink_chan_sw_flags - channel switch control flags 705 * 706 * @QLINK_CHAN_SW_RADAR_REQUIRED: whether radar detection is required on a new 707 * channel. 708 * @QLINK_CHAN_SW_BLOCK_TX: whether transmissions should be blocked while 709 * changing a channel. 710 */ 711 enum qlink_chan_sw_flags { 712 QLINK_CHAN_SW_RADAR_REQUIRED = BIT(0), 713 QLINK_CHAN_SW_BLOCK_TX = BIT(1), 714 }; 715 716 /** 717 * struct qlink_cmd_chan_switch - data for QLINK_CMD_CHAN_SWITCH command 718 * 719 * @channel: channel to switch to. 720 * @flags: flags to control channel switch, bitmap of &enum qlink_chan_sw_flags. 721 * @beacon_count: number of beacons until switch 722 */ 723 struct qlink_cmd_chan_switch { 724 struct qlink_cmd chdr; 725 struct qlink_chandef channel; 726 __le64 flags; 727 __le32 n_counter_offsets_beacon; 728 __le32 n_counter_offsets_presp; 729 u8 beacon_count; 730 u8 rsvd[3]; 731 } __packed; 732 733 /** 734 * enum qlink_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID 735 * 736 * Refer to &enum nl80211_hidden_ssid 737 */ 738 enum qlink_hidden_ssid { 739 QLINK_HIDDEN_SSID_NOT_IN_USE, 740 QLINK_HIDDEN_SSID_ZERO_LEN, 741 QLINK_HIDDEN_SSID_ZERO_CONTENTS 742 }; 743 744 /** 745 * struct qlink_cmd_start_ap - data for QLINK_CMD_START_AP command 746 * 747 * @beacon_interval: beacon interval 748 * @inactivity_timeout: station's inactivity period in seconds 749 * @dtim_period: DTIM period 750 * @hidden_ssid: whether to hide the SSID, one of &enum qlink_hidden_ssid 751 * @smps_mode: SMPS mode 752 * @ht_required: stations must support HT 753 * @vht_required: stations must support VHT 754 * @aen: encryption info 755 * @sr_params: spatial reuse parameters 756 * @twt_responder: enable Target Wake Time 757 * @info: variable configurations 758 */ 759 struct qlink_cmd_start_ap { 760 struct qlink_cmd chdr; 761 __le16 beacon_interval; 762 __le16 inactivity_timeout; 763 u8 dtim_period; 764 u8 hidden_ssid; 765 u8 smps_mode; 766 u8 p2p_ctwindow; 767 u8 p2p_opp_ps; 768 u8 pbss; 769 u8 ht_required; 770 u8 vht_required; 771 struct qlink_auth_encr aen; 772 struct qlink_sr_params sr_params; 773 u8 twt_responder; 774 u8 rsvd[3]; 775 u8 info[0]; 776 } __packed; 777 778 /** 779 * struct qlink_cmd_start_cac - data for QLINK_CMD_START_CAC command 780 * 781 * @chan: a channel to start a radar detection procedure on. 782 * @cac_time_ms: CAC time. 783 */ 784 struct qlink_cmd_start_cac { 785 struct qlink_cmd chdr; 786 struct qlink_chandef chan; 787 __le32 cac_time_ms; 788 } __packed; 789 790 enum qlink_acl_policy { 791 QLINK_ACL_POLICY_ACCEPT_UNLESS_LISTED, 792 QLINK_ACL_POLICY_DENY_UNLESS_LISTED, 793 }; 794 795 struct qlink_mac_address { 796 u8 addr[ETH_ALEN]; 797 } __packed; 798 799 /** 800 * struct qlink_acl_data - ACL data 801 * 802 * @policy: filter policy, one of &enum qlink_acl_policy. 803 * @num_entries: number of MAC addresses in array. 804 * @mac_address: MAC addresses array. 805 */ 806 struct qlink_acl_data { 807 __le32 policy; 808 __le32 num_entries; 809 struct qlink_mac_address mac_addrs[0]; 810 } __packed; 811 812 /** 813 * enum qlink_pm_mode - Power Management mode 814 * 815 * @QLINK_PM_OFF: normal mode, no power saving enabled 816 * @QLINK_PM_AUTO_STANDBY: enable auto power save mode 817 */ 818 enum qlink_pm_mode { 819 QLINK_PM_OFF = 0, 820 QLINK_PM_AUTO_STANDBY = 1, 821 }; 822 823 /** 824 * struct qlink_cmd_pm_set - data for QLINK_CMD_PM_SET command 825 * 826 * @pm_standby timer: period of network inactivity in seconds before 827 * putting a radio in power save mode 828 * @pm_mode: power management mode 829 */ 830 struct qlink_cmd_pm_set { 831 struct qlink_cmd chdr; 832 __le32 pm_standby_timer; 833 u8 pm_mode; 834 u8 rsvd[3]; 835 } __packed; 836 837 /** 838 * enum qlink_txpwr_op - transmit power operation type 839 * @QLINK_TXPWR_SET: set tx power 840 * @QLINK_TXPWR_GET: get current tx power setting 841 */ 842 enum qlink_txpwr_op { 843 QLINK_TXPWR_SET, 844 QLINK_TXPWR_GET 845 }; 846 847 /** 848 * struct qlink_cmd_txpwr - get or set current transmit power 849 * 850 * @txpwr: new transmit power setting, in mBm 851 * @txpwr_setting: transmit power setting type, one of 852 * &enum nl80211_tx_power_setting 853 * @op_type: type of operation, one of &enum qlink_txpwr_op 854 */ 855 struct qlink_cmd_txpwr { 856 struct qlink_cmd chdr; 857 __le32 txpwr; 858 u8 txpwr_setting; 859 u8 op_type; 860 u8 rsvd[2]; 861 } __packed; 862 863 /** 864 * enum qlink_wowlan_trigger 865 * 866 * @QLINK_WOWLAN_TRIG_DISCONNECT: wakeup on disconnect 867 * @QLINK_WOWLAN_TRIG_MAGIC_PKT: wakeup on magic packet 868 * @QLINK_WOWLAN_TRIG_PATTERN_PKT: wakeup on user-defined packet 869 */ 870 enum qlink_wowlan_trigger { 871 QLINK_WOWLAN_TRIG_DISCONNECT = BIT(0), 872 QLINK_WOWLAN_TRIG_MAGIC_PKT = BIT(1), 873 QLINK_WOWLAN_TRIG_PATTERN_PKT = BIT(2), 874 }; 875 876 /** 877 * struct qlink_cmd_wowlan_set - data for QLINK_CMD_WOWLAN_SET command 878 * 879 * @triggers: requested bitmask of WoWLAN triggers 880 */ 881 struct qlink_cmd_wowlan_set { 882 struct qlink_cmd chdr; 883 __le32 triggers; 884 u8 data[0]; 885 } __packed; 886 887 enum qlink_ndev_event_type { 888 QLINK_NDEV_EVENT_CHANGEUPPER, 889 }; 890 891 /** 892 * struct qlink_cmd_ndev_event - data for QLINK_CMD_NDEV_EVENT command 893 * 894 * @event: type of event, one of &enum qlink_ndev_event_type 895 */ 896 struct qlink_cmd_ndev_event { 897 struct qlink_cmd chdr; 898 __le16 event; 899 u8 rsvd[2]; 900 } __packed; 901 902 enum qlink_ndev_upper_type { 903 QLINK_NDEV_UPPER_TYPE_NONE, 904 QLINK_NDEV_UPPER_TYPE_BRIDGE, 905 }; 906 907 /** 908 * struct qlink_cmd_ndev_changeupper - data for QLINK_NDEV_EVENT_CHANGEUPPER 909 * 910 * @br_domain: layer 2 broadcast domain ID that ndev is a member of 911 * @upper_type: type of upper device, one of &enum qlink_ndev_upper_type 912 */ 913 struct qlink_cmd_ndev_changeupper { 914 struct qlink_cmd_ndev_event nehdr; 915 __le64 flags; 916 __le32 br_domain; 917 __le32 netspace_id; 918 __le16 vlanid; 919 u8 upper_type; 920 u8 rsvd[1]; 921 } __packed; 922 923 /** 924 * enum qlink_scan_flags - scan request control flags 925 * 926 * Scan flags are used to control QLINK_CMD_SCAN behavior. 927 * 928 * @QLINK_SCAN_FLAG_FLUSH: flush cache before scanning. 929 */ 930 enum qlink_scan_flags { 931 QLINK_SCAN_FLAG_FLUSH = BIT(0), 932 QLINK_SCAN_FLAG_DURATION_MANDATORY = BIT(1), 933 }; 934 935 /** 936 * struct qlink_cmd_scan - data for QLINK_CMD_SCAN command 937 * 938 * @flags: scan flags, a bitmap of &enum qlink_scan_flags. 939 * @n_ssids: number of WLAN_EID_SSID TLVs expected in variable portion of the 940 * command. 941 * @n_channels: number of QTN_TLV_ID_CHANNEL TLVs expected in variable payload. 942 * @active_dwell: time spent on a single channel for an active scan. 943 * @passive_dwell: time spent on a single channel for a passive scan. 944 * @sample_duration: total duration of sampling a single channel during a scan 945 * including off-channel dwell time and operating channel time. 946 * @bssid: specific BSSID to scan for or a broadcast BSSID. 947 * @scan_width: channel width to use, one of &enum qlink_channel_width. 948 */ 949 struct qlink_cmd_scan { 950 struct qlink_cmd chdr; 951 __le64 flags; 952 __le16 n_ssids; 953 __le16 n_channels; 954 __le16 active_dwell; 955 __le16 passive_dwell; 956 __le16 sample_duration; 957 u8 bssid[ETH_ALEN]; 958 u8 scan_width; 959 u8 rsvd[3]; 960 u8 var_info[0]; 961 } __packed; 962 963 /* QLINK Command Responses messages related definitions 964 */ 965 966 enum qlink_cmd_result { 967 QLINK_CMD_RESULT_OK = 0, 968 QLINK_CMD_RESULT_INVALID, 969 QLINK_CMD_RESULT_ENOTSUPP, 970 QLINK_CMD_RESULT_ENOTFOUND, 971 QLINK_CMD_RESULT_EALREADY, 972 QLINK_CMD_RESULT_EADDRINUSE, 973 QLINK_CMD_RESULT_EADDRNOTAVAIL, 974 QLINK_CMD_RESULT_EBUSY, 975 }; 976 977 /** 978 * struct qlink_resp - QLINK command response message header 979 * 980 * Header used for QLINK messages of QLINK_MSG_TYPE_CMDRSP type. 981 * 982 * @mhdr: see &struct qlink_msg_header. 983 * @cmd_id: command ID the response corresponds to, one of &enum qlink_cmd_type. 984 * @seq_num: sequence number of command message, used for matching with 985 * response message. 986 * @result: result of the command execution, one of &enum qlink_cmd_result. 987 * @macid: index of physical radio device the response is sent from or 988 * QLINK_MACID_RSVD if not applicable. 989 * @vifid: index of virtual wireless interface on specified @macid the response 990 * is sent from or QLINK_VIFID_RSVD if not applicable. 991 */ 992 struct qlink_resp { 993 struct qlink_msg_header mhdr; 994 __le16 cmd_id; 995 __le16 seq_num; 996 __le16 result; 997 u8 macid; 998 u8 vifid; 999 } __packed; 1000 1001 /** 1002 * struct qlink_resp_init_fw - response for QLINK_CMD_FW_INIT 1003 * 1004 * @qlink_proto_ver: QLINK protocol version used by wifi card firmware. 1005 */ 1006 struct qlink_resp_init_fw { 1007 struct qlink_resp rhdr; 1008 __le32 qlink_proto_ver; 1009 } __packed; 1010 1011 /** 1012 * enum qlink_dfs_regions - regulatory DFS regions 1013 * 1014 * Corresponds to &enum nl80211_dfs_regions. 1015 */ 1016 enum qlink_dfs_regions { 1017 QLINK_DFS_UNSET = 0, 1018 QLINK_DFS_FCC = 1, 1019 QLINK_DFS_ETSI = 2, 1020 QLINK_DFS_JP = 3, 1021 }; 1022 1023 /** 1024 * struct qlink_resp_get_mac_info - response for QLINK_CMD_MAC_INFO command 1025 * 1026 * Data describing specific physical device providing wireless MAC 1027 * functionality. 1028 * 1029 * @dev_mac: MAC address of physical WMAC device (used for first BSS on 1030 * specified WMAC). 1031 * @num_tx_chain: Number of transmit chains used by WMAC. 1032 * @num_rx_chain: Number of receive chains used by WMAC. 1033 * @vht_cap_mod_mask: mask specifying which VHT capabilities can be altered. 1034 * @ht_cap_mod_mask: mask specifying which HT capabilities can be altered. 1035 * @max_scan_ssids: maximum number of SSIDs the device can scan for in any scan. 1036 * @bands_cap: wireless bands WMAC can operate in, bitmap of &enum qlink_band. 1037 * @max_ap_assoc_sta: Maximum number of associations supported by WMAC. 1038 * @radar_detect_widths: bitmask of channels BW for which WMAC can detect radar. 1039 * @alpha2: country code ID firmware is configured to. 1040 * @n_reg_rules: number of regulatory rules TLVs in variable portion of the 1041 * message. 1042 * @dfs_region: regulatory DFS region, one of &enum qlink_dfs_regions. 1043 * @var_info: variable-length WMAC info data. 1044 */ 1045 struct qlink_resp_get_mac_info { 1046 struct qlink_resp rhdr; 1047 u8 dev_mac[ETH_ALEN]; 1048 u8 num_tx_chain; 1049 u8 num_rx_chain; 1050 struct ieee80211_vht_cap vht_cap_mod_mask; 1051 struct ieee80211_ht_cap ht_cap_mod_mask; 1052 1053 __le16 max_ap_assoc_sta; 1054 __le32 hw_version; 1055 __le32 probe_resp_offload; 1056 __le32 bss_select_support; 1057 __le16 n_addresses; 1058 __le16 radar_detect_widths; 1059 __le16 max_remain_on_channel_duration; 1060 __le16 max_acl_mac_addrs; 1061 1062 __le32 frag_threshold; 1063 __le32 rts_threshold; 1064 u8 retry_short; 1065 u8 retry_long; 1066 u8 coverage_class; 1067 1068 u8 max_scan_ssids; 1069 u8 max_sched_scan_reqs; 1070 u8 max_sched_scan_ssids; 1071 u8 max_match_sets; 1072 u8 max_adj_channel_rssi_comp; 1073 1074 __le16 max_scan_ie_len; 1075 __le16 max_sched_scan_ie_len; 1076 __le32 max_sched_scan_plans; 1077 __le32 max_sched_scan_plan_interval; 1078 __le32 max_sched_scan_plan_iterations; 1079 1080 u8 n_cipher_suites; 1081 u8 n_akm_suites; 1082 u8 max_num_pmkids; 1083 u8 num_iftype_ext_capab; 1084 u8 extended_capabilities_len; 1085 u8 max_data_retry_count; 1086 u8 n_iface_combinations; 1087 u8 max_num_csa_counters; 1088 1089 u8 bands_cap; 1090 u8 alpha2[2]; 1091 u8 n_reg_rules; 1092 u8 dfs_region; 1093 u8 rsvd[3]; 1094 u8 var_info[0]; 1095 } __packed; 1096 1097 /** 1098 * struct qlink_resp_get_hw_info - response for QLINK_CMD_GET_HW_INFO command 1099 * 1100 * Description of wireless hardware capabilities and features. 1101 * 1102 * @fw_ver: wireless hardware firmware version. 1103 * @num_mac: Number of separate physical radio devices provided by hardware. 1104 * @mac_bitmap: Bitmap of MAC IDs that are active and can be used in firmware. 1105 * @total_tx_chains: total number of transmit chains used by device. 1106 * @total_rx_chains: total number of receive chains. 1107 * @info: variable-length HW info. 1108 */ 1109 struct qlink_resp_get_hw_info { 1110 struct qlink_resp rhdr; 1111 __le32 fw_ver; 1112 __le32 bld_tmstamp; 1113 __le32 plat_id; 1114 __le32 hw_ver; 1115 u8 num_mac; 1116 u8 mac_bitmap; 1117 u8 total_tx_chain; 1118 u8 total_rx_chain; 1119 u8 info[0]; 1120 } __packed; 1121 1122 /** 1123 * struct qlink_resp_manage_intf - response for interface management commands 1124 * 1125 * Response data for QLINK_CMD_ADD_INTF and QLINK_CMD_CHANGE_INTF commands. 1126 * 1127 * @rhdr: Common Command Response message header. 1128 * @intf_info: interface description. 1129 */ 1130 struct qlink_resp_manage_intf { 1131 struct qlink_resp rhdr; 1132 struct qlink_intf_info intf_info; 1133 } __packed; 1134 1135 enum qlink_sta_info_rate_flags { 1136 QLINK_STA_INFO_RATE_FLAG_HT_MCS = BIT(0), 1137 QLINK_STA_INFO_RATE_FLAG_VHT_MCS = BIT(1), 1138 QLINK_STA_INFO_RATE_FLAG_SHORT_GI = BIT(2), 1139 QLINK_STA_INFO_RATE_FLAG_60G = BIT(3), 1140 QLINK_STA_INFO_RATE_FLAG_HE_MCS = BIT(4), 1141 }; 1142 1143 /** 1144 * struct qlink_resp_get_sta_info - response for QLINK_CMD_GET_STA_INFO command 1145 * 1146 * Response data containing statistics for specified STA. 1147 * 1148 * @sta_addr: MAC address of STA the response carries statistic for. 1149 * @info: variable statistics for specified STA. 1150 */ 1151 struct qlink_resp_get_sta_info { 1152 struct qlink_resp rhdr; 1153 u8 sta_addr[ETH_ALEN]; 1154 u8 rsvd[2]; 1155 u8 info[0]; 1156 } __packed; 1157 1158 /** 1159 * struct qlink_resp_band_info_get - response for QLINK_CMD_BAND_INFO_GET cmd 1160 * 1161 * @band: frequency band that the response describes, one of @enum qlink_band. 1162 * @num_chans: total number of channels info TLVs contained in reply. 1163 * @num_bitrates: total number of bitrate TLVs contained in reply. 1164 * @info: variable-length info portion. 1165 */ 1166 struct qlink_resp_band_info_get { 1167 struct qlink_resp rhdr; 1168 u8 band; 1169 u8 num_chans; 1170 u8 num_bitrates; 1171 u8 rsvd[1]; 1172 u8 info[0]; 1173 } __packed; 1174 1175 /** 1176 * struct qlink_resp_get_chan_stats - response for QLINK_CMD_CHAN_STATS cmd 1177 * 1178 * @chan_freq: center frequency for a channel the report is sent for. 1179 * @info: variable-length channel info. 1180 */ 1181 struct qlink_resp_get_chan_stats { 1182 struct qlink_resp rhdr; 1183 __le32 chan_freq; 1184 u8 info[0]; 1185 } __packed; 1186 1187 /** 1188 * struct qlink_resp_channel_get - response for QLINK_CMD_CHAN_GET command 1189 * 1190 * @chan: definition of current operating channel. 1191 */ 1192 struct qlink_resp_channel_get { 1193 struct qlink_resp rhdr; 1194 struct qlink_chandef chan; 1195 } __packed; 1196 1197 /** 1198 * struct qlink_resp_txpwr - response for QLINK_CMD_TXPWR command 1199 * 1200 * This response is intended for QLINK_TXPWR_GET operation and does not 1201 * contain any meaningful information in case of QLINK_TXPWR_SET operation. 1202 * 1203 * @txpwr: current transmit power setting, in mBm 1204 */ 1205 struct qlink_resp_txpwr { 1206 struct qlink_resp rhdr; 1207 __le32 txpwr; 1208 } __packed; 1209 1210 /* QLINK Events messages related definitions 1211 */ 1212 1213 enum qlink_event_type { 1214 QLINK_EVENT_STA_ASSOCIATED = 0x0021, 1215 QLINK_EVENT_STA_DEAUTH = 0x0022, 1216 QLINK_EVENT_MGMT_RECEIVED = 0x0023, 1217 QLINK_EVENT_SCAN_RESULTS = 0x0024, 1218 QLINK_EVENT_SCAN_COMPLETE = 0x0025, 1219 QLINK_EVENT_BSS_JOIN = 0x0026, 1220 QLINK_EVENT_BSS_LEAVE = 0x0027, 1221 QLINK_EVENT_FREQ_CHANGE = 0x0028, 1222 QLINK_EVENT_RADAR = 0x0029, 1223 QLINK_EVENT_EXTERNAL_AUTH = 0x0030, 1224 QLINK_EVENT_MIC_FAILURE = 0x0031, 1225 }; 1226 1227 /** 1228 * struct qlink_event - QLINK event message header 1229 * 1230 * Header used for QLINK messages of QLINK_MSG_TYPE_EVENT type. 1231 * 1232 * @mhdr: Common QLINK message header. 1233 * @event_id: Specifies specific event ID, one of &enum qlink_event_type. 1234 * @macid: index of physical radio device the event was generated on or 1235 * QLINK_MACID_RSVD if not applicable. 1236 * @vifid: index of virtual wireless interface on specified @macid the event 1237 * was generated on or QLINK_VIFID_RSVD if not applicable. 1238 */ 1239 struct qlink_event { 1240 struct qlink_msg_header mhdr; 1241 __le16 event_id; 1242 u8 macid; 1243 u8 vifid; 1244 } __packed; 1245 1246 /** 1247 * struct qlink_event_sta_assoc - data for QLINK_EVENT_STA_ASSOCIATED event 1248 * 1249 * @sta_addr: Address of a STA for which new association event was generated 1250 * @frame_control: control bits from 802.11 ASSOC_REQUEST header. 1251 * @payload: IEs from association request. 1252 */ 1253 struct qlink_event_sta_assoc { 1254 struct qlink_event ehdr; 1255 u8 sta_addr[ETH_ALEN]; 1256 __le16 frame_control; 1257 u8 ies[0]; 1258 } __packed; 1259 1260 /** 1261 * struct qlink_event_sta_deauth - data for QLINK_EVENT_STA_DEAUTH event 1262 * 1263 * @sta_addr: Address of a deauthenticated STA. 1264 * @reason: reason for deauthentication. 1265 */ 1266 struct qlink_event_sta_deauth { 1267 struct qlink_event ehdr; 1268 u8 sta_addr[ETH_ALEN]; 1269 __le16 reason; 1270 } __packed; 1271 1272 /** 1273 * struct qlink_event_bss_join - data for QLINK_EVENT_BSS_JOIN event 1274 * 1275 * @chan: new operating channel definition 1276 * @bssid: BSSID of a BSS which interface tried to joined. 1277 * @status: status of joining attempt, see &enum ieee80211_statuscode. 1278 */ 1279 struct qlink_event_bss_join { 1280 struct qlink_event ehdr; 1281 struct qlink_chandef chan; 1282 u8 bssid[ETH_ALEN]; 1283 __le16 status; 1284 u8 ies[0]; 1285 } __packed; 1286 1287 /** 1288 * struct qlink_event_bss_leave - data for QLINK_EVENT_BSS_LEAVE event 1289 * 1290 * @reason: reason of disconnecting from BSS. 1291 */ 1292 struct qlink_event_bss_leave { 1293 struct qlink_event ehdr; 1294 __le16 reason; 1295 u8 rsvd[2]; 1296 } __packed; 1297 1298 /** 1299 * struct qlink_event_freq_change - data for QLINK_EVENT_FREQ_CHANGE event 1300 * 1301 * @chan: new operating channel definition 1302 */ 1303 struct qlink_event_freq_change { 1304 struct qlink_event ehdr; 1305 struct qlink_chandef chan; 1306 } __packed; 1307 1308 enum qlink_rxmgmt_flags { 1309 QLINK_RXMGMT_FLAG_ANSWERED = 1 << 0, 1310 }; 1311 1312 /** 1313 * struct qlink_event_rxmgmt - data for QLINK_EVENT_MGMT_RECEIVED event 1314 * 1315 * @freq: Frequency on which the frame was received in MHz. 1316 * @flags: bitmap of &enum qlink_rxmgmt_flags. 1317 * @sig_dbm: signal strength in dBm. 1318 * @frame_data: data of Rx'd frame itself. 1319 */ 1320 struct qlink_event_rxmgmt { 1321 struct qlink_event ehdr; 1322 __le32 freq; 1323 __le32 flags; 1324 s8 sig_dbm; 1325 u8 rsvd[3]; 1326 u8 frame_data[0]; 1327 } __packed; 1328 1329 /** 1330 * struct qlink_event_scan_result - data for QLINK_EVENT_SCAN_RESULTS event 1331 * 1332 * @tsf: TSF timestamp indicating when scan results were generated. 1333 * @freq: Center frequency of the channel where BSS for which the scan result 1334 * event was generated was discovered. 1335 * @capab: capabilities field. 1336 * @bintval: beacon interval announced by discovered BSS. 1337 * @sig_dbm: signal strength in dBm. 1338 * @bssid: BSSID announced by discovered BSS. 1339 * @ssid_len: length of SSID announced by BSS. 1340 * @ssid: SSID announced by discovered BSS. 1341 * @payload: IEs that are announced by discovered BSS in its MGMt frames. 1342 */ 1343 struct qlink_event_scan_result { 1344 struct qlink_event ehdr; 1345 __le64 tsf; 1346 __le16 freq; 1347 __le16 capab; 1348 __le16 bintval; 1349 s8 sig_dbm; 1350 u8 ssid_len; 1351 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1352 u8 bssid[ETH_ALEN]; 1353 u8 rsvd[2]; 1354 u8 payload[0]; 1355 } __packed; 1356 1357 /** 1358 * enum qlink_scan_complete_flags - indicates result of scan request. 1359 * 1360 * @QLINK_SCAN_NONE: Scan request was processed. 1361 * @QLINK_SCAN_ABORTED: Scan was aborted. 1362 */ 1363 enum qlink_scan_complete_flags { 1364 QLINK_SCAN_NONE = 0, 1365 QLINK_SCAN_ABORTED = BIT(0), 1366 }; 1367 1368 /** 1369 * struct qlink_event_scan_complete - data for QLINK_EVENT_SCAN_COMPLETE event 1370 * 1371 * @flags: flags indicating the status of pending scan request, 1372 * see &enum qlink_scan_complete_flags. 1373 */ 1374 struct qlink_event_scan_complete { 1375 struct qlink_event ehdr; 1376 __le32 flags; 1377 } __packed; 1378 1379 enum qlink_radar_event { 1380 QLINK_RADAR_DETECTED, 1381 QLINK_RADAR_CAC_FINISHED, 1382 QLINK_RADAR_CAC_ABORTED, 1383 QLINK_RADAR_NOP_FINISHED, 1384 QLINK_RADAR_PRE_CAC_EXPIRED, 1385 QLINK_RADAR_CAC_STARTED, 1386 }; 1387 1388 /** 1389 * struct qlink_event_radar - data for QLINK_EVENT_RADAR event 1390 * 1391 * @chan: channel on which radar event happened. 1392 * @event: radar event type, one of &enum qlink_radar_event. 1393 */ 1394 struct qlink_event_radar { 1395 struct qlink_event ehdr; 1396 struct qlink_chandef chan; 1397 u8 event; 1398 u8 rsvd[3]; 1399 } __packed; 1400 1401 /** 1402 * struct qlink_event_external_auth - data for QLINK_EVENT_EXTERNAL_AUTH event 1403 * 1404 * @ssid: SSID announced by BSS 1405 * @ssid_len: SSID length 1406 * @bssid: BSSID of the BSS to connect to 1407 * @akm_suite: AKM suite for external authentication 1408 * @action: action type/trigger for external authentication 1409 */ 1410 struct qlink_event_external_auth { 1411 struct qlink_event ehdr; 1412 __le32 akm_suite; 1413 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1414 u8 bssid[ETH_ALEN]; 1415 u8 ssid_len; 1416 u8 action; 1417 } __packed; 1418 1419 /** 1420 * struct qlink_event_mic_failure - data for QLINK_EVENT_MIC_FAILURE event 1421 * 1422 * @src: source MAC address of the frame 1423 * @key_index: index of the key being reported 1424 * @pairwise: whether the key is pairwise or group 1425 */ 1426 struct qlink_event_mic_failure { 1427 struct qlink_event ehdr; 1428 u8 src[ETH_ALEN]; 1429 u8 key_index; 1430 u8 pairwise; 1431 } __packed; 1432 1433 /* QLINK TLVs (Type-Length Values) definitions 1434 */ 1435 1436 /** 1437 * enum qlink_tlv_id - list of TLVs that Qlink messages can carry 1438 * 1439 * @QTN_TLV_ID_BITMAP: a data representing a bitmap that is used together with 1440 * other TLVs: 1441 * &enum qlink_sta_info used to indicate which statistic carried in 1442 * QTN_TLV_ID_STA_STATS is valid. 1443 * &enum qlink_hw_capab listing wireless card capabilities. 1444 * &enum qlink_driver_capab listing driver/host system capabilities. 1445 * &enum qlink_chan_stat used to indicate which statistic carried in 1446 * QTN_TLV_ID_CHANNEL_STATS is valid. 1447 * @QTN_TLV_ID_STA_STATS: per-STA statistics as defined by 1448 * &struct qlink_sta_stats. Valid values are marked as such in a bitmap 1449 * carried by QTN_TLV_ID_BITMAP. 1450 * @QTN_TLV_ID_IFTYPE_DATA: supported band data. 1451 */ 1452 enum qlink_tlv_id { 1453 QTN_TLV_ID_FRAG_THRESH = 0x0201, 1454 QTN_TLV_ID_RTS_THRESH = 0x0202, 1455 QTN_TLV_ID_SRETRY_LIMIT = 0x0203, 1456 QTN_TLV_ID_LRETRY_LIMIT = 0x0204, 1457 QTN_TLV_ID_REG_RULE = 0x0207, 1458 QTN_TLV_ID_CHANNEL = 0x020F, 1459 QTN_TLV_ID_CHANDEF = 0x0210, 1460 QTN_TLV_ID_BITMAP = 0x0211, 1461 QTN_TLV_ID_STA_STATS = 0x0212, 1462 QTN_TLV_ID_COVERAGE_CLASS = 0x0213, 1463 QTN_TLV_ID_IFACE_LIMIT = 0x0214, 1464 QTN_TLV_ID_CHANNEL_STATS = 0x0216, 1465 QTN_TLV_ID_KEY = 0x0302, 1466 QTN_TLV_ID_SEQ = 0x0303, 1467 QTN_TLV_ID_IE_SET = 0x0305, 1468 QTN_TLV_ID_EXT_CAPABILITY_MASK = 0x0306, 1469 QTN_TLV_ID_ACL_DATA = 0x0307, 1470 QTN_TLV_ID_BUILD_NAME = 0x0401, 1471 QTN_TLV_ID_BUILD_REV = 0x0402, 1472 QTN_TLV_ID_BUILD_TYPE = 0x0403, 1473 QTN_TLV_ID_BUILD_LABEL = 0x0404, 1474 QTN_TLV_ID_HW_ID = 0x0405, 1475 QTN_TLV_ID_CALIBRATION_VER = 0x0406, 1476 QTN_TLV_ID_UBOOT_VER = 0x0407, 1477 QTN_TLV_ID_RANDOM_MAC_ADDR = 0x0408, 1478 QTN_TLV_ID_WOWLAN_CAPAB = 0x0410, 1479 QTN_TLV_ID_WOWLAN_PATTERN = 0x0411, 1480 QTN_TLV_ID_IFTYPE_DATA = 0x0418, 1481 }; 1482 1483 struct qlink_tlv_hdr { 1484 __le16 type; 1485 __le16 len; 1486 u8 val[0]; 1487 } __packed; 1488 1489 struct qlink_iface_limit { 1490 __le16 max_num; 1491 __le16 type; 1492 } __packed; 1493 1494 struct qlink_iface_limit_record { 1495 __le16 max_interfaces; 1496 u8 num_different_channels; 1497 u8 n_limits; 1498 struct qlink_iface_limit limits[0]; 1499 } __packed; 1500 1501 #define QLINK_RSSI_OFFSET 120 1502 1503 /** 1504 * enum qlink_reg_rule_flags - regulatory rule flags 1505 * 1506 * See description of &enum nl80211_reg_rule_flags 1507 */ 1508 enum qlink_reg_rule_flags { 1509 QLINK_RRF_NO_OFDM = BIT(0), 1510 QLINK_RRF_NO_CCK = BIT(1), 1511 QLINK_RRF_NO_INDOOR = BIT(2), 1512 QLINK_RRF_NO_OUTDOOR = BIT(3), 1513 QLINK_RRF_DFS = BIT(4), 1514 QLINK_RRF_PTP_ONLY = BIT(5), 1515 QLINK_RRF_PTMP_ONLY = BIT(6), 1516 QLINK_RRF_NO_IR = BIT(7), 1517 QLINK_RRF_AUTO_BW = BIT(8), 1518 QLINK_RRF_IR_CONCURRENT = BIT(9), 1519 QLINK_RRF_NO_HT40MINUS = BIT(10), 1520 QLINK_RRF_NO_HT40PLUS = BIT(11), 1521 QLINK_RRF_NO_80MHZ = BIT(12), 1522 QLINK_RRF_NO_160MHZ = BIT(13), 1523 }; 1524 1525 /** 1526 * struct qlink_tlv_reg_rule - data for QTN_TLV_ID_REG_RULE TLV 1527 * 1528 * Regulatory rule description. 1529 * 1530 * @start_freq_khz: start frequency of the range the rule is attributed to. 1531 * @end_freq_khz: end frequency of the range the rule is attributed to. 1532 * @max_bandwidth_khz: max bandwidth that channels in specified range can be 1533 * configured to. 1534 * @max_antenna_gain: max antenna gain that can be used in the specified 1535 * frequency range, dBi. 1536 * @max_eirp: maximum EIRP. 1537 * @flags: regulatory rule flags in &enum qlink_reg_rule_flags. 1538 * @dfs_cac_ms: DFS CAC period. 1539 */ 1540 struct qlink_tlv_reg_rule { 1541 struct qlink_tlv_hdr hdr; 1542 __le32 start_freq_khz; 1543 __le32 end_freq_khz; 1544 __le32 max_bandwidth_khz; 1545 __le32 max_antenna_gain; 1546 __le32 max_eirp; 1547 __le32 flags; 1548 __le32 dfs_cac_ms; 1549 } __packed; 1550 1551 enum qlink_channel_flags { 1552 QLINK_CHAN_DISABLED = BIT(0), 1553 QLINK_CHAN_NO_IR = BIT(1), 1554 QLINK_CHAN_RADAR = BIT(3), 1555 QLINK_CHAN_NO_HT40PLUS = BIT(4), 1556 QLINK_CHAN_NO_HT40MINUS = BIT(5), 1557 QLINK_CHAN_NO_OFDM = BIT(6), 1558 QLINK_CHAN_NO_80MHZ = BIT(7), 1559 QLINK_CHAN_NO_160MHZ = BIT(8), 1560 QLINK_CHAN_INDOOR_ONLY = BIT(9), 1561 QLINK_CHAN_IR_CONCURRENT = BIT(10), 1562 QLINK_CHAN_NO_20MHZ = BIT(11), 1563 QLINK_CHAN_NO_10MHZ = BIT(12), 1564 }; 1565 1566 enum qlink_dfs_state { 1567 QLINK_DFS_USABLE, 1568 QLINK_DFS_UNAVAILABLE, 1569 QLINK_DFS_AVAILABLE, 1570 }; 1571 1572 /** 1573 * struct qlink_tlv_channel - data for QTN_TLV_ID_CHANNEL TLV 1574 * 1575 * Channel settings. 1576 * 1577 * @channel: ieee80211 channel settings. 1578 */ 1579 struct qlink_tlv_channel { 1580 struct qlink_tlv_hdr hdr; 1581 struct qlink_channel chan; 1582 } __packed; 1583 1584 /** 1585 * struct qlink_tlv_chandef - data for QTN_TLV_ID_CHANDEF TLV 1586 * 1587 * Channel definition. 1588 * 1589 * @chan: channel definition data. 1590 */ 1591 struct qlink_tlv_chandef { 1592 struct qlink_tlv_hdr hdr; 1593 struct qlink_chandef chdef; 1594 } __packed; 1595 1596 enum qlink_ie_set_type { 1597 QLINK_IE_SET_UNKNOWN, 1598 QLINK_IE_SET_ASSOC_REQ, 1599 QLINK_IE_SET_ASSOC_RESP, 1600 QLINK_IE_SET_PROBE_REQ, 1601 QLINK_IE_SET_SCAN, 1602 QLINK_IE_SET_BEACON_HEAD, 1603 QLINK_IE_SET_BEACON_TAIL, 1604 QLINK_IE_SET_BEACON_IES, 1605 QLINK_IE_SET_PROBE_RESP, 1606 QLINK_IE_SET_PROBE_RESP_IES, 1607 }; 1608 1609 /** 1610 * struct qlink_tlv_ie_set - data for QTN_TLV_ID_IE_SET 1611 * 1612 * @type: type of MGMT frame IEs belong to, one of &enum qlink_ie_set_type. 1613 * @flags: for future use. 1614 * @ie_data: IEs data. 1615 */ 1616 struct qlink_tlv_ie_set { 1617 struct qlink_tlv_hdr hdr; 1618 u8 type; 1619 u8 flags; 1620 u8 rsvd[2]; 1621 u8 ie_data[0]; 1622 } __packed; 1623 1624 /** 1625 * struct qlink_tlv_ext_ie - extension IE 1626 * 1627 * @eid_ext: element ID extension, one of &enum ieee80211_eid_ext. 1628 * @ie_data: IEs data. 1629 */ 1630 struct qlink_tlv_ext_ie { 1631 struct qlink_tlv_hdr hdr; 1632 u8 eid_ext; 1633 u8 rsvd[3]; 1634 u8 ie_data[0]; 1635 } __packed; 1636 1637 #define IEEE80211_HE_PPE_THRES_MAX_LEN 25 1638 struct qlink_sband_iftype_data { 1639 __le16 types_mask; 1640 struct ieee80211_he_cap_elem he_cap_elem; 1641 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; 1642 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN]; 1643 } __packed; 1644 1645 /** 1646 * struct qlink_tlv_iftype_data - data for QTN_TLV_ID_IFTYPE_DATA 1647 * 1648 * @n_iftype_data: number of entries in iftype_data. 1649 * @iftype_data: interface type data entries. 1650 */ 1651 struct qlink_tlv_iftype_data { 1652 struct qlink_tlv_hdr hdr; 1653 u8 n_iftype_data; 1654 u8 rsvd[3]; 1655 struct qlink_sband_iftype_data iftype_data[0]; 1656 } __packed; 1657 1658 /** 1659 * enum qlink_chan_stat - channel statistics bitmap 1660 * 1661 * Used to indicate which statistics values in &struct qlink_chan_stats 1662 * are valid. Individual values are used to fill a bitmap carried in a 1663 * payload of QTN_TLV_ID_BITMAP. 1664 * 1665 * @QLINK_CHAN_STAT_TIME_ON: time_on value is valid. 1666 * @QLINK_CHAN_STAT_TIME_TX: time_tx value is valid. 1667 * @QLINK_CHAN_STAT_TIME_RX: time_rx value is valid. 1668 * @QLINK_CHAN_STAT_CCA_BUSY: cca_busy value is valid. 1669 * @QLINK_CHAN_STAT_CCA_BUSY_EXT: cca_busy_ext value is valid. 1670 * @QLINK_CHAN_STAT_TIME_SCAN: time_scan value is valid. 1671 * @QLINK_CHAN_STAT_CHAN_NOISE: chan_noise value is valid. 1672 */ 1673 enum qlink_chan_stat { 1674 QLINK_CHAN_STAT_TIME_ON, 1675 QLINK_CHAN_STAT_TIME_TX, 1676 QLINK_CHAN_STAT_TIME_RX, 1677 QLINK_CHAN_STAT_CCA_BUSY, 1678 QLINK_CHAN_STAT_CCA_BUSY_EXT, 1679 QLINK_CHAN_STAT_TIME_SCAN, 1680 QLINK_CHAN_STAT_CHAN_NOISE, 1681 QLINK_CHAN_STAT_NUM, 1682 }; 1683 1684 /** 1685 * struct qlink_chan_stats - data for QTN_TLV_ID_CHANNEL_STATS 1686 * 1687 * Carries a per-channel statistics. Not all fields may be filled with 1688 * valid values. Valid fields should be indicated as such using a bitmap of 1689 * &enum qlink_chan_stat. Bitmap is carried separately in a payload of 1690 * QTN_TLV_ID_BITMAP. 1691 * 1692 * @time_on: amount of time radio operated on that channel. 1693 * @time_tx: amount of time radio spent transmitting on the channel. 1694 * @time_rx: amount of time radio spent receiving on the channel. 1695 * @cca_busy: amount of time the the primary channel was busy. 1696 * @cca_busy_ext: amount of time the the secondary channel was busy. 1697 * @time_scan: amount of radio spent scanning on the channel. 1698 * @chan_noise: channel noise. 1699 */ 1700 struct qlink_chan_stats { 1701 __le64 time_on; 1702 __le64 time_tx; 1703 __le64 time_rx; 1704 __le64 cca_busy; 1705 __le64 cca_busy_ext; 1706 __le64 time_scan; 1707 s8 chan_noise; 1708 u8 rsvd[3]; 1709 } __packed; 1710 1711 /** 1712 * enum qlink_sta_info - station information bitmap 1713 * 1714 * Used to indicate which statistics values in &struct qlink_sta_stats 1715 * are valid. Individual values are used to fill a bitmap carried in a 1716 * payload of QTN_TLV_ID_BITMAP. 1717 * 1718 * @QLINK_STA_INFO_CONNECTED_TIME: connected_time value is valid. 1719 * @QLINK_STA_INFO_INACTIVE_TIME: inactive_time value is valid. 1720 * @QLINK_STA_INFO_RX_BYTES: lower 32 bits of rx_bytes value are valid. 1721 * @QLINK_STA_INFO_TX_BYTES: lower 32 bits of tx_bytes value are valid. 1722 * @QLINK_STA_INFO_RX_BYTES64: rx_bytes value is valid. 1723 * @QLINK_STA_INFO_TX_BYTES64: tx_bytes value is valid. 1724 * @QLINK_STA_INFO_RX_DROP_MISC: rx_dropped_misc value is valid. 1725 * @QLINK_STA_INFO_BEACON_RX: rx_beacon value is valid. 1726 * @QLINK_STA_INFO_SIGNAL: signal value is valid. 1727 * @QLINK_STA_INFO_SIGNAL_AVG: signal_avg value is valid. 1728 * @QLINK_STA_INFO_RX_BITRATE: rxrate value is valid. 1729 * @QLINK_STA_INFO_TX_BITRATE: txrate value is valid. 1730 * @QLINK_STA_INFO_RX_PACKETS: rx_packets value is valid. 1731 * @QLINK_STA_INFO_TX_PACKETS: tx_packets value is valid. 1732 * @QLINK_STA_INFO_TX_RETRIES: tx_retries value is valid. 1733 * @QLINK_STA_INFO_TX_FAILED: tx_failed value is valid. 1734 * @QLINK_STA_INFO_STA_FLAGS: sta_flags value is valid. 1735 */ 1736 enum qlink_sta_info { 1737 QLINK_STA_INFO_CONNECTED_TIME, 1738 QLINK_STA_INFO_INACTIVE_TIME, 1739 QLINK_STA_INFO_RX_BYTES, 1740 QLINK_STA_INFO_TX_BYTES, 1741 QLINK_STA_INFO_RX_BYTES64, 1742 QLINK_STA_INFO_TX_BYTES64, 1743 QLINK_STA_INFO_RX_DROP_MISC, 1744 QLINK_STA_INFO_BEACON_RX, 1745 QLINK_STA_INFO_SIGNAL, 1746 QLINK_STA_INFO_SIGNAL_AVG, 1747 QLINK_STA_INFO_RX_BITRATE, 1748 QLINK_STA_INFO_TX_BITRATE, 1749 QLINK_STA_INFO_RX_PACKETS, 1750 QLINK_STA_INFO_TX_PACKETS, 1751 QLINK_STA_INFO_TX_RETRIES, 1752 QLINK_STA_INFO_TX_FAILED, 1753 QLINK_STA_INFO_STA_FLAGS, 1754 QLINK_STA_INFO_NUM, 1755 }; 1756 1757 /** 1758 * struct qlink_sta_info_rate - STA rate statistics 1759 * 1760 * @rate: data rate in Mbps. 1761 * @flags: bitmap of &enum qlink_sta_info_rate_flags. 1762 * @mcs: 802.11-defined MCS index. 1763 * nss: Number of Spatial Streams. 1764 * @bw: bandwidth, one of &enum qlink_channel_width. 1765 */ 1766 struct qlink_sta_info_rate { 1767 __le16 rate; 1768 u8 flags; 1769 u8 mcs; 1770 u8 nss; 1771 u8 bw; 1772 } __packed; 1773 1774 /** 1775 * struct qlink_sta_stats - data for QTN_TLV_ID_STA_STATS 1776 * 1777 * Carries statistics of a STA. Not all fields may be filled with 1778 * valid values. Valid fields should be indicated as such using a bitmap of 1779 * &enum qlink_sta_info. Bitmap is carried separately in a payload of 1780 * QTN_TLV_ID_BITMAP. 1781 */ 1782 struct qlink_sta_stats { 1783 __le64 rx_bytes; 1784 __le64 tx_bytes; 1785 __le64 rx_beacon; 1786 __le64 rx_duration; 1787 __le64 t_offset; 1788 __le32 connected_time; 1789 __le32 inactive_time; 1790 __le32 rx_packets; 1791 __le32 tx_packets; 1792 __le32 tx_retries; 1793 __le32 tx_failed; 1794 __le32 rx_dropped_misc; 1795 __le32 beacon_loss_count; 1796 __le32 expected_throughput; 1797 struct qlink_sta_info_state sta_flags; 1798 struct qlink_sta_info_rate txrate; 1799 struct qlink_sta_info_rate rxrate; 1800 __le16 llid; 1801 __le16 plid; 1802 u8 local_pm; 1803 u8 peer_pm; 1804 u8 nonpeer_pm; 1805 u8 rx_beacon_signal_avg; 1806 u8 plink_state; 1807 u8 signal; 1808 u8 signal_avg; 1809 u8 rsvd[1]; 1810 }; 1811 1812 /** 1813 * struct qlink_random_mac_addr - data for QTN_TLV_ID_RANDOM_MAC_ADDR TLV 1814 * 1815 * Specifies MAC address mask/value for generation random MAC address 1816 * during scan. 1817 * 1818 * @mac_addr: MAC address used with randomisation 1819 * @mac_addr_mask: MAC address mask used with randomisation, bits that 1820 * are 0 in the mask should be randomised, bits that are 1 should 1821 * be taken from the @mac_addr 1822 */ 1823 struct qlink_random_mac_addr { 1824 u8 mac_addr[ETH_ALEN]; 1825 u8 mac_addr_mask[ETH_ALEN]; 1826 } __packed; 1827 1828 /** 1829 * struct qlink_wowlan_capab_data - data for QTN_TLV_ID_WOWLAN_CAPAB TLV 1830 * 1831 * WoWLAN capabilities supported by cards. 1832 * 1833 * @version: version of WoWLAN data structure, to ensure backward 1834 * compatibility for firmwares with limited WoWLAN support 1835 * @len: Total length of WoWLAN data 1836 * @data: supported WoWLAN features 1837 */ 1838 struct qlink_wowlan_capab_data { 1839 __le16 version; 1840 __le16 len; 1841 u8 data[0]; 1842 } __packed; 1843 1844 /** 1845 * struct qlink_wowlan_support - supported WoWLAN capabilities 1846 * 1847 * @n_patterns: number of supported wakeup patterns 1848 * @pattern_max_len: maximum length of each pattern 1849 * @pattern_min_len: minimum length of each pattern 1850 */ 1851 struct qlink_wowlan_support { 1852 __le32 n_patterns; 1853 __le32 pattern_max_len; 1854 __le32 pattern_min_len; 1855 } __packed; 1856 1857 #endif /* _QTN_QLINK_H_ */ 1858