qlink.h 39 KB

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