1 /* 2 * Copyright (c) 2015-2016 Quantenna Communications, Inc. 3 * All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 */ 16 17 #ifndef _QTN_QLINK_H_ 18 #define _QTN_QLINK_H_ 19 20 #include <linux/ieee80211.h> 21 22 #define QLINK_PROTO_VER 11 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 */ 73 enum qlink_hw_capab { 74 QLINK_HW_CAPAB_REG_UPDATE = BIT(0), 75 QLINK_HW_CAPAB_STA_INACT_TIMEOUT = BIT(1), 76 QLINK_HW_CAPAB_DFS_OFFLOAD = BIT(2), 77 }; 78 79 enum qlink_iface_type { 80 QLINK_IFTYPE_AP = 1, 81 QLINK_IFTYPE_STATION = 2, 82 QLINK_IFTYPE_ADHOC = 3, 83 QLINK_IFTYPE_MONITOR = 4, 84 QLINK_IFTYPE_WDS = 5, 85 QLINK_IFTYPE_AP_VLAN = 6, 86 }; 87 88 /** 89 * struct qlink_intf_info - information on virtual interface. 90 * 91 * Data describing a single virtual interface. 92 * 93 * @if_type: Mode of interface operation, one of &enum qlink_iface_type 94 * @vlanid: VLAN ID for AP_VLAN interface type 95 * @mac_addr: MAC address of virtual interface. 96 */ 97 struct qlink_intf_info { 98 __le16 if_type; 99 __le16 vlanid; 100 u8 mac_addr[ETH_ALEN]; 101 u8 rsvd[2]; 102 } __packed; 103 104 enum qlink_sta_flags { 105 QLINK_STA_FLAG_INVALID = 0, 106 QLINK_STA_FLAG_AUTHORIZED = BIT(0), 107 QLINK_STA_FLAG_SHORT_PREAMBLE = BIT(1), 108 QLINK_STA_FLAG_WME = BIT(2), 109 QLINK_STA_FLAG_MFP = BIT(3), 110 QLINK_STA_FLAG_AUTHENTICATED = BIT(4), 111 QLINK_STA_FLAG_TDLS_PEER = BIT(5), 112 QLINK_STA_FLAG_ASSOCIATED = BIT(6), 113 }; 114 115 enum qlink_channel_width { 116 QLINK_CHAN_WIDTH_5 = 0, 117 QLINK_CHAN_WIDTH_10, 118 QLINK_CHAN_WIDTH_20_NOHT, 119 QLINK_CHAN_WIDTH_20, 120 QLINK_CHAN_WIDTH_40, 121 QLINK_CHAN_WIDTH_80, 122 QLINK_CHAN_WIDTH_80P80, 123 QLINK_CHAN_WIDTH_160, 124 }; 125 126 /** 127 * struct qlink_channel - qlink control channel definition 128 * 129 * @hw_value: hardware-specific value for the channel 130 * @center_freq: center frequency in MHz 131 * @flags: channel flags from &enum qlink_channel_flags 132 * @band: band this channel belongs to 133 * @max_antenna_gain: maximum antenna gain in dBi 134 * @max_power: maximum transmission power (in dBm) 135 * @max_reg_power: maximum regulatory transmission power (in dBm) 136 * @dfs_state: current state of this channel. 137 * Only relevant if radar is required on this channel. 138 * @beacon_found: helper to regulatory code to indicate when a beacon 139 * has been found on this channel. Use regulatory_hint_found_beacon() 140 * to enable this, this is useful only on 5 GHz band. 141 */ 142 struct qlink_channel { 143 __le16 hw_value; 144 __le16 center_freq; 145 __le32 flags; 146 u8 band; 147 u8 max_antenna_gain; 148 u8 max_power; 149 u8 max_reg_power; 150 __le32 dfs_cac_ms; 151 u8 dfs_state; 152 u8 beacon_found; 153 u8 rsvd[2]; 154 } __packed; 155 156 /** 157 * struct qlink_chandef - qlink channel definition 158 * 159 * @chan: primary channel definition 160 * @center_freq1: center frequency of first segment 161 * @center_freq2: center frequency of second segment (80+80 only) 162 * @width: channel width, one of @enum qlink_channel_width 163 */ 164 struct qlink_chandef { 165 struct qlink_channel chan; 166 __le16 center_freq1; 167 __le16 center_freq2; 168 u8 width; 169 u8 rsvd; 170 } __packed; 171 172 #define QLINK_MAX_NR_CIPHER_SUITES 5 173 #define QLINK_MAX_NR_AKM_SUITES 2 174 175 struct qlink_auth_encr { 176 __le32 wpa_versions; 177 __le32 cipher_group; 178 __le32 n_ciphers_pairwise; 179 __le32 ciphers_pairwise[QLINK_MAX_NR_CIPHER_SUITES]; 180 __le32 n_akm_suites; 181 __le32 akm_suites[QLINK_MAX_NR_AKM_SUITES]; 182 __le16 control_port_ethertype; 183 u8 auth_type; 184 u8 privacy; 185 u8 control_port; 186 u8 control_port_no_encrypt; 187 u8 rsvd[2]; 188 } __packed; 189 190 /** 191 * struct qlink_sta_info_state - station flags mask/value 192 * 193 * @mask: STA flags mask, bitmap of &enum qlink_sta_flags 194 * @value: STA flags values, bitmap of &enum qlink_sta_flags 195 */ 196 struct qlink_sta_info_state { 197 __le32 mask; 198 __le32 value; 199 } __packed; 200 201 /* QLINK Command messages related definitions 202 */ 203 204 /** 205 * enum qlink_cmd_type - list of supported commands 206 * 207 * Commands are QLINK messages of type @QLINK_MSG_TYPE_CMD, sent by driver to 208 * wireless network device for processing. Device is expected to send back a 209 * reply message of type &QLINK_MSG_TYPE_CMDRSP, containing at least command 210 * execution status (one of &enum qlink_cmd_result). Reply message 211 * may also contain data payload specific to the command type. 212 * 213 * @QLINK_CMD_BAND_INFO_GET: for the specified MAC and specified band, get 214 * the band's description including number of operational channels and 215 * info on each channel, HT/VHT capabilities, supported rates etc. 216 * This command is generic to a specified MAC, interface index must be set 217 * to QLINK_VIFID_RSVD in command header. 218 * @QLINK_CMD_REG_NOTIFY: notify device about regulatory domain change. This 219 * command is supported only if device reports QLINK_HW_SUPPORTS_REG_UPDATE 220 * capability. 221 * @QLINK_CMD_START_CAC: start radar detection procedure on a specified channel. 222 */ 223 enum qlink_cmd_type { 224 QLINK_CMD_FW_INIT = 0x0001, 225 QLINK_CMD_FW_DEINIT = 0x0002, 226 QLINK_CMD_REGISTER_MGMT = 0x0003, 227 QLINK_CMD_SEND_MGMT_FRAME = 0x0004, 228 QLINK_CMD_MGMT_SET_APPIE = 0x0005, 229 QLINK_CMD_PHY_PARAMS_GET = 0x0011, 230 QLINK_CMD_PHY_PARAMS_SET = 0x0012, 231 QLINK_CMD_GET_HW_INFO = 0x0013, 232 QLINK_CMD_MAC_INFO = 0x0014, 233 QLINK_CMD_ADD_INTF = 0x0015, 234 QLINK_CMD_DEL_INTF = 0x0016, 235 QLINK_CMD_CHANGE_INTF = 0x0017, 236 QLINK_CMD_UPDOWN_INTF = 0x0018, 237 QLINK_CMD_REG_NOTIFY = 0x0019, 238 QLINK_CMD_BAND_INFO_GET = 0x001A, 239 QLINK_CMD_CHAN_SWITCH = 0x001B, 240 QLINK_CMD_CHAN_GET = 0x001C, 241 QLINK_CMD_START_CAC = 0x001D, 242 QLINK_CMD_START_AP = 0x0021, 243 QLINK_CMD_STOP_AP = 0x0022, 244 QLINK_CMD_SET_MAC_ACL = 0x0023, 245 QLINK_CMD_GET_STA_INFO = 0x0030, 246 QLINK_CMD_ADD_KEY = 0x0040, 247 QLINK_CMD_DEL_KEY = 0x0041, 248 QLINK_CMD_SET_DEFAULT_KEY = 0x0042, 249 QLINK_CMD_SET_DEFAULT_MGMT_KEY = 0x0043, 250 QLINK_CMD_CHANGE_STA = 0x0051, 251 QLINK_CMD_DEL_STA = 0x0052, 252 QLINK_CMD_SCAN = 0x0053, 253 QLINK_CMD_CHAN_STATS = 0x0054, 254 QLINK_CMD_CONNECT = 0x0060, 255 QLINK_CMD_DISCONNECT = 0x0061, 256 }; 257 258 /** 259 * struct qlink_cmd - QLINK command message header 260 * 261 * Header used for QLINK messages of QLINK_MSG_TYPE_CMD type. 262 * 263 * @mhdr: Common QLINK message header. 264 * @cmd_id: command id, one of &enum qlink_cmd_type. 265 * @seq_num: sequence number of command message, used for matching with 266 * response message. 267 * @macid: index of physical radio device the command is destined to or 268 * QLINK_MACID_RSVD if not applicable. 269 * @vifid: index of virtual wireless interface on specified @macid the command 270 * is destined to or QLINK_VIFID_RSVD if not applicable. 271 */ 272 struct qlink_cmd { 273 struct qlink_msg_header mhdr; 274 __le16 cmd_id; 275 __le16 seq_num; 276 u8 rsvd[2]; 277 u8 macid; 278 u8 vifid; 279 } __packed; 280 281 /** 282 * struct qlink_cmd_manage_intf - interface management command 283 * 284 * Data for interface management commands QLINK_CMD_ADD_INTF, QLINK_CMD_DEL_INTF 285 * and QLINK_CMD_CHANGE_INTF. 286 * 287 * @intf_info: interface description. 288 */ 289 struct qlink_cmd_manage_intf { 290 struct qlink_cmd chdr; 291 struct qlink_intf_info intf_info; 292 } __packed; 293 294 enum qlink_mgmt_frame_type { 295 QLINK_MGMT_FRAME_ASSOC_REQ = 0x00, 296 QLINK_MGMT_FRAME_ASSOC_RESP = 0x01, 297 QLINK_MGMT_FRAME_REASSOC_REQ = 0x02, 298 QLINK_MGMT_FRAME_REASSOC_RESP = 0x03, 299 QLINK_MGMT_FRAME_PROBE_REQ = 0x04, 300 QLINK_MGMT_FRAME_PROBE_RESP = 0x05, 301 QLINK_MGMT_FRAME_BEACON = 0x06, 302 QLINK_MGMT_FRAME_ATIM = 0x07, 303 QLINK_MGMT_FRAME_DISASSOC = 0x08, 304 QLINK_MGMT_FRAME_AUTH = 0x09, 305 QLINK_MGMT_FRAME_DEAUTH = 0x0A, 306 QLINK_MGMT_FRAME_ACTION = 0x0B, 307 308 QLINK_MGMT_FRAME_TYPE_COUNT 309 }; 310 311 /** 312 * struct qlink_cmd_mgmt_frame_register - data for QLINK_CMD_REGISTER_MGMT 313 * 314 * @frame_type: MGMT frame type the registration request describes, one of 315 * &enum qlink_mgmt_frame_type. 316 * @do_register: 0 - unregister, otherwise register for reception of specified 317 * MGMT frame type. 318 */ 319 struct qlink_cmd_mgmt_frame_register { 320 struct qlink_cmd chdr; 321 __le16 frame_type; 322 u8 do_register; 323 } __packed; 324 325 enum qlink_mgmt_frame_tx_flags { 326 QLINK_MGMT_FRAME_TX_FLAG_NONE = 0, 327 QLINK_MGMT_FRAME_TX_FLAG_OFFCHAN = BIT(0), 328 QLINK_MGMT_FRAME_TX_FLAG_NO_CCK = BIT(1), 329 QLINK_MGMT_FRAME_TX_FLAG_ACK_NOWAIT = BIT(2), 330 }; 331 332 /** 333 * struct qlink_cmd_mgmt_frame_tx - data for QLINK_CMD_SEND_MGMT_FRAME command 334 * 335 * @cookie: opaque request identifier. 336 * @freq: Frequency to use for frame transmission. 337 * @flags: Transmission flags, one of &enum qlink_mgmt_frame_tx_flags. 338 * @frame_data: frame to transmit. 339 */ 340 struct qlink_cmd_mgmt_frame_tx { 341 struct qlink_cmd chdr; 342 __le32 cookie; 343 __le16 freq; 344 __le16 flags; 345 u8 frame_data[0]; 346 } __packed; 347 348 /** 349 * struct qlink_cmd_get_sta_info - data for QLINK_CMD_GET_STA_INFO command 350 * 351 * @sta_addr: MAC address of the STA statistics is requested for. 352 */ 353 struct qlink_cmd_get_sta_info { 354 struct qlink_cmd chdr; 355 u8 sta_addr[ETH_ALEN]; 356 } __packed; 357 358 /** 359 * struct qlink_cmd_add_key - data for QLINK_CMD_ADD_KEY command. 360 * 361 * @key_index: index of the key being installed. 362 * @pairwise: whether to use pairwise key. 363 * @addr: MAC address of a STA key is being installed to. 364 * @cipher: cipher suite. 365 * @vlanid: VLAN ID for AP_VLAN interface type 366 * @key_data: key data itself. 367 */ 368 struct qlink_cmd_add_key { 369 struct qlink_cmd chdr; 370 u8 key_index; 371 u8 pairwise; 372 u8 addr[ETH_ALEN]; 373 __le32 cipher; 374 __le16 vlanid; 375 u8 key_data[0]; 376 } __packed; 377 378 /** 379 * struct qlink_cmd_del_key_req - data for QLINK_CMD_DEL_KEY command 380 * 381 * @key_index: index of the key being removed. 382 * @pairwise: whether to use pairwise key. 383 * @addr: MAC address of a STA for which a key is removed. 384 */ 385 struct qlink_cmd_del_key { 386 struct qlink_cmd chdr; 387 u8 key_index; 388 u8 pairwise; 389 u8 addr[ETH_ALEN]; 390 } __packed; 391 392 /** 393 * struct qlink_cmd_set_def_key - data for QLINK_CMD_SET_DEFAULT_KEY command 394 * 395 * @key_index: index of the key to be set as default one. 396 * @unicast: key is unicast. 397 * @multicast: key is multicast. 398 */ 399 struct qlink_cmd_set_def_key { 400 struct qlink_cmd chdr; 401 u8 key_index; 402 u8 unicast; 403 u8 multicast; 404 } __packed; 405 406 /** 407 * struct qlink_cmd_set_def_mgmt_key - data for QLINK_CMD_SET_DEFAULT_MGMT_KEY 408 * 409 * @key_index: index of the key to be set as default MGMT key. 410 */ 411 struct qlink_cmd_set_def_mgmt_key { 412 struct qlink_cmd chdr; 413 u8 key_index; 414 } __packed; 415 416 /** 417 * struct qlink_cmd_change_sta - data for QLINK_CMD_CHANGE_STA command 418 * 419 * @flag_update: STA flags to update 420 * @if_type: Mode of interface operation, one of &enum qlink_iface_type 421 * @vlanid: VLAN ID to assign to specific STA 422 * @sta_addr: address of the STA for which parameters are set. 423 */ 424 struct qlink_cmd_change_sta { 425 struct qlink_cmd chdr; 426 struct qlink_sta_info_state flag_update; 427 __le16 if_type; 428 __le16 vlanid; 429 u8 sta_addr[ETH_ALEN]; 430 } __packed; 431 432 /** 433 * struct qlink_cmd_del_sta - data for QLINK_CMD_DEL_STA command. 434 * 435 * See &struct station_del_parameters 436 */ 437 struct qlink_cmd_del_sta { 438 struct qlink_cmd chdr; 439 __le16 reason_code; 440 u8 subtype; 441 u8 sta_addr[ETH_ALEN]; 442 } __packed; 443 444 enum qlink_sta_connect_flags { 445 QLINK_STA_CONNECT_DISABLE_HT = BIT(0), 446 QLINK_STA_CONNECT_DISABLE_VHT = BIT(1), 447 QLINK_STA_CONNECT_USE_RRM = BIT(2), 448 }; 449 450 /** 451 * struct qlink_cmd_connect - data for QLINK_CMD_CONNECT command 452 * 453 * @bssid: BSSID of the BSS to connect to. 454 * @bssid_hint: recommended AP BSSID for initial connection to the BSS or 455 * 00:00:00:00:00:00 if not specified. 456 * @prev_bssid: previous BSSID, if specified (not 00:00:00:00:00:00) indicates 457 * a request to reassociate. 458 * @bg_scan_period: period of background scan. 459 * @flags: one of &enum qlink_sta_connect_flags. 460 * @ht_capa: HT Capabilities overrides. 461 * @ht_capa_mask: The bits of ht_capa which are to be used. 462 * @vht_capa: VHT Capability overrides 463 * @vht_capa_mask: The bits of vht_capa which are to be used. 464 * @aen: authentication information. 465 * @mfp: whether to use management frame protection. 466 * @payload: variable portion of connection request. 467 */ 468 struct qlink_cmd_connect { 469 struct qlink_cmd chdr; 470 u8 bssid[ETH_ALEN]; 471 u8 bssid_hint[ETH_ALEN]; 472 u8 prev_bssid[ETH_ALEN]; 473 __le16 bg_scan_period; 474 __le32 flags; 475 struct ieee80211_ht_cap ht_capa; 476 struct ieee80211_ht_cap ht_capa_mask; 477 struct ieee80211_vht_cap vht_capa; 478 struct ieee80211_vht_cap vht_capa_mask; 479 struct qlink_auth_encr aen; 480 u8 mfp; 481 u8 pbss; 482 u8 rsvd[2]; 483 u8 payload[0]; 484 } __packed; 485 486 /** 487 * struct qlink_cmd_disconnect - data for QLINK_CMD_DISCONNECT command 488 * 489 * @reason: code of the reason of disconnect, see &enum ieee80211_reasoncode. 490 */ 491 struct qlink_cmd_disconnect { 492 struct qlink_cmd chdr; 493 __le16 reason; 494 } __packed; 495 496 /** 497 * struct qlink_cmd_updown - data for QLINK_CMD_UPDOWN_INTF command 498 * 499 * @if_up: bring specified interface DOWN (if_up==0) or UP (otherwise). 500 * Interface is specified in common command header @chdr. 501 */ 502 struct qlink_cmd_updown { 503 struct qlink_cmd chdr; 504 u8 if_up; 505 } __packed; 506 507 /** 508 * enum qlink_band - a list of frequency bands 509 * 510 * @QLINK_BAND_2GHZ: 2.4GHz band 511 * @QLINK_BAND_5GHZ: 5GHz band 512 * @QLINK_BAND_60GHZ: 60GHz band 513 */ 514 enum qlink_band { 515 QLINK_BAND_2GHZ = BIT(0), 516 QLINK_BAND_5GHZ = BIT(1), 517 QLINK_BAND_60GHZ = BIT(2), 518 }; 519 520 /** 521 * struct qlink_cmd_band_info_get - data for QLINK_CMD_BAND_INFO_GET command 522 * 523 * @band: a PHY band for which information is queried, one of @enum qlink_band 524 */ 525 struct qlink_cmd_band_info_get { 526 struct qlink_cmd chdr; 527 u8 band; 528 } __packed; 529 530 /** 531 * struct qlink_cmd_get_chan_stats - data for QLINK_CMD_CHAN_STATS command 532 * 533 * @channel: channel number according to 802.11 17.3.8.3.2 and Annex J 534 */ 535 struct qlink_cmd_get_chan_stats { 536 struct qlink_cmd chdr; 537 __le16 channel; 538 } __packed; 539 540 /** 541 * enum qlink_reg_initiator - Indicates the initiator of a reg domain request 542 * 543 * See &enum nl80211_reg_initiator for more info. 544 */ 545 enum qlink_reg_initiator { 546 QLINK_REGDOM_SET_BY_CORE, 547 QLINK_REGDOM_SET_BY_USER, 548 QLINK_REGDOM_SET_BY_DRIVER, 549 QLINK_REGDOM_SET_BY_COUNTRY_IE, 550 }; 551 552 /** 553 * enum qlink_user_reg_hint_type - type of user regulatory hint 554 * 555 * See &enum nl80211_user_reg_hint_type for more info. 556 */ 557 enum qlink_user_reg_hint_type { 558 QLINK_USER_REG_HINT_USER = 0, 559 QLINK_USER_REG_HINT_CELL_BASE = 1, 560 QLINK_USER_REG_HINT_INDOOR = 2, 561 }; 562 563 /** 564 * struct qlink_cmd_reg_notify - data for QLINK_CMD_REG_NOTIFY command 565 * 566 * @alpha2: the ISO / IEC 3166 alpha2 country code. 567 * @initiator: which entity sent the request, one of &enum qlink_reg_initiator. 568 * @user_reg_hint_type: type of hint for QLINK_REGDOM_SET_BY_USER request, one 569 * of &enum qlink_user_reg_hint_type. 570 */ 571 struct qlink_cmd_reg_notify { 572 struct qlink_cmd chdr; 573 u8 alpha2[2]; 574 u8 initiator; 575 u8 user_reg_hint_type; 576 } __packed; 577 578 /** 579 * struct qlink_cmd_chan_switch - data for QLINK_CMD_CHAN_SWITCH command 580 * 581 * @channel: channel number according to 802.11 17.3.8.3.2 and Annex J 582 * @radar_required: whether radar detection is required on the new channel 583 * @block_tx: whether transmissions should be blocked while changing 584 * @beacon_count: number of beacons until switch 585 */ 586 struct qlink_cmd_chan_switch { 587 struct qlink_cmd chdr; 588 __le16 channel; 589 u8 radar_required; 590 u8 block_tx; 591 u8 beacon_count; 592 } __packed; 593 594 /** 595 * enum qlink_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID 596 * 597 * Refer to &enum nl80211_hidden_ssid 598 */ 599 enum qlink_hidden_ssid { 600 QLINK_HIDDEN_SSID_NOT_IN_USE, 601 QLINK_HIDDEN_SSID_ZERO_LEN, 602 QLINK_HIDDEN_SSID_ZERO_CONTENTS 603 }; 604 605 /** 606 * struct qlink_cmd_start_ap - data for QLINK_CMD_START_AP command 607 * 608 * @beacon_interval: beacon interval 609 * @inactivity_timeout: station's inactivity period in seconds 610 * @dtim_period: DTIM period 611 * @hidden_ssid: whether to hide the SSID, one of &enum qlink_hidden_ssid 612 * @smps_mode: SMPS mode 613 * @ht_required: stations must support HT 614 * @vht_required: stations must support VHT 615 * @aen: encryption info 616 * @info: variable configurations 617 */ 618 struct qlink_cmd_start_ap { 619 struct qlink_cmd chdr; 620 __le16 beacon_interval; 621 __le16 inactivity_timeout; 622 u8 dtim_period; 623 u8 hidden_ssid; 624 u8 smps_mode; 625 u8 p2p_ctwindow; 626 u8 p2p_opp_ps; 627 u8 pbss; 628 u8 ht_required; 629 u8 vht_required; 630 struct qlink_auth_encr aen; 631 u8 info[0]; 632 } __packed; 633 634 /** 635 * struct qlink_cmd_start_cac - data for QLINK_CMD_START_CAC command 636 * 637 * @chan: a channel to start a radar detection procedure on. 638 * @cac_time_ms: CAC time. 639 */ 640 struct qlink_cmd_start_cac { 641 struct qlink_cmd chdr; 642 struct qlink_chandef chan; 643 __le32 cac_time_ms; 644 } __packed; 645 646 enum qlink_acl_policy { 647 QLINK_ACL_POLICY_ACCEPT_UNLESS_LISTED, 648 QLINK_ACL_POLICY_DENY_UNLESS_LISTED, 649 }; 650 651 struct qlink_mac_address { 652 u8 addr[ETH_ALEN]; 653 } __packed; 654 655 /** 656 * struct qlink_acl_data - ACL data 657 * 658 * @policy: filter policy, one of &enum qlink_acl_policy. 659 * @num_entries: number of MAC addresses in array. 660 * @mac_address: MAC addresses array. 661 */ 662 struct qlink_acl_data { 663 __le32 policy; 664 __le32 num_entries; 665 struct qlink_mac_address mac_addrs[0]; 666 } __packed; 667 668 /* QLINK Command Responses messages related definitions 669 */ 670 671 enum qlink_cmd_result { 672 QLINK_CMD_RESULT_OK = 0, 673 QLINK_CMD_RESULT_INVALID, 674 QLINK_CMD_RESULT_ENOTSUPP, 675 QLINK_CMD_RESULT_ENOTFOUND, 676 QLINK_CMD_RESULT_EALREADY, 677 }; 678 679 /** 680 * struct qlink_resp - QLINK command response message header 681 * 682 * Header used for QLINK messages of QLINK_MSG_TYPE_CMDRSP type. 683 * 684 * @mhdr: see &struct qlink_msg_header. 685 * @cmd_id: command ID the response corresponds to, one of &enum qlink_cmd_type. 686 * @seq_num: sequence number of command message, used for matching with 687 * response message. 688 * @result: result of the command execution, one of &enum qlink_cmd_result. 689 * @macid: index of physical radio device the response is sent from or 690 * QLINK_MACID_RSVD if not applicable. 691 * @vifid: index of virtual wireless interface on specified @macid the response 692 * is sent from or QLINK_VIFID_RSVD if not applicable. 693 */ 694 struct qlink_resp { 695 struct qlink_msg_header mhdr; 696 __le16 cmd_id; 697 __le16 seq_num; 698 __le16 result; 699 u8 macid; 700 u8 vifid; 701 } __packed; 702 703 /** 704 * struct qlink_resp_get_mac_info - response for QLINK_CMD_MAC_INFO command 705 * 706 * Data describing specific physical device providing wireless MAC 707 * functionality. 708 * 709 * @dev_mac: MAC address of physical WMAC device (used for first BSS on 710 * specified WMAC). 711 * @num_tx_chain: Number of transmit chains used by WMAC. 712 * @num_rx_chain: Number of receive chains used by WMAC. 713 * @vht_cap_mod_mask: mask specifying which VHT capabilities can be altered. 714 * @ht_cap_mod_mask: mask specifying which HT capabilities can be altered. 715 * @bands_cap: wireless bands WMAC can operate in, bitmap of &enum qlink_band. 716 * @max_ap_assoc_sta: Maximum number of associations supported by WMAC. 717 * @radar_detect_widths: bitmask of channels BW for which WMAC can detect radar. 718 * @var_info: variable-length WMAC info data. 719 */ 720 struct qlink_resp_get_mac_info { 721 struct qlink_resp rhdr; 722 u8 dev_mac[ETH_ALEN]; 723 u8 num_tx_chain; 724 u8 num_rx_chain; 725 struct ieee80211_vht_cap vht_cap_mod_mask; 726 struct ieee80211_ht_cap ht_cap_mod_mask; 727 __le16 max_ap_assoc_sta; 728 __le16 radar_detect_widths; 729 __le32 max_acl_mac_addrs; 730 u8 bands_cap; 731 u8 rsvd[1]; 732 u8 var_info[0]; 733 } __packed; 734 735 /** 736 * enum qlink_dfs_regions - regulatory DFS regions 737 * 738 * Corresponds to &enum nl80211_dfs_regions. 739 */ 740 enum qlink_dfs_regions { 741 QLINK_DFS_UNSET = 0, 742 QLINK_DFS_FCC = 1, 743 QLINK_DFS_ETSI = 2, 744 QLINK_DFS_JP = 3, 745 }; 746 747 /** 748 * struct qlink_resp_get_hw_info - response for QLINK_CMD_GET_HW_INFO command 749 * 750 * Description of wireless hardware capabilities and features. 751 * 752 * @fw_ver: wireless hardware firmware version. 753 * @hw_capab: Bitmap of capabilities supported by firmware. 754 * @ql_proto_ver: Version of QLINK protocol used by firmware. 755 * @num_mac: Number of separate physical radio devices provided by hardware. 756 * @mac_bitmap: Bitmap of MAC IDs that are active and can be used in firmware. 757 * @total_tx_chains: total number of transmit chains used by device. 758 * @total_rx_chains: total number of receive chains. 759 * @alpha2: country code ID firmware is configured to. 760 * @n_reg_rules: number of regulatory rules TLVs in variable portion of the 761 * message. 762 * @dfs_region: regulatory DFS region, one of @enum qlink_dfs_region. 763 * @info: variable-length HW info, can contain QTN_TLV_ID_REG_RULE. 764 */ 765 struct qlink_resp_get_hw_info { 766 struct qlink_resp rhdr; 767 __le32 fw_ver; 768 __le32 hw_capab; 769 __le32 bld_tmstamp; 770 __le32 plat_id; 771 __le32 hw_ver; 772 __le16 ql_proto_ver; 773 u8 num_mac; 774 u8 mac_bitmap; 775 u8 total_tx_chain; 776 u8 total_rx_chain; 777 u8 alpha2[2]; 778 u8 n_reg_rules; 779 u8 dfs_region; 780 u8 info[0]; 781 } __packed; 782 783 /** 784 * struct qlink_resp_manage_intf - response for interface management commands 785 * 786 * Response data for QLINK_CMD_ADD_INTF and QLINK_CMD_CHANGE_INTF commands. 787 * 788 * @rhdr: Common Command Response message header. 789 * @intf_info: interface description. 790 */ 791 struct qlink_resp_manage_intf { 792 struct qlink_resp rhdr; 793 struct qlink_intf_info intf_info; 794 } __packed; 795 796 enum qlink_sta_info_rate_flags { 797 QLINK_STA_INFO_RATE_FLAG_HT_MCS = BIT(0), 798 QLINK_STA_INFO_RATE_FLAG_VHT_MCS = BIT(1), 799 QLINK_STA_INFO_RATE_FLAG_SHORT_GI = BIT(2), 800 QLINK_STA_INFO_RATE_FLAG_60G = BIT(3), 801 }; 802 803 /** 804 * struct qlink_resp_get_sta_info - response for QLINK_CMD_GET_STA_INFO command 805 * 806 * Response data containing statistics for specified STA. 807 * 808 * @filled: a bitmask of &enum qlink_sta_info, specifies which info in response 809 * is valid. 810 * @sta_addr: MAC address of STA the response carries statistic for. 811 * @info: variable statistics for specified STA. 812 */ 813 struct qlink_resp_get_sta_info { 814 struct qlink_resp rhdr; 815 u8 sta_addr[ETH_ALEN]; 816 u8 rsvd[2]; 817 u8 info[0]; 818 } __packed; 819 820 /** 821 * struct qlink_resp_band_info_get - response for QLINK_CMD_BAND_INFO_GET cmd 822 * 823 * @band: frequency band that the response describes, one of @enum qlink_band. 824 * @num_chans: total number of channels info TLVs contained in reply. 825 * @num_bitrates: total number of bitrate TLVs contained in reply. 826 * @info: variable-length info portion. 827 */ 828 struct qlink_resp_band_info_get { 829 struct qlink_resp rhdr; 830 u8 band; 831 u8 num_chans; 832 u8 num_bitrates; 833 u8 rsvd[1]; 834 u8 info[0]; 835 } __packed; 836 837 /** 838 * struct qlink_resp_phy_params - response for QLINK_CMD_PHY_PARAMS_GET command 839 * 840 * @info: variable-length array of PHY params. 841 */ 842 struct qlink_resp_phy_params { 843 struct qlink_resp rhdr; 844 u8 info[0]; 845 } __packed; 846 847 /** 848 * struct qlink_resp_get_chan_stats - response for QLINK_CMD_CHAN_STATS cmd 849 * 850 * @info: variable-length channel info. 851 */ 852 struct qlink_resp_get_chan_stats { 853 struct qlink_cmd rhdr; 854 u8 info[0]; 855 } __packed; 856 857 /** 858 * struct qlink_resp_channel_get - response for QLINK_CMD_CHAN_GET command 859 * 860 * @chan: definition of current operating channel. 861 */ 862 struct qlink_resp_channel_get { 863 struct qlink_resp rhdr; 864 struct qlink_chandef chan; 865 } __packed; 866 867 /* QLINK Events messages related definitions 868 */ 869 870 enum qlink_event_type { 871 QLINK_EVENT_STA_ASSOCIATED = 0x0021, 872 QLINK_EVENT_STA_DEAUTH = 0x0022, 873 QLINK_EVENT_MGMT_RECEIVED = 0x0023, 874 QLINK_EVENT_SCAN_RESULTS = 0x0024, 875 QLINK_EVENT_SCAN_COMPLETE = 0x0025, 876 QLINK_EVENT_BSS_JOIN = 0x0026, 877 QLINK_EVENT_BSS_LEAVE = 0x0027, 878 QLINK_EVENT_FREQ_CHANGE = 0x0028, 879 QLINK_EVENT_RADAR = 0x0029, 880 }; 881 882 /** 883 * struct qlink_event - QLINK event message header 884 * 885 * Header used for QLINK messages of QLINK_MSG_TYPE_EVENT type. 886 * 887 * @mhdr: Common QLINK message header. 888 * @event_id: Specifies specific event ID, one of &enum qlink_event_type. 889 * @macid: index of physical radio device the event was generated on or 890 * QLINK_MACID_RSVD if not applicable. 891 * @vifid: index of virtual wireless interface on specified @macid the event 892 * was generated on or QLINK_VIFID_RSVD if not applicable. 893 */ 894 struct qlink_event { 895 struct qlink_msg_header mhdr; 896 __le16 event_id; 897 u8 macid; 898 u8 vifid; 899 } __packed; 900 901 /** 902 * struct qlink_event_sta_assoc - data for QLINK_EVENT_STA_ASSOCIATED event 903 * 904 * @sta_addr: Address of a STA for which new association event was generated 905 * @frame_control: control bits from 802.11 ASSOC_REQUEST header. 906 * @payload: IEs from association request. 907 */ 908 struct qlink_event_sta_assoc { 909 struct qlink_event ehdr; 910 u8 sta_addr[ETH_ALEN]; 911 __le16 frame_control; 912 u8 ies[0]; 913 } __packed; 914 915 /** 916 * struct qlink_event_sta_deauth - data for QLINK_EVENT_STA_DEAUTH event 917 * 918 * @sta_addr: Address of a deauthenticated STA. 919 * @reason: reason for deauthentication. 920 */ 921 struct qlink_event_sta_deauth { 922 struct qlink_event ehdr; 923 u8 sta_addr[ETH_ALEN]; 924 __le16 reason; 925 } __packed; 926 927 /** 928 * struct qlink_event_bss_join - data for QLINK_EVENT_BSS_JOIN event 929 * 930 * @bssid: BSSID of a BSS which interface tried to joined. 931 * @status: status of joining attempt, see &enum ieee80211_statuscode. 932 */ 933 struct qlink_event_bss_join { 934 struct qlink_event ehdr; 935 u8 bssid[ETH_ALEN]; 936 __le16 status; 937 } __packed; 938 939 /** 940 * struct qlink_event_bss_leave - data for QLINK_EVENT_BSS_LEAVE event 941 * 942 * @reason: reason of disconnecting from BSS. 943 */ 944 struct qlink_event_bss_leave { 945 struct qlink_event ehdr; 946 __le16 reason; 947 } __packed; 948 949 /** 950 * struct qlink_event_freq_change - data for QLINK_EVENT_FREQ_CHANGE event 951 * 952 * @chan: new operating channel definition 953 */ 954 struct qlink_event_freq_change { 955 struct qlink_event ehdr; 956 struct qlink_chandef chan; 957 } __packed; 958 959 enum qlink_rxmgmt_flags { 960 QLINK_RXMGMT_FLAG_ANSWERED = 1 << 0, 961 }; 962 963 /** 964 * struct qlink_event_rxmgmt - data for QLINK_EVENT_MGMT_RECEIVED event 965 * 966 * @freq: Frequency on which the frame was received in MHz. 967 * @flags: bitmap of &enum qlink_rxmgmt_flags. 968 * @sig_dbm: signal strength in dBm. 969 * @frame_data: data of Rx'd frame itself. 970 */ 971 struct qlink_event_rxmgmt { 972 struct qlink_event ehdr; 973 __le32 freq; 974 __le32 flags; 975 s8 sig_dbm; 976 u8 rsvd[3]; 977 u8 frame_data[0]; 978 } __packed; 979 980 /** 981 * struct qlink_event_scan_result - data for QLINK_EVENT_SCAN_RESULTS event 982 * 983 * @tsf: TSF timestamp indicating when scan results were generated. 984 * @freq: Center frequency of the channel where BSS for which the scan result 985 * event was generated was discovered. 986 * @capab: capabilities field. 987 * @bintval: beacon interval announced by discovered BSS. 988 * @sig_dbm: signal strength in dBm. 989 * @bssid: BSSID announced by discovered BSS. 990 * @ssid_len: length of SSID announced by BSS. 991 * @ssid: SSID announced by discovered BSS. 992 * @payload: IEs that are announced by discovered BSS in its MGMt frames. 993 */ 994 struct qlink_event_scan_result { 995 struct qlink_event ehdr; 996 __le64 tsf; 997 __le16 freq; 998 __le16 capab; 999 __le16 bintval; 1000 s8 sig_dbm; 1001 u8 ssid_len; 1002 u8 ssid[IEEE80211_MAX_SSID_LEN]; 1003 u8 bssid[ETH_ALEN]; 1004 u8 rsvd[2]; 1005 u8 payload[0]; 1006 } __packed; 1007 1008 /** 1009 * enum qlink_scan_complete_flags - indicates result of scan request. 1010 * 1011 * @QLINK_SCAN_NONE: Scan request was processed. 1012 * @QLINK_SCAN_ABORTED: Scan was aborted. 1013 */ 1014 enum qlink_scan_complete_flags { 1015 QLINK_SCAN_NONE = 0, 1016 QLINK_SCAN_ABORTED = BIT(0), 1017 }; 1018 1019 /** 1020 * struct qlink_event_scan_complete - data for QLINK_EVENT_SCAN_COMPLETE event 1021 * 1022 * @flags: flags indicating the status of pending scan request, 1023 * see &enum qlink_scan_complete_flags. 1024 */ 1025 struct qlink_event_scan_complete { 1026 struct qlink_event ehdr; 1027 __le32 flags; 1028 } __packed; 1029 1030 enum qlink_radar_event { 1031 QLINK_RADAR_DETECTED, 1032 QLINK_RADAR_CAC_FINISHED, 1033 QLINK_RADAR_CAC_ABORTED, 1034 QLINK_RADAR_NOP_FINISHED, 1035 QLINK_RADAR_PRE_CAC_EXPIRED, 1036 QLINK_RADAR_CAC_STARTED, 1037 }; 1038 1039 /** 1040 * struct qlink_event_radar - data for QLINK_EVENT_RADAR event 1041 * 1042 * @chan: channel on which radar event happened. 1043 * @event: radar event type, one of &enum qlink_radar_event. 1044 */ 1045 struct qlink_event_radar { 1046 struct qlink_event ehdr; 1047 struct qlink_chandef chan; 1048 u8 event; 1049 u8 rsvd[3]; 1050 } __packed; 1051 1052 /* QLINK TLVs (Type-Length Values) definitions 1053 */ 1054 1055 /** 1056 * enum qlink_tlv_id - list of TLVs that Qlink messages can carry 1057 * 1058 * @QTN_TLV_ID_STA_STATS_MAP: a bitmap of &enum qlink_sta_info, used to 1059 * indicate which statistic carried in QTN_TLV_ID_STA_STATS is valid. 1060 * @QTN_TLV_ID_STA_STATS: per-STA statistics as defined by 1061 * &struct qlink_sta_stats. Valid values are marked as such in a bitmap 1062 * carried by QTN_TLV_ID_STA_STATS_MAP. 1063 */ 1064 enum qlink_tlv_id { 1065 QTN_TLV_ID_FRAG_THRESH = 0x0201, 1066 QTN_TLV_ID_RTS_THRESH = 0x0202, 1067 QTN_TLV_ID_SRETRY_LIMIT = 0x0203, 1068 QTN_TLV_ID_LRETRY_LIMIT = 0x0204, 1069 QTN_TLV_ID_REG_RULE = 0x0207, 1070 QTN_TLV_ID_CHANNEL = 0x020F, 1071 QTN_TLV_ID_CHANDEF = 0x0210, 1072 QTN_TLV_ID_STA_STATS_MAP = 0x0211, 1073 QTN_TLV_ID_STA_STATS = 0x0212, 1074 QTN_TLV_ID_COVERAGE_CLASS = 0x0213, 1075 QTN_TLV_ID_IFACE_LIMIT = 0x0214, 1076 QTN_TLV_ID_NUM_IFACE_COMB = 0x0215, 1077 QTN_TLV_ID_CHANNEL_STATS = 0x0216, 1078 QTN_TLV_ID_KEY = 0x0302, 1079 QTN_TLV_ID_SEQ = 0x0303, 1080 QTN_TLV_ID_IE_SET = 0x0305, 1081 QTN_TLV_ID_EXT_CAPABILITY_MASK = 0x0306, 1082 QTN_TLV_ID_ACL_DATA = 0x0307, 1083 QTN_TLV_ID_BUILD_NAME = 0x0401, 1084 QTN_TLV_ID_BUILD_REV = 0x0402, 1085 QTN_TLV_ID_BUILD_TYPE = 0x0403, 1086 QTN_TLV_ID_BUILD_LABEL = 0x0404, 1087 QTN_TLV_ID_HW_ID = 0x0405, 1088 QTN_TLV_ID_CALIBRATION_VER = 0x0406, 1089 QTN_TLV_ID_UBOOT_VER = 0x0407, 1090 }; 1091 1092 struct qlink_tlv_hdr { 1093 __le16 type; 1094 __le16 len; 1095 u8 val[0]; 1096 } __packed; 1097 1098 struct qlink_iface_comb_num { 1099 __le32 iface_comb_num; 1100 } __packed; 1101 1102 struct qlink_iface_limit { 1103 __le16 max_num; 1104 __le16 type; 1105 } __packed; 1106 1107 struct qlink_iface_limit_record { 1108 __le16 max_interfaces; 1109 u8 num_different_channels; 1110 u8 n_limits; 1111 struct qlink_iface_limit limits[0]; 1112 } __packed; 1113 1114 #define QLINK_RSSI_OFFSET 120 1115 1116 struct qlink_tlv_frag_rts_thr { 1117 struct qlink_tlv_hdr hdr; 1118 __le16 thr; 1119 } __packed; 1120 1121 struct qlink_tlv_rlimit { 1122 struct qlink_tlv_hdr hdr; 1123 u8 rlimit; 1124 } __packed; 1125 1126 struct qlink_tlv_cclass { 1127 struct qlink_tlv_hdr hdr; 1128 u8 cclass; 1129 } __packed; 1130 1131 /** 1132 * enum qlink_reg_rule_flags - regulatory rule flags 1133 * 1134 * See description of &enum nl80211_reg_rule_flags 1135 */ 1136 enum qlink_reg_rule_flags { 1137 QLINK_RRF_NO_OFDM = BIT(0), 1138 QLINK_RRF_NO_CCK = BIT(1), 1139 QLINK_RRF_NO_INDOOR = BIT(2), 1140 QLINK_RRF_NO_OUTDOOR = BIT(3), 1141 QLINK_RRF_DFS = BIT(4), 1142 QLINK_RRF_PTP_ONLY = BIT(5), 1143 QLINK_RRF_PTMP_ONLY = BIT(6), 1144 QLINK_RRF_NO_IR = BIT(7), 1145 QLINK_RRF_AUTO_BW = BIT(8), 1146 QLINK_RRF_IR_CONCURRENT = BIT(9), 1147 QLINK_RRF_NO_HT40MINUS = BIT(10), 1148 QLINK_RRF_NO_HT40PLUS = BIT(11), 1149 QLINK_RRF_NO_80MHZ = BIT(12), 1150 QLINK_RRF_NO_160MHZ = BIT(13), 1151 }; 1152 1153 /** 1154 * struct qlink_tlv_reg_rule - data for QTN_TLV_ID_REG_RULE TLV 1155 * 1156 * Regulatory rule description. 1157 * 1158 * @start_freq_khz: start frequency of the range the rule is attributed to. 1159 * @end_freq_khz: end frequency of the range the rule is attributed to. 1160 * @max_bandwidth_khz: max bandwidth that channels in specified range can be 1161 * configured to. 1162 * @max_antenna_gain: max antenna gain that can be used in the specified 1163 * frequency range, dBi. 1164 * @max_eirp: maximum EIRP. 1165 * @flags: regulatory rule flags in &enum qlink_reg_rule_flags. 1166 * @dfs_cac_ms: DFS CAC period. 1167 */ 1168 struct qlink_tlv_reg_rule { 1169 struct qlink_tlv_hdr hdr; 1170 __le32 start_freq_khz; 1171 __le32 end_freq_khz; 1172 __le32 max_bandwidth_khz; 1173 __le32 max_antenna_gain; 1174 __le32 max_eirp; 1175 __le32 flags; 1176 __le32 dfs_cac_ms; 1177 } __packed; 1178 1179 enum qlink_channel_flags { 1180 QLINK_CHAN_DISABLED = BIT(0), 1181 QLINK_CHAN_NO_IR = BIT(1), 1182 QLINK_CHAN_RADAR = BIT(3), 1183 QLINK_CHAN_NO_HT40PLUS = BIT(4), 1184 QLINK_CHAN_NO_HT40MINUS = BIT(5), 1185 QLINK_CHAN_NO_OFDM = BIT(6), 1186 QLINK_CHAN_NO_80MHZ = BIT(7), 1187 QLINK_CHAN_NO_160MHZ = BIT(8), 1188 QLINK_CHAN_INDOOR_ONLY = BIT(9), 1189 QLINK_CHAN_IR_CONCURRENT = BIT(10), 1190 QLINK_CHAN_NO_20MHZ = BIT(11), 1191 QLINK_CHAN_NO_10MHZ = BIT(12), 1192 }; 1193 1194 enum qlink_dfs_state { 1195 QLINK_DFS_USABLE, 1196 QLINK_DFS_UNAVAILABLE, 1197 QLINK_DFS_AVAILABLE, 1198 }; 1199 1200 /** 1201 * struct qlink_tlv_channel - data for QTN_TLV_ID_CHANNEL TLV 1202 * 1203 * Channel settings. 1204 * 1205 * @channel: ieee80211 channel settings. 1206 */ 1207 struct qlink_tlv_channel { 1208 struct qlink_tlv_hdr hdr; 1209 struct qlink_channel chan; 1210 } __packed; 1211 1212 /** 1213 * struct qlink_tlv_chandef - data for QTN_TLV_ID_CHANDEF TLV 1214 * 1215 * Channel definition. 1216 * 1217 * @chan: channel definition data. 1218 */ 1219 struct qlink_tlv_chandef { 1220 struct qlink_tlv_hdr hdr; 1221 struct qlink_chandef chdef; 1222 } __packed; 1223 1224 enum qlink_ie_set_type { 1225 QLINK_IE_SET_UNKNOWN, 1226 QLINK_IE_SET_ASSOC_REQ, 1227 QLINK_IE_SET_ASSOC_RESP, 1228 QLINK_IE_SET_PROBE_REQ, 1229 QLINK_IE_SET_SCAN, 1230 QLINK_IE_SET_BEACON_HEAD, 1231 QLINK_IE_SET_BEACON_TAIL, 1232 QLINK_IE_SET_BEACON_IES, 1233 QLINK_IE_SET_PROBE_RESP, 1234 QLINK_IE_SET_PROBE_RESP_IES, 1235 }; 1236 1237 /** 1238 * struct qlink_tlv_ie_set - data for QTN_TLV_ID_IE_SET 1239 * 1240 * @type: type of MGMT frame IEs belong to, one of &enum qlink_ie_set_type. 1241 * @flags: for future use. 1242 * @ie_data: IEs data. 1243 */ 1244 struct qlink_tlv_ie_set { 1245 struct qlink_tlv_hdr hdr; 1246 u8 type; 1247 u8 flags; 1248 u8 ie_data[0]; 1249 } __packed; 1250 1251 struct qlink_chan_stats { 1252 __le32 chan_num; 1253 __le32 cca_tx; 1254 __le32 cca_rx; 1255 __le32 cca_busy; 1256 __le32 cca_try; 1257 s8 chan_noise; 1258 } __packed; 1259 1260 /** 1261 * enum qlink_sta_info - station information bitmap 1262 * 1263 * Used to indicate which statistics values in &struct qlink_sta_stats 1264 * are valid. Individual values are used to fill a bitmap carried in a 1265 * payload of QTN_TLV_ID_STA_STATS_MAP. 1266 * 1267 * @QLINK_STA_INFO_CONNECTED_TIME: connected_time value is valid. 1268 * @QLINK_STA_INFO_INACTIVE_TIME: inactive_time value is valid. 1269 * @QLINK_STA_INFO_RX_BYTES: lower 32 bits of rx_bytes value are valid. 1270 * @QLINK_STA_INFO_TX_BYTES: lower 32 bits of tx_bytes value are valid. 1271 * @QLINK_STA_INFO_RX_BYTES64: rx_bytes value is valid. 1272 * @QLINK_STA_INFO_TX_BYTES64: tx_bytes value is valid. 1273 * @QLINK_STA_INFO_RX_DROP_MISC: rx_dropped_misc value is valid. 1274 * @QLINK_STA_INFO_BEACON_RX: rx_beacon value is valid. 1275 * @QLINK_STA_INFO_SIGNAL: signal value is valid. 1276 * @QLINK_STA_INFO_SIGNAL_AVG: signal_avg value is valid. 1277 * @QLINK_STA_INFO_RX_BITRATE: rxrate value is valid. 1278 * @QLINK_STA_INFO_TX_BITRATE: txrate value is valid. 1279 * @QLINK_STA_INFO_RX_PACKETS: rx_packets value is valid. 1280 * @QLINK_STA_INFO_TX_PACKETS: tx_packets value is valid. 1281 * @QLINK_STA_INFO_TX_RETRIES: tx_retries value is valid. 1282 * @QLINK_STA_INFO_TX_FAILED: tx_failed value is valid. 1283 * @QLINK_STA_INFO_STA_FLAGS: sta_flags value is valid. 1284 */ 1285 enum qlink_sta_info { 1286 QLINK_STA_INFO_CONNECTED_TIME, 1287 QLINK_STA_INFO_INACTIVE_TIME, 1288 QLINK_STA_INFO_RX_BYTES, 1289 QLINK_STA_INFO_TX_BYTES, 1290 QLINK_STA_INFO_RX_BYTES64, 1291 QLINK_STA_INFO_TX_BYTES64, 1292 QLINK_STA_INFO_RX_DROP_MISC, 1293 QLINK_STA_INFO_BEACON_RX, 1294 QLINK_STA_INFO_SIGNAL, 1295 QLINK_STA_INFO_SIGNAL_AVG, 1296 QLINK_STA_INFO_RX_BITRATE, 1297 QLINK_STA_INFO_TX_BITRATE, 1298 QLINK_STA_INFO_RX_PACKETS, 1299 QLINK_STA_INFO_TX_PACKETS, 1300 QLINK_STA_INFO_TX_RETRIES, 1301 QLINK_STA_INFO_TX_FAILED, 1302 QLINK_STA_INFO_STA_FLAGS, 1303 QLINK_STA_INFO_NUM, 1304 }; 1305 1306 /** 1307 * struct qlink_sta_info_rate - STA rate statistics 1308 * 1309 * @rate: data rate in Mbps. 1310 * @flags: bitmap of &enum qlink_sta_info_rate_flags. 1311 * @mcs: 802.11-defined MCS index. 1312 * nss: Number of Spatial Streams. 1313 * @bw: bandwidth, one of &enum qlink_channel_width. 1314 */ 1315 struct qlink_sta_info_rate { 1316 __le16 rate; 1317 u8 flags; 1318 u8 mcs; 1319 u8 nss; 1320 u8 bw; 1321 } __packed; 1322 1323 /** 1324 * struct qlink_sta_stats - data for QTN_TLV_ID_STA_STATS 1325 * 1326 * Carries statistics of a STA. Not all fields may be filled with 1327 * valid values. Valid fields should be indicated as such using a bitmap of 1328 * &enum qlink_sta_info. Bitmap is carried separately in a payload of 1329 * QTN_TLV_ID_STA_STATS_MAP. 1330 */ 1331 struct qlink_sta_stats { 1332 __le64 rx_bytes; 1333 __le64 tx_bytes; 1334 __le64 rx_beacon; 1335 __le64 rx_duration; 1336 __le64 t_offset; 1337 __le32 connected_time; 1338 __le32 inactive_time; 1339 __le32 rx_packets; 1340 __le32 tx_packets; 1341 __le32 tx_retries; 1342 __le32 tx_failed; 1343 __le32 rx_dropped_misc; 1344 __le32 beacon_loss_count; 1345 __le32 expected_throughput; 1346 struct qlink_sta_info_state sta_flags; 1347 struct qlink_sta_info_rate txrate; 1348 struct qlink_sta_info_rate rxrate; 1349 __le16 llid; 1350 __le16 plid; 1351 u8 local_pm; 1352 u8 peer_pm; 1353 u8 nonpeer_pm; 1354 u8 rx_beacon_signal_avg; 1355 u8 plink_state; 1356 u8 signal; 1357 u8 signal_avg; 1358 u8 rsvd[1]; 1359 }; 1360 1361 #endif /* _QTN_QLINK_H_ */ 1362