htt.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611
  1. /*
  2. * Copyright (c) 2005-2011 Atheros Communications Inc.
  3. * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _HTT_H_
  18. #define _HTT_H_
  19. #include <linux/bug.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/dmapool.h>
  22. #include <linux/hashtable.h>
  23. #include <net/mac80211.h>
  24. #include "htc.h"
  25. #include "hw.h"
  26. #include "rx_desc.h"
  27. #include "hw.h"
  28. enum htt_dbg_stats_type {
  29. HTT_DBG_STATS_WAL_PDEV_TXRX = 1 << 0,
  30. HTT_DBG_STATS_RX_REORDER = 1 << 1,
  31. HTT_DBG_STATS_RX_RATE_INFO = 1 << 2,
  32. HTT_DBG_STATS_TX_PPDU_LOG = 1 << 3,
  33. HTT_DBG_STATS_TX_RATE_INFO = 1 << 4,
  34. /* bits 5-23 currently reserved */
  35. HTT_DBG_NUM_STATS /* keep this last */
  36. };
  37. enum htt_h2t_msg_type { /* host-to-target */
  38. HTT_H2T_MSG_TYPE_VERSION_REQ = 0,
  39. HTT_H2T_MSG_TYPE_TX_FRM = 1,
  40. HTT_H2T_MSG_TYPE_RX_RING_CFG = 2,
  41. HTT_H2T_MSG_TYPE_STATS_REQ = 3,
  42. HTT_H2T_MSG_TYPE_SYNC = 4,
  43. HTT_H2T_MSG_TYPE_AGGR_CFG = 5,
  44. HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG = 6,
  45. /* This command is used for sending management frames in HTT < 3.0.
  46. * HTT >= 3.0 uses TX_FRM for everything. */
  47. HTT_H2T_MSG_TYPE_MGMT_TX = 7,
  48. HTT_H2T_NUM_MSGS /* keep this last */
  49. };
  50. struct htt_cmd_hdr {
  51. u8 msg_type;
  52. } __packed;
  53. struct htt_ver_req {
  54. u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)];
  55. } __packed;
  56. /*
  57. * HTT tx MSDU descriptor
  58. *
  59. * The HTT tx MSDU descriptor is created by the host HTT SW for each
  60. * tx MSDU. The HTT tx MSDU descriptor contains the information that
  61. * the target firmware needs for the FW's tx processing, particularly
  62. * for creating the HW msdu descriptor.
  63. * The same HTT tx descriptor is used for HL and LL systems, though
  64. * a few fields within the tx descriptor are used only by LL or
  65. * only by HL.
  66. * The HTT tx descriptor is defined in two manners: by a struct with
  67. * bitfields, and by a series of [dword offset, bit mask, bit shift]
  68. * definitions.
  69. * The target should use the struct def, for simplicitly and clarity,
  70. * but the host shall use the bit-mast + bit-shift defs, to be endian-
  71. * neutral. Specifically, the host shall use the get/set macros built
  72. * around the mask + shift defs.
  73. */
  74. struct htt_data_tx_desc_frag {
  75. union {
  76. struct double_word_addr {
  77. __le32 paddr;
  78. __le32 len;
  79. } __packed dword_addr;
  80. struct triple_word_addr {
  81. __le32 paddr_lo;
  82. __le16 paddr_hi;
  83. __le16 len_16;
  84. } __packed tword_addr;
  85. } __packed;
  86. } __packed;
  87. struct htt_msdu_ext_desc {
  88. __le32 tso_flag[3];
  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. enum htt_data_tx_desc_flags0 {
  105. HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT = 1 << 0,
  106. HTT_DATA_TX_DESC_FLAGS0_NO_AGGR = 1 << 1,
  107. HTT_DATA_TX_DESC_FLAGS0_NO_ENCRYPT = 1 << 2,
  108. HTT_DATA_TX_DESC_FLAGS0_NO_CLASSIFY = 1 << 3,
  109. HTT_DATA_TX_DESC_FLAGS0_RSVD0 = 1 << 4
  110. #define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_MASK 0xE0
  111. #define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_LSB 5
  112. };
  113. enum htt_data_tx_desc_flags1 {
  114. #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_BITS 6
  115. #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_MASK 0x003F
  116. #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_LSB 0
  117. #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_BITS 5
  118. #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_MASK 0x07C0
  119. #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_LSB 6
  120. HTT_DATA_TX_DESC_FLAGS1_POSTPONED = 1 << 11,
  121. HTT_DATA_TX_DESC_FLAGS1_MORE_IN_BATCH = 1 << 12,
  122. HTT_DATA_TX_DESC_FLAGS1_CKSUM_L3_OFFLOAD = 1 << 13,
  123. HTT_DATA_TX_DESC_FLAGS1_CKSUM_L4_OFFLOAD = 1 << 14,
  124. HTT_DATA_TX_DESC_FLAGS1_RSVD1 = 1 << 15
  125. };
  126. enum htt_data_tx_ext_tid {
  127. HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST = 16,
  128. HTT_DATA_TX_EXT_TID_MGMT = 17,
  129. HTT_DATA_TX_EXT_TID_INVALID = 31
  130. };
  131. #define HTT_INVALID_PEERID 0xFFFF
  132. /*
  133. * htt_data_tx_desc - used for data tx path
  134. *
  135. * Note: vdev_id irrelevant for pkt_type == raw and no_classify == 1.
  136. * ext_tid: for qos-data frames (0-15), see %HTT_DATA_TX_EXT_TID_
  137. * for special kinds of tids
  138. * postponed: only for HL hosts. indicates if this is a resend
  139. * (HL hosts manage queues on the host )
  140. * more_in_batch: only for HL hosts. indicates if more packets are
  141. * pending. this allows target to wait and aggregate
  142. * freq: 0 means home channel of given vdev. intended for offchannel
  143. */
  144. struct htt_data_tx_desc {
  145. u8 flags0; /* %HTT_DATA_TX_DESC_FLAGS0_ */
  146. __le16 flags1; /* %HTT_DATA_TX_DESC_FLAGS1_ */
  147. __le16 len;
  148. __le16 id;
  149. __le32 frags_paddr;
  150. union {
  151. __le32 peerid;
  152. struct {
  153. __le16 peerid;
  154. __le16 freq;
  155. } __packed offchan_tx;
  156. } __packed;
  157. u8 prefetch[0]; /* start of frame, for FW classification engine */
  158. } __packed;
  159. enum htt_rx_ring_flags {
  160. HTT_RX_RING_FLAGS_MAC80211_HDR = 1 << 0,
  161. HTT_RX_RING_FLAGS_MSDU_PAYLOAD = 1 << 1,
  162. HTT_RX_RING_FLAGS_PPDU_START = 1 << 2,
  163. HTT_RX_RING_FLAGS_PPDU_END = 1 << 3,
  164. HTT_RX_RING_FLAGS_MPDU_START = 1 << 4,
  165. HTT_RX_RING_FLAGS_MPDU_END = 1 << 5,
  166. HTT_RX_RING_FLAGS_MSDU_START = 1 << 6,
  167. HTT_RX_RING_FLAGS_MSDU_END = 1 << 7,
  168. HTT_RX_RING_FLAGS_RX_ATTENTION = 1 << 8,
  169. HTT_RX_RING_FLAGS_FRAG_INFO = 1 << 9,
  170. HTT_RX_RING_FLAGS_UNICAST_RX = 1 << 10,
  171. HTT_RX_RING_FLAGS_MULTICAST_RX = 1 << 11,
  172. HTT_RX_RING_FLAGS_CTRL_RX = 1 << 12,
  173. HTT_RX_RING_FLAGS_MGMT_RX = 1 << 13,
  174. HTT_RX_RING_FLAGS_NULL_RX = 1 << 14,
  175. HTT_RX_RING_FLAGS_PHY_DATA_RX = 1 << 15
  176. };
  177. #define HTT_RX_RING_SIZE_MIN 128
  178. #define HTT_RX_RING_SIZE_MAX 2048
  179. struct htt_rx_ring_setup_ring {
  180. __le32 fw_idx_shadow_reg_paddr;
  181. __le32 rx_ring_base_paddr;
  182. __le16 rx_ring_len; /* in 4-byte words */
  183. __le16 rx_ring_bufsize; /* rx skb size - in bytes */
  184. __le16 flags; /* %HTT_RX_RING_FLAGS_ */
  185. __le16 fw_idx_init_val;
  186. /* the following offsets are in 4-byte units */
  187. __le16 mac80211_hdr_offset;
  188. __le16 msdu_payload_offset;
  189. __le16 ppdu_start_offset;
  190. __le16 ppdu_end_offset;
  191. __le16 mpdu_start_offset;
  192. __le16 mpdu_end_offset;
  193. __le16 msdu_start_offset;
  194. __le16 msdu_end_offset;
  195. __le16 rx_attention_offset;
  196. __le16 frag_info_offset;
  197. } __packed;
  198. struct htt_rx_ring_setup_hdr {
  199. u8 num_rings; /* supported values: 1, 2 */
  200. __le16 rsvd0;
  201. } __packed;
  202. struct htt_rx_ring_setup {
  203. struct htt_rx_ring_setup_hdr hdr;
  204. struct htt_rx_ring_setup_ring rings[0];
  205. } __packed;
  206. /*
  207. * htt_stats_req - request target to send specified statistics
  208. *
  209. * @msg_type: hardcoded %HTT_H2T_MSG_TYPE_STATS_REQ
  210. * @upload_types: see %htt_dbg_stats_type. this is 24bit field actually
  211. * so make sure its little-endian.
  212. * @reset_types: see %htt_dbg_stats_type. this is 24bit field actually
  213. * so make sure its little-endian.
  214. * @cfg_val: stat_type specific configuration
  215. * @stat_type: see %htt_dbg_stats_type
  216. * @cookie_lsb: used for confirmation message from target->host
  217. * @cookie_msb: ditto as %cookie
  218. */
  219. struct htt_stats_req {
  220. u8 upload_types[3];
  221. u8 rsvd0;
  222. u8 reset_types[3];
  223. struct {
  224. u8 mpdu_bytes;
  225. u8 mpdu_num_msdus;
  226. u8 msdu_bytes;
  227. } __packed;
  228. u8 stat_type;
  229. __le32 cookie_lsb;
  230. __le32 cookie_msb;
  231. } __packed;
  232. #define HTT_STATS_REQ_CFG_STAT_TYPE_INVALID 0xff
  233. /*
  234. * htt_oob_sync_req - request out-of-band sync
  235. *
  236. * The HTT SYNC tells the target to suspend processing of subsequent
  237. * HTT host-to-target messages until some other target agent locally
  238. * informs the target HTT FW that the current sync counter is equal to
  239. * or greater than (in a modulo sense) the sync counter specified in
  240. * the SYNC message.
  241. *
  242. * This allows other host-target components to synchronize their operation
  243. * with HTT, e.g. to ensure that tx frames don't get transmitted until a
  244. * security key has been downloaded to and activated by the target.
  245. * In the absence of any explicit synchronization counter value
  246. * specification, the target HTT FW will use zero as the default current
  247. * sync value.
  248. *
  249. * The HTT target FW will suspend its host->target message processing as long
  250. * as 0 < (in-band sync counter - out-of-band sync counter) & 0xff < 128.
  251. */
  252. struct htt_oob_sync_req {
  253. u8 sync_count;
  254. __le16 rsvd0;
  255. } __packed;
  256. struct htt_aggr_conf {
  257. u8 max_num_ampdu_subframes;
  258. /* amsdu_subframes is limited by 0x1F mask */
  259. u8 max_num_amsdu_subframes;
  260. } __packed;
  261. #define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32
  262. struct htt_mgmt_tx_desc_qca99x0 {
  263. __le32 rate;
  264. } __packed;
  265. struct htt_mgmt_tx_desc {
  266. u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)];
  267. __le32 msdu_paddr;
  268. __le32 desc_id;
  269. __le32 len;
  270. __le32 vdev_id;
  271. u8 hdr[HTT_MGMT_FRM_HDR_DOWNLOAD_LEN];
  272. union {
  273. struct htt_mgmt_tx_desc_qca99x0 qca99x0;
  274. } __packed;
  275. } __packed;
  276. enum htt_mgmt_tx_status {
  277. HTT_MGMT_TX_STATUS_OK = 0,
  278. HTT_MGMT_TX_STATUS_RETRY = 1,
  279. HTT_MGMT_TX_STATUS_DROP = 2
  280. };
  281. /*=== target -> host messages ===============================================*/
  282. enum htt_main_t2h_msg_type {
  283. HTT_MAIN_T2H_MSG_TYPE_VERSION_CONF = 0x0,
  284. HTT_MAIN_T2H_MSG_TYPE_RX_IND = 0x1,
  285. HTT_MAIN_T2H_MSG_TYPE_RX_FLUSH = 0x2,
  286. HTT_MAIN_T2H_MSG_TYPE_PEER_MAP = 0x3,
  287. HTT_MAIN_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
  288. HTT_MAIN_T2H_MSG_TYPE_RX_ADDBA = 0x5,
  289. HTT_MAIN_T2H_MSG_TYPE_RX_DELBA = 0x6,
  290. HTT_MAIN_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
  291. HTT_MAIN_T2H_MSG_TYPE_PKTLOG = 0x8,
  292. HTT_MAIN_T2H_MSG_TYPE_STATS_CONF = 0x9,
  293. HTT_MAIN_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
  294. HTT_MAIN_T2H_MSG_TYPE_SEC_IND = 0xb,
  295. HTT_MAIN_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
  296. HTT_MAIN_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
  297. HTT_MAIN_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf,
  298. HTT_MAIN_T2H_MSG_TYPE_RX_PN_IND = 0x10,
  299. HTT_MAIN_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11,
  300. HTT_MAIN_T2H_MSG_TYPE_TEST,
  301. /* keep this last */
  302. HTT_MAIN_T2H_NUM_MSGS
  303. };
  304. enum htt_10x_t2h_msg_type {
  305. HTT_10X_T2H_MSG_TYPE_VERSION_CONF = 0x0,
  306. HTT_10X_T2H_MSG_TYPE_RX_IND = 0x1,
  307. HTT_10X_T2H_MSG_TYPE_RX_FLUSH = 0x2,
  308. HTT_10X_T2H_MSG_TYPE_PEER_MAP = 0x3,
  309. HTT_10X_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
  310. HTT_10X_T2H_MSG_TYPE_RX_ADDBA = 0x5,
  311. HTT_10X_T2H_MSG_TYPE_RX_DELBA = 0x6,
  312. HTT_10X_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
  313. HTT_10X_T2H_MSG_TYPE_PKTLOG = 0x8,
  314. HTT_10X_T2H_MSG_TYPE_STATS_CONF = 0x9,
  315. HTT_10X_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
  316. HTT_10X_T2H_MSG_TYPE_SEC_IND = 0xb,
  317. HTT_10X_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc,
  318. HTT_10X_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
  319. HTT_10X_T2H_MSG_TYPE_TEST = 0xe,
  320. HTT_10X_T2H_MSG_TYPE_CHAN_CHANGE = 0xf,
  321. HTT_10X_T2H_MSG_TYPE_AGGR_CONF = 0x11,
  322. HTT_10X_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x12,
  323. HTT_10X_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0x13,
  324. /* keep this last */
  325. HTT_10X_T2H_NUM_MSGS
  326. };
  327. enum htt_tlv_t2h_msg_type {
  328. HTT_TLV_T2H_MSG_TYPE_VERSION_CONF = 0x0,
  329. HTT_TLV_T2H_MSG_TYPE_RX_IND = 0x1,
  330. HTT_TLV_T2H_MSG_TYPE_RX_FLUSH = 0x2,
  331. HTT_TLV_T2H_MSG_TYPE_PEER_MAP = 0x3,
  332. HTT_TLV_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
  333. HTT_TLV_T2H_MSG_TYPE_RX_ADDBA = 0x5,
  334. HTT_TLV_T2H_MSG_TYPE_RX_DELBA = 0x6,
  335. HTT_TLV_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
  336. HTT_TLV_T2H_MSG_TYPE_PKTLOG = 0x8,
  337. HTT_TLV_T2H_MSG_TYPE_STATS_CONF = 0x9,
  338. HTT_TLV_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
  339. HTT_TLV_T2H_MSG_TYPE_SEC_IND = 0xb,
  340. HTT_TLV_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, /* deprecated */
  341. HTT_TLV_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
  342. HTT_TLV_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
  343. HTT_TLV_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf,
  344. HTT_TLV_T2H_MSG_TYPE_RX_PN_IND = 0x10,
  345. HTT_TLV_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11,
  346. HTT_TLV_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND = 0x12,
  347. /* 0x13 reservd */
  348. HTT_TLV_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE = 0x14,
  349. HTT_TLV_T2H_MSG_TYPE_CHAN_CHANGE = 0x15,
  350. HTT_TLV_T2H_MSG_TYPE_RX_OFLD_PKT_ERR = 0x16,
  351. HTT_TLV_T2H_MSG_TYPE_TEST,
  352. /* keep this last */
  353. HTT_TLV_T2H_NUM_MSGS
  354. };
  355. enum htt_10_4_t2h_msg_type {
  356. HTT_10_4_T2H_MSG_TYPE_VERSION_CONF = 0x0,
  357. HTT_10_4_T2H_MSG_TYPE_RX_IND = 0x1,
  358. HTT_10_4_T2H_MSG_TYPE_RX_FLUSH = 0x2,
  359. HTT_10_4_T2H_MSG_TYPE_PEER_MAP = 0x3,
  360. HTT_10_4_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
  361. HTT_10_4_T2H_MSG_TYPE_RX_ADDBA = 0x5,
  362. HTT_10_4_T2H_MSG_TYPE_RX_DELBA = 0x6,
  363. HTT_10_4_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
  364. HTT_10_4_T2H_MSG_TYPE_PKTLOG = 0x8,
  365. HTT_10_4_T2H_MSG_TYPE_STATS_CONF = 0x9,
  366. HTT_10_4_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
  367. HTT_10_4_T2H_MSG_TYPE_SEC_IND = 0xb,
  368. HTT_10_4_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc,
  369. HTT_10_4_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
  370. HTT_10_4_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
  371. HTT_10_4_T2H_MSG_TYPE_CHAN_CHANGE = 0xf,
  372. HTT_10_4_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0x10,
  373. HTT_10_4_T2H_MSG_TYPE_RX_PN_IND = 0x11,
  374. HTT_10_4_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x12,
  375. HTT_10_4_T2H_MSG_TYPE_TEST = 0x13,
  376. HTT_10_4_T2H_MSG_TYPE_EN_STATS = 0x14,
  377. HTT_10_4_T2H_MSG_TYPE_AGGR_CONF = 0x15,
  378. HTT_10_4_T2H_MSG_TYPE_TX_FETCH_IND = 0x16,
  379. HTT_10_4_T2H_MSG_TYPE_TX_FETCH_CONF = 0x17,
  380. HTT_10_4_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x18,
  381. /* 0x19 to 0x2f are reserved */
  382. HTT_10_4_T2H_MSG_TYPE_TX_LOW_LATENCY_IND = 0x30,
  383. /* keep this last */
  384. HTT_10_4_T2H_NUM_MSGS
  385. };
  386. enum htt_t2h_msg_type {
  387. HTT_T2H_MSG_TYPE_VERSION_CONF,
  388. HTT_T2H_MSG_TYPE_RX_IND,
  389. HTT_T2H_MSG_TYPE_RX_FLUSH,
  390. HTT_T2H_MSG_TYPE_PEER_MAP,
  391. HTT_T2H_MSG_TYPE_PEER_UNMAP,
  392. HTT_T2H_MSG_TYPE_RX_ADDBA,
  393. HTT_T2H_MSG_TYPE_RX_DELBA,
  394. HTT_T2H_MSG_TYPE_TX_COMPL_IND,
  395. HTT_T2H_MSG_TYPE_PKTLOG,
  396. HTT_T2H_MSG_TYPE_STATS_CONF,
  397. HTT_T2H_MSG_TYPE_RX_FRAG_IND,
  398. HTT_T2H_MSG_TYPE_SEC_IND,
  399. HTT_T2H_MSG_TYPE_RC_UPDATE_IND,
  400. HTT_T2H_MSG_TYPE_TX_INSPECT_IND,
  401. HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION,
  402. HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND,
  403. HTT_T2H_MSG_TYPE_RX_PN_IND,
  404. HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND,
  405. HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND,
  406. HTT_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE,
  407. HTT_T2H_MSG_TYPE_CHAN_CHANGE,
  408. HTT_T2H_MSG_TYPE_RX_OFLD_PKT_ERR,
  409. HTT_T2H_MSG_TYPE_AGGR_CONF,
  410. HTT_T2H_MSG_TYPE_STATS_NOUPLOAD,
  411. HTT_T2H_MSG_TYPE_TEST,
  412. HTT_T2H_MSG_TYPE_EN_STATS,
  413. HTT_T2H_MSG_TYPE_TX_FETCH_IND,
  414. HTT_T2H_MSG_TYPE_TX_FETCH_CONF,
  415. HTT_T2H_MSG_TYPE_TX_LOW_LATENCY_IND,
  416. /* keep this last */
  417. HTT_T2H_NUM_MSGS
  418. };
  419. /*
  420. * htt_resp_hdr - header for target-to-host messages
  421. *
  422. * msg_type: see htt_t2h_msg_type
  423. */
  424. struct htt_resp_hdr {
  425. u8 msg_type;
  426. } __packed;
  427. #define HTT_RESP_HDR_MSG_TYPE_OFFSET 0
  428. #define HTT_RESP_HDR_MSG_TYPE_MASK 0xff
  429. #define HTT_RESP_HDR_MSG_TYPE_LSB 0
  430. /* htt_ver_resp - response sent for htt_ver_req */
  431. struct htt_ver_resp {
  432. u8 minor;
  433. u8 major;
  434. u8 rsvd0;
  435. } __packed;
  436. struct htt_mgmt_tx_completion {
  437. u8 rsvd0;
  438. u8 rsvd1;
  439. u8 rsvd2;
  440. __le32 desc_id;
  441. __le32 status;
  442. } __packed;
  443. #define HTT_RX_INDICATION_INFO0_EXT_TID_MASK (0x3F)
  444. #define HTT_RX_INDICATION_INFO0_EXT_TID_LSB (0)
  445. #define HTT_RX_INDICATION_INFO0_FLUSH_VALID (1 << 6)
  446. #define HTT_RX_INDICATION_INFO0_RELEASE_VALID (1 << 7)
  447. #define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_MASK 0x0000003F
  448. #define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_LSB 0
  449. #define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_MASK 0x00000FC0
  450. #define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_LSB 6
  451. #define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_MASK 0x0003F000
  452. #define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_LSB 12
  453. #define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_MASK 0x00FC0000
  454. #define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_LSB 18
  455. #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_MASK 0xFF000000
  456. #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_LSB 24
  457. struct htt_rx_indication_hdr {
  458. u8 info0; /* %HTT_RX_INDICATION_INFO0_ */
  459. __le16 peer_id;
  460. __le32 info1; /* %HTT_RX_INDICATION_INFO1_ */
  461. } __packed;
  462. #define HTT_RX_INDICATION_INFO0_PHY_ERR_VALID (1 << 0)
  463. #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_MASK (0x1E)
  464. #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_LSB (1)
  465. #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK (1 << 5)
  466. #define HTT_RX_INDICATION_INFO0_END_VALID (1 << 6)
  467. #define HTT_RX_INDICATION_INFO0_START_VALID (1 << 7)
  468. #define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_MASK 0x00FFFFFF
  469. #define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_LSB 0
  470. #define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_MASK 0xFF000000
  471. #define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_LSB 24
  472. #define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_MASK 0x00FFFFFF
  473. #define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_LSB 0
  474. #define HTT_RX_INDICATION_INFO2_SERVICE_MASK 0xFF000000
  475. #define HTT_RX_INDICATION_INFO2_SERVICE_LSB 24
  476. enum htt_rx_legacy_rate {
  477. HTT_RX_OFDM_48 = 0,
  478. HTT_RX_OFDM_24 = 1,
  479. HTT_RX_OFDM_12,
  480. HTT_RX_OFDM_6,
  481. HTT_RX_OFDM_54,
  482. HTT_RX_OFDM_36,
  483. HTT_RX_OFDM_18,
  484. HTT_RX_OFDM_9,
  485. /* long preamble */
  486. HTT_RX_CCK_11_LP = 0,
  487. HTT_RX_CCK_5_5_LP = 1,
  488. HTT_RX_CCK_2_LP,
  489. HTT_RX_CCK_1_LP,
  490. /* short preamble */
  491. HTT_RX_CCK_11_SP,
  492. HTT_RX_CCK_5_5_SP,
  493. HTT_RX_CCK_2_SP
  494. };
  495. enum htt_rx_legacy_rate_type {
  496. HTT_RX_LEGACY_RATE_OFDM = 0,
  497. HTT_RX_LEGACY_RATE_CCK
  498. };
  499. enum htt_rx_preamble_type {
  500. HTT_RX_LEGACY = 0x4,
  501. HTT_RX_HT = 0x8,
  502. HTT_RX_HT_WITH_TXBF = 0x9,
  503. HTT_RX_VHT = 0xC,
  504. HTT_RX_VHT_WITH_TXBF = 0xD,
  505. };
  506. /*
  507. * Fields: phy_err_valid, phy_err_code, tsf,
  508. * usec_timestamp, sub_usec_timestamp
  509. * ..are valid only if end_valid == 1.
  510. *
  511. * Fields: rssi_chains, legacy_rate_type,
  512. * legacy_rate_cck, preamble_type, service,
  513. * vht_sig_*
  514. * ..are valid only if start_valid == 1;
  515. */
  516. struct htt_rx_indication_ppdu {
  517. u8 combined_rssi;
  518. u8 sub_usec_timestamp;
  519. u8 phy_err_code;
  520. u8 info0; /* HTT_RX_INDICATION_INFO0_ */
  521. struct {
  522. u8 pri20_db;
  523. u8 ext20_db;
  524. u8 ext40_db;
  525. u8 ext80_db;
  526. } __packed rssi_chains[4];
  527. __le32 tsf;
  528. __le32 usec_timestamp;
  529. __le32 info1; /* HTT_RX_INDICATION_INFO1_ */
  530. __le32 info2; /* HTT_RX_INDICATION_INFO2_ */
  531. } __packed;
  532. enum htt_rx_mpdu_status {
  533. HTT_RX_IND_MPDU_STATUS_UNKNOWN = 0x0,
  534. HTT_RX_IND_MPDU_STATUS_OK,
  535. HTT_RX_IND_MPDU_STATUS_ERR_FCS,
  536. HTT_RX_IND_MPDU_STATUS_ERR_DUP,
  537. HTT_RX_IND_MPDU_STATUS_ERR_REPLAY,
  538. HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER,
  539. /* only accept EAPOL frames */
  540. HTT_RX_IND_MPDU_STATUS_UNAUTH_PEER,
  541. HTT_RX_IND_MPDU_STATUS_OUT_OF_SYNC,
  542. /* Non-data in promiscous mode */
  543. HTT_RX_IND_MPDU_STATUS_MGMT_CTRL,
  544. HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR,
  545. HTT_RX_IND_MPDU_STATUS_DECRYPT_ERR,
  546. HTT_RX_IND_MPDU_STATUS_MPDU_LENGTH_ERR,
  547. HTT_RX_IND_MPDU_STATUS_ENCRYPT_REQUIRED_ERR,
  548. HTT_RX_IND_MPDU_STATUS_PRIVACY_ERR,
  549. /*
  550. * MISC: discard for unspecified reasons.
  551. * Leave this enum value last.
  552. */
  553. HTT_RX_IND_MPDU_STATUS_ERR_MISC = 0xFF
  554. };
  555. struct htt_rx_indication_mpdu_range {
  556. u8 mpdu_count;
  557. u8 mpdu_range_status; /* %htt_rx_mpdu_status */
  558. u8 pad0;
  559. u8 pad1;
  560. } __packed;
  561. struct htt_rx_indication_prefix {
  562. __le16 fw_rx_desc_bytes;
  563. u8 pad0;
  564. u8 pad1;
  565. };
  566. struct htt_rx_indication {
  567. struct htt_rx_indication_hdr hdr;
  568. struct htt_rx_indication_ppdu ppdu;
  569. struct htt_rx_indication_prefix prefix;
  570. /*
  571. * the following fields are both dynamically sized, so
  572. * take care addressing them
  573. */
  574. /* the size of this is %fw_rx_desc_bytes */
  575. struct fw_rx_desc_base fw_desc;
  576. /*
  577. * %mpdu_ranges starts after &%prefix + roundup(%fw_rx_desc_bytes, 4)
  578. * and has %num_mpdu_ranges elements.
  579. */
  580. struct htt_rx_indication_mpdu_range mpdu_ranges[0];
  581. } __packed;
  582. static inline struct htt_rx_indication_mpdu_range *
  583. htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
  584. {
  585. void *ptr = rx_ind;
  586. ptr += sizeof(rx_ind->hdr)
  587. + sizeof(rx_ind->ppdu)
  588. + sizeof(rx_ind->prefix)
  589. + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
  590. return ptr;
  591. }
  592. enum htt_rx_flush_mpdu_status {
  593. HTT_RX_FLUSH_MPDU_DISCARD = 0,
  594. HTT_RX_FLUSH_MPDU_REORDER = 1,
  595. };
  596. /*
  597. * htt_rx_flush - discard or reorder given range of mpdus
  598. *
  599. * Note: host must check if all sequence numbers between
  600. * [seq_num_start, seq_num_end-1] are valid.
  601. */
  602. struct htt_rx_flush {
  603. __le16 peer_id;
  604. u8 tid;
  605. u8 rsvd0;
  606. u8 mpdu_status; /* %htt_rx_flush_mpdu_status */
  607. u8 seq_num_start; /* it is 6 LSBs of 802.11 seq no */
  608. u8 seq_num_end; /* it is 6 LSBs of 802.11 seq no */
  609. };
  610. struct htt_rx_peer_map {
  611. u8 vdev_id;
  612. __le16 peer_id;
  613. u8 addr[6];
  614. u8 rsvd0;
  615. u8 rsvd1;
  616. } __packed;
  617. struct htt_rx_peer_unmap {
  618. u8 rsvd0;
  619. __le16 peer_id;
  620. } __packed;
  621. enum htt_security_types {
  622. HTT_SECURITY_NONE,
  623. HTT_SECURITY_WEP128,
  624. HTT_SECURITY_WEP104,
  625. HTT_SECURITY_WEP40,
  626. HTT_SECURITY_TKIP,
  627. HTT_SECURITY_TKIP_NOMIC,
  628. HTT_SECURITY_AES_CCMP,
  629. HTT_SECURITY_WAPI,
  630. HTT_NUM_SECURITY_TYPES /* keep this last! */
  631. };
  632. enum htt_security_flags {
  633. #define HTT_SECURITY_TYPE_MASK 0x7F
  634. #define HTT_SECURITY_TYPE_LSB 0
  635. HTT_SECURITY_IS_UNICAST = 1 << 7
  636. };
  637. struct htt_security_indication {
  638. union {
  639. /* dont use bitfields; undefined behaviour */
  640. u8 flags; /* %htt_security_flags */
  641. struct {
  642. u8 security_type:7, /* %htt_security_types */
  643. is_unicast:1;
  644. } __packed;
  645. } __packed;
  646. __le16 peer_id;
  647. u8 michael_key[8];
  648. u8 wapi_rsc[16];
  649. } __packed;
  650. #define HTT_RX_BA_INFO0_TID_MASK 0x000F
  651. #define HTT_RX_BA_INFO0_TID_LSB 0
  652. #define HTT_RX_BA_INFO0_PEER_ID_MASK 0xFFF0
  653. #define HTT_RX_BA_INFO0_PEER_ID_LSB 4
  654. struct htt_rx_addba {
  655. u8 window_size;
  656. __le16 info0; /* %HTT_RX_BA_INFO0_ */
  657. } __packed;
  658. struct htt_rx_delba {
  659. u8 rsvd0;
  660. __le16 info0; /* %HTT_RX_BA_INFO0_ */
  661. } __packed;
  662. enum htt_data_tx_status {
  663. HTT_DATA_TX_STATUS_OK = 0,
  664. HTT_DATA_TX_STATUS_DISCARD = 1,
  665. HTT_DATA_TX_STATUS_NO_ACK = 2,
  666. HTT_DATA_TX_STATUS_POSTPONE = 3, /* HL only */
  667. HTT_DATA_TX_STATUS_DOWNLOAD_FAIL = 128
  668. };
  669. enum htt_data_tx_flags {
  670. #define HTT_DATA_TX_STATUS_MASK 0x07
  671. #define HTT_DATA_TX_STATUS_LSB 0
  672. #define HTT_DATA_TX_TID_MASK 0x78
  673. #define HTT_DATA_TX_TID_LSB 3
  674. HTT_DATA_TX_TID_INVALID = 1 << 7
  675. };
  676. #define HTT_TX_COMPL_INV_MSDU_ID 0xFFFF
  677. struct htt_data_tx_completion {
  678. union {
  679. u8 flags;
  680. struct {
  681. u8 status:3,
  682. tid:4,
  683. tid_invalid:1;
  684. } __packed;
  685. } __packed;
  686. u8 num_msdus;
  687. u8 rsvd0;
  688. __le16 msdus[0]; /* variable length based on %num_msdus */
  689. } __packed;
  690. struct htt_tx_compl_ind_base {
  691. u32 hdr;
  692. u16 payload[1/*or more*/];
  693. } __packed;
  694. struct htt_rc_tx_done_params {
  695. u32 rate_code;
  696. u32 rate_code_flags;
  697. u32 flags;
  698. u32 num_enqued; /* 1 for non-AMPDU */
  699. u32 num_retries;
  700. u32 num_failed; /* for AMPDU */
  701. u32 ack_rssi;
  702. u32 time_stamp;
  703. u32 is_probe;
  704. };
  705. struct htt_rc_update {
  706. u8 vdev_id;
  707. __le16 peer_id;
  708. u8 addr[6];
  709. u8 num_elems;
  710. u8 rsvd0;
  711. struct htt_rc_tx_done_params params[0]; /* variable length %num_elems */
  712. } __packed;
  713. /* see htt_rx_indication for similar fields and descriptions */
  714. struct htt_rx_fragment_indication {
  715. union {
  716. u8 info0; /* %HTT_RX_FRAG_IND_INFO0_ */
  717. struct {
  718. u8 ext_tid:5,
  719. flush_valid:1;
  720. } __packed;
  721. } __packed;
  722. __le16 peer_id;
  723. __le32 info1; /* %HTT_RX_FRAG_IND_INFO1_ */
  724. __le16 fw_rx_desc_bytes;
  725. __le16 rsvd0;
  726. u8 fw_msdu_rx_desc[0];
  727. } __packed;
  728. #define HTT_RX_FRAG_IND_INFO0_EXT_TID_MASK 0x1F
  729. #define HTT_RX_FRAG_IND_INFO0_EXT_TID_LSB 0
  730. #define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_MASK 0x20
  731. #define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_LSB 5
  732. #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_MASK 0x0000003F
  733. #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_LSB 0
  734. #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_MASK 0x00000FC0
  735. #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_LSB 6
  736. struct htt_rx_pn_ind {
  737. __le16 peer_id;
  738. u8 tid;
  739. u8 seqno_start;
  740. u8 seqno_end;
  741. u8 pn_ie_count;
  742. u8 reserved;
  743. u8 pn_ies[0];
  744. } __packed;
  745. struct htt_rx_offload_msdu {
  746. __le16 msdu_len;
  747. __le16 peer_id;
  748. u8 vdev_id;
  749. u8 tid;
  750. u8 fw_desc;
  751. u8 payload[0];
  752. } __packed;
  753. struct htt_rx_offload_ind {
  754. u8 reserved;
  755. __le16 msdu_count;
  756. } __packed;
  757. struct htt_rx_in_ord_msdu_desc {
  758. __le32 msdu_paddr;
  759. __le16 msdu_len;
  760. u8 fw_desc;
  761. u8 reserved;
  762. } __packed;
  763. struct htt_rx_in_ord_ind {
  764. u8 info;
  765. __le16 peer_id;
  766. u8 vdev_id;
  767. u8 reserved;
  768. __le16 msdu_count;
  769. struct htt_rx_in_ord_msdu_desc msdu_descs[0];
  770. } __packed;
  771. #define HTT_RX_IN_ORD_IND_INFO_TID_MASK 0x0000001f
  772. #define HTT_RX_IN_ORD_IND_INFO_TID_LSB 0
  773. #define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_MASK 0x00000020
  774. #define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_LSB 5
  775. #define HTT_RX_IN_ORD_IND_INFO_FRAG_MASK 0x00000040
  776. #define HTT_RX_IN_ORD_IND_INFO_FRAG_LSB 6
  777. /*
  778. * target -> host test message definition
  779. *
  780. * The following field definitions describe the format of the test
  781. * message sent from the target to the host.
  782. * The message consists of a 4-octet header, followed by a variable
  783. * number of 32-bit integer values, followed by a variable number
  784. * of 8-bit character values.
  785. *
  786. * |31 16|15 8|7 0|
  787. * |-----------------------------------------------------------|
  788. * | num chars | num ints | msg type |
  789. * |-----------------------------------------------------------|
  790. * | int 0 |
  791. * |-----------------------------------------------------------|
  792. * | int 1 |
  793. * |-----------------------------------------------------------|
  794. * | ... |
  795. * |-----------------------------------------------------------|
  796. * | char 3 | char 2 | char 1 | char 0 |
  797. * |-----------------------------------------------------------|
  798. * | | | ... | char 4 |
  799. * |-----------------------------------------------------------|
  800. * - MSG_TYPE
  801. * Bits 7:0
  802. * Purpose: identifies this as a test message
  803. * Value: HTT_MSG_TYPE_TEST
  804. * - NUM_INTS
  805. * Bits 15:8
  806. * Purpose: indicate how many 32-bit integers follow the message header
  807. * - NUM_CHARS
  808. * Bits 31:16
  809. * Purpose: indicate how many 8-bit charaters follow the series of integers
  810. */
  811. struct htt_rx_test {
  812. u8 num_ints;
  813. __le16 num_chars;
  814. /* payload consists of 2 lists:
  815. * a) num_ints * sizeof(__le32)
  816. * b) num_chars * sizeof(u8) aligned to 4bytes */
  817. u8 payload[0];
  818. } __packed;
  819. static inline __le32 *htt_rx_test_get_ints(struct htt_rx_test *rx_test)
  820. {
  821. return (__le32 *)rx_test->payload;
  822. }
  823. static inline u8 *htt_rx_test_get_chars(struct htt_rx_test *rx_test)
  824. {
  825. return rx_test->payload + (rx_test->num_ints * sizeof(__le32));
  826. }
  827. /*
  828. * target -> host packet log message
  829. *
  830. * The following field definitions describe the format of the packet log
  831. * message sent from the target to the host.
  832. * The message consists of a 4-octet header,followed by a variable number
  833. * of 32-bit character values.
  834. *
  835. * |31 24|23 16|15 8|7 0|
  836. * |-----------------------------------------------------------|
  837. * | | | | msg type |
  838. * |-----------------------------------------------------------|
  839. * | payload |
  840. * |-----------------------------------------------------------|
  841. * - MSG_TYPE
  842. * Bits 7:0
  843. * Purpose: identifies this as a test message
  844. * Value: HTT_MSG_TYPE_PACKETLOG
  845. */
  846. struct htt_pktlog_msg {
  847. u8 pad[3];
  848. u8 payload[0];
  849. } __packed;
  850. struct htt_dbg_stats_rx_reorder_stats {
  851. /* Non QoS MPDUs received */
  852. __le32 deliver_non_qos;
  853. /* MPDUs received in-order */
  854. __le32 deliver_in_order;
  855. /* Flush due to reorder timer expired */
  856. __le32 deliver_flush_timeout;
  857. /* Flush due to move out of window */
  858. __le32 deliver_flush_oow;
  859. /* Flush due to DELBA */
  860. __le32 deliver_flush_delba;
  861. /* MPDUs dropped due to FCS error */
  862. __le32 fcs_error;
  863. /* MPDUs dropped due to monitor mode non-data packet */
  864. __le32 mgmt_ctrl;
  865. /* MPDUs dropped due to invalid peer */
  866. __le32 invalid_peer;
  867. /* MPDUs dropped due to duplication (non aggregation) */
  868. __le32 dup_non_aggr;
  869. /* MPDUs dropped due to processed before */
  870. __le32 dup_past;
  871. /* MPDUs dropped due to duplicate in reorder queue */
  872. __le32 dup_in_reorder;
  873. /* Reorder timeout happened */
  874. __le32 reorder_timeout;
  875. /* invalid bar ssn */
  876. __le32 invalid_bar_ssn;
  877. /* reorder reset due to bar ssn */
  878. __le32 ssn_reset;
  879. };
  880. struct htt_dbg_stats_wal_tx_stats {
  881. /* Num HTT cookies queued to dispatch list */
  882. __le32 comp_queued;
  883. /* Num HTT cookies dispatched */
  884. __le32 comp_delivered;
  885. /* Num MSDU queued to WAL */
  886. __le32 msdu_enqued;
  887. /* Num MPDU queue to WAL */
  888. __le32 mpdu_enqued;
  889. /* Num MSDUs dropped by WMM limit */
  890. __le32 wmm_drop;
  891. /* Num Local frames queued */
  892. __le32 local_enqued;
  893. /* Num Local frames done */
  894. __le32 local_freed;
  895. /* Num queued to HW */
  896. __le32 hw_queued;
  897. /* Num PPDU reaped from HW */
  898. __le32 hw_reaped;
  899. /* Num underruns */
  900. __le32 underrun;
  901. /* Num PPDUs cleaned up in TX abort */
  902. __le32 tx_abort;
  903. /* Num MPDUs requed by SW */
  904. __le32 mpdus_requed;
  905. /* excessive retries */
  906. __le32 tx_ko;
  907. /* data hw rate code */
  908. __le32 data_rc;
  909. /* Scheduler self triggers */
  910. __le32 self_triggers;
  911. /* frames dropped due to excessive sw retries */
  912. __le32 sw_retry_failure;
  913. /* illegal rate phy errors */
  914. __le32 illgl_rate_phy_err;
  915. /* wal pdev continous xretry */
  916. __le32 pdev_cont_xretry;
  917. /* wal pdev continous xretry */
  918. __le32 pdev_tx_timeout;
  919. /* wal pdev resets */
  920. __le32 pdev_resets;
  921. __le32 phy_underrun;
  922. /* MPDU is more than txop limit */
  923. __le32 txop_ovf;
  924. } __packed;
  925. struct htt_dbg_stats_wal_rx_stats {
  926. /* Cnts any change in ring routing mid-ppdu */
  927. __le32 mid_ppdu_route_change;
  928. /* Total number of statuses processed */
  929. __le32 status_rcvd;
  930. /* Extra frags on rings 0-3 */
  931. __le32 r0_frags;
  932. __le32 r1_frags;
  933. __le32 r2_frags;
  934. __le32 r3_frags;
  935. /* MSDUs / MPDUs delivered to HTT */
  936. __le32 htt_msdus;
  937. __le32 htt_mpdus;
  938. /* MSDUs / MPDUs delivered to local stack */
  939. __le32 loc_msdus;
  940. __le32 loc_mpdus;
  941. /* AMSDUs that have more MSDUs than the status ring size */
  942. __le32 oversize_amsdu;
  943. /* Number of PHY errors */
  944. __le32 phy_errs;
  945. /* Number of PHY errors drops */
  946. __le32 phy_err_drop;
  947. /* Number of mpdu errors - FCS, MIC, ENC etc. */
  948. __le32 mpdu_errs;
  949. } __packed;
  950. struct htt_dbg_stats_wal_peer_stats {
  951. __le32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
  952. } __packed;
  953. struct htt_dbg_stats_wal_pdev_txrx {
  954. struct htt_dbg_stats_wal_tx_stats tx_stats;
  955. struct htt_dbg_stats_wal_rx_stats rx_stats;
  956. struct htt_dbg_stats_wal_peer_stats peer_stats;
  957. } __packed;
  958. struct htt_dbg_stats_rx_rate_info {
  959. __le32 mcs[10];
  960. __le32 sgi[10];
  961. __le32 nss[4];
  962. __le32 stbc[10];
  963. __le32 bw[3];
  964. __le32 pream[6];
  965. __le32 ldpc;
  966. __le32 txbf;
  967. };
  968. /*
  969. * htt_dbg_stats_status -
  970. * present - The requested stats have been delivered in full.
  971. * This indicates that either the stats information was contained
  972. * in its entirety within this message, or else this message
  973. * completes the delivery of the requested stats info that was
  974. * partially delivered through earlier STATS_CONF messages.
  975. * partial - The requested stats have been delivered in part.
  976. * One or more subsequent STATS_CONF messages with the same
  977. * cookie value will be sent to deliver the remainder of the
  978. * information.
  979. * error - The requested stats could not be delivered, for example due
  980. * to a shortage of memory to construct a message holding the
  981. * requested stats.
  982. * invalid - The requested stat type is either not recognized, or the
  983. * target is configured to not gather the stats type in question.
  984. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  985. * series_done - This special value indicates that no further stats info
  986. * elements are present within a series of stats info elems
  987. * (within a stats upload confirmation message).
  988. */
  989. enum htt_dbg_stats_status {
  990. HTT_DBG_STATS_STATUS_PRESENT = 0,
  991. HTT_DBG_STATS_STATUS_PARTIAL = 1,
  992. HTT_DBG_STATS_STATUS_ERROR = 2,
  993. HTT_DBG_STATS_STATUS_INVALID = 3,
  994. HTT_DBG_STATS_STATUS_SERIES_DONE = 7
  995. };
  996. /*
  997. * target -> host statistics upload
  998. *
  999. * The following field definitions describe the format of the HTT target
  1000. * to host stats upload confirmation message.
  1001. * The message contains a cookie echoed from the HTT host->target stats
  1002. * upload request, which identifies which request the confirmation is
  1003. * for, and a series of tag-length-value stats information elements.
  1004. * The tag-length header for each stats info element also includes a
  1005. * status field, to indicate whether the request for the stat type in
  1006. * question was fully met, partially met, unable to be met, or invalid
  1007. * (if the stat type in question is disabled in the target).
  1008. * A special value of all 1's in this status field is used to indicate
  1009. * the end of the series of stats info elements.
  1010. *
  1011. *
  1012. * |31 16|15 8|7 5|4 0|
  1013. * |------------------------------------------------------------|
  1014. * | reserved | msg type |
  1015. * |------------------------------------------------------------|
  1016. * | cookie LSBs |
  1017. * |------------------------------------------------------------|
  1018. * | cookie MSBs |
  1019. * |------------------------------------------------------------|
  1020. * | stats entry length | reserved | S |stat type|
  1021. * |------------------------------------------------------------|
  1022. * | |
  1023. * | type-specific stats info |
  1024. * | |
  1025. * |------------------------------------------------------------|
  1026. * | stats entry length | reserved | S |stat type|
  1027. * |------------------------------------------------------------|
  1028. * | |
  1029. * | type-specific stats info |
  1030. * | |
  1031. * |------------------------------------------------------------|
  1032. * | n/a | reserved | 111 | n/a |
  1033. * |------------------------------------------------------------|
  1034. * Header fields:
  1035. * - MSG_TYPE
  1036. * Bits 7:0
  1037. * Purpose: identifies this is a statistics upload confirmation message
  1038. * Value: 0x9
  1039. * - COOKIE_LSBS
  1040. * Bits 31:0
  1041. * Purpose: Provide a mechanism to match a target->host stats confirmation
  1042. * message with its preceding host->target stats request message.
  1043. * Value: LSBs of the opaque cookie specified by the host-side requestor
  1044. * - COOKIE_MSBS
  1045. * Bits 31:0
  1046. * Purpose: Provide a mechanism to match a target->host stats confirmation
  1047. * message with its preceding host->target stats request message.
  1048. * Value: MSBs of the opaque cookie specified by the host-side requestor
  1049. *
  1050. * Stats Information Element tag-length header fields:
  1051. * - STAT_TYPE
  1052. * Bits 4:0
  1053. * Purpose: identifies the type of statistics info held in the
  1054. * following information element
  1055. * Value: htt_dbg_stats_type
  1056. * - STATUS
  1057. * Bits 7:5
  1058. * Purpose: indicate whether the requested stats are present
  1059. * Value: htt_dbg_stats_status, including a special value (0x7) to mark
  1060. * the completion of the stats entry series
  1061. * - LENGTH
  1062. * Bits 31:16
  1063. * Purpose: indicate the stats information size
  1064. * Value: This field specifies the number of bytes of stats information
  1065. * that follows the element tag-length header.
  1066. * It is expected but not required that this length is a multiple of
  1067. * 4 bytes. Even if the length is not an integer multiple of 4, the
  1068. * subsequent stats entry header will begin on a 4-byte aligned
  1069. * boundary.
  1070. */
  1071. #define HTT_STATS_CONF_ITEM_INFO_STAT_TYPE_MASK 0x1F
  1072. #define HTT_STATS_CONF_ITEM_INFO_STAT_TYPE_LSB 0
  1073. #define HTT_STATS_CONF_ITEM_INFO_STATUS_MASK 0xE0
  1074. #define HTT_STATS_CONF_ITEM_INFO_STATUS_LSB 5
  1075. struct htt_stats_conf_item {
  1076. union {
  1077. u8 info;
  1078. struct {
  1079. u8 stat_type:5; /* %HTT_DBG_STATS_ */
  1080. u8 status:3; /* %HTT_DBG_STATS_STATUS_ */
  1081. } __packed;
  1082. } __packed;
  1083. u8 pad;
  1084. __le16 length;
  1085. u8 payload[0]; /* roundup(length, 4) long */
  1086. } __packed;
  1087. struct htt_stats_conf {
  1088. u8 pad[3];
  1089. __le32 cookie_lsb;
  1090. __le32 cookie_msb;
  1091. /* each item has variable length! */
  1092. struct htt_stats_conf_item items[0];
  1093. } __packed;
  1094. static inline struct htt_stats_conf_item *htt_stats_conf_next_item(
  1095. const struct htt_stats_conf_item *item)
  1096. {
  1097. return (void *)item + sizeof(*item) + roundup(item->length, 4);
  1098. }
  1099. /*
  1100. * host -> target FRAG DESCRIPTOR/MSDU_EXT DESC bank
  1101. *
  1102. * The following field definitions describe the format of the HTT host
  1103. * to target frag_desc/msdu_ext bank configuration message.
  1104. * The message contains the based address and the min and max id of the
  1105. * MSDU_EXT/FRAG_DESC that will be used by the HTT to map MSDU DESC and
  1106. * MSDU_EXT/FRAG_DESC.
  1107. * HTT will use id in HTT descriptor instead sending the frag_desc_ptr.
  1108. * For QCA988X HW the firmware will use fragment_desc_ptr but in WIFI2.0
  1109. * the hardware does the mapping/translation.
  1110. *
  1111. * Total banks that can be configured is configured to 16.
  1112. *
  1113. * This should be called before any TX has be initiated by the HTT
  1114. *
  1115. * |31 16|15 8|7 5|4 0|
  1116. * |------------------------------------------------------------|
  1117. * | DESC_SIZE | NUM_BANKS | RES |SWP|pdev| msg type |
  1118. * |------------------------------------------------------------|
  1119. * | BANK0_BASE_ADDRESS |
  1120. * |------------------------------------------------------------|
  1121. * | ... |
  1122. * |------------------------------------------------------------|
  1123. * | BANK15_BASE_ADDRESS |
  1124. * |------------------------------------------------------------|
  1125. * | BANK0_MAX_ID | BANK0_MIN_ID |
  1126. * |------------------------------------------------------------|
  1127. * | ... |
  1128. * |------------------------------------------------------------|
  1129. * | BANK15_MAX_ID | BANK15_MIN_ID |
  1130. * |------------------------------------------------------------|
  1131. * Header fields:
  1132. * - MSG_TYPE
  1133. * Bits 7:0
  1134. * Value: 0x6
  1135. * - BANKx_BASE_ADDRESS
  1136. * Bits 31:0
  1137. * Purpose: Provide a mechanism to specify the base address of the MSDU_EXT
  1138. * bank physical/bus address.
  1139. * - BANKx_MIN_ID
  1140. * Bits 15:0
  1141. * Purpose: Provide a mechanism to specify the min index that needs to
  1142. * mapped.
  1143. * - BANKx_MAX_ID
  1144. * Bits 31:16
  1145. * Purpose: Provide a mechanism to specify the max index that needs to
  1146. *
  1147. */
  1148. struct htt_frag_desc_bank_id {
  1149. __le16 bank_min_id;
  1150. __le16 bank_max_id;
  1151. } __packed;
  1152. /* real is 16 but it wouldn't fit in the max htt message size
  1153. * so we use a conservatively safe value for now */
  1154. #define HTT_FRAG_DESC_BANK_MAX 4
  1155. #define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_MASK 0x03
  1156. #define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_LSB 0
  1157. #define HTT_FRAG_DESC_BANK_CFG_INFO_SWAP (1 << 2)
  1158. struct htt_frag_desc_bank_cfg {
  1159. u8 info; /* HTT_FRAG_DESC_BANK_CFG_INFO_ */
  1160. u8 num_banks;
  1161. u8 desc_size;
  1162. __le32 bank_base_addrs[HTT_FRAG_DESC_BANK_MAX];
  1163. struct htt_frag_desc_bank_id bank_id[HTT_FRAG_DESC_BANK_MAX];
  1164. } __packed;
  1165. union htt_rx_pn_t {
  1166. /* WEP: 24-bit PN */
  1167. u32 pn24;
  1168. /* TKIP or CCMP: 48-bit PN */
  1169. u_int64_t pn48;
  1170. /* WAPI: 128-bit PN */
  1171. u_int64_t pn128[2];
  1172. };
  1173. struct htt_cmd {
  1174. struct htt_cmd_hdr hdr;
  1175. union {
  1176. struct htt_ver_req ver_req;
  1177. struct htt_mgmt_tx_desc mgmt_tx;
  1178. struct htt_data_tx_desc data_tx;
  1179. struct htt_rx_ring_setup rx_setup;
  1180. struct htt_stats_req stats_req;
  1181. struct htt_oob_sync_req oob_sync_req;
  1182. struct htt_aggr_conf aggr_conf;
  1183. struct htt_frag_desc_bank_cfg frag_desc_bank_cfg;
  1184. };
  1185. } __packed;
  1186. struct htt_resp {
  1187. struct htt_resp_hdr hdr;
  1188. union {
  1189. struct htt_ver_resp ver_resp;
  1190. struct htt_mgmt_tx_completion mgmt_tx_completion;
  1191. struct htt_data_tx_completion data_tx_completion;
  1192. struct htt_rx_indication rx_ind;
  1193. struct htt_rx_fragment_indication rx_frag_ind;
  1194. struct htt_rx_peer_map peer_map;
  1195. struct htt_rx_peer_unmap peer_unmap;
  1196. struct htt_rx_flush rx_flush;
  1197. struct htt_rx_addba rx_addba;
  1198. struct htt_rx_delba rx_delba;
  1199. struct htt_security_indication security_indication;
  1200. struct htt_rc_update rc_update;
  1201. struct htt_rx_test rx_test;
  1202. struct htt_pktlog_msg pktlog_msg;
  1203. struct htt_stats_conf stats_conf;
  1204. struct htt_rx_pn_ind rx_pn_ind;
  1205. struct htt_rx_offload_ind rx_offload_ind;
  1206. struct htt_rx_in_ord_ind rx_in_ord_ind;
  1207. };
  1208. } __packed;
  1209. /*** host side structures follow ***/
  1210. struct htt_tx_done {
  1211. u32 msdu_id;
  1212. bool discard;
  1213. bool no_ack;
  1214. bool success;
  1215. };
  1216. struct htt_peer_map_event {
  1217. u8 vdev_id;
  1218. u16 peer_id;
  1219. u8 addr[ETH_ALEN];
  1220. };
  1221. struct htt_peer_unmap_event {
  1222. u16 peer_id;
  1223. };
  1224. struct ath10k_htt_txbuf {
  1225. struct htt_data_tx_desc_frag frags[2];
  1226. struct ath10k_htc_hdr htc_hdr;
  1227. struct htt_cmd_hdr cmd_hdr;
  1228. struct htt_data_tx_desc cmd_tx;
  1229. } __packed;
  1230. struct ath10k_htt {
  1231. struct ath10k *ar;
  1232. enum ath10k_htc_ep_id eid;
  1233. u8 target_version_major;
  1234. u8 target_version_minor;
  1235. struct completion target_version_received;
  1236. enum ath10k_fw_htt_op_version op_version;
  1237. u8 max_num_amsdu;
  1238. u8 max_num_ampdu;
  1239. const enum htt_t2h_msg_type *t2h_msg_types;
  1240. u32 t2h_msg_types_max;
  1241. struct {
  1242. /*
  1243. * Ring of network buffer objects - This ring is
  1244. * used exclusively by the host SW. This ring
  1245. * mirrors the dev_addrs_ring that is shared
  1246. * between the host SW and the MAC HW. The host SW
  1247. * uses this netbufs ring to locate the network
  1248. * buffer objects whose data buffers the HW has
  1249. * filled.
  1250. */
  1251. struct sk_buff **netbufs_ring;
  1252. /* This is used only with firmware supporting IN_ORD_IND.
  1253. *
  1254. * With Full Rx Reorder the HTT Rx Ring is more of a temporary
  1255. * buffer ring from which buffer addresses are copied by the
  1256. * firmware to MAC Rx ring. Firmware then delivers IN_ORD_IND
  1257. * pointing to specific (re-ordered) buffers.
  1258. *
  1259. * FIXME: With kernel generic hashing functions there's a lot
  1260. * of hash collisions for sk_buffs.
  1261. */
  1262. bool in_ord_rx;
  1263. DECLARE_HASHTABLE(skb_table, 4);
  1264. /*
  1265. * Ring of buffer addresses -
  1266. * This ring holds the "physical" device address of the
  1267. * rx buffers the host SW provides for the MAC HW to
  1268. * fill.
  1269. */
  1270. __le32 *paddrs_ring;
  1271. /*
  1272. * Base address of ring, as a "physical" device address
  1273. * rather than a CPU address.
  1274. */
  1275. dma_addr_t base_paddr;
  1276. /* how many elems in the ring (power of 2) */
  1277. int size;
  1278. /* size - 1 */
  1279. unsigned size_mask;
  1280. /* how many rx buffers to keep in the ring */
  1281. int fill_level;
  1282. /* how many rx buffers (full+empty) are in the ring */
  1283. int fill_cnt;
  1284. /*
  1285. * alloc_idx - where HTT SW has deposited empty buffers
  1286. * This is allocated in consistent mem, so that the FW can
  1287. * read this variable, and program the HW's FW_IDX reg with
  1288. * the value of this shadow register.
  1289. */
  1290. struct {
  1291. __le32 *vaddr;
  1292. dma_addr_t paddr;
  1293. } alloc_idx;
  1294. /* where HTT SW has processed bufs filled by rx MAC DMA */
  1295. struct {
  1296. unsigned msdu_payld;
  1297. } sw_rd_idx;
  1298. /*
  1299. * refill_retry_timer - timer triggered when the ring is
  1300. * not refilled to the level expected
  1301. */
  1302. struct timer_list refill_retry_timer;
  1303. /* Protects access to all rx ring buffer state variables */
  1304. spinlock_t lock;
  1305. } rx_ring;
  1306. unsigned int prefetch_len;
  1307. /* Protects access to pending_tx, num_pending_tx */
  1308. spinlock_t tx_lock;
  1309. int max_num_pending_tx;
  1310. int num_pending_tx;
  1311. int num_pending_mgmt_tx;
  1312. struct idr pending_tx;
  1313. wait_queue_head_t empty_tx_wq;
  1314. /* set if host-fw communication goes haywire
  1315. * used to avoid further failures */
  1316. bool rx_confused;
  1317. struct tasklet_struct rx_replenish_task;
  1318. /* This is used to group tx/rx completions separately and process them
  1319. * in batches to reduce cache stalls */
  1320. struct tasklet_struct txrx_compl_task;
  1321. struct sk_buff_head tx_compl_q;
  1322. struct sk_buff_head rx_compl_q;
  1323. struct sk_buff_head rx_in_ord_compl_q;
  1324. /* rx_status template */
  1325. struct ieee80211_rx_status rx_status;
  1326. struct {
  1327. dma_addr_t paddr;
  1328. struct htt_msdu_ext_desc *vaddr;
  1329. } frag_desc;
  1330. struct {
  1331. dma_addr_t paddr;
  1332. struct ath10k_htt_txbuf *vaddr;
  1333. } txbuf;
  1334. };
  1335. #define RX_HTT_HDR_STATUS_LEN 64
  1336. /* This structure layout is programmed via rx ring setup
  1337. * so that FW knows how to transfer the rx descriptor to the host.
  1338. * Buffers like this are placed on the rx ring. */
  1339. struct htt_rx_desc {
  1340. union {
  1341. /* This field is filled on the host using the msdu buffer
  1342. * from htt_rx_indication */
  1343. struct fw_rx_desc_base fw_desc;
  1344. u32 pad;
  1345. } __packed;
  1346. struct {
  1347. struct rx_attention attention;
  1348. struct rx_frag_info frag_info;
  1349. struct rx_mpdu_start mpdu_start;
  1350. struct rx_msdu_start msdu_start;
  1351. struct rx_msdu_end msdu_end;
  1352. struct rx_mpdu_end mpdu_end;
  1353. struct rx_ppdu_start ppdu_start;
  1354. struct rx_ppdu_end ppdu_end;
  1355. } __packed;
  1356. u8 rx_hdr_status[RX_HTT_HDR_STATUS_LEN];
  1357. u8 msdu_payload[0];
  1358. };
  1359. #define HTT_RX_DESC_ALIGN 8
  1360. #define HTT_MAC_ADDR_LEN 6
  1361. /*
  1362. * FIX THIS
  1363. * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size,
  1364. * rounded up to a cache line size.
  1365. */
  1366. #define HTT_RX_BUF_SIZE 1920
  1367. #define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc))
  1368. /* Refill a bunch of RX buffers for each refill round so that FW/HW can handle
  1369. * aggregated traffic more nicely. */
  1370. #define ATH10K_HTT_MAX_NUM_REFILL 16
  1371. /*
  1372. * DMA_MAP expects the buffer to be an integral number of cache lines.
  1373. * Rather than checking the actual cache line size, this code makes a
  1374. * conservative estimate of what the cache line size could be.
  1375. */
  1376. #define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */
  1377. #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1)
  1378. /* These values are default in most firmware revisions and apparently are a
  1379. * sweet spot performance wise.
  1380. */
  1381. #define ATH10K_HTT_MAX_NUM_AMSDU_DEFAULT 3
  1382. #define ATH10K_HTT_MAX_NUM_AMPDU_DEFAULT 64
  1383. int ath10k_htt_connect(struct ath10k_htt *htt);
  1384. int ath10k_htt_init(struct ath10k *ar);
  1385. int ath10k_htt_setup(struct ath10k_htt *htt);
  1386. int ath10k_htt_tx_alloc(struct ath10k_htt *htt);
  1387. void ath10k_htt_tx_free(struct ath10k_htt *htt);
  1388. int ath10k_htt_rx_alloc(struct ath10k_htt *htt);
  1389. int ath10k_htt_rx_ring_refill(struct ath10k *ar);
  1390. void ath10k_htt_rx_free(struct ath10k_htt *htt);
  1391. void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb);
  1392. void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
  1393. int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt);
  1394. int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u8 mask, u64 cookie);
  1395. int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt);
  1396. int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt);
  1397. int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
  1398. u8 max_subfrms_ampdu,
  1399. u8 max_subfrms_amsdu);
  1400. void ath10k_htt_hif_tx_complete(struct ath10k *ar, struct sk_buff *skb);
  1401. void __ath10k_htt_tx_dec_pending(struct ath10k_htt *htt, bool limit_mgmt_desc);
  1402. int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb);
  1403. void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id);
  1404. int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *);
  1405. int ath10k_htt_tx(struct ath10k_htt *htt,
  1406. enum ath10k_hw_txrx_mode txmode,
  1407. struct sk_buff *msdu);
  1408. void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
  1409. struct sk_buff *skb);
  1410. #endif