qlink.h 36 KB

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