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