qlink.h 51 KB

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