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