qlink.h 36 KB

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