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