htt.h 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465
  1. /* SPDX-License-Identifier: ISC */
  2. /*
  3. * Copyright (c) 2005-2011 Atheros Communications Inc.
  4. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
  5. * Copyright (c) 2018, The Linux Foundation. All rights reserved.
  6. * Copyright (c) 2021, 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  7. */
  8. #ifndef _HTT_H_
  9. #define _HTT_H_
  10. #include <linux/bug.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/dmapool.h>
  13. #include <linux/hashtable.h>
  14. #include <linux/kfifo.h>
  15. #include <net/mac80211.h>
  16. #include "htc.h"
  17. #include "hw.h"
  18. #include "rx_desc.h"
  19. enum htt_dbg_stats_type {
  20. HTT_DBG_STATS_WAL_PDEV_TXRX = 1 << 0,
  21. HTT_DBG_STATS_RX_REORDER = 1 << 1,
  22. HTT_DBG_STATS_RX_RATE_INFO = 1 << 2,
  23. HTT_DBG_STATS_TX_PPDU_LOG = 1 << 3,
  24. HTT_DBG_STATS_TX_RATE_INFO = 1 << 4,
  25. /* bits 5-23 currently reserved */
  26. HTT_DBG_NUM_STATS /* keep this last */
  27. };
  28. enum htt_h2t_msg_type { /* host-to-target */
  29. HTT_H2T_MSG_TYPE_VERSION_REQ = 0,
  30. HTT_H2T_MSG_TYPE_TX_FRM = 1,
  31. HTT_H2T_MSG_TYPE_RX_RING_CFG = 2,
  32. HTT_H2T_MSG_TYPE_STATS_REQ = 3,
  33. HTT_H2T_MSG_TYPE_SYNC = 4,
  34. HTT_H2T_MSG_TYPE_AGGR_CFG = 5,
  35. HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG = 6,
  36. /* This command is used for sending management frames in HTT < 3.0.
  37. * HTT >= 3.0 uses TX_FRM for everything.
  38. */
  39. HTT_H2T_MSG_TYPE_MGMT_TX = 7,
  40. HTT_H2T_MSG_TYPE_TX_FETCH_RESP = 11,
  41. HTT_H2T_NUM_MSGS /* keep this last */
  42. };
  43. struct htt_cmd_hdr {
  44. u8 msg_type;
  45. } __packed;
  46. struct htt_ver_req {
  47. u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)];
  48. } __packed;
  49. /*
  50. * HTT tx MSDU descriptor
  51. *
  52. * The HTT tx MSDU descriptor is created by the host HTT SW for each
  53. * tx MSDU. The HTT tx MSDU descriptor contains the information that
  54. * the target firmware needs for the FW's tx processing, particularly
  55. * for creating the HW msdu descriptor.
  56. * The same HTT tx descriptor is used for HL and LL systems, though
  57. * a few fields within the tx descriptor are used only by LL or
  58. * only by HL.
  59. * The HTT tx descriptor is defined in two manners: by a struct with
  60. * bitfields, and by a series of [dword offset, bit mask, bit shift]
  61. * definitions.
  62. * The target should use the struct def, for simplicity and clarity,
  63. * but the host shall use the bit-mast + bit-shift defs, to be endian-
  64. * neutral. Specifically, the host shall use the get/set macros built
  65. * around the mask + shift defs.
  66. */
  67. struct htt_data_tx_desc_frag {
  68. union {
  69. struct double_word_addr {
  70. __le32 paddr;
  71. __le32 len;
  72. } __packed dword_addr;
  73. struct triple_word_addr {
  74. __le32 paddr_lo;
  75. __le16 paddr_hi;
  76. __le16 len_16;
  77. } __packed tword_addr;
  78. } __packed;
  79. } __packed;
  80. struct htt_msdu_ext_desc {
  81. __le32 tso_flag[3];
  82. __le16 ip_identification;
  83. u8 flags;
  84. u8 reserved;
  85. struct htt_data_tx_desc_frag frags[6];
  86. };
  87. struct htt_msdu_ext_desc_64 {
  88. __le32 tso_flag[5];
  89. __le16 ip_identification;
  90. u8 flags;
  91. u8 reserved;
  92. struct htt_data_tx_desc_frag frags[6];
  93. };
  94. #define HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE BIT(0)
  95. #define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE BIT(1)
  96. #define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE BIT(2)
  97. #define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE BIT(3)
  98. #define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE BIT(4)
  99. #define HTT_MSDU_CHECKSUM_ENABLE (HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE \
  100. | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE \
  101. | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE \
  102. | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE \
  103. | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE)
  104. #define HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE_64 BIT(16)
  105. #define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE_64 BIT(17)
  106. #define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE_64 BIT(18)
  107. #define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE_64 BIT(19)
  108. #define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE_64 BIT(20)
  109. #define HTT_MSDU_EXT_DESC_FLAG_PARTIAL_CSUM_ENABLE_64 BIT(21)
  110. #define HTT_MSDU_CHECKSUM_ENABLE_64 (HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE_64 \
  111. | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE_64 \
  112. | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE_64 \
  113. | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE_64 \
  114. | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE_64)
  115. enum htt_data_tx_desc_flags0 {
  116. HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT = 1 << 0,
  117. HTT_DATA_TX_DESC_FLAGS0_NO_AGGR = 1 << 1,
  118. HTT_DATA_TX_DESC_FLAGS0_NO_ENCRYPT = 1 << 2,
  119. HTT_DATA_TX_DESC_FLAGS0_NO_CLASSIFY = 1 << 3,
  120. HTT_DATA_TX_DESC_FLAGS0_RSVD0 = 1 << 4
  121. #define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_MASK 0xE0
  122. #define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_LSB 5
  123. };
  124. enum htt_data_tx_desc_flags1 {
  125. #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_BITS 6
  126. #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_MASK 0x003F
  127. #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_LSB 0
  128. #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_BITS 5
  129. #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_MASK 0x07C0
  130. #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_LSB 6
  131. HTT_DATA_TX_DESC_FLAGS1_POSTPONED = 1 << 11,
  132. HTT_DATA_TX_DESC_FLAGS1_MORE_IN_BATCH = 1 << 12,
  133. HTT_DATA_TX_DESC_FLAGS1_CKSUM_L3_OFFLOAD = 1 << 13,
  134. HTT_DATA_TX_DESC_FLAGS1_CKSUM_L4_OFFLOAD = 1 << 14,
  135. HTT_DATA_TX_DESC_FLAGS1_TX_COMPLETE = 1 << 15
  136. };
  137. #define HTT_TX_CREDIT_DELTA_ABS_M 0xffff0000
  138. #define HTT_TX_CREDIT_DELTA_ABS_S 16
  139. #define HTT_TX_CREDIT_DELTA_ABS_GET(word) \
  140. (((word) & HTT_TX_CREDIT_DELTA_ABS_M) >> HTT_TX_CREDIT_DELTA_ABS_S)
  141. #define HTT_TX_CREDIT_SIGN_BIT_M 0x00000100
  142. #define HTT_TX_CREDIT_SIGN_BIT_S 8
  143. #define HTT_TX_CREDIT_SIGN_BIT_GET(word) \
  144. (((word) & HTT_TX_CREDIT_SIGN_BIT_M) >> HTT_TX_CREDIT_SIGN_BIT_S)
  145. enum htt_data_tx_ext_tid {
  146. HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST = 16,
  147. HTT_DATA_TX_EXT_TID_MGMT = 17,
  148. HTT_DATA_TX_EXT_TID_INVALID = 31
  149. };
  150. #define HTT_INVALID_PEERID 0xFFFF
  151. /*
  152. * htt_data_tx_desc - used for data tx path
  153. *
  154. * Note: vdev_id irrelevant for pkt_type == raw and no_classify == 1.
  155. * ext_tid: for qos-data frames (0-15), see %HTT_DATA_TX_EXT_TID_
  156. * for special kinds of tids
  157. * postponed: only for HL hosts. indicates if this is a resend
  158. * (HL hosts manage queues on the host )
  159. * more_in_batch: only for HL hosts. indicates if more packets are
  160. * pending. this allows target to wait and aggregate
  161. * freq: 0 means home channel of given vdev. intended for offchannel
  162. */
  163. struct htt_data_tx_desc {
  164. u8 flags0; /* %HTT_DATA_TX_DESC_FLAGS0_ */
  165. __le16 flags1; /* %HTT_DATA_TX_DESC_FLAGS1_ */
  166. __le16 len;
  167. __le16 id;
  168. __le32 frags_paddr;
  169. union {
  170. __le32 peerid;
  171. struct {
  172. __le16 peerid;
  173. __le16 freq;
  174. } __packed offchan_tx;
  175. } __packed;
  176. u8 prefetch[0]; /* start of frame, for FW classification engine */
  177. } __packed;
  178. struct htt_data_tx_desc_64 {
  179. u8 flags0; /* %HTT_DATA_TX_DESC_FLAGS0_ */
  180. __le16 flags1; /* %HTT_DATA_TX_DESC_FLAGS1_ */
  181. __le16 len;
  182. __le16 id;
  183. __le64 frags_paddr;
  184. union {
  185. __le32 peerid;
  186. struct {
  187. __le16 peerid;
  188. __le16 freq;
  189. } __packed offchan_tx;
  190. } __packed;
  191. u8 prefetch[0]; /* start of frame, for FW classification engine */
  192. } __packed;
  193. enum htt_rx_ring_flags {
  194. HTT_RX_RING_FLAGS_MAC80211_HDR = 1 << 0,
  195. HTT_RX_RING_FLAGS_MSDU_PAYLOAD = 1 << 1,
  196. HTT_RX_RING_FLAGS_PPDU_START = 1 << 2,
  197. HTT_RX_RING_FLAGS_PPDU_END = 1 << 3,
  198. HTT_RX_RING_FLAGS_MPDU_START = 1 << 4,
  199. HTT_RX_RING_FLAGS_MPDU_END = 1 << 5,
  200. HTT_RX_RING_FLAGS_MSDU_START = 1 << 6,
  201. HTT_RX_RING_FLAGS_MSDU_END = 1 << 7,
  202. HTT_RX_RING_FLAGS_RX_ATTENTION = 1 << 8,
  203. HTT_RX_RING_FLAGS_FRAG_INFO = 1 << 9,
  204. HTT_RX_RING_FLAGS_UNICAST_RX = 1 << 10,
  205. HTT_RX_RING_FLAGS_MULTICAST_RX = 1 << 11,
  206. HTT_RX_RING_FLAGS_CTRL_RX = 1 << 12,
  207. HTT_RX_RING_FLAGS_MGMT_RX = 1 << 13,
  208. HTT_RX_RING_FLAGS_NULL_RX = 1 << 14,
  209. HTT_RX_RING_FLAGS_PHY_DATA_RX = 1 << 15
  210. };
  211. #define HTT_RX_RING_SIZE_MIN 128
  212. #define HTT_RX_RING_SIZE_MAX 2048
  213. #define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX
  214. #define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1)
  215. #define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1)
  216. struct htt_rx_ring_rx_desc_offsets {
  217. /* the following offsets are in 4-byte units */
  218. __le16 mac80211_hdr_offset;
  219. __le16 msdu_payload_offset;
  220. __le16 ppdu_start_offset;
  221. __le16 ppdu_end_offset;
  222. __le16 mpdu_start_offset;
  223. __le16 mpdu_end_offset;
  224. __le16 msdu_start_offset;
  225. __le16 msdu_end_offset;
  226. __le16 rx_attention_offset;
  227. __le16 frag_info_offset;
  228. } __packed;
  229. struct htt_rx_ring_setup_ring32 {
  230. __le32 fw_idx_shadow_reg_paddr;
  231. __le32 rx_ring_base_paddr;
  232. __le16 rx_ring_len; /* in 4-byte words */
  233. __le16 rx_ring_bufsize; /* rx skb size - in bytes */
  234. __le16 flags; /* %HTT_RX_RING_FLAGS_ */
  235. __le16 fw_idx_init_val;
  236. struct htt_rx_ring_rx_desc_offsets offsets;
  237. } __packed;
  238. struct htt_rx_ring_setup_ring64 {
  239. __le64 fw_idx_shadow_reg_paddr;
  240. __le64 rx_ring_base_paddr;
  241. __le16 rx_ring_len; /* in 4-byte words */
  242. __le16 rx_ring_bufsize; /* rx skb size - in bytes */
  243. __le16 flags; /* %HTT_RX_RING_FLAGS_ */
  244. __le16 fw_idx_init_val;
  245. struct htt_rx_ring_rx_desc_offsets offsets;
  246. } __packed;
  247. struct htt_rx_ring_setup_hdr {
  248. u8 num_rings; /* supported values: 1, 2 */
  249. __le16 rsvd0;
  250. } __packed;
  251. struct htt_rx_ring_setup_32 {
  252. struct htt_rx_ring_setup_hdr hdr;
  253. struct htt_rx_ring_setup_ring32 rings[];
  254. } __packed;
  255. struct htt_rx_ring_setup_64 {
  256. struct htt_rx_ring_setup_hdr hdr;
  257. struct htt_rx_ring_setup_ring64 rings[];
  258. } __packed;
  259. /*
  260. * htt_stats_req - request target to send specified statistics
  261. *
  262. * @msg_type: hardcoded %HTT_H2T_MSG_TYPE_STATS_REQ
  263. * @upload_types: see %htt_dbg_stats_type. this is 24bit field actually
  264. * so make sure its little-endian.
  265. * @reset_types: see %htt_dbg_stats_type. this is 24bit field actually
  266. * so make sure its little-endian.
  267. * @cfg_val: stat_type specific configuration
  268. * @stat_type: see %htt_dbg_stats_type
  269. * @cookie_lsb: used for confirmation message from target->host
  270. * @cookie_msb: ditto as %cookie
  271. */
  272. struct htt_stats_req {
  273. u8 upload_types[3];
  274. u8 rsvd0;
  275. u8 reset_types[3];
  276. struct {
  277. u8 mpdu_bytes;
  278. u8 mpdu_num_msdus;
  279. u8 msdu_bytes;
  280. } __packed;
  281. u8 stat_type;
  282. __le32 cookie_lsb;
  283. __le32 cookie_msb;
  284. } __packed;
  285. #define HTT_STATS_REQ_CFG_STAT_TYPE_INVALID 0xff
  286. #define HTT_STATS_BIT_MASK GENMASK(16, 0)
  287. /*
  288. * htt_oob_sync_req - request out-of-band sync
  289. *
  290. * The HTT SYNC tells the target to suspend processing of subsequent
  291. * HTT host-to-target messages until some other target agent locally
  292. * informs the target HTT FW that the current sync counter is equal to
  293. * or greater than (in a modulo sense) the sync counter specified in
  294. * the SYNC message.
  295. *
  296. * This allows other host-target components to synchronize their operation
  297. * with HTT, e.g. to ensure that tx frames don't get transmitted until a
  298. * security key has been downloaded to and activated by the target.
  299. * In the absence of any explicit synchronization counter value
  300. * specification, the target HTT FW will use zero as the default current
  301. * sync value.
  302. *
  303. * The HTT target FW will suspend its host->target message processing as long
  304. * as 0 < (in-band sync counter - out-of-band sync counter) & 0xff < 128.
  305. */
  306. struct htt_oob_sync_req {
  307. u8 sync_count;
  308. __le16 rsvd0;
  309. } __packed;
  310. struct htt_aggr_conf {
  311. u8 max_num_ampdu_subframes;
  312. /* amsdu_subframes is limited by 0x1F mask */
  313. u8 max_num_amsdu_subframes;
  314. } __packed;
  315. struct htt_aggr_conf_v2 {
  316. u8 max_num_ampdu_subframes;
  317. /* amsdu_subframes is limited by 0x1F mask */
  318. u8 max_num_amsdu_subframes;
  319. u8 reserved;
  320. } __packed;
  321. #define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32
  322. struct htt_mgmt_tx_desc_qca99x0 {
  323. __le32 rate;
  324. } __packed;
  325. struct htt_mgmt_tx_desc {
  326. u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)];
  327. __le32 msdu_paddr;
  328. __le32 desc_id;
  329. __le32 len;
  330. __le32 vdev_id;
  331. u8 hdr[HTT_MGMT_FRM_HDR_DOWNLOAD_LEN];
  332. union {
  333. struct htt_mgmt_tx_desc_qca99x0 qca99x0;
  334. } __packed;
  335. } __packed;
  336. enum htt_mgmt_tx_status {
  337. HTT_MGMT_TX_STATUS_OK = 0,
  338. HTT_MGMT_TX_STATUS_RETRY = 1,
  339. HTT_MGMT_TX_STATUS_DROP = 2
  340. };
  341. /*=== target -> host messages ===============================================*/
  342. enum htt_main_t2h_msg_type {
  343. HTT_MAIN_T2H_MSG_TYPE_VERSION_CONF = 0x0,
  344. HTT_MAIN_T2H_MSG_TYPE_RX_IND = 0x1,
  345. HTT_MAIN_T2H_MSG_TYPE_RX_FLUSH = 0x2,
  346. HTT_MAIN_T2H_MSG_TYPE_PEER_MAP = 0x3,
  347. HTT_MAIN_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
  348. HTT_MAIN_T2H_MSG_TYPE_RX_ADDBA = 0x5,
  349. HTT_MAIN_T2H_MSG_TYPE_RX_DELBA = 0x6,
  350. HTT_MAIN_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
  351. HTT_MAIN_T2H_MSG_TYPE_PKTLOG = 0x8,
  352. HTT_MAIN_T2H_MSG_TYPE_STATS_CONF = 0x9,
  353. HTT_MAIN_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
  354. HTT_MAIN_T2H_MSG_TYPE_SEC_IND = 0xb,
  355. HTT_MAIN_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
  356. HTT_MAIN_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
  357. HTT_MAIN_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf,
  358. HTT_MAIN_T2H_MSG_TYPE_RX_PN_IND = 0x10,
  359. HTT_MAIN_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11,
  360. HTT_MAIN_T2H_MSG_TYPE_TEST,
  361. /* keep this last */
  362. HTT_MAIN_T2H_NUM_MSGS
  363. };
  364. enum htt_10x_t2h_msg_type {
  365. HTT_10X_T2H_MSG_TYPE_VERSION_CONF = 0x0,
  366. HTT_10X_T2H_MSG_TYPE_RX_IND = 0x1,
  367. HTT_10X_T2H_MSG_TYPE_RX_FLUSH = 0x2,
  368. HTT_10X_T2H_MSG_TYPE_PEER_MAP = 0x3,
  369. HTT_10X_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
  370. HTT_10X_T2H_MSG_TYPE_RX_ADDBA = 0x5,
  371. HTT_10X_T2H_MSG_TYPE_RX_DELBA = 0x6,
  372. HTT_10X_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
  373. HTT_10X_T2H_MSG_TYPE_PKTLOG = 0x8,
  374. HTT_10X_T2H_MSG_TYPE_STATS_CONF = 0x9,
  375. HTT_10X_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
  376. HTT_10X_T2H_MSG_TYPE_SEC_IND = 0xb,
  377. HTT_10X_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc,
  378. HTT_10X_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
  379. HTT_10X_T2H_MSG_TYPE_TEST = 0xe,
  380. HTT_10X_T2H_MSG_TYPE_CHAN_CHANGE = 0xf,
  381. HTT_10X_T2H_MSG_TYPE_AGGR_CONF = 0x11,
  382. HTT_10X_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x12,
  383. HTT_10X_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0x13,
  384. /* keep this last */
  385. HTT_10X_T2H_NUM_MSGS
  386. };
  387. enum htt_tlv_t2h_msg_type {
  388. HTT_TLV_T2H_MSG_TYPE_VERSION_CONF = 0x0,
  389. HTT_TLV_T2H_MSG_TYPE_RX_IND = 0x1,
  390. HTT_TLV_T2H_MSG_TYPE_RX_FLUSH = 0x2,
  391. HTT_TLV_T2H_MSG_TYPE_PEER_MAP = 0x3,
  392. HTT_TLV_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
  393. HTT_TLV_T2H_MSG_TYPE_RX_ADDBA = 0x5,
  394. HTT_TLV_T2H_MSG_TYPE_RX_DELBA = 0x6,
  395. HTT_TLV_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
  396. HTT_TLV_T2H_MSG_TYPE_PKTLOG = 0x8,
  397. HTT_TLV_T2H_MSG_TYPE_STATS_CONF = 0x9,
  398. HTT_TLV_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
  399. HTT_TLV_T2H_MSG_TYPE_SEC_IND = 0xb,
  400. HTT_TLV_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, /* deprecated */
  401. HTT_TLV_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
  402. HTT_TLV_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
  403. HTT_TLV_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf,
  404. HTT_TLV_T2H_MSG_TYPE_RX_PN_IND = 0x10,
  405. HTT_TLV_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11,
  406. HTT_TLV_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND = 0x12,
  407. /* 0x13 reservd */
  408. HTT_TLV_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE = 0x14,
  409. HTT_TLV_T2H_MSG_TYPE_CHAN_CHANGE = 0x15,
  410. HTT_TLV_T2H_MSG_TYPE_RX_OFLD_PKT_ERR = 0x16,
  411. HTT_TLV_T2H_MSG_TYPE_TEST,
  412. /* keep this last */
  413. HTT_TLV_T2H_NUM_MSGS
  414. };
  415. enum htt_10_4_t2h_msg_type {
  416. HTT_10_4_T2H_MSG_TYPE_VERSION_CONF = 0x0,
  417. HTT_10_4_T2H_MSG_TYPE_RX_IND = 0x1,
  418. HTT_10_4_T2H_MSG_TYPE_RX_FLUSH = 0x2,
  419. HTT_10_4_T2H_MSG_TYPE_PEER_MAP = 0x3,
  420. HTT_10_4_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
  421. HTT_10_4_T2H_MSG_TYPE_RX_ADDBA = 0x5,
  422. HTT_10_4_T2H_MSG_TYPE_RX_DELBA = 0x6,
  423. HTT_10_4_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
  424. HTT_10_4_T2H_MSG_TYPE_PKTLOG = 0x8,
  425. HTT_10_4_T2H_MSG_TYPE_STATS_CONF = 0x9,
  426. HTT_10_4_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
  427. HTT_10_4_T2H_MSG_TYPE_SEC_IND = 0xb,
  428. HTT_10_4_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc,
  429. HTT_10_4_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
  430. HTT_10_4_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
  431. HTT_10_4_T2H_MSG_TYPE_CHAN_CHANGE = 0xf,
  432. HTT_10_4_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0x10,
  433. HTT_10_4_T2H_MSG_TYPE_RX_PN_IND = 0x11,
  434. HTT_10_4_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x12,
  435. HTT_10_4_T2H_MSG_TYPE_TEST = 0x13,
  436. HTT_10_4_T2H_MSG_TYPE_EN_STATS = 0x14,
  437. HTT_10_4_T2H_MSG_TYPE_AGGR_CONF = 0x15,
  438. HTT_10_4_T2H_MSG_TYPE_TX_FETCH_IND = 0x16,
  439. HTT_10_4_T2H_MSG_TYPE_TX_FETCH_CONFIRM = 0x17,
  440. HTT_10_4_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x18,
  441. /* 0x19 to 0x2f are reserved */
  442. HTT_10_4_T2H_MSG_TYPE_TX_MODE_SWITCH_IND = 0x30,
  443. HTT_10_4_T2H_MSG_TYPE_PEER_STATS = 0x31,
  444. /* keep this last */
  445. HTT_10_4_T2H_NUM_MSGS
  446. };
  447. enum htt_t2h_msg_type {
  448. HTT_T2H_MSG_TYPE_VERSION_CONF,
  449. HTT_T2H_MSG_TYPE_RX_IND,
  450. HTT_T2H_MSG_TYPE_RX_FLUSH,
  451. HTT_T2H_MSG_TYPE_PEER_MAP,
  452. HTT_T2H_MSG_TYPE_PEER_UNMAP,
  453. HTT_T2H_MSG_TYPE_RX_ADDBA,
  454. HTT_T2H_MSG_TYPE_RX_DELBA,
  455. HTT_T2H_MSG_TYPE_TX_COMPL_IND,
  456. HTT_T2H_MSG_TYPE_PKTLOG,
  457. HTT_T2H_MSG_TYPE_STATS_CONF,
  458. HTT_T2H_MSG_TYPE_RX_FRAG_IND,
  459. HTT_T2H_MSG_TYPE_SEC_IND,
  460. HTT_T2H_MSG_TYPE_RC_UPDATE_IND,
  461. HTT_T2H_MSG_TYPE_TX_INSPECT_IND,
  462. HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION,
  463. HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND,
  464. HTT_T2H_MSG_TYPE_RX_PN_IND,
  465. HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND,
  466. HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND,
  467. HTT_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE,
  468. HTT_T2H_MSG_TYPE_CHAN_CHANGE,
  469. HTT_T2H_MSG_TYPE_RX_OFLD_PKT_ERR,
  470. HTT_T2H_MSG_TYPE_AGGR_CONF,
  471. HTT_T2H_MSG_TYPE_STATS_NOUPLOAD,
  472. HTT_T2H_MSG_TYPE_TEST,
  473. HTT_T2H_MSG_TYPE_EN_STATS,
  474. HTT_T2H_MSG_TYPE_TX_FETCH_IND,
  475. HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM,
  476. HTT_T2H_MSG_TYPE_TX_MODE_SWITCH_IND,
  477. HTT_T2H_MSG_TYPE_PEER_STATS,
  478. /* keep this last */
  479. HTT_T2H_NUM_MSGS
  480. };
  481. /*
  482. * htt_resp_hdr - header for target-to-host messages
  483. *
  484. * msg_type: see htt_t2h_msg_type
  485. */
  486. struct htt_resp_hdr {
  487. u8 msg_type;
  488. } __packed;
  489. #define HTT_RESP_HDR_MSG_TYPE_OFFSET 0
  490. #define HTT_RESP_HDR_MSG_TYPE_MASK 0xff
  491. #define HTT_RESP_HDR_MSG_TYPE_LSB 0
  492. /* htt_ver_resp - response sent for htt_ver_req */
  493. struct htt_ver_resp {
  494. u8 minor;
  495. u8 major;
  496. u8 rsvd0;
  497. } __packed;
  498. #define HTT_MGMT_TX_CMPL_FLAG_ACK_RSSI BIT(0)
  499. #define HTT_MGMT_TX_CMPL_INFO_ACK_RSSI_MASK GENMASK(7, 0)
  500. struct htt_mgmt_tx_completion {
  501. u8 rsvd0;
  502. u8 rsvd1;
  503. u8 flags;
  504. __le32 desc_id;
  505. __le32 status;
  506. __le32 ppdu_id;
  507. __le32 info;
  508. } __packed;
  509. #define HTT_RX_INDICATION_INFO0_EXT_TID_MASK (0x1F)
  510. #define HTT_RX_INDICATION_INFO0_EXT_TID_LSB (0)
  511. #define HTT_RX_INDICATION_INFO0_FLUSH_VALID (1 << 5)
  512. #define HTT_RX_INDICATION_INFO0_RELEASE_VALID (1 << 6)
  513. #define HTT_RX_INDICATION_INFO0_PPDU_DURATION BIT(7)
  514. #define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_MASK 0x0000003F
  515. #define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_LSB 0
  516. #define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_MASK 0x00000FC0
  517. #define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_LSB 6
  518. #define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_MASK 0x0003F000
  519. #define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_LSB 12
  520. #define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_MASK 0x00FC0000
  521. #define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_LSB 18
  522. #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_MASK 0xFF000000
  523. #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_LSB 24
  524. #define HTT_TX_CMPL_FLAG_DATA_RSSI BIT(0)
  525. #define HTT_TX_CMPL_FLAG_PPID_PRESENT BIT(1)
  526. #define HTT_TX_CMPL_FLAG_PA_PRESENT BIT(2)
  527. #define HTT_TX_CMPL_FLAG_PPDU_DURATION_PRESENT BIT(3)
  528. #define HTT_TX_DATA_RSSI_ENABLE_WCN3990 BIT(3)
  529. #define HTT_TX_DATA_APPEND_RETRIES BIT(0)
  530. #define HTT_TX_DATA_APPEND_TIMESTAMP BIT(1)
  531. struct htt_rx_indication_hdr {
  532. u8 info0; /* %HTT_RX_INDICATION_INFO0_ */
  533. __le16 peer_id;
  534. __le32 info1; /* %HTT_RX_INDICATION_INFO1_ */
  535. } __packed;
  536. #define HTT_RX_INDICATION_INFO0_PHY_ERR_VALID (1 << 0)
  537. #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_MASK (0x1E)
  538. #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_LSB (1)
  539. #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK (1 << 5)
  540. #define HTT_RX_INDICATION_INFO0_END_VALID (1 << 6)
  541. #define HTT_RX_INDICATION_INFO0_START_VALID (1 << 7)
  542. #define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_MASK 0x00FFFFFF
  543. #define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_LSB 0
  544. #define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_MASK 0xFF000000
  545. #define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_LSB 24
  546. #define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_MASK 0x00FFFFFF
  547. #define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_LSB 0
  548. #define HTT_RX_INDICATION_INFO2_SERVICE_MASK 0xFF000000
  549. #define HTT_RX_INDICATION_INFO2_SERVICE_LSB 24
  550. enum htt_rx_legacy_rate {
  551. HTT_RX_OFDM_48 = 0,
  552. HTT_RX_OFDM_24 = 1,
  553. HTT_RX_OFDM_12,
  554. HTT_RX_OFDM_6,
  555. HTT_RX_OFDM_54,
  556. HTT_RX_OFDM_36,
  557. HTT_RX_OFDM_18,
  558. HTT_RX_OFDM_9,
  559. /* long preamble */
  560. HTT_RX_CCK_11_LP = 0,
  561. HTT_RX_CCK_5_5_LP = 1,
  562. HTT_RX_CCK_2_LP,
  563. HTT_RX_CCK_1_LP,
  564. /* short preamble */
  565. HTT_RX_CCK_11_SP,
  566. HTT_RX_CCK_5_5_SP,
  567. HTT_RX_CCK_2_SP
  568. };
  569. enum htt_rx_legacy_rate_type {
  570. HTT_RX_LEGACY_RATE_OFDM = 0,
  571. HTT_RX_LEGACY_RATE_CCK
  572. };
  573. enum htt_rx_preamble_type {
  574. HTT_RX_LEGACY = 0x4,
  575. HTT_RX_HT = 0x8,
  576. HTT_RX_HT_WITH_TXBF = 0x9,
  577. HTT_RX_VHT = 0xC,
  578. HTT_RX_VHT_WITH_TXBF = 0xD,
  579. };
  580. /*
  581. * Fields: phy_err_valid, phy_err_code, tsf,
  582. * usec_timestamp, sub_usec_timestamp
  583. * ..are valid only if end_valid == 1.
  584. *
  585. * Fields: rssi_chains, legacy_rate_type,
  586. * legacy_rate_cck, preamble_type, service,
  587. * vht_sig_*
  588. * ..are valid only if start_valid == 1;
  589. */
  590. struct htt_rx_indication_ppdu {
  591. u8 combined_rssi;
  592. u8 sub_usec_timestamp;
  593. u8 phy_err_code;
  594. u8 info0; /* HTT_RX_INDICATION_INFO0_ */
  595. struct {
  596. u8 pri20_db;
  597. u8 ext20_db;
  598. u8 ext40_db;
  599. u8 ext80_db;
  600. } __packed rssi_chains[4];
  601. __le32 tsf;
  602. __le32 usec_timestamp;
  603. __le32 info1; /* HTT_RX_INDICATION_INFO1_ */
  604. __le32 info2; /* HTT_RX_INDICATION_INFO2_ */
  605. } __packed;
  606. enum htt_rx_mpdu_status {
  607. HTT_RX_IND_MPDU_STATUS_UNKNOWN = 0x0,
  608. HTT_RX_IND_MPDU_STATUS_OK,
  609. HTT_RX_IND_MPDU_STATUS_ERR_FCS,
  610. HTT_RX_IND_MPDU_STATUS_ERR_DUP,
  611. HTT_RX_IND_MPDU_STATUS_ERR_REPLAY,
  612. HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER,
  613. /* only accept EAPOL frames */
  614. HTT_RX_IND_MPDU_STATUS_UNAUTH_PEER,
  615. HTT_RX_IND_MPDU_STATUS_OUT_OF_SYNC,
  616. /* Non-data in promiscuous mode */
  617. HTT_RX_IND_MPDU_STATUS_MGMT_CTRL,
  618. HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR,
  619. HTT_RX_IND_MPDU_STATUS_DECRYPT_ERR,
  620. HTT_RX_IND_MPDU_STATUS_MPDU_LENGTH_ERR,
  621. HTT_RX_IND_MPDU_STATUS_ENCRYPT_REQUIRED_ERR,
  622. HTT_RX_IND_MPDU_STATUS_PRIVACY_ERR,
  623. /*
  624. * MISC: discard for unspecified reasons.
  625. * Leave this enum value last.
  626. */
  627. HTT_RX_IND_MPDU_STATUS_ERR_MISC = 0xFF
  628. };
  629. struct htt_rx_indication_mpdu_range {
  630. u8 mpdu_count;
  631. u8 mpdu_range_status; /* %htt_rx_mpdu_status */
  632. u8 pad0;
  633. u8 pad1;
  634. } __packed;
  635. struct htt_rx_indication_prefix {
  636. __le16 fw_rx_desc_bytes;
  637. u8 pad0;
  638. u8 pad1;
  639. } __packed;
  640. struct htt_rx_indication {
  641. struct htt_rx_indication_hdr hdr;
  642. struct htt_rx_indication_ppdu ppdu;
  643. struct htt_rx_indication_prefix prefix;
  644. /*
  645. * the following fields are both dynamically sized, so
  646. * take care addressing them
  647. */
  648. /* the size of this is %fw_rx_desc_bytes */
  649. struct fw_rx_desc_base fw_desc;
  650. /*
  651. * %mpdu_ranges starts after &%prefix + roundup(%fw_rx_desc_bytes, 4)
  652. * and has %num_mpdu_ranges elements.
  653. */
  654. struct htt_rx_indication_mpdu_range mpdu_ranges[];
  655. } __packed;
  656. /* High latency version of the RX indication */
  657. struct htt_rx_indication_hl {
  658. struct htt_rx_indication_hdr hdr;
  659. struct htt_rx_indication_ppdu ppdu;
  660. struct htt_rx_indication_prefix prefix;
  661. struct fw_rx_desc_hl fw_desc;
  662. struct htt_rx_indication_mpdu_range mpdu_ranges[];
  663. } __packed;
  664. struct htt_hl_rx_desc {
  665. __le32 info;
  666. __le32 pn_31_0;
  667. union {
  668. struct {
  669. __le16 pn_47_32;
  670. __le16 pn_63_48;
  671. } pn16;
  672. __le32 pn_63_32;
  673. } u0;
  674. __le32 pn_95_64;
  675. __le32 pn_127_96;
  676. } __packed;
  677. static inline struct htt_rx_indication_mpdu_range *
  678. htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
  679. {
  680. void *ptr = rx_ind;
  681. ptr += sizeof(rx_ind->hdr)
  682. + sizeof(rx_ind->ppdu)
  683. + sizeof(rx_ind->prefix)
  684. + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
  685. return ptr;
  686. }
  687. static inline struct htt_rx_indication_mpdu_range *
  688. htt_rx_ind_get_mpdu_ranges_hl(struct htt_rx_indication_hl *rx_ind)
  689. {
  690. void *ptr = rx_ind;
  691. ptr += sizeof(rx_ind->hdr)
  692. + sizeof(rx_ind->ppdu)
  693. + sizeof(rx_ind->prefix)
  694. + sizeof(rx_ind->fw_desc);
  695. return ptr;
  696. }
  697. enum htt_rx_flush_mpdu_status {
  698. HTT_RX_FLUSH_MPDU_DISCARD = 0,
  699. HTT_RX_FLUSH_MPDU_REORDER = 1,
  700. };
  701. /*
  702. * htt_rx_flush - discard or reorder given range of mpdus
  703. *
  704. * Note: host must check if all sequence numbers between
  705. * [seq_num_start, seq_num_end-1] are valid.
  706. */
  707. struct htt_rx_flush {
  708. __le16 peer_id;
  709. u8 tid;
  710. u8 rsvd0;
  711. u8 mpdu_status; /* %htt_rx_flush_mpdu_status */
  712. u8 seq_num_start; /* it is 6 LSBs of 802.11 seq no */
  713. u8 seq_num_end; /* it is 6 LSBs of 802.11 seq no */
  714. };
  715. struct htt_rx_peer_map {
  716. u8 vdev_id;
  717. __le16 peer_id;
  718. u8 addr[6];
  719. u8 rsvd0;
  720. u8 rsvd1;
  721. } __packed;
  722. struct htt_rx_peer_unmap {
  723. u8 rsvd0;
  724. __le16 peer_id;
  725. } __packed;
  726. enum htt_txrx_sec_cast_type {
  727. HTT_TXRX_SEC_MCAST = 0,
  728. HTT_TXRX_SEC_UCAST
  729. };
  730. enum htt_rx_pn_check_type {
  731. HTT_RX_NON_PN_CHECK = 0,
  732. HTT_RX_PN_CHECK
  733. };
  734. enum htt_rx_tkip_demic_type {
  735. HTT_RX_NON_TKIP_MIC = 0,
  736. HTT_RX_TKIP_MIC
  737. };
  738. enum htt_security_types {
  739. HTT_SECURITY_NONE,
  740. HTT_SECURITY_WEP128,
  741. HTT_SECURITY_WEP104,
  742. HTT_SECURITY_WEP40,
  743. HTT_SECURITY_TKIP,
  744. HTT_SECURITY_TKIP_NOMIC,
  745. HTT_SECURITY_AES_CCMP,
  746. HTT_SECURITY_WAPI,
  747. HTT_NUM_SECURITY_TYPES /* keep this last! */
  748. };
  749. #define ATH10K_HTT_TXRX_PEER_SECURITY_MAX 2
  750. #define ATH10K_TXRX_NUM_EXT_TIDS 19
  751. #define ATH10K_TXRX_NON_QOS_TID 16
  752. enum htt_security_flags {
  753. #define HTT_SECURITY_TYPE_MASK 0x7F
  754. #define HTT_SECURITY_TYPE_LSB 0
  755. HTT_SECURITY_IS_UNICAST = 1 << 7
  756. };
  757. struct htt_security_indication {
  758. union {
  759. /* dont use bitfields; undefined behaviour */
  760. u8 flags; /* %htt_security_flags */
  761. struct {
  762. u8 security_type:7, /* %htt_security_types */
  763. is_unicast:1;
  764. } __packed;
  765. } __packed;
  766. __le16 peer_id;
  767. u8 michael_key[8];
  768. u8 wapi_rsc[16];
  769. } __packed;
  770. #define HTT_RX_BA_INFO0_TID_MASK 0x000F
  771. #define HTT_RX_BA_INFO0_TID_LSB 0
  772. #define HTT_RX_BA_INFO0_PEER_ID_MASK 0xFFF0
  773. #define HTT_RX_BA_INFO0_PEER_ID_LSB 4
  774. struct htt_rx_addba {
  775. u8 window_size;
  776. __le16 info0; /* %HTT_RX_BA_INFO0_ */
  777. } __packed;
  778. struct htt_rx_delba {
  779. u8 rsvd0;
  780. __le16 info0; /* %HTT_RX_BA_INFO0_ */
  781. } __packed;
  782. enum htt_data_tx_status {
  783. HTT_DATA_TX_STATUS_OK = 0,
  784. HTT_DATA_TX_STATUS_DISCARD = 1,
  785. HTT_DATA_TX_STATUS_NO_ACK = 2,
  786. HTT_DATA_TX_STATUS_POSTPONE = 3 /* HL only */
  787. };
  788. enum htt_data_tx_flags {
  789. #define HTT_DATA_TX_STATUS_MASK 0x07
  790. #define HTT_DATA_TX_STATUS_LSB 0
  791. #define HTT_DATA_TX_TID_MASK 0x78
  792. #define HTT_DATA_TX_TID_LSB 3
  793. HTT_DATA_TX_TID_INVALID = 1 << 7
  794. };
  795. #define HTT_TX_COMPL_INV_MSDU_ID 0xFFFF
  796. struct htt_append_retries {
  797. __le16 msdu_id;
  798. u8 tx_retries;
  799. u8 flag;
  800. } __packed;
  801. struct htt_data_tx_completion_ext {
  802. struct htt_append_retries a_retries;
  803. __le32 t_stamp;
  804. __le16 msdus_rssi[];
  805. } __packed;
  806. /*
  807. * @brief target -> host TX completion indication message definition
  808. *
  809. * @details
  810. * The following diagram shows the format of the TX completion indication sent
  811. * from the target to the host
  812. *
  813. * |31 28|27|26|25|24|23 16| 15 |14 11|10 8|7 0|
  814. * |-------------------------------------------------------------|
  815. * header: |rsvd |A2|TP|A1|A0| num | t_i| tid |status| msg_type |
  816. * |-------------------------------------------------------------|
  817. * payload: | MSDU1 ID | MSDU0 ID |
  818. * |-------------------------------------------------------------|
  819. * : MSDU3 ID : MSDU2 ID :
  820. * |-------------------------------------------------------------|
  821. * | struct htt_tx_compl_ind_append_retries |
  822. * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
  823. * | struct htt_tx_compl_ind_append_tx_tstamp |
  824. * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
  825. * | MSDU1 ACK RSSI | MSDU0 ACK RSSI |
  826. * |-------------------------------------------------------------|
  827. * : MSDU3 ACK RSSI : MSDU2 ACK RSSI :
  828. * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
  829. * -msg_type
  830. * Bits 7:0
  831. * Purpose: identifies this as HTT TX completion indication
  832. * -status
  833. * Bits 10:8
  834. * Purpose: the TX completion status of payload fragmentations descriptors
  835. * Value: could be HTT_TX_COMPL_IND_STAT_OK or HTT_TX_COMPL_IND_STAT_DISCARD
  836. * -tid
  837. * Bits 14:11
  838. * Purpose: the tid associated with those fragmentation descriptors. It is
  839. * valid or not, depending on the tid_invalid bit.
  840. * Value: 0 to 15
  841. * -tid_invalid
  842. * Bits 15:15
  843. * Purpose: this bit indicates whether the tid field is valid or not
  844. * Value: 0 indicates valid, 1 indicates invalid
  845. * -num
  846. * Bits 23:16
  847. * Purpose: the number of payload in this indication
  848. * Value: 1 to 255
  849. * -A0 = append
  850. * Bits 24:24
  851. * Purpose: append the struct htt_tx_compl_ind_append_retries which contains
  852. * the number of tx retries for one MSDU at the end of this message
  853. * Value: 0 indicates no appending, 1 indicates appending
  854. * -A1 = append1
  855. * Bits 25:25
  856. * Purpose: Append the struct htt_tx_compl_ind_append_tx_tstamp which
  857. * contains the timestamp info for each TX msdu id in payload.
  858. * Value: 0 indicates no appending, 1 indicates appending
  859. * -TP = MSDU tx power presence
  860. * Bits 26:26
  861. * Purpose: Indicate whether the TX_COMPL_IND includes a tx power report
  862. * for each MSDU referenced by the TX_COMPL_IND message.
  863. * The order of the per-MSDU tx power reports matches the order
  864. * of the MSDU IDs.
  865. * Value: 0 indicates not appending, 1 indicates appending
  866. * -A2 = append2
  867. * Bits 27:27
  868. * Purpose: Indicate whether data ACK RSSI is appended for each MSDU in
  869. * TX_COMP_IND message. The order of the per-MSDU ACK RSSI report
  870. * matches the order of the MSDU IDs.
  871. * The ACK RSSI values are valid when status is COMPLETE_OK (and
  872. * this append2 bit is set).
  873. * Value: 0 indicates not appending, 1 indicates appending
  874. */
  875. struct htt_data_tx_completion {
  876. union {
  877. u8 flags;
  878. struct {
  879. u8 status:3,
  880. tid:4,
  881. tid_invalid:1;
  882. } __packed;
  883. } __packed;
  884. u8 num_msdus;
  885. u8 flags2; /* HTT_TX_CMPL_FLAG_DATA_RSSI */
  886. __le16 msdus[]; /* variable length based on %num_msdus */
  887. } __packed;
  888. #define HTT_TX_PPDU_DUR_INFO0_PEER_ID_MASK GENMASK(15, 0)
  889. #define HTT_TX_PPDU_DUR_INFO0_TID_MASK GENMASK(20, 16)
  890. struct htt_data_tx_ppdu_dur {
  891. __le32 info0; /* HTT_TX_PPDU_DUR_INFO0_ */
  892. __le32 tx_duration; /* in usecs */
  893. } __packed;
  894. #define HTT_TX_COMPL_PPDU_DUR_INFO0_NUM_ENTRIES_MASK GENMASK(7, 0)
  895. struct htt_data_tx_compl_ppdu_dur {
  896. __le32 info0; /* HTT_TX_COMPL_PPDU_DUR_INFO0_ */
  897. struct htt_data_tx_ppdu_dur ppdu_dur[];
  898. } __packed;
  899. struct htt_tx_compl_ind_base {
  900. u32 hdr;
  901. u16 payload[1/*or more*/];
  902. } __packed;
  903. struct htt_rc_tx_done_params {
  904. u32 rate_code;
  905. u32 rate_code_flags;
  906. u32 flags;
  907. u32 num_enqued; /* 1 for non-AMPDU */
  908. u32 num_retries;
  909. u32 num_failed; /* for AMPDU */
  910. u32 ack_rssi;
  911. u32 time_stamp;
  912. u32 is_probe;
  913. };
  914. struct htt_rc_update {
  915. u8 vdev_id;
  916. __le16 peer_id;
  917. u8 addr[6];
  918. u8 num_elems;
  919. u8 rsvd0;
  920. struct htt_rc_tx_done_params params[]; /* variable length %num_elems */
  921. } __packed;
  922. /* see htt_rx_indication for similar fields and descriptions */
  923. struct htt_rx_fragment_indication {
  924. union {
  925. u8 info0; /* %HTT_RX_FRAG_IND_INFO0_ */
  926. struct {
  927. u8 ext_tid:5,
  928. flush_valid:1;
  929. } __packed;
  930. } __packed;
  931. __le16 peer_id;
  932. __le32 info1; /* %HTT_RX_FRAG_IND_INFO1_ */
  933. __le16 fw_rx_desc_bytes;
  934. __le16 rsvd0;
  935. u8 fw_msdu_rx_desc[];
  936. } __packed;
  937. #define ATH10K_IEEE80211_EXTIV BIT(5)
  938. #define ATH10K_IEEE80211_TKIP_MICLEN 8 /* trailing MIC */
  939. #define HTT_RX_FRAG_IND_INFO0_HEADER_LEN 16
  940. #define HTT_RX_FRAG_IND_INFO0_EXT_TID_MASK 0x1F
  941. #define HTT_RX_FRAG_IND_INFO0_EXT_TID_LSB 0
  942. #define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_MASK 0x20
  943. #define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_LSB 5
  944. #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_MASK 0x0000003F
  945. #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_LSB 0
  946. #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_MASK 0x00000FC0
  947. #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_LSB 6
  948. struct htt_rx_pn_ind {
  949. __le16 peer_id;
  950. u8 tid;
  951. u8 seqno_start;
  952. u8 seqno_end;
  953. u8 pn_ie_count;
  954. u8 reserved;
  955. u8 pn_ies[];
  956. } __packed;
  957. struct htt_rx_offload_msdu {
  958. __le16 msdu_len;
  959. __le16 peer_id;
  960. u8 vdev_id;
  961. u8 tid;
  962. u8 fw_desc;
  963. u8 payload[];
  964. } __packed;
  965. struct htt_rx_offload_ind {
  966. u8 reserved;
  967. __le16 msdu_count;
  968. } __packed;
  969. struct htt_rx_in_ord_msdu_desc {
  970. __le32 msdu_paddr;
  971. __le16 msdu_len;
  972. u8 fw_desc;
  973. u8 reserved;
  974. } __packed;
  975. struct htt_rx_in_ord_msdu_desc_ext {
  976. __le64 msdu_paddr;
  977. __le16 msdu_len;
  978. u8 fw_desc;
  979. u8 reserved;
  980. } __packed;
  981. struct htt_rx_in_ord_ind {
  982. u8 info;
  983. __le16 peer_id;
  984. u8 vdev_id;
  985. u8 reserved;
  986. __le16 msdu_count;
  987. union {
  988. DECLARE_FLEX_ARRAY(struct htt_rx_in_ord_msdu_desc,
  989. msdu_descs32);
  990. DECLARE_FLEX_ARRAY(struct htt_rx_in_ord_msdu_desc_ext,
  991. msdu_descs64);
  992. } __packed;
  993. } __packed;
  994. #define HTT_RX_IN_ORD_IND_INFO_TID_MASK 0x0000001f
  995. #define HTT_RX_IN_ORD_IND_INFO_TID_LSB 0
  996. #define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_MASK 0x00000020
  997. #define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_LSB 5
  998. #define HTT_RX_IN_ORD_IND_INFO_FRAG_MASK 0x00000040
  999. #define HTT_RX_IN_ORD_IND_INFO_FRAG_LSB 6
  1000. /*
  1001. * target -> host test message definition
  1002. *
  1003. * The following field definitions describe the format of the test
  1004. * message sent from the target to the host.
  1005. * The message consists of a 4-octet header, followed by a variable
  1006. * number of 32-bit integer values, followed by a variable number
  1007. * of 8-bit character values.
  1008. *
  1009. * |31 16|15 8|7 0|
  1010. * |-----------------------------------------------------------|
  1011. * | num chars | num ints | msg type |
  1012. * |-----------------------------------------------------------|
  1013. * | int 0 |
  1014. * |-----------------------------------------------------------|
  1015. * | int 1 |
  1016. * |-----------------------------------------------------------|
  1017. * | ... |
  1018. * |-----------------------------------------------------------|
  1019. * | char 3 | char 2 | char 1 | char 0 |
  1020. * |-----------------------------------------------------------|
  1021. * | | | ... | char 4 |
  1022. * |-----------------------------------------------------------|
  1023. * - MSG_TYPE
  1024. * Bits 7:0
  1025. * Purpose: identifies this as a test message
  1026. * Value: HTT_MSG_TYPE_TEST
  1027. * - NUM_INTS
  1028. * Bits 15:8
  1029. * Purpose: indicate how many 32-bit integers follow the message header
  1030. * - NUM_CHARS
  1031. * Bits 31:16
  1032. * Purpose: indicate how many 8-bit characters follow the series of integers
  1033. */
  1034. struct htt_rx_test {
  1035. u8 num_ints;
  1036. __le16 num_chars;
  1037. /* payload consists of 2 lists:
  1038. * a) num_ints * sizeof(__le32)
  1039. * b) num_chars * sizeof(u8) aligned to 4bytes
  1040. */
  1041. u8 payload[];
  1042. } __packed;
  1043. static inline __le32 *htt_rx_test_get_ints(struct htt_rx_test *rx_test)
  1044. {
  1045. return (__le32 *)rx_test->payload;
  1046. }
  1047. static inline u8 *htt_rx_test_get_chars(struct htt_rx_test *rx_test)
  1048. {
  1049. return rx_test->payload + (rx_test->num_ints * sizeof(__le32));
  1050. }
  1051. /*
  1052. * target -> host packet log message
  1053. *
  1054. * The following field definitions describe the format of the packet log
  1055. * message sent from the target to the host.
  1056. * The message consists of a 4-octet header,followed by a variable number
  1057. * of 32-bit character values.
  1058. *
  1059. * |31 24|23 16|15 8|7 0|
  1060. * |-----------------------------------------------------------|
  1061. * | | | | msg type |
  1062. * |-----------------------------------------------------------|
  1063. * | payload |
  1064. * |-----------------------------------------------------------|
  1065. * - MSG_TYPE
  1066. * Bits 7:0
  1067. * Purpose: identifies this as a test message
  1068. * Value: HTT_MSG_TYPE_PACKETLOG
  1069. */
  1070. struct htt_pktlog_msg {
  1071. u8 pad[3];
  1072. u8 payload[];
  1073. } __packed;
  1074. struct htt_dbg_stats_rx_reorder_stats {
  1075. /* Non QoS MPDUs received */
  1076. __le32 deliver_non_qos;
  1077. /* MPDUs received in-order */
  1078. __le32 deliver_in_order;
  1079. /* Flush due to reorder timer expired */
  1080. __le32 deliver_flush_timeout;
  1081. /* Flush due to move out of window */
  1082. __le32 deliver_flush_oow;
  1083. /* Flush due to DELBA */
  1084. __le32 deliver_flush_delba;
  1085. /* MPDUs dropped due to FCS error */
  1086. __le32 fcs_error;
  1087. /* MPDUs dropped due to monitor mode non-data packet */
  1088. __le32 mgmt_ctrl;
  1089. /* MPDUs dropped due to invalid peer */
  1090. __le32 invalid_peer;
  1091. /* MPDUs dropped due to duplication (non aggregation) */
  1092. __le32 dup_non_aggr;
  1093. /* MPDUs dropped due to processed before */
  1094. __le32 dup_past;
  1095. /* MPDUs dropped due to duplicate in reorder queue */
  1096. __le32 dup_in_reorder;
  1097. /* Reorder timeout happened */
  1098. __le32 reorder_timeout;
  1099. /* invalid bar ssn */
  1100. __le32 invalid_bar_ssn;
  1101. /* reorder reset due to bar ssn */
  1102. __le32 ssn_reset;
  1103. };
  1104. struct htt_dbg_stats_wal_tx_stats {
  1105. /* Num HTT cookies queued to dispatch list */
  1106. __le32 comp_queued;
  1107. /* Num HTT cookies dispatched */
  1108. __le32 comp_delivered;
  1109. /* Num MSDU queued to WAL */
  1110. __le32 msdu_enqued;
  1111. /* Num MPDU queue to WAL */
  1112. __le32 mpdu_enqued;
  1113. /* Num MSDUs dropped by WMM limit */
  1114. __le32 wmm_drop;
  1115. /* Num Local frames queued */
  1116. __le32 local_enqued;
  1117. /* Num Local frames done */
  1118. __le32 local_freed;
  1119. /* Num queued to HW */
  1120. __le32 hw_queued;
  1121. /* Num PPDU reaped from HW */
  1122. __le32 hw_reaped;
  1123. /* Num underruns */
  1124. __le32 underrun;
  1125. /* Num PPDUs cleaned up in TX abort */
  1126. __le32 tx_abort;
  1127. /* Num MPDUs requeued by SW */
  1128. __le32 mpdus_requeued;
  1129. /* excessive retries */
  1130. __le32 tx_ko;
  1131. /* data hw rate code */
  1132. __le32 data_rc;
  1133. /* Scheduler self triggers */
  1134. __le32 self_triggers;
  1135. /* frames dropped due to excessive sw retries */
  1136. __le32 sw_retry_failure;
  1137. /* illegal rate phy errors */
  1138. __le32 illgl_rate_phy_err;
  1139. /* wal pdev continuous xretry */
  1140. __le32 pdev_cont_xretry;
  1141. /* wal pdev continuous xretry */
  1142. __le32 pdev_tx_timeout;
  1143. /* wal pdev resets */
  1144. __le32 pdev_resets;
  1145. __le32 phy_underrun;
  1146. /* MPDU is more than txop limit */
  1147. __le32 txop_ovf;
  1148. } __packed;
  1149. struct htt_dbg_stats_wal_rx_stats {
  1150. /* Cnts any change in ring routing mid-ppdu */
  1151. __le32 mid_ppdu_route_change;
  1152. /* Total number of statuses processed */
  1153. __le32 status_rcvd;
  1154. /* Extra frags on rings 0-3 */
  1155. __le32 r0_frags;
  1156. __le32 r1_frags;
  1157. __le32 r2_frags;
  1158. __le32 r3_frags;
  1159. /* MSDUs / MPDUs delivered to HTT */
  1160. __le32 htt_msdus;
  1161. __le32 htt_mpdus;
  1162. /* MSDUs / MPDUs delivered to local stack */
  1163. __le32 loc_msdus;
  1164. __le32 loc_mpdus;
  1165. /* AMSDUs that have more MSDUs than the status ring size */
  1166. __le32 oversize_amsdu;
  1167. /* Number of PHY errors */
  1168. __le32 phy_errs;
  1169. /* Number of PHY errors drops */
  1170. __le32 phy_err_drop;
  1171. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  1172. __le32 mpdu_errs;
  1173. } __packed;
  1174. struct htt_dbg_stats_wal_peer_stats {
  1175. __le32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
  1176. } __packed;
  1177. struct htt_dbg_stats_wal_pdev_txrx {
  1178. struct htt_dbg_stats_wal_tx_stats tx_stats;
  1179. struct htt_dbg_stats_wal_rx_stats rx_stats;
  1180. struct htt_dbg_stats_wal_peer_stats peer_stats;
  1181. } __packed;
  1182. struct htt_dbg_stats_rx_rate_info {
  1183. __le32 mcs[10];
  1184. __le32 sgi[10];
  1185. __le32 nss[4];
  1186. __le32 stbc[10];
  1187. __le32 bw[3];
  1188. __le32 pream[6];
  1189. __le32 ldpc;
  1190. __le32 txbf;
  1191. };
  1192. /*
  1193. * htt_dbg_stats_status -
  1194. * present - The requested stats have been delivered in full.
  1195. * This indicates that either the stats information was contained
  1196. * in its entirety within this message, or else this message
  1197. * completes the delivery of the requested stats info that was
  1198. * partially delivered through earlier STATS_CONF messages.
  1199. * partial - The requested stats have been delivered in part.
  1200. * One or more subsequent STATS_CONF messages with the same
  1201. * cookie value will be sent to deliver the remainder of the
  1202. * information.
  1203. * error - The requested stats could not be delivered, for example due
  1204. * to a shortage of memory to construct a message holding the
  1205. * requested stats.
  1206. * invalid - The requested stat type is either not recognized, or the
  1207. * target is configured to not gather the stats type in question.
  1208. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1209. * series_done - This special value indicates that no further stats info
  1210. * elements are present within a series of stats info elems
  1211. * (within a stats upload confirmation message).
  1212. */
  1213. enum htt_dbg_stats_status {
  1214. HTT_DBG_STATS_STATUS_PRESENT = 0,
  1215. HTT_DBG_STATS_STATUS_PARTIAL = 1,
  1216. HTT_DBG_STATS_STATUS_ERROR = 2,
  1217. HTT_DBG_STATS_STATUS_INVALID = 3,
  1218. HTT_DBG_STATS_STATUS_SERIES_DONE = 7
  1219. };
  1220. /*
  1221. * host -> target FRAG DESCRIPTOR/MSDU_EXT DESC bank
  1222. *
  1223. * The following field definitions describe the format of the HTT host
  1224. * to target frag_desc/msdu_ext bank configuration message.
  1225. * The message contains the based address and the min and max id of the
  1226. * MSDU_EXT/FRAG_DESC that will be used by the HTT to map MSDU DESC and
  1227. * MSDU_EXT/FRAG_DESC.
  1228. * HTT will use id in HTT descriptor instead sending the frag_desc_ptr.
  1229. * For QCA988X HW the firmware will use fragment_desc_ptr but in WIFI2.0
  1230. * the hardware does the mapping/translation.
  1231. *
  1232. * Total banks that can be configured is configured to 16.
  1233. *
  1234. * This should be called before any TX has be initiated by the HTT
  1235. *
  1236. * |31 16|15 8|7 5|4 0|
  1237. * |------------------------------------------------------------|
  1238. * | DESC_SIZE | NUM_BANKS | RES |SWP|pdev| msg type |
  1239. * |------------------------------------------------------------|
  1240. * | BANK0_BASE_ADDRESS |
  1241. * |------------------------------------------------------------|
  1242. * | ... |
  1243. * |------------------------------------------------------------|
  1244. * | BANK15_BASE_ADDRESS |
  1245. * |------------------------------------------------------------|
  1246. * | BANK0_MAX_ID | BANK0_MIN_ID |
  1247. * |------------------------------------------------------------|
  1248. * | ... |
  1249. * |------------------------------------------------------------|
  1250. * | BANK15_MAX_ID | BANK15_MIN_ID |
  1251. * |------------------------------------------------------------|
  1252. * Header fields:
  1253. * - MSG_TYPE
  1254. * Bits 7:0
  1255. * Value: 0x6
  1256. * - BANKx_BASE_ADDRESS
  1257. * Bits 31:0
  1258. * Purpose: Provide a mechanism to specify the base address of the MSDU_EXT
  1259. * bank physical/bus address.
  1260. * - BANKx_MIN_ID
  1261. * Bits 15:0
  1262. * Purpose: Provide a mechanism to specify the min index that needs to
  1263. * mapped.
  1264. * - BANKx_MAX_ID
  1265. * Bits 31:16
  1266. * Purpose: Provide a mechanism to specify the max index that needs to
  1267. *
  1268. */
  1269. struct htt_frag_desc_bank_id {
  1270. __le16 bank_min_id;
  1271. __le16 bank_max_id;
  1272. } __packed;
  1273. /* real is 16 but it wouldn't fit in the max htt message size
  1274. * so we use a conservatively safe value for now
  1275. */
  1276. #define HTT_FRAG_DESC_BANK_MAX 4
  1277. #define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_MASK 0x03
  1278. #define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_LSB 0
  1279. #define HTT_FRAG_DESC_BANK_CFG_INFO_SWAP BIT(2)
  1280. #define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_VALID BIT(3)
  1281. #define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_DEPTH_TYPE_MASK BIT(4)
  1282. #define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_DEPTH_TYPE_LSB 4
  1283. enum htt_q_depth_type {
  1284. HTT_Q_DEPTH_TYPE_BYTES = 0,
  1285. HTT_Q_DEPTH_TYPE_MSDUS = 1,
  1286. };
  1287. #define HTT_TX_Q_STATE_NUM_PEERS (TARGET_10_4_NUM_QCACHE_PEERS_MAX + \
  1288. TARGET_10_4_NUM_VDEVS)
  1289. #define HTT_TX_Q_STATE_NUM_TIDS 8
  1290. #define HTT_TX_Q_STATE_ENTRY_SIZE 1
  1291. #define HTT_TX_Q_STATE_ENTRY_MULTIPLIER 0
  1292. /**
  1293. * struct htt_q_state_conf - part of htt_frag_desc_bank_cfg for host q state config
  1294. *
  1295. * Defines host q state format and behavior. See htt_q_state.
  1296. *
  1297. * @paddr: Queue physical address
  1298. * @num_peers: Number of supported peers
  1299. * @num_tids: Number of supported TIDs
  1300. * @record_size: Defines the size of each host q entry in bytes. In practice
  1301. * however firmware (at least 10.4.3-00191) ignores this host
  1302. * configuration value and uses hardcoded value of 1.
  1303. * @record_multiplier: This is valid only when q depth type is MSDUs. It
  1304. * defines the exponent for the power of 2 multiplication.
  1305. * @pad: struct padding for 32-bit alignment
  1306. */
  1307. struct htt_q_state_conf {
  1308. __le32 paddr;
  1309. __le16 num_peers;
  1310. __le16 num_tids;
  1311. u8 record_size;
  1312. u8 record_multiplier;
  1313. u8 pad[2];
  1314. } __packed;
  1315. struct htt_frag_desc_bank_cfg32 {
  1316. u8 info; /* HTT_FRAG_DESC_BANK_CFG_INFO_ */
  1317. u8 num_banks;
  1318. u8 desc_size;
  1319. __le32 bank_base_addrs[HTT_FRAG_DESC_BANK_MAX];
  1320. struct htt_frag_desc_bank_id bank_id[HTT_FRAG_DESC_BANK_MAX];
  1321. struct htt_q_state_conf q_state;
  1322. } __packed;
  1323. struct htt_frag_desc_bank_cfg64 {
  1324. u8 info; /* HTT_FRAG_DESC_BANK_CFG_INFO_ */
  1325. u8 num_banks;
  1326. u8 desc_size;
  1327. __le64 bank_base_addrs[HTT_FRAG_DESC_BANK_MAX];
  1328. struct htt_frag_desc_bank_id bank_id[HTT_FRAG_DESC_BANK_MAX];
  1329. struct htt_q_state_conf q_state;
  1330. } __packed;
  1331. #define HTT_TX_Q_STATE_ENTRY_COEFFICIENT 128
  1332. #define HTT_TX_Q_STATE_ENTRY_FACTOR_MASK 0x3f
  1333. #define HTT_TX_Q_STATE_ENTRY_FACTOR_LSB 0
  1334. #define HTT_TX_Q_STATE_ENTRY_EXP_MASK 0xc0
  1335. #define HTT_TX_Q_STATE_ENTRY_EXP_LSB 6
  1336. /**
  1337. * struct htt_q_state - shared between host and firmware via DMA
  1338. *
  1339. * This structure is used for the host to expose it's software queue state to
  1340. * firmware so that its rate control can schedule fetch requests for optimized
  1341. * performance. This is most notably used for MU-MIMO aggregation when multiple
  1342. * MU clients are connected.
  1343. *
  1344. * @count: Each element defines the host queue depth. When q depth type was
  1345. * configured as HTT_Q_DEPTH_TYPE_BYTES then each entry is defined as:
  1346. * FACTOR * 128 * 8^EXP (see HTT_TX_Q_STATE_ENTRY_FACTOR_MASK and
  1347. * HTT_TX_Q_STATE_ENTRY_EXP_MASK). When q depth type was configured as
  1348. * HTT_Q_DEPTH_TYPE_MSDUS the number of packets is scaled by 2 **
  1349. * record_multiplier (see htt_q_state_conf).
  1350. * @map: Used by firmware to quickly check which host queues are not empty. It
  1351. * is a bitmap simply saying.
  1352. * @seq: Used by firmware to quickly check if the host queues were updated
  1353. * since it last checked.
  1354. *
  1355. * FIXME: Is the q_state map[] size calculation really correct?
  1356. */
  1357. struct htt_q_state {
  1358. u8 count[HTT_TX_Q_STATE_NUM_TIDS][HTT_TX_Q_STATE_NUM_PEERS];
  1359. u32 map[HTT_TX_Q_STATE_NUM_TIDS][(HTT_TX_Q_STATE_NUM_PEERS + 31) / 32];
  1360. __le32 seq;
  1361. } __packed;
  1362. #define HTT_TX_FETCH_RECORD_INFO_PEER_ID_MASK 0x0fff
  1363. #define HTT_TX_FETCH_RECORD_INFO_PEER_ID_LSB 0
  1364. #define HTT_TX_FETCH_RECORD_INFO_TID_MASK 0xf000
  1365. #define HTT_TX_FETCH_RECORD_INFO_TID_LSB 12
  1366. struct htt_tx_fetch_record {
  1367. __le16 info; /* HTT_TX_FETCH_IND_RECORD_INFO_ */
  1368. __le16 num_msdus;
  1369. __le32 num_bytes;
  1370. } __packed;
  1371. struct htt_tx_fetch_ind {
  1372. u8 pad0;
  1373. __le16 fetch_seq_num;
  1374. __le32 token;
  1375. __le16 num_resp_ids;
  1376. __le16 num_records;
  1377. union {
  1378. /* ath10k_htt_get_tx_fetch_ind_resp_ids() */
  1379. DECLARE_FLEX_ARRAY(__le32, resp_ids);
  1380. DECLARE_FLEX_ARRAY(struct htt_tx_fetch_record, records);
  1381. } __packed;
  1382. } __packed;
  1383. static inline void *
  1384. ath10k_htt_get_tx_fetch_ind_resp_ids(struct htt_tx_fetch_ind *ind)
  1385. {
  1386. return (void *)&ind->records[le16_to_cpu(ind->num_records)];
  1387. }
  1388. struct htt_tx_fetch_resp {
  1389. u8 pad0;
  1390. __le16 resp_id;
  1391. __le16 fetch_seq_num;
  1392. __le16 num_records;
  1393. __le32 token;
  1394. struct htt_tx_fetch_record records[];
  1395. } __packed;
  1396. struct htt_tx_fetch_confirm {
  1397. u8 pad0;
  1398. __le16 num_resp_ids;
  1399. __le32 resp_ids[];
  1400. } __packed;
  1401. enum htt_tx_mode_switch_mode {
  1402. HTT_TX_MODE_SWITCH_PUSH = 0,
  1403. HTT_TX_MODE_SWITCH_PUSH_PULL = 1,
  1404. };
  1405. #define HTT_TX_MODE_SWITCH_IND_INFO0_ENABLE BIT(0)
  1406. #define HTT_TX_MODE_SWITCH_IND_INFO0_NUM_RECORDS_MASK 0xfffe
  1407. #define HTT_TX_MODE_SWITCH_IND_INFO0_NUM_RECORDS_LSB 1
  1408. #define HTT_TX_MODE_SWITCH_IND_INFO1_MODE_MASK 0x0003
  1409. #define HTT_TX_MODE_SWITCH_IND_INFO1_MODE_LSB 0
  1410. #define HTT_TX_MODE_SWITCH_IND_INFO1_THRESHOLD_MASK 0xfffc
  1411. #define HTT_TX_MODE_SWITCH_IND_INFO1_THRESHOLD_LSB 2
  1412. #define HTT_TX_MODE_SWITCH_RECORD_INFO0_PEER_ID_MASK 0x0fff
  1413. #define HTT_TX_MODE_SWITCH_RECORD_INFO0_PEER_ID_LSB 0
  1414. #define HTT_TX_MODE_SWITCH_RECORD_INFO0_TID_MASK 0xf000
  1415. #define HTT_TX_MODE_SWITCH_RECORD_INFO0_TID_LSB 12
  1416. struct htt_tx_mode_switch_record {
  1417. __le16 info0; /* HTT_TX_MODE_SWITCH_RECORD_INFO0_ */
  1418. __le16 num_max_msdus;
  1419. } __packed;
  1420. struct htt_tx_mode_switch_ind {
  1421. u8 pad0;
  1422. __le16 info0; /* HTT_TX_MODE_SWITCH_IND_INFO0_ */
  1423. __le16 info1; /* HTT_TX_MODE_SWITCH_IND_INFO1_ */
  1424. u8 pad1[2];
  1425. struct htt_tx_mode_switch_record records[];
  1426. } __packed;
  1427. struct htt_channel_change {
  1428. u8 pad[3];
  1429. __le32 freq;
  1430. __le32 center_freq1;
  1431. __le32 center_freq2;
  1432. __le32 phymode;
  1433. } __packed;
  1434. struct htt_per_peer_tx_stats_ind {
  1435. __le32 succ_bytes;
  1436. __le32 retry_bytes;
  1437. __le32 failed_bytes;
  1438. u8 ratecode;
  1439. u8 flags;
  1440. __le16 peer_id;
  1441. __le16 succ_pkts;
  1442. __le16 retry_pkts;
  1443. __le16 failed_pkts;
  1444. __le16 tx_duration;
  1445. __le32 reserved1;
  1446. __le32 reserved2;
  1447. } __packed;
  1448. struct htt_peer_tx_stats {
  1449. u8 num_ppdu;
  1450. u8 ppdu_len;
  1451. u8 version;
  1452. u8 payload[];
  1453. } __packed;
  1454. #define ATH10K_10_2_TX_STATS_OFFSET 136
  1455. #define PEER_STATS_FOR_NO_OF_PPDUS 4
  1456. struct ath10k_10_2_peer_tx_stats {
  1457. u8 ratecode[PEER_STATS_FOR_NO_OF_PPDUS];
  1458. u8 success_pkts[PEER_STATS_FOR_NO_OF_PPDUS];
  1459. __le16 success_bytes[PEER_STATS_FOR_NO_OF_PPDUS];
  1460. u8 retry_pkts[PEER_STATS_FOR_NO_OF_PPDUS];
  1461. __le16 retry_bytes[PEER_STATS_FOR_NO_OF_PPDUS];
  1462. u8 failed_pkts[PEER_STATS_FOR_NO_OF_PPDUS];
  1463. __le16 failed_bytes[PEER_STATS_FOR_NO_OF_PPDUS];
  1464. u8 flags[PEER_STATS_FOR_NO_OF_PPDUS];
  1465. __le32 tx_duration;
  1466. u8 tx_ppdu_cnt;
  1467. u8 peer_id;
  1468. } __packed;
  1469. union htt_rx_pn_t {
  1470. /* WEP: 24-bit PN */
  1471. u32 pn24;
  1472. /* TKIP or CCMP: 48-bit PN */
  1473. u64 pn48;
  1474. /* WAPI: 128-bit PN */
  1475. u64 pn128[2];
  1476. };
  1477. struct htt_cmd {
  1478. struct htt_cmd_hdr hdr;
  1479. union {
  1480. struct htt_ver_req ver_req;
  1481. struct htt_mgmt_tx_desc mgmt_tx;
  1482. struct htt_data_tx_desc data_tx;
  1483. struct htt_rx_ring_setup_32 rx_setup_32;
  1484. struct htt_rx_ring_setup_64 rx_setup_64;
  1485. struct htt_stats_req stats_req;
  1486. struct htt_oob_sync_req oob_sync_req;
  1487. struct htt_aggr_conf aggr_conf;
  1488. struct htt_aggr_conf_v2 aggr_conf_v2;
  1489. struct htt_frag_desc_bank_cfg32 frag_desc_bank_cfg32;
  1490. struct htt_frag_desc_bank_cfg64 frag_desc_bank_cfg64;
  1491. struct htt_tx_fetch_resp tx_fetch_resp;
  1492. };
  1493. } __packed;
  1494. struct htt_resp {
  1495. struct htt_resp_hdr hdr;
  1496. union {
  1497. struct htt_ver_resp ver_resp;
  1498. struct htt_mgmt_tx_completion mgmt_tx_completion;
  1499. struct htt_data_tx_completion data_tx_completion;
  1500. struct htt_rx_indication rx_ind;
  1501. struct htt_rx_indication_hl rx_ind_hl;
  1502. struct htt_rx_fragment_indication rx_frag_ind;
  1503. struct htt_rx_peer_map peer_map;
  1504. struct htt_rx_peer_unmap peer_unmap;
  1505. struct htt_rx_flush rx_flush;
  1506. struct htt_rx_addba rx_addba;
  1507. struct htt_rx_delba rx_delba;
  1508. struct htt_security_indication security_indication;
  1509. struct htt_rc_update rc_update;
  1510. struct htt_rx_test rx_test;
  1511. struct htt_pktlog_msg pktlog_msg;
  1512. struct htt_rx_pn_ind rx_pn_ind;
  1513. struct htt_rx_offload_ind rx_offload_ind;
  1514. struct htt_rx_in_ord_ind rx_in_ord_ind;
  1515. struct htt_tx_fetch_ind tx_fetch_ind;
  1516. struct htt_tx_fetch_confirm tx_fetch_confirm;
  1517. struct htt_tx_mode_switch_ind tx_mode_switch_ind;
  1518. struct htt_channel_change chan_change;
  1519. struct htt_peer_tx_stats peer_tx_stats;
  1520. } __packed;
  1521. } __packed;
  1522. /*** host side structures follow ***/
  1523. struct htt_tx_done {
  1524. u16 msdu_id;
  1525. u16 status;
  1526. u8 ack_rssi;
  1527. };
  1528. enum htt_tx_compl_state {
  1529. HTT_TX_COMPL_STATE_NONE,
  1530. HTT_TX_COMPL_STATE_ACK,
  1531. HTT_TX_COMPL_STATE_NOACK,
  1532. HTT_TX_COMPL_STATE_DISCARD,
  1533. };
  1534. struct htt_peer_map_event {
  1535. u8 vdev_id;
  1536. u16 peer_id;
  1537. u8 addr[ETH_ALEN];
  1538. };
  1539. struct htt_peer_unmap_event {
  1540. u16 peer_id;
  1541. };
  1542. struct ath10k_htt_txbuf_32 {
  1543. struct htt_data_tx_desc_frag frags[2];
  1544. struct ath10k_htc_hdr htc_hdr;
  1545. struct htt_cmd_hdr cmd_hdr;
  1546. struct htt_data_tx_desc cmd_tx;
  1547. } __packed __aligned(4);
  1548. struct ath10k_htt_txbuf_64 {
  1549. struct htt_data_tx_desc_frag frags[2];
  1550. struct ath10k_htc_hdr htc_hdr;
  1551. struct htt_cmd_hdr cmd_hdr;
  1552. struct htt_data_tx_desc_64 cmd_tx;
  1553. } __packed __aligned(4);
  1554. struct ath10k_htt {
  1555. struct ath10k *ar;
  1556. enum ath10k_htc_ep_id eid;
  1557. struct sk_buff_head rx_indication_head;
  1558. u8 target_version_major;
  1559. u8 target_version_minor;
  1560. struct completion target_version_received;
  1561. u8 max_num_amsdu;
  1562. u8 max_num_ampdu;
  1563. const enum htt_t2h_msg_type *t2h_msg_types;
  1564. u32 t2h_msg_types_max;
  1565. struct {
  1566. /*
  1567. * Ring of network buffer objects - This ring is
  1568. * used exclusively by the host SW. This ring
  1569. * mirrors the dev_addrs_ring that is shared
  1570. * between the host SW and the MAC HW. The host SW
  1571. * uses this netbufs ring to locate the network
  1572. * buffer objects whose data buffers the HW has
  1573. * filled.
  1574. */
  1575. struct sk_buff **netbufs_ring;
  1576. /* This is used only with firmware supporting IN_ORD_IND.
  1577. *
  1578. * With Full Rx Reorder the HTT Rx Ring is more of a temporary
  1579. * buffer ring from which buffer addresses are copied by the
  1580. * firmware to MAC Rx ring. Firmware then delivers IN_ORD_IND
  1581. * pointing to specific (re-ordered) buffers.
  1582. *
  1583. * FIXME: With kernel generic hashing functions there's a lot
  1584. * of hash collisions for sk_buffs.
  1585. */
  1586. bool in_ord_rx;
  1587. DECLARE_HASHTABLE(skb_table, 4);
  1588. /*
  1589. * Ring of buffer addresses -
  1590. * This ring holds the "physical" device address of the
  1591. * rx buffers the host SW provides for the MAC HW to
  1592. * fill.
  1593. */
  1594. union {
  1595. __le64 *paddrs_ring_64;
  1596. __le32 *paddrs_ring_32;
  1597. };
  1598. /*
  1599. * Base address of ring, as a "physical" device address
  1600. * rather than a CPU address.
  1601. */
  1602. dma_addr_t base_paddr;
  1603. /* how many elems in the ring (power of 2) */
  1604. int size;
  1605. /* size - 1 */
  1606. unsigned int size_mask;
  1607. /* how many rx buffers to keep in the ring */
  1608. int fill_level;
  1609. /* how many rx buffers (full+empty) are in the ring */
  1610. int fill_cnt;
  1611. /*
  1612. * alloc_idx - where HTT SW has deposited empty buffers
  1613. * This is allocated in consistent mem, so that the FW can
  1614. * read this variable, and program the HW's FW_IDX reg with
  1615. * the value of this shadow register.
  1616. */
  1617. struct {
  1618. __le32 *vaddr;
  1619. dma_addr_t paddr;
  1620. } alloc_idx;
  1621. /* where HTT SW has processed bufs filled by rx MAC DMA */
  1622. struct {
  1623. unsigned int msdu_payld;
  1624. } sw_rd_idx;
  1625. /*
  1626. * refill_retry_timer - timer triggered when the ring is
  1627. * not refilled to the level expected
  1628. */
  1629. struct timer_list refill_retry_timer;
  1630. /* Protects access to all rx ring buffer state variables */
  1631. spinlock_t lock;
  1632. } rx_ring;
  1633. unsigned int prefetch_len;
  1634. /* Protects access to pending_tx, num_pending_tx */
  1635. spinlock_t tx_lock;
  1636. int max_num_pending_tx;
  1637. int num_pending_tx;
  1638. int num_pending_mgmt_tx;
  1639. struct idr pending_tx;
  1640. wait_queue_head_t empty_tx_wq;
  1641. /* FIFO for storing tx done status {ack, no-ack, discard} and msdu id */
  1642. DECLARE_KFIFO_PTR(txdone_fifo, struct htt_tx_done);
  1643. /* set if host-fw communication goes haywire
  1644. * used to avoid further failures
  1645. */
  1646. bool rx_confused;
  1647. atomic_t num_mpdus_ready;
  1648. /* This is used to group tx/rx completions separately and process them
  1649. * in batches to reduce cache stalls
  1650. */
  1651. struct sk_buff_head rx_msdus_q;
  1652. struct sk_buff_head rx_in_ord_compl_q;
  1653. struct sk_buff_head tx_fetch_ind_q;
  1654. /* rx_status template */
  1655. struct ieee80211_rx_status rx_status;
  1656. struct {
  1657. dma_addr_t paddr;
  1658. union {
  1659. struct htt_msdu_ext_desc *vaddr_desc_32;
  1660. struct htt_msdu_ext_desc_64 *vaddr_desc_64;
  1661. };
  1662. size_t size;
  1663. } frag_desc;
  1664. struct {
  1665. dma_addr_t paddr;
  1666. union {
  1667. struct ath10k_htt_txbuf_32 *vaddr_txbuff_32;
  1668. struct ath10k_htt_txbuf_64 *vaddr_txbuff_64;
  1669. };
  1670. size_t size;
  1671. } txbuf;
  1672. struct {
  1673. bool enabled;
  1674. struct htt_q_state *vaddr;
  1675. dma_addr_t paddr;
  1676. u16 num_push_allowed;
  1677. u16 num_peers;
  1678. u16 num_tids;
  1679. enum htt_tx_mode_switch_mode mode;
  1680. enum htt_q_depth_type type;
  1681. } tx_q_state;
  1682. bool tx_mem_allocated;
  1683. const struct ath10k_htt_tx_ops *tx_ops;
  1684. const struct ath10k_htt_rx_ops *rx_ops;
  1685. bool disable_tx_comp;
  1686. bool bundle_tx;
  1687. struct sk_buff_head tx_req_head;
  1688. struct sk_buff_head tx_complete_head;
  1689. };
  1690. struct ath10k_htt_tx_ops {
  1691. int (*htt_send_rx_ring_cfg)(struct ath10k_htt *htt);
  1692. int (*htt_send_frag_desc_bank_cfg)(struct ath10k_htt *htt);
  1693. int (*htt_alloc_frag_desc)(struct ath10k_htt *htt);
  1694. void (*htt_free_frag_desc)(struct ath10k_htt *htt);
  1695. int (*htt_tx)(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode,
  1696. struct sk_buff *msdu);
  1697. int (*htt_alloc_txbuff)(struct ath10k_htt *htt);
  1698. void (*htt_free_txbuff)(struct ath10k_htt *htt);
  1699. int (*htt_h2t_aggr_cfg_msg)(struct ath10k_htt *htt,
  1700. u8 max_subfrms_ampdu,
  1701. u8 max_subfrms_amsdu);
  1702. void (*htt_flush_tx)(struct ath10k_htt *htt);
  1703. };
  1704. static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt)
  1705. {
  1706. if (!htt->tx_ops->htt_send_rx_ring_cfg)
  1707. return -EOPNOTSUPP;
  1708. return htt->tx_ops->htt_send_rx_ring_cfg(htt);
  1709. }
  1710. static inline int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt)
  1711. {
  1712. if (!htt->tx_ops->htt_send_frag_desc_bank_cfg)
  1713. return -EOPNOTSUPP;
  1714. return htt->tx_ops->htt_send_frag_desc_bank_cfg(htt);
  1715. }
  1716. static inline int ath10k_htt_alloc_frag_desc(struct ath10k_htt *htt)
  1717. {
  1718. if (!htt->tx_ops->htt_alloc_frag_desc)
  1719. return -EOPNOTSUPP;
  1720. return htt->tx_ops->htt_alloc_frag_desc(htt);
  1721. }
  1722. static inline void ath10k_htt_free_frag_desc(struct ath10k_htt *htt)
  1723. {
  1724. if (htt->tx_ops->htt_free_frag_desc)
  1725. htt->tx_ops->htt_free_frag_desc(htt);
  1726. }
  1727. static inline int ath10k_htt_tx(struct ath10k_htt *htt,
  1728. enum ath10k_hw_txrx_mode txmode,
  1729. struct sk_buff *msdu)
  1730. {
  1731. return htt->tx_ops->htt_tx(htt, txmode, msdu);
  1732. }
  1733. static inline void ath10k_htt_flush_tx(struct ath10k_htt *htt)
  1734. {
  1735. if (htt->tx_ops->htt_flush_tx)
  1736. htt->tx_ops->htt_flush_tx(htt);
  1737. }
  1738. static inline int ath10k_htt_alloc_txbuff(struct ath10k_htt *htt)
  1739. {
  1740. if (!htt->tx_ops->htt_alloc_txbuff)
  1741. return -EOPNOTSUPP;
  1742. return htt->tx_ops->htt_alloc_txbuff(htt);
  1743. }
  1744. static inline void ath10k_htt_free_txbuff(struct ath10k_htt *htt)
  1745. {
  1746. if (htt->tx_ops->htt_free_txbuff)
  1747. htt->tx_ops->htt_free_txbuff(htt);
  1748. }
  1749. static inline int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
  1750. u8 max_subfrms_ampdu,
  1751. u8 max_subfrms_amsdu)
  1752. {
  1753. if (!htt->tx_ops->htt_h2t_aggr_cfg_msg)
  1754. return -EOPNOTSUPP;
  1755. return htt->tx_ops->htt_h2t_aggr_cfg_msg(htt,
  1756. max_subfrms_ampdu,
  1757. max_subfrms_amsdu);
  1758. }
  1759. struct ath10k_htt_rx_ops {
  1760. size_t (*htt_get_rx_ring_size)(struct ath10k_htt *htt);
  1761. void (*htt_config_paddrs_ring)(struct ath10k_htt *htt, void *vaddr);
  1762. void (*htt_set_paddrs_ring)(struct ath10k_htt *htt, dma_addr_t paddr,
  1763. int idx);
  1764. void* (*htt_get_vaddr_ring)(struct ath10k_htt *htt);
  1765. void (*htt_reset_paddrs_ring)(struct ath10k_htt *htt, int idx);
  1766. bool (*htt_rx_proc_rx_frag_ind)(struct ath10k_htt *htt,
  1767. struct htt_rx_fragment_indication *rx,
  1768. struct sk_buff *skb);
  1769. };
  1770. static inline size_t ath10k_htt_get_rx_ring_size(struct ath10k_htt *htt)
  1771. {
  1772. if (!htt->rx_ops->htt_get_rx_ring_size)
  1773. return 0;
  1774. return htt->rx_ops->htt_get_rx_ring_size(htt);
  1775. }
  1776. static inline void ath10k_htt_config_paddrs_ring(struct ath10k_htt *htt,
  1777. void *vaddr)
  1778. {
  1779. if (htt->rx_ops->htt_config_paddrs_ring)
  1780. htt->rx_ops->htt_config_paddrs_ring(htt, vaddr);
  1781. }
  1782. static inline void ath10k_htt_set_paddrs_ring(struct ath10k_htt *htt,
  1783. dma_addr_t paddr,
  1784. int idx)
  1785. {
  1786. if (htt->rx_ops->htt_set_paddrs_ring)
  1787. htt->rx_ops->htt_set_paddrs_ring(htt, paddr, idx);
  1788. }
  1789. static inline void *ath10k_htt_get_vaddr_ring(struct ath10k_htt *htt)
  1790. {
  1791. if (!htt->rx_ops->htt_get_vaddr_ring)
  1792. return NULL;
  1793. return htt->rx_ops->htt_get_vaddr_ring(htt);
  1794. }
  1795. static inline void ath10k_htt_reset_paddrs_ring(struct ath10k_htt *htt, int idx)
  1796. {
  1797. if (htt->rx_ops->htt_reset_paddrs_ring)
  1798. htt->rx_ops->htt_reset_paddrs_ring(htt, idx);
  1799. }
  1800. static inline bool ath10k_htt_rx_proc_rx_frag_ind(struct ath10k_htt *htt,
  1801. struct htt_rx_fragment_indication *rx,
  1802. struct sk_buff *skb)
  1803. {
  1804. if (!htt->rx_ops->htt_rx_proc_rx_frag_ind)
  1805. return true;
  1806. return htt->rx_ops->htt_rx_proc_rx_frag_ind(htt, rx, skb);
  1807. }
  1808. /* the driver strongly assumes that the rx header status be 64 bytes long,
  1809. * so all possible rx_desc structures must respect this assumption.
  1810. */
  1811. #define RX_HTT_HDR_STATUS_LEN 64
  1812. /* The rx descriptor structure layout is programmed via rx ring setup
  1813. * so that FW knows how to transfer the rx descriptor to the host.
  1814. * Unfortunately, though, QCA6174's firmware doesn't currently behave correctly
  1815. * when modifying the structure layout of the rx descriptor beyond what it expects
  1816. * (even if it correctly programmed during the rx ring setup).
  1817. * Therefore we must keep two different memory layouts, abstract the rx descriptor
  1818. * representation and use ath10k_rx_desc_ops
  1819. * for correctly accessing rx descriptor data.
  1820. */
  1821. /* base struct used for abstracting the rx descriptor representation */
  1822. struct htt_rx_desc {
  1823. union {
  1824. /* This field is filled on the host using the msdu buffer
  1825. * from htt_rx_indication
  1826. */
  1827. struct fw_rx_desc_base fw_desc;
  1828. u32 pad;
  1829. } __packed;
  1830. } __packed;
  1831. /* rx descriptor for wcn3990 and possibly extensible for newer cards
  1832. * Buffers like this are placed on the rx ring.
  1833. */
  1834. struct htt_rx_desc_v2 {
  1835. struct htt_rx_desc base;
  1836. struct {
  1837. struct rx_attention attention;
  1838. struct rx_frag_info frag_info;
  1839. struct rx_mpdu_start mpdu_start;
  1840. struct rx_msdu_start msdu_start;
  1841. struct rx_msdu_end msdu_end;
  1842. struct rx_mpdu_end mpdu_end;
  1843. struct rx_ppdu_start ppdu_start;
  1844. struct rx_ppdu_end ppdu_end;
  1845. } __packed;
  1846. u8 rx_hdr_status[RX_HTT_HDR_STATUS_LEN];
  1847. u8 msdu_payload[];
  1848. };
  1849. /* QCA6174, QCA988x, QCA99x0 dedicated rx descriptor to make sure their firmware
  1850. * works correctly. We keep a single rx descriptor for all these three
  1851. * families of cards because from tests it seems to be the most stable solution,
  1852. * e.g. having a rx descriptor only for QCA6174 seldom caused firmware crashes
  1853. * during some tests.
  1854. * Buffers like this are placed on the rx ring.
  1855. */
  1856. struct htt_rx_desc_v1 {
  1857. struct htt_rx_desc base;
  1858. struct {
  1859. struct rx_attention attention;
  1860. struct rx_frag_info_v1 frag_info;
  1861. struct rx_mpdu_start mpdu_start;
  1862. struct rx_msdu_start_v1 msdu_start;
  1863. struct rx_msdu_end_v1 msdu_end;
  1864. struct rx_mpdu_end mpdu_end;
  1865. struct rx_ppdu_start ppdu_start;
  1866. struct rx_ppdu_end_v1 ppdu_end;
  1867. } __packed;
  1868. u8 rx_hdr_status[RX_HTT_HDR_STATUS_LEN];
  1869. u8 msdu_payload[];
  1870. };
  1871. /* rx_desc abstraction */
  1872. struct ath10k_htt_rx_desc_ops {
  1873. /* These fields are mandatory, they must be specified in any instance */
  1874. /* sizeof() of the rx_desc structure used by this hw */
  1875. size_t rx_desc_size;
  1876. /* offset of msdu_payload inside the rx_desc structure used by this hw */
  1877. size_t rx_desc_msdu_payload_offset;
  1878. /* These fields are options.
  1879. * When a field is not provided the default implementation gets used
  1880. * (see the ath10k_rx_desc_* operations below for more info about the defaults)
  1881. */
  1882. bool (*rx_desc_get_msdu_limit_error)(struct htt_rx_desc *rxd);
  1883. int (*rx_desc_get_l3_pad_bytes)(struct htt_rx_desc *rxd);
  1884. /* Safely cast from a void* buffer containing an rx descriptor
  1885. * to the proper rx_desc structure
  1886. */
  1887. struct htt_rx_desc *(*rx_desc_from_raw_buffer)(void *buff);
  1888. void (*rx_desc_get_offsets)(struct htt_rx_ring_rx_desc_offsets *offs);
  1889. struct rx_attention *(*rx_desc_get_attention)(struct htt_rx_desc *rxd);
  1890. struct rx_frag_info_common *(*rx_desc_get_frag_info)(struct htt_rx_desc *rxd);
  1891. struct rx_mpdu_start *(*rx_desc_get_mpdu_start)(struct htt_rx_desc *rxd);
  1892. struct rx_mpdu_end *(*rx_desc_get_mpdu_end)(struct htt_rx_desc *rxd);
  1893. struct rx_msdu_start_common *(*rx_desc_get_msdu_start)(struct htt_rx_desc *rxd);
  1894. struct rx_msdu_end_common *(*rx_desc_get_msdu_end)(struct htt_rx_desc *rxd);
  1895. struct rx_ppdu_start *(*rx_desc_get_ppdu_start)(struct htt_rx_desc *rxd);
  1896. struct rx_ppdu_end_common *(*rx_desc_get_ppdu_end)(struct htt_rx_desc *rxd);
  1897. u8 *(*rx_desc_get_rx_hdr_status)(struct htt_rx_desc *rxd);
  1898. u8 *(*rx_desc_get_msdu_payload)(struct htt_rx_desc *rxd);
  1899. };
  1900. extern const struct ath10k_htt_rx_desc_ops qca988x_rx_desc_ops;
  1901. extern const struct ath10k_htt_rx_desc_ops qca99x0_rx_desc_ops;
  1902. extern const struct ath10k_htt_rx_desc_ops wcn3990_rx_desc_ops;
  1903. static inline int
  1904. ath10k_htt_rx_desc_get_l3_pad_bytes(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  1905. {
  1906. if (hw->rx_desc_ops->rx_desc_get_l3_pad_bytes)
  1907. return hw->rx_desc_ops->rx_desc_get_l3_pad_bytes(rxd);
  1908. return 0;
  1909. }
  1910. static inline bool
  1911. ath10k_htt_rx_desc_msdu_limit_error(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  1912. {
  1913. if (hw->rx_desc_ops->rx_desc_get_msdu_limit_error)
  1914. return hw->rx_desc_ops->rx_desc_get_msdu_limit_error(rxd);
  1915. return false;
  1916. }
  1917. /* The default implementation of all these getters is using the old rx_desc,
  1918. * so that it is easier to define the ath10k_htt_rx_desc_ops instances.
  1919. * But probably, if new wireless cards must be supported, it would be better
  1920. * to switch the default implementation to the new rx_desc, since this would
  1921. * make the extension easier .
  1922. */
  1923. static inline struct htt_rx_desc *
  1924. ath10k_htt_rx_desc_from_raw_buffer(struct ath10k_hw_params *hw, void *buff)
  1925. {
  1926. if (hw->rx_desc_ops->rx_desc_from_raw_buffer)
  1927. return hw->rx_desc_ops->rx_desc_from_raw_buffer(buff);
  1928. return &((struct htt_rx_desc_v1 *)buff)->base;
  1929. }
  1930. static inline void
  1931. ath10k_htt_rx_desc_get_offsets(struct ath10k_hw_params *hw,
  1932. struct htt_rx_ring_rx_desc_offsets *off)
  1933. {
  1934. if (hw->rx_desc_ops->rx_desc_get_offsets) {
  1935. hw->rx_desc_ops->rx_desc_get_offsets(off);
  1936. } else {
  1937. #define desc_offset(x) (offsetof(struct htt_rx_desc_v1, x) / 4)
  1938. off->mac80211_hdr_offset = __cpu_to_le16(desc_offset(rx_hdr_status));
  1939. off->msdu_payload_offset = __cpu_to_le16(desc_offset(msdu_payload));
  1940. off->ppdu_start_offset = __cpu_to_le16(desc_offset(ppdu_start));
  1941. off->ppdu_end_offset = __cpu_to_le16(desc_offset(ppdu_end));
  1942. off->mpdu_start_offset = __cpu_to_le16(desc_offset(mpdu_start));
  1943. off->mpdu_end_offset = __cpu_to_le16(desc_offset(mpdu_end));
  1944. off->msdu_start_offset = __cpu_to_le16(desc_offset(msdu_start));
  1945. off->msdu_end_offset = __cpu_to_le16(desc_offset(msdu_end));
  1946. off->rx_attention_offset = __cpu_to_le16(desc_offset(attention));
  1947. off->frag_info_offset = __cpu_to_le16(desc_offset(frag_info));
  1948. #undef desc_offset
  1949. }
  1950. }
  1951. static inline struct rx_attention *
  1952. ath10k_htt_rx_desc_get_attention(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  1953. {
  1954. struct htt_rx_desc_v1 *rx_desc;
  1955. if (hw->rx_desc_ops->rx_desc_get_attention)
  1956. return hw->rx_desc_ops->rx_desc_get_attention(rxd);
  1957. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  1958. return &rx_desc->attention;
  1959. }
  1960. static inline struct rx_frag_info_common *
  1961. ath10k_htt_rx_desc_get_frag_info(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  1962. {
  1963. struct htt_rx_desc_v1 *rx_desc;
  1964. if (hw->rx_desc_ops->rx_desc_get_frag_info)
  1965. return hw->rx_desc_ops->rx_desc_get_frag_info(rxd);
  1966. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  1967. return &rx_desc->frag_info.common;
  1968. }
  1969. static inline struct rx_mpdu_start *
  1970. ath10k_htt_rx_desc_get_mpdu_start(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  1971. {
  1972. struct htt_rx_desc_v1 *rx_desc;
  1973. if (hw->rx_desc_ops->rx_desc_get_mpdu_start)
  1974. return hw->rx_desc_ops->rx_desc_get_mpdu_start(rxd);
  1975. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  1976. return &rx_desc->mpdu_start;
  1977. }
  1978. static inline struct rx_mpdu_end *
  1979. ath10k_htt_rx_desc_get_mpdu_end(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  1980. {
  1981. struct htt_rx_desc_v1 *rx_desc;
  1982. if (hw->rx_desc_ops->rx_desc_get_mpdu_end)
  1983. return hw->rx_desc_ops->rx_desc_get_mpdu_end(rxd);
  1984. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  1985. return &rx_desc->mpdu_end;
  1986. }
  1987. static inline struct rx_msdu_start_common *
  1988. ath10k_htt_rx_desc_get_msdu_start(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  1989. {
  1990. struct htt_rx_desc_v1 *rx_desc;
  1991. if (hw->rx_desc_ops->rx_desc_get_msdu_start)
  1992. return hw->rx_desc_ops->rx_desc_get_msdu_start(rxd);
  1993. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  1994. return &rx_desc->msdu_start.common;
  1995. }
  1996. static inline struct rx_msdu_end_common *
  1997. ath10k_htt_rx_desc_get_msdu_end(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  1998. {
  1999. struct htt_rx_desc_v1 *rx_desc;
  2000. if (hw->rx_desc_ops->rx_desc_get_msdu_end)
  2001. return hw->rx_desc_ops->rx_desc_get_msdu_end(rxd);
  2002. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  2003. return &rx_desc->msdu_end.common;
  2004. }
  2005. static inline struct rx_ppdu_start *
  2006. ath10k_htt_rx_desc_get_ppdu_start(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  2007. {
  2008. struct htt_rx_desc_v1 *rx_desc;
  2009. if (hw->rx_desc_ops->rx_desc_get_ppdu_start)
  2010. return hw->rx_desc_ops->rx_desc_get_ppdu_start(rxd);
  2011. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  2012. return &rx_desc->ppdu_start;
  2013. }
  2014. static inline struct rx_ppdu_end_common *
  2015. ath10k_htt_rx_desc_get_ppdu_end(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  2016. {
  2017. struct htt_rx_desc_v1 *rx_desc;
  2018. if (hw->rx_desc_ops->rx_desc_get_ppdu_end)
  2019. return hw->rx_desc_ops->rx_desc_get_ppdu_end(rxd);
  2020. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  2021. return &rx_desc->ppdu_end.common;
  2022. }
  2023. static inline u8 *
  2024. ath10k_htt_rx_desc_get_rx_hdr_status(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  2025. {
  2026. struct htt_rx_desc_v1 *rx_desc;
  2027. if (hw->rx_desc_ops->rx_desc_get_rx_hdr_status)
  2028. return hw->rx_desc_ops->rx_desc_get_rx_hdr_status(rxd);
  2029. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  2030. return rx_desc->rx_hdr_status;
  2031. }
  2032. static inline u8 *
  2033. ath10k_htt_rx_desc_get_msdu_payload(struct ath10k_hw_params *hw, struct htt_rx_desc *rxd)
  2034. {
  2035. struct htt_rx_desc_v1 *rx_desc;
  2036. if (hw->rx_desc_ops->rx_desc_get_msdu_payload)
  2037. return hw->rx_desc_ops->rx_desc_get_msdu_payload(rxd);
  2038. rx_desc = container_of(rxd, struct htt_rx_desc_v1, base);
  2039. return rx_desc->msdu_payload;
  2040. }
  2041. #define HTT_RX_DESC_HL_INFO_SEQ_NUM_MASK 0x00000fff
  2042. #define HTT_RX_DESC_HL_INFO_SEQ_NUM_LSB 0
  2043. #define HTT_RX_DESC_HL_INFO_ENCRYPTED_MASK 0x00001000
  2044. #define HTT_RX_DESC_HL_INFO_ENCRYPTED_LSB 12
  2045. #define HTT_RX_DESC_HL_INFO_CHAN_INFO_PRESENT_MASK 0x00002000
  2046. #define HTT_RX_DESC_HL_INFO_CHAN_INFO_PRESENT_LSB 13
  2047. #define HTT_RX_DESC_HL_INFO_MCAST_BCAST_MASK 0x00010000
  2048. #define HTT_RX_DESC_HL_INFO_MCAST_BCAST_LSB 16
  2049. #define HTT_RX_DESC_HL_INFO_KEY_ID_OCT_MASK 0x01fe0000
  2050. #define HTT_RX_DESC_HL_INFO_KEY_ID_OCT_LSB 17
  2051. struct htt_rx_desc_base_hl {
  2052. __le32 info; /* HTT_RX_DESC_HL_INFO_ */
  2053. };
  2054. struct htt_rx_chan_info {
  2055. __le16 primary_chan_center_freq_mhz;
  2056. __le16 contig_chan1_center_freq_mhz;
  2057. __le16 contig_chan2_center_freq_mhz;
  2058. u8 phy_mode;
  2059. u8 reserved;
  2060. } __packed;
  2061. #define HTT_RX_DESC_ALIGN 8
  2062. #define HTT_MAC_ADDR_LEN 6
  2063. /*
  2064. * FIX THIS
  2065. * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size,
  2066. * rounded up to a cache line size.
  2067. */
  2068. #define HTT_RX_BUF_SIZE 2048
  2069. /* The HTT_RX_MSDU_SIZE can't be statically computed anymore,
  2070. * because it depends on the underlying device rx_desc representation
  2071. */
  2072. static inline int ath10k_htt_rx_msdu_size(struct ath10k_hw_params *hw)
  2073. {
  2074. return HTT_RX_BUF_SIZE - (int)hw->rx_desc_ops->rx_desc_size;
  2075. }
  2076. /* Refill a bunch of RX buffers for each refill round so that FW/HW can handle
  2077. * aggregated traffic more nicely.
  2078. */
  2079. #define ATH10K_HTT_MAX_NUM_REFILL 100
  2080. /*
  2081. * DMA_MAP expects the buffer to be an integral number of cache lines.
  2082. * Rather than checking the actual cache line size, this code makes a
  2083. * conservative estimate of what the cache line size could be.
  2084. */
  2085. #define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */
  2086. #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1)
  2087. /* These values are default in most firmware revisions and apparently are a
  2088. * sweet spot performance wise.
  2089. */
  2090. #define ATH10K_HTT_MAX_NUM_AMSDU_DEFAULT 3
  2091. #define ATH10K_HTT_MAX_NUM_AMPDU_DEFAULT 64
  2092. int ath10k_htt_connect(struct ath10k_htt *htt);
  2093. int ath10k_htt_init(struct ath10k *ar);
  2094. int ath10k_htt_setup(struct ath10k_htt *htt);
  2095. int ath10k_htt_tx_start(struct ath10k_htt *htt);
  2096. void ath10k_htt_tx_stop(struct ath10k_htt *htt);
  2097. void ath10k_htt_tx_destroy(struct ath10k_htt *htt);
  2098. void ath10k_htt_tx_free(struct ath10k_htt *htt);
  2099. int ath10k_htt_rx_alloc(struct ath10k_htt *htt);
  2100. int ath10k_htt_rx_ring_refill(struct ath10k *ar);
  2101. void ath10k_htt_rx_free(struct ath10k_htt *htt);
  2102. void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb);
  2103. void ath10k_htt_htc_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
  2104. bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
  2105. int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt);
  2106. int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u32 reset_mask,
  2107. u64 cookie);
  2108. void ath10k_htt_hif_tx_complete(struct ath10k *ar, struct sk_buff *skb);
  2109. int ath10k_htt_tx_fetch_resp(struct ath10k *ar,
  2110. __le32 token,
  2111. __le16 fetch_seq_num,
  2112. struct htt_tx_fetch_record *records,
  2113. size_t num_records);
  2114. void ath10k_htt_op_ep_tx_credits(struct ath10k *ar);
  2115. void ath10k_htt_tx_txq_update(struct ieee80211_hw *hw,
  2116. struct ieee80211_txq *txq);
  2117. void ath10k_htt_tx_txq_recalc(struct ieee80211_hw *hw,
  2118. struct ieee80211_txq *txq);
  2119. void ath10k_htt_tx_txq_sync(struct ath10k *ar);
  2120. void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt);
  2121. int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt);
  2122. void ath10k_htt_tx_mgmt_dec_pending(struct ath10k_htt *htt);
  2123. int ath10k_htt_tx_mgmt_inc_pending(struct ath10k_htt *htt, bool is_mgmt,
  2124. bool is_presp);
  2125. int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb);
  2126. void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id);
  2127. int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu);
  2128. void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
  2129. struct sk_buff *skb);
  2130. int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget);
  2131. int ath10k_htt_rx_hl_indication(struct ath10k *ar, int budget);
  2132. void ath10k_htt_set_tx_ops(struct ath10k_htt *htt);
  2133. void ath10k_htt_set_rx_ops(struct ath10k_htt *htt);
  2134. #endif