Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Houston Hoffman | b0ac63c | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * @file htt_h2t.c |
| 30 | * @brief Provide functions to send host->target HTT messages. |
| 31 | * @details |
| 32 | * This file contains functions related to host->target HTT messages. |
| 33 | * There are a couple aspects of this host->target messaging: |
| 34 | * 1. This file contains the function that is called by HTC when |
| 35 | * a host->target send completes. |
| 36 | * This send-completion callback is primarily relevant to HL, |
| 37 | * to invoke the download scheduler to set up a new download, |
| 38 | * and optionally free the tx frame whose download is completed. |
| 39 | * For both HL and LL, this completion callback frees up the |
| 40 | * HTC_PACKET object used to specify the download. |
| 41 | * 2. This file contains functions for creating messages to send |
| 42 | * from the host to the target. |
| 43 | */ |
| 44 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 45 | #include <qdf_mem.h> /* qdf_mem_copy */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 46 | #include <qdf_nbuf.h> /* qdf_nbuf_map_single */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #include <htc_api.h> /* HTC_PACKET */ |
| 48 | #include <htc.h> /* HTC_HDR_ALIGNMENT_PADDING */ |
| 49 | #include <htt.h> /* HTT host->target msg defs */ |
| 50 | #include <ol_txrx_htt_api.h> /* ol_tx_completion_handler, htt_tx_status */ |
| 51 | #include <ol_htt_tx_api.h> |
| 52 | |
| 53 | #include <htt_internal.h> |
| 54 | |
| 55 | #define HTT_MSG_BUF_SIZE(msg_bytes) \ |
| 56 | ((msg_bytes) + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING) |
| 57 | |
| 58 | #ifndef container_of |
| 59 | #define container_of(ptr, type, member) \ |
| 60 | ((type *)((char *)(ptr) - (char *)(&((type *)0)->member))) |
| 61 | #endif |
| 62 | |
| 63 | static void |
| 64 | htt_h2t_send_complete_free_netbuf(void *pdev, A_STATUS status, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 65 | qdf_nbuf_t netbuf, uint16_t msdu_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | { |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 67 | qdf_nbuf_free(netbuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | void htt_h2t_send_complete(void *context, HTC_PACKET *htc_pkt) |
| 71 | { |
| 72 | void (*send_complete_part2)(void *pdev, A_STATUS status, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 73 | qdf_nbuf_t msdu, uint16_t msdu_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 74 | struct htt_pdev_t *pdev = (struct htt_pdev_t *)context; |
| 75 | struct htt_htc_pkt *htt_pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 76 | qdf_nbuf_t netbuf; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 77 | |
| 78 | send_complete_part2 = htc_pkt->pPktContext; |
| 79 | |
| 80 | htt_pkt = container_of(htc_pkt, struct htt_htc_pkt, htc_pkt); |
| 81 | |
| 82 | /* process (free or keep) the netbuf that held the message */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 83 | netbuf = (qdf_nbuf_t) htc_pkt->pNetBufContext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 84 | if (send_complete_part2 != NULL) { |
| 85 | send_complete_part2(htt_pkt->pdev_ctxt, htc_pkt->Status, netbuf, |
| 86 | htt_pkt->msdu_id); |
| 87 | } |
| 88 | /* free the htt_htc_pkt / HTC_PACKET object */ |
| 89 | htt_htc_pkt_free(pdev, htt_pkt); |
| 90 | } |
| 91 | |
| 92 | HTC_SEND_FULL_ACTION htt_h2t_full(void *context, HTC_PACKET *pkt) |
| 93 | { |
| 94 | /* FIX THIS */ |
| 95 | return HTC_SEND_FULL_KEEP; |
| 96 | } |
| 97 | |
| 98 | #if defined(HELIUMPLUS_PADDR64) |
| 99 | A_STATUS htt_h2t_frag_desc_bank_cfg_msg(struct htt_pdev_t *pdev) |
| 100 | { |
| 101 | A_STATUS rc = A_OK; |
| 102 | |
| 103 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 104 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 105 | u_int32_t *msg_word; |
| 106 | struct htt_tx_frag_desc_bank_cfg_t *bank_cfg; |
| 107 | |
| 108 | pkt = htt_htc_pkt_alloc(pdev); |
| 109 | if (!pkt) |
| 110 | return A_ERROR; /* failure */ |
| 111 | |
| 112 | /* show that this is not a tx frame download |
| 113 | * (not required, but helpful) |
| 114 | */ |
| 115 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 116 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 117 | |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 118 | msg = qdf_nbuf_alloc( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 119 | pdev->osdev, |
| 120 | HTT_MSG_BUF_SIZE(sizeof(struct htt_tx_frag_desc_bank_cfg_t)), |
| 121 | /* reserve room for the HTC header */ |
| 122 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, true); |
| 123 | if (!msg) { |
| 124 | htt_htc_pkt_free(pdev, pkt); |
| 125 | return A_ERROR; /* failure */ |
| 126 | } |
| 127 | |
| 128 | /* |
| 129 | * Set the length of the message. |
| 130 | * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added |
| 131 | * separately during the below call to adf_nbuf_push_head. |
| 132 | * The contribution from the HTC header is added separately inside HTC. |
| 133 | */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 134 | qdf_nbuf_put_tail(msg, sizeof(struct htt_tx_frag_desc_bank_cfg_t)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 135 | |
| 136 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 137 | msg_word = (u_int32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 138 | |
| 139 | memset(msg_word, 0 , sizeof(struct htt_tx_frag_desc_bank_cfg_t)); |
| 140 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 141 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 142 | |
| 143 | *msg_word = 0; |
| 144 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG); |
| 145 | |
| 146 | bank_cfg = (struct htt_tx_frag_desc_bank_cfg_t *)msg_word; |
| 147 | |
| 148 | /** @note @todo Hard coded to 0 Assuming just one pdev for now.*/ |
| 149 | HTT_H2T_FRAG_DESC_BANK_PDEVID_SET(*msg_word, 0); |
| 150 | /** @note Hard coded to 1.*/ |
| 151 | HTT_H2T_FRAG_DESC_BANK_NUM_BANKS_SET(*msg_word, 1); |
| 152 | HTT_H2T_FRAG_DESC_BANK_DESC_SIZE_SET(*msg_word, pdev->frag_descs.size); |
| 153 | HTT_H2T_FRAG_DESC_BANK_SWAP_SET(*msg_word, 0); |
| 154 | |
| 155 | /** Bank specific data structure.*/ |
| 156 | #if HTT_PADDR64 |
Leo Chang | 376398b | 2015-10-23 14:19:02 -0700 | [diff] [blame] | 157 | bank_cfg->bank_base_address[0].lo = |
| 158 | pdev->frag_descs.desc_pages.dma_pages->page_p_addr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 159 | bank_cfg->bank_base_address[0].hi = 0; |
| 160 | #else /* ! HTT_PADDR64 */ |
Leo Chang | 376398b | 2015-10-23 14:19:02 -0700 | [diff] [blame] | 161 | bank_cfg->bank_base_address[0] = |
| 162 | pdev->frag_descs.desc_pages.dma_pages->page_p_addr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 163 | #endif /* HTT_PADDR64 */ |
| 164 | /* Logical Min index */ |
| 165 | HTT_H2T_FRAG_DESC_BANK_MIN_IDX_SET(bank_cfg->bank_info[0], 0); |
| 166 | /* Logical Max index */ |
| 167 | HTT_H2T_FRAG_DESC_BANK_MAX_IDX_SET(bank_cfg->bank_info[0], |
| 168 | pdev->frag_descs.pool_elems-1); |
| 169 | |
| 170 | SET_HTC_PACKET_INFO_TX( |
| 171 | &pkt->htc_pkt, |
| 172 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 173 | qdf_nbuf_data(msg), |
| 174 | qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 175 | pdev->htc_endpoint, |
| 176 | 1); /* tag - not relevant here */ |
| 177 | |
| 178 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 179 | |
| 180 | rc = htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 181 | |
| 182 | return rc; |
| 183 | } |
| 184 | |
| 185 | #endif /* defined(HELIUMPLUS_PADDR64) */ |
| 186 | |
| 187 | A_STATUS htt_h2t_ver_req_msg(struct htt_pdev_t *pdev) |
| 188 | { |
| 189 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 190 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 191 | uint32_t *msg_word; |
| 192 | |
| 193 | pkt = htt_htc_pkt_alloc(pdev); |
| 194 | if (!pkt) |
| 195 | return A_ERROR; /* failure */ |
| 196 | |
| 197 | /* show that this is not a tx frame download |
| 198 | * (not required, but helpful) |
| 199 | */ |
| 200 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 201 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 202 | |
| 203 | /* reserve room for the HTC header */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 204 | msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_VER_REQ_BYTES), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 205 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 206 | true); |
| 207 | if (!msg) { |
| 208 | htt_htc_pkt_free(pdev, pkt); |
| 209 | return A_ERROR; /* failure */ |
| 210 | } |
| 211 | |
| 212 | /* |
| 213 | * Set the length of the message. |
| 214 | * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 215 | * separately during the below call to qdf_nbuf_push_head. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 216 | * The contribution from the HTC header is added separately inside HTC. |
| 217 | */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 218 | qdf_nbuf_put_tail(msg, HTT_VER_REQ_BYTES); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 219 | |
| 220 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 221 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 222 | |
| 223 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 224 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 225 | |
| 226 | *msg_word = 0; |
| 227 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_VERSION_REQ); |
| 228 | |
| 229 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 230 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 231 | qdf_nbuf_data(msg), qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 232 | pdev->htc_endpoint, |
| 233 | 1); /* tag - not relevant here */ |
| 234 | |
| 235 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 236 | |
| 237 | #ifdef ATH_11AC_TXCOMPACT |
| 238 | if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK) |
| 239 | htt_htc_misc_pkt_list_add(pdev, pkt); |
| 240 | #else |
| 241 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 242 | #endif |
| 243 | |
| 244 | return A_OK; |
| 245 | } |
| 246 | |
| 247 | A_STATUS htt_h2t_rx_ring_cfg_msg_ll(struct htt_pdev_t *pdev) |
| 248 | { |
| 249 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 250 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 251 | uint32_t *msg_word; |
| 252 | int enable_ctrl_data, enable_mgmt_data, |
| 253 | enable_null_data, enable_phy_data, enable_hdr, |
| 254 | enable_ppdu_start, enable_ppdu_end; |
| 255 | |
| 256 | pkt = htt_htc_pkt_alloc(pdev); |
| 257 | if (!pkt) |
| 258 | return A_ERROR; /* failure */ |
| 259 | |
| 260 | /* show that this is not a tx frame download |
| 261 | (not required, but helpful) |
| 262 | */ |
| 263 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 264 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 265 | |
| 266 | /* reserve room for the HTC header */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 267 | msg = qdf_nbuf_alloc(pdev->osdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 268 | HTT_MSG_BUF_SIZE(HTT_RX_RING_CFG_BYTES(1)), |
| 269 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 270 | true); |
| 271 | if (!msg) { |
| 272 | htt_htc_pkt_free(pdev, pkt); |
| 273 | return A_ERROR; /* failure */ |
| 274 | } |
| 275 | /* |
| 276 | * Set the length of the message. |
| 277 | * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 278 | * separately during the below call to qdf_nbuf_push_head. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 279 | * The contribution from the HTC header is added separately inside HTC. |
| 280 | */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 281 | qdf_nbuf_put_tail(msg, HTT_RX_RING_CFG_BYTES(1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 282 | |
| 283 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 284 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 285 | |
| 286 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 287 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 288 | |
| 289 | *msg_word = 0; |
| 290 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_RING_CFG); |
| 291 | HTT_RX_RING_CFG_NUM_RINGS_SET(*msg_word, 1); |
| 292 | |
| 293 | msg_word++; |
| 294 | *msg_word = 0; |
| 295 | #if HTT_PADDR64 |
| 296 | HTT_RX_RING_CFG_IDX_SHADOW_REG_PADDR_LO_SET(*msg_word, |
| 297 | pdev->rx_ring.alloc_idx.paddr); |
| 298 | msg_word++; |
| 299 | HTT_RX_RING_CFG_IDX_SHADOW_REG_PADDR_HI_SET(*msg_word, 0); |
| 300 | #else /* ! HTT_PADDR64 */ |
| 301 | HTT_RX_RING_CFG_IDX_SHADOW_REG_PADDR_SET(*msg_word, |
| 302 | pdev->rx_ring.alloc_idx.paddr); |
| 303 | #endif /* HTT_PADDR64 */ |
| 304 | |
| 305 | msg_word++; |
| 306 | *msg_word = 0; |
| 307 | #if HTT_PADDR64 |
| 308 | HTT_RX_RING_CFG_BASE_PADDR_LO_SET(*msg_word, |
| 309 | pdev->rx_ring.base_paddr); |
| 310 | msg_word++; |
| 311 | HTT_RX_RING_CFG_BASE_PADDR_HI_SET(*msg_word, 0); |
| 312 | #else /* ! HTT_PADDR64 */ |
| 313 | HTT_RX_RING_CFG_BASE_PADDR_SET(*msg_word, pdev->rx_ring.base_paddr); |
| 314 | #endif /* HTT_PADDR64 */ |
| 315 | |
| 316 | msg_word++; |
| 317 | *msg_word = 0; |
| 318 | HTT_RX_RING_CFG_LEN_SET(*msg_word, pdev->rx_ring.size); |
| 319 | HTT_RX_RING_CFG_BUF_SZ_SET(*msg_word, HTT_RX_BUF_SIZE); |
| 320 | |
| 321 | /* FIX THIS: if the FW creates a complete translated rx descriptor, |
| 322 | * then the MAC DMA of the HW rx descriptor should be disabled. |
| 323 | */ |
| 324 | msg_word++; |
| 325 | *msg_word = 0; |
| 326 | #ifndef REMOVE_PKT_LOG |
| 327 | if (ol_cfg_is_packet_log_enabled(pdev->ctrl_pdev)) { |
| 328 | enable_ctrl_data = 1; |
| 329 | enable_mgmt_data = 1; |
| 330 | enable_null_data = 1; |
| 331 | enable_phy_data = 1; |
| 332 | enable_hdr = 1; |
| 333 | enable_ppdu_start = 1; |
| 334 | enable_ppdu_end = 1; |
| 335 | /* Disable ASPM when pkt log is enabled */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 336 | qdf_print("Pkt log is enabled\n"); |
Komal Seelam | c12e675 | 2016-02-02 18:17:13 +0530 | [diff] [blame] | 337 | htt_htc_disable_aspm(pdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 338 | } else { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 339 | qdf_print("Pkt log is disabled\n"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 340 | enable_ctrl_data = 0; |
| 341 | enable_mgmt_data = 0; |
| 342 | enable_null_data = 0; |
| 343 | enable_phy_data = 0; |
| 344 | enable_hdr = 0; |
| 345 | enable_ppdu_start = 0; |
| 346 | enable_ppdu_end = 0; |
| 347 | } |
| 348 | #else |
| 349 | enable_ctrl_data = 0; |
| 350 | enable_mgmt_data = 0; |
| 351 | enable_null_data = 0; |
| 352 | enable_phy_data = 0; |
| 353 | enable_hdr = 0; |
| 354 | enable_ppdu_start = 0; |
| 355 | enable_ppdu_end = 0; |
| 356 | #endif |
| 357 | HTT_RX_RING_CFG_ENABLED_802_11_HDR_SET(*msg_word, enable_hdr); |
| 358 | HTT_RX_RING_CFG_ENABLED_MSDU_PAYLD_SET(*msg_word, 1); |
| 359 | HTT_RX_RING_CFG_ENABLED_PPDU_START_SET(*msg_word, enable_ppdu_start); |
| 360 | HTT_RX_RING_CFG_ENABLED_PPDU_END_SET(*msg_word, enable_ppdu_end); |
| 361 | HTT_RX_RING_CFG_ENABLED_MPDU_START_SET(*msg_word, 1); |
| 362 | HTT_RX_RING_CFG_ENABLED_MPDU_END_SET(*msg_word, 1); |
| 363 | HTT_RX_RING_CFG_ENABLED_MSDU_START_SET(*msg_word, 1); |
| 364 | HTT_RX_RING_CFG_ENABLED_MSDU_END_SET(*msg_word, 1); |
| 365 | HTT_RX_RING_CFG_ENABLED_RX_ATTN_SET(*msg_word, 1); |
| 366 | /* always present? */ |
| 367 | HTT_RX_RING_CFG_ENABLED_FRAG_INFO_SET(*msg_word, 1); |
| 368 | HTT_RX_RING_CFG_ENABLED_UCAST_SET(*msg_word, 1); |
| 369 | HTT_RX_RING_CFG_ENABLED_MCAST_SET(*msg_word, 1); |
| 370 | /* Must change to dynamic enable at run time |
| 371 | * rather than at compile time |
| 372 | */ |
| 373 | HTT_RX_RING_CFG_ENABLED_CTRL_SET(*msg_word, enable_ctrl_data); |
| 374 | HTT_RX_RING_CFG_ENABLED_MGMT_SET(*msg_word, enable_mgmt_data); |
| 375 | HTT_RX_RING_CFG_ENABLED_NULL_SET(*msg_word, enable_null_data); |
| 376 | HTT_RX_RING_CFG_ENABLED_PHY_SET(*msg_word, enable_phy_data); |
| 377 | HTT_RX_RING_CFG_IDX_INIT_VAL_SET(*msg_word, |
| 378 | *pdev->rx_ring.alloc_idx.vaddr); |
| 379 | |
| 380 | msg_word++; |
| 381 | *msg_word = 0; |
| 382 | HTT_RX_RING_CFG_OFFSET_802_11_HDR_SET(*msg_word, |
| 383 | RX_DESC_HDR_STATUS_OFFSET32); |
| 384 | HTT_RX_RING_CFG_OFFSET_MSDU_PAYLD_SET(*msg_word, |
| 385 | HTT_RX_DESC_RESERVATION32); |
| 386 | |
| 387 | msg_word++; |
| 388 | *msg_word = 0; |
| 389 | HTT_RX_RING_CFG_OFFSET_PPDU_START_SET(*msg_word, |
| 390 | RX_DESC_PPDU_START_OFFSET32); |
| 391 | HTT_RX_RING_CFG_OFFSET_PPDU_END_SET(*msg_word, |
| 392 | RX_DESC_PPDU_END_OFFSET32); |
| 393 | |
| 394 | msg_word++; |
| 395 | *msg_word = 0; |
| 396 | HTT_RX_RING_CFG_OFFSET_MPDU_START_SET(*msg_word, |
| 397 | RX_DESC_MPDU_START_OFFSET32); |
| 398 | HTT_RX_RING_CFG_OFFSET_MPDU_END_SET(*msg_word, |
| 399 | RX_DESC_MPDU_END_OFFSET32); |
| 400 | |
| 401 | msg_word++; |
| 402 | *msg_word = 0; |
| 403 | HTT_RX_RING_CFG_OFFSET_MSDU_START_SET(*msg_word, |
| 404 | RX_DESC_MSDU_START_OFFSET32); |
| 405 | HTT_RX_RING_CFG_OFFSET_MSDU_END_SET(*msg_word, |
| 406 | RX_DESC_MSDU_END_OFFSET32); |
| 407 | |
| 408 | msg_word++; |
| 409 | *msg_word = 0; |
| 410 | HTT_RX_RING_CFG_OFFSET_RX_ATTN_SET(*msg_word, |
| 411 | RX_DESC_ATTN_OFFSET32); |
| 412 | HTT_RX_RING_CFG_OFFSET_FRAG_INFO_SET(*msg_word, |
| 413 | RX_DESC_FRAG_INFO_OFFSET32); |
| 414 | |
| 415 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 416 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 417 | qdf_nbuf_data(msg), |
| 418 | qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 419 | pdev->htc_endpoint, |
Houston Hoffman | b0ac63c | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 420 | HTC_TX_PACKET_TAG_RUNTIME_PUT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 421 | |
| 422 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 423 | |
| 424 | #ifdef ATH_11AC_TXCOMPACT |
| 425 | if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK) |
| 426 | htt_htc_misc_pkt_list_add(pdev, pkt); |
| 427 | #else |
| 428 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 429 | #endif |
| 430 | return A_OK; |
| 431 | } |
| 432 | |
| 433 | int |
| 434 | htt_h2t_dbg_stats_get(struct htt_pdev_t *pdev, |
| 435 | uint32_t stats_type_upload_mask, |
| 436 | uint32_t stats_type_reset_mask, |
| 437 | uint8_t cfg_stat_type, uint32_t cfg_val, uint64_t cookie) |
| 438 | { |
| 439 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 440 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 441 | uint32_t *msg_word; |
Houston Hoffman | b0ac63c | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 442 | uint16_t htc_tag = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 443 | |
| 444 | pkt = htt_htc_pkt_alloc(pdev); |
| 445 | if (!pkt) |
| 446 | return -EINVAL; /* failure */ |
| 447 | |
| 448 | if (stats_type_upload_mask >= 1 << HTT_DBG_NUM_STATS || |
| 449 | stats_type_reset_mask >= 1 << HTT_DBG_NUM_STATS) { |
| 450 | /* FIX THIS - add more details? */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 451 | qdf_print("%#x %#x stats not supported\n", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 452 | stats_type_upload_mask, stats_type_reset_mask); |
| 453 | return -EINVAL; /* failure */ |
| 454 | } |
| 455 | |
Houston Hoffman | b0ac63c | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 456 | if (stats_type_reset_mask) |
| 457 | htc_tag = HTC_TX_PACKET_TAG_RUNTIME_PUT; |
| 458 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 459 | /* show that this is not a tx frame download |
| 460 | * (not required, but helpful) |
| 461 | */ |
| 462 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 463 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 464 | |
| 465 | |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 466 | msg = qdf_nbuf_alloc(pdev->osdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 467 | HTT_MSG_BUF_SIZE(HTT_H2T_STATS_REQ_MSG_SZ), |
| 468 | /* reserve room for HTC header */ |
| 469 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 470 | false); |
| 471 | if (!msg) { |
| 472 | htt_htc_pkt_free(pdev, pkt); |
| 473 | return -EINVAL; /* failure */ |
| 474 | } |
| 475 | /* set the length of the message */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 476 | qdf_nbuf_put_tail(msg, HTT_H2T_STATS_REQ_MSG_SZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 477 | |
| 478 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 479 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 480 | |
| 481 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 482 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 483 | |
| 484 | *msg_word = 0; |
| 485 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_STATS_REQ); |
| 486 | HTT_H2T_STATS_REQ_UPLOAD_TYPES_SET(*msg_word, stats_type_upload_mask); |
| 487 | |
| 488 | msg_word++; |
| 489 | *msg_word = 0; |
| 490 | HTT_H2T_STATS_REQ_RESET_TYPES_SET(*msg_word, stats_type_reset_mask); |
| 491 | |
| 492 | msg_word++; |
| 493 | *msg_word = 0; |
| 494 | HTT_H2T_STATS_REQ_CFG_VAL_SET(*msg_word, cfg_val); |
| 495 | HTT_H2T_STATS_REQ_CFG_STAT_TYPE_SET(*msg_word, cfg_stat_type); |
| 496 | |
| 497 | /* cookie LSBs */ |
| 498 | msg_word++; |
| 499 | *msg_word = cookie & 0xffffffff; |
| 500 | |
| 501 | /* cookie MSBs */ |
| 502 | msg_word++; |
| 503 | *msg_word = cookie >> 32; |
| 504 | |
| 505 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 506 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 507 | qdf_nbuf_data(msg), |
| 508 | qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 509 | pdev->htc_endpoint, |
Houston Hoffman | b0ac63c | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 510 | htc_tag); /* tag - not relevant here */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 511 | |
| 512 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 513 | |
| 514 | #ifdef ATH_11AC_TXCOMPACT |
| 515 | if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK) |
| 516 | htt_htc_misc_pkt_list_add(pdev, pkt); |
| 517 | #else |
| 518 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 519 | #endif |
| 520 | |
| 521 | return 0; |
| 522 | } |
| 523 | |
| 524 | A_STATUS htt_h2t_sync_msg(struct htt_pdev_t *pdev, uint8_t sync_cnt) |
| 525 | { |
| 526 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 527 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 528 | uint32_t *msg_word; |
| 529 | |
| 530 | pkt = htt_htc_pkt_alloc(pdev); |
| 531 | if (!pkt) |
| 532 | return A_NO_MEMORY; |
| 533 | |
| 534 | /* show that this is not a tx frame download |
| 535 | (not required, but helpful) |
| 536 | */ |
| 537 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 538 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 539 | |
| 540 | /* reserve room for HTC header */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 541 | msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_H2T_SYNC_MSG_SZ), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 542 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 543 | false); |
| 544 | if (!msg) { |
| 545 | htt_htc_pkt_free(pdev, pkt); |
| 546 | return A_NO_MEMORY; |
| 547 | } |
| 548 | /* set the length of the message */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 549 | qdf_nbuf_put_tail(msg, HTT_H2T_SYNC_MSG_SZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 550 | |
| 551 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 552 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 553 | |
| 554 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 555 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 556 | |
| 557 | *msg_word = 0; |
| 558 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_SYNC); |
| 559 | HTT_H2T_SYNC_COUNT_SET(*msg_word, sync_cnt); |
| 560 | |
| 561 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 562 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 563 | qdf_nbuf_data(msg), |
| 564 | qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 565 | pdev->htc_endpoint, |
Houston Hoffman | b0ac63c | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 566 | HTC_TX_PACKET_TAG_RUNTIME_PUT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 567 | |
| 568 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 569 | |
| 570 | #ifdef ATH_11AC_TXCOMPACT |
| 571 | if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK) |
| 572 | htt_htc_misc_pkt_list_add(pdev, pkt); |
| 573 | #else |
| 574 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 575 | #endif |
| 576 | |
| 577 | return A_OK; |
| 578 | } |
| 579 | |
| 580 | int |
| 581 | htt_h2t_aggr_cfg_msg(struct htt_pdev_t *pdev, |
| 582 | int max_subfrms_ampdu, int max_subfrms_amsdu) |
| 583 | { |
| 584 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 585 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 586 | uint32_t *msg_word; |
| 587 | |
| 588 | pkt = htt_htc_pkt_alloc(pdev); |
| 589 | if (!pkt) |
| 590 | return -EINVAL; /* failure */ |
| 591 | |
| 592 | /* show that this is not a tx frame download |
| 593 | * (not required, but helpful) |
| 594 | */ |
| 595 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 596 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 597 | |
| 598 | /* reserve room for HTC header */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 599 | msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_AGGR_CFG_MSG_SZ), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 600 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 601 | false); |
| 602 | if (!msg) { |
| 603 | htt_htc_pkt_free(pdev, pkt); |
| 604 | return -EINVAL; /* failure */ |
| 605 | } |
| 606 | /* set the length of the message */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 607 | qdf_nbuf_put_tail(msg, HTT_AGGR_CFG_MSG_SZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 608 | |
| 609 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 610 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 611 | |
| 612 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 613 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 614 | |
| 615 | *msg_word = 0; |
| 616 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_AGGR_CFG); |
| 617 | |
| 618 | if (max_subfrms_ampdu && (max_subfrms_ampdu <= 64)) { |
| 619 | HTT_AGGR_CFG_MAX_NUM_AMPDU_SUBFRM_SET(*msg_word, |
| 620 | max_subfrms_ampdu); |
| 621 | } |
| 622 | |
| 623 | if (max_subfrms_amsdu && (max_subfrms_amsdu < 32)) { |
| 624 | HTT_AGGR_CFG_MAX_NUM_AMSDU_SUBFRM_SET(*msg_word, |
| 625 | max_subfrms_amsdu); |
| 626 | } |
| 627 | |
| 628 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 629 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 630 | qdf_nbuf_data(msg), |
| 631 | qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 632 | pdev->htc_endpoint, |
Houston Hoffman | b0ac63c | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 633 | HTC_TX_PACKET_TAG_RUNTIME_PUT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 634 | |
| 635 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 636 | |
| 637 | #ifdef ATH_11AC_TXCOMPACT |
| 638 | if (htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt) == A_OK) |
| 639 | htt_htc_misc_pkt_list_add(pdev, pkt); |
| 640 | #else |
| 641 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 642 | #endif |
| 643 | |
| 644 | return 0; |
| 645 | } |
| 646 | |
| 647 | #ifdef IPA_OFFLOAD |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 648 | /** |
| 649 | * htt_h2t_ipa_uc_rsc_cfg_msg() - Send WDI IPA config message to firmware |
| 650 | * @pdev: handle to the HTT instance |
| 651 | * |
| 652 | * Return: 0 success |
| 653 | * A_NO_MEMORY No memory fail |
| 654 | */ |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 655 | #ifdef QCA_WIFI_2_0 |
| 656 | /* Rome Support only WDI 1.0 */ |
| 657 | int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev) |
| 658 | { |
| 659 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 660 | qdf_nbuf_t msg; |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 661 | uint32_t *msg_word; |
| 662 | |
| 663 | pkt = htt_htc_pkt_alloc(pdev); |
| 664 | if (!pkt) |
| 665 | return A_NO_MEMORY; |
| 666 | |
| 667 | /* show that this is not a tx frame download |
| 668 | * (not required, but helpful) |
| 669 | */ |
| 670 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 671 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 672 | |
| 673 | /* reserve room for HTC header */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 674 | msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_WDI_IPA_CFG_SZ), |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 675 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 676 | false); |
| 677 | if (!msg) { |
| 678 | htt_htc_pkt_free(pdev, pkt); |
| 679 | return A_NO_MEMORY; |
| 680 | } |
| 681 | /* set the length of the message */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 682 | qdf_nbuf_put_tail(msg, HTT_WDI_IPA_CFG_SZ); |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 683 | |
| 684 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 685 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 686 | |
| 687 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 688 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 689 | |
| 690 | *msg_word = 0; |
| 691 | HTT_WDI_IPA_CFG_TX_PKT_POOL_SIZE_SET(*msg_word, |
| 692 | pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt); |
| 693 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_CFG); |
| 694 | |
| 695 | msg_word++; |
| 696 | *msg_word = 0; |
| 697 | HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_SET(*msg_word, |
| 698 | (unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_base.paddr); |
| 699 | |
| 700 | msg_word++; |
| 701 | *msg_word = 0; |
| 702 | HTT_WDI_IPA_CFG_TX_COMP_RING_SIZE_SET(*msg_word, |
| 703 | (unsigned int)ol_cfg_ipa_uc_tx_max_buf_cnt(pdev->ctrl_pdev)); |
| 704 | |
| 705 | msg_word++; |
| 706 | *msg_word = 0; |
| 707 | HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_SET(*msg_word, |
| 708 | (unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_idx_paddr); |
| 709 | |
| 710 | msg_word++; |
| 711 | *msg_word = 0; |
| 712 | HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_SET(*msg_word, |
| 713 | (unsigned int)pdev->ipa_uc_tx_rsc.tx_ce_idx.paddr); |
| 714 | |
| 715 | msg_word++; |
| 716 | *msg_word = 0; |
| 717 | HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_SET(*msg_word, |
| 718 | (unsigned int)pdev->ipa_uc_rx_rsc.rx_ind_ring_base.paddr); |
| 719 | |
| 720 | msg_word++; |
| 721 | *msg_word = 0; |
| 722 | HTT_WDI_IPA_CFG_RX_IND_RING_SIZE_SET(*msg_word, |
| 723 | (unsigned int)ol_cfg_ipa_uc_rx_ind_ring_size(pdev->ctrl_pdev)); |
| 724 | |
| 725 | msg_word++; |
| 726 | *msg_word = 0; |
| 727 | HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_SET(*msg_word, |
| 728 | (unsigned int)pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx.paddr); |
| 729 | |
| 730 | msg_word++; |
| 731 | *msg_word = 0; |
| 732 | HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_SET(*msg_word, |
| 733 | (unsigned int)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr); |
| 734 | |
| 735 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 736 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 737 | qdf_nbuf_data(msg), |
| 738 | qdf_nbuf_len(msg), |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 739 | pdev->htc_endpoint, |
Houston Hoffman | b0ac63c | 2015-11-10 11:35:49 -0800 | [diff] [blame] | 740 | HTC_TX_PACKET_TAG_RUNTIME_PUT); |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 741 | |
| 742 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 743 | |
| 744 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 745 | |
| 746 | return A_OK; |
| 747 | } |
| 748 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 749 | int htt_h2t_ipa_uc_rsc_cfg_msg(struct htt_pdev_t *pdev) |
| 750 | { |
| 751 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 752 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 753 | uint32_t *msg_word; |
| 754 | |
| 755 | pkt = htt_htc_pkt_alloc(pdev); |
| 756 | if (!pkt) |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 757 | return -A_NO_MEMORY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 758 | |
| 759 | /* show that this is not a tx frame download |
| 760 | * (not required, but helpful) |
| 761 | */ |
| 762 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 763 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 764 | |
| 765 | /* reserve room for HTC header */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 766 | msg = qdf_nbuf_alloc(pdev->osdev, HTT_MSG_BUF_SIZE(HTT_WDI_IPA_CFG_SZ), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 767 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 768 | false); |
| 769 | if (!msg) { |
| 770 | htt_htc_pkt_free(pdev, pkt); |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 771 | return -A_NO_MEMORY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 772 | } |
| 773 | /* set the length of the message */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 774 | qdf_nbuf_put_tail(msg, HTT_WDI_IPA_CFG_SZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 775 | |
| 776 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 777 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 778 | |
| 779 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 780 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 781 | |
| 782 | *msg_word = 0; |
| 783 | HTT_WDI_IPA_CFG_TX_PKT_POOL_SIZE_SET(*msg_word, |
| 784 | pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt); |
| 785 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_CFG); |
| 786 | |
| 787 | msg_word++; |
| 788 | *msg_word = 0; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 789 | /* TX COMP RING BASE LO */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 790 | HTT_WDI_IPA_CFG_TX_COMP_RING_BASE_ADDR_LO_SET(*msg_word, |
| 791 | (unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_base.paddr); |
| 792 | msg_word++; |
| 793 | *msg_word = 0; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 794 | /* TX COMP RING BASE HI, NONE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 795 | |
| 796 | msg_word++; |
| 797 | *msg_word = 0; |
| 798 | HTT_WDI_IPA_CFG_TX_COMP_RING_SIZE_SET(*msg_word, |
| 799 | (unsigned int)ol_cfg_ipa_uc_tx_max_buf_cnt(pdev->ctrl_pdev)); |
| 800 | |
| 801 | msg_word++; |
| 802 | *msg_word = 0; |
| 803 | HTT_WDI_IPA_CFG_TX_COMP_WR_IDX_ADDR_LO_SET(*msg_word, |
| 804 | (unsigned int)pdev->ipa_uc_tx_rsc.tx_comp_idx_paddr); |
| 805 | msg_word++; |
| 806 | *msg_word = 0; |
| 807 | |
| 808 | msg_word++; |
| 809 | *msg_word = 0; |
| 810 | HTT_WDI_IPA_CFG_TX_CE_WR_IDX_ADDR_LO_SET(*msg_word, |
| 811 | (unsigned int)pdev->ipa_uc_tx_rsc.tx_ce_idx.paddr); |
| 812 | msg_word++; |
| 813 | *msg_word = 0; |
| 814 | |
| 815 | msg_word++; |
| 816 | *msg_word = 0; |
| 817 | HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_LO_SET(*msg_word, |
| 818 | (unsigned int)pdev->ipa_uc_rx_rsc.rx_ind_ring_base.paddr); |
| 819 | msg_word++; |
| 820 | *msg_word = 0; |
| 821 | HTT_WDI_IPA_CFG_RX_IND_RING_BASE_ADDR_HI_SET(*msg_word, |
| 822 | 0); |
| 823 | |
| 824 | msg_word++; |
| 825 | *msg_word = 0; |
| 826 | HTT_WDI_IPA_CFG_RX_IND_RING_SIZE_SET(*msg_word, |
| 827 | (unsigned int)ol_cfg_ipa_uc_rx_ind_ring_size(pdev->ctrl_pdev)); |
| 828 | |
| 829 | msg_word++; |
| 830 | *msg_word = 0; |
| 831 | HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_LO_SET(*msg_word, |
| 832 | (unsigned int)pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx.paddr); |
| 833 | msg_word++; |
| 834 | *msg_word = 0; |
| 835 | HTT_WDI_IPA_CFG_RX_IND_RD_IDX_ADDR_HI_SET(*msg_word, |
| 836 | 0); |
| 837 | |
| 838 | msg_word++; |
| 839 | *msg_word = 0; |
| 840 | HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_LO_SET(*msg_word, |
| 841 | (unsigned int)pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr); |
| 842 | msg_word++; |
| 843 | *msg_word = 0; |
| 844 | HTT_WDI_IPA_CFG_RX_IND_WR_IDX_ADDR_HI_SET(*msg_word, |
| 845 | 0); |
| 846 | |
| 847 | msg_word++; |
| 848 | *msg_word = 0; |
| 849 | HTT_WDI_IPA_CFG_RX_RING2_BASE_ADDR_LO_SET(*msg_word, |
| 850 | (unsigned int)pdev->ipa_uc_rx_rsc.rx2_ind_ring_base.paddr); |
| 851 | msg_word++; |
| 852 | *msg_word = 0; |
| 853 | HTT_WDI_IPA_CFG_RX_RING2_BASE_ADDR_HI_SET(*msg_word, |
| 854 | 0); |
| 855 | |
| 856 | msg_word++; |
| 857 | *msg_word = 0; |
| 858 | HTT_WDI_IPA_CFG_RX_RING2_SIZE_SET(*msg_word, |
| 859 | (unsigned int)ol_cfg_ipa_uc_rx_ind_ring_size(pdev->ctrl_pdev)); |
| 860 | |
| 861 | msg_word++; |
| 862 | *msg_word = 0; |
| 863 | HTT_WDI_IPA_CFG_RX_RING2_RD_IDX_ADDR_LO_SET(*msg_word, |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 864 | (unsigned int)pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.paddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 865 | msg_word++; |
| 866 | *msg_word = 0; |
| 867 | HTT_WDI_IPA_CFG_RX_RING2_RD_IDX_ADDR_HI_SET(*msg_word, |
| 868 | 0); |
| 869 | |
| 870 | msg_word++; |
| 871 | *msg_word = 0; |
| 872 | HTT_WDI_IPA_CFG_RX_RING2_WR_IDX_ADDR_LO_SET(*msg_word, |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 873 | (unsigned int)pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.paddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 874 | msg_word++; |
| 875 | *msg_word = 0; |
| 876 | HTT_WDI_IPA_CFG_RX_RING2_WR_IDX_ADDR_HI_SET(*msg_word, |
| 877 | 0); |
| 878 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 879 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 880 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 881 | qdf_nbuf_data(msg), |
| 882 | qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 883 | pdev->htc_endpoint, |
| 884 | 1); /* tag - not relevant here */ |
| 885 | |
| 886 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 887 | |
| 888 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 889 | |
| 890 | return A_OK; |
| 891 | } |
Manikandan Mohan | fba8e0d | 2015-11-18 16:27:37 -0800 | [diff] [blame] | 892 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 893 | |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 894 | /** |
| 895 | * htt_h2t_ipa_uc_set_active() - Propagate WDI path enable/disable to firmware |
| 896 | * @pdev: handle to the HTT instance |
| 897 | * @uc_active: WDI UC path enable or not |
| 898 | * @is_tx: TX path or RX path |
| 899 | * |
| 900 | * Return: 0 success |
| 901 | * A_NO_MEMORY No memory fail |
| 902 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 903 | int htt_h2t_ipa_uc_set_active(struct htt_pdev_t *pdev, |
| 904 | bool uc_active, bool is_tx) |
| 905 | { |
| 906 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 907 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 908 | uint32_t *msg_word; |
| 909 | uint8_t active_target = 0; |
| 910 | |
| 911 | pkt = htt_htc_pkt_alloc(pdev); |
| 912 | if (!pkt) |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 913 | return -A_NO_MEMORY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 914 | |
| 915 | /* show that this is not a tx frame download |
| 916 | * (not required, but helpful) |
| 917 | */ |
| 918 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 919 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 920 | |
| 921 | /* reserve room for HTC header */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 922 | msg = qdf_nbuf_alloc(pdev->osdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 923 | HTT_MSG_BUF_SIZE(HTT_WDI_IPA_OP_REQUEST_SZ), |
| 924 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 925 | false); |
| 926 | if (!msg) { |
| 927 | htt_htc_pkt_free(pdev, pkt); |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 928 | return -A_NO_MEMORY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 929 | } |
| 930 | /* set the length of the message */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 931 | qdf_nbuf_put_tail(msg, HTT_WDI_IPA_OP_REQUEST_SZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 932 | |
| 933 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 934 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | |
| 936 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 937 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 938 | |
| 939 | *msg_word = 0; |
| 940 | if (uc_active && is_tx) |
| 941 | active_target = HTT_WDI_IPA_OPCODE_TX_RESUME; |
| 942 | else if (!uc_active && is_tx) |
| 943 | active_target = HTT_WDI_IPA_OPCODE_TX_SUSPEND; |
| 944 | else if (uc_active && !is_tx) |
| 945 | active_target = HTT_WDI_IPA_OPCODE_RX_RESUME; |
| 946 | else if (!uc_active && !is_tx) |
| 947 | active_target = HTT_WDI_IPA_OPCODE_RX_SUSPEND; |
| 948 | |
| 949 | HTT_WDI_IPA_OP_REQUEST_OP_CODE_SET(*msg_word, active_target); |
| 950 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_OP_REQ); |
| 951 | |
| 952 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 953 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 954 | qdf_nbuf_data(msg), |
| 955 | qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 956 | pdev->htc_endpoint, |
| 957 | 1); /* tag - not relevant here */ |
| 958 | |
| 959 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 960 | |
| 961 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 962 | |
| 963 | return A_OK; |
| 964 | } |
| 965 | |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 966 | /** |
| 967 | * htt_h2t_ipa_uc_get_stats() - WDI UC state query request to firmware |
| 968 | * @pdev: handle to the HTT instance |
| 969 | * |
| 970 | * Return: 0 success |
| 971 | * A_NO_MEMORY No memory fail |
| 972 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | int htt_h2t_ipa_uc_get_stats(struct htt_pdev_t *pdev) |
| 974 | { |
| 975 | struct htt_htc_pkt *pkt; |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 976 | qdf_nbuf_t msg; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 977 | uint32_t *msg_word; |
| 978 | |
| 979 | pkt = htt_htc_pkt_alloc(pdev); |
| 980 | if (!pkt) |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 981 | return -A_NO_MEMORY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | |
| 983 | /* show that this is not a tx frame download |
| 984 | * (not required, but helpful) |
| 985 | */ |
| 986 | pkt->msdu_id = HTT_TX_COMPL_INV_MSDU_ID; |
| 987 | pkt->pdev_ctxt = NULL; /* not used during send-done callback */ |
| 988 | |
| 989 | /* reserve room for HTC header */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 990 | msg = qdf_nbuf_alloc(pdev->osdev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 991 | HTT_MSG_BUF_SIZE(HTT_WDI_IPA_OP_REQUEST_SZ), |
| 992 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, |
| 993 | false); |
| 994 | if (!msg) { |
| 995 | htt_htc_pkt_free(pdev, pkt); |
Leo Chang | 8e07361 | 2015-11-13 10:55:34 -0800 | [diff] [blame] | 996 | return -A_NO_MEMORY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 997 | } |
| 998 | /* set the length of the message */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 999 | qdf_nbuf_put_tail(msg, HTT_WDI_IPA_OP_REQUEST_SZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1000 | |
| 1001 | /* fill in the message contents */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 1002 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | |
| 1004 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 1005 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1006 | |
| 1007 | *msg_word = 0; |
| 1008 | HTT_WDI_IPA_OP_REQUEST_OP_CODE_SET(*msg_word, |
| 1009 | HTT_WDI_IPA_OPCODE_DBG_STATS); |
| 1010 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_WDI_IPA_OP_REQ); |
| 1011 | |
| 1012 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 1013 | htt_h2t_send_complete_free_netbuf, |
Nirav Shah | cbc6d72 | 2016-03-01 16:24:53 +0530 | [diff] [blame^] | 1014 | qdf_nbuf_data(msg), |
| 1015 | qdf_nbuf_len(msg), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1016 | pdev->htc_endpoint, |
| 1017 | 1); /* tag - not relevant here */ |
| 1018 | |
| 1019 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 1020 | |
| 1021 | htc_send_pkt(pdev->htc_pdev, &pkt->htc_pkt); |
| 1022 | |
| 1023 | return A_OK; |
| 1024 | } |
| 1025 | #endif /* IPA_OFFLOAD */ |