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