dp_htt.c 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489
  1. /*
  2. * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #include <htt.h>
  19. #include <hal_api.h>
  20. #include "dp_htt.h"
  21. #include "dp_peer.h"
  22. #include "dp_types.h"
  23. #include "dp_internal.h"
  24. #include "dp_rx_mon.h"
  25. #include "htt_stats.h"
  26. #include "qdf_mem.h" /* qdf_mem_malloc,free */
  27. #define HTT_TLV_HDR_LEN HTT_T2H_EXT_STATS_CONF_TLV_HDR_SIZE
  28. #define HTT_HTC_PKT_POOL_INIT_SIZE 64
  29. #define HTT_T2H_MAX_MSG_SIZE 2048
  30. #define HTT_MSG_BUF_SIZE(msg_bytes) \
  31. ((msg_bytes) + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING)
  32. #define DP_EXT_MSG_LENGTH 2048
  33. /*
  34. * htt_htc_pkt_alloc() - Allocate HTC packet buffer
  35. * @htt_soc: HTT SOC handle
  36. *
  37. * Return: Pointer to htc packet buffer
  38. */
  39. static struct dp_htt_htc_pkt *
  40. htt_htc_pkt_alloc(struct htt_soc *soc)
  41. {
  42. struct dp_htt_htc_pkt_union *pkt = NULL;
  43. HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex);
  44. if (soc->htt_htc_pkt_freelist) {
  45. pkt = soc->htt_htc_pkt_freelist;
  46. soc->htt_htc_pkt_freelist = soc->htt_htc_pkt_freelist->u.next;
  47. }
  48. HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex);
  49. if (pkt == NULL)
  50. pkt = qdf_mem_malloc(sizeof(*pkt));
  51. return &pkt->u.pkt; /* not actually a dereference */
  52. }
  53. /*
  54. * htt_htc_pkt_free() - Free HTC packet buffer
  55. * @htt_soc: HTT SOC handle
  56. */
  57. static void
  58. htt_htc_pkt_free(struct htt_soc *soc, struct dp_htt_htc_pkt *pkt)
  59. {
  60. struct dp_htt_htc_pkt_union *u_pkt =
  61. (struct dp_htt_htc_pkt_union *)pkt;
  62. HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex);
  63. u_pkt->u.next = soc->htt_htc_pkt_freelist;
  64. soc->htt_htc_pkt_freelist = u_pkt;
  65. HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex);
  66. }
  67. /*
  68. * htt_htc_pkt_pool_free() - Free HTC packet pool
  69. * @htt_soc: HTT SOC handle
  70. */
  71. static void
  72. htt_htc_pkt_pool_free(struct htt_soc *soc)
  73. {
  74. struct dp_htt_htc_pkt_union *pkt, *next;
  75. pkt = soc->htt_htc_pkt_freelist;
  76. while (pkt) {
  77. next = pkt->u.next;
  78. qdf_mem_free(pkt);
  79. pkt = next;
  80. }
  81. soc->htt_htc_pkt_freelist = NULL;
  82. }
  83. /*
  84. * htt_t2h_mac_addr_deswizzle() - Swap MAC addr bytes if FW endianess differ
  85. * @tgt_mac_addr: Target MAC
  86. * @buffer: Output buffer
  87. */
  88. static u_int8_t *
  89. htt_t2h_mac_addr_deswizzle(u_int8_t *tgt_mac_addr, u_int8_t *buffer)
  90. {
  91. #ifdef BIG_ENDIAN_HOST
  92. /*
  93. * The host endianness is opposite of the target endianness.
  94. * To make u_int32_t elements come out correctly, the target->host
  95. * upload has swizzled the bytes in each u_int32_t element of the
  96. * message.
  97. * For byte-array message fields like the MAC address, this
  98. * upload swizzling puts the bytes in the wrong order, and needs
  99. * to be undone.
  100. */
  101. buffer[0] = tgt_mac_addr[3];
  102. buffer[1] = tgt_mac_addr[2];
  103. buffer[2] = tgt_mac_addr[1];
  104. buffer[3] = tgt_mac_addr[0];
  105. buffer[4] = tgt_mac_addr[7];
  106. buffer[5] = tgt_mac_addr[6];
  107. return buffer;
  108. #else
  109. /*
  110. * The host endianness matches the target endianness -
  111. * we can use the mac addr directly from the message buffer.
  112. */
  113. return tgt_mac_addr;
  114. #endif
  115. }
  116. /*
  117. * dp_htt_h2t_send_complete_free_netbuf() - Free completed buffer
  118. * @soc: SOC handle
  119. * @status: Completion status
  120. * @netbuf: HTT buffer
  121. */
  122. static void
  123. dp_htt_h2t_send_complete_free_netbuf(
  124. void *soc, A_STATUS status, qdf_nbuf_t netbuf)
  125. {
  126. qdf_nbuf_free(netbuf);
  127. }
  128. /*
  129. * dp_htt_h2t_send_complete() - H2T completion handler
  130. * @context: Opaque context (HTT SOC handle)
  131. * @htc_pkt: HTC packet
  132. */
  133. static void
  134. dp_htt_h2t_send_complete(void *context, HTC_PACKET *htc_pkt)
  135. {
  136. void (*send_complete_part2)(
  137. void *soc, A_STATUS status, qdf_nbuf_t msdu);
  138. struct htt_soc *soc = (struct htt_soc *) context;
  139. struct dp_htt_htc_pkt *htt_pkt;
  140. qdf_nbuf_t netbuf;
  141. send_complete_part2 = htc_pkt->pPktContext;
  142. htt_pkt = container_of(htc_pkt, struct dp_htt_htc_pkt, htc_pkt);
  143. /* process (free or keep) the netbuf that held the message */
  144. netbuf = (qdf_nbuf_t) htc_pkt->pNetBufContext;
  145. /*
  146. * adf sendcomplete is required for windows only
  147. */
  148. /* qdf_nbuf_set_sendcompleteflag(netbuf, TRUE); */
  149. if (send_complete_part2 != NULL) {
  150. send_complete_part2(
  151. htt_pkt->soc_ctxt, htc_pkt->Status, netbuf);
  152. }
  153. /* free the htt_htc_pkt / HTC_PACKET object */
  154. htt_htc_pkt_free(soc, htt_pkt);
  155. }
  156. /*
  157. * htt_h2t_ver_req_msg() - Send HTT version request message to target
  158. * @htt_soc: HTT SOC handle
  159. *
  160. * Return: 0 on success; error code on failure
  161. */
  162. static int htt_h2t_ver_req_msg(struct htt_soc *soc)
  163. {
  164. struct dp_htt_htc_pkt *pkt;
  165. qdf_nbuf_t msg;
  166. uint32_t *msg_word;
  167. msg = qdf_nbuf_alloc(
  168. soc->osdev,
  169. HTT_MSG_BUF_SIZE(HTT_VER_REQ_BYTES),
  170. /* reserve room for the HTC header */
  171. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  172. if (!msg)
  173. return QDF_STATUS_E_NOMEM;
  174. /*
  175. * Set the length of the message.
  176. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  177. * separately during the below call to qdf_nbuf_push_head.
  178. * The contribution from the HTC header is added separately inside HTC.
  179. */
  180. if (qdf_nbuf_put_tail(msg, HTT_VER_REQ_BYTES) == NULL) {
  181. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  182. "%s: Failed to expand head for HTT_H2T_MSG_TYPE_VERSION_REQ msg\n",
  183. __func__);
  184. return QDF_STATUS_E_FAILURE;
  185. }
  186. /* fill in the message contents */
  187. msg_word = (u_int32_t *) qdf_nbuf_data(msg);
  188. /* rewind beyond alignment pad to get to the HTC header reserved area */
  189. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  190. *msg_word = 0;
  191. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_VERSION_REQ);
  192. pkt = htt_htc_pkt_alloc(soc);
  193. if (!pkt) {
  194. qdf_nbuf_free(msg);
  195. return QDF_STATUS_E_FAILURE;
  196. }
  197. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  198. SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
  199. dp_htt_h2t_send_complete_free_netbuf, qdf_nbuf_data(msg),
  200. qdf_nbuf_len(msg), soc->htc_endpoint,
  201. 1); /* tag - not relevant here */
  202. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  203. htc_send_pkt(soc->htc_soc, &pkt->htc_pkt);
  204. return 0;
  205. }
  206. /*
  207. * htt_srng_setup() - Send SRNG setup message to target
  208. * @htt_soc: HTT SOC handle
  209. * @mac_id: MAC Id
  210. * @hal_srng: Opaque HAL SRNG pointer
  211. * @hal_ring_type: SRNG ring type
  212. *
  213. * Return: 0 on success; error code on failure
  214. */
  215. int htt_srng_setup(void *htt_soc, int mac_id, void *hal_srng,
  216. int hal_ring_type)
  217. {
  218. struct htt_soc *soc = (struct htt_soc *)htt_soc;
  219. struct dp_htt_htc_pkt *pkt;
  220. qdf_nbuf_t htt_msg;
  221. uint32_t *msg_word;
  222. struct hal_srng_params srng_params;
  223. qdf_dma_addr_t hp_addr, tp_addr;
  224. uint32_t ring_entry_size =
  225. hal_srng_get_entrysize(soc->hal_soc, hal_ring_type);
  226. int htt_ring_type, htt_ring_id;
  227. /* Sizes should be set in 4-byte words */
  228. ring_entry_size = ring_entry_size >> 2;
  229. htt_msg = qdf_nbuf_alloc(soc->osdev,
  230. HTT_MSG_BUF_SIZE(HTT_SRING_SETUP_SZ),
  231. /* reserve room for the HTC header */
  232. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  233. if (!htt_msg)
  234. goto fail0;
  235. hal_get_srng_params(soc->hal_soc, hal_srng, &srng_params);
  236. hp_addr = hal_srng_get_hp_addr(soc->hal_soc, hal_srng);
  237. tp_addr = hal_srng_get_tp_addr(soc->hal_soc, hal_srng);
  238. switch (hal_ring_type) {
  239. case RXDMA_BUF:
  240. #ifdef QCA_HOST2FW_RXBUF_RING
  241. if (srng_params.ring_id ==
  242. (HAL_SRNG_WMAC1_SW2RXDMA0_BUF)) {
  243. htt_ring_id = HTT_HOST1_TO_FW_RXBUF_RING;
  244. htt_ring_type = HTT_SW_TO_SW_RING;
  245. #else
  246. if (srng_params.ring_id ==
  247. (HAL_SRNG_WMAC1_SW2RXDMA0_BUF +
  248. (mac_id * HAL_MAX_RINGS_PER_LMAC))) {
  249. htt_ring_id = HTT_RXDMA_HOST_BUF_RING;
  250. htt_ring_type = HTT_SW_TO_HW_RING;
  251. #endif
  252. } else if (srng_params.ring_id ==
  253. (HAL_SRNG_WMAC1_SW2RXDMA1_BUF +
  254. (mac_id * HAL_MAX_RINGS_PER_LMAC))) {
  255. htt_ring_id = HTT_RXDMA_HOST_BUF_RING;
  256. htt_ring_type = HTT_SW_TO_HW_RING;
  257. } else {
  258. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  259. "%s: Ring %d currently not supported\n",
  260. __func__, srng_params.ring_id);
  261. goto fail1;
  262. }
  263. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  264. "%s: ring_type %d ring_id %d\n",
  265. __func__, hal_ring_type, srng_params.ring_id);
  266. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  267. "%s: hp_addr 0x%llx tp_addr 0x%llx\n",
  268. __func__, (uint64_t)hp_addr, (uint64_t)tp_addr);
  269. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  270. "%s: htt_ring_id %d\n", __func__, htt_ring_id);
  271. break;
  272. case RXDMA_MONITOR_BUF:
  273. htt_ring_id = HTT_RXDMA_MONITOR_BUF_RING;
  274. htt_ring_type = HTT_SW_TO_HW_RING;
  275. break;
  276. case RXDMA_MONITOR_STATUS:
  277. htt_ring_id = HTT_RXDMA_MONITOR_STATUS_RING;
  278. htt_ring_type = HTT_SW_TO_HW_RING;
  279. break;
  280. case RXDMA_MONITOR_DST:
  281. htt_ring_id = HTT_RXDMA_MONITOR_DEST_RING;
  282. htt_ring_type = HTT_HW_TO_SW_RING;
  283. break;
  284. case RXDMA_MONITOR_DESC:
  285. htt_ring_id = HTT_RXDMA_MONITOR_DESC_RING;
  286. htt_ring_type = HTT_SW_TO_HW_RING;
  287. break;
  288. default:
  289. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  290. "%s: Ring currently not supported\n", __func__);
  291. goto fail1;
  292. }
  293. /*
  294. * Set the length of the message.
  295. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  296. * separately during the below call to qdf_nbuf_push_head.
  297. * The contribution from the HTC header is added separately inside HTC.
  298. */
  299. if (qdf_nbuf_put_tail(htt_msg, HTT_SRING_SETUP_SZ) == NULL) {
  300. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  301. "%s: Failed to expand head for SRING_SETUP msg\n",
  302. __func__);
  303. return QDF_STATUS_E_FAILURE;
  304. }
  305. msg_word = (uint32_t *)qdf_nbuf_data(htt_msg);
  306. /* rewind beyond alignment pad to get to the HTC header reserved area */
  307. qdf_nbuf_push_head(htt_msg, HTC_HDR_ALIGNMENT_PADDING);
  308. /* word 0 */
  309. *msg_word = 0;
  310. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_SRING_SETUP);
  311. if ((htt_ring_type == HTT_SW_TO_HW_RING) ||
  312. (htt_ring_type == HTT_HW_TO_SW_RING))
  313. HTT_SRING_SETUP_PDEV_ID_SET(*msg_word,
  314. DP_SW2HW_MACID(mac_id));
  315. else
  316. HTT_SRING_SETUP_PDEV_ID_SET(*msg_word, mac_id);
  317. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  318. "%s: mac_id %d\n", __func__, mac_id);
  319. HTT_SRING_SETUP_RING_TYPE_SET(*msg_word, htt_ring_type);
  320. /* TODO: Discuss with FW on changing this to unique ID and using
  321. * htt_ring_type to send the type of ring
  322. */
  323. HTT_SRING_SETUP_RING_ID_SET(*msg_word, htt_ring_id);
  324. /* word 1 */
  325. msg_word++;
  326. *msg_word = 0;
  327. HTT_SRING_SETUP_RING_BASE_ADDR_LO_SET(*msg_word,
  328. srng_params.ring_base_paddr & 0xffffffff);
  329. /* word 2 */
  330. msg_word++;
  331. *msg_word = 0;
  332. HTT_SRING_SETUP_RING_BASE_ADDR_HI_SET(*msg_word,
  333. (uint64_t)srng_params.ring_base_paddr >> 32);
  334. /* word 3 */
  335. msg_word++;
  336. *msg_word = 0;
  337. HTT_SRING_SETUP_ENTRY_SIZE_SET(*msg_word, ring_entry_size);
  338. HTT_SRING_SETUP_RING_SIZE_SET(*msg_word,
  339. (ring_entry_size * srng_params.num_entries));
  340. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  341. "%s: entry_size %d\n", __func__,
  342. ring_entry_size);
  343. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  344. "%s: num_entries %d\n", __func__,
  345. srng_params.num_entries);
  346. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  347. "%s: ring_size %d\n", __func__,
  348. (ring_entry_size * srng_params.num_entries));
  349. if (htt_ring_type == HTT_SW_TO_HW_RING)
  350. HTT_SRING_SETUP_RING_MISC_CFG_FLAG_LOOPCOUNT_DISABLE_SET(
  351. *msg_word, 1);
  352. HTT_SRING_SETUP_RING_MISC_CFG_FLAG_MSI_SWAP_SET(*msg_word,
  353. !!(srng_params.flags & HAL_SRNG_MSI_SWAP));
  354. HTT_SRING_SETUP_RING_MISC_CFG_FLAG_TLV_SWAP_SET(*msg_word,
  355. !!(srng_params.flags & HAL_SRNG_DATA_TLV_SWAP));
  356. HTT_SRING_SETUP_RING_MISC_CFG_FLAG_HOST_FW_SWAP_SET(*msg_word,
  357. !!(srng_params.flags & HAL_SRNG_RING_PTR_SWAP));
  358. /* word 4 */
  359. msg_word++;
  360. *msg_word = 0;
  361. HTT_SRING_SETUP_HEAD_OFFSET32_REMOTE_BASE_ADDR_LO_SET(*msg_word,
  362. hp_addr & 0xffffffff);
  363. /* word 5 */
  364. msg_word++;
  365. *msg_word = 0;
  366. HTT_SRING_SETUP_HEAD_OFFSET32_REMOTE_BASE_ADDR_HI_SET(*msg_word,
  367. (uint64_t)hp_addr >> 32);
  368. /* word 6 */
  369. msg_word++;
  370. *msg_word = 0;
  371. HTT_SRING_SETUP_TAIL_OFFSET32_REMOTE_BASE_ADDR_LO_SET(*msg_word,
  372. tp_addr & 0xffffffff);
  373. /* word 7 */
  374. msg_word++;
  375. *msg_word = 0;
  376. HTT_SRING_SETUP_TAIL_OFFSET32_REMOTE_BASE_ADDR_HI_SET(*msg_word,
  377. (uint64_t)tp_addr >> 32);
  378. /* word 8 */
  379. msg_word++;
  380. *msg_word = 0;
  381. HTT_SRING_SETUP_RING_MSI_ADDR_LO_SET(*msg_word,
  382. srng_params.msi_addr & 0xffffffff);
  383. /* word 9 */
  384. msg_word++;
  385. *msg_word = 0;
  386. HTT_SRING_SETUP_RING_MSI_ADDR_HI_SET(*msg_word,
  387. (uint64_t)(srng_params.msi_addr) >> 32);
  388. /* word 10 */
  389. msg_word++;
  390. *msg_word = 0;
  391. HTT_SRING_SETUP_RING_MSI_DATA_SET(*msg_word,
  392. srng_params.msi_data);
  393. /* word 11 */
  394. msg_word++;
  395. *msg_word = 0;
  396. HTT_SRING_SETUP_INTR_BATCH_COUNTER_TH_SET(*msg_word,
  397. srng_params.intr_batch_cntr_thres_entries *
  398. ring_entry_size);
  399. HTT_SRING_SETUP_INTR_TIMER_TH_SET(*msg_word,
  400. srng_params.intr_timer_thres_us >> 3);
  401. /* word 12 */
  402. msg_word++;
  403. *msg_word = 0;
  404. if (srng_params.flags & HAL_SRNG_LOW_THRES_INTR_ENABLE) {
  405. /* TODO: Setting low threshold to 1/8th of ring size - see
  406. * if this needs to be configurable
  407. */
  408. HTT_SRING_SETUP_INTR_LOW_TH_SET(*msg_word,
  409. srng_params.low_threshold);
  410. }
  411. /* "response_required" field should be set if a HTT response message is
  412. * required after setting up the ring.
  413. */
  414. pkt = htt_htc_pkt_alloc(soc);
  415. if (!pkt)
  416. goto fail1;
  417. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  418. SET_HTC_PACKET_INFO_TX(
  419. &pkt->htc_pkt,
  420. dp_htt_h2t_send_complete_free_netbuf,
  421. qdf_nbuf_data(htt_msg),
  422. qdf_nbuf_len(htt_msg),
  423. soc->htc_endpoint,
  424. 1); /* tag - not relevant here */
  425. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg);
  426. htc_send_pkt(soc->htc_soc, &pkt->htc_pkt);
  427. return QDF_STATUS_SUCCESS;
  428. fail1:
  429. qdf_nbuf_free(htt_msg);
  430. fail0:
  431. return QDF_STATUS_E_FAILURE;
  432. }
  433. /*
  434. * htt_h2t_rx_ring_cfg() - Send SRNG packet and TLV filter
  435. * config message to target
  436. * @htt_soc: HTT SOC handle
  437. * @pdev_id: PDEV Id
  438. * @hal_srng: Opaque HAL SRNG pointer
  439. * @hal_ring_type: SRNG ring type
  440. * @ring_buf_size: SRNG buffer size
  441. * @htt_tlv_filter: Rx SRNG TLV and filter setting
  442. * Return: 0 on success; error code on failure
  443. */
  444. int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng,
  445. int hal_ring_type, int ring_buf_size,
  446. struct htt_rx_ring_tlv_filter *htt_tlv_filter)
  447. {
  448. struct htt_soc *soc = (struct htt_soc *)htt_soc;
  449. struct dp_htt_htc_pkt *pkt;
  450. qdf_nbuf_t htt_msg;
  451. uint32_t *msg_word;
  452. struct hal_srng_params srng_params;
  453. uint32_t htt_ring_type, htt_ring_id;
  454. uint32_t tlv_filter;
  455. htt_msg = qdf_nbuf_alloc(soc->osdev,
  456. HTT_MSG_BUF_SIZE(HTT_RX_RING_SELECTION_CFG_SZ),
  457. /* reserve room for the HTC header */
  458. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  459. if (!htt_msg)
  460. goto fail0;
  461. hal_get_srng_params(soc->hal_soc, hal_srng, &srng_params);
  462. switch (hal_ring_type) {
  463. case RXDMA_BUF:
  464. #if QCA_HOST2FW_RXBUF_RING
  465. htt_ring_id = HTT_HOST1_TO_FW_RXBUF_RING;
  466. htt_ring_type = HTT_SW_TO_SW_RING;
  467. #else
  468. htt_ring_id = HTT_RXDMA_HOST_BUF_RING;
  469. htt_ring_type = HTT_SW_TO_HW_RING;
  470. #endif
  471. break;
  472. case RXDMA_MONITOR_BUF:
  473. htt_ring_id = HTT_RXDMA_MONITOR_BUF_RING;
  474. htt_ring_type = HTT_SW_TO_HW_RING;
  475. break;
  476. case RXDMA_MONITOR_STATUS:
  477. htt_ring_id = HTT_RXDMA_MONITOR_STATUS_RING;
  478. htt_ring_type = HTT_SW_TO_HW_RING;
  479. break;
  480. case RXDMA_MONITOR_DST:
  481. htt_ring_id = HTT_RXDMA_MONITOR_DEST_RING;
  482. htt_ring_type = HTT_HW_TO_SW_RING;
  483. break;
  484. case RXDMA_MONITOR_DESC:
  485. htt_ring_id = HTT_RXDMA_MONITOR_DESC_RING;
  486. htt_ring_type = HTT_SW_TO_HW_RING;
  487. break;
  488. default:
  489. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  490. "%s: Ring currently not supported\n", __func__);
  491. goto fail1;
  492. }
  493. /*
  494. * Set the length of the message.
  495. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  496. * separately during the below call to qdf_nbuf_push_head.
  497. * The contribution from the HTC header is added separately inside HTC.
  498. */
  499. if (qdf_nbuf_put_tail(htt_msg, HTT_RX_RING_SELECTION_CFG_SZ) == NULL) {
  500. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  501. "%s: Failed to expand head for RX Ring Cfg msg\n",
  502. __func__);
  503. goto fail1; /* failure */
  504. }
  505. msg_word = (uint32_t *)qdf_nbuf_data(htt_msg);
  506. /* rewind beyond alignment pad to get to the HTC header reserved area */
  507. qdf_nbuf_push_head(htt_msg, HTC_HDR_ALIGNMENT_PADDING);
  508. /* word 0 */
  509. *msg_word = 0;
  510. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG);
  511. HTT_RX_RING_SELECTION_CFG_PDEV_ID_SET(*msg_word,
  512. DP_SW2HW_MACID(pdev_id));
  513. /* TODO: Discuss with FW on changing this to unique ID and using
  514. * htt_ring_type to send the type of ring
  515. */
  516. HTT_RX_RING_SELECTION_CFG_RING_ID_SET(*msg_word, htt_ring_id);
  517. HTT_RX_RING_SELECTION_CFG_STATUS_TLV_SET(*msg_word,
  518. !!(srng_params.flags & HAL_SRNG_MSI_SWAP));
  519. HTT_RX_RING_SELECTION_CFG_PKT_TLV_SET(*msg_word,
  520. !!(srng_params.flags & HAL_SRNG_DATA_TLV_SWAP));
  521. /* word 1 */
  522. msg_word++;
  523. *msg_word = 0;
  524. HTT_RX_RING_SELECTION_CFG_RING_BUFFER_SIZE_SET(*msg_word,
  525. ring_buf_size);
  526. /* word 2 */
  527. msg_word++;
  528. *msg_word = 0;
  529. if (htt_tlv_filter->enable_fp) {
  530. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  531. MGMT, 0000, 1);
  532. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  533. MGMT, 0001, 1);
  534. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  535. MGMT, 0010, 1);
  536. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  537. MGMT, 0011, 1);
  538. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  539. MGMT, 0100, 1);
  540. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  541. MGMT, 0101, 1);
  542. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  543. MGMT, 0110, 1);
  544. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  545. MGMT, 1000, 1);
  546. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  547. MGMT, 1001, 1);
  548. }
  549. if (htt_tlv_filter->enable_md) {
  550. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  551. MGMT, 0000, 1);
  552. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  553. MGMT, 0001, 1);
  554. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  555. MGMT, 0010, 1);
  556. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  557. MGMT, 0011, 1);
  558. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  559. MGMT, 0100, 1);
  560. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  561. MGMT, 0101, 1);
  562. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  563. MGMT, 0110, 1);
  564. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  565. MGMT, 1000, 1);
  566. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  567. MGMT, 1001, 1);
  568. }
  569. if (htt_tlv_filter->enable_mo) {
  570. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  571. MGMT, 0000, 1);
  572. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  573. MGMT, 0001, 1);
  574. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  575. MGMT, 0010, 1);
  576. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  577. MGMT, 0011, 1);
  578. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  579. MGMT, 0100, 1);
  580. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  581. MGMT, 0101, 1);
  582. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  583. MGMT, 0110, 1);
  584. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  585. MGMT, 1000, 1);
  586. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  587. MGMT, 1001, 1);
  588. }
  589. /* word 3 */
  590. msg_word++;
  591. *msg_word = 0;
  592. if (htt_tlv_filter->enable_fp) {
  593. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, FP,
  594. MGMT, 1010, 1);
  595. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, FP,
  596. MGMT, 1011, 1);
  597. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, FP,
  598. MGMT, 1100, 1);
  599. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, FP,
  600. MGMT, 1101, 1);
  601. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, FP,
  602. MGMT, 1110, 1);
  603. }
  604. if (htt_tlv_filter->enable_md) {
  605. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD,
  606. MGMT, 1010, 1);
  607. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD,
  608. MGMT, 1011, 1);
  609. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD,
  610. MGMT, 1100, 1);
  611. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD,
  612. MGMT, 1101, 1);
  613. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD,
  614. MGMT, 1110, 1);
  615. }
  616. if (htt_tlv_filter->enable_mo) {
  617. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MO,
  618. MGMT, 1010, 1);
  619. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MO,
  620. MGMT, 1011, 1);
  621. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MO,
  622. MGMT, 1100, 1);
  623. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MO,
  624. MGMT, 1101, 1);
  625. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MO,
  626. MGMT, 1110, 1);
  627. }
  628. /* word 4 */
  629. msg_word++;
  630. *msg_word = 0;
  631. if (htt_tlv_filter->enable_fp) {
  632. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  633. CTRL, 0111, 1);
  634. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  635. CTRL, 1000, 1);
  636. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  637. CTRL, 1001, 1);
  638. }
  639. if (htt_tlv_filter->enable_md) {
  640. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  641. CTRL, 0111, 1);
  642. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  643. CTRL, 1000, 1);
  644. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  645. CTRL, 1001, 1);
  646. }
  647. if (htt_tlv_filter->enable_mo) {
  648. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  649. CTRL, 0111, 1);
  650. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  651. CTRL, 1000, 1);
  652. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  653. CTRL, 1001, 1);
  654. }
  655. /* word 5 */
  656. msg_word++;
  657. *msg_word = 0;
  658. if (htt_tlv_filter->enable_fp) {
  659. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  660. CTRL, 1010, 1);
  661. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  662. CTRL, 1011, 1);
  663. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  664. CTRL, 1100, 1);
  665. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  666. CTRL, 1101, 1);
  667. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  668. CTRL, 1110, 1);
  669. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  670. CTRL, 1111, 1);
  671. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  672. CTRL, 1111, 1);
  673. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  674. DATA, MCAST, 1);
  675. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  676. DATA, UCAST, 1);
  677. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  678. DATA, NULL, 1);
  679. }
  680. if (htt_tlv_filter->enable_md) {
  681. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  682. CTRL, 1010, 1);
  683. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  684. CTRL, 1011, 1);
  685. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  686. CTRL, 1100, 1);
  687. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  688. CTRL, 1101, 1);
  689. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  690. CTRL, 1110, 1);
  691. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  692. CTRL, 1111, 1);
  693. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  694. CTRL, 1111, 1);
  695. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  696. DATA, MCAST, 1);
  697. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  698. DATA, UCAST, 1);
  699. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  700. DATA, NULL, 1);
  701. }
  702. if (htt_tlv_filter->enable_mo) {
  703. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  704. CTRL, 1010, 1);
  705. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  706. CTRL, 1011, 1);
  707. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  708. CTRL, 1100, 1);
  709. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  710. CTRL, 1101, 1);
  711. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  712. CTRL, 1110, 1);
  713. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  714. CTRL, 1111, 1);
  715. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  716. CTRL, 1111, 1);
  717. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  718. DATA, MCAST, 1);
  719. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  720. DATA, UCAST, 1);
  721. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  722. DATA, NULL, 1);
  723. }
  724. /* word 6 */
  725. msg_word++;
  726. *msg_word = 0;
  727. tlv_filter = 0;
  728. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MPDU_START,
  729. htt_tlv_filter->mpdu_start);
  730. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MSDU_START,
  731. htt_tlv_filter->msdu_start);
  732. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PACKET,
  733. htt_tlv_filter->packet);
  734. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MSDU_END,
  735. htt_tlv_filter->msdu_end);
  736. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MPDU_END,
  737. htt_tlv_filter->mpdu_end);
  738. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PACKET_HEADER,
  739. htt_tlv_filter->packet_header);
  740. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, ATTENTION,
  741. htt_tlv_filter->attention);
  742. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_START,
  743. htt_tlv_filter->ppdu_start);
  744. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END,
  745. htt_tlv_filter->ppdu_end);
  746. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END_USER_STATS,
  747. htt_tlv_filter->ppdu_end_user_stats);
  748. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter,
  749. PPDU_END_USER_STATS_EXT,
  750. htt_tlv_filter->ppdu_end_user_stats_ext);
  751. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END_STATUS_DONE,
  752. htt_tlv_filter->ppdu_end_status_done);
  753. HTT_RX_RING_SELECTION_CFG_TLV_FILTER_IN_FLAG_SET(*msg_word, tlv_filter);
  754. /* "response_required" field should be set if a HTT response message is
  755. * required after setting up the ring.
  756. */
  757. pkt = htt_htc_pkt_alloc(soc);
  758. if (!pkt)
  759. goto fail1;
  760. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  761. SET_HTC_PACKET_INFO_TX(
  762. &pkt->htc_pkt,
  763. dp_htt_h2t_send_complete_free_netbuf,
  764. qdf_nbuf_data(htt_msg),
  765. qdf_nbuf_len(htt_msg),
  766. soc->htc_endpoint,
  767. 1); /* tag - not relevant here */
  768. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg);
  769. htc_send_pkt(soc->htc_soc, &pkt->htc_pkt);
  770. return QDF_STATUS_SUCCESS;
  771. fail1:
  772. qdf_nbuf_free(htt_msg);
  773. fail0:
  774. return QDF_STATUS_E_FAILURE;
  775. }
  776. /**
  777. * dp_process_htt_stat_msg(): Process the list of buffers of HTT EXT stats
  778. * @soc: DP SOC handle
  779. *
  780. * The FW sends the HTT EXT STATS as a stream of T2H messages. Each T2H message
  781. * contains sub messages which are identified by a TLV header.
  782. * In this function we will process the stream of T2H messages and read all the
  783. * TLV contained in the message.
  784. *
  785. * THe following cases have been taken care of
  786. * Case 1: When the tlv_remain_length <= msg_remain_length of HTT MSG buffer
  787. * In this case the buffer will contain multiple tlvs.
  788. * Case 2: When the tlv_remain_length > msg_remain_length of HTT MSG buffer.
  789. * Only one tlv will be contained in the HTT message and this tag
  790. * will extend onto the next buffer.
  791. * Case 3: When the buffer is the continuation of the previous message
  792. * Case 4: tlv length is 0. which will indicate the end of message
  793. *
  794. * return: void
  795. */
  796. static inline void dp_process_htt_stat_msg(struct dp_soc *soc)
  797. {
  798. htt_tlv_tag_t tlv_type = 0xff;
  799. qdf_nbuf_t htt_msg = NULL;
  800. uint32_t *msg_word;
  801. uint8_t *tlv_buf_head = NULL;
  802. uint8_t *tlv_buf_tail = NULL;
  803. uint32_t msg_remain_len = 0;
  804. uint32_t tlv_remain_len = 0;
  805. uint32_t *tlv_start;
  806. /* Process node in the HTT message queue */
  807. while ((htt_msg = qdf_nbuf_queue_remove(&soc->htt_stats_msg)) != NULL) {
  808. msg_word = (uint32_t *) qdf_nbuf_data(htt_msg);
  809. /* read 5th word */
  810. msg_word = msg_word + 4;
  811. msg_remain_len = qdf_min(soc->htt_msg_len,
  812. (uint32_t)DP_EXT_MSG_LENGTH);
  813. /* Keep processing the node till node length is 0 */
  814. while (msg_remain_len) {
  815. /*
  816. * if message is not a continuation of previous message
  817. * read the tlv type and tlv length
  818. */
  819. if (!tlv_buf_head) {
  820. tlv_type = HTT_STATS_TLV_TAG_GET(
  821. *msg_word);
  822. tlv_remain_len = HTT_STATS_TLV_LENGTH_GET(
  823. *msg_word);
  824. }
  825. if (tlv_remain_len == 0) {
  826. msg_remain_len = 0;
  827. if (tlv_buf_head) {
  828. qdf_mem_free(tlv_buf_head);
  829. tlv_buf_head = NULL;
  830. tlv_buf_tail = NULL;
  831. }
  832. goto error;
  833. }
  834. tlv_remain_len += HTT_TLV_HDR_LEN;
  835. if ((tlv_remain_len <= msg_remain_len)) {
  836. /* Case 3 */
  837. if (tlv_buf_head) {
  838. qdf_mem_copy(tlv_buf_tail,
  839. (uint8_t *)msg_word,
  840. tlv_remain_len);
  841. tlv_start = (uint32_t *)tlv_buf_head;
  842. } else {
  843. /* Case 1 */
  844. tlv_start = msg_word;
  845. }
  846. dp_htt_stats_print_tag(tlv_type, tlv_start);
  847. msg_remain_len -= tlv_remain_len;
  848. msg_word = (uint32_t *)
  849. (((uint8_t *)msg_word) +
  850. tlv_remain_len);
  851. tlv_remain_len = 0;
  852. if (tlv_buf_head) {
  853. qdf_mem_free(tlv_buf_head);
  854. tlv_buf_head = NULL;
  855. tlv_buf_tail = NULL;
  856. }
  857. } else { /* tlv_remain_len > msg_remain_len */
  858. /* Case 2 & 3 */
  859. if (!tlv_buf_head) {
  860. tlv_buf_head = qdf_mem_malloc(
  861. tlv_remain_len);
  862. if (!tlv_buf_head) {
  863. QDF_TRACE(QDF_MODULE_ID_TXRX,
  864. QDF_TRACE_LEVEL_ERROR,
  865. "Alloc failed");
  866. goto error;
  867. }
  868. tlv_buf_tail = tlv_buf_head;
  869. }
  870. qdf_mem_copy(tlv_buf_tail, (uint8_t *)msg_word,
  871. msg_remain_len);
  872. tlv_remain_len -= msg_remain_len;
  873. tlv_buf_tail += msg_remain_len;
  874. msg_remain_len = 0;
  875. }
  876. }
  877. if (soc->htt_msg_len >= DP_EXT_MSG_LENGTH) {
  878. soc->htt_msg_len -= DP_EXT_MSG_LENGTH;
  879. }
  880. qdf_nbuf_free(htt_msg);
  881. }
  882. soc->htt_msg_len = 0;
  883. return;
  884. error:
  885. qdf_nbuf_free(htt_msg);
  886. soc->htt_msg_len = 0;
  887. while ((htt_msg = qdf_nbuf_queue_remove(&soc->htt_stats_msg))
  888. != NULL)
  889. qdf_nbuf_free(htt_msg);
  890. }
  891. /**
  892. * dp_txrx_fw_stats_handler():Function to process HTT EXT stats
  893. * @soc: DP SOC handle
  894. * @htt_t2h_msg: HTT message nbuf
  895. *
  896. * return:void
  897. */
  898. static inline void dp_txrx_fw_stats_handler(struct dp_soc *soc,
  899. qdf_nbuf_t htt_t2h_msg)
  900. {
  901. uint32_t length;
  902. uint8_t done;
  903. qdf_nbuf_t msg_copy;
  904. uint32_t *msg_word;
  905. msg_word = (uint32_t *) qdf_nbuf_data(htt_t2h_msg);
  906. msg_word = msg_word + 3;
  907. done = 0;
  908. length = HTT_T2H_EXT_STATS_CONF_TLV_LENGTH_GET(*msg_word);
  909. done = HTT_T2H_EXT_STATS_CONF_TLV_DONE_GET(*msg_word);
  910. /*
  911. * HTT EXT stats response comes as stream of TLVs which span over
  912. * multiple T2H messages.
  913. * The first message will carry length of the response.
  914. * For rest of the messages length will be zero.
  915. */
  916. if (soc->htt_msg_len && length)
  917. goto error;
  918. if (length)
  919. soc->htt_msg_len = length;
  920. /*
  921. * Clone the T2H message buffer and store it in a list to process
  922. * it later.
  923. *
  924. * The original T2H message buffers gets freed in the T2H HTT event
  925. * handler
  926. */
  927. msg_copy = qdf_nbuf_clone(htt_t2h_msg);
  928. if (!msg_copy) {
  929. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO,
  930. "T2H messge clone failed for HTT EXT STATS");
  931. soc->htt_msg_len = 0;
  932. goto error;
  933. }
  934. qdf_nbuf_queue_add(&soc->htt_stats_msg, msg_copy);
  935. /*
  936. * Done bit signifies that this is the last T2H buffer in the stream of
  937. * HTT EXT STATS message
  938. */
  939. if (done)
  940. dp_process_htt_stat_msg(soc);
  941. return;
  942. error:
  943. while ((msg_copy = qdf_nbuf_queue_remove(&soc->htt_stats_msg))
  944. != NULL) {
  945. qdf_nbuf_free(msg_copy);
  946. }
  947. return;
  948. }
  949. /*
  950. * htt_soc_attach_target() - SOC level HTT setup
  951. * @htt_soc: HTT SOC handle
  952. *
  953. * Return: 0 on success; error code on failure
  954. */
  955. int htt_soc_attach_target(void *htt_soc)
  956. {
  957. struct htt_soc *soc = (struct htt_soc *)htt_soc;
  958. return htt_h2t_ver_req_msg(soc);
  959. }
  960. /*
  961. * dp_htt_t2h_msg_handler() - Generic Target to host Msg/event handler
  962. * @context: Opaque context (HTT SOC handle)
  963. * @pkt: HTC packet
  964. */
  965. static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt)
  966. {
  967. struct htt_soc *soc = (struct htt_soc *) context;
  968. qdf_nbuf_t htt_t2h_msg = (qdf_nbuf_t) pkt->pPktContext;
  969. u_int32_t *msg_word;
  970. enum htt_t2h_msg_type msg_type;
  971. /* check for successful message reception */
  972. if (pkt->Status != A_OK) {
  973. if (pkt->Status != A_ECANCELED)
  974. soc->stats.htc_err_cnt++;
  975. qdf_nbuf_free(htt_t2h_msg);
  976. return;
  977. }
  978. /* TODO: Check if we should pop the HTC/HTT header alignment padding */
  979. msg_word = (u_int32_t *) qdf_nbuf_data(htt_t2h_msg);
  980. msg_type = HTT_T2H_MSG_TYPE_GET(*msg_word);
  981. switch (msg_type) {
  982. case HTT_T2H_MSG_TYPE_PEER_MAP:
  983. {
  984. u_int8_t mac_addr_deswizzle_buf[HTT_MAC_ADDR_LEN];
  985. u_int8_t *peer_mac_addr;
  986. u_int16_t peer_id;
  987. u_int16_t hw_peer_id;
  988. u_int8_t vdev_id;
  989. peer_id = HTT_RX_PEER_MAP_PEER_ID_GET(*msg_word);
  990. hw_peer_id =
  991. HTT_RX_PEER_MAP_HW_PEER_ID_GET(*(msg_word+2));
  992. vdev_id = HTT_RX_PEER_MAP_VDEV_ID_GET(*msg_word);
  993. peer_mac_addr = htt_t2h_mac_addr_deswizzle(
  994. (u_int8_t *) (msg_word+1),
  995. &mac_addr_deswizzle_buf[0]);
  996. QDF_TRACE(QDF_MODULE_ID_TXRX,
  997. QDF_TRACE_LEVEL_INFO,
  998. "HTT_T2H_MSG_TYPE_PEER_MAP msg for peer id %d vdev id %d n",
  999. peer_id, vdev_id);
  1000. dp_rx_peer_map_handler(soc->dp_soc, peer_id, hw_peer_id,
  1001. vdev_id, peer_mac_addr);
  1002. break;
  1003. }
  1004. case HTT_T2H_MSG_TYPE_PEER_UNMAP:
  1005. {
  1006. u_int16_t peer_id;
  1007. peer_id = HTT_RX_PEER_UNMAP_PEER_ID_GET(*msg_word);
  1008. dp_rx_peer_unmap_handler(soc->dp_soc, peer_id);
  1009. break;
  1010. }
  1011. case HTT_T2H_MSG_TYPE_SEC_IND:
  1012. {
  1013. u_int16_t peer_id;
  1014. enum htt_sec_type sec_type;
  1015. int is_unicast;
  1016. peer_id = HTT_SEC_IND_PEER_ID_GET(*msg_word);
  1017. sec_type = HTT_SEC_IND_SEC_TYPE_GET(*msg_word);
  1018. is_unicast = HTT_SEC_IND_UNICAST_GET(*msg_word);
  1019. /* point to the first part of the Michael key */
  1020. msg_word++;
  1021. dp_rx_sec_ind_handler(
  1022. soc->dp_soc, peer_id, sec_type, is_unicast,
  1023. msg_word, msg_word + 2);
  1024. break;
  1025. }
  1026. #if defined(CONFIG_WIN) && WDI_EVENT_ENABLE
  1027. #ifndef REMOVE_PKT_LOG
  1028. case HTT_T2H_MSG_TYPE_PKTLOG:
  1029. {
  1030. u_int32_t *pl_hdr;
  1031. pl_hdr = (msg_word + 1);
  1032. dp_wdi_event_handler(WDI_EVENT_OFFLOAD_ALL, soc->dp_soc,
  1033. (void *)pl_hdr, HTT_INVALID_PEER, WDI_NO_VAL, 0);
  1034. break;
  1035. }
  1036. case HTT_T2H_MSG_TYPE_PPDU_STATS_IND:
  1037. {
  1038. qdf_nbuf_set_pktlen(htt_t2h_msg, HTT_T2H_MAX_MSG_SIZE);
  1039. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO,
  1040. "received HTT_T2H_MSG_TYPE_PPDU_STATS_IND\n");
  1041. dp_wdi_event_handler(WDI_EVENT_LITE_T2H, soc->dp_soc,
  1042. htt_t2h_msg, HTT_INVALID_PEER, WDI_NO_VAL, 0);
  1043. break;
  1044. }
  1045. #endif
  1046. #endif
  1047. case HTT_T2H_MSG_TYPE_VERSION_CONF:
  1048. {
  1049. soc->tgt_ver.major = HTT_VER_CONF_MAJOR_GET(*msg_word);
  1050. soc->tgt_ver.minor = HTT_VER_CONF_MINOR_GET(*msg_word);
  1051. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
  1052. "target uses HTT version %d.%d; host uses %d.%d\n",
  1053. soc->tgt_ver.major, soc->tgt_ver.minor,
  1054. HTT_CURRENT_VERSION_MAJOR,
  1055. HTT_CURRENT_VERSION_MINOR);
  1056. if (soc->tgt_ver.major != HTT_CURRENT_VERSION_MAJOR) {
  1057. QDF_TRACE(QDF_MODULE_ID_TXRX,
  1058. QDF_TRACE_LEVEL_ERROR,
  1059. "*** Incompatible host/target HTT versions!\n");
  1060. }
  1061. /* abort if the target is incompatible with the host */
  1062. qdf_assert(soc->tgt_ver.major ==
  1063. HTT_CURRENT_VERSION_MAJOR);
  1064. if (soc->tgt_ver.minor != HTT_CURRENT_VERSION_MINOR) {
  1065. QDF_TRACE(QDF_MODULE_ID_TXRX,
  1066. QDF_TRACE_LEVEL_WARN,
  1067. "*** Warning: host/target HTT versions"
  1068. " are different, though compatible!\n");
  1069. }
  1070. break;
  1071. }
  1072. case HTT_T2H_MSG_TYPE_RX_ADDBA:
  1073. {
  1074. uint16_t peer_id;
  1075. uint8_t tid;
  1076. uint8_t win_sz;
  1077. uint16_t status;
  1078. struct dp_peer *peer;
  1079. /*
  1080. * Update REO Queue Desc with new values
  1081. */
  1082. peer_id = HTT_RX_ADDBA_PEER_ID_GET(*msg_word);
  1083. tid = HTT_RX_ADDBA_TID_GET(*msg_word);
  1084. win_sz = HTT_RX_ADDBA_WIN_SIZE_GET(*msg_word);
  1085. peer = dp_peer_find_by_id(soc->dp_soc, peer_id);
  1086. /*
  1087. * Window size needs to be incremented by 1
  1088. * since fw needs to represent a value of 256
  1089. * using just 8 bits
  1090. */
  1091. if (peer) {
  1092. status = dp_addba_requestprocess_wifi3(peer,
  1093. 0, tid, 0, win_sz + 1, 0xffff);
  1094. QDF_TRACE(QDF_MODULE_ID_TXRX,
  1095. QDF_TRACE_LEVEL_INFO,
  1096. FL("PeerID %d BAW %d TID %d stat %d\n"),
  1097. peer_id, win_sz, tid, status);
  1098. } else {
  1099. QDF_TRACE(QDF_MODULE_ID_TXRX,
  1100. QDF_TRACE_LEVEL_ERROR,
  1101. FL("Peer not found peer id %d\n"),
  1102. peer_id);
  1103. }
  1104. break;
  1105. }
  1106. case HTT_T2H_MSG_TYPE_EXT_STATS_CONF:
  1107. {
  1108. dp_txrx_fw_stats_handler(soc->dp_soc, htt_t2h_msg);
  1109. break;
  1110. }
  1111. default:
  1112. break;
  1113. };
  1114. /* Free the indication buffer */
  1115. qdf_nbuf_free(htt_t2h_msg);
  1116. }
  1117. /*
  1118. * dp_htt_h2t_full() - Send full handler (called from HTC)
  1119. * @context: Opaque context (HTT SOC handle)
  1120. * @pkt: HTC packet
  1121. *
  1122. * Return: enum htc_send_full_action
  1123. */
  1124. static enum htc_send_full_action
  1125. dp_htt_h2t_full(void *context, HTC_PACKET *pkt)
  1126. {
  1127. return HTC_SEND_FULL_KEEP;
  1128. }
  1129. /*
  1130. * htt_htc_soc_attach() - Register SOC level HTT instance with HTC
  1131. * @htt_soc: HTT SOC handle
  1132. *
  1133. * Return: 0 on success; error code on failure
  1134. */
  1135. static int
  1136. htt_htc_soc_attach(struct htt_soc *soc)
  1137. {
  1138. struct htc_service_connect_req connect;
  1139. struct htc_service_connect_resp response;
  1140. A_STATUS status;
  1141. qdf_mem_set(&connect, sizeof(connect), 0);
  1142. qdf_mem_set(&response, sizeof(response), 0);
  1143. connect.pMetaData = NULL;
  1144. connect.MetaDataLength = 0;
  1145. connect.EpCallbacks.pContext = soc;
  1146. connect.EpCallbacks.EpTxComplete = dp_htt_h2t_send_complete;
  1147. connect.EpCallbacks.EpTxCompleteMultiple = NULL;
  1148. connect.EpCallbacks.EpRecv = dp_htt_t2h_msg_handler;
  1149. /* rx buffers currently are provided by HIF, not by EpRecvRefill */
  1150. connect.EpCallbacks.EpRecvRefill = NULL;
  1151. /* N/A, fill is done by HIF */
  1152. connect.EpCallbacks.RecvRefillWaterMark = 1;
  1153. connect.EpCallbacks.EpSendFull = dp_htt_h2t_full;
  1154. /*
  1155. * Specify how deep to let a queue get before htc_send_pkt will
  1156. * call the EpSendFull function due to excessive send queue depth.
  1157. */
  1158. connect.MaxSendQueueDepth = DP_HTT_MAX_SEND_QUEUE_DEPTH;
  1159. /* disable flow control for HTT data message service */
  1160. connect.ConnectionFlags |= HTC_CONNECT_FLAGS_DISABLE_CREDIT_FLOW_CTRL;
  1161. /* connect to control service */
  1162. connect.service_id = HTT_DATA_MSG_SVC;
  1163. status = htc_connect_service(soc->htc_soc, &connect, &response);
  1164. if (status != A_OK)
  1165. return QDF_STATUS_E_FAILURE;
  1166. soc->htc_endpoint = response.Endpoint;
  1167. return 0; /* success */
  1168. }
  1169. /*
  1170. * htt_soc_attach() - SOC level HTT initialization
  1171. * @dp_soc: Opaque Data path SOC handle
  1172. * @osif_soc: Opaque OSIF SOC handle
  1173. * @htc_soc: SOC level HTC handle
  1174. * @hal_soc: Opaque HAL SOC handle
  1175. * @osdev: QDF device
  1176. *
  1177. * Return: HTT handle on success; NULL on failure
  1178. */
  1179. void *
  1180. htt_soc_attach(void *dp_soc, void *osif_soc, HTC_HANDLE htc_soc,
  1181. void *hal_soc, qdf_device_t osdev)
  1182. {
  1183. struct htt_soc *soc;
  1184. int i;
  1185. soc = qdf_mem_malloc(sizeof(*soc));
  1186. if (!soc)
  1187. goto fail1;
  1188. soc->osdev = osdev;
  1189. soc->osif_soc = osif_soc;
  1190. soc->dp_soc = dp_soc;
  1191. soc->htc_soc = htc_soc;
  1192. soc->hal_soc = hal_soc;
  1193. /* TODO: See if any NSS related context is requred in htt_soc */
  1194. soc->htt_htc_pkt_freelist = NULL;
  1195. if (htt_htc_soc_attach(soc))
  1196. goto fail2;
  1197. /* TODO: See if any Rx data specific intialization is required. For
  1198. * MCL use cases, the data will be received as single packet and
  1199. * should not required any descriptor or reorder handling
  1200. */
  1201. HTT_TX_MUTEX_INIT(&soc->htt_tx_mutex);
  1202. /* pre-allocate some HTC_PACKET objects */
  1203. for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) {
  1204. struct dp_htt_htc_pkt_union *pkt;
  1205. pkt = qdf_mem_malloc(sizeof(*pkt));
  1206. if (!pkt)
  1207. break;
  1208. htt_htc_pkt_free(soc, &pkt->u.pkt);
  1209. }
  1210. return soc;
  1211. fail2:
  1212. qdf_mem_free(soc);
  1213. fail1:
  1214. return NULL;
  1215. }
  1216. /*
  1217. * htt_soc_detach() - Detach SOC level HTT
  1218. * @htt_soc: HTT SOC handle
  1219. */
  1220. void
  1221. htt_soc_detach(void *htt_soc)
  1222. {
  1223. struct htt_soc *soc = (struct htt_soc *)htt_soc;
  1224. htt_htc_pkt_pool_free(soc);
  1225. HTT_TX_MUTEX_DESTROY(&soc->htt_tx_mutex);
  1226. qdf_mem_free(soc);
  1227. }
  1228. /**
  1229. * dp_h2t_ext_stats_msg_send(): function to contruct HTT message to pass to FW
  1230. * @pdev: DP PDEV handle
  1231. * @stats_type_upload_mask: stats type requested by user
  1232. * @config_param_0: extra configuration parameters
  1233. * @config_param_1: extra configuration parameters
  1234. * @config_param_2: extra configuration parameters
  1235. * @config_param_3: extra configuration parameters
  1236. *
  1237. * return: QDF STATUS
  1238. */
  1239. QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
  1240. uint32_t stats_type_upload_mask, uint32_t config_param_0,
  1241. uint32_t config_param_1, uint32_t config_param_2,
  1242. uint32_t config_param_3)
  1243. {
  1244. struct htt_soc *soc = pdev->soc->htt_handle;
  1245. struct dp_htt_htc_pkt *pkt;
  1246. qdf_nbuf_t msg;
  1247. uint32_t *msg_word;
  1248. uint8_t pdev_mask;
  1249. msg = qdf_nbuf_alloc(
  1250. soc->osdev,
  1251. HTT_MSG_BUF_SIZE(HTT_H2T_EXT_STATS_REQ_MSG_SZ),
  1252. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  1253. if (!msg)
  1254. return QDF_STATUS_E_NOMEM;
  1255. /*TODO:Add support for SOC stats
  1256. * Bit 0: SOC Stats
  1257. * Bit 1: Pdev stats for pdev id 0
  1258. * Bit 2: Pdev stats for pdev id 1
  1259. * Bit 3: Pdev stats for pdev id 2
  1260. */
  1261. pdev_mask = 1 << (pdev->pdev_id + 1);
  1262. /*
  1263. * Set the length of the message.
  1264. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  1265. * separately during the below call to qdf_nbuf_push_head.
  1266. * The contribution from the HTC header is added separately inside HTC.
  1267. */
  1268. if (qdf_nbuf_put_tail(msg, HTT_H2T_EXT_STATS_REQ_MSG_SZ) == NULL) {
  1269. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  1270. "Failed to expand head for HTT_EXT_STATS");
  1271. qdf_nbuf_free(msg);
  1272. return QDF_STATUS_E_FAILURE;
  1273. }
  1274. msg_word = (uint32_t *) qdf_nbuf_data(msg);
  1275. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  1276. *msg_word = 0;
  1277. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_EXT_STATS_REQ);
  1278. HTT_H2T_EXT_STATS_REQ_PDEV_MASK_SET(*msg_word, pdev_mask);
  1279. HTT_H2T_EXT_STATS_REQ_STATS_TYPE_SET(*msg_word, stats_type_upload_mask);
  1280. /* word 1 */
  1281. msg_word++;
  1282. *msg_word = 0;
  1283. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_0);
  1284. /* word 2 */
  1285. msg_word++;
  1286. *msg_word = 0;
  1287. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_1);
  1288. /* word 3 */
  1289. msg_word++;
  1290. *msg_word = 0;
  1291. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_2);
  1292. /* word 4 */
  1293. msg_word++;
  1294. *msg_word = 0;
  1295. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_3);
  1296. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, 0);
  1297. pkt = htt_htc_pkt_alloc(soc);
  1298. if (!pkt) {
  1299. qdf_nbuf_free(msg);
  1300. return QDF_STATUS_E_NOMEM;
  1301. }
  1302. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  1303. SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
  1304. dp_htt_h2t_send_complete_free_netbuf,
  1305. qdf_nbuf_data(msg), qdf_nbuf_len(msg),
  1306. soc->htc_endpoint,
  1307. 1); /* tag - not relevant here */
  1308. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  1309. return htc_send_pkt(soc->htc_soc, &pkt->htc_pkt);
  1310. }