Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1 | /* |
Jeff Johnson | 2cb8fc7 | 2016-12-17 10:45:08 -0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 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 | |
| 19 | #include <htt.h> |
| 20 | #include <hal_api.h> |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 21 | #include "dp_htt.h" |
Jeff Johnson | 2cb8fc7 | 2016-12-17 10:45:08 -0800 | [diff] [blame] | 22 | #include "dp_peer.h" |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 23 | #include "dp_types.h" |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 24 | #include "dp_internal.h" |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 25 | #include "dp_rx_mon.h" |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 26 | #include "htt_stats.h" |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 27 | #include "htt_ppdu_stats.h" |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 28 | #include "qdf_mem.h" /* qdf_mem_malloc,free */ |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 29 | #include "cdp_txrx_cmn_struct.h" |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 30 | |
| 31 | #define HTT_TLV_HDR_LEN HTT_T2H_EXT_STATS_CONF_TLV_HDR_SIZE |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 32 | |
| 33 | #define HTT_HTC_PKT_POOL_INIT_SIZE 64 |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 34 | #define HTT_T2H_MAX_MSG_SIZE 2048 |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 35 | |
| 36 | #define HTT_MSG_BUF_SIZE(msg_bytes) \ |
| 37 | ((msg_bytes) + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING) |
| 38 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 39 | #define DP_EXT_MSG_LENGTH 2048 |
Pramod Simha | e0baa44 | 2017-06-27 15:21:39 -0700 | [diff] [blame] | 40 | #define DP_HTT_SEND_HTC_PKT(soc, pkt) \ |
| 41 | do { \ |
| 42 | if (htc_send_pkt(soc->htc_soc, &pkt->htc_pkt) == \ |
| 43 | QDF_STATUS_SUCCESS) \ |
| 44 | htt_htc_misc_pkt_list_add(soc, pkt); \ |
| 45 | } while (0) |
| 46 | |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 47 | #define HTT_MGMT_CTRL_TLV_RESERVERD_LEN 12 |
| 48 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 49 | /* |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 50 | * dp_tx_stats_update() - Update per-peer statistics |
| 51 | * @soc: Datapath soc handle |
| 52 | * @peer: Datapath peer handle |
| 53 | * @ppdu: PPDU Descriptor |
| 54 | * @ack_rssi: RSSI of last ack received |
| 55 | * |
| 56 | * Return: None |
| 57 | */ |
| 58 | #ifdef FEATURE_PERPKT_INFO |
| 59 | static void dp_tx_stats_update(struct dp_soc *soc, struct dp_peer *peer, |
| 60 | struct cdp_tx_completion_ppdu_user *ppdu, uint32_t ack_rssi) |
| 61 | { |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 62 | struct dp_pdev *pdev = peer->vdev->pdev; |
Pamidipati, Vijay | 57a435a | 2017-10-17 11:03:39 +0530 | [diff] [blame] | 63 | uint8_t preamble, mcs; |
| 64 | uint16_t num_msdu; |
| 65 | |
| 66 | preamble = ppdu->preamble; |
| 67 | mcs = ppdu->mcs; |
| 68 | num_msdu = ppdu->num_msdu; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 69 | |
Pamidipati, Vijay | bd9c13f | 2017-10-17 20:12:03 +0530 | [diff] [blame] | 70 | /* If the peer statistics are already processed as part of |
| 71 | * per-MSDU completion handler, do not process these again in per-PPDU |
| 72 | * indications */ |
| 73 | if (soc->process_tx_status) |
| 74 | return; |
| 75 | |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 76 | DP_STATS_INC_PKT(peer, tx.comp_pkt, |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 77 | num_msdu, (ppdu->success_bytes + |
| 78 | ppdu->retry_bytes + ppdu->failed_bytes)); |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 79 | DP_STATS_INC(peer, tx.tx_failed, ppdu->failed_msdus); |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 80 | DP_STATS_UPD(peer, tx.tx_rate, ppdu->tx_rate); |
| 81 | DP_STATS_INC(peer, tx.sgi_count[ppdu->gi], num_msdu); |
| 82 | DP_STATS_INC(peer, tx.bw[ppdu->bw], num_msdu); |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 83 | DP_STATS_UPD(peer, tx.last_ack_rssi, ack_rssi); |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 84 | DP_STATS_INC(peer, tx.wme_ac_type[TID_TO_WME_AC(ppdu->tid)], num_msdu); |
| 85 | DP_STATS_INCC(peer, tx.stbc, num_msdu, ppdu->stbc); |
| 86 | DP_STATS_INCC(peer, tx.ldpc, num_msdu, ppdu->ldpc); |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 87 | DP_STATS_INC_PKT(peer, tx.tx_success, ppdu->success_msdus, |
| 88 | ppdu->success_bytes); |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 89 | if (ppdu->is_mcast) { |
| 90 | DP_STATS_INC_PKT(peer, tx.mcast, num_msdu, (ppdu->success_bytes |
| 91 | + ppdu->retry_bytes + |
| 92 | ppdu->failed_bytes)); |
| 93 | } else { |
| 94 | DP_STATS_INC_PKT(peer, tx.ucast, num_msdu, (ppdu->success_bytes |
| 95 | + ppdu->retry_bytes + |
| 96 | ppdu->failed_bytes)); |
| 97 | } |
| 98 | |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 99 | DP_STATS_INC(peer, tx.retries, |
| 100 | (ppdu->long_retries + ppdu->short_retries)); |
Pamidipati, Vijay | 57a435a | 2017-10-17 11:03:39 +0530 | [diff] [blame] | 101 | DP_STATS_INCC(peer, |
| 102 | tx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu, |
| 103 | ((mcs >= MAX_MCS_11A) && (preamble == DOT11_A))); |
| 104 | DP_STATS_INCC(peer, |
| 105 | tx.pkt_type[preamble].mcs_count[mcs], num_msdu, |
| 106 | ((mcs < MAX_MCS_11A) && (preamble == DOT11_A))); |
| 107 | DP_STATS_INCC(peer, |
| 108 | tx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu, |
| 109 | ((mcs >= MAX_MCS_11B) && (preamble == DOT11_B))); |
| 110 | DP_STATS_INCC(peer, |
| 111 | tx.pkt_type[preamble].mcs_count[mcs], num_msdu, |
| 112 | ((mcs < (MAX_MCS_11B)) && (preamble == DOT11_B))); |
| 113 | DP_STATS_INCC(peer, |
| 114 | tx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu, |
| 115 | ((mcs >= MAX_MCS_11A) && (preamble == DOT11_N))); |
| 116 | DP_STATS_INCC(peer, |
| 117 | tx.pkt_type[preamble].mcs_count[mcs], num_msdu, |
| 118 | ((mcs < MAX_MCS_11A) && (preamble == DOT11_N))); |
| 119 | DP_STATS_INCC(peer, |
| 120 | tx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu, |
| 121 | ((mcs >= MAX_MCS_11AC) && (preamble == DOT11_AC))); |
| 122 | DP_STATS_INCC(peer, |
| 123 | tx.pkt_type[preamble].mcs_count[mcs], num_msdu, |
| 124 | ((mcs < MAX_MCS_11AC) && (preamble == DOT11_AC))); |
| 125 | DP_STATS_INCC(peer, |
| 126 | tx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu, |
| 127 | ((mcs >= (MAX_MCS - 1)) && (preamble == DOT11_AX))); |
| 128 | DP_STATS_INCC(peer, |
| 129 | tx.pkt_type[preamble].mcs_count[mcs], num_msdu, |
| 130 | ((mcs < (MAX_MCS - 1)) && (preamble == DOT11_AX))); |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 131 | |
| 132 | if (soc->cdp_soc.ol_ops->update_dp_stats) { |
| 133 | soc->cdp_soc.ol_ops->update_dp_stats(pdev->osif_pdev, |
| 134 | &peer->stats, ppdu->peer_id, |
| 135 | UPDATE_PEER_STATS); |
| 136 | } |
| 137 | } |
| 138 | #endif |
| 139 | |
| 140 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 141 | * htt_htc_pkt_alloc() - Allocate HTC packet buffer |
| 142 | * @htt_soc: HTT SOC handle |
| 143 | * |
| 144 | * Return: Pointer to htc packet buffer |
| 145 | */ |
| 146 | static struct dp_htt_htc_pkt * |
| 147 | htt_htc_pkt_alloc(struct htt_soc *soc) |
| 148 | { |
| 149 | struct dp_htt_htc_pkt_union *pkt = NULL; |
| 150 | |
| 151 | HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex); |
| 152 | if (soc->htt_htc_pkt_freelist) { |
| 153 | pkt = soc->htt_htc_pkt_freelist; |
| 154 | soc->htt_htc_pkt_freelist = soc->htt_htc_pkt_freelist->u.next; |
| 155 | } |
| 156 | HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex); |
| 157 | |
| 158 | if (pkt == NULL) |
| 159 | pkt = qdf_mem_malloc(sizeof(*pkt)); |
| 160 | return &pkt->u.pkt; /* not actually a dereference */ |
| 161 | } |
| 162 | |
| 163 | /* |
| 164 | * htt_htc_pkt_free() - Free HTC packet buffer |
| 165 | * @htt_soc: HTT SOC handle |
| 166 | */ |
| 167 | static void |
| 168 | htt_htc_pkt_free(struct htt_soc *soc, struct dp_htt_htc_pkt *pkt) |
| 169 | { |
| 170 | struct dp_htt_htc_pkt_union *u_pkt = |
| 171 | (struct dp_htt_htc_pkt_union *)pkt; |
| 172 | |
| 173 | HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex); |
| 174 | u_pkt->u.next = soc->htt_htc_pkt_freelist; |
| 175 | soc->htt_htc_pkt_freelist = u_pkt; |
| 176 | HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex); |
| 177 | } |
| 178 | |
| 179 | /* |
| 180 | * htt_htc_pkt_pool_free() - Free HTC packet pool |
| 181 | * @htt_soc: HTT SOC handle |
| 182 | */ |
| 183 | static void |
| 184 | htt_htc_pkt_pool_free(struct htt_soc *soc) |
| 185 | { |
| 186 | struct dp_htt_htc_pkt_union *pkt, *next; |
| 187 | pkt = soc->htt_htc_pkt_freelist; |
| 188 | while (pkt) { |
| 189 | next = pkt->u.next; |
| 190 | qdf_mem_free(pkt); |
| 191 | pkt = next; |
| 192 | } |
| 193 | soc->htt_htc_pkt_freelist = NULL; |
| 194 | } |
| 195 | |
| 196 | /* |
Pramod Simha | e0baa44 | 2017-06-27 15:21:39 -0700 | [diff] [blame] | 197 | * htt_htc_misc_pkt_list_trim() - trim misc list |
| 198 | * @htt_soc: HTT SOC handle |
| 199 | * @level: max no. of pkts in list |
| 200 | */ |
| 201 | static void |
| 202 | htt_htc_misc_pkt_list_trim(struct htt_soc *soc, int level) |
| 203 | { |
| 204 | struct dp_htt_htc_pkt_union *pkt, *next, *prev = NULL; |
| 205 | int i = 0; |
| 206 | qdf_nbuf_t netbuf; |
| 207 | |
| 208 | HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex); |
| 209 | pkt = soc->htt_htc_pkt_misclist; |
| 210 | while (pkt) { |
| 211 | next = pkt->u.next; |
| 212 | /* trim the out grown list*/ |
| 213 | if (++i > level) { |
| 214 | netbuf = |
| 215 | (qdf_nbuf_t)(pkt->u.pkt.htc_pkt.pNetBufContext); |
| 216 | qdf_nbuf_unmap(soc->osdev, netbuf, QDF_DMA_TO_DEVICE); |
| 217 | qdf_nbuf_free(netbuf); |
| 218 | qdf_mem_free(pkt); |
| 219 | pkt = NULL; |
| 220 | if (prev) |
| 221 | prev->u.next = NULL; |
| 222 | } |
| 223 | prev = pkt; |
| 224 | pkt = next; |
| 225 | } |
| 226 | HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex); |
| 227 | } |
| 228 | |
| 229 | /* |
| 230 | * htt_htc_misc_pkt_list_add() - Add pkt to misc list |
| 231 | * @htt_soc: HTT SOC handle |
| 232 | * @dp_htt_htc_pkt: pkt to be added to list |
| 233 | */ |
| 234 | static void |
| 235 | htt_htc_misc_pkt_list_add(struct htt_soc *soc, struct dp_htt_htc_pkt *pkt) |
| 236 | { |
| 237 | struct dp_htt_htc_pkt_union *u_pkt = |
| 238 | (struct dp_htt_htc_pkt_union *)pkt; |
| 239 | int misclist_trim_level = htc_get_tx_queue_depth(soc->htc_soc, |
| 240 | pkt->htc_pkt.Endpoint) |
| 241 | + DP_HTT_HTC_PKT_MISCLIST_SIZE; |
| 242 | |
| 243 | HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex); |
| 244 | if (soc->htt_htc_pkt_misclist) { |
| 245 | u_pkt->u.next = soc->htt_htc_pkt_misclist; |
| 246 | soc->htt_htc_pkt_misclist = u_pkt; |
| 247 | } else { |
| 248 | soc->htt_htc_pkt_misclist = u_pkt; |
| 249 | } |
| 250 | HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex); |
| 251 | |
| 252 | /* only ce pipe size + tx_queue_depth could possibly be in use |
| 253 | * free older packets in the misclist |
| 254 | */ |
| 255 | htt_htc_misc_pkt_list_trim(soc, misclist_trim_level); |
| 256 | } |
| 257 | |
| 258 | /* |
| 259 | * htt_htc_misc_pkt_pool_free() - free pkts in misc list |
| 260 | * @htt_soc: HTT SOC handle |
| 261 | */ |
| 262 | static void |
| 263 | htt_htc_misc_pkt_pool_free(struct htt_soc *soc) |
| 264 | { |
| 265 | struct dp_htt_htc_pkt_union *pkt, *next; |
| 266 | qdf_nbuf_t netbuf; |
| 267 | |
| 268 | pkt = soc->htt_htc_pkt_misclist; |
| 269 | |
| 270 | while (pkt) { |
| 271 | next = pkt->u.next; |
| 272 | netbuf = (qdf_nbuf_t) (pkt->u.pkt.htc_pkt.pNetBufContext); |
| 273 | qdf_nbuf_unmap(soc->osdev, netbuf, QDF_DMA_TO_DEVICE); |
| 274 | |
| 275 | soc->stats.htc_pkt_free++; |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 276 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
Pramod Simha | e0baa44 | 2017-06-27 15:21:39 -0700 | [diff] [blame] | 277 | "%s: Pkt free count %d\n", |
| 278 | __func__, soc->stats.htc_pkt_free); |
| 279 | |
| 280 | qdf_nbuf_free(netbuf); |
| 281 | qdf_mem_free(pkt); |
| 282 | pkt = next; |
| 283 | } |
| 284 | soc->htt_htc_pkt_misclist = NULL; |
| 285 | } |
| 286 | |
| 287 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 288 | * htt_t2h_mac_addr_deswizzle() - Swap MAC addr bytes if FW endianess differ |
| 289 | * @tgt_mac_addr: Target MAC |
| 290 | * @buffer: Output buffer |
| 291 | */ |
| 292 | static u_int8_t * |
| 293 | htt_t2h_mac_addr_deswizzle(u_int8_t *tgt_mac_addr, u_int8_t *buffer) |
| 294 | { |
| 295 | #ifdef BIG_ENDIAN_HOST |
| 296 | /* |
| 297 | * The host endianness is opposite of the target endianness. |
| 298 | * To make u_int32_t elements come out correctly, the target->host |
| 299 | * upload has swizzled the bytes in each u_int32_t element of the |
| 300 | * message. |
| 301 | * For byte-array message fields like the MAC address, this |
| 302 | * upload swizzling puts the bytes in the wrong order, and needs |
| 303 | * to be undone. |
| 304 | */ |
| 305 | buffer[0] = tgt_mac_addr[3]; |
| 306 | buffer[1] = tgt_mac_addr[2]; |
| 307 | buffer[2] = tgt_mac_addr[1]; |
| 308 | buffer[3] = tgt_mac_addr[0]; |
| 309 | buffer[4] = tgt_mac_addr[7]; |
| 310 | buffer[5] = tgt_mac_addr[6]; |
| 311 | return buffer; |
| 312 | #else |
| 313 | /* |
| 314 | * The host endianness matches the target endianness - |
| 315 | * we can use the mac addr directly from the message buffer. |
| 316 | */ |
| 317 | return tgt_mac_addr; |
| 318 | #endif |
| 319 | } |
| 320 | |
| 321 | /* |
| 322 | * dp_htt_h2t_send_complete_free_netbuf() - Free completed buffer |
| 323 | * @soc: SOC handle |
| 324 | * @status: Completion status |
| 325 | * @netbuf: HTT buffer |
| 326 | */ |
| 327 | static void |
| 328 | dp_htt_h2t_send_complete_free_netbuf( |
| 329 | void *soc, A_STATUS status, qdf_nbuf_t netbuf) |
| 330 | { |
| 331 | qdf_nbuf_free(netbuf); |
| 332 | } |
| 333 | |
| 334 | /* |
| 335 | * dp_htt_h2t_send_complete() - H2T completion handler |
| 336 | * @context: Opaque context (HTT SOC handle) |
| 337 | * @htc_pkt: HTC packet |
| 338 | */ |
Jeff Johnson | 3214074 | 2017-01-05 15:30:47 -0800 | [diff] [blame] | 339 | static void |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 340 | dp_htt_h2t_send_complete(void *context, HTC_PACKET *htc_pkt) |
| 341 | { |
| 342 | void (*send_complete_part2)( |
| 343 | void *soc, A_STATUS status, qdf_nbuf_t msdu); |
| 344 | struct htt_soc *soc = (struct htt_soc *) context; |
| 345 | struct dp_htt_htc_pkt *htt_pkt; |
| 346 | qdf_nbuf_t netbuf; |
| 347 | |
| 348 | send_complete_part2 = htc_pkt->pPktContext; |
| 349 | |
| 350 | htt_pkt = container_of(htc_pkt, struct dp_htt_htc_pkt, htc_pkt); |
| 351 | |
| 352 | /* process (free or keep) the netbuf that held the message */ |
| 353 | netbuf = (qdf_nbuf_t) htc_pkt->pNetBufContext; |
| 354 | /* |
| 355 | * adf sendcomplete is required for windows only |
| 356 | */ |
| 357 | /* qdf_nbuf_set_sendcompleteflag(netbuf, TRUE); */ |
| 358 | if (send_complete_part2 != NULL) { |
| 359 | send_complete_part2( |
| 360 | htt_pkt->soc_ctxt, htc_pkt->Status, netbuf); |
| 361 | } |
| 362 | /* free the htt_htc_pkt / HTC_PACKET object */ |
| 363 | htt_htc_pkt_free(soc, htt_pkt); |
| 364 | } |
| 365 | |
| 366 | /* |
| 367 | * htt_h2t_ver_req_msg() - Send HTT version request message to target |
| 368 | * @htt_soc: HTT SOC handle |
| 369 | * |
| 370 | * Return: 0 on success; error code on failure |
| 371 | */ |
| 372 | static int htt_h2t_ver_req_msg(struct htt_soc *soc) |
| 373 | { |
| 374 | struct dp_htt_htc_pkt *pkt; |
| 375 | qdf_nbuf_t msg; |
| 376 | uint32_t *msg_word; |
| 377 | |
| 378 | msg = qdf_nbuf_alloc( |
| 379 | soc->osdev, |
| 380 | HTT_MSG_BUF_SIZE(HTT_VER_REQ_BYTES), |
| 381 | /* reserve room for the HTC header */ |
| 382 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE); |
| 383 | if (!msg) |
| 384 | return QDF_STATUS_E_NOMEM; |
| 385 | |
| 386 | /* |
| 387 | * Set the length of the message. |
| 388 | * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added |
| 389 | * separately during the below call to qdf_nbuf_push_head. |
| 390 | * The contribution from the HTC header is added separately inside HTC. |
| 391 | */ |
| 392 | if (qdf_nbuf_put_tail(msg, HTT_VER_REQ_BYTES) == NULL) { |
| 393 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 394 | "%s: Failed to expand head for HTT_H2T_MSG_TYPE_VERSION_REQ msg\n", |
| 395 | __func__); |
| 396 | return QDF_STATUS_E_FAILURE; |
| 397 | } |
| 398 | |
| 399 | /* fill in the message contents */ |
| 400 | msg_word = (u_int32_t *) qdf_nbuf_data(msg); |
| 401 | |
| 402 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
| 403 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
| 404 | |
| 405 | *msg_word = 0; |
| 406 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_VERSION_REQ); |
| 407 | |
| 408 | pkt = htt_htc_pkt_alloc(soc); |
| 409 | if (!pkt) { |
| 410 | qdf_nbuf_free(msg); |
| 411 | return QDF_STATUS_E_FAILURE; |
| 412 | } |
| 413 | pkt->soc_ctxt = NULL; /* not used during send-done callback */ |
| 414 | |
| 415 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 416 | dp_htt_h2t_send_complete_free_netbuf, qdf_nbuf_data(msg), |
| 417 | qdf_nbuf_len(msg), soc->htc_endpoint, |
| 418 | 1); /* tag - not relevant here */ |
| 419 | |
| 420 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
Pramod Simha | e0baa44 | 2017-06-27 15:21:39 -0700 | [diff] [blame] | 421 | DP_HTT_SEND_HTC_PKT(soc, pkt); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 422 | return 0; |
| 423 | } |
| 424 | |
| 425 | /* |
| 426 | * htt_srng_setup() - Send SRNG setup message to target |
| 427 | * @htt_soc: HTT SOC handle |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 428 | * @mac_id: MAC Id |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 429 | * @hal_srng: Opaque HAL SRNG pointer |
| 430 | * @hal_ring_type: SRNG ring type |
| 431 | * |
| 432 | * Return: 0 on success; error code on failure |
| 433 | */ |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 434 | int htt_srng_setup(void *htt_soc, int mac_id, void *hal_srng, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 435 | int hal_ring_type) |
| 436 | { |
| 437 | struct htt_soc *soc = (struct htt_soc *)htt_soc; |
| 438 | struct dp_htt_htc_pkt *pkt; |
| 439 | qdf_nbuf_t htt_msg; |
| 440 | uint32_t *msg_word; |
| 441 | struct hal_srng_params srng_params; |
| 442 | qdf_dma_addr_t hp_addr, tp_addr; |
| 443 | uint32_t ring_entry_size = |
| 444 | hal_srng_get_entrysize(soc->hal_soc, hal_ring_type); |
| 445 | int htt_ring_type, htt_ring_id; |
| 446 | |
| 447 | /* Sizes should be set in 4-byte words */ |
| 448 | ring_entry_size = ring_entry_size >> 2; |
| 449 | |
| 450 | htt_msg = qdf_nbuf_alloc(soc->osdev, |
| 451 | HTT_MSG_BUF_SIZE(HTT_SRING_SETUP_SZ), |
| 452 | /* reserve room for the HTC header */ |
| 453 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE); |
| 454 | if (!htt_msg) |
| 455 | goto fail0; |
| 456 | |
| 457 | hal_get_srng_params(soc->hal_soc, hal_srng, &srng_params); |
| 458 | hp_addr = hal_srng_get_hp_addr(soc->hal_soc, hal_srng); |
| 459 | tp_addr = hal_srng_get_tp_addr(soc->hal_soc, hal_srng); |
| 460 | |
| 461 | switch (hal_ring_type) { |
| 462 | case RXDMA_BUF: |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 463 | #ifdef QCA_HOST2FW_RXBUF_RING |
Manoj Ekbote | 46c0316 | 2017-02-16 21:32:00 -0800 | [diff] [blame] | 464 | if (srng_params.ring_id == |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 465 | (HAL_SRNG_WMAC1_SW2RXDMA0_BUF0)) { |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 466 | htt_ring_id = HTT_HOST1_TO_FW_RXBUF_RING; |
| 467 | htt_ring_type = HTT_SW_TO_SW_RING; |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 468 | #ifdef IPA_OFFLOAD |
| 469 | } else if (srng_params.ring_id == |
| 470 | (HAL_SRNG_WMAC1_SW2RXDMA0_BUF2)) { |
| 471 | htt_ring_id = HTT_HOST2_TO_FW_RXBUF_RING; |
| 472 | htt_ring_type = HTT_SW_TO_SW_RING; |
| 473 | #endif |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 474 | #else |
Manoj Ekbote | 46c0316 | 2017-02-16 21:32:00 -0800 | [diff] [blame] | 475 | if (srng_params.ring_id == |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 476 | (HAL_SRNG_WMAC1_SW2RXDMA0_BUF0 + |
Manoj Ekbote | 46c0316 | 2017-02-16 21:32:00 -0800 | [diff] [blame] | 477 | (mac_id * HAL_MAX_RINGS_PER_LMAC))) { |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 478 | htt_ring_id = HTT_RXDMA_HOST_BUF_RING; |
| 479 | htt_ring_type = HTT_SW_TO_HW_RING; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 480 | #endif |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 481 | } else if (srng_params.ring_id == |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 482 | #ifdef IPA_OFFLOAD |
| 483 | (HAL_SRNG_WMAC1_SW2RXDMA0_BUF1 + |
| 484 | #else |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 485 | (HAL_SRNG_WMAC1_SW2RXDMA1_BUF + |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 486 | #endif |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 487 | (mac_id * HAL_MAX_RINGS_PER_LMAC))) { |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 488 | htt_ring_id = HTT_RXDMA_HOST_BUF_RING; |
| 489 | htt_ring_type = HTT_SW_TO_HW_RING; |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 490 | } else { |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 491 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 492 | "%s: Ring %d currently not supported\n", |
| 493 | __func__, srng_params.ring_id); |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 494 | goto fail1; |
| 495 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 496 | |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 497 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 498 | "%s: ring_type %d ring_id %d\n", |
| 499 | __func__, hal_ring_type, srng_params.ring_id); |
| 500 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 501 | "%s: hp_addr 0x%llx tp_addr 0x%llx\n", |
| 502 | __func__, (uint64_t)hp_addr, (uint64_t)tp_addr); |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 503 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 504 | "%s: htt_ring_id %d\n", __func__, htt_ring_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 505 | break; |
| 506 | case RXDMA_MONITOR_BUF: |
| 507 | htt_ring_id = HTT_RXDMA_MONITOR_BUF_RING; |
| 508 | htt_ring_type = HTT_SW_TO_HW_RING; |
| 509 | break; |
| 510 | case RXDMA_MONITOR_STATUS: |
| 511 | htt_ring_id = HTT_RXDMA_MONITOR_STATUS_RING; |
| 512 | htt_ring_type = HTT_SW_TO_HW_RING; |
| 513 | break; |
| 514 | case RXDMA_MONITOR_DST: |
| 515 | htt_ring_id = HTT_RXDMA_MONITOR_DEST_RING; |
| 516 | htt_ring_type = HTT_HW_TO_SW_RING; |
| 517 | break; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 518 | case RXDMA_MONITOR_DESC: |
| 519 | htt_ring_id = HTT_RXDMA_MONITOR_DESC_RING; |
| 520 | htt_ring_type = HTT_SW_TO_HW_RING; |
| 521 | break; |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 522 | case RXDMA_DST: |
| 523 | htt_ring_id = HTT_RXDMA_NON_MONITOR_DEST_RING; |
| 524 | htt_ring_type = HTT_HW_TO_SW_RING; |
| 525 | break; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 526 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 527 | default: |
| 528 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 529 | "%s: Ring currently not supported\n", __func__); |
| 530 | goto fail1; |
| 531 | } |
| 532 | |
| 533 | /* |
| 534 | * Set the length of the message. |
| 535 | * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added |
| 536 | * separately during the below call to qdf_nbuf_push_head. |
| 537 | * The contribution from the HTC header is added separately inside HTC. |
| 538 | */ |
| 539 | if (qdf_nbuf_put_tail(htt_msg, HTT_SRING_SETUP_SZ) == NULL) { |
| 540 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 541 | "%s: Failed to expand head for SRING_SETUP msg\n", |
| 542 | __func__); |
| 543 | return QDF_STATUS_E_FAILURE; |
| 544 | } |
| 545 | |
| 546 | msg_word = (uint32_t *)qdf_nbuf_data(htt_msg); |
| 547 | |
| 548 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
| 549 | qdf_nbuf_push_head(htt_msg, HTC_HDR_ALIGNMENT_PADDING); |
| 550 | |
| 551 | /* word 0 */ |
| 552 | *msg_word = 0; |
| 553 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_SRING_SETUP); |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 554 | |
Kai Chen | cbe4c34 | 2017-06-12 20:06:35 -0700 | [diff] [blame] | 555 | if ((htt_ring_type == HTT_SW_TO_HW_RING) || |
Ravi Joshi | 8851f4e | 2017-06-07 21:22:08 -0700 | [diff] [blame] | 556 | (htt_ring_type == HTT_HW_TO_SW_RING)) |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 557 | HTT_SRING_SETUP_PDEV_ID_SET(*msg_word, |
| 558 | DP_SW2HW_MACID(mac_id)); |
| 559 | else |
| 560 | HTT_SRING_SETUP_PDEV_ID_SET(*msg_word, mac_id); |
| 561 | |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 562 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 563 | "%s: mac_id %d\n", __func__, mac_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 564 | HTT_SRING_SETUP_RING_TYPE_SET(*msg_word, htt_ring_type); |
| 565 | /* TODO: Discuss with FW on changing this to unique ID and using |
| 566 | * htt_ring_type to send the type of ring |
| 567 | */ |
| 568 | HTT_SRING_SETUP_RING_ID_SET(*msg_word, htt_ring_id); |
| 569 | |
| 570 | /* word 1 */ |
| 571 | msg_word++; |
| 572 | *msg_word = 0; |
| 573 | HTT_SRING_SETUP_RING_BASE_ADDR_LO_SET(*msg_word, |
| 574 | srng_params.ring_base_paddr & 0xffffffff); |
| 575 | |
| 576 | /* word 2 */ |
| 577 | msg_word++; |
| 578 | *msg_word = 0; |
| 579 | HTT_SRING_SETUP_RING_BASE_ADDR_HI_SET(*msg_word, |
| 580 | (uint64_t)srng_params.ring_base_paddr >> 32); |
| 581 | |
| 582 | /* word 3 */ |
| 583 | msg_word++; |
| 584 | *msg_word = 0; |
| 585 | HTT_SRING_SETUP_ENTRY_SIZE_SET(*msg_word, ring_entry_size); |
| 586 | HTT_SRING_SETUP_RING_SIZE_SET(*msg_word, |
| 587 | (ring_entry_size * srng_params.num_entries)); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 588 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 589 | "%s: entry_size %d\n", __func__, |
| 590 | ring_entry_size); |
| 591 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 592 | "%s: num_entries %d\n", __func__, |
| 593 | srng_params.num_entries); |
| 594 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 595 | "%s: ring_size %d\n", __func__, |
| 596 | (ring_entry_size * srng_params.num_entries)); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 597 | if (htt_ring_type == HTT_SW_TO_HW_RING) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 598 | HTT_SRING_SETUP_RING_MISC_CFG_FLAG_LOOPCOUNT_DISABLE_SET( |
| 599 | *msg_word, 1); |
| 600 | HTT_SRING_SETUP_RING_MISC_CFG_FLAG_MSI_SWAP_SET(*msg_word, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 601 | !!(srng_params.flags & HAL_SRNG_MSI_SWAP)); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 602 | HTT_SRING_SETUP_RING_MISC_CFG_FLAG_TLV_SWAP_SET(*msg_word, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 603 | !!(srng_params.flags & HAL_SRNG_DATA_TLV_SWAP)); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 604 | HTT_SRING_SETUP_RING_MISC_CFG_FLAG_HOST_FW_SWAP_SET(*msg_word, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 605 | !!(srng_params.flags & HAL_SRNG_RING_PTR_SWAP)); |
| 606 | |
| 607 | /* word 4 */ |
| 608 | msg_word++; |
| 609 | *msg_word = 0; |
| 610 | HTT_SRING_SETUP_HEAD_OFFSET32_REMOTE_BASE_ADDR_LO_SET(*msg_word, |
| 611 | hp_addr & 0xffffffff); |
| 612 | |
| 613 | /* word 5 */ |
| 614 | msg_word++; |
| 615 | *msg_word = 0; |
| 616 | HTT_SRING_SETUP_HEAD_OFFSET32_REMOTE_BASE_ADDR_HI_SET(*msg_word, |
| 617 | (uint64_t)hp_addr >> 32); |
| 618 | |
| 619 | /* word 6 */ |
| 620 | msg_word++; |
| 621 | *msg_word = 0; |
| 622 | HTT_SRING_SETUP_TAIL_OFFSET32_REMOTE_BASE_ADDR_LO_SET(*msg_word, |
| 623 | tp_addr & 0xffffffff); |
| 624 | |
| 625 | /* word 7 */ |
| 626 | msg_word++; |
| 627 | *msg_word = 0; |
| 628 | HTT_SRING_SETUP_TAIL_OFFSET32_REMOTE_BASE_ADDR_HI_SET(*msg_word, |
| 629 | (uint64_t)tp_addr >> 32); |
| 630 | |
| 631 | /* word 8 */ |
| 632 | msg_word++; |
| 633 | *msg_word = 0; |
| 634 | HTT_SRING_SETUP_RING_MSI_ADDR_LO_SET(*msg_word, |
| 635 | srng_params.msi_addr & 0xffffffff); |
| 636 | |
| 637 | /* word 9 */ |
| 638 | msg_word++; |
| 639 | *msg_word = 0; |
| 640 | HTT_SRING_SETUP_RING_MSI_ADDR_HI_SET(*msg_word, |
| 641 | (uint64_t)(srng_params.msi_addr) >> 32); |
| 642 | |
| 643 | /* word 10 */ |
| 644 | msg_word++; |
| 645 | *msg_word = 0; |
| 646 | HTT_SRING_SETUP_RING_MSI_DATA_SET(*msg_word, |
| 647 | srng_params.msi_data); |
| 648 | |
| 649 | /* word 11 */ |
| 650 | msg_word++; |
| 651 | *msg_word = 0; |
| 652 | HTT_SRING_SETUP_INTR_BATCH_COUNTER_TH_SET(*msg_word, |
| 653 | srng_params.intr_batch_cntr_thres_entries * |
| 654 | ring_entry_size); |
| 655 | HTT_SRING_SETUP_INTR_TIMER_TH_SET(*msg_word, |
| 656 | srng_params.intr_timer_thres_us >> 3); |
| 657 | |
| 658 | /* word 12 */ |
| 659 | msg_word++; |
| 660 | *msg_word = 0; |
| 661 | if (srng_params.flags & HAL_SRNG_LOW_THRES_INTR_ENABLE) { |
| 662 | /* TODO: Setting low threshold to 1/8th of ring size - see |
| 663 | * if this needs to be configurable |
| 664 | */ |
| 665 | HTT_SRING_SETUP_INTR_LOW_TH_SET(*msg_word, |
| 666 | srng_params.low_threshold); |
| 667 | } |
| 668 | /* "response_required" field should be set if a HTT response message is |
| 669 | * required after setting up the ring. |
| 670 | */ |
| 671 | pkt = htt_htc_pkt_alloc(soc); |
| 672 | if (!pkt) |
| 673 | goto fail1; |
| 674 | |
| 675 | pkt->soc_ctxt = NULL; /* not used during send-done callback */ |
| 676 | |
| 677 | SET_HTC_PACKET_INFO_TX( |
| 678 | &pkt->htc_pkt, |
| 679 | dp_htt_h2t_send_complete_free_netbuf, |
| 680 | qdf_nbuf_data(htt_msg), |
| 681 | qdf_nbuf_len(htt_msg), |
| 682 | soc->htc_endpoint, |
Yue Ma | 245b47b | 2017-02-21 16:35:31 -0800 | [diff] [blame] | 683 | HTC_TX_PACKET_TAG_RUNTIME_PUT); /* tag for no FW response msg */ |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 684 | |
| 685 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg); |
Pramod Simha | e0baa44 | 2017-06-27 15:21:39 -0700 | [diff] [blame] | 686 | DP_HTT_SEND_HTC_PKT(soc, pkt); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 687 | |
| 688 | return QDF_STATUS_SUCCESS; |
| 689 | |
| 690 | fail1: |
| 691 | qdf_nbuf_free(htt_msg); |
| 692 | fail0: |
| 693 | return QDF_STATUS_E_FAILURE; |
| 694 | } |
| 695 | |
| 696 | /* |
| 697 | * htt_h2t_rx_ring_cfg() - Send SRNG packet and TLV filter |
| 698 | * config message to target |
| 699 | * @htt_soc: HTT SOC handle |
| 700 | * @pdev_id: PDEV Id |
| 701 | * @hal_srng: Opaque HAL SRNG pointer |
| 702 | * @hal_ring_type: SRNG ring type |
| 703 | * @ring_buf_size: SRNG buffer size |
| 704 | * @htt_tlv_filter: Rx SRNG TLV and filter setting |
| 705 | * Return: 0 on success; error code on failure |
| 706 | */ |
| 707 | int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng, |
| 708 | int hal_ring_type, int ring_buf_size, |
| 709 | struct htt_rx_ring_tlv_filter *htt_tlv_filter) |
| 710 | { |
| 711 | struct htt_soc *soc = (struct htt_soc *)htt_soc; |
| 712 | struct dp_htt_htc_pkt *pkt; |
| 713 | qdf_nbuf_t htt_msg; |
| 714 | uint32_t *msg_word; |
| 715 | struct hal_srng_params srng_params; |
| 716 | uint32_t htt_ring_type, htt_ring_id; |
| 717 | uint32_t tlv_filter; |
| 718 | |
| 719 | htt_msg = qdf_nbuf_alloc(soc->osdev, |
| 720 | HTT_MSG_BUF_SIZE(HTT_RX_RING_SELECTION_CFG_SZ), |
| 721 | /* reserve room for the HTC header */ |
| 722 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE); |
| 723 | if (!htt_msg) |
| 724 | goto fail0; |
| 725 | |
| 726 | hal_get_srng_params(soc->hal_soc, hal_srng, &srng_params); |
| 727 | |
| 728 | switch (hal_ring_type) { |
| 729 | case RXDMA_BUF: |
| 730 | #if QCA_HOST2FW_RXBUF_RING |
| 731 | htt_ring_id = HTT_HOST1_TO_FW_RXBUF_RING; |
| 732 | htt_ring_type = HTT_SW_TO_SW_RING; |
| 733 | #else |
| 734 | htt_ring_id = HTT_RXDMA_HOST_BUF_RING; |
| 735 | htt_ring_type = HTT_SW_TO_HW_RING; |
| 736 | #endif |
| 737 | break; |
| 738 | case RXDMA_MONITOR_BUF: |
| 739 | htt_ring_id = HTT_RXDMA_MONITOR_BUF_RING; |
| 740 | htt_ring_type = HTT_SW_TO_HW_RING; |
| 741 | break; |
| 742 | case RXDMA_MONITOR_STATUS: |
| 743 | htt_ring_id = HTT_RXDMA_MONITOR_STATUS_RING; |
| 744 | htt_ring_type = HTT_SW_TO_HW_RING; |
| 745 | break; |
| 746 | case RXDMA_MONITOR_DST: |
| 747 | htt_ring_id = HTT_RXDMA_MONITOR_DEST_RING; |
| 748 | htt_ring_type = HTT_HW_TO_SW_RING; |
| 749 | break; |
| 750 | case RXDMA_MONITOR_DESC: |
| 751 | htt_ring_id = HTT_RXDMA_MONITOR_DESC_RING; |
| 752 | htt_ring_type = HTT_SW_TO_HW_RING; |
| 753 | break; |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 754 | case RXDMA_DST: |
| 755 | htt_ring_id = HTT_RXDMA_NON_MONITOR_DEST_RING; |
| 756 | htt_ring_type = HTT_HW_TO_SW_RING; |
| 757 | break; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 758 | |
| 759 | default: |
| 760 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 761 | "%s: Ring currently not supported\n", __func__); |
| 762 | goto fail1; |
| 763 | } |
| 764 | |
| 765 | /* |
| 766 | * Set the length of the message. |
| 767 | * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added |
| 768 | * separately during the below call to qdf_nbuf_push_head. |
| 769 | * The contribution from the HTC header is added separately inside HTC. |
| 770 | */ |
| 771 | if (qdf_nbuf_put_tail(htt_msg, HTT_RX_RING_SELECTION_CFG_SZ) == NULL) { |
| 772 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 773 | "%s: Failed to expand head for RX Ring Cfg msg\n", |
| 774 | __func__); |
| 775 | goto fail1; /* failure */ |
| 776 | } |
| 777 | |
| 778 | msg_word = (uint32_t *)qdf_nbuf_data(htt_msg); |
| 779 | |
| 780 | /* rewind beyond alignment pad to get to the HTC header reserved area */ |
| 781 | qdf_nbuf_push_head(htt_msg, HTC_HDR_ALIGNMENT_PADDING); |
| 782 | |
| 783 | /* word 0 */ |
| 784 | *msg_word = 0; |
| 785 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG); |
Ravi Joshi | 8851f4e | 2017-06-07 21:22:08 -0700 | [diff] [blame] | 786 | |
| 787 | /* |
| 788 | * pdev_id is indexed from 0 whereas mac_id is indexed from 1 |
| 789 | * SW_TO_SW and SW_TO_HW rings are unaffected by this |
| 790 | */ |
| 791 | if (htt_ring_type == HTT_SW_TO_SW_RING || |
| 792 | htt_ring_type == HTT_SW_TO_HW_RING) |
| 793 | HTT_RX_RING_SELECTION_CFG_PDEV_ID_SET(*msg_word, |
| 794 | DP_SW2HW_MACID(pdev_id)); |
| 795 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 796 | /* TODO: Discuss with FW on changing this to unique ID and using |
| 797 | * htt_ring_type to send the type of ring |
| 798 | */ |
| 799 | HTT_RX_RING_SELECTION_CFG_RING_ID_SET(*msg_word, htt_ring_id); |
| 800 | |
| 801 | HTT_RX_RING_SELECTION_CFG_STATUS_TLV_SET(*msg_word, |
| 802 | !!(srng_params.flags & HAL_SRNG_MSI_SWAP)); |
| 803 | |
| 804 | HTT_RX_RING_SELECTION_CFG_PKT_TLV_SET(*msg_word, |
| 805 | !!(srng_params.flags & HAL_SRNG_DATA_TLV_SWAP)); |
| 806 | |
| 807 | /* word 1 */ |
| 808 | msg_word++; |
| 809 | *msg_word = 0; |
| 810 | HTT_RX_RING_SELECTION_CFG_RING_BUFFER_SIZE_SET(*msg_word, |
| 811 | ring_buf_size); |
| 812 | |
| 813 | /* word 2 */ |
| 814 | msg_word++; |
| 815 | *msg_word = 0; |
| 816 | |
| 817 | if (htt_tlv_filter->enable_fp) { |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 818 | /* TYPE: MGMT */ |
| 819 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 820 | FP, MGMT, 0000, |
| 821 | (htt_tlv_filter->fp_mgmt_filter & |
| 822 | FILTER_MGMT_ASSOC_REQ) ? 1 : 0); |
| 823 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 824 | FP, MGMT, 0001, |
| 825 | (htt_tlv_filter->fp_mgmt_filter & |
| 826 | FILTER_MGMT_ASSOC_RES) ? 1 : 0); |
| 827 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 828 | FP, MGMT, 0010, |
| 829 | (htt_tlv_filter->fp_mgmt_filter & |
| 830 | FILTER_MGMT_REASSOC_REQ) ? 1 : 0); |
| 831 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 832 | FP, MGMT, 0011, |
| 833 | (htt_tlv_filter->fp_mgmt_filter & |
| 834 | FILTER_MGMT_REASSOC_RES) ? 1 : 0); |
| 835 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 836 | FP, MGMT, 0100, |
| 837 | (htt_tlv_filter->fp_mgmt_filter & |
| 838 | FILTER_MGMT_PROBE_REQ) ? 1 : 0); |
| 839 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 840 | FP, MGMT, 0101, |
| 841 | (htt_tlv_filter->fp_mgmt_filter & |
| 842 | FILTER_MGMT_PROBE_RES) ? 1 : 0); |
| 843 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 844 | FP, MGMT, 0110, |
| 845 | (htt_tlv_filter->fp_mgmt_filter & |
| 846 | FILTER_MGMT_TIM_ADVT) ? 1 : 0); |
| 847 | /* reserved */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 848 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 849 | MGMT, 0111, |
| 850 | (htt_tlv_filter->fp_mgmt_filter & |
| 851 | FILTER_MGMT_RESERVED_7) ? 1 : 0); |
| 852 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 853 | FP, MGMT, 1000, |
| 854 | (htt_tlv_filter->fp_mgmt_filter & |
| 855 | FILTER_MGMT_BEACON) ? 1 : 0); |
| 856 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 857 | FP, MGMT, 1001, |
| 858 | (htt_tlv_filter->fp_mgmt_filter & |
| 859 | FILTER_MGMT_ATIM) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 860 | } |
| 861 | |
| 862 | if (htt_tlv_filter->enable_md) { |
| 863 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 864 | MGMT, 0000, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 865 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 866 | MGMT, 0001, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 867 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 868 | MGMT, 0010, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 869 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 870 | MGMT, 0011, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 871 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 872 | MGMT, 0100, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 873 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 874 | MGMT, 0101, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 875 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 876 | MGMT, 0110, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 877 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 878 | MGMT, 0111, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 879 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 880 | MGMT, 1000, 1); |
| 881 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD, |
| 882 | MGMT, 1001, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 883 | } |
| 884 | |
| 885 | if (htt_tlv_filter->enable_mo) { |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 886 | /* TYPE: MGMT */ |
| 887 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 888 | MO, MGMT, 0000, |
| 889 | (htt_tlv_filter->mo_mgmt_filter & |
| 890 | FILTER_MGMT_ASSOC_REQ) ? 1 : 0); |
| 891 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 892 | MO, MGMT, 0001, |
| 893 | (htt_tlv_filter->mo_mgmt_filter & |
| 894 | FILTER_MGMT_ASSOC_RES) ? 1 : 0); |
| 895 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 896 | MO, MGMT, 0010, |
| 897 | (htt_tlv_filter->mo_mgmt_filter & |
| 898 | FILTER_MGMT_REASSOC_REQ) ? 1 : 0); |
| 899 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 900 | MO, MGMT, 0011, |
| 901 | (htt_tlv_filter->mo_mgmt_filter & |
| 902 | FILTER_MGMT_REASSOC_RES) ? 1 : 0); |
| 903 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 904 | MO, MGMT, 0100, |
| 905 | (htt_tlv_filter->mo_mgmt_filter & |
| 906 | FILTER_MGMT_PROBE_REQ) ? 1 : 0); |
| 907 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 908 | MO, MGMT, 0101, |
| 909 | (htt_tlv_filter->mo_mgmt_filter & |
| 910 | FILTER_MGMT_PROBE_RES) ? 1 : 0); |
| 911 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 912 | MO, MGMT, 0110, |
| 913 | (htt_tlv_filter->mo_mgmt_filter & |
| 914 | FILTER_MGMT_TIM_ADVT) ? 1 : 0); |
| 915 | /* reserved */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 916 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 917 | MGMT, 0111, |
| 918 | (htt_tlv_filter->mo_mgmt_filter & |
| 919 | FILTER_MGMT_RESERVED_7) ? 1 : 0); |
| 920 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 921 | MO, MGMT, 1000, |
| 922 | (htt_tlv_filter->mo_mgmt_filter & |
| 923 | FILTER_MGMT_BEACON) ? 1 : 0); |
| 924 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, |
| 925 | MO, MGMT, 1001, |
| 926 | (htt_tlv_filter->mo_mgmt_filter & |
| 927 | FILTER_MGMT_ATIM) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 928 | } |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 929 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 930 | /* word 3 */ |
| 931 | msg_word++; |
| 932 | *msg_word = 0; |
| 933 | |
| 934 | if (htt_tlv_filter->enable_fp) { |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 935 | /* TYPE: MGMT */ |
| 936 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 937 | FP, MGMT, 1010, |
| 938 | (htt_tlv_filter->fp_mgmt_filter & |
| 939 | FILTER_MGMT_DISASSOC) ? 1 : 0); |
| 940 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 941 | FP, MGMT, 1011, |
| 942 | (htt_tlv_filter->fp_mgmt_filter & |
| 943 | FILTER_MGMT_AUTH) ? 1 : 0); |
| 944 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 945 | FP, MGMT, 1100, |
| 946 | (htt_tlv_filter->fp_mgmt_filter & |
| 947 | FILTER_MGMT_DEAUTH) ? 1 : 0); |
| 948 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 949 | FP, MGMT, 1101, |
| 950 | (htt_tlv_filter->fp_mgmt_filter & |
| 951 | FILTER_MGMT_ACTION) ? 1 : 0); |
| 952 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 953 | FP, MGMT, 1110, |
| 954 | (htt_tlv_filter->fp_mgmt_filter & |
| 955 | FILTER_MGMT_ACT_NO_ACK) ? 1 : 0); |
| 956 | /* reserved*/ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 957 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 958 | MGMT, 1111, |
| 959 | (htt_tlv_filter->fp_mgmt_filter & |
| 960 | FILTER_MGMT_RESERVED_15) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 961 | } |
| 962 | |
| 963 | if (htt_tlv_filter->enable_md) { |
| 964 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 965 | MGMT, 1010, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 966 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 967 | MGMT, 1011, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 968 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 969 | MGMT, 1100, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 970 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 971 | MGMT, 1101, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 972 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 973 | MGMT, 1110, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 974 | } |
| 975 | |
| 976 | if (htt_tlv_filter->enable_mo) { |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 977 | /* TYPE: MGMT */ |
| 978 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 979 | MO, MGMT, 1010, |
| 980 | (htt_tlv_filter->mo_mgmt_filter & |
| 981 | FILTER_MGMT_DISASSOC) ? 1 : 0); |
| 982 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 983 | MO, MGMT, 1011, |
| 984 | (htt_tlv_filter->mo_mgmt_filter & |
| 985 | FILTER_MGMT_AUTH) ? 1 : 0); |
| 986 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 987 | MO, MGMT, 1100, |
| 988 | (htt_tlv_filter->mo_mgmt_filter & |
| 989 | FILTER_MGMT_DEAUTH) ? 1 : 0); |
| 990 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 991 | MO, MGMT, 1101, |
| 992 | (htt_tlv_filter->mo_mgmt_filter & |
| 993 | FILTER_MGMT_ACTION) ? 1 : 0); |
| 994 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, |
| 995 | MO, MGMT, 1110, |
| 996 | (htt_tlv_filter->mo_mgmt_filter & |
| 997 | FILTER_MGMT_ACT_NO_ACK) ? 1 : 0); |
| 998 | /* reserved*/ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 999 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1000 | MGMT, 1111, |
| 1001 | (htt_tlv_filter->mo_mgmt_filter & |
| 1002 | FILTER_MGMT_RESERVED_15) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1003 | } |
| 1004 | |
| 1005 | /* word 4 */ |
| 1006 | msg_word++; |
| 1007 | *msg_word = 0; |
| 1008 | |
| 1009 | if (htt_tlv_filter->enable_fp) { |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1010 | /* TYPE: CTRL */ |
| 1011 | /* reserved */ |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 1012 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1013 | CTRL, 0000, |
| 1014 | (htt_tlv_filter->fp_ctrl_filter & |
| 1015 | FILTER_CTRL_RESERVED_1) ? 1 : 0); |
| 1016 | /* reserved */ |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 1017 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1018 | CTRL, 0001, |
| 1019 | (htt_tlv_filter->fp_ctrl_filter & |
| 1020 | FILTER_CTRL_RESERVED_2) ? 1 : 0); |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 1021 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1022 | CTRL, 0010, |
| 1023 | (htt_tlv_filter->fp_ctrl_filter & |
| 1024 | FILTER_CTRL_TRIGGER) ? 1 : 0); |
| 1025 | /* reserved */ |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 1026 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1027 | CTRL, 0011, |
| 1028 | (htt_tlv_filter->fp_ctrl_filter & |
| 1029 | FILTER_CTRL_RESERVED_4) ? 1 : 0); |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 1030 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1031 | CTRL, 0100, |
| 1032 | (htt_tlv_filter->fp_ctrl_filter & |
| 1033 | FILTER_CTRL_BF_REP_POLL) ? 1 : 0); |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 1034 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1035 | CTRL, 0101, |
| 1036 | (htt_tlv_filter->fp_ctrl_filter & |
| 1037 | FILTER_CTRL_VHT_NDP) ? 1 : 0); |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 1038 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1039 | CTRL, 0110, |
| 1040 | (htt_tlv_filter->fp_ctrl_filter & |
| 1041 | FILTER_CTRL_FRAME_EXT) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1042 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1043 | CTRL, 0111, |
| 1044 | (htt_tlv_filter->fp_ctrl_filter & |
| 1045 | FILTER_CTRL_CTRLWRAP) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1046 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1047 | CTRL, 1000, |
| 1048 | (htt_tlv_filter->fp_ctrl_filter & |
| 1049 | FILTER_CTRL_BA_REQ) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1050 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1051 | CTRL, 1001, |
| 1052 | (htt_tlv_filter->fp_ctrl_filter & |
| 1053 | FILTER_CTRL_BA) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1054 | } |
| 1055 | |
| 1056 | if (htt_tlv_filter->enable_md) { |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1057 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
| 1058 | CTRL, 0000, 1); |
| 1059 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
| 1060 | CTRL, 0001, 1); |
| 1061 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
| 1062 | CTRL, 0010, 1); |
| 1063 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
| 1064 | CTRL, 0011, 1); |
| 1065 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
| 1066 | CTRL, 0100, 1); |
| 1067 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
| 1068 | CTRL, 0101, 1); |
| 1069 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
| 1070 | CTRL, 0110, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1071 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1072 | CTRL, 0111, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1073 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1074 | CTRL, 1000, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1075 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1076 | CTRL, 1001, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1077 | } |
| 1078 | |
| 1079 | if (htt_tlv_filter->enable_mo) { |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1080 | /* TYPE: CTRL */ |
| 1081 | /* reserved */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1082 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1083 | CTRL, 0000, |
| 1084 | (htt_tlv_filter->mo_ctrl_filter & |
| 1085 | FILTER_CTRL_RESERVED_1) ? 1 : 0); |
| 1086 | /* reserved */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1087 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1088 | CTRL, 0001, |
| 1089 | (htt_tlv_filter->mo_ctrl_filter & |
| 1090 | FILTER_CTRL_RESERVED_2) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1091 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1092 | CTRL, 0010, |
| 1093 | (htt_tlv_filter->mo_ctrl_filter & |
| 1094 | FILTER_CTRL_TRIGGER) ? 1 : 0); |
| 1095 | /* reserved */ |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1096 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1097 | CTRL, 0011, |
| 1098 | (htt_tlv_filter->mo_ctrl_filter & |
| 1099 | FILTER_CTRL_RESERVED_4) ? 1 : 0); |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1100 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1101 | CTRL, 0100, |
| 1102 | (htt_tlv_filter->mo_ctrl_filter & |
| 1103 | FILTER_CTRL_BF_REP_POLL) ? 1 : 0); |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1104 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1105 | CTRL, 0101, |
| 1106 | (htt_tlv_filter->mo_ctrl_filter & |
| 1107 | FILTER_CTRL_VHT_NDP) ? 1 : 0); |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1108 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1109 | CTRL, 0110, |
| 1110 | (htt_tlv_filter->mo_ctrl_filter & |
| 1111 | FILTER_CTRL_FRAME_EXT) ? 1 : 0); |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1112 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1113 | CTRL, 0111, |
| 1114 | (htt_tlv_filter->mo_ctrl_filter & |
| 1115 | FILTER_CTRL_CTRLWRAP) ? 1 : 0); |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1116 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1117 | CTRL, 1000, |
| 1118 | (htt_tlv_filter->mo_ctrl_filter & |
| 1119 | FILTER_CTRL_BA_REQ) ? 1 : 0); |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1120 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1121 | CTRL, 1001, |
| 1122 | (htt_tlv_filter->mo_ctrl_filter & |
| 1123 | FILTER_CTRL_BA) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1124 | } |
| 1125 | |
| 1126 | /* word 5 */ |
| 1127 | msg_word++; |
| 1128 | *msg_word = 0; |
| 1129 | if (htt_tlv_filter->enable_fp) { |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1130 | /* TYPE: CTRL */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1131 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1132 | CTRL, 1010, |
| 1133 | (htt_tlv_filter->fp_ctrl_filter & |
| 1134 | FILTER_CTRL_PSPOLL) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1135 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1136 | CTRL, 1011, |
| 1137 | (htt_tlv_filter->fp_ctrl_filter & |
| 1138 | FILTER_CTRL_RTS) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1139 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1140 | CTRL, 1100, |
| 1141 | (htt_tlv_filter->fp_ctrl_filter & |
| 1142 | FILTER_CTRL_CTS) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1143 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1144 | CTRL, 1101, |
| 1145 | (htt_tlv_filter->fp_ctrl_filter & |
| 1146 | FILTER_CTRL_ACK) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1147 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1148 | CTRL, 1110, |
| 1149 | (htt_tlv_filter->fp_ctrl_filter & |
| 1150 | FILTER_CTRL_CFEND) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1151 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1152 | CTRL, 1111, |
| 1153 | (htt_tlv_filter->fp_ctrl_filter & |
| 1154 | FILTER_CTRL_CFEND_CFACK) ? 1 : 0); |
| 1155 | /* TYPE: DATA */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1156 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1157 | DATA, MCAST, |
| 1158 | (htt_tlv_filter->fp_data_filter & |
| 1159 | FILTER_DATA_MCAST) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1160 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1161 | DATA, UCAST, |
| 1162 | (htt_tlv_filter->fp_data_filter & |
| 1163 | FILTER_DATA_UCAST) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1164 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1165 | DATA, NULL, |
| 1166 | (htt_tlv_filter->fp_data_filter & |
| 1167 | FILTER_DATA_NULL) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1168 | } |
| 1169 | |
| 1170 | if (htt_tlv_filter->enable_md) { |
| 1171 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1172 | CTRL, 1010, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1173 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1174 | CTRL, 1011, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1175 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1176 | CTRL, 1100, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1177 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1178 | CTRL, 1101, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1179 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1180 | CTRL, 1110, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1181 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1182 | CTRL, 1111, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1183 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1184 | DATA, MCAST, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1185 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1186 | DATA, UCAST, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1187 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD, |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1188 | DATA, NULL, 1); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1189 | } |
Ravi Joshi | 2320b6f | 2017-05-24 15:43:04 -0700 | [diff] [blame] | 1190 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1191 | if (htt_tlv_filter->enable_mo) { |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1192 | /* TYPE: CTRL */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1193 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1194 | CTRL, 1010, |
| 1195 | (htt_tlv_filter->mo_ctrl_filter & |
| 1196 | FILTER_CTRL_PSPOLL) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1197 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1198 | CTRL, 1011, |
| 1199 | (htt_tlv_filter->mo_ctrl_filter & |
| 1200 | FILTER_CTRL_RTS) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1201 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1202 | CTRL, 1100, |
| 1203 | (htt_tlv_filter->mo_ctrl_filter & |
| 1204 | FILTER_CTRL_CTS) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1205 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1206 | CTRL, 1101, |
| 1207 | (htt_tlv_filter->mo_ctrl_filter & |
| 1208 | FILTER_CTRL_ACK) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1209 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1210 | CTRL, 1110, |
| 1211 | (htt_tlv_filter->mo_ctrl_filter & |
| 1212 | FILTER_CTRL_CFEND) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1213 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1214 | CTRL, 1111, |
| 1215 | (htt_tlv_filter->mo_ctrl_filter & |
| 1216 | FILTER_CTRL_CFEND_CFACK) ? 1 : 0); |
| 1217 | /* TYPE: DATA */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1218 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1219 | DATA, MCAST, |
| 1220 | (htt_tlv_filter->mo_data_filter & |
| 1221 | FILTER_DATA_MCAST) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1222 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1223 | DATA, UCAST, |
| 1224 | (htt_tlv_filter->mo_data_filter & |
| 1225 | FILTER_DATA_UCAST) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1226 | htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 1227 | DATA, NULL, |
| 1228 | (htt_tlv_filter->mo_data_filter & |
| 1229 | FILTER_DATA_NULL) ? 1 : 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1230 | } |
| 1231 | |
| 1232 | /* word 6 */ |
| 1233 | msg_word++; |
| 1234 | *msg_word = 0; |
| 1235 | tlv_filter = 0; |
| 1236 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MPDU_START, |
| 1237 | htt_tlv_filter->mpdu_start); |
| 1238 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MSDU_START, |
| 1239 | htt_tlv_filter->msdu_start); |
| 1240 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PACKET, |
| 1241 | htt_tlv_filter->packet); |
| 1242 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MSDU_END, |
| 1243 | htt_tlv_filter->msdu_end); |
| 1244 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MPDU_END, |
| 1245 | htt_tlv_filter->mpdu_end); |
| 1246 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PACKET_HEADER, |
| 1247 | htt_tlv_filter->packet_header); |
| 1248 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, ATTENTION, |
Karunakar Dasineni | 4055568 | 2017-03-26 22:44:39 -0700 | [diff] [blame] | 1249 | htt_tlv_filter->attention); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1250 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_START, |
| 1251 | htt_tlv_filter->ppdu_start); |
| 1252 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END, |
| 1253 | htt_tlv_filter->ppdu_end); |
| 1254 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END_USER_STATS, |
| 1255 | htt_tlv_filter->ppdu_end_user_stats); |
| 1256 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, |
| 1257 | PPDU_END_USER_STATS_EXT, |
| 1258 | htt_tlv_filter->ppdu_end_user_stats_ext); |
| 1259 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END_STATUS_DONE, |
| 1260 | htt_tlv_filter->ppdu_end_status_done); |
sumedh baikady | 308ff00 | 2017-09-18 16:24:36 -0700 | [diff] [blame] | 1261 | /* RESERVED bit maps to header_per_msdu in htt_tlv_filter*/ |
| 1262 | htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, RESERVED, |
| 1263 | htt_tlv_filter->header_per_msdu); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1264 | |
| 1265 | HTT_RX_RING_SELECTION_CFG_TLV_FILTER_IN_FLAG_SET(*msg_word, tlv_filter); |
| 1266 | |
| 1267 | /* "response_required" field should be set if a HTT response message is |
| 1268 | * required after setting up the ring. |
| 1269 | */ |
| 1270 | pkt = htt_htc_pkt_alloc(soc); |
| 1271 | if (!pkt) |
| 1272 | goto fail1; |
| 1273 | |
| 1274 | pkt->soc_ctxt = NULL; /* not used during send-done callback */ |
| 1275 | |
| 1276 | SET_HTC_PACKET_INFO_TX( |
| 1277 | &pkt->htc_pkt, |
| 1278 | dp_htt_h2t_send_complete_free_netbuf, |
| 1279 | qdf_nbuf_data(htt_msg), |
| 1280 | qdf_nbuf_len(htt_msg), |
| 1281 | soc->htc_endpoint, |
| 1282 | 1); /* tag - not relevant here */ |
| 1283 | |
| 1284 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg); |
Pramod Simha | e0baa44 | 2017-06-27 15:21:39 -0700 | [diff] [blame] | 1285 | DP_HTT_SEND_HTC_PKT(soc, pkt); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1286 | return QDF_STATUS_SUCCESS; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1287 | |
| 1288 | fail1: |
| 1289 | qdf_nbuf_free(htt_msg); |
| 1290 | fail0: |
| 1291 | return QDF_STATUS_E_FAILURE; |
| 1292 | } |
| 1293 | |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 1294 | #if defined(CONFIG_WIN) && WDI_EVENT_ENABLE |
| 1295 | static inline QDF_STATUS dp_send_htt_stat_resp(struct htt_stats_context *htt_stats, |
| 1296 | struct dp_soc *soc, qdf_nbuf_t htt_msg) |
| 1297 | |
| 1298 | { |
| 1299 | uint32_t pdev_id; |
| 1300 | uint32_t *msg_word = NULL; |
| 1301 | uint32_t msg_remain_len = 0; |
| 1302 | |
| 1303 | msg_word = (uint32_t *) qdf_nbuf_data(htt_msg); |
| 1304 | |
| 1305 | /*COOKIE MSB*/ |
| 1306 | pdev_id = *(msg_word + 2); |
| 1307 | |
| 1308 | /* stats message length + 16 size of HTT header*/ |
| 1309 | msg_remain_len = qdf_min(htt_stats->msg_len + 16, |
| 1310 | (uint32_t)DP_EXT_MSG_LENGTH); |
| 1311 | |
| 1312 | dp_wdi_event_handler(WDI_EVENT_HTT_STATS, soc, |
| 1313 | msg_word, msg_remain_len, |
| 1314 | WDI_NO_VAL, pdev_id); |
| 1315 | |
| 1316 | if (htt_stats->msg_len >= DP_EXT_MSG_LENGTH) { |
| 1317 | htt_stats->msg_len -= DP_EXT_MSG_LENGTH; |
| 1318 | } |
| 1319 | /* Need to be freed here as WDI handler will |
| 1320 | * make a copy of pkt to send data to application |
| 1321 | */ |
| 1322 | qdf_nbuf_free(htt_msg); |
| 1323 | return QDF_STATUS_SUCCESS; |
| 1324 | } |
| 1325 | #else |
| 1326 | static inline QDF_STATUS dp_send_htt_stat_resp(struct htt_stats_context *htt_stats, |
| 1327 | struct dp_soc *soc, qdf_nbuf_t htt_msg) |
| 1328 | { |
| 1329 | return QDF_STATUS_E_NOSUPPORT; |
| 1330 | } |
| 1331 | #endif |
| 1332 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1333 | /** |
| 1334 | * dp_process_htt_stat_msg(): Process the list of buffers of HTT EXT stats |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1335 | * @htt_stats: htt stats info |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1336 | * |
| 1337 | * The FW sends the HTT EXT STATS as a stream of T2H messages. Each T2H message |
| 1338 | * contains sub messages which are identified by a TLV header. |
| 1339 | * In this function we will process the stream of T2H messages and read all the |
| 1340 | * TLV contained in the message. |
| 1341 | * |
| 1342 | * THe following cases have been taken care of |
| 1343 | * Case 1: When the tlv_remain_length <= msg_remain_length of HTT MSG buffer |
| 1344 | * In this case the buffer will contain multiple tlvs. |
| 1345 | * Case 2: When the tlv_remain_length > msg_remain_length of HTT MSG buffer. |
| 1346 | * Only one tlv will be contained in the HTT message and this tag |
| 1347 | * will extend onto the next buffer. |
| 1348 | * Case 3: When the buffer is the continuation of the previous message |
| 1349 | * Case 4: tlv length is 0. which will indicate the end of message |
| 1350 | * |
| 1351 | * return: void |
| 1352 | */ |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 1353 | static inline void dp_process_htt_stat_msg(struct htt_stats_context *htt_stats, |
| 1354 | struct dp_soc *soc) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1355 | { |
| 1356 | htt_tlv_tag_t tlv_type = 0xff; |
| 1357 | qdf_nbuf_t htt_msg = NULL; |
| 1358 | uint32_t *msg_word; |
| 1359 | uint8_t *tlv_buf_head = NULL; |
| 1360 | uint8_t *tlv_buf_tail = NULL; |
| 1361 | uint32_t msg_remain_len = 0; |
| 1362 | uint32_t tlv_remain_len = 0; |
| 1363 | uint32_t *tlv_start; |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 1364 | int cookie_val; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1365 | |
| 1366 | /* Process node in the HTT message queue */ |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1367 | while ((htt_msg = qdf_nbuf_queue_remove(&htt_stats->msg)) |
| 1368 | != NULL) { |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1369 | msg_word = (uint32_t *) qdf_nbuf_data(htt_msg); |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 1370 | cookie_val = *(msg_word + 1); |
| 1371 | if (cookie_val) { |
| 1372 | if (dp_send_htt_stat_resp(htt_stats, soc, htt_msg) |
| 1373 | == QDF_STATUS_SUCCESS) { |
| 1374 | continue; |
| 1375 | } |
| 1376 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1377 | /* read 5th word */ |
| 1378 | msg_word = msg_word + 4; |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1379 | msg_remain_len = qdf_min(htt_stats->msg_len, |
| 1380 | (uint32_t) DP_EXT_MSG_LENGTH); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1381 | |
| 1382 | /* Keep processing the node till node length is 0 */ |
| 1383 | while (msg_remain_len) { |
| 1384 | /* |
| 1385 | * if message is not a continuation of previous message |
| 1386 | * read the tlv type and tlv length |
| 1387 | */ |
| 1388 | if (!tlv_buf_head) { |
| 1389 | tlv_type = HTT_STATS_TLV_TAG_GET( |
| 1390 | *msg_word); |
| 1391 | tlv_remain_len = HTT_STATS_TLV_LENGTH_GET( |
| 1392 | *msg_word); |
| 1393 | } |
| 1394 | |
| 1395 | if (tlv_remain_len == 0) { |
| 1396 | msg_remain_len = 0; |
| 1397 | |
| 1398 | if (tlv_buf_head) { |
| 1399 | qdf_mem_free(tlv_buf_head); |
| 1400 | tlv_buf_head = NULL; |
| 1401 | tlv_buf_tail = NULL; |
| 1402 | } |
| 1403 | |
| 1404 | goto error; |
| 1405 | } |
| 1406 | |
chenguo | 2649554 | 2017-12-14 21:56:46 +0800 | [diff] [blame^] | 1407 | if (!tlv_buf_head) |
| 1408 | tlv_remain_len += HTT_TLV_HDR_LEN; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1409 | |
| 1410 | if ((tlv_remain_len <= msg_remain_len)) { |
| 1411 | /* Case 3 */ |
| 1412 | if (tlv_buf_head) { |
| 1413 | qdf_mem_copy(tlv_buf_tail, |
| 1414 | (uint8_t *)msg_word, |
| 1415 | tlv_remain_len); |
| 1416 | tlv_start = (uint32_t *)tlv_buf_head; |
| 1417 | } else { |
| 1418 | /* Case 1 */ |
| 1419 | tlv_start = msg_word; |
| 1420 | } |
| 1421 | |
| 1422 | dp_htt_stats_print_tag(tlv_type, tlv_start); |
| 1423 | |
| 1424 | msg_remain_len -= tlv_remain_len; |
| 1425 | |
| 1426 | msg_word = (uint32_t *) |
| 1427 | (((uint8_t *)msg_word) + |
| 1428 | tlv_remain_len); |
| 1429 | |
| 1430 | tlv_remain_len = 0; |
| 1431 | |
| 1432 | if (tlv_buf_head) { |
| 1433 | qdf_mem_free(tlv_buf_head); |
| 1434 | tlv_buf_head = NULL; |
| 1435 | tlv_buf_tail = NULL; |
| 1436 | } |
| 1437 | |
| 1438 | } else { /* tlv_remain_len > msg_remain_len */ |
| 1439 | /* Case 2 & 3 */ |
| 1440 | if (!tlv_buf_head) { |
| 1441 | tlv_buf_head = qdf_mem_malloc( |
| 1442 | tlv_remain_len); |
| 1443 | |
| 1444 | if (!tlv_buf_head) { |
| 1445 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 1446 | QDF_TRACE_LEVEL_ERROR, |
| 1447 | "Alloc failed"); |
| 1448 | goto error; |
| 1449 | } |
| 1450 | |
| 1451 | tlv_buf_tail = tlv_buf_head; |
| 1452 | } |
| 1453 | |
| 1454 | qdf_mem_copy(tlv_buf_tail, (uint8_t *)msg_word, |
| 1455 | msg_remain_len); |
| 1456 | tlv_remain_len -= msg_remain_len; |
| 1457 | tlv_buf_tail += msg_remain_len; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1458 | } |
| 1459 | } |
| 1460 | |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1461 | if (htt_stats->msg_len >= DP_EXT_MSG_LENGTH) { |
| 1462 | htt_stats->msg_len -= DP_EXT_MSG_LENGTH; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1463 | } |
| 1464 | |
| 1465 | qdf_nbuf_free(htt_msg); |
| 1466 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1467 | return; |
| 1468 | |
| 1469 | error: |
| 1470 | qdf_nbuf_free(htt_msg); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1471 | while ((htt_msg = qdf_nbuf_queue_remove(&htt_stats->msg)) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1472 | != NULL) |
| 1473 | qdf_nbuf_free(htt_msg); |
| 1474 | } |
| 1475 | |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 1476 | void htt_t2h_stats_handler(void *context) |
| 1477 | { |
| 1478 | struct dp_soc *soc = (struct dp_soc *)context; |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1479 | struct htt_stats_context htt_stats; |
| 1480 | uint32_t length; |
| 1481 | uint32_t *msg_word; |
| 1482 | qdf_nbuf_t htt_msg = NULL; |
| 1483 | uint8_t done; |
| 1484 | uint8_t rem_stats; |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 1485 | |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1486 | if (!soc || !qdf_atomic_read(&soc->cmn_init_done)) { |
| 1487 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1488 | "soc: 0x%pK, init_done: %d", soc, |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1489 | qdf_atomic_read(&soc->cmn_init_done)); |
| 1490 | return; |
| 1491 | } |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 1492 | |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1493 | qdf_mem_zero(&htt_stats, sizeof(htt_stats)); |
| 1494 | qdf_nbuf_queue_init(&htt_stats.msg); |
| 1495 | |
| 1496 | /* pull one completed stats from soc->htt_stats_msg and process */ |
| 1497 | qdf_spin_lock_bh(&soc->htt_stats.lock); |
| 1498 | if (!soc->htt_stats.num_stats) { |
| 1499 | qdf_spin_unlock_bh(&soc->htt_stats.lock); |
| 1500 | return; |
| 1501 | } |
| 1502 | while ((htt_msg = qdf_nbuf_queue_remove(&soc->htt_stats.msg)) != NULL) { |
| 1503 | msg_word = (uint32_t *) qdf_nbuf_data(htt_msg); |
| 1504 | msg_word = msg_word + HTT_T2H_EXT_STATS_TLV_START_OFFSET; |
| 1505 | length = HTT_T2H_EXT_STATS_CONF_TLV_LENGTH_GET(*msg_word); |
| 1506 | done = HTT_T2H_EXT_STATS_CONF_TLV_DONE_GET(*msg_word); |
| 1507 | qdf_nbuf_queue_add(&htt_stats.msg, htt_msg); |
| 1508 | /* |
| 1509 | * HTT EXT stats response comes as stream of TLVs which span over |
| 1510 | * multiple T2H messages. |
| 1511 | * The first message will carry length of the response. |
| 1512 | * For rest of the messages length will be zero. |
| 1513 | */ |
| 1514 | if (length) |
| 1515 | htt_stats.msg_len = length; |
| 1516 | /* |
| 1517 | * Done bit signifies that this is the last T2H buffer in the |
| 1518 | * stream of HTT EXT STATS message |
| 1519 | */ |
| 1520 | if (done) |
| 1521 | break; |
| 1522 | } |
| 1523 | rem_stats = --soc->htt_stats.num_stats; |
| 1524 | qdf_spin_unlock_bh(&soc->htt_stats.lock); |
| 1525 | |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 1526 | dp_process_htt_stat_msg(&htt_stats, soc); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 1527 | /* If there are more stats to process, schedule stats work again */ |
| 1528 | if (rem_stats) |
| 1529 | qdf_sched_work(0, &soc->htt_stats.work); |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 1530 | } |
| 1531 | |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1532 | /* |
| 1533 | * dp_get_ppdu_info_user_index: Find place holder for the received |
| 1534 | * ppdu stats info |
| 1535 | * pdev: DP pdev handle |
| 1536 | * |
| 1537 | * return:user index to be populated |
| 1538 | */ |
| 1539 | #ifdef FEATURE_PERPKT_INFO |
| 1540 | static uint8_t dp_get_ppdu_info_user_index(struct dp_pdev *pdev, |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1541 | uint16_t peer_id) |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1542 | { |
| 1543 | uint8_t user_index = 0; |
| 1544 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1545 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 1546 | |
| 1547 | ppdu_desc = |
| 1548 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1549 | |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1550 | while ((user_index + 1) <= pdev->tx_ppdu_info.last_user) { |
| 1551 | ppdu_user_desc = &ppdu_desc->user[user_index]; |
| 1552 | if (ppdu_user_desc->peer_id != peer_id) { |
| 1553 | user_index++; |
| 1554 | continue; |
| 1555 | } else { |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1556 | /* Max users possible is 8 so user array index should |
| 1557 | * not exceed 7 |
| 1558 | */ |
| 1559 | qdf_assert_always(user_index <= CDP_MU_MAX_USER_INDEX); |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1560 | return user_index; |
| 1561 | } |
| 1562 | } |
| 1563 | |
| 1564 | pdev->tx_ppdu_info.last_user++; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1565 | /* Max users possible is 8 so last user should not exceed 8 */ |
| 1566 | qdf_assert_always(pdev->tx_ppdu_info.last_user <= CDP_MU_MAX_USERS); |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1567 | return pdev->tx_ppdu_info.last_user - 1; |
| 1568 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1569 | |
| 1570 | /* |
| 1571 | * dp_process_ppdu_stats_common_tlv: Process htt_ppdu_stats_common_tlv |
| 1572 | * pdev: DP pdev handle |
| 1573 | * @tag_buf: buffer containing the tlv htt_ppdu_stats_common_tlv |
| 1574 | * |
| 1575 | * return:void |
| 1576 | */ |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1577 | static void dp_process_ppdu_stats_common_tlv(struct dp_pdev *pdev, |
| 1578 | uint32_t *tag_buf) |
| 1579 | { |
Pamidipati, Vijay | d7eb83e | 2017-09-20 21:19:56 +0530 | [diff] [blame] | 1580 | uint16_t frame_type; |
Venkateswara Swamy Bandaru | 2907bc5 | 2017-11-15 19:04:49 +0530 | [diff] [blame] | 1581 | uint16_t freq; |
| 1582 | struct dp_soc *soc = NULL; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1583 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1584 | htt_ppdu_stats_common_tlv *dp_stats_buf = |
| 1585 | (htt_ppdu_stats_common_tlv *)tag_buf; |
| 1586 | |
| 1587 | ppdu_desc = |
| 1588 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1589 | |
| 1590 | ppdu_desc->ppdu_id = dp_stats_buf->ppdu_id; |
| 1591 | tag_buf += 2; |
| 1592 | ppdu_desc->num_users = |
| 1593 | HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_GET(*tag_buf); |
| 1594 | tag_buf++; |
Pamidipati, Vijay | d7eb83e | 2017-09-20 21:19:56 +0530 | [diff] [blame] | 1595 | frame_type = HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_GET(*tag_buf); |
| 1596 | |
| 1597 | if ((frame_type == HTT_STATS_FTYPE_TIDQ_DATA_SU) || |
| 1598 | (frame_type == HTT_STATS_FTYPE_TIDQ_DATA_MU)) |
| 1599 | ppdu_desc->frame_type = CDP_PPDU_FTYPE_DATA; |
| 1600 | else |
| 1601 | ppdu_desc->frame_type = CDP_PPDU_FTYPE_CTRL; |
| 1602 | |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 1603 | tag_buf += 2; |
| 1604 | ppdu_desc->tx_duration = *tag_buf; |
| 1605 | tag_buf += 3; |
| 1606 | ppdu_desc->ppdu_start_timestamp = *tag_buf; |
| 1607 | ppdu_desc->ppdu_end_timestamp = 0; /*TODO: value to be provided by FW */ |
| 1608 | tag_buf++; |
| 1609 | |
Venkateswara Swamy Bandaru | 2907bc5 | 2017-11-15 19:04:49 +0530 | [diff] [blame] | 1610 | freq = HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_GET(*tag_buf); |
| 1611 | if (freq != ppdu_desc->channel) { |
| 1612 | soc = pdev->soc; |
| 1613 | ppdu_desc->channel = freq; |
| 1614 | if (soc && soc->cdp_soc.ol_ops->freq_to_channel) |
| 1615 | pdev->operating_channel = |
| 1616 | soc->cdp_soc.ol_ops->freq_to_channel(pdev->osif_pdev, freq); |
| 1617 | } |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 1618 | |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1619 | ppdu_desc->phy_mode = HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_GET(*tag_buf); |
| 1620 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1621 | |
| 1622 | /* |
| 1623 | * dp_process_ppdu_stats_user_common_tlv: Process ppdu_stats_user_common |
| 1624 | * @tag_buf: buffer containing the tlv htt_ppdu_stats_user_common_tlv |
| 1625 | * |
| 1626 | * return:void |
| 1627 | */ |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1628 | static void dp_process_ppdu_stats_user_common_tlv( |
| 1629 | struct dp_pdev *pdev, uint32_t *tag_buf) |
| 1630 | { |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1631 | uint16_t peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1632 | struct dp_peer *peer; |
| 1633 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1634 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 1635 | uint8_t curr_user_index = 0; |
| 1636 | |
| 1637 | ppdu_desc = |
| 1638 | (struct cdp_tx_completion_ppdu *) qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1639 | |
| 1640 | tag_buf++; |
| 1641 | peer_id = HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_GET(*tag_buf); |
| 1642 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 1643 | |
| 1644 | if (!peer) |
| 1645 | return; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1646 | |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1647 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 1648 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
| 1649 | |
| 1650 | ppdu_user_desc->peer_id = peer_id; |
| 1651 | |
| 1652 | tag_buf++; |
| 1653 | |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 1654 | if (HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_GET(*tag_buf)) { |
| 1655 | ppdu_user_desc->is_mcast = true; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1656 | ppdu_user_desc->mpdu_tried_mcast = |
| 1657 | HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_GET(*tag_buf); |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 1658 | } else { |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1659 | ppdu_user_desc->mpdu_tried_ucast = |
| 1660 | HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_GET(*tag_buf); |
Soumya Bhat | 606fb39 | 2017-10-27 12:42:45 +0530 | [diff] [blame] | 1661 | } |
| 1662 | |
| 1663 | tag_buf++; |
| 1664 | |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1665 | ppdu_user_desc->qos_ctrl = |
| 1666 | HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_GET(*tag_buf); |
| 1667 | ppdu_user_desc->frame_ctrl = |
| 1668 | HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_GET(*tag_buf); |
| 1669 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1670 | |
| 1671 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 1672 | /** |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 1673 | * dp_process_ppdu_stats_user_rate_tlv() - Process htt_ppdu_stats_user_rate_tlv |
| 1674 | * @pdev: DP pdev handle |
| 1675 | * @tag_buf: T2H message buffer carrying the user rate TLV |
| 1676 | * |
| 1677 | * return:void |
| 1678 | */ |
| 1679 | static void dp_process_ppdu_stats_user_rate_tlv(struct dp_pdev *pdev, |
| 1680 | uint32_t *tag_buf) |
| 1681 | { |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1682 | uint16_t peer_id; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 1683 | struct dp_peer *peer; |
| 1684 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1685 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1686 | uint8_t curr_user_index = 0; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 1687 | |
| 1688 | ppdu_desc = |
| 1689 | (struct cdp_tx_completion_ppdu *) qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1690 | |
| 1691 | tag_buf++; |
| 1692 | peer_id = HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_GET(*tag_buf); |
| 1693 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 1694 | |
| 1695 | if (!peer) |
| 1696 | return; |
| 1697 | |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1698 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 1699 | |
| 1700 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
| 1701 | ppdu_user_desc->peer_id = peer_id; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 1702 | |
| 1703 | ppdu_user_desc->tid = |
| 1704 | HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_GET(*tag_buf); |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 1705 | |
| 1706 | qdf_mem_copy(ppdu_user_desc->mac_addr, peer->mac_addr.raw, |
| 1707 | DP_MAC_ADDR_LEN); |
| 1708 | |
Soumya Bhat | 2854111 | 2017-11-22 16:58:29 +0530 | [diff] [blame] | 1709 | tag_buf += 2; |
| 1710 | |
| 1711 | ppdu_user_desc->ru_tones = (HTT_PPDU_STATS_USER_RATE_TLV_RU_END_GET(*tag_buf) - |
| 1712 | HTT_PPDU_STATS_USER_RATE_TLV_RU_START_GET(*tag_buf)) + 1; |
| 1713 | |
| 1714 | tag_buf += 2; |
Soumya Bhat | 606fb39 | 2017-10-27 12:42:45 +0530 | [diff] [blame] | 1715 | |
| 1716 | ppdu_user_desc->ppdu_type = |
| 1717 | HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_GET(*tag_buf); |
| 1718 | |
| 1719 | tag_buf++; |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 1720 | ppdu_user_desc->tx_rate = *tag_buf; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 1721 | |
| 1722 | ppdu_user_desc->ltf_size = |
| 1723 | HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_GET(*tag_buf); |
| 1724 | ppdu_user_desc->stbc = |
| 1725 | HTT_PPDU_STATS_USER_RATE_TLV_STBC_GET(*tag_buf); |
| 1726 | ppdu_user_desc->he_re = |
| 1727 | HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_GET(*tag_buf); |
| 1728 | ppdu_user_desc->txbf = |
| 1729 | HTT_PPDU_STATS_USER_RATE_TLV_TXBF_GET(*tag_buf); |
| 1730 | ppdu_user_desc->bw = |
| 1731 | HTT_PPDU_STATS_USER_RATE_TLV_BW_GET(*tag_buf); |
| 1732 | ppdu_user_desc->nss = HTT_PPDU_STATS_USER_RATE_TLV_NSS_GET(*tag_buf); |
| 1733 | ppdu_user_desc->mcs = HTT_PPDU_STATS_USER_RATE_TLV_MCS_GET(*tag_buf); |
| 1734 | ppdu_user_desc->preamble = |
| 1735 | HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_GET(*tag_buf); |
| 1736 | ppdu_user_desc->gi = HTT_PPDU_STATS_USER_RATE_TLV_GI_GET(*tag_buf); |
| 1737 | ppdu_user_desc->dcm = HTT_PPDU_STATS_USER_RATE_TLV_DCM_GET(*tag_buf); |
| 1738 | ppdu_user_desc->ldpc = HTT_PPDU_STATS_USER_RATE_TLV_LDPC_GET(*tag_buf); |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 1739 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1740 | |
| 1741 | /* |
| 1742 | * dp_process_ppdu_stats_enq_mpdu_bitmap_64_tlv: Process |
| 1743 | * htt_ppdu_stats_enq_mpdu_bitmap_64_tlv |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 1744 | * pdev: DP PDEV handle |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1745 | * @tag_buf: buffer containing the tlv htt_ppdu_stats_enq_mpdu_bitmap_64_tlv |
| 1746 | * |
| 1747 | * return:void |
| 1748 | */ |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1749 | static void dp_process_ppdu_stats_enq_mpdu_bitmap_64_tlv( |
| 1750 | struct dp_pdev *pdev, uint32_t *tag_buf) |
| 1751 | { |
| 1752 | htt_ppdu_stats_enq_mpdu_bitmap_64_tlv *dp_stats_buf = |
| 1753 | (htt_ppdu_stats_enq_mpdu_bitmap_64_tlv *)tag_buf; |
| 1754 | |
| 1755 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1756 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 1757 | uint8_t curr_user_index = 0; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1758 | uint16_t peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1759 | struct dp_peer *peer; |
| 1760 | |
| 1761 | ppdu_desc = |
| 1762 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1763 | |
| 1764 | tag_buf++; |
| 1765 | |
| 1766 | peer_id = |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1767 | HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_GET(*tag_buf); |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1768 | |
| 1769 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 1770 | |
| 1771 | if (!peer) |
| 1772 | return; |
| 1773 | |
| 1774 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 1775 | |
| 1776 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1777 | ppdu_user_desc->peer_id = peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1778 | |
| 1779 | ppdu_user_desc->start_seq = dp_stats_buf->start_seq; |
| 1780 | qdf_mem_copy(&ppdu_user_desc->enq_bitmap, &dp_stats_buf->enq_bitmap, |
| 1781 | CDP_BA_64_BIT_MAP_SIZE_DWORDS); |
| 1782 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1783 | |
| 1784 | /* |
| 1785 | * dp_process_ppdu_stats_enq_mpdu_bitmap_256_tlv: Process |
| 1786 | * htt_ppdu_stats_enq_mpdu_bitmap_256_tlv |
| 1787 | * soc: DP SOC handle |
| 1788 | * @tag_buf: buffer containing the tlv htt_ppdu_stats_enq_mpdu_bitmap_256_tlv |
| 1789 | * |
| 1790 | * return:void |
| 1791 | */ |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1792 | static void dp_process_ppdu_stats_enq_mpdu_bitmap_256_tlv( |
| 1793 | struct dp_pdev *pdev, uint32_t *tag_buf) |
| 1794 | { |
| 1795 | htt_ppdu_stats_enq_mpdu_bitmap_256_tlv *dp_stats_buf = |
| 1796 | (htt_ppdu_stats_enq_mpdu_bitmap_256_tlv *)tag_buf; |
| 1797 | |
| 1798 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1799 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 1800 | uint8_t curr_user_index = 0; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1801 | uint16_t peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1802 | struct dp_peer *peer; |
| 1803 | |
| 1804 | ppdu_desc = |
| 1805 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1806 | |
| 1807 | tag_buf++; |
| 1808 | |
| 1809 | peer_id = |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1810 | HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_GET(*tag_buf); |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1811 | |
| 1812 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 1813 | |
| 1814 | if (!peer) |
| 1815 | return; |
| 1816 | |
| 1817 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 1818 | |
| 1819 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1820 | ppdu_user_desc->peer_id = peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1821 | |
| 1822 | ppdu_user_desc->start_seq = dp_stats_buf->start_seq; |
| 1823 | qdf_mem_copy(&ppdu_user_desc->enq_bitmap, &dp_stats_buf->enq_bitmap, |
| 1824 | CDP_BA_256_BIT_MAP_SIZE_DWORDS); |
| 1825 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1826 | |
| 1827 | /* |
| 1828 | * dp_process_ppdu_stats_user_cmpltn_common_tlv: Process |
| 1829 | * htt_ppdu_stats_user_cmpltn_common_tlv |
| 1830 | * soc: DP SOC handle |
| 1831 | * @tag_buf: buffer containing the tlv htt_ppdu_stats_user_cmpltn_common_tlv |
| 1832 | * |
| 1833 | * return:void |
| 1834 | */ |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1835 | static void dp_process_ppdu_stats_user_cmpltn_common_tlv( |
| 1836 | struct dp_pdev *pdev, uint32_t *tag_buf) |
| 1837 | { |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1838 | uint16_t peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1839 | struct dp_peer *peer; |
| 1840 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1841 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 1842 | uint8_t curr_user_index = 0; |
| 1843 | htt_ppdu_stats_user_cmpltn_common_tlv *dp_stats_buf = |
| 1844 | (htt_ppdu_stats_user_cmpltn_common_tlv *)tag_buf; |
| 1845 | |
| 1846 | ppdu_desc = |
| 1847 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1848 | |
| 1849 | tag_buf++; |
| 1850 | peer_id = |
| 1851 | HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_GET(*tag_buf); |
| 1852 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 1853 | |
| 1854 | if (!peer) |
| 1855 | return; |
| 1856 | |
| 1857 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 1858 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
| 1859 | ppdu_user_desc->peer_id = peer_id; |
| 1860 | |
| 1861 | ppdu_user_desc->completion_status = |
| 1862 | HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_GET( |
| 1863 | *tag_buf); |
| 1864 | |
| 1865 | ppdu_user_desc->tid = |
| 1866 | HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_GET(*tag_buf); |
| 1867 | |
| 1868 | |
| 1869 | tag_buf++; |
| 1870 | ppdu_desc->ack_rssi = dp_stats_buf->ack_rssi; |
| 1871 | |
| 1872 | tag_buf++; |
| 1873 | |
| 1874 | ppdu_user_desc->mpdu_success = |
| 1875 | HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_GET(*tag_buf); |
| 1876 | |
| 1877 | tag_buf++; |
| 1878 | |
| 1879 | ppdu_user_desc->long_retries = |
| 1880 | HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_GET(*tag_buf); |
| 1881 | |
| 1882 | ppdu_user_desc->short_retries = |
| 1883 | HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_GET(*tag_buf); |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 1884 | ppdu_user_desc->retry_msdus = |
| 1885 | ppdu_user_desc->long_retries + ppdu_user_desc->short_retries; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1886 | |
| 1887 | ppdu_user_desc->is_ampdu = |
| 1888 | HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_GET(*tag_buf); |
| 1889 | |
| 1890 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1891 | |
| 1892 | /* |
| 1893 | * dp_process_ppdu_stats_user_compltn_ba_bitmap_64_tlv: Process |
| 1894 | * htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 1895 | * pdev: DP PDEV handle |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1896 | * @tag_buf: buffer containing the htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv |
| 1897 | * |
| 1898 | * return:void |
| 1899 | */ |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1900 | static void dp_process_ppdu_stats_user_compltn_ba_bitmap_64_tlv( |
| 1901 | struct dp_pdev *pdev, uint32_t *tag_buf) |
| 1902 | { |
| 1903 | htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv *dp_stats_buf = |
| 1904 | (htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv *)tag_buf; |
| 1905 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 1906 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1907 | uint8_t curr_user_index = 0; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1908 | uint16_t peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1909 | struct dp_peer *peer; |
| 1910 | |
| 1911 | ppdu_desc = |
| 1912 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1913 | |
| 1914 | tag_buf++; |
| 1915 | |
| 1916 | peer_id = |
| 1917 | HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_GET(*tag_buf); |
| 1918 | |
| 1919 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 1920 | |
| 1921 | if (!peer) |
| 1922 | return; |
| 1923 | |
| 1924 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 1925 | |
| 1926 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1927 | ppdu_user_desc->peer_id = peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1928 | |
| 1929 | ppdu_user_desc->ba_seq_no = dp_stats_buf->ba_seq_no; |
| 1930 | qdf_mem_copy(&ppdu_user_desc->ba_bitmap, &dp_stats_buf->ba_bitmap, |
| 1931 | CDP_BA_64_BIT_MAP_SIZE_DWORDS); |
| 1932 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1933 | |
| 1934 | /* |
| 1935 | * dp_process_ppdu_stats_user_compltn_ba_bitmap_256_tlv: Process |
| 1936 | * htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 1937 | * pdev: DP PDEV handle |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1938 | * @tag_buf: buffer containing the htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv |
| 1939 | * |
| 1940 | * return:void |
| 1941 | */ |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1942 | static void dp_process_ppdu_stats_user_compltn_ba_bitmap_256_tlv( |
| 1943 | struct dp_pdev *pdev, uint32_t *tag_buf) |
| 1944 | { |
| 1945 | htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv *dp_stats_buf = |
| 1946 | (htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv *)tag_buf; |
| 1947 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 1948 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1949 | uint8_t curr_user_index = 0; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1950 | uint16_t peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1951 | struct dp_peer *peer; |
| 1952 | |
| 1953 | ppdu_desc = |
| 1954 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1955 | |
| 1956 | tag_buf++; |
| 1957 | |
| 1958 | peer_id = |
| 1959 | HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_GET(*tag_buf); |
| 1960 | |
| 1961 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 1962 | |
| 1963 | if (!peer) |
| 1964 | return; |
| 1965 | |
| 1966 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 1967 | |
| 1968 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1969 | ppdu_user_desc->peer_id = peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1970 | |
| 1971 | ppdu_user_desc->ba_seq_no = dp_stats_buf->ba_seq_no; |
| 1972 | qdf_mem_copy(&ppdu_user_desc->ba_bitmap, &dp_stats_buf->ba_bitmap, |
| 1973 | CDP_BA_256_BIT_MAP_SIZE_DWORDS); |
| 1974 | } |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1975 | |
| 1976 | /* |
| 1977 | * dp_process_ppdu_stats_user_compltn_ack_ba_status_tlv: Process |
| 1978 | * htt_ppdu_stats_user_compltn_ack_ba_status_tlv |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 1979 | * pdev: DP PDE handle |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1980 | * @tag_buf: buffer containing the htt_ppdu_stats_user_compltn_ack_ba_status_tlv |
| 1981 | * |
| 1982 | * return:void |
| 1983 | */ |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1984 | static void dp_process_ppdu_stats_user_compltn_ack_ba_status_tlv( |
| 1985 | struct dp_pdev *pdev, uint32_t *tag_buf) |
| 1986 | { |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 1987 | uint16_t peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 1988 | struct dp_peer *peer; |
| 1989 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 1990 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 1991 | uint8_t curr_user_index = 0; |
| 1992 | |
| 1993 | ppdu_desc = |
| 1994 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 1995 | |
| 1996 | tag_buf += 2; |
| 1997 | peer_id = |
| 1998 | HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_GET(*tag_buf); |
| 1999 | |
| 2000 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 2001 | |
| 2002 | if (!peer) |
| 2003 | return; |
| 2004 | |
| 2005 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 2006 | |
| 2007 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
Soumya Bhat | 835033e | 2017-10-04 22:21:46 +0530 | [diff] [blame] | 2008 | ppdu_user_desc->peer_id = peer_id; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 2009 | |
Soumya Bhat | 606fb39 | 2017-10-27 12:42:45 +0530 | [diff] [blame] | 2010 | tag_buf++; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 2011 | ppdu_user_desc->num_mpdu = |
| 2012 | HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_GET(*tag_buf); |
| 2013 | |
| 2014 | ppdu_user_desc->num_msdu = |
| 2015 | HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_GET(*tag_buf); |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 2016 | |
| 2017 | ppdu_user_desc->success_msdus = ppdu_user_desc->num_msdu; |
| 2018 | |
| 2019 | tag_buf += 2; |
| 2020 | ppdu_user_desc->success_bytes = *tag_buf; |
| 2021 | |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 2022 | } |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2023 | |
| 2024 | /* |
| 2025 | * dp_process_ppdu_stats_user_common_array_tlv: Process |
| 2026 | * htt_ppdu_stats_user_common_array_tlv |
| 2027 | * pdev: DP PDEV handle |
| 2028 | * @tag_buf: buffer containing the htt_ppdu_stats_user_compltn_ack_ba_status_tlv |
| 2029 | * |
| 2030 | * return:void |
| 2031 | */ |
| 2032 | static void dp_process_ppdu_stats_user_common_array_tlv(struct dp_pdev *pdev, |
| 2033 | uint32_t *tag_buf) |
| 2034 | { |
| 2035 | uint32_t peer_id; |
| 2036 | struct dp_peer *peer; |
| 2037 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 2038 | struct cdp_tx_completion_ppdu_user *ppdu_user_desc; |
| 2039 | uint8_t curr_user_index = 0; |
| 2040 | struct htt_tx_ppdu_stats_info *dp_stats_buf; |
| 2041 | |
| 2042 | ppdu_desc = |
| 2043 | (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 2044 | |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 2045 | tag_buf++; |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2046 | dp_stats_buf = (struct htt_tx_ppdu_stats_info *)tag_buf; |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 2047 | tag_buf += 3; |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2048 | peer_id = |
| 2049 | HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_GET(*tag_buf); |
| 2050 | |
| 2051 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 2052 | |
| 2053 | if (!peer) { |
| 2054 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2055 | "Invalid peer"); |
| 2056 | return; |
| 2057 | } |
| 2058 | |
| 2059 | curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id); |
| 2060 | |
| 2061 | ppdu_user_desc = &ppdu_desc->user[curr_user_index]; |
| 2062 | |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2063 | ppdu_user_desc->retry_bytes = dp_stats_buf->tx_retry_bytes; |
| 2064 | ppdu_user_desc->failed_bytes = dp_stats_buf->tx_failed_bytes; |
| 2065 | |
| 2066 | tag_buf++; |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 2067 | |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2068 | ppdu_user_desc->success_msdus = |
| 2069 | HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_GET(*tag_buf); |
| 2070 | ppdu_user_desc->retry_bytes = |
| 2071 | HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_GET(*tag_buf); |
| 2072 | tag_buf++; |
| 2073 | ppdu_user_desc->failed_msdus = |
| 2074 | HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_GET(*tag_buf); |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 2075 | } |
| 2076 | |
| 2077 | /* |
| 2078 | * dp_process_ppdu_stats_flush_tlv: Process |
| 2079 | * htt_ppdu_stats_flush_tlv |
| 2080 | * @pdev: DP PDEV handle |
| 2081 | * @tag_buf: buffer containing the htt_ppdu_stats_flush_tlv |
| 2082 | * |
| 2083 | * return:void |
| 2084 | */ |
| 2085 | static void dp_process_ppdu_stats_user_compltn_flush_tlv(struct dp_pdev *pdev, |
| 2086 | uint32_t *tag_buf) |
| 2087 | { |
| 2088 | uint32_t peer_id; |
| 2089 | uint32_t drop_reason; |
| 2090 | uint8_t tid; |
| 2091 | uint32_t num_msdu; |
| 2092 | struct dp_peer *peer; |
| 2093 | |
| 2094 | tag_buf++; |
| 2095 | drop_reason = *tag_buf; |
| 2096 | |
| 2097 | tag_buf++; |
| 2098 | num_msdu = HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_GET(*tag_buf); |
| 2099 | |
| 2100 | tag_buf++; |
| 2101 | peer_id = |
| 2102 | HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_GET(*tag_buf); |
| 2103 | |
| 2104 | peer = dp_peer_find_by_id(pdev->soc, peer_id); |
| 2105 | if (!peer) |
| 2106 | return; |
| 2107 | |
| 2108 | tid = HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_GET(*tag_buf); |
| 2109 | |
| 2110 | if (drop_reason == HTT_FLUSH_EXCESS_RETRIES) { |
| 2111 | DP_STATS_INC(peer, tx.excess_retries[TID_TO_WME_AC(tid)], |
| 2112 | num_msdu); |
| 2113 | } |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2114 | } |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2115 | |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 2116 | /* |
| 2117 | * dp_process_ppdu_stats_tx_mgmtctrl_payload_tlv: Process |
| 2118 | * htt_ppdu_stats_tx_mgmtctrl_payload_tlv |
| 2119 | * @pdev: DP PDEV handle |
| 2120 | * @tag_buf: buffer containing the htt_ppdu_stats_tx_mgmtctrl_payload_tlv |
| 2121 | * @length: tlv_length |
| 2122 | * |
| 2123 | * return:void |
| 2124 | */ |
| 2125 | static void dp_process_ppdu_stats_tx_mgmtctrl_payload_tlv( |
| 2126 | struct dp_pdev *pdev, uint32_t *tag_buf, uint32_t length) |
| 2127 | { |
| 2128 | htt_ppdu_stats_tx_mgmtctrl_payload_tlv *dp_stats_buf = |
| 2129 | (htt_ppdu_stats_tx_mgmtctrl_payload_tlv *)tag_buf; |
| 2130 | |
| 2131 | qdf_nbuf_t nbuf = NULL; |
| 2132 | |
| 2133 | uint32_t payload_size = length - HTT_MGMT_CTRL_TLV_RESERVERD_LEN; |
| 2134 | |
| 2135 | nbuf = qdf_nbuf_alloc(pdev->soc->osdev, payload_size, 0, 4, true); |
| 2136 | |
| 2137 | if (!nbuf) { |
| 2138 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2139 | "Nbuf Allocation failed for Mgmt. payload"); |
| 2140 | qdf_assert(0); |
| 2141 | return; |
| 2142 | } |
| 2143 | |
| 2144 | qdf_nbuf_put_tail(nbuf, payload_size); |
| 2145 | qdf_mem_copy(qdf_nbuf_data(nbuf), dp_stats_buf->payload, payload_size); |
| 2146 | |
| 2147 | dp_wdi_event_handler(WDI_EVENT_TX_MGMT_CTRL, pdev->soc, |
| 2148 | nbuf, HTT_INVALID_PEER, |
| 2149 | WDI_NO_VAL, pdev->pdev_id); |
| 2150 | } |
| 2151 | |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2152 | /** |
| 2153 | * dp_process_ppdu_tag(): Function to process the PPDU TLVs |
| 2154 | * @soc: DP Physical device (radio) handle |
| 2155 | * @tag_buf: TLV buffer |
| 2156 | * |
| 2157 | * return: void |
| 2158 | */ |
| 2159 | static void dp_process_ppdu_tag(struct dp_pdev *pdev, uint32_t *tag_buf, |
| 2160 | uint32_t tlv_len) |
| 2161 | { |
| 2162 | uint32_t tlv_type = HTT_STATS_TLV_TAG_GET(*tag_buf); |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2163 | switch (tlv_type) { |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 2164 | case HTT_PPDU_STATS_COMMON_TLV: |
| 2165 | dp_process_ppdu_stats_common_tlv(pdev, tag_buf); |
| 2166 | break; |
| 2167 | case HTT_PPDU_STATS_USR_COMMON_TLV: |
| 2168 | dp_process_ppdu_stats_user_common_tlv(pdev, tag_buf); |
| 2169 | break; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2170 | case HTT_PPDU_STATS_USR_RATE_TLV: |
| 2171 | qdf_assert_always(tlv_len == |
| 2172 | sizeof(htt_ppdu_stats_user_rate_tlv)); |
| 2173 | dp_process_ppdu_stats_user_rate_tlv(pdev, tag_buf); |
| 2174 | break; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 2175 | case HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_64_TLV: |
| 2176 | dp_process_ppdu_stats_enq_mpdu_bitmap_64_tlv(pdev, tag_buf); |
| 2177 | break; |
| 2178 | case HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_256_TLV: |
| 2179 | dp_process_ppdu_stats_enq_mpdu_bitmap_256_tlv(pdev, tag_buf); |
| 2180 | break; |
| 2181 | case HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV: |
| 2182 | dp_process_ppdu_stats_user_cmpltn_common_tlv(pdev, tag_buf); |
| 2183 | break; |
| 2184 | case HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_64_TLV: |
| 2185 | dp_process_ppdu_stats_user_compltn_ba_bitmap_64_tlv(pdev, |
| 2186 | tag_buf); |
| 2187 | break; |
| 2188 | case HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV: |
| 2189 | dp_process_ppdu_stats_user_compltn_ba_bitmap_256_tlv(pdev, |
| 2190 | tag_buf); |
| 2191 | break; |
| 2192 | case HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV: |
| 2193 | dp_process_ppdu_stats_user_compltn_ack_ba_status_tlv(pdev, |
| 2194 | tag_buf); |
| 2195 | break; |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2196 | case HTT_PPDU_STATS_USR_COMMON_ARRAY_TLV: |
| 2197 | dp_process_ppdu_stats_user_common_array_tlv(pdev, |
| 2198 | tag_buf); |
| 2199 | break; |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 2200 | case HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV: |
| 2201 | dp_process_ppdu_stats_user_compltn_flush_tlv(pdev, |
| 2202 | tag_buf); |
| 2203 | break; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 2204 | case HTT_PPDU_STATS_TX_MGMTCTRL_PAYLOAD_TLV: |
| 2205 | dp_process_ppdu_stats_tx_mgmtctrl_payload_tlv(pdev, |
| 2206 | tag_buf, tlv_len); |
| 2207 | break; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2208 | default: |
| 2209 | break; |
| 2210 | } |
| 2211 | } |
| 2212 | |
| 2213 | static QDF_STATUS dp_htt_process_tlv(struct dp_pdev *pdev, |
| 2214 | qdf_nbuf_t htt_t2h_msg) |
| 2215 | { |
| 2216 | uint32_t length; |
| 2217 | uint32_t ppdu_id; |
| 2218 | uint8_t tlv_type; |
| 2219 | uint32_t tlv_length; |
| 2220 | uint8_t *tlv_buf; |
| 2221 | QDF_STATUS status = QDF_STATUS_E_PENDING; |
| 2222 | |
| 2223 | uint32_t *msg_word = (uint32_t *) qdf_nbuf_data(htt_t2h_msg); |
| 2224 | |
| 2225 | length = HTT_T2H_PPDU_STATS_PAYLOAD_SIZE_GET(*msg_word); |
| 2226 | |
| 2227 | msg_word = msg_word + 1; |
| 2228 | ppdu_id = HTT_T2H_PPDU_STATS_PPDU_ID_GET(*msg_word); |
| 2229 | |
| 2230 | msg_word = msg_word + 3; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2231 | while (length > 0) { |
| 2232 | tlv_buf = (uint8_t *)msg_word; |
| 2233 | tlv_type = HTT_STATS_TLV_TAG_GET(*msg_word); |
| 2234 | tlv_length = HTT_STATS_TLV_LENGTH_GET(*msg_word); |
| 2235 | |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2236 | if (tlv_length == 0) |
| 2237 | break; |
| 2238 | |
| 2239 | if (tlv_type == HTT_PPDU_STATS_SCH_CMD_STATUS_TLV) |
| 2240 | status = QDF_STATUS_SUCCESS; |
| 2241 | |
| 2242 | tlv_length += HTT_TLV_HDR_LEN; |
| 2243 | dp_process_ppdu_tag(pdev, msg_word, tlv_length); |
| 2244 | |
Pranita Solanke | a12b4b3 | 2017-11-20 23:04:14 +0530 | [diff] [blame] | 2245 | |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2246 | msg_word = (uint32_t *)((uint8_t *)tlv_buf + tlv_length); |
| 2247 | length -= (tlv_length); |
| 2248 | } |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2249 | return status; |
| 2250 | } |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2251 | #endif /* FEATURE_PERPKT_INFO */ |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2252 | |
| 2253 | /** |
| 2254 | * dp_txrx_ppdu_stats_handler() - Function to process HTT PPDU stats from FW |
| 2255 | * @soc: DP SOC handle |
| 2256 | * @pdev_id: pdev id |
| 2257 | * @htt_t2h_msg: HTT message nbuf |
| 2258 | * |
| 2259 | * return:void |
| 2260 | */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2261 | #if defined(WDI_EVENT_ENABLE) |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2262 | #ifdef FEATURE_PERPKT_INFO |
| 2263 | static void dp_txrx_ppdu_stats_handler(struct dp_soc *soc, |
| 2264 | uint8_t pdev_id, qdf_nbuf_t htt_t2h_msg) |
| 2265 | { |
| 2266 | struct dp_pdev *pdev = soc->pdev_list[pdev_id]; |
| 2267 | struct dp_vdev *vdev; |
| 2268 | struct dp_peer *peer; |
| 2269 | struct cdp_tx_completion_ppdu *ppdu_desc; |
| 2270 | int status; |
| 2271 | int i; |
| 2272 | |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 2273 | if (!pdev->enhanced_stats_en && !pdev->tx_sniffer_enable && |
| 2274 | !pdev->am_copy_mode) |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2275 | return; |
| 2276 | |
| 2277 | if (!pdev->tx_ppdu_info.buf) { |
| 2278 | /* |
| 2279 | * Todo: For MU/OFDMA, we need to account for multiple user |
| 2280 | * descriptors in a PPDU, in skb size. |
| 2281 | * The allocation has to be moved to ppdu_cmn tlv processing |
| 2282 | */ |
| 2283 | pdev->tx_ppdu_info.buf = qdf_nbuf_alloc(soc->osdev, |
| 2284 | sizeof(struct cdp_tx_completion_ppdu), 0, 4, |
| 2285 | TRUE); |
| 2286 | |
| 2287 | if (!pdev->tx_ppdu_info.buf) { |
| 2288 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2289 | "Nbuf Allocation failed for HTT PPDU"); |
| 2290 | return; |
| 2291 | } |
| 2292 | |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2293 | qdf_mem_zero(qdf_nbuf_data(pdev->tx_ppdu_info.buf), |
| 2294 | sizeof(struct cdp_tx_completion_ppdu)); |
| 2295 | |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2296 | if (qdf_nbuf_put_tail(pdev->tx_ppdu_info.buf, |
| 2297 | sizeof(struct cdp_tx_completion_ppdu)) == NULL) { |
| 2298 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2299 | "No tailroom for HTT PPDU"); |
| 2300 | return; |
| 2301 | } |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2302 | |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2303 | } |
| 2304 | |
| 2305 | status = dp_htt_process_tlv(pdev, htt_t2h_msg); |
| 2306 | |
| 2307 | if (status == QDF_STATUS_SUCCESS) { |
| 2308 | ppdu_desc = (struct cdp_tx_completion_ppdu *) |
| 2309 | qdf_nbuf_data(pdev->tx_ppdu_info.buf); |
| 2310 | |
| 2311 | vdev = dp_get_vdev_from_soc_vdev_id_wifi3(soc, |
| 2312 | ppdu_desc->vdev_id); |
| 2313 | |
| 2314 | for (i = 0; i < ppdu_desc->num_users; i++) { |
| 2315 | peer = dp_peer_find_by_id(soc, |
| 2316 | ppdu_desc->user[i].peer_id); |
Soumya Bhat | 1c73aa6 | 2017-09-20 22:18:22 +0530 | [diff] [blame] | 2317 | if (!peer) |
| 2318 | continue; |
| 2319 | |
| 2320 | ppdu_desc->num_mpdu += ppdu_desc->user[i].num_mpdu; |
| 2321 | ppdu_desc->num_msdu += ppdu_desc->user[i].num_msdu; |
Pamidipati, Vijay | 57a435a | 2017-10-17 11:03:39 +0530 | [diff] [blame] | 2322 | |
| 2323 | if (ppdu_desc->frame_type == CDP_PPDU_FTYPE_DATA) { |
| 2324 | dp_tx_stats_update(soc, peer, |
| 2325 | &ppdu_desc->user[i], |
| 2326 | ppdu_desc->ack_rssi); |
| 2327 | } |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2328 | } |
| 2329 | |
| 2330 | dp_wdi_event_handler(WDI_EVENT_TX_PPDU_DESC, soc, |
| 2331 | pdev->tx_ppdu_info.buf, HTT_INVALID_PEER, |
| 2332 | WDI_NO_VAL, pdev_id); |
| 2333 | |
| 2334 | pdev->tx_ppdu_info.buf = NULL; |
Soumya Bhat | 539ecfa | 2017-09-08 12:50:30 +0530 | [diff] [blame] | 2335 | pdev->tx_ppdu_info.last_user = 0; |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2336 | } |
| 2337 | } |
| 2338 | #else |
| 2339 | static void dp_txrx_ppdu_stats_handler(struct dp_soc *soc, |
| 2340 | uint8_t pdev_id, qdf_nbuf_t htt_t2h_msg) |
| 2341 | { |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2342 | |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 2343 | } |
| 2344 | #endif |
| 2345 | #endif |
| 2346 | |
| 2347 | /** |
| 2348 | * dp_txrx_fw_stats_handler() - Function to process HTT EXT stats |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2349 | * @soc: DP SOC handle |
| 2350 | * @htt_t2h_msg: HTT message nbuf |
| 2351 | * |
| 2352 | * return:void |
| 2353 | */ |
| 2354 | static inline void dp_txrx_fw_stats_handler(struct dp_soc *soc, |
| 2355 | qdf_nbuf_t htt_t2h_msg) |
| 2356 | { |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2357 | uint8_t done; |
| 2358 | qdf_nbuf_t msg_copy; |
| 2359 | uint32_t *msg_word; |
| 2360 | |
| 2361 | msg_word = (uint32_t *) qdf_nbuf_data(htt_t2h_msg); |
| 2362 | msg_word = msg_word + 3; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2363 | done = HTT_T2H_EXT_STATS_CONF_TLV_DONE_GET(*msg_word); |
| 2364 | |
| 2365 | /* |
| 2366 | * HTT EXT stats response comes as stream of TLVs which span over |
| 2367 | * multiple T2H messages. |
| 2368 | * The first message will carry length of the response. |
| 2369 | * For rest of the messages length will be zero. |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2370 | * |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2371 | * Clone the T2H message buffer and store it in a list to process |
| 2372 | * it later. |
| 2373 | * |
| 2374 | * The original T2H message buffers gets freed in the T2H HTT event |
| 2375 | * handler |
| 2376 | */ |
| 2377 | msg_copy = qdf_nbuf_clone(htt_t2h_msg); |
| 2378 | |
| 2379 | if (!msg_copy) { |
| 2380 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO, |
| 2381 | "T2H messge clone failed for HTT EXT STATS"); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2382 | goto error; |
| 2383 | } |
| 2384 | |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2385 | qdf_spin_lock_bh(&soc->htt_stats.lock); |
| 2386 | qdf_nbuf_queue_add(&soc->htt_stats.msg, msg_copy); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2387 | /* |
| 2388 | * Done bit signifies that this is the last T2H buffer in the stream of |
| 2389 | * HTT EXT STATS message |
| 2390 | */ |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2391 | if (done) { |
| 2392 | soc->htt_stats.num_stats++; |
| 2393 | qdf_sched_work(0, &soc->htt_stats.work); |
| 2394 | } |
| 2395 | qdf_spin_unlock_bh(&soc->htt_stats.lock); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2396 | |
| 2397 | return; |
| 2398 | |
| 2399 | error: |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2400 | qdf_spin_lock_bh(&soc->htt_stats.lock); |
| 2401 | while ((msg_copy = qdf_nbuf_queue_remove(&soc->htt_stats.msg)) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2402 | != NULL) { |
| 2403 | qdf_nbuf_free(msg_copy); |
| 2404 | } |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2405 | soc->htt_stats.num_stats = 0; |
| 2406 | qdf_spin_unlock_bh(&soc->htt_stats.lock); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2407 | return; |
| 2408 | |
| 2409 | } |
| 2410 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2411 | /* |
| 2412 | * htt_soc_attach_target() - SOC level HTT setup |
| 2413 | * @htt_soc: HTT SOC handle |
| 2414 | * |
| 2415 | * Return: 0 on success; error code on failure |
| 2416 | */ |
| 2417 | int htt_soc_attach_target(void *htt_soc) |
| 2418 | { |
| 2419 | struct htt_soc *soc = (struct htt_soc *)htt_soc; |
| 2420 | |
| 2421 | return htt_h2t_ver_req_msg(soc); |
| 2422 | } |
| 2423 | |
| 2424 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2425 | #if defined(WDI_EVENT_ENABLE) && !defined(REMOVE_PKT_LOG) |
| 2426 | /* |
| 2427 | * dp_ppdu_stats_ind_handler() - PPDU stats msg handler |
| 2428 | * @htt_soc: HTT SOC handle |
| 2429 | * @msg_word: Pointer to payload |
| 2430 | * @htt_t2h_msg: HTT msg nbuf |
| 2431 | * |
| 2432 | * Return: None |
| 2433 | */ |
| 2434 | static void |
| 2435 | dp_ppdu_stats_ind_handler(struct htt_soc *soc, |
| 2436 | uint32_t *msg_word, |
| 2437 | qdf_nbuf_t htt_t2h_msg) |
| 2438 | { |
| 2439 | u_int8_t pdev_id; |
| 2440 | qdf_nbuf_set_pktlen(htt_t2h_msg, HTT_T2H_MAX_MSG_SIZE); |
| 2441 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO, |
| 2442 | "received HTT_T2H_MSG_TYPE_PPDU_STATS_IND\n"); |
| 2443 | pdev_id = HTT_T2H_PPDU_STATS_MAC_ID_GET(*msg_word); |
| 2444 | pdev_id = DP_HW2SW_MACID(pdev_id); |
| 2445 | dp_txrx_ppdu_stats_handler(soc->dp_soc, pdev_id, |
| 2446 | htt_t2h_msg); |
| 2447 | dp_wdi_event_handler(WDI_EVENT_LITE_T2H, soc->dp_soc, |
| 2448 | htt_t2h_msg, HTT_INVALID_PEER, WDI_NO_VAL, |
| 2449 | pdev_id); |
| 2450 | } |
| 2451 | #else |
| 2452 | dp_ppdu_stats_ind_handler(struct htt_soc *soc, |
| 2453 | qdf_nbuf_t htt_t2h_msg) |
| 2454 | { |
| 2455 | } |
| 2456 | #endif |
| 2457 | |
| 2458 | #if defined(WDI_EVENT_ENABLE) && \ |
| 2459 | !defined(REMOVE_PKT_LOG) && defined(CONFIG_WIN) |
| 2460 | /* |
| 2461 | * dp_pktlog_msg_handler() - Pktlog msg handler |
| 2462 | * @htt_soc: HTT SOC handle |
| 2463 | * @msg_word: Pointer to payload |
| 2464 | * |
| 2465 | * Return: None |
| 2466 | */ |
| 2467 | static void |
| 2468 | dp_pktlog_msg_handler(struct htt_soc *soc, |
| 2469 | uint32_t *msg_word) |
| 2470 | { |
| 2471 | uint8_t pdev_id; |
| 2472 | uint32_t *pl_hdr; |
| 2473 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO, |
| 2474 | "received HTT_T2H_MSG_TYPE_PKTLOG\n"); |
| 2475 | pdev_id = HTT_T2H_PKTLOG_MAC_ID_GET(*msg_word); |
| 2476 | pdev_id = DP_HW2SW_MACID(pdev_id); |
| 2477 | pl_hdr = (msg_word + 1); |
| 2478 | dp_wdi_event_handler(WDI_EVENT_OFFLOAD_ALL, soc->dp_soc, |
| 2479 | pl_hdr, HTT_INVALID_PEER, WDI_NO_VAL, |
| 2480 | pdev_id); |
| 2481 | } |
| 2482 | #else |
| 2483 | static void |
| 2484 | dp_pktlog_msg_handler(struct htt_soc *soc, |
| 2485 | uint32_t *msg_word) |
| 2486 | { |
| 2487 | } |
| 2488 | #endif |
| 2489 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2490 | /* |
| 2491 | * dp_htt_t2h_msg_handler() - Generic Target to host Msg/event handler |
| 2492 | * @context: Opaque context (HTT SOC handle) |
| 2493 | * @pkt: HTC packet |
| 2494 | */ |
| 2495 | static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt) |
| 2496 | { |
| 2497 | struct htt_soc *soc = (struct htt_soc *) context; |
| 2498 | qdf_nbuf_t htt_t2h_msg = (qdf_nbuf_t) pkt->pPktContext; |
| 2499 | u_int32_t *msg_word; |
| 2500 | enum htt_t2h_msg_type msg_type; |
| 2501 | |
| 2502 | /* check for successful message reception */ |
Rakesh Pillai | 1314645 | 2017-06-22 12:52:31 +0530 | [diff] [blame] | 2503 | if (pkt->Status != QDF_STATUS_SUCCESS) { |
| 2504 | if (pkt->Status != QDF_STATUS_E_CANCELED) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2505 | soc->stats.htc_err_cnt++; |
| 2506 | |
| 2507 | qdf_nbuf_free(htt_t2h_msg); |
| 2508 | return; |
| 2509 | } |
| 2510 | |
| 2511 | /* TODO: Check if we should pop the HTC/HTT header alignment padding */ |
| 2512 | |
| 2513 | msg_word = (u_int32_t *) qdf_nbuf_data(htt_t2h_msg); |
| 2514 | msg_type = HTT_T2H_MSG_TYPE_GET(*msg_word); |
| 2515 | switch (msg_type) { |
| 2516 | case HTT_T2H_MSG_TYPE_PEER_MAP: |
| 2517 | { |
| 2518 | u_int8_t mac_addr_deswizzle_buf[HTT_MAC_ADDR_LEN]; |
| 2519 | u_int8_t *peer_mac_addr; |
| 2520 | u_int16_t peer_id; |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 2521 | u_int16_t hw_peer_id; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2522 | u_int8_t vdev_id; |
| 2523 | |
| 2524 | peer_id = HTT_RX_PEER_MAP_PEER_ID_GET(*msg_word); |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 2525 | hw_peer_id = |
| 2526 | HTT_RX_PEER_MAP_HW_PEER_ID_GET(*(msg_word+2)); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2527 | vdev_id = HTT_RX_PEER_MAP_VDEV_ID_GET(*msg_word); |
| 2528 | peer_mac_addr = htt_t2h_mac_addr_deswizzle( |
| 2529 | (u_int8_t *) (msg_word+1), |
| 2530 | &mac_addr_deswizzle_buf[0]); |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 2531 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 2532 | QDF_TRACE_LEVEL_INFO, |
| 2533 | "HTT_T2H_MSG_TYPE_PEER_MAP msg for peer id %d vdev id %d n", |
| 2534 | peer_id, vdev_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2535 | |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 2536 | dp_rx_peer_map_handler(soc->dp_soc, peer_id, hw_peer_id, |
| 2537 | vdev_id, peer_mac_addr); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2538 | break; |
| 2539 | } |
| 2540 | case HTT_T2H_MSG_TYPE_PEER_UNMAP: |
| 2541 | { |
| 2542 | u_int16_t peer_id; |
| 2543 | peer_id = HTT_RX_PEER_UNMAP_PEER_ID_GET(*msg_word); |
| 2544 | |
| 2545 | dp_rx_peer_unmap_handler(soc->dp_soc, peer_id); |
| 2546 | break; |
| 2547 | } |
| 2548 | case HTT_T2H_MSG_TYPE_SEC_IND: |
| 2549 | { |
| 2550 | u_int16_t peer_id; |
| 2551 | enum htt_sec_type sec_type; |
| 2552 | int is_unicast; |
| 2553 | |
| 2554 | peer_id = HTT_SEC_IND_PEER_ID_GET(*msg_word); |
| 2555 | sec_type = HTT_SEC_IND_SEC_TYPE_GET(*msg_word); |
| 2556 | is_unicast = HTT_SEC_IND_UNICAST_GET(*msg_word); |
| 2557 | /* point to the first part of the Michael key */ |
| 2558 | msg_word++; |
| 2559 | dp_rx_sec_ind_handler( |
| 2560 | soc->dp_soc, peer_id, sec_type, is_unicast, |
| 2561 | msg_word, msg_word + 2); |
| 2562 | break; |
| 2563 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2564 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 2565 | case HTT_T2H_MSG_TYPE_PPDU_STATS_IND: |
| 2566 | { |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2567 | dp_ppdu_stats_ind_handler(soc, msg_word, htt_t2h_msg); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2568 | break; |
| 2569 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2570 | |
Karunakar Dasineni | ead27fb | 2017-09-28 14:28:48 -0700 | [diff] [blame] | 2571 | case HTT_T2H_MSG_TYPE_PKTLOG: |
| 2572 | { |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2573 | dp_pktlog_msg_handler(soc, msg_word); |
Karunakar Dasineni | ead27fb | 2017-09-28 14:28:48 -0700 | [diff] [blame] | 2574 | break; |
| 2575 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2576 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2577 | case HTT_T2H_MSG_TYPE_VERSION_CONF: |
| 2578 | { |
Yue Ma | 245b47b | 2017-02-21 16:35:31 -0800 | [diff] [blame] | 2579 | htc_pm_runtime_put(soc->htc_soc); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2580 | soc->tgt_ver.major = HTT_VER_CONF_MAJOR_GET(*msg_word); |
| 2581 | soc->tgt_ver.minor = HTT_VER_CONF_MINOR_GET(*msg_word); |
| 2582 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 2583 | "target uses HTT version %d.%d; host uses %d.%d\n", |
| 2584 | soc->tgt_ver.major, soc->tgt_ver.minor, |
| 2585 | HTT_CURRENT_VERSION_MAJOR, |
| 2586 | HTT_CURRENT_VERSION_MINOR); |
| 2587 | if (soc->tgt_ver.major != HTT_CURRENT_VERSION_MAJOR) { |
| 2588 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 2589 | QDF_TRACE_LEVEL_ERROR, |
| 2590 | "*** Incompatible host/target HTT versions!\n"); |
| 2591 | } |
| 2592 | /* abort if the target is incompatible with the host */ |
| 2593 | qdf_assert(soc->tgt_ver.major == |
| 2594 | HTT_CURRENT_VERSION_MAJOR); |
| 2595 | if (soc->tgt_ver.minor != HTT_CURRENT_VERSION_MINOR) { |
| 2596 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 2597 | QDF_TRACE_LEVEL_WARN, |
| 2598 | "*** Warning: host/target HTT versions" |
| 2599 | " are different, though compatible!\n"); |
| 2600 | } |
| 2601 | break; |
| 2602 | } |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 2603 | case HTT_T2H_MSG_TYPE_RX_ADDBA: |
| 2604 | { |
| 2605 | uint16_t peer_id; |
| 2606 | uint8_t tid; |
| 2607 | uint8_t win_sz; |
| 2608 | uint16_t status; |
| 2609 | struct dp_peer *peer; |
| 2610 | |
| 2611 | /* |
| 2612 | * Update REO Queue Desc with new values |
| 2613 | */ |
| 2614 | peer_id = HTT_RX_ADDBA_PEER_ID_GET(*msg_word); |
| 2615 | tid = HTT_RX_ADDBA_TID_GET(*msg_word); |
| 2616 | win_sz = HTT_RX_ADDBA_WIN_SIZE_GET(*msg_word); |
| 2617 | peer = dp_peer_find_by_id(soc->dp_soc, peer_id); |
| 2618 | |
Pramod Simha | 30e8135 | 2017-03-27 10:03:31 -0700 | [diff] [blame] | 2619 | /* |
| 2620 | * Window size needs to be incremented by 1 |
| 2621 | * since fw needs to represent a value of 256 |
| 2622 | * using just 8 bits |
| 2623 | */ |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 2624 | if (peer) { |
| 2625 | status = dp_addba_requestprocess_wifi3(peer, |
Pramod Simha | 30e8135 | 2017-03-27 10:03:31 -0700 | [diff] [blame] | 2626 | 0, tid, 0, win_sz + 1, 0xffff); |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 2627 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 2628 | QDF_TRACE_LEVEL_INFO, |
| 2629 | FL("PeerID %d BAW %d TID %d stat %d\n"), |
| 2630 | peer_id, win_sz, tid, status); |
| 2631 | |
| 2632 | } else { |
| 2633 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 2634 | QDF_TRACE_LEVEL_ERROR, |
| 2635 | FL("Peer not found peer id %d\n"), |
| 2636 | peer_id); |
| 2637 | } |
| 2638 | break; |
| 2639 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2640 | case HTT_T2H_MSG_TYPE_EXT_STATS_CONF: |
| 2641 | { |
| 2642 | dp_txrx_fw_stats_handler(soc->dp_soc, htt_t2h_msg); |
| 2643 | break; |
| 2644 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2645 | default: |
| 2646 | break; |
| 2647 | }; |
| 2648 | |
| 2649 | /* Free the indication buffer */ |
| 2650 | qdf_nbuf_free(htt_t2h_msg); |
| 2651 | } |
| 2652 | |
| 2653 | /* |
| 2654 | * dp_htt_h2t_full() - Send full handler (called from HTC) |
| 2655 | * @context: Opaque context (HTT SOC handle) |
| 2656 | * @pkt: HTC packet |
| 2657 | * |
Manikandan Mohan | 50ec704 | 2017-04-19 11:37:47 -0700 | [diff] [blame] | 2658 | * Return: enum htc_send_full_action |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2659 | */ |
Manikandan Mohan | 50ec704 | 2017-04-19 11:37:47 -0700 | [diff] [blame] | 2660 | static enum htc_send_full_action |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2661 | dp_htt_h2t_full(void *context, HTC_PACKET *pkt) |
| 2662 | { |
| 2663 | return HTC_SEND_FULL_KEEP; |
| 2664 | } |
| 2665 | |
| 2666 | /* |
Karunakar Dasineni | ead27fb | 2017-09-28 14:28:48 -0700 | [diff] [blame] | 2667 | * dp_htt_hif_t2h_hp_callback() - HIF callback for high priority T2H messages |
| 2668 | * @context: Opaque context (HTT SOC handle) |
| 2669 | * @nbuf: nbuf containing T2H message |
| 2670 | * @pipe_id: HIF pipe ID |
| 2671 | * |
| 2672 | * Return: QDF_STATUS |
| 2673 | * |
| 2674 | * TODO: Temporary change to bypass HTC connection for this new HIF pipe, which |
| 2675 | * will be used for packet log and other high-priority HTT messsages. Proper |
| 2676 | * HTC connection to be added later once required FW changes are available |
| 2677 | */ |
| 2678 | static QDF_STATUS |
| 2679 | dp_htt_hif_t2h_hp_callback (void *context, qdf_nbuf_t nbuf, uint8_t pipe_id) |
| 2680 | { |
| 2681 | A_STATUS rc = QDF_STATUS_SUCCESS; |
| 2682 | HTC_PACKET htc_pkt; |
| 2683 | |
| 2684 | qdf_assert_always(pipe_id == DP_HTT_T2H_HP_PIPE); |
| 2685 | qdf_mem_zero(&htc_pkt, sizeof(htc_pkt)); |
| 2686 | htc_pkt.Status = QDF_STATUS_SUCCESS; |
| 2687 | htc_pkt.pPktContext = (void *)nbuf; |
| 2688 | dp_htt_t2h_msg_handler(context, &htc_pkt); |
| 2689 | |
| 2690 | return rc; |
| 2691 | } |
| 2692 | |
| 2693 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2694 | * htt_htc_soc_attach() - Register SOC level HTT instance with HTC |
| 2695 | * @htt_soc: HTT SOC handle |
| 2696 | * |
| 2697 | * Return: 0 on success; error code on failure |
| 2698 | */ |
| 2699 | static int |
| 2700 | htt_htc_soc_attach(struct htt_soc *soc) |
| 2701 | { |
Manikandan Mohan | 50ec704 | 2017-04-19 11:37:47 -0700 | [diff] [blame] | 2702 | struct htc_service_connect_req connect; |
| 2703 | struct htc_service_connect_resp response; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2704 | A_STATUS status; |
| 2705 | |
| 2706 | qdf_mem_set(&connect, sizeof(connect), 0); |
| 2707 | qdf_mem_set(&response, sizeof(response), 0); |
| 2708 | |
| 2709 | connect.pMetaData = NULL; |
| 2710 | connect.MetaDataLength = 0; |
| 2711 | connect.EpCallbacks.pContext = soc; |
| 2712 | connect.EpCallbacks.EpTxComplete = dp_htt_h2t_send_complete; |
| 2713 | connect.EpCallbacks.EpTxCompleteMultiple = NULL; |
| 2714 | connect.EpCallbacks.EpRecv = dp_htt_t2h_msg_handler; |
| 2715 | |
| 2716 | /* rx buffers currently are provided by HIF, not by EpRecvRefill */ |
| 2717 | connect.EpCallbacks.EpRecvRefill = NULL; |
| 2718 | |
| 2719 | /* N/A, fill is done by HIF */ |
| 2720 | connect.EpCallbacks.RecvRefillWaterMark = 1; |
| 2721 | |
| 2722 | connect.EpCallbacks.EpSendFull = dp_htt_h2t_full; |
| 2723 | /* |
| 2724 | * Specify how deep to let a queue get before htc_send_pkt will |
| 2725 | * call the EpSendFull function due to excessive send queue depth. |
| 2726 | */ |
| 2727 | connect.MaxSendQueueDepth = DP_HTT_MAX_SEND_QUEUE_DEPTH; |
| 2728 | |
| 2729 | /* disable flow control for HTT data message service */ |
| 2730 | connect.ConnectionFlags |= HTC_CONNECT_FLAGS_DISABLE_CREDIT_FLOW_CTRL; |
| 2731 | |
| 2732 | /* connect to control service */ |
| 2733 | connect.service_id = HTT_DATA_MSG_SVC; |
| 2734 | |
| 2735 | status = htc_connect_service(soc->htc_soc, &connect, &response); |
| 2736 | |
| 2737 | if (status != A_OK) |
| 2738 | return QDF_STATUS_E_FAILURE; |
| 2739 | |
| 2740 | soc->htc_endpoint = response.Endpoint; |
| 2741 | |
Karunakar Dasineni | ead27fb | 2017-09-28 14:28:48 -0700 | [diff] [blame] | 2742 | dp_hif_update_pipe_callback(soc->dp_soc, (void *)soc, |
| 2743 | dp_htt_hif_t2h_hp_callback, DP_HTT_T2H_HP_PIPE); |
| 2744 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2745 | return 0; /* success */ |
| 2746 | } |
| 2747 | |
| 2748 | /* |
| 2749 | * htt_soc_attach() - SOC level HTT initialization |
| 2750 | * @dp_soc: Opaque Data path SOC handle |
| 2751 | * @osif_soc: Opaque OSIF SOC handle |
| 2752 | * @htc_soc: SOC level HTC handle |
| 2753 | * @hal_soc: Opaque HAL SOC handle |
| 2754 | * @osdev: QDF device |
| 2755 | * |
| 2756 | * Return: HTT handle on success; NULL on failure |
| 2757 | */ |
| 2758 | void * |
| 2759 | htt_soc_attach(void *dp_soc, void *osif_soc, HTC_HANDLE htc_soc, |
| 2760 | void *hal_soc, qdf_device_t osdev) |
| 2761 | { |
| 2762 | struct htt_soc *soc; |
| 2763 | int i; |
| 2764 | |
| 2765 | soc = qdf_mem_malloc(sizeof(*soc)); |
| 2766 | |
| 2767 | if (!soc) |
| 2768 | goto fail1; |
| 2769 | |
| 2770 | soc->osdev = osdev; |
| 2771 | soc->osif_soc = osif_soc; |
| 2772 | soc->dp_soc = dp_soc; |
| 2773 | soc->htc_soc = htc_soc; |
| 2774 | soc->hal_soc = hal_soc; |
| 2775 | |
| 2776 | /* TODO: See if any NSS related context is requred in htt_soc */ |
| 2777 | |
| 2778 | soc->htt_htc_pkt_freelist = NULL; |
| 2779 | |
| 2780 | if (htt_htc_soc_attach(soc)) |
| 2781 | goto fail2; |
| 2782 | |
| 2783 | /* TODO: See if any Rx data specific intialization is required. For |
| 2784 | * MCL use cases, the data will be received as single packet and |
| 2785 | * should not required any descriptor or reorder handling |
| 2786 | */ |
| 2787 | |
| 2788 | HTT_TX_MUTEX_INIT(&soc->htt_tx_mutex); |
| 2789 | |
| 2790 | /* pre-allocate some HTC_PACKET objects */ |
| 2791 | for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) { |
| 2792 | struct dp_htt_htc_pkt_union *pkt; |
| 2793 | pkt = qdf_mem_malloc(sizeof(*pkt)); |
| 2794 | if (!pkt) |
| 2795 | break; |
| 2796 | |
| 2797 | htt_htc_pkt_free(soc, &pkt->u.pkt); |
| 2798 | } |
| 2799 | |
| 2800 | return soc; |
| 2801 | |
| 2802 | fail2: |
| 2803 | qdf_mem_free(soc); |
| 2804 | |
| 2805 | fail1: |
| 2806 | return NULL; |
| 2807 | } |
| 2808 | |
| 2809 | |
| 2810 | /* |
| 2811 | * htt_soc_detach() - Detach SOC level HTT |
| 2812 | * @htt_soc: HTT SOC handle |
| 2813 | */ |
| 2814 | void |
| 2815 | htt_soc_detach(void *htt_soc) |
| 2816 | { |
Kiran Venkatappa | 3ec0b30 | 2016-12-20 11:30:46 +0530 | [diff] [blame] | 2817 | struct htt_soc *soc = (struct htt_soc *)htt_soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2818 | |
Pramod Simha | e0baa44 | 2017-06-27 15:21:39 -0700 | [diff] [blame] | 2819 | htt_htc_misc_pkt_pool_free(soc); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2820 | htt_htc_pkt_pool_free(soc); |
| 2821 | HTT_TX_MUTEX_DESTROY(&soc->htt_tx_mutex); |
| 2822 | qdf_mem_free(soc); |
| 2823 | } |
| 2824 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2825 | /** |
| 2826 | * dp_h2t_ext_stats_msg_send(): function to contruct HTT message to pass to FW |
| 2827 | * @pdev: DP PDEV handle |
| 2828 | * @stats_type_upload_mask: stats type requested by user |
| 2829 | * @config_param_0: extra configuration parameters |
| 2830 | * @config_param_1: extra configuration parameters |
| 2831 | * @config_param_2: extra configuration parameters |
| 2832 | * @config_param_3: extra configuration parameters |
| 2833 | * |
| 2834 | * return: QDF STATUS |
| 2835 | */ |
| 2836 | QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev, |
| 2837 | uint32_t stats_type_upload_mask, uint32_t config_param_0, |
| 2838 | uint32_t config_param_1, uint32_t config_param_2, |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 2839 | uint32_t config_param_3, int cookie_val) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2840 | { |
| 2841 | struct htt_soc *soc = pdev->soc->htt_handle; |
| 2842 | struct dp_htt_htc_pkt *pkt; |
| 2843 | qdf_nbuf_t msg; |
| 2844 | uint32_t *msg_word; |
| 2845 | uint8_t pdev_mask; |
| 2846 | |
| 2847 | msg = qdf_nbuf_alloc( |
| 2848 | soc->osdev, |
| 2849 | HTT_MSG_BUF_SIZE(HTT_H2T_EXT_STATS_REQ_MSG_SZ), |
| 2850 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE); |
| 2851 | |
| 2852 | if (!msg) |
| 2853 | return QDF_STATUS_E_NOMEM; |
| 2854 | |
| 2855 | /*TODO:Add support for SOC stats |
| 2856 | * Bit 0: SOC Stats |
| 2857 | * Bit 1: Pdev stats for pdev id 0 |
| 2858 | * Bit 2: Pdev stats for pdev id 1 |
| 2859 | * Bit 3: Pdev stats for pdev id 2 |
| 2860 | */ |
| 2861 | pdev_mask = 1 << (pdev->pdev_id + 1); |
| 2862 | |
| 2863 | /* |
| 2864 | * Set the length of the message. |
| 2865 | * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added |
| 2866 | * separately during the below call to qdf_nbuf_push_head. |
| 2867 | * The contribution from the HTC header is added separately inside HTC. |
| 2868 | */ |
| 2869 | if (qdf_nbuf_put_tail(msg, HTT_H2T_EXT_STATS_REQ_MSG_SZ) == NULL) { |
| 2870 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2871 | "Failed to expand head for HTT_EXT_STATS"); |
| 2872 | qdf_nbuf_free(msg); |
| 2873 | return QDF_STATUS_E_FAILURE; |
| 2874 | } |
| 2875 | |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 2876 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 2877 | "-----%s:%d----\n cookie <-> %d\n config_param_0 %u\n" |
| 2878 | "config_param_1 %u\n config_param_2 %u\n" |
| 2879 | "config_param_4 %u\n -------------\n", |
| 2880 | __func__, __LINE__, cookie_val, config_param_0, |
| 2881 | config_param_1, config_param_2, config_param_3); |
| 2882 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2883 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
| 2884 | |
| 2885 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
| 2886 | *msg_word = 0; |
| 2887 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_EXT_STATS_REQ); |
| 2888 | HTT_H2T_EXT_STATS_REQ_PDEV_MASK_SET(*msg_word, pdev_mask); |
| 2889 | HTT_H2T_EXT_STATS_REQ_STATS_TYPE_SET(*msg_word, stats_type_upload_mask); |
| 2890 | |
| 2891 | /* word 1 */ |
| 2892 | msg_word++; |
| 2893 | *msg_word = 0; |
| 2894 | HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_0); |
| 2895 | |
| 2896 | /* word 2 */ |
| 2897 | msg_word++; |
| 2898 | *msg_word = 0; |
| 2899 | HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_1); |
| 2900 | |
| 2901 | /* word 3 */ |
| 2902 | msg_word++; |
| 2903 | *msg_word = 0; |
| 2904 | HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_2); |
| 2905 | |
| 2906 | /* word 4 */ |
| 2907 | msg_word++; |
| 2908 | *msg_word = 0; |
| 2909 | HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_3); |
| 2910 | |
| 2911 | HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, 0); |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 2912 | |
| 2913 | /* word 5 */ |
| 2914 | msg_word++; |
| 2915 | |
| 2916 | /* word 6 */ |
| 2917 | msg_word++; |
| 2918 | *msg_word = 0; |
| 2919 | HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, cookie_val); |
| 2920 | |
| 2921 | /* word 7 */ |
| 2922 | msg_word++; |
| 2923 | *msg_word = 0; |
| 2924 | HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, pdev->pdev_id); |
| 2925 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2926 | pkt = htt_htc_pkt_alloc(soc); |
| 2927 | if (!pkt) { |
| 2928 | qdf_nbuf_free(msg); |
| 2929 | return QDF_STATUS_E_NOMEM; |
| 2930 | } |
| 2931 | |
| 2932 | pkt->soc_ctxt = NULL; /* not used during send-done callback */ |
| 2933 | |
| 2934 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 2935 | dp_htt_h2t_send_complete_free_netbuf, |
| 2936 | qdf_nbuf_data(msg), qdf_nbuf_len(msg), |
| 2937 | soc->htc_endpoint, |
| 2938 | 1); /* tag - not relevant here */ |
| 2939 | |
| 2940 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
Pramod Simha | e0baa44 | 2017-06-27 15:21:39 -0700 | [diff] [blame] | 2941 | DP_HTT_SEND_HTC_PKT(soc, pkt); |
| 2942 | return 0; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 2943 | } |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 2944 | |
| 2945 | /* This macro will revert once proper HTT header will define for |
| 2946 | * HTT_H2T_MSG_TYPE_PPDU_STATS_CFG in htt.h file |
| 2947 | * */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2948 | #if defined(WDI_EVENT_ENABLE) |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 2949 | /** |
| 2950 | * dp_h2t_cfg_stats_msg_send(): function to construct HTT message to pass to FW |
| 2951 | * @pdev: DP PDEV handle |
| 2952 | * @stats_type_upload_mask: stats type requested by user |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2953 | * @mac_id: Mac id number |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 2954 | * |
| 2955 | * return: QDF STATUS |
| 2956 | */ |
| 2957 | QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev, |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2958 | uint32_t stats_type_upload_mask, uint8_t mac_id) |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 2959 | { |
| 2960 | struct htt_soc *soc = pdev->soc->htt_handle; |
| 2961 | struct dp_htt_htc_pkt *pkt; |
| 2962 | qdf_nbuf_t msg; |
| 2963 | uint32_t *msg_word; |
| 2964 | uint8_t pdev_mask; |
| 2965 | |
| 2966 | msg = qdf_nbuf_alloc( |
| 2967 | soc->osdev, |
| 2968 | HTT_MSG_BUF_SIZE(HTT_H2T_PPDU_STATS_CFG_MSG_SZ), |
| 2969 | HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, true); |
| 2970 | |
| 2971 | if (!msg) { |
| 2972 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2973 | "Fail to allocate HTT_H2T_PPDU_STATS_CFG_MSG_SZ msg buffer\n"); |
| 2974 | qdf_assert(0); |
| 2975 | return QDF_STATUS_E_NOMEM; |
| 2976 | } |
| 2977 | |
| 2978 | /*TODO:Add support for SOC stats |
| 2979 | * Bit 0: SOC Stats |
| 2980 | * Bit 1: Pdev stats for pdev id 0 |
| 2981 | * Bit 2: Pdev stats for pdev id 1 |
| 2982 | * Bit 3: Pdev stats for pdev id 2 |
| 2983 | */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2984 | pdev_mask = 1 << DP_SW2HW_MACID(mac_id); |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 2985 | |
| 2986 | /* |
| 2987 | * Set the length of the message. |
| 2988 | * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added |
| 2989 | * separately during the below call to qdf_nbuf_push_head. |
| 2990 | * The contribution from the HTC header is added separately inside HTC. |
| 2991 | */ |
| 2992 | if (qdf_nbuf_put_tail(msg, HTT_H2T_PPDU_STATS_CFG_MSG_SZ) == NULL) { |
| 2993 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2994 | "Failed to expand head for HTT_CFG_STATS\n"); |
| 2995 | qdf_nbuf_free(msg); |
| 2996 | return QDF_STATUS_E_FAILURE; |
| 2997 | } |
| 2998 | |
| 2999 | msg_word = (uint32_t *) qdf_nbuf_data(msg); |
| 3000 | |
| 3001 | qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); |
| 3002 | *msg_word = 0; |
| 3003 | HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_PPDU_STATS_CFG); |
| 3004 | HTT_H2T_PPDU_STATS_CFG_PDEV_MASK_SET(*msg_word, pdev_mask); |
| 3005 | HTT_H2T_PPDU_STATS_CFG_TLV_BITMASK_SET(*msg_word, |
| 3006 | stats_type_upload_mask); |
| 3007 | |
| 3008 | pkt = htt_htc_pkt_alloc(soc); |
| 3009 | if (!pkt) { |
| 3010 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3011 | "Fail to allocate dp_htt_htc_pkt buffer\n"); |
| 3012 | qdf_assert(0); |
| 3013 | qdf_nbuf_free(msg); |
| 3014 | return QDF_STATUS_E_NOMEM; |
| 3015 | } |
| 3016 | |
| 3017 | pkt->soc_ctxt = NULL; /* not used during send-done callback */ |
| 3018 | |
| 3019 | SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, |
| 3020 | dp_htt_h2t_send_complete_free_netbuf, |
| 3021 | qdf_nbuf_data(msg), qdf_nbuf_len(msg), |
| 3022 | soc->htc_endpoint, |
| 3023 | 1); /* tag - not relevant here */ |
| 3024 | |
| 3025 | SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); |
| 3026 | DP_HTT_SEND_HTC_PKT(soc, pkt); |
| 3027 | return 0; |
| 3028 | } |
| 3029 | #endif |