Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1 | /* |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2 | * Copyright (c) 2016-2018 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 <qdf_types.h> |
| 20 | #include <qdf_lock.h> |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 21 | #include <qdf_net_types.h> |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 22 | #include <qdf_lro.h> |
Tallapragada Kalyan | 4c183b8 | 2017-09-13 23:48:14 +0530 | [diff] [blame] | 23 | #include <qdf_module.h> |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 24 | #include <hal_api.h> |
| 25 | #include <hif.h> |
| 26 | #include <htt.h> |
| 27 | #include <wdi_event.h> |
| 28 | #include <queue.h> |
| 29 | #include "dp_htt.h" |
| 30 | #include "dp_types.h" |
| 31 | #include "dp_internal.h" |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 32 | #include "dp_tx.h" |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 33 | #include "dp_tx_desc.h" |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 34 | #include "dp_rx.h" |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 35 | #include <cdp_txrx_handle.h> |
Ravi Joshi | af9ace8 | 2017-02-17 12:41:48 -0800 | [diff] [blame] | 36 | #include <wlan_cfg.h> |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 37 | #include "cdp_txrx_cmn_struct.h" |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 38 | #include "cdp_txrx_stats_struct.h" |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 39 | #include <qdf_util.h> |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 40 | #include "dp_peer.h" |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 41 | #include "dp_rx_mon.h" |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 42 | #include "htt_stats.h" |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 43 | #include "qdf_mem.h" /* qdf_mem_malloc,free */ |
Manjunathappa Prakash | 5f050a8 | 2017-07-18 22:00:05 -0700 | [diff] [blame] | 44 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 45 | #include "cdp_txrx_flow_ctrl_v2.h" |
Manjunathappa Prakash | 5f050a8 | 2017-07-18 22:00:05 -0700 | [diff] [blame] | 46 | #else |
| 47 | static inline void |
| 48 | cdp_dump_flow_pool_info(struct cdp_soc_t *soc) |
| 49 | { |
| 50 | return; |
| 51 | } |
| 52 | #endif |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 53 | #include "dp_ipa.h" |
Ravi Joshi | af9ace8 | 2017-02-17 12:41:48 -0800 | [diff] [blame] | 54 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 55 | #ifdef CONFIG_MCL |
| 56 | static void dp_service_mon_rings(void *arg); |
| 57 | #ifndef REMOVE_PKT_LOG |
| 58 | #include <pktlog_ac_api.h> |
| 59 | #include <pktlog_ac.h> |
| 60 | static void dp_pkt_log_con_service(struct cdp_pdev *ppdev, void *scn); |
| 61 | #endif |
| 62 | #endif |
| 63 | static void dp_pktlogmod_exit(struct dp_pdev *handle); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 64 | static void *dp_peer_create_wifi3(struct cdp_vdev *vdev_handle, |
| 65 | uint8_t *peer_mac_addr); |
| 66 | static void dp_peer_delete_wifi3(void *peer_handle, uint32_t bitmap); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 67 | |
Karunakar Dasineni | 1d891ed | 2017-03-29 15:42:02 -0700 | [diff] [blame] | 68 | #define DP_INTR_POLL_TIMER_MS 10 |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 69 | #define DP_WDS_AGING_TIMER_DEFAULT_MS 120000 |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 70 | #define DP_MCS_LENGTH (6*MAX_MCS) |
| 71 | #define DP_NSS_LENGTH (6*SS_COUNT) |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 72 | #define DP_RXDMA_ERR_LENGTH (6*HAL_RXDMA_ERR_MAX) |
| 73 | #define DP_REO_ERR_LENGTH (6*HAL_REO_ERR_MAX) |
| 74 | #define DP_MAX_MCS_STRING_LEN 30 |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 75 | #define DP_CURR_FW_STATS_AVAIL 19 |
| 76 | #define DP_HTT_DBG_EXT_STATS_MAX 256 |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 77 | #define DP_MAX_SLEEP_TIME 100 |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 78 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 79 | #ifdef IPA_OFFLOAD |
| 80 | /* Exclude IPA rings from the interrupt context */ |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 81 | #define TX_RING_MASK_VAL 0xb |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 82 | #define RX_RING_MASK_VAL 0x7 |
| 83 | #else |
| 84 | #define TX_RING_MASK_VAL 0xF |
| 85 | #define RX_RING_MASK_VAL 0xF |
| 86 | #endif |
Venkateswara Swamy Bandaru | ed15e74a | 2017-08-18 19:13:10 +0530 | [diff] [blame] | 87 | |
Tallapragada Kalyan | 4c183b8 | 2017-09-13 23:48:14 +0530 | [diff] [blame] | 88 | bool rx_hash = 1; |
| 89 | qdf_declare_param(rx_hash, bool); |
| 90 | |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 91 | #define STR_MAXLEN 64 |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 92 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 93 | #define DP_PPDU_STATS_CFG_ALL 0xFFFF |
| 94 | |
| 95 | /* PPDU stats mask sent to FW to enable enhanced stats */ |
| 96 | #define DP_PPDU_STATS_CFG_ENH_STATS 0xE67 |
| 97 | /* PPDU stats mask sent to FW to support debug sniffer feature */ |
| 98 | #define DP_PPDU_STATS_CFG_SNIFFER 0x2FFF |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 99 | /** |
| 100 | * default_dscp_tid_map - Default DSCP-TID mapping |
| 101 | * |
Pamidipati, Vijay | ef2cbc6 | 2017-09-27 23:09:06 +0530 | [diff] [blame] | 102 | * DSCP TID |
| 103 | * 000000 0 |
| 104 | * 001000 1 |
| 105 | * 010000 2 |
| 106 | * 011000 3 |
| 107 | * 100000 4 |
| 108 | * 101000 5 |
| 109 | * 110000 6 |
| 110 | * 111000 7 |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 111 | */ |
| 112 | static uint8_t default_dscp_tid_map[DSCP_TID_MAP_MAX] = { |
| 113 | 0, 0, 0, 0, 0, 0, 0, 0, |
| 114 | 1, 1, 1, 1, 1, 1, 1, 1, |
Pamidipati, Vijay | ef2cbc6 | 2017-09-27 23:09:06 +0530 | [diff] [blame] | 115 | 2, 2, 2, 2, 2, 2, 2, 2, |
| 116 | 3, 3, 3, 3, 3, 3, 3, 3, |
| 117 | 4, 4, 4, 4, 4, 4, 4, 4, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 118 | 5, 5, 5, 5, 5, 5, 5, 5, |
| 119 | 6, 6, 6, 6, 6, 6, 6, 6, |
Pamidipati, Vijay | ef2cbc6 | 2017-09-27 23:09:06 +0530 | [diff] [blame] | 120 | 7, 7, 7, 7, 7, 7, 7, 7, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 121 | }; |
| 122 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 123 | /* |
| 124 | * struct dp_rate_debug |
| 125 | * |
| 126 | * @mcs_type: print string for a given mcs |
| 127 | * @valid: valid mcs rate? |
| 128 | */ |
| 129 | struct dp_rate_debug { |
| 130 | char mcs_type[DP_MAX_MCS_STRING_LEN]; |
| 131 | uint8_t valid; |
| 132 | }; |
| 133 | |
| 134 | #define MCS_VALID 1 |
| 135 | #define MCS_INVALID 0 |
| 136 | |
| 137 | static const struct dp_rate_debug dp_rate_string[DOT11_MAX][MAX_MCS] = { |
Anish Nataraj | 072d897 | 2018-01-09 18:23:33 +0530 | [diff] [blame] | 138 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 139 | { |
| 140 | {"OFDM 48 Mbps", MCS_VALID}, |
| 141 | {"OFDM 24 Mbps", MCS_VALID}, |
| 142 | {"OFDM 12 Mbps", MCS_VALID}, |
| 143 | {"OFDM 6 Mbps ", MCS_VALID}, |
| 144 | {"OFDM 54 Mbps", MCS_VALID}, |
| 145 | {"OFDM 36 Mbps", MCS_VALID}, |
| 146 | {"OFDM 18 Mbps", MCS_VALID}, |
| 147 | {"OFDM 9 Mbps ", MCS_VALID}, |
| 148 | {"INVALID ", MCS_INVALID}, |
| 149 | {"INVALID ", MCS_INVALID}, |
| 150 | {"INVALID ", MCS_INVALID}, |
| 151 | {"INVALID ", MCS_INVALID}, |
| 152 | {"INVALID ", MCS_VALID}, |
| 153 | }, |
| 154 | { |
Anish Nataraj | 072d897 | 2018-01-09 18:23:33 +0530 | [diff] [blame] | 155 | {"CCK 11 Mbps Long ", MCS_VALID}, |
| 156 | {"CCK 5.5 Mbps Long ", MCS_VALID}, |
| 157 | {"CCK 2 Mbps Long ", MCS_VALID}, |
| 158 | {"CCK 1 Mbps Long ", MCS_VALID}, |
| 159 | {"CCK 11 Mbps Short ", MCS_VALID}, |
| 160 | {"CCK 5.5 Mbps Short", MCS_VALID}, |
| 161 | {"CCK 2 Mbps Short ", MCS_VALID}, |
| 162 | {"INVALID ", MCS_INVALID}, |
| 163 | {"INVALID ", MCS_INVALID}, |
| 164 | {"INVALID ", MCS_INVALID}, |
| 165 | {"INVALID ", MCS_INVALID}, |
| 166 | {"INVALID ", MCS_INVALID}, |
| 167 | {"INVALID ", MCS_VALID}, |
| 168 | }, |
| 169 | { |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 170 | {"HT MCS 0 (BPSK 1/2) ", MCS_VALID}, |
| 171 | {"HT MCS 1 (QPSK 1/2) ", MCS_VALID}, |
| 172 | {"HT MCS 2 (QPSK 3/4) ", MCS_VALID}, |
| 173 | {"HT MCS 3 (16-QAM 1/2)", MCS_VALID}, |
| 174 | {"HT MCS 4 (16-QAM 3/4)", MCS_VALID}, |
| 175 | {"HT MCS 5 (64-QAM 2/3)", MCS_VALID}, |
| 176 | {"HT MCS 6 (64-QAM 3/4)", MCS_VALID}, |
| 177 | {"HT MCS 7 (64-QAM 5/6)", MCS_VALID}, |
| 178 | {"INVALID ", MCS_INVALID}, |
| 179 | {"INVALID ", MCS_INVALID}, |
| 180 | {"INVALID ", MCS_INVALID}, |
| 181 | {"INVALID ", MCS_INVALID}, |
| 182 | {"INVALID ", MCS_VALID}, |
| 183 | }, |
| 184 | { |
| 185 | {"VHT MCS 0 (BPSK 1/2) ", MCS_VALID}, |
| 186 | {"VHT MCS 1 (QPSK 1/2) ", MCS_VALID}, |
| 187 | {"VHT MCS 2 (QPSK 3/4) ", MCS_VALID}, |
| 188 | {"VHT MCS 3 (16-QAM 1/2) ", MCS_VALID}, |
| 189 | {"VHT MCS 4 (16-QAM 3/4) ", MCS_VALID}, |
| 190 | {"VHT MCS 5 (64-QAM 2/3) ", MCS_VALID}, |
| 191 | {"VHT MCS 6 (64-QAM 3/4) ", MCS_VALID}, |
| 192 | {"VHT MCS 7 (64-QAM 5/6) ", MCS_VALID}, |
| 193 | {"VHT MCS 8 (256-QAM 3/4) ", MCS_VALID}, |
| 194 | {"VHT MCS 9 (256-QAM 5/6) ", MCS_VALID}, |
| 195 | {"VHT MCS 10 (1024-QAM 3/4)", MCS_VALID}, |
Pamidipati, Vijay | 57a435a | 2017-10-17 11:03:39 +0530 | [diff] [blame] | 196 | {"VHT MCS 11 (1024-QAM 5/6)", MCS_VALID}, |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 197 | {"INVALID ", MCS_VALID}, |
| 198 | }, |
| 199 | { |
| 200 | {"HE MCS 0 (BPSK 1/2) ", MCS_VALID}, |
| 201 | {"HE MCS 1 (QPSK 1/2) ", MCS_VALID}, |
| 202 | {"HE MCS 2 (QPSK 3/4) ", MCS_VALID}, |
| 203 | {"HE MCS 3 (16-QAM 1/2) ", MCS_VALID}, |
| 204 | {"HE MCS 4 (16-QAM 3/4) ", MCS_VALID}, |
| 205 | {"HE MCS 5 (64-QAM 2/3) ", MCS_VALID}, |
| 206 | {"HE MCS 6 (64-QAM 3/4) ", MCS_VALID}, |
| 207 | {"HE MCS 7 (64-QAM 5/6) ", MCS_VALID}, |
| 208 | {"HE MCS 8 (256-QAM 3/4) ", MCS_VALID}, |
| 209 | {"HE MCS 9 (256-QAM 5/6) ", MCS_VALID}, |
| 210 | {"HE MCS 10 (1024-QAM 3/4)", MCS_VALID}, |
Pamidipati, Vijay | 57a435a | 2017-10-17 11:03:39 +0530 | [diff] [blame] | 211 | {"HE MCS 11 (1024-QAM 5/6)", MCS_VALID}, |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 212 | {"INVALID ", MCS_VALID}, |
| 213 | } |
| 214 | }; |
| 215 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 216 | /** |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 217 | * @brief Cpu ring map types |
| 218 | */ |
| 219 | enum dp_cpu_ring_map_types { |
| 220 | DP_DEFAULT_MAP, |
| 221 | DP_NSS_FIRST_RADIO_OFFLOADED_MAP, |
| 222 | DP_NSS_SECOND_RADIO_OFFLOADED_MAP, |
| 223 | DP_NSS_ALL_RADIO_OFFLOADED_MAP, |
| 224 | DP_CPU_RING_MAP_MAX |
| 225 | }; |
| 226 | |
| 227 | /** |
| 228 | * @brief Cpu to tx ring map |
| 229 | */ |
| 230 | static uint8_t dp_cpu_ring_map[DP_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 231 | {0x0, 0x1, 0x2, 0x0}, |
| 232 | {0x1, 0x2, 0x1, 0x2}, |
| 233 | {0x0, 0x2, 0x0, 0x2}, |
| 234 | {0x2, 0x2, 0x2, 0x2} |
| 235 | }; |
| 236 | |
| 237 | /** |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 238 | * @brief Select the type of statistics |
| 239 | */ |
| 240 | enum dp_stats_type { |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 241 | STATS_FW = 0, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 242 | STATS_HOST = 1, |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 243 | STATS_TYPE_MAX = 2, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 244 | }; |
| 245 | |
| 246 | /** |
| 247 | * @brief General Firmware statistics options |
| 248 | * |
| 249 | */ |
| 250 | enum dp_fw_stats { |
| 251 | TXRX_FW_STATS_INVALID = -1, |
| 252 | }; |
| 253 | |
| 254 | /** |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 255 | * dp_stats_mapping_table - Firmware and Host statistics |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 256 | * currently supported |
| 257 | */ |
| 258 | const int dp_stats_mapping_table[][STATS_TYPE_MAX] = { |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 259 | {HTT_DBG_EXT_STATS_RESET, TXRX_HOST_STATS_INVALID}, |
| 260 | {HTT_DBG_EXT_STATS_PDEV_TX, TXRX_HOST_STATS_INVALID}, |
| 261 | {HTT_DBG_EXT_STATS_PDEV_RX, TXRX_HOST_STATS_INVALID}, |
| 262 | {HTT_DBG_EXT_STATS_PDEV_TX_HWQ, TXRX_HOST_STATS_INVALID}, |
| 263 | {HTT_DBG_EXT_STATS_PDEV_TX_SCHED, TXRX_HOST_STATS_INVALID}, |
| 264 | {HTT_DBG_EXT_STATS_PDEV_ERROR, TXRX_HOST_STATS_INVALID}, |
| 265 | {HTT_DBG_EXT_STATS_PDEV_TQM, TXRX_HOST_STATS_INVALID}, |
| 266 | {HTT_DBG_EXT_STATS_TQM_CMDQ, TXRX_HOST_STATS_INVALID}, |
| 267 | {HTT_DBG_EXT_STATS_TX_DE_INFO, TXRX_HOST_STATS_INVALID}, |
| 268 | {HTT_DBG_EXT_STATS_PDEV_TX_RATE, TXRX_HOST_STATS_INVALID}, |
| 269 | {HTT_DBG_EXT_STATS_PDEV_RX_RATE, TXRX_HOST_STATS_INVALID}, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 270 | {TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID}, |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 271 | {HTT_DBG_EXT_STATS_TX_SELFGEN_INFO, TXRX_HOST_STATS_INVALID}, |
| 272 | {HTT_DBG_EXT_STATS_TX_MU_HWQ, TXRX_HOST_STATS_INVALID}, |
| 273 | {HTT_DBG_EXT_STATS_RING_IF_INFO, TXRX_HOST_STATS_INVALID}, |
| 274 | {HTT_DBG_EXT_STATS_SRNG_INFO, TXRX_HOST_STATS_INVALID}, |
| 275 | {HTT_DBG_EXT_STATS_SFM_INFO, TXRX_HOST_STATS_INVALID}, |
| 276 | {HTT_DBG_EXT_STATS_PDEV_TX_MU, TXRX_HOST_STATS_INVALID}, |
| 277 | {HTT_DBG_EXT_STATS_ACTIVE_PEERS_LIST, TXRX_HOST_STATS_INVALID}, |
| 278 | /* Last ENUM for HTT FW STATS */ |
| 279 | {DP_HTT_DBG_EXT_STATS_MAX, TXRX_HOST_STATS_INVALID}, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 280 | {TXRX_FW_STATS_INVALID, TXRX_CLEAR_STATS}, |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 281 | {TXRX_FW_STATS_INVALID, TXRX_RX_RATE_STATS}, |
| 282 | {TXRX_FW_STATS_INVALID, TXRX_TX_RATE_STATS}, |
| 283 | {TXRX_FW_STATS_INVALID, TXRX_TX_HOST_STATS}, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 284 | {TXRX_FW_STATS_INVALID, TXRX_RX_HOST_STATS}, |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 285 | {TXRX_FW_STATS_INVALID, TXRX_AST_STATS}, |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 286 | {TXRX_FW_STATS_INVALID, TXRX_SRNG_PTR_STATS}, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 287 | }; |
| 288 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 289 | static int dp_peer_add_ast_wifi3(struct cdp_soc_t *soc_hdl, |
| 290 | struct cdp_peer *peer_hdl, |
| 291 | uint8_t *mac_addr, |
| 292 | enum cdp_txrx_ast_entry_type type, |
| 293 | uint32_t flags) |
| 294 | { |
| 295 | |
| 296 | return dp_peer_add_ast((struct dp_soc *)soc_hdl, |
| 297 | (struct dp_peer *)peer_hdl, |
| 298 | mac_addr, |
| 299 | type, |
| 300 | flags); |
| 301 | } |
| 302 | |
| 303 | static void dp_peer_del_ast_wifi3(struct cdp_soc_t *soc_hdl, |
| 304 | void *ast_entry_hdl) |
| 305 | { |
| 306 | struct dp_soc *soc = (struct dp_soc *)soc_hdl; |
| 307 | qdf_spin_lock_bh(&soc->ast_lock); |
| 308 | dp_peer_del_ast((struct dp_soc *)soc_hdl, |
| 309 | (struct dp_ast_entry *)ast_entry_hdl); |
| 310 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 311 | } |
| 312 | |
| 313 | static int dp_peer_update_ast_wifi3(struct cdp_soc_t *soc_hdl, |
| 314 | struct cdp_peer *peer_hdl, |
| 315 | void *ast_entry_hdl, |
| 316 | uint32_t flags) |
| 317 | { |
| 318 | int status; |
| 319 | struct dp_soc *soc = (struct dp_soc *)soc_hdl; |
| 320 | qdf_spin_lock_bh(&soc->ast_lock); |
| 321 | status = dp_peer_update_ast(soc, |
| 322 | (struct dp_peer *)peer_hdl, |
| 323 | (struct dp_ast_entry *)ast_entry_hdl, |
| 324 | flags); |
| 325 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 326 | return status; |
| 327 | } |
| 328 | |
| 329 | static void *dp_peer_ast_hash_find_wifi3(struct cdp_soc_t *soc_hdl, |
| 330 | uint8_t *ast_mac_addr) |
| 331 | { |
| 332 | struct dp_ast_entry *ast_entry; |
| 333 | struct dp_soc *soc = (struct dp_soc *)soc_hdl; |
| 334 | qdf_spin_lock_bh(&soc->ast_lock); |
| 335 | ast_entry = dp_peer_ast_hash_find(soc, ast_mac_addr); |
| 336 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 337 | return (void *)ast_entry; |
| 338 | } |
| 339 | |
| 340 | static uint8_t dp_peer_ast_get_pdev_id_wifi3(struct cdp_soc_t *soc_hdl, |
| 341 | void *ast_entry_hdl) |
| 342 | { |
| 343 | return dp_peer_ast_get_pdev_id((struct dp_soc *)soc_hdl, |
| 344 | (struct dp_ast_entry *)ast_entry_hdl); |
| 345 | } |
| 346 | |
| 347 | static uint8_t dp_peer_ast_get_next_hop_wifi3(struct cdp_soc_t *soc_hdl, |
| 348 | void *ast_entry_hdl) |
| 349 | { |
| 350 | return dp_peer_ast_get_next_hop((struct dp_soc *)soc_hdl, |
| 351 | (struct dp_ast_entry *)ast_entry_hdl); |
| 352 | } |
| 353 | |
| 354 | static void dp_peer_ast_set_type_wifi3( |
| 355 | struct cdp_soc_t *soc_hdl, |
| 356 | void *ast_entry_hdl, |
| 357 | enum cdp_txrx_ast_entry_type type) |
| 358 | { |
| 359 | dp_peer_ast_set_type((struct dp_soc *)soc_hdl, |
| 360 | (struct dp_ast_entry *)ast_entry_hdl, |
| 361 | type); |
| 362 | } |
| 363 | |
| 364 | |
| 365 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 366 | /** |
| 367 | * dp_srng_find_ring_in_mask() - find which ext_group a ring belongs |
| 368 | * @ring_num: ring num of the ring being queried |
| 369 | * @grp_mask: the grp_mask array for the ring type in question. |
| 370 | * |
| 371 | * The grp_mask array is indexed by group number and the bit fields correspond |
| 372 | * to ring numbers. We are finding which interrupt group a ring belongs to. |
| 373 | * |
| 374 | * Return: the index in the grp_mask array with the ring number. |
| 375 | * -QDF_STATUS_E_NOENT if no entry is found |
| 376 | */ |
| 377 | static int dp_srng_find_ring_in_mask(int ring_num, int *grp_mask) |
| 378 | { |
| 379 | int ext_group_num; |
| 380 | int mask = 1 << ring_num; |
| 381 | |
| 382 | for (ext_group_num = 0; ext_group_num < WLAN_CFG_INT_NUM_CONTEXTS; |
| 383 | ext_group_num++) { |
| 384 | if (mask & grp_mask[ext_group_num]) |
| 385 | return ext_group_num; |
| 386 | } |
| 387 | |
| 388 | return -QDF_STATUS_E_NOENT; |
| 389 | } |
| 390 | |
| 391 | static int dp_srng_calculate_msi_group(struct dp_soc *soc, |
| 392 | enum hal_ring_type ring_type, |
| 393 | int ring_num) |
| 394 | { |
| 395 | int *grp_mask; |
| 396 | |
| 397 | switch (ring_type) { |
| 398 | case WBM2SW_RELEASE: |
| 399 | /* dp_tx_comp_handler - soc->tx_comp_ring */ |
| 400 | if (ring_num < 3) |
| 401 | grp_mask = &soc->wlan_cfg_ctx->int_tx_ring_mask[0]; |
| 402 | |
| 403 | /* dp_rx_wbm_err_process - soc->rx_rel_ring */ |
| 404 | else if (ring_num == 3) { |
| 405 | /* sw treats this as a separate ring type */ |
| 406 | grp_mask = &soc->wlan_cfg_ctx-> |
| 407 | int_rx_wbm_rel_ring_mask[0]; |
| 408 | ring_num = 0; |
| 409 | } else { |
| 410 | qdf_assert(0); |
| 411 | return -QDF_STATUS_E_NOENT; |
| 412 | } |
| 413 | break; |
| 414 | |
| 415 | case REO_EXCEPTION: |
| 416 | /* dp_rx_err_process - &soc->reo_exception_ring */ |
| 417 | grp_mask = &soc->wlan_cfg_ctx->int_rx_err_ring_mask[0]; |
| 418 | break; |
| 419 | |
| 420 | case REO_DST: |
| 421 | /* dp_rx_process - soc->reo_dest_ring */ |
| 422 | grp_mask = &soc->wlan_cfg_ctx->int_rx_ring_mask[0]; |
| 423 | break; |
| 424 | |
| 425 | case REO_STATUS: |
| 426 | /* dp_reo_status_ring_handler - soc->reo_status_ring */ |
| 427 | grp_mask = &soc->wlan_cfg_ctx->int_reo_status_ring_mask[0]; |
| 428 | break; |
| 429 | |
| 430 | /* dp_rx_mon_status_srng_process - pdev->rxdma_mon_status_ring*/ |
| 431 | case RXDMA_MONITOR_STATUS: |
| 432 | /* dp_rx_mon_dest_process - pdev->rxdma_mon_dst_ring */ |
| 433 | case RXDMA_MONITOR_DST: |
| 434 | /* dp_mon_process */ |
| 435 | grp_mask = &soc->wlan_cfg_ctx->int_rx_mon_ring_mask[0]; |
| 436 | break; |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 437 | case RXDMA_DST: |
| 438 | /* dp_rxdma_err_process */ |
| 439 | grp_mask = &soc->wlan_cfg_ctx->int_rxdma2host_ring_mask[0]; |
| 440 | break; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 441 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 442 | case RXDMA_BUF: |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 443 | grp_mask = &soc->wlan_cfg_ctx->int_host2rxdma_ring_mask[0]; |
| 444 | break; |
| 445 | |
| 446 | case RXDMA_MONITOR_BUF: |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 447 | /* TODO: support low_thresh interrupt */ |
| 448 | return -QDF_STATUS_E_NOENT; |
| 449 | break; |
| 450 | |
| 451 | case TCL_DATA: |
| 452 | case TCL_CMD: |
| 453 | case REO_CMD: |
| 454 | case SW2WBM_RELEASE: |
| 455 | case WBM_IDLE_LINK: |
| 456 | /* normally empty SW_TO_HW rings */ |
| 457 | return -QDF_STATUS_E_NOENT; |
| 458 | break; |
| 459 | |
| 460 | case TCL_STATUS: |
| 461 | case REO_REINJECT: |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 462 | /* misc unused rings */ |
| 463 | return -QDF_STATUS_E_NOENT; |
| 464 | break; |
| 465 | |
| 466 | case CE_SRC: |
| 467 | case CE_DST: |
| 468 | case CE_DST_STATUS: |
| 469 | /* CE_rings - currently handled by hif */ |
| 470 | default: |
| 471 | return -QDF_STATUS_E_NOENT; |
| 472 | break; |
| 473 | } |
| 474 | |
| 475 | return dp_srng_find_ring_in_mask(ring_num, grp_mask); |
| 476 | } |
| 477 | |
| 478 | static void dp_srng_msi_setup(struct dp_soc *soc, struct hal_srng_params |
| 479 | *ring_params, int ring_type, int ring_num) |
| 480 | { |
| 481 | int msi_group_number; |
| 482 | int msi_data_count; |
| 483 | int ret; |
| 484 | uint32_t msi_data_start, msi_irq_start, addr_low, addr_high; |
| 485 | |
| 486 | ret = pld_get_user_msi_assignment(soc->osdev->dev, "DP", |
| 487 | &msi_data_count, &msi_data_start, |
| 488 | &msi_irq_start); |
| 489 | |
| 490 | if (ret) |
| 491 | return; |
| 492 | |
| 493 | msi_group_number = dp_srng_calculate_msi_group(soc, ring_type, |
| 494 | ring_num); |
| 495 | if (msi_group_number < 0) { |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 496 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 497 | FL("ring not part of an ext_group; ring_type: %d,ring_num %d"), |
| 498 | ring_type, ring_num); |
| 499 | ring_params->msi_addr = 0; |
| 500 | ring_params->msi_data = 0; |
| 501 | return; |
| 502 | } |
| 503 | |
| 504 | if (msi_group_number > msi_data_count) { |
| 505 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_WARN, |
| 506 | FL("2 msi_groups will share an msi; msi_group_num %d"), |
| 507 | msi_group_number); |
| 508 | |
| 509 | QDF_ASSERT(0); |
| 510 | } |
| 511 | |
| 512 | pld_get_msi_address(soc->osdev->dev, &addr_low, &addr_high); |
| 513 | |
| 514 | ring_params->msi_addr = addr_low; |
| 515 | ring_params->msi_addr |= (qdf_dma_addr_t)(((uint64_t)addr_high) << 32); |
| 516 | ring_params->msi_data = (msi_group_number % msi_data_count) |
| 517 | + msi_data_start; |
| 518 | ring_params->flags |= HAL_SRNG_MSI_INTR; |
| 519 | } |
| 520 | |
| 521 | /** |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 522 | * dp_print_ast_stats() - Dump AST table contents |
| 523 | * @soc: Datapath soc handle |
| 524 | * |
| 525 | * return void |
| 526 | */ |
| 527 | #ifdef FEATURE_WDS |
| 528 | static void dp_print_ast_stats(struct dp_soc *soc) |
| 529 | { |
| 530 | uint8_t i; |
| 531 | uint8_t num_entries = 0; |
| 532 | struct dp_vdev *vdev; |
| 533 | struct dp_pdev *pdev; |
| 534 | struct dp_peer *peer; |
| 535 | struct dp_ast_entry *ase, *tmp_ase; |
| 536 | |
| 537 | DP_PRINT_STATS("AST Stats:"); |
| 538 | DP_PRINT_STATS(" Entries Added = %d", soc->stats.ast.added); |
| 539 | DP_PRINT_STATS(" Entries Deleted = %d", soc->stats.ast.deleted); |
| 540 | DP_PRINT_STATS(" Entries Agedout = %d", soc->stats.ast.aged_out); |
| 541 | DP_PRINT_STATS("AST Table:"); |
| 542 | for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { |
| 543 | pdev = soc->pdev_list[i]; |
| 544 | DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) { |
| 545 | DP_VDEV_ITERATE_PEER_LIST(vdev, peer) { |
| 546 | DP_PEER_ITERATE_ASE_LIST(peer, ase, tmp_ase) { |
| 547 | DP_PRINT_STATS("%6d mac_addr = %pM" |
| 548 | " peer_mac_addr = %pM" |
| 549 | " type = %d" |
| 550 | " next_hop = %d" |
| 551 | " is_active = %d" |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 552 | " is_bss = %d" |
| 553 | " ast_idx = %d" |
| 554 | " pdev_id = %d" |
| 555 | " vdev_id = %d", |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 556 | ++num_entries, |
| 557 | ase->mac_addr.raw, |
| 558 | ase->peer->mac_addr.raw, |
| 559 | ase->type, |
| 560 | ase->next_hop, |
| 561 | ase->is_active, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 562 | ase->is_bss, |
| 563 | ase->ast_idx, |
| 564 | ase->pdev_id, |
| 565 | ase->vdev_id); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 566 | } |
| 567 | } |
| 568 | } |
| 569 | } |
| 570 | } |
| 571 | #else |
| 572 | static void dp_print_ast_stats(struct dp_soc *soc) |
| 573 | { |
| 574 | DP_PRINT_STATS("AST Stats not available.Enable FEATURE_WDS"); |
| 575 | return; |
| 576 | } |
| 577 | #endif |
| 578 | |
| 579 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 580 | * dp_setup_srng - Internal function to setup SRNG rings used by data path |
| 581 | */ |
| 582 | static int dp_srng_setup(struct dp_soc *soc, struct dp_srng *srng, |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 583 | int ring_type, int ring_num, int mac_id, uint32_t num_entries) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 584 | { |
| 585 | void *hal_soc = soc->hal_soc; |
| 586 | uint32_t entry_size = hal_srng_get_entrysize(hal_soc, ring_type); |
| 587 | /* TODO: See if we should get align size from hal */ |
| 588 | uint32_t ring_base_align = 8; |
| 589 | struct hal_srng_params ring_params; |
Karunakar Dasineni | d0ea21f | 2017-01-31 22:58:15 -0800 | [diff] [blame] | 590 | uint32_t max_entries = hal_srng_max_entries(hal_soc, ring_type); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 591 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 592 | /* TODO: Currently hal layer takes care of endianness related settings. |
| 593 | * See if these settings need to passed from DP layer |
| 594 | */ |
| 595 | ring_params.flags = 0; |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 596 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 597 | FL("Ring type: %d, num:%d"), ring_type, ring_num); |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 598 | |
Karunakar Dasineni | d0ea21f | 2017-01-31 22:58:15 -0800 | [diff] [blame] | 599 | num_entries = (num_entries > max_entries) ? max_entries : num_entries; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 600 | srng->hal_srng = NULL; |
| 601 | srng->alloc_size = (num_entries * entry_size) + ring_base_align - 1; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 602 | srng->num_entries = num_entries; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 603 | srng->base_vaddr_unaligned = qdf_mem_alloc_consistent( |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 604 | soc->osdev, soc->osdev->dev, srng->alloc_size, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 605 | &(srng->base_paddr_unaligned)); |
| 606 | |
| 607 | if (!srng->base_vaddr_unaligned) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 608 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 609 | FL("alloc failed - ring_type: %d, ring_num %d"), |
| 610 | ring_type, ring_num); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 611 | return QDF_STATUS_E_NOMEM; |
| 612 | } |
| 613 | |
| 614 | ring_params.ring_base_vaddr = srng->base_vaddr_unaligned + |
| 615 | ((unsigned long)srng->base_vaddr_unaligned % ring_base_align); |
| 616 | ring_params.ring_base_paddr = srng->base_paddr_unaligned + |
| 617 | ((unsigned long)(ring_params.ring_base_vaddr) - |
| 618 | (unsigned long)srng->base_vaddr_unaligned); |
| 619 | ring_params.num_entries = num_entries; |
| 620 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 621 | if (soc->intr_mode == DP_INTR_MSI) { |
| 622 | dp_srng_msi_setup(soc, &ring_params, ring_type, ring_num); |
| 623 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 624 | FL("Using MSI for ring_type: %d, ring_num %d"), |
| 625 | ring_type, ring_num); |
| 626 | |
| 627 | } else { |
| 628 | ring_params.msi_data = 0; |
| 629 | ring_params.msi_addr = 0; |
| 630 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 631 | FL("Skipping MSI for ring_type: %d, ring_num %d"), |
| 632 | ring_type, ring_num); |
| 633 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 634 | |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 635 | /* |
| 636 | * Setup interrupt timer and batch counter thresholds for |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 637 | * interrupt mitigation based on ring type |
| 638 | */ |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 639 | if (ring_type == REO_DST) { |
| 640 | ring_params.intr_timer_thres_us = |
| 641 | wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx); |
| 642 | ring_params.intr_batch_cntr_thres_entries = |
| 643 | wlan_cfg_get_int_batch_threshold_rx(soc->wlan_cfg_ctx); |
| 644 | } else if (ring_type == WBM2SW_RELEASE && (ring_num < 3)) { |
| 645 | ring_params.intr_timer_thres_us = |
| 646 | wlan_cfg_get_int_timer_threshold_tx(soc->wlan_cfg_ctx); |
| 647 | ring_params.intr_batch_cntr_thres_entries = |
| 648 | wlan_cfg_get_int_batch_threshold_tx(soc->wlan_cfg_ctx); |
| 649 | } else { |
| 650 | ring_params.intr_timer_thres_us = |
| 651 | wlan_cfg_get_int_timer_threshold_other(soc->wlan_cfg_ctx); |
| 652 | ring_params.intr_batch_cntr_thres_entries = |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 653 | wlan_cfg_get_int_batch_threshold_other(soc->wlan_cfg_ctx); |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 654 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 655 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 656 | /* Enable low threshold interrupts for rx buffer rings (regular and |
| 657 | * monitor buffer rings. |
| 658 | * TODO: See if this is required for any other ring |
| 659 | */ |
Karunakar Dasineni | 37995ac | 2018-02-06 12:37:30 -0800 | [diff] [blame] | 660 | if ((ring_type == RXDMA_BUF) || (ring_type == RXDMA_MONITOR_BUF) || |
| 661 | (ring_type == RXDMA_MONITOR_STATUS)) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 662 | /* TODO: Setting low threshold to 1/8th of ring size |
| 663 | * see if this needs to be configurable |
| 664 | */ |
| 665 | ring_params.low_threshold = num_entries >> 3; |
| 666 | ring_params.flags |= HAL_SRNG_LOW_THRES_INTR_ENABLE; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 667 | ring_params.intr_timer_thres_us = 0x1000; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 668 | } |
| 669 | |
| 670 | srng->hal_srng = hal_srng_setup(hal_soc, ring_type, ring_num, |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 671 | mac_id, &ring_params); |
Manoj Ekbote | 376116e | 2017-12-19 10:44:41 -0800 | [diff] [blame] | 672 | |
| 673 | if (!srng->hal_srng) { |
| 674 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
| 675 | srng->alloc_size, |
| 676 | srng->base_vaddr_unaligned, |
| 677 | srng->base_paddr_unaligned, 0); |
| 678 | } |
| 679 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 680 | return 0; |
| 681 | } |
| 682 | |
| 683 | /** |
| 684 | * dp_srng_cleanup - Internal function to cleanup SRNG rings used by data path |
| 685 | * Any buffers allocated and attached to ring entries are expected to be freed |
| 686 | * before calling this function. |
| 687 | */ |
| 688 | static void dp_srng_cleanup(struct dp_soc *soc, struct dp_srng *srng, |
| 689 | int ring_type, int ring_num) |
| 690 | { |
| 691 | if (!srng->hal_srng) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 692 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 693 | FL("Ring type: %d, num:%d not setup"), |
| 694 | ring_type, ring_num); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 695 | return; |
| 696 | } |
| 697 | |
| 698 | hal_srng_cleanup(soc->hal_soc, srng->hal_srng); |
| 699 | |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 700 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 701 | srng->alloc_size, |
| 702 | srng->base_vaddr_unaligned, |
| 703 | srng->base_paddr_unaligned, 0); |
Manoj Ekbote | 525bcab | 2017-09-01 17:23:32 -0700 | [diff] [blame] | 704 | srng->hal_srng = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 705 | } |
| 706 | |
| 707 | /* TODO: Need this interface from HIF */ |
| 708 | void *hif_get_hal_handle(void *hif_handle); |
| 709 | |
| 710 | /* |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 711 | * dp_service_srngs() - Top level interrupt handler for DP Ring interrupts |
| 712 | * @dp_ctx: DP SOC handle |
| 713 | * @budget: Number of frames/descriptors that can be processed in one shot |
| 714 | * |
| 715 | * Return: remaining budget/quota for the soc device |
| 716 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 717 | static uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 718 | { |
| 719 | struct dp_intr *int_ctx = (struct dp_intr *)dp_ctx; |
| 720 | struct dp_soc *soc = int_ctx->soc; |
| 721 | int ring = 0; |
| 722 | uint32_t work_done = 0; |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 723 | int budget = dp_budget; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 724 | uint8_t tx_mask = int_ctx->tx_ring_mask; |
| 725 | uint8_t rx_mask = int_ctx->rx_ring_mask; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 726 | uint8_t rx_err_mask = int_ctx->rx_err_ring_mask; |
| 727 | uint8_t rx_wbm_rel_mask = int_ctx->rx_wbm_rel_ring_mask; |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 728 | uint8_t reo_status_mask = int_ctx->reo_status_ring_mask; |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 729 | uint32_t remaining_quota = dp_budget; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 730 | struct dp_pdev *pdev = NULL; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 731 | |
| 732 | /* Process Tx completion interrupts first to return back buffers */ |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 733 | while (tx_mask) { |
| 734 | if (tx_mask & 0x1) { |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 735 | work_done = dp_tx_comp_handler(soc, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 736 | soc->tx_comp_ring[ring].hal_srng, |
| 737 | remaining_quota); |
| 738 | |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 739 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 740 | "tx mask 0x%x ring %d, budget %d, work_done %d", |
| 741 | tx_mask, ring, budget, work_done); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 742 | |
| 743 | budget -= work_done; |
| 744 | if (budget <= 0) |
| 745 | goto budget_done; |
| 746 | |
| 747 | remaining_quota = budget; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 748 | } |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 749 | tx_mask = tx_mask >> 1; |
| 750 | ring++; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 751 | } |
| 752 | |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 753 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 754 | /* Process REO Exception ring interrupt */ |
| 755 | if (rx_err_mask) { |
| 756 | work_done = dp_rx_err_process(soc, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 757 | soc->reo_exception_ring.hal_srng, |
| 758 | remaining_quota); |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 759 | |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 760 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 761 | "REO Exception Ring: work_done %d budget %d", |
| 762 | work_done, budget); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 763 | |
| 764 | budget -= work_done; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 765 | if (budget <= 0) { |
| 766 | goto budget_done; |
| 767 | } |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 768 | remaining_quota = budget; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 769 | } |
| 770 | |
| 771 | /* Process Rx WBM release ring interrupt */ |
| 772 | if (rx_wbm_rel_mask) { |
| 773 | work_done = dp_rx_wbm_err_process(soc, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 774 | soc->rx_rel_ring.hal_srng, remaining_quota); |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 775 | |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 776 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 777 | "WBM Release Ring: work_done %d budget %d", |
| 778 | work_done, budget); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 779 | |
| 780 | budget -= work_done; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 781 | if (budget <= 0) { |
| 782 | goto budget_done; |
| 783 | } |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 784 | remaining_quota = budget; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 785 | } |
| 786 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 787 | /* Process Rx interrupts */ |
| 788 | if (rx_mask) { |
| 789 | for (ring = 0; ring < soc->num_reo_dest_rings; ring++) { |
| 790 | if (rx_mask & (1 << ring)) { |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 791 | work_done = dp_rx_process(int_ctx, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 792 | soc->reo_dest_ring[ring].hal_srng, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 793 | remaining_quota); |
| 794 | |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 795 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 796 | "rx mask 0x%x ring %d, work_done %d budget %d", |
| 797 | rx_mask, ring, work_done, budget); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 798 | |
| 799 | budget -= work_done; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 800 | if (budget <= 0) |
| 801 | goto budget_done; |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 802 | remaining_quota = budget; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 803 | } |
| 804 | } |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 805 | for (ring = 0; ring < MAX_RX_MAC_RINGS; ring++) { |
| 806 | /* Need to check on this, why is required */ |
| 807 | work_done = dp_rxdma_err_process(soc, ring, |
| 808 | remaining_quota); |
| 809 | budget -= work_done; |
| 810 | } |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 811 | } |
| 812 | |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 813 | if (reo_status_mask) |
| 814 | dp_reo_status_ring_handler(soc); |
| 815 | |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 816 | /* Process LMAC interrupts */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 817 | for (ring = 0 ; ring < MAX_PDEV_CNT; ring++) { |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 818 | pdev = soc->pdev_list[ring]; |
| 819 | if (pdev == NULL) |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 820 | continue; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 821 | if (int_ctx->rx_mon_ring_mask & (1 << ring)) { |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 822 | work_done = dp_mon_process(soc, ring, remaining_quota); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 823 | budget -= work_done; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 824 | if (budget <= 0) |
| 825 | goto budget_done; |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 826 | remaining_quota = budget; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 827 | } |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 828 | |
| 829 | if (int_ctx->rxdma2host_ring_mask & (1 << ring)) { |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 830 | work_done = dp_rxdma_err_process(soc, ring, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 831 | remaining_quota); |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 832 | budget -= work_done; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 833 | if (budget <= 0) |
| 834 | goto budget_done; |
| 835 | remaining_quota = budget; |
| 836 | } |
| 837 | |
| 838 | if (int_ctx->host2rxdma_ring_mask & (1 << ring)) { |
| 839 | union dp_rx_desc_list_elem_t *desc_list = NULL; |
| 840 | union dp_rx_desc_list_elem_t *tail = NULL; |
| 841 | struct dp_srng *rx_refill_buf_ring = |
| 842 | &pdev->rx_refill_buf_ring; |
| 843 | |
| 844 | DP_STATS_INC(pdev, replenish.low_thresh_intrs, 1); |
| 845 | dp_rx_buffers_replenish(soc, ring, |
| 846 | rx_refill_buf_ring, |
| 847 | &soc->rx_desc_buf[ring], 0, |
| 848 | &desc_list, &tail, HAL_RX_BUF_RBM_SW3_BM); |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 849 | } |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 850 | } |
| 851 | |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 852 | qdf_lro_flush(int_ctx->lro_ctx); |
| 853 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 854 | budget_done: |
| 855 | return dp_budget - budget; |
| 856 | } |
| 857 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 858 | #ifdef DP_INTR_POLL_BASED |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 859 | /* dp_interrupt_timer()- timer poll for interrupts |
| 860 | * |
| 861 | * @arg: SoC Handle |
| 862 | * |
| 863 | * Return: |
| 864 | * |
| 865 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 866 | static void dp_interrupt_timer(void *arg) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 867 | { |
| 868 | struct dp_soc *soc = (struct dp_soc *) arg; |
| 869 | int i; |
| 870 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 871 | if (qdf_atomic_read(&soc->cmn_init_done)) { |
| 872 | for (i = 0; |
| 873 | i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) |
| 874 | dp_service_srngs(&soc->intr_ctx[i], 0xffff); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 875 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 876 | qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); |
| 877 | } |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 878 | } |
| 879 | |
| 880 | /* |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 881 | * dp_soc_interrupt_attach_poll() - Register handlers for DP interrupts |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 882 | * @txrx_soc: DP SOC handle |
| 883 | * |
| 884 | * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI |
| 885 | * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and |
| 886 | * rx_monitor_ring mask to indicate the rings that are processed by the handler. |
| 887 | * |
| 888 | * Return: 0 for success. nonzero for failure. |
| 889 | */ |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 890 | static QDF_STATUS dp_soc_interrupt_attach_poll(void *txrx_soc) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 891 | { |
| 892 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
| 893 | int i; |
| 894 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 895 | soc->intr_mode = DP_INTR_POLL; |
| 896 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 897 | for (i = 0; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) { |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 898 | soc->intr_ctx[i].dp_intr_id = i; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 899 | soc->intr_ctx[i].tx_ring_mask = |
| 900 | wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx, i); |
| 901 | soc->intr_ctx[i].rx_ring_mask = |
| 902 | wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx, i); |
| 903 | soc->intr_ctx[i].rx_mon_ring_mask = |
| 904 | wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, i); |
| 905 | soc->intr_ctx[i].rx_err_ring_mask = |
| 906 | wlan_cfg_get_rx_err_ring_mask(soc->wlan_cfg_ctx, i); |
| 907 | soc->intr_ctx[i].rx_wbm_rel_ring_mask = |
| 908 | wlan_cfg_get_rx_wbm_rel_ring_mask(soc->wlan_cfg_ctx, i); |
| 909 | soc->intr_ctx[i].reo_status_ring_mask = |
| 910 | wlan_cfg_get_reo_status_ring_mask(soc->wlan_cfg_ctx, i); |
| 911 | soc->intr_ctx[i].rxdma2host_ring_mask = |
| 912 | wlan_cfg_get_rxdma2host_ring_mask(soc->wlan_cfg_ctx, i); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 913 | soc->intr_ctx[i].soc = soc; |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 914 | soc->intr_ctx[i].lro_ctx = qdf_lro_init(); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 915 | } |
| 916 | |
| 917 | qdf_timer_init(soc->osdev, &soc->int_timer, |
| 918 | dp_interrupt_timer, (void *)soc, |
| 919 | QDF_TIMER_TYPE_WAKE_APPS); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 920 | |
| 921 | return QDF_STATUS_SUCCESS; |
| 922 | } |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 923 | |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 924 | #if defined(CONFIG_MCL) |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 925 | extern int con_mode_monitor; |
| 926 | static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc); |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 927 | /* |
| 928 | * dp_soc_interrupt_attach_wrapper() - Register handlers for DP interrupts |
| 929 | * @txrx_soc: DP SOC handle |
| 930 | * |
| 931 | * Call the appropriate attach function based on the mode of operation. |
| 932 | * This is a WAR for enabling monitor mode. |
| 933 | * |
| 934 | * Return: 0 for success. nonzero for failure. |
| 935 | */ |
| 936 | static QDF_STATUS dp_soc_interrupt_attach_wrapper(void *txrx_soc) |
| 937 | { |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 938 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
| 939 | |
| 940 | if (!(soc->wlan_cfg_ctx->napi_enabled) || |
| 941 | con_mode_monitor == QDF_GLOBAL_MONITOR_MODE) { |
Mohit Khanna | 9a6fdd5 | 2017-12-12 10:55:48 +0800 | [diff] [blame] | 942 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 943 | "%s: Poll mode", __func__); |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 944 | return dp_soc_interrupt_attach_poll(txrx_soc); |
| 945 | } else { |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 946 | |
Mohit Khanna | 9a6fdd5 | 2017-12-12 10:55:48 +0800 | [diff] [blame] | 947 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 948 | "%s: Interrupt mode", __func__); |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 949 | return dp_soc_interrupt_attach(txrx_soc); |
| 950 | } |
| 951 | } |
| 952 | #else |
| 953 | static QDF_STATUS dp_soc_interrupt_attach_wrapper(void *txrx_soc) |
| 954 | { |
| 955 | return dp_soc_interrupt_attach_poll(txrx_soc); |
| 956 | } |
| 957 | #endif |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 958 | #endif |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 959 | |
| 960 | static void dp_soc_interrupt_map_calculate_integrated(struct dp_soc *soc, |
| 961 | int intr_ctx_num, int *irq_id_map, int *num_irq_r) |
| 962 | { |
| 963 | int j; |
| 964 | int num_irq = 0; |
| 965 | |
| 966 | int tx_mask = |
| 967 | wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num); |
| 968 | int rx_mask = |
| 969 | wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num); |
| 970 | int rx_mon_mask = |
| 971 | wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num); |
| 972 | int rx_err_ring_mask = wlan_cfg_get_rx_err_ring_mask( |
| 973 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 974 | int rx_wbm_rel_ring_mask = wlan_cfg_get_rx_wbm_rel_ring_mask( |
| 975 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 976 | int reo_status_ring_mask = wlan_cfg_get_reo_status_ring_mask( |
| 977 | soc->wlan_cfg_ctx, intr_ctx_num); |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 978 | int rxdma2host_ring_mask = wlan_cfg_get_rxdma2host_ring_mask( |
| 979 | soc->wlan_cfg_ctx, intr_ctx_num); |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 980 | int host2rxdma_ring_mask = wlan_cfg_get_host2rxdma_ring_mask( |
| 981 | soc->wlan_cfg_ctx, intr_ctx_num); |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 982 | |
| 983 | for (j = 0; j < HIF_MAX_GRP_IRQ; j++) { |
| 984 | |
| 985 | if (tx_mask & (1 << j)) { |
| 986 | irq_id_map[num_irq++] = |
| 987 | (wbm2host_tx_completions_ring1 - j); |
| 988 | } |
| 989 | |
| 990 | if (rx_mask & (1 << j)) { |
| 991 | irq_id_map[num_irq++] = |
| 992 | (reo2host_destination_ring1 - j); |
| 993 | } |
| 994 | |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 995 | if (rxdma2host_ring_mask & (1 << j)) { |
| 996 | irq_id_map[num_irq++] = |
| 997 | rxdma2host_destination_ring_mac1 - |
| 998 | wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j); |
| 999 | } |
| 1000 | |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1001 | if (host2rxdma_ring_mask & (1 << j)) { |
| 1002 | irq_id_map[num_irq++] = |
| 1003 | host2rxdma_host_buf_ring_mac1 - |
| 1004 | wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j); |
| 1005 | } |
| 1006 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1007 | if (rx_mon_mask & (1 << j)) { |
| 1008 | irq_id_map[num_irq++] = |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1009 | ppdu_end_interrupts_mac1 - |
| 1010 | wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j); |
Karunakar Dasineni | 37995ac | 2018-02-06 12:37:30 -0800 | [diff] [blame] | 1011 | irq_id_map[num_irq++] = |
| 1012 | rxdma2host_monitor_status_ring_mac1 - |
| 1013 | wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j); |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1014 | } |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1015 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1016 | if (rx_wbm_rel_ring_mask & (1 << j)) |
| 1017 | irq_id_map[num_irq++] = wbm2host_rx_release; |
| 1018 | |
| 1019 | if (rx_err_ring_mask & (1 << j)) |
| 1020 | irq_id_map[num_irq++] = reo2host_exception; |
| 1021 | |
| 1022 | if (reo_status_ring_mask & (1 << j)) |
| 1023 | irq_id_map[num_irq++] = reo2host_status; |
| 1024 | |
| 1025 | } |
| 1026 | *num_irq_r = num_irq; |
| 1027 | } |
| 1028 | |
| 1029 | static void dp_soc_interrupt_map_calculate_msi(struct dp_soc *soc, |
| 1030 | int intr_ctx_num, int *irq_id_map, int *num_irq_r, |
| 1031 | int msi_vector_count, int msi_vector_start) |
| 1032 | { |
| 1033 | int tx_mask = wlan_cfg_get_tx_ring_mask( |
| 1034 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1035 | int rx_mask = wlan_cfg_get_rx_ring_mask( |
| 1036 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1037 | int rx_mon_mask = wlan_cfg_get_rx_mon_ring_mask( |
| 1038 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1039 | int rx_err_ring_mask = wlan_cfg_get_rx_err_ring_mask( |
| 1040 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1041 | int rx_wbm_rel_ring_mask = wlan_cfg_get_rx_wbm_rel_ring_mask( |
| 1042 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1043 | int reo_status_ring_mask = wlan_cfg_get_reo_status_ring_mask( |
| 1044 | soc->wlan_cfg_ctx, intr_ctx_num); |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1045 | int rxdma2host_ring_mask = wlan_cfg_get_rxdma2host_ring_mask( |
| 1046 | soc->wlan_cfg_ctx, intr_ctx_num); |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1047 | |
| 1048 | unsigned int vector = |
| 1049 | (intr_ctx_num % msi_vector_count) + msi_vector_start; |
| 1050 | int num_irq = 0; |
| 1051 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1052 | soc->intr_mode = DP_INTR_MSI; |
| 1053 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1054 | if (tx_mask | rx_mask | rx_mon_mask | rx_err_ring_mask | |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1055 | rx_wbm_rel_ring_mask | reo_status_ring_mask | rxdma2host_ring_mask) |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1056 | irq_id_map[num_irq++] = |
| 1057 | pld_get_msi_irq(soc->osdev->dev, vector); |
| 1058 | |
| 1059 | *num_irq_r = num_irq; |
| 1060 | } |
| 1061 | |
| 1062 | static void dp_soc_interrupt_map_calculate(struct dp_soc *soc, int intr_ctx_num, |
| 1063 | int *irq_id_map, int *num_irq) |
| 1064 | { |
| 1065 | int msi_vector_count, ret; |
| 1066 | uint32_t msi_base_data, msi_vector_start; |
| 1067 | |
| 1068 | ret = pld_get_user_msi_assignment(soc->osdev->dev, "DP", |
| 1069 | &msi_vector_count, |
| 1070 | &msi_base_data, |
| 1071 | &msi_vector_start); |
| 1072 | if (ret) |
| 1073 | return dp_soc_interrupt_map_calculate_integrated(soc, |
| 1074 | intr_ctx_num, irq_id_map, num_irq); |
| 1075 | |
| 1076 | else |
| 1077 | dp_soc_interrupt_map_calculate_msi(soc, |
| 1078 | intr_ctx_num, irq_id_map, num_irq, |
| 1079 | msi_vector_count, msi_vector_start); |
| 1080 | } |
| 1081 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1082 | /* |
| 1083 | * dp_soc_interrupt_attach() - Register handlers for DP interrupts |
| 1084 | * @txrx_soc: DP SOC handle |
| 1085 | * |
| 1086 | * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI |
| 1087 | * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and |
| 1088 | * rx_monitor_ring mask to indicate the rings that are processed by the handler. |
| 1089 | * |
| 1090 | * Return: 0 for success. nonzero for failure. |
| 1091 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 1092 | static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1093 | { |
| 1094 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
| 1095 | |
| 1096 | int i = 0; |
| 1097 | int num_irq = 0; |
| 1098 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1099 | for (i = 0; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) { |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1100 | int ret = 0; |
| 1101 | |
| 1102 | /* Map of IRQ ids registered with one interrupt context */ |
| 1103 | int irq_id_map[HIF_MAX_GRP_IRQ]; |
| 1104 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1105 | int tx_mask = |
| 1106 | wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx, i); |
| 1107 | int rx_mask = |
| 1108 | wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx, i); |
| 1109 | int rx_mon_mask = |
| 1110 | wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, i); |
Nandha Kishore Easwaran | 82ac62e | 2017-06-20 17:55:07 +0530 | [diff] [blame] | 1111 | int rx_err_ring_mask = |
| 1112 | wlan_cfg_get_rx_err_ring_mask(soc->wlan_cfg_ctx, i); |
| 1113 | int rx_wbm_rel_ring_mask = |
| 1114 | wlan_cfg_get_rx_wbm_rel_ring_mask(soc->wlan_cfg_ctx, i); |
| 1115 | int reo_status_ring_mask = |
| 1116 | wlan_cfg_get_reo_status_ring_mask(soc->wlan_cfg_ctx, i); |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 1117 | int rxdma2host_ring_mask = |
| 1118 | wlan_cfg_get_rxdma2host_ring_mask(soc->wlan_cfg_ctx, i); |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1119 | int host2rxdma_ring_mask = |
| 1120 | wlan_cfg_get_host2rxdma_ring_mask(soc->wlan_cfg_ctx, i); |
| 1121 | |
Pamidipati, Vijay | 3d8e1e8 | 2017-05-29 14:29:31 +0530 | [diff] [blame] | 1122 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1123 | soc->intr_ctx[i].dp_intr_id = i; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1124 | soc->intr_ctx[i].tx_ring_mask = tx_mask; |
| 1125 | soc->intr_ctx[i].rx_ring_mask = rx_mask; |
| 1126 | soc->intr_ctx[i].rx_mon_ring_mask = rx_mon_mask; |
Pamidipati, Vijay | 3d8e1e8 | 2017-05-29 14:29:31 +0530 | [diff] [blame] | 1127 | soc->intr_ctx[i].rx_err_ring_mask = rx_err_ring_mask; |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 1128 | soc->intr_ctx[i].rxdma2host_ring_mask = rxdma2host_ring_mask; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1129 | soc->intr_ctx[i].host2rxdma_ring_mask = host2rxdma_ring_mask; |
Pamidipati, Vijay | 3d8e1e8 | 2017-05-29 14:29:31 +0530 | [diff] [blame] | 1130 | soc->intr_ctx[i].rx_wbm_rel_ring_mask = rx_wbm_rel_ring_mask; |
| 1131 | soc->intr_ctx[i].reo_status_ring_mask = reo_status_ring_mask; |
| 1132 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1133 | soc->intr_ctx[i].soc = soc; |
| 1134 | |
| 1135 | num_irq = 0; |
| 1136 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1137 | dp_soc_interrupt_map_calculate(soc, i, &irq_id_map[0], |
| 1138 | &num_irq); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1139 | |
Houston Hoffman | def86a3 | 2017-04-21 20:23:45 -0700 | [diff] [blame] | 1140 | ret = hif_register_ext_group(soc->hif_handle, |
| 1141 | num_irq, irq_id_map, dp_service_srngs, |
| 1142 | &soc->intr_ctx[i], "dp_intr", |
chenguo | f254886 | 2017-11-08 16:33:25 +0800 | [diff] [blame] | 1143 | HIF_EXEC_NAPI_TYPE, QCA_NAPI_DEF_SCALE_BIN_SHIFT); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1144 | |
| 1145 | if (ret) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1146 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1147 | FL("failed, ret = %d"), ret); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1148 | |
| 1149 | return QDF_STATUS_E_FAILURE; |
| 1150 | } |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 1151 | soc->intr_ctx[i].lro_ctx = qdf_lro_init(); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1152 | } |
| 1153 | |
Venkateswara Swamy Bandaru | 19dc8b2 | 2017-03-13 15:09:24 +0530 | [diff] [blame] | 1154 | hif_configure_ext_group_interrupts(soc->hif_handle); |
| 1155 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1156 | return QDF_STATUS_SUCCESS; |
| 1157 | } |
| 1158 | |
| 1159 | /* |
| 1160 | * dp_soc_interrupt_detach() - Deregister any allocations done for interrupts |
| 1161 | * @txrx_soc: DP SOC handle |
| 1162 | * |
| 1163 | * Return: void |
| 1164 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 1165 | static void dp_soc_interrupt_detach(void *txrx_soc) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1166 | { |
| 1167 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1168 | int i; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1169 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1170 | if (soc->intr_mode == DP_INTR_POLL) { |
| 1171 | qdf_timer_stop(&soc->int_timer); |
| 1172 | qdf_timer_free(&soc->int_timer); |
psimha | a079b8c | 2017-08-02 17:27:14 -0700 | [diff] [blame] | 1173 | } else { |
| 1174 | hif_deregister_exec_group(soc->hif_handle, "dp_intr"); |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1175 | } |
| 1176 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1177 | for (i = 0; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) { |
| 1178 | soc->intr_ctx[i].tx_ring_mask = 0; |
| 1179 | soc->intr_ctx[i].rx_ring_mask = 0; |
| 1180 | soc->intr_ctx[i].rx_mon_ring_mask = 0; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1181 | soc->intr_ctx[i].rx_err_ring_mask = 0; |
| 1182 | soc->intr_ctx[i].rx_wbm_rel_ring_mask = 0; |
| 1183 | soc->intr_ctx[i].reo_status_ring_mask = 0; |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1184 | soc->intr_ctx[i].rxdma2host_ring_mask = 0; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1185 | soc->intr_ctx[i].host2rxdma_ring_mask = 0; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1186 | |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 1187 | qdf_lro_deinit(soc->intr_ctx[i].lro_ctx); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1188 | } |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1189 | } |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1190 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1191 | #define AVG_MAX_MPDUS_PER_TID 128 |
| 1192 | #define AVG_TIDS_PER_CLIENT 2 |
| 1193 | #define AVG_FLOWS_PER_TID 2 |
| 1194 | #define AVG_MSDUS_PER_FLOW 128 |
| 1195 | #define AVG_MSDUS_PER_MPDU 4 |
| 1196 | |
| 1197 | /* |
| 1198 | * Allocate and setup link descriptor pool that will be used by HW for |
| 1199 | * various link and queue descriptors and managed by WBM |
| 1200 | */ |
| 1201 | static int dp_hw_link_desc_pool_setup(struct dp_soc *soc) |
| 1202 | { |
| 1203 | int link_desc_size = hal_get_link_desc_size(soc->hal_soc); |
| 1204 | int link_desc_align = hal_get_link_desc_align(soc->hal_soc); |
| 1205 | uint32_t max_clients = wlan_cfg_get_max_clients(soc->wlan_cfg_ctx); |
| 1206 | uint32_t num_mpdus_per_link_desc = |
| 1207 | hal_num_mpdus_per_link_desc(soc->hal_soc); |
| 1208 | uint32_t num_msdus_per_link_desc = |
| 1209 | hal_num_msdus_per_link_desc(soc->hal_soc); |
| 1210 | uint32_t num_mpdu_links_per_queue_desc = |
| 1211 | hal_num_mpdu_links_per_queue_desc(soc->hal_soc); |
| 1212 | uint32_t max_alloc_size = wlan_cfg_max_alloc_size(soc->wlan_cfg_ctx); |
| 1213 | uint32_t total_link_descs, total_mem_size; |
| 1214 | uint32_t num_mpdu_link_descs, num_mpdu_queue_descs; |
| 1215 | uint32_t num_tx_msdu_link_descs, num_rx_msdu_link_descs; |
| 1216 | uint32_t num_link_desc_banks; |
| 1217 | uint32_t last_bank_size = 0; |
| 1218 | uint32_t entry_size, num_entries; |
| 1219 | int i; |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1220 | uint32_t desc_id = 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1221 | |
| 1222 | /* Only Tx queue descriptors are allocated from common link descriptor |
| 1223 | * pool Rx queue descriptors are not included in this because (REO queue |
| 1224 | * extension descriptors) they are expected to be allocated contiguously |
| 1225 | * with REO queue descriptors |
| 1226 | */ |
| 1227 | num_mpdu_link_descs = (max_clients * AVG_TIDS_PER_CLIENT * |
| 1228 | AVG_MAX_MPDUS_PER_TID) / num_mpdus_per_link_desc; |
| 1229 | |
| 1230 | num_mpdu_queue_descs = num_mpdu_link_descs / |
| 1231 | num_mpdu_links_per_queue_desc; |
| 1232 | |
| 1233 | num_tx_msdu_link_descs = (max_clients * AVG_TIDS_PER_CLIENT * |
| 1234 | AVG_FLOWS_PER_TID * AVG_MSDUS_PER_FLOW) / |
| 1235 | num_msdus_per_link_desc; |
| 1236 | |
| 1237 | num_rx_msdu_link_descs = (max_clients * AVG_TIDS_PER_CLIENT * |
| 1238 | AVG_MAX_MPDUS_PER_TID * AVG_MSDUS_PER_MPDU) / 6; |
| 1239 | |
| 1240 | num_entries = num_mpdu_link_descs + num_mpdu_queue_descs + |
| 1241 | num_tx_msdu_link_descs + num_rx_msdu_link_descs; |
| 1242 | |
| 1243 | /* Round up to power of 2 */ |
| 1244 | total_link_descs = 1; |
| 1245 | while (total_link_descs < num_entries) |
| 1246 | total_link_descs <<= 1; |
| 1247 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1248 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
| 1249 | FL("total_link_descs: %u, link_desc_size: %d"), |
| 1250 | total_link_descs, link_desc_size); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1251 | total_mem_size = total_link_descs * link_desc_size; |
| 1252 | |
| 1253 | total_mem_size += link_desc_align; |
| 1254 | |
| 1255 | if (total_mem_size <= max_alloc_size) { |
| 1256 | num_link_desc_banks = 0; |
| 1257 | last_bank_size = total_mem_size; |
| 1258 | } else { |
| 1259 | num_link_desc_banks = (total_mem_size) / |
| 1260 | (max_alloc_size - link_desc_align); |
| 1261 | last_bank_size = total_mem_size % |
| 1262 | (max_alloc_size - link_desc_align); |
| 1263 | } |
| 1264 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1265 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
| 1266 | FL("total_mem_size: %d, num_link_desc_banks: %u"), |
| 1267 | total_mem_size, num_link_desc_banks); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1268 | |
| 1269 | for (i = 0; i < num_link_desc_banks; i++) { |
| 1270 | soc->link_desc_banks[i].base_vaddr_unaligned = |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1271 | qdf_mem_alloc_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1272 | max_alloc_size, |
| 1273 | &(soc->link_desc_banks[i].base_paddr_unaligned)); |
| 1274 | soc->link_desc_banks[i].size = max_alloc_size; |
| 1275 | |
| 1276 | soc->link_desc_banks[i].base_vaddr = (void *)((unsigned long)( |
| 1277 | soc->link_desc_banks[i].base_vaddr_unaligned) + |
| 1278 | ((unsigned long)( |
| 1279 | soc->link_desc_banks[i].base_vaddr_unaligned) % |
| 1280 | link_desc_align)); |
| 1281 | |
| 1282 | soc->link_desc_banks[i].base_paddr = (unsigned long)( |
| 1283 | soc->link_desc_banks[i].base_paddr_unaligned) + |
| 1284 | ((unsigned long)(soc->link_desc_banks[i].base_vaddr) - |
| 1285 | (unsigned long)( |
| 1286 | soc->link_desc_banks[i].base_vaddr_unaligned)); |
| 1287 | |
| 1288 | if (!soc->link_desc_banks[i].base_vaddr_unaligned) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1289 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1290 | FL("Link descriptor memory alloc failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1291 | goto fail; |
| 1292 | } |
| 1293 | } |
| 1294 | |
| 1295 | if (last_bank_size) { |
| 1296 | /* Allocate last bank in case total memory required is not exact |
| 1297 | * multiple of max_alloc_size |
| 1298 | */ |
| 1299 | soc->link_desc_banks[i].base_vaddr_unaligned = |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1300 | qdf_mem_alloc_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1301 | last_bank_size, |
| 1302 | &(soc->link_desc_banks[i].base_paddr_unaligned)); |
| 1303 | soc->link_desc_banks[i].size = last_bank_size; |
| 1304 | |
| 1305 | soc->link_desc_banks[i].base_vaddr = (void *)((unsigned long) |
| 1306 | (soc->link_desc_banks[i].base_vaddr_unaligned) + |
| 1307 | ((unsigned long)( |
| 1308 | soc->link_desc_banks[i].base_vaddr_unaligned) % |
| 1309 | link_desc_align)); |
| 1310 | |
| 1311 | soc->link_desc_banks[i].base_paddr = |
| 1312 | (unsigned long)( |
| 1313 | soc->link_desc_banks[i].base_paddr_unaligned) + |
| 1314 | ((unsigned long)(soc->link_desc_banks[i].base_vaddr) - |
| 1315 | (unsigned long)( |
| 1316 | soc->link_desc_banks[i].base_vaddr_unaligned)); |
| 1317 | } |
| 1318 | |
| 1319 | |
| 1320 | /* Allocate and setup link descriptor idle list for HW internal use */ |
| 1321 | entry_size = hal_srng_get_entrysize(soc->hal_soc, WBM_IDLE_LINK); |
| 1322 | total_mem_size = entry_size * total_link_descs; |
| 1323 | |
| 1324 | if (total_mem_size <= max_alloc_size) { |
| 1325 | void *desc; |
| 1326 | |
| 1327 | if (dp_srng_setup(soc, &soc->wbm_idle_link_ring, |
| 1328 | WBM_IDLE_LINK, 0, 0, total_link_descs)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1329 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1330 | FL("Link desc idle ring setup failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1331 | goto fail; |
| 1332 | } |
| 1333 | |
| 1334 | hal_srng_access_start_unlocked(soc->hal_soc, |
| 1335 | soc->wbm_idle_link_ring.hal_srng); |
| 1336 | |
| 1337 | for (i = 0; i < MAX_LINK_DESC_BANKS && |
| 1338 | soc->link_desc_banks[i].base_paddr; i++) { |
| 1339 | uint32_t num_entries = (soc->link_desc_banks[i].size - |
Karunakar Dasineni | c45b01e | 2017-06-07 11:38:01 -0700 | [diff] [blame] | 1340 | ((unsigned long)( |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1341 | soc->link_desc_banks[i].base_vaddr) - |
| 1342 | (unsigned long)( |
Karunakar Dasineni | c45b01e | 2017-06-07 11:38:01 -0700 | [diff] [blame] | 1343 | soc->link_desc_banks[i].base_vaddr_unaligned))) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1344 | / link_desc_size; |
| 1345 | unsigned long paddr = (unsigned long)( |
| 1346 | soc->link_desc_banks[i].base_paddr); |
| 1347 | |
| 1348 | while (num_entries && (desc = hal_srng_src_get_next( |
| 1349 | soc->hal_soc, |
| 1350 | soc->wbm_idle_link_ring.hal_srng))) { |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1351 | hal_set_link_desc_addr(desc, |
| 1352 | LINK_DESC_COOKIE(desc_id, i), paddr); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1353 | num_entries--; |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1354 | desc_id++; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1355 | paddr += link_desc_size; |
| 1356 | } |
| 1357 | } |
| 1358 | hal_srng_access_end_unlocked(soc->hal_soc, |
| 1359 | soc->wbm_idle_link_ring.hal_srng); |
| 1360 | } else { |
| 1361 | uint32_t num_scatter_bufs; |
| 1362 | uint32_t num_entries_per_buf; |
| 1363 | uint32_t rem_entries; |
| 1364 | uint8_t *scatter_buf_ptr; |
| 1365 | uint16_t scatter_buf_num; |
| 1366 | |
| 1367 | soc->wbm_idle_scatter_buf_size = |
| 1368 | hal_idle_list_scatter_buf_size(soc->hal_soc); |
| 1369 | num_entries_per_buf = hal_idle_scatter_buf_num_entries( |
| 1370 | soc->hal_soc, soc->wbm_idle_scatter_buf_size); |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1371 | num_scatter_bufs = hal_idle_list_num_scatter_bufs( |
| 1372 | soc->hal_soc, total_mem_size, |
| 1373 | soc->wbm_idle_scatter_buf_size); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1374 | |
| 1375 | for (i = 0; i < num_scatter_bufs; i++) { |
| 1376 | soc->wbm_idle_scatter_buf_base_vaddr[i] = |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1377 | qdf_mem_alloc_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1378 | soc->wbm_idle_scatter_buf_size, |
| 1379 | &(soc->wbm_idle_scatter_buf_base_paddr[i])); |
| 1380 | if (soc->wbm_idle_scatter_buf_base_vaddr[i] == NULL) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1381 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1382 | QDF_TRACE_LEVEL_ERROR, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1383 | FL("Scatter list memory alloc failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1384 | goto fail; |
| 1385 | } |
| 1386 | } |
| 1387 | |
| 1388 | /* Populate idle list scatter buffers with link descriptor |
| 1389 | * pointers |
| 1390 | */ |
| 1391 | scatter_buf_num = 0; |
| 1392 | scatter_buf_ptr = (uint8_t *)( |
| 1393 | soc->wbm_idle_scatter_buf_base_vaddr[scatter_buf_num]); |
| 1394 | rem_entries = num_entries_per_buf; |
| 1395 | |
| 1396 | for (i = 0; i < MAX_LINK_DESC_BANKS && |
| 1397 | soc->link_desc_banks[i].base_paddr; i++) { |
| 1398 | uint32_t num_link_descs = |
| 1399 | (soc->link_desc_banks[i].size - |
Karunakar Dasineni | c45b01e | 2017-06-07 11:38:01 -0700 | [diff] [blame] | 1400 | ((unsigned long)( |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1401 | soc->link_desc_banks[i].base_vaddr) - |
| 1402 | (unsigned long)( |
Karunakar Dasineni | c45b01e | 2017-06-07 11:38:01 -0700 | [diff] [blame] | 1403 | soc->link_desc_banks[i].base_vaddr_unaligned))) |
| 1404 | / link_desc_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1405 | unsigned long paddr = (unsigned long)( |
| 1406 | soc->link_desc_banks[i].base_paddr); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1407 | |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1408 | while (num_link_descs) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1409 | hal_set_link_desc_addr((void *)scatter_buf_ptr, |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1410 | LINK_DESC_COOKIE(desc_id, i), paddr); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1411 | num_link_descs--; |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1412 | desc_id++; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1413 | paddr += link_desc_size; |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1414 | rem_entries--; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1415 | if (rem_entries) { |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1416 | scatter_buf_ptr += entry_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1417 | } else { |
| 1418 | rem_entries = num_entries_per_buf; |
| 1419 | scatter_buf_num++; |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1420 | |
| 1421 | if (scatter_buf_num >= num_scatter_bufs) |
| 1422 | break; |
| 1423 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1424 | scatter_buf_ptr = (uint8_t *)( |
| 1425 | soc->wbm_idle_scatter_buf_base_vaddr[ |
| 1426 | scatter_buf_num]); |
| 1427 | } |
| 1428 | } |
| 1429 | } |
| 1430 | /* Setup link descriptor idle list in HW */ |
| 1431 | hal_setup_link_idle_list(soc->hal_soc, |
| 1432 | soc->wbm_idle_scatter_buf_base_paddr, |
| 1433 | soc->wbm_idle_scatter_buf_base_vaddr, |
| 1434 | num_scatter_bufs, soc->wbm_idle_scatter_buf_size, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1435 | (uint32_t)(scatter_buf_ptr - |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1436 | (uint8_t *)(soc->wbm_idle_scatter_buf_base_vaddr[ |
| 1437 | scatter_buf_num-1])), total_link_descs); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1438 | } |
| 1439 | return 0; |
| 1440 | |
| 1441 | fail: |
| 1442 | if (soc->wbm_idle_link_ring.hal_srng) { |
| 1443 | dp_srng_cleanup(soc->hal_soc, &soc->wbm_idle_link_ring, |
| 1444 | WBM_IDLE_LINK, 0); |
| 1445 | } |
| 1446 | |
| 1447 | for (i = 0; i < MAX_IDLE_SCATTER_BUFS; i++) { |
| 1448 | if (soc->wbm_idle_scatter_buf_base_vaddr[i]) { |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1449 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1450 | soc->wbm_idle_scatter_buf_size, |
| 1451 | soc->wbm_idle_scatter_buf_base_vaddr[i], |
| 1452 | soc->wbm_idle_scatter_buf_base_paddr[i], 0); |
Karunakar Dasineni | b71ad04 | 2018-01-22 16:50:20 -0800 | [diff] [blame] | 1453 | soc->wbm_idle_scatter_buf_base_vaddr[i] = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1454 | } |
| 1455 | } |
| 1456 | |
| 1457 | for (i = 0; i < MAX_LINK_DESC_BANKS; i++) { |
| 1458 | if (soc->link_desc_banks[i].base_vaddr_unaligned) { |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1459 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1460 | soc->link_desc_banks[i].size, |
| 1461 | soc->link_desc_banks[i].base_vaddr_unaligned, |
| 1462 | soc->link_desc_banks[i].base_paddr_unaligned, |
| 1463 | 0); |
Karunakar Dasineni | b71ad04 | 2018-01-22 16:50:20 -0800 | [diff] [blame] | 1464 | soc->link_desc_banks[i].base_vaddr_unaligned = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1465 | } |
| 1466 | } |
| 1467 | return QDF_STATUS_E_FAILURE; |
| 1468 | } |
| 1469 | |
| 1470 | /* |
| 1471 | * Free link descriptor pool that was setup HW |
| 1472 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 1473 | static void dp_hw_link_desc_pool_cleanup(struct dp_soc *soc) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1474 | { |
| 1475 | int i; |
| 1476 | |
| 1477 | if (soc->wbm_idle_link_ring.hal_srng) { |
Manoj Ekbote | 525bcab | 2017-09-01 17:23:32 -0700 | [diff] [blame] | 1478 | dp_srng_cleanup(soc, &soc->wbm_idle_link_ring, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1479 | WBM_IDLE_LINK, 0); |
| 1480 | } |
| 1481 | |
| 1482 | for (i = 0; i < MAX_IDLE_SCATTER_BUFS; i++) { |
| 1483 | if (soc->wbm_idle_scatter_buf_base_vaddr[i]) { |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1484 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1485 | soc->wbm_idle_scatter_buf_size, |
| 1486 | soc->wbm_idle_scatter_buf_base_vaddr[i], |
| 1487 | soc->wbm_idle_scatter_buf_base_paddr[i], 0); |
Karunakar Dasineni | b71ad04 | 2018-01-22 16:50:20 -0800 | [diff] [blame] | 1488 | soc->wbm_idle_scatter_buf_base_vaddr[i] = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1489 | } |
| 1490 | } |
| 1491 | |
| 1492 | for (i = 0; i < MAX_LINK_DESC_BANKS; i++) { |
| 1493 | if (soc->link_desc_banks[i].base_vaddr_unaligned) { |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1494 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1495 | soc->link_desc_banks[i].size, |
| 1496 | soc->link_desc_banks[i].base_vaddr_unaligned, |
| 1497 | soc->link_desc_banks[i].base_paddr_unaligned, |
| 1498 | 0); |
Karunakar Dasineni | b71ad04 | 2018-01-22 16:50:20 -0800 | [diff] [blame] | 1499 | soc->link_desc_banks[i].base_vaddr_unaligned = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1500 | } |
| 1501 | } |
| 1502 | } |
| 1503 | |
| 1504 | /* TODO: Following should be configurable */ |
| 1505 | #define WBM_RELEASE_RING_SIZE 64 |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1506 | #define TCL_CMD_RING_SIZE 32 |
| 1507 | #define TCL_STATUS_RING_SIZE 32 |
Ajit Pal Singh | d27d746 | 2017-07-07 17:17:43 +0530 | [diff] [blame] | 1508 | #if defined(QCA_WIFI_QCA6290) |
| 1509 | #define REO_DST_RING_SIZE 1024 |
| 1510 | #else |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1511 | #define REO_DST_RING_SIZE 2048 |
Ajit Pal Singh | d27d746 | 2017-07-07 17:17:43 +0530 | [diff] [blame] | 1512 | #endif |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1513 | #define REO_REINJECT_RING_SIZE 32 |
Karunakar Dasineni | d0ea21f | 2017-01-31 22:58:15 -0800 | [diff] [blame] | 1514 | #define RX_RELEASE_RING_SIZE 1024 |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1515 | #define REO_EXCEPTION_RING_SIZE 128 |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1516 | #define REO_CMD_RING_SIZE 64 |
| 1517 | #define REO_STATUS_RING_SIZE 128 |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 1518 | #define RXDMA_BUF_RING_SIZE 1024 |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1519 | #define RXDMA_REFILL_RING_SIZE 4096 |
Kai Chen | ad516ae | 2017-09-08 18:35:47 -0700 | [diff] [blame] | 1520 | #define RXDMA_MONITOR_BUF_RING_SIZE 4096 |
| 1521 | #define RXDMA_MONITOR_DST_RING_SIZE 2048 |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1522 | #define RXDMA_MONITOR_STATUS_RING_SIZE 1024 |
Karunakar Dasineni | 37995ac | 2018-02-06 12:37:30 -0800 | [diff] [blame] | 1523 | #define RXDMA_MONITOR_DESC_RING_SIZE 4096 |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 1524 | #define RXDMA_ERR_DST_RING_SIZE 1024 |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1525 | |
| 1526 | /* |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1527 | * dp_wds_aging_timer_fn() - Timer callback function for WDS aging |
| 1528 | * @soc: Datapath SOC handle |
| 1529 | * |
| 1530 | * This is a timer function used to age out stale WDS nodes from |
| 1531 | * AST table |
| 1532 | */ |
| 1533 | #ifdef FEATURE_WDS |
| 1534 | static void dp_wds_aging_timer_fn(void *soc_hdl) |
| 1535 | { |
| 1536 | struct dp_soc *soc = (struct dp_soc *) soc_hdl; |
| 1537 | struct dp_pdev *pdev; |
| 1538 | struct dp_vdev *vdev; |
| 1539 | struct dp_peer *peer; |
Tallapragada Kalyan | 1c14d5d | 2017-07-26 00:31:35 +0530 | [diff] [blame] | 1540 | struct dp_ast_entry *ase, *temp_ase; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1541 | int i; |
| 1542 | |
| 1543 | qdf_spin_lock_bh(&soc->ast_lock); |
| 1544 | |
| 1545 | for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { |
| 1546 | pdev = soc->pdev_list[i]; |
| 1547 | DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) { |
| 1548 | DP_VDEV_ITERATE_PEER_LIST(vdev, peer) { |
Tallapragada Kalyan | 1c14d5d | 2017-07-26 00:31:35 +0530 | [diff] [blame] | 1549 | DP_PEER_ITERATE_ASE_LIST(peer, ase, temp_ase) { |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1550 | /* |
| 1551 | * Do not expire static ast entries |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 1552 | * and HM WDS entries |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1553 | */ |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 1554 | if (ase->type == |
| 1555 | CDP_TXRX_AST_TYPE_STATIC || |
| 1556 | ase->type == |
| 1557 | CDP_TXRX_AST_TYPE_WDS_HM) |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1558 | continue; |
| 1559 | |
| 1560 | if (ase->is_active) { |
| 1561 | ase->is_active = FALSE; |
| 1562 | continue; |
| 1563 | } |
| 1564 | |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 1565 | DP_STATS_INC(soc, ast.aged_out, 1); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1566 | dp_peer_del_ast(soc, ase); |
| 1567 | } |
| 1568 | } |
| 1569 | } |
| 1570 | |
| 1571 | } |
| 1572 | |
| 1573 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 1574 | |
| 1575 | if (qdf_atomic_read(&soc->cmn_init_done)) |
| 1576 | qdf_timer_mod(&soc->wds_aging_timer, DP_WDS_AGING_TIMER_DEFAULT_MS); |
| 1577 | } |
| 1578 | |
| 1579 | /* |
| 1580 | * dp_soc_wds_attach() - Setup WDS timer and AST table |
| 1581 | * @soc: Datapath SOC handle |
| 1582 | * |
| 1583 | * Return: None |
| 1584 | */ |
| 1585 | static void dp_soc_wds_attach(struct dp_soc *soc) |
| 1586 | { |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1587 | qdf_timer_init(soc->osdev, &soc->wds_aging_timer, |
| 1588 | dp_wds_aging_timer_fn, (void *)soc, |
| 1589 | QDF_TIMER_TYPE_WAKE_APPS); |
| 1590 | |
| 1591 | qdf_timer_mod(&soc->wds_aging_timer, DP_WDS_AGING_TIMER_DEFAULT_MS); |
| 1592 | } |
| 1593 | |
| 1594 | /* |
| 1595 | * dp_soc_wds_detach() - Detach WDS data structures and timers |
| 1596 | * @txrx_soc: DP SOC handle |
| 1597 | * |
| 1598 | * Return: None |
| 1599 | */ |
| 1600 | static void dp_soc_wds_detach(struct dp_soc *soc) |
| 1601 | { |
| 1602 | qdf_timer_stop(&soc->wds_aging_timer); |
| 1603 | qdf_timer_free(&soc->wds_aging_timer); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1604 | } |
| 1605 | #else |
| 1606 | static void dp_soc_wds_attach(struct dp_soc *soc) |
| 1607 | { |
| 1608 | } |
| 1609 | |
| 1610 | static void dp_soc_wds_detach(struct dp_soc *soc) |
| 1611 | { |
| 1612 | } |
| 1613 | #endif |
| 1614 | |
| 1615 | /* |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 1616 | * dp_soc_reset_ring_map() - Reset cpu ring map |
| 1617 | * @soc: Datapath soc handler |
| 1618 | * |
| 1619 | * This api resets the default cpu ring map |
| 1620 | */ |
| 1621 | |
| 1622 | static void dp_soc_reset_cpu_ring_map(struct dp_soc *soc) |
| 1623 | { |
| 1624 | uint8_t i; |
| 1625 | int nss_config = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); |
| 1626 | |
| 1627 | for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { |
| 1628 | if (nss_config == 1) { |
| 1629 | /* |
| 1630 | * Setting Tx ring map for one nss offloaded radio |
| 1631 | */ |
| 1632 | soc->tx_ring_map[i] = dp_cpu_ring_map[DP_NSS_FIRST_RADIO_OFFLOADED_MAP][i]; |
| 1633 | } else if (nss_config == 2) { |
| 1634 | /* |
| 1635 | * Setting Tx ring for two nss offloaded radios |
| 1636 | */ |
| 1637 | soc->tx_ring_map[i] = dp_cpu_ring_map[DP_NSS_SECOND_RADIO_OFFLOADED_MAP][i]; |
| 1638 | } else { |
| 1639 | /* |
| 1640 | * Setting Tx ring map for all nss offloaded radios |
| 1641 | */ |
| 1642 | soc->tx_ring_map[i] = dp_cpu_ring_map[DP_NSS_ALL_RADIO_OFFLOADED_MAP][i]; |
| 1643 | } |
| 1644 | } |
| 1645 | } |
| 1646 | |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 1647 | /* |
| 1648 | * dp_soc_ring_if_nss_offloaded() - find if ring is offloaded to NSS |
| 1649 | * @dp_soc - DP soc handle |
| 1650 | * @ring_type - ring type |
| 1651 | * @ring_num - ring_num |
| 1652 | * |
| 1653 | * return 0 or 1 |
| 1654 | */ |
| 1655 | static uint8_t dp_soc_ring_if_nss_offloaded(struct dp_soc *soc, enum hal_ring_type ring_type, int ring_num) |
| 1656 | { |
| 1657 | uint8_t nss_config = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); |
| 1658 | uint8_t status = 0; |
| 1659 | |
| 1660 | switch (ring_type) { |
| 1661 | case WBM2SW_RELEASE: |
| 1662 | case REO_DST: |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1663 | case RXDMA_BUF: |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 1664 | status = ((nss_config) & (1 << ring_num)); |
| 1665 | break; |
| 1666 | default: |
| 1667 | break; |
| 1668 | } |
| 1669 | |
| 1670 | return status; |
| 1671 | } |
| 1672 | |
| 1673 | /* |
| 1674 | * dp_soc_reset_intr_mask() - reset interrupt mask |
| 1675 | * @dp_soc - DP Soc handle |
| 1676 | * |
| 1677 | * Return: Return void |
| 1678 | */ |
| 1679 | static void dp_soc_reset_intr_mask(struct dp_soc *soc) |
| 1680 | { |
| 1681 | uint8_t j; |
| 1682 | int *grp_mask = NULL; |
| 1683 | int group_number, mask, num_ring; |
| 1684 | |
| 1685 | /* number of tx ring */ |
| 1686 | num_ring = wlan_cfg_num_tcl_data_rings(soc->wlan_cfg_ctx); |
| 1687 | |
| 1688 | /* |
| 1689 | * group mask for tx completion ring. |
| 1690 | */ |
| 1691 | grp_mask = &soc->wlan_cfg_ctx->int_tx_ring_mask[0]; |
| 1692 | |
| 1693 | /* loop and reset the mask for only offloaded ring */ |
| 1694 | for (j = 0; j < num_ring; j++) { |
| 1695 | if (!dp_soc_ring_if_nss_offloaded(soc, WBM2SW_RELEASE, j)) { |
| 1696 | continue; |
| 1697 | } |
| 1698 | |
| 1699 | /* |
| 1700 | * Group number corresponding to tx offloaded ring. |
| 1701 | */ |
| 1702 | group_number = dp_srng_find_ring_in_mask(j, grp_mask); |
| 1703 | if (group_number < 0) { |
| 1704 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1705 | FL("ring not part of any group; ring_type: %d,ring_num %d"), |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 1706 | WBM2SW_RELEASE, j); |
| 1707 | return; |
| 1708 | } |
| 1709 | |
| 1710 | /* reset the tx mask for offloaded ring */ |
| 1711 | mask = wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx, group_number); |
| 1712 | mask &= (~(1 << j)); |
| 1713 | |
| 1714 | /* |
| 1715 | * reset the interrupt mask for offloaded ring. |
| 1716 | */ |
| 1717 | wlan_cfg_set_tx_ring_mask(soc->wlan_cfg_ctx, group_number, mask); |
| 1718 | } |
| 1719 | |
| 1720 | /* number of rx rings */ |
| 1721 | num_ring = wlan_cfg_num_reo_dest_rings(soc->wlan_cfg_ctx); |
| 1722 | |
| 1723 | /* |
| 1724 | * group mask for reo destination ring. |
| 1725 | */ |
| 1726 | grp_mask = &soc->wlan_cfg_ctx->int_rx_ring_mask[0]; |
| 1727 | |
| 1728 | /* loop and reset the mask for only offloaded ring */ |
| 1729 | for (j = 0; j < num_ring; j++) { |
| 1730 | if (!dp_soc_ring_if_nss_offloaded(soc, REO_DST, j)) { |
| 1731 | continue; |
| 1732 | } |
| 1733 | |
| 1734 | /* |
| 1735 | * Group number corresponding to rx offloaded ring. |
| 1736 | */ |
| 1737 | group_number = dp_srng_find_ring_in_mask(j, grp_mask); |
| 1738 | if (group_number < 0) { |
| 1739 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1740 | FL("ring not part of any group; ring_type: %d,ring_num %d"), |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 1741 | REO_DST, j); |
| 1742 | return; |
| 1743 | } |
| 1744 | |
| 1745 | /* set the interrupt mask for offloaded ring */ |
| 1746 | mask = wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx, group_number); |
| 1747 | mask &= (~(1 << j)); |
| 1748 | |
| 1749 | /* |
| 1750 | * set the interrupt mask to zero for rx offloaded radio. |
| 1751 | */ |
| 1752 | wlan_cfg_set_rx_ring_mask(soc->wlan_cfg_ctx, group_number, mask); |
| 1753 | } |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1754 | |
| 1755 | /* |
| 1756 | * group mask for Rx buffer refill ring |
| 1757 | */ |
| 1758 | grp_mask = &soc->wlan_cfg_ctx->int_host2rxdma_ring_mask[0]; |
| 1759 | |
| 1760 | /* loop and reset the mask for only offloaded ring */ |
| 1761 | for (j = 0; j < MAX_PDEV_CNT; j++) { |
| 1762 | if (!dp_soc_ring_if_nss_offloaded(soc, RXDMA_BUF, j)) { |
| 1763 | continue; |
| 1764 | } |
| 1765 | |
| 1766 | /* |
| 1767 | * Group number corresponding to rx offloaded ring. |
| 1768 | */ |
| 1769 | group_number = dp_srng_find_ring_in_mask(j, grp_mask); |
| 1770 | if (group_number < 0) { |
| 1771 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 1772 | FL("ring not part of any group; ring_type: %d,ring_num %d"), |
| 1773 | REO_DST, j); |
| 1774 | return; |
| 1775 | } |
| 1776 | |
| 1777 | /* set the interrupt mask for offloaded ring */ |
| 1778 | mask = wlan_cfg_get_host2rxdma_ring_mask(soc->wlan_cfg_ctx, |
| 1779 | group_number); |
| 1780 | mask &= (~(1 << j)); |
| 1781 | |
| 1782 | /* |
| 1783 | * set the interrupt mask to zero for rx offloaded radio. |
| 1784 | */ |
| 1785 | wlan_cfg_set_host2rxdma_ring_mask(soc->wlan_cfg_ctx, |
| 1786 | group_number, mask); |
| 1787 | } |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 1788 | } |
| 1789 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 1790 | #ifdef IPA_OFFLOAD |
| 1791 | /** |
| 1792 | * dp_reo_remap_config() - configure reo remap register value based |
| 1793 | * nss configuration. |
| 1794 | * based on offload_radio value below remap configuration |
| 1795 | * get applied. |
| 1796 | * 0 - both Radios handled by host (remap rings 1, 2, 3 & 4) |
| 1797 | * 1 - 1st Radio handled by NSS (remap rings 2, 3 & 4) |
| 1798 | * 2 - 2nd Radio handled by NSS (remap rings 1, 2 & 4) |
| 1799 | * 3 - both Radios handled by NSS (remap not required) |
| 1800 | * 4 - IPA OFFLOAD enabled (remap rings 1,2 & 3) |
| 1801 | * |
| 1802 | * @remap1: output parameter indicates reo remap 1 register value |
| 1803 | * @remap2: output parameter indicates reo remap 2 register value |
| 1804 | * Return: bool type, true if remap is configured else false. |
| 1805 | */ |
| 1806 | static bool dp_reo_remap_config(struct dp_soc *soc, |
| 1807 | uint32_t *remap1, |
| 1808 | uint32_t *remap2) |
| 1809 | { |
| 1810 | |
| 1811 | *remap1 = ((0x1 << 0) | (0x2 << 3) | (0x3 << 6) | (0x1 << 9) | |
| 1812 | (0x2 << 12) | (0x3 << 15) | (0x1 << 18) | (0x2 << 21)) << 8; |
| 1813 | |
| 1814 | *remap2 = ((0x3 << 0) | (0x1 << 3) | (0x2 << 6) | (0x3 << 9) | |
| 1815 | (0x1 << 12) | (0x2 << 15) | (0x3 << 18) | (0x1 << 21)) << 8; |
| 1816 | |
| 1817 | return true; |
| 1818 | } |
| 1819 | #else |
| 1820 | static bool dp_reo_remap_config(struct dp_soc *soc, |
| 1821 | uint32_t *remap1, |
| 1822 | uint32_t *remap2) |
| 1823 | { |
| 1824 | uint8_t offload_radio = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); |
| 1825 | |
| 1826 | switch (offload_radio) { |
| 1827 | case 0: |
| 1828 | *remap1 = ((0x1 << 0) | (0x2 << 3) | (0x3 << 6) | |
| 1829 | (0x4 << 9) | (0x1 << 12) | (0x2 << 15) | |
| 1830 | (0x3 << 18) | (0x4 << 21)) << 8; |
| 1831 | |
| 1832 | *remap2 = ((0x1 << 0) | (0x2 << 3) | (0x3 << 6) | |
| 1833 | (0x4 << 9) | (0x1 << 12) | (0x2 << 15) | |
| 1834 | (0x3 << 18) | (0x4 << 21)) << 8; |
| 1835 | break; |
| 1836 | |
| 1837 | case 1: |
| 1838 | *remap1 = ((0x2 << 0) | (0x3 << 3) | (0x4 << 6) | |
| 1839 | (0x2 << 9) | (0x3 << 12) | (0x4 << 15) | |
| 1840 | (0x2 << 18) | (0x3 << 21)) << 8; |
| 1841 | |
| 1842 | *remap2 = ((0x4 << 0) | (0x2 << 3) | (0x3 << 6) | |
| 1843 | (0x4 << 9) | (0x2 << 12) | (0x3 << 15) | |
| 1844 | (0x4 << 18) | (0x2 << 21)) << 8; |
| 1845 | break; |
| 1846 | |
| 1847 | case 2: |
| 1848 | *remap1 = ((0x1 << 0) | (0x3 << 3) | (0x4 << 6) | |
| 1849 | (0x1 << 9) | (0x3 << 12) | (0x4 << 15) | |
| 1850 | (0x1 << 18) | (0x3 << 21)) << 8; |
| 1851 | |
| 1852 | *remap2 = ((0x4 << 0) | (0x1 << 3) | (0x3 << 6) | |
| 1853 | (0x4 << 9) | (0x1 << 12) | (0x3 << 15) | |
| 1854 | (0x4 << 18) | (0x1 << 21)) << 8; |
| 1855 | break; |
| 1856 | |
| 1857 | case 3: |
| 1858 | /* return false if both radios are offloaded to NSS */ |
| 1859 | return false; |
| 1860 | } |
| 1861 | return true; |
| 1862 | } |
| 1863 | #endif |
| 1864 | |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 1865 | /* |
Aniruddha Paul | 91dfd50 | 2018-01-08 11:24:34 +0530 | [diff] [blame] | 1866 | * dp_reo_frag_dst_set() - configure reo register to set the |
| 1867 | * fragment destination ring |
| 1868 | * @soc : Datapath soc |
| 1869 | * @frag_dst_ring : output parameter to set fragment destination ring |
| 1870 | * |
| 1871 | * Based on offload_radio below fragment destination rings is selected |
| 1872 | * 0 - TCL |
| 1873 | * 1 - SW1 |
| 1874 | * 2 - SW2 |
| 1875 | * 3 - SW3 |
| 1876 | * 4 - SW4 |
| 1877 | * 5 - Release |
| 1878 | * 6 - FW |
| 1879 | * 7 - alternate select |
| 1880 | * |
| 1881 | * return: void |
| 1882 | */ |
| 1883 | static void dp_reo_frag_dst_set(struct dp_soc *soc, uint8_t *frag_dst_ring) |
| 1884 | { |
| 1885 | uint8_t offload_radio = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); |
| 1886 | |
| 1887 | switch (offload_radio) { |
| 1888 | case 0: |
| 1889 | *frag_dst_ring = HAL_SRNG_REO_EXCEPTION; |
| 1890 | break; |
| 1891 | case 3: |
| 1892 | *frag_dst_ring = HAL_SRNG_REO_ALTERNATE_SELECT; |
| 1893 | break; |
| 1894 | default: |
| 1895 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1896 | FL("dp_reo_frag_dst_set invalid offload radio config")); |
| 1897 | break; |
| 1898 | } |
| 1899 | } |
| 1900 | |
| 1901 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1902 | * dp_soc_cmn_setup() - Common SoC level initializion |
| 1903 | * @soc: Datapath SOC handle |
| 1904 | * |
| 1905 | * This is an internal function used to setup common SOC data structures, |
| 1906 | * to be called from PDEV attach after receiving HW mode capabilities from FW |
| 1907 | */ |
| 1908 | static int dp_soc_cmn_setup(struct dp_soc *soc) |
| 1909 | { |
| 1910 | int i; |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 1911 | struct hal_reo_params reo_params; |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 1912 | int tx_ring_size; |
| 1913 | int tx_comp_ring_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1914 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 1915 | if (qdf_atomic_read(&soc->cmn_init_done)) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1916 | return 0; |
| 1917 | |
| 1918 | if (dp_peer_find_attach(soc)) |
| 1919 | goto fail0; |
| 1920 | |
| 1921 | if (dp_hw_link_desc_pool_setup(soc)) |
| 1922 | goto fail1; |
| 1923 | |
| 1924 | /* Setup SRNG rings */ |
| 1925 | /* Common rings */ |
| 1926 | if (dp_srng_setup(soc, &soc->wbm_desc_rel_ring, SW2WBM_RELEASE, 0, 0, |
| 1927 | WBM_RELEASE_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1928 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1929 | FL("dp_srng_setup failed for wbm_desc_rel_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1930 | goto fail1; |
| 1931 | } |
| 1932 | |
| 1933 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 1934 | soc->num_tcl_data_rings = 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1935 | /* Tx data rings */ |
| 1936 | if (!wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { |
| 1937 | soc->num_tcl_data_rings = |
| 1938 | wlan_cfg_num_tcl_data_rings(soc->wlan_cfg_ctx); |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 1939 | tx_comp_ring_size = |
| 1940 | wlan_cfg_tx_comp_ring_size(soc->wlan_cfg_ctx); |
| 1941 | tx_ring_size = |
| 1942 | wlan_cfg_tx_ring_size(soc->wlan_cfg_ctx); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1943 | for (i = 0; i < soc->num_tcl_data_rings; i++) { |
| 1944 | if (dp_srng_setup(soc, &soc->tcl_data_ring[i], |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 1945 | TCL_DATA, i, 0, tx_ring_size)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1946 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1947 | QDF_TRACE_LEVEL_ERROR, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1948 | FL("dp_srng_setup failed for tcl_data_ring[%d]"), i); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1949 | goto fail1; |
| 1950 | } |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 1951 | /* |
| 1952 | * TBD: Set IPA WBM ring size with ini IPA UC tx buffer |
| 1953 | * count |
| 1954 | */ |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1955 | if (dp_srng_setup(soc, &soc->tx_comp_ring[i], |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 1956 | WBM2SW_RELEASE, i, 0, tx_comp_ring_size)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1957 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1958 | QDF_TRACE_LEVEL_ERROR, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1959 | FL("dp_srng_setup failed for tx_comp_ring[%d]"), i); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1960 | goto fail1; |
| 1961 | } |
| 1962 | } |
| 1963 | } else { |
| 1964 | /* This will be incremented during per pdev ring setup */ |
| 1965 | soc->num_tcl_data_rings = 0; |
| 1966 | } |
| 1967 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 1968 | if (dp_tx_soc_attach(soc)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1969 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1970 | FL("dp_tx_soc_attach failed")); |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 1971 | goto fail1; |
| 1972 | } |
| 1973 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1974 | /* TCL command and status rings */ |
| 1975 | if (dp_srng_setup(soc, &soc->tcl_cmd_ring, TCL_CMD, 0, 0, |
| 1976 | TCL_CMD_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1977 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1978 | FL("dp_srng_setup failed for tcl_cmd_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1979 | goto fail1; |
| 1980 | } |
| 1981 | |
| 1982 | if (dp_srng_setup(soc, &soc->tcl_status_ring, TCL_STATUS, 0, 0, |
| 1983 | TCL_STATUS_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1984 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1985 | FL("dp_srng_setup failed for tcl_status_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1986 | goto fail1; |
| 1987 | } |
| 1988 | |
| 1989 | |
| 1990 | /* TBD: call dp_tx_init to setup Tx SW descriptors and MSDU extension |
| 1991 | * descriptors |
| 1992 | */ |
| 1993 | |
| 1994 | /* Rx data rings */ |
| 1995 | if (!wlan_cfg_per_pdev_rx_ring(soc->wlan_cfg_ctx)) { |
| 1996 | soc->num_reo_dest_rings = |
| 1997 | wlan_cfg_num_reo_dest_rings(soc->wlan_cfg_ctx); |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 1998 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 1999 | QDF_TRACE_LEVEL_ERROR, |
| 2000 | FL("num_reo_dest_rings %d\n"), soc->num_reo_dest_rings); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2001 | for (i = 0; i < soc->num_reo_dest_rings; i++) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2002 | if (dp_srng_setup(soc, &soc->reo_dest_ring[i], REO_DST, |
| 2003 | i, 0, REO_DST_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2004 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2005 | QDF_TRACE_LEVEL_ERROR, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2006 | FL("dp_srng_setup failed for reo_dest_ring[%d]"), i); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2007 | goto fail1; |
| 2008 | } |
| 2009 | } |
| 2010 | } else { |
| 2011 | /* This will be incremented during per pdev ring setup */ |
| 2012 | soc->num_reo_dest_rings = 0; |
| 2013 | } |
| 2014 | |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 2015 | /* LMAC RxDMA to SW Rings configuration */ |
| 2016 | if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { |
| 2017 | /* Only valid for MCL */ |
| 2018 | struct dp_pdev *pdev = soc->pdev_list[0]; |
| 2019 | |
| 2020 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) { |
| 2021 | if (dp_srng_setup(soc, &pdev->rxdma_err_dst_ring[i], |
| 2022 | RXDMA_DST, 0, i, RXDMA_ERR_DST_RING_SIZE)) { |
| 2023 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 2024 | QDF_TRACE_LEVEL_ERROR, |
| 2025 | FL("dp_srng_setup failed for rxdma_err_dst_ring")); |
| 2026 | goto fail1; |
| 2027 | } |
| 2028 | } |
| 2029 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2030 | /* TBD: call dp_rx_init to setup Rx SW descriptors */ |
| 2031 | |
| 2032 | /* REO reinjection ring */ |
| 2033 | if (dp_srng_setup(soc, &soc->reo_reinject_ring, REO_REINJECT, 0, 0, |
| 2034 | REO_REINJECT_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2035 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2036 | FL("dp_srng_setup failed for reo_reinject_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2037 | goto fail1; |
| 2038 | } |
| 2039 | |
| 2040 | |
| 2041 | /* Rx release ring */ |
| 2042 | if (dp_srng_setup(soc, &soc->rx_rel_ring, WBM2SW_RELEASE, 3, 0, |
| 2043 | RX_RELEASE_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2044 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2045 | FL("dp_srng_setup failed for rx_rel_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2046 | goto fail1; |
| 2047 | } |
| 2048 | |
| 2049 | |
| 2050 | /* Rx exception ring */ |
| 2051 | if (dp_srng_setup(soc, &soc->reo_exception_ring, REO_EXCEPTION, 0, |
| 2052 | MAX_REO_DEST_RINGS, REO_EXCEPTION_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2053 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2054 | FL("dp_srng_setup failed for reo_exception_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2055 | goto fail1; |
| 2056 | } |
| 2057 | |
| 2058 | |
| 2059 | /* REO command and status rings */ |
| 2060 | if (dp_srng_setup(soc, &soc->reo_cmd_ring, REO_CMD, 0, 0, |
| 2061 | REO_CMD_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2062 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2063 | FL("dp_srng_setup failed for reo_cmd_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2064 | goto fail1; |
| 2065 | } |
| 2066 | |
Manoj Ekbote | 4f0c6b1 | 2016-10-30 16:01:38 -0700 | [diff] [blame] | 2067 | hal_reo_init_cmd_ring(soc->hal_soc, soc->reo_cmd_ring.hal_srng); |
| 2068 | TAILQ_INIT(&soc->rx.reo_cmd_list); |
| 2069 | qdf_spinlock_create(&soc->rx.reo_cmd_lock); |
| 2070 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2071 | if (dp_srng_setup(soc, &soc->reo_status_ring, REO_STATUS, 0, 0, |
| 2072 | REO_STATUS_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2073 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2074 | FL("dp_srng_setup failed for reo_status_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2075 | goto fail1; |
| 2076 | } |
| 2077 | |
Yun Park | 92af713 | 2017-09-13 16:33:35 -0700 | [diff] [blame] | 2078 | qdf_spinlock_create(&soc->ast_lock); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 2079 | dp_soc_wds_attach(soc); |
| 2080 | |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2081 | /* Reset the cpu ring map if radio is NSS offloaded */ |
| 2082 | if (wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx)) { |
| 2083 | dp_soc_reset_cpu_ring_map(soc); |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 2084 | dp_soc_reset_intr_mask(soc); |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2085 | } |
| 2086 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2087 | /* Setup HW REO */ |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2088 | qdf_mem_zero(&reo_params, sizeof(reo_params)); |
| 2089 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 2090 | if (wlan_cfg_is_rx_hash_enabled(soc->wlan_cfg_ctx)) { |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2091 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 2092 | /* |
| 2093 | * Reo ring remap is not required if both radios |
| 2094 | * are offloaded to NSS |
| 2095 | */ |
| 2096 | if (!dp_reo_remap_config(soc, |
| 2097 | &reo_params.remap1, |
| 2098 | &reo_params.remap2)) |
| 2099 | goto out; |
| 2100 | |
| 2101 | reo_params.rx_hash_enabled = true; |
| 2102 | } |
| 2103 | |
psimha | fc2f91b | 2018-01-10 15:30:03 -0800 | [diff] [blame] | 2104 | /* setup the global rx defrag waitlist */ |
| 2105 | TAILQ_INIT(&soc->rx.defrag.waitlist); |
| 2106 | soc->rx.defrag.timeout_ms = |
| 2107 | wlan_cfg_get_rx_defrag_min_timeout(soc->wlan_cfg_ctx); |
| 2108 | soc->rx.flags.defrag_timeout_check = |
| 2109 | wlan_cfg_get_defrag_timeout_check(soc->wlan_cfg_ctx); |
| 2110 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 2111 | out: |
Aniruddha Paul | 91dfd50 | 2018-01-08 11:24:34 +0530 | [diff] [blame] | 2112 | /* |
| 2113 | * set the fragment destination ring |
| 2114 | */ |
| 2115 | dp_reo_frag_dst_set(soc, &reo_params.frag_dst_ring); |
| 2116 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2117 | hal_reo_setup(soc->hal_soc, &reo_params); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2118 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 2119 | qdf_atomic_set(&soc->cmn_init_done, 1); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2120 | qdf_nbuf_queue_init(&soc->htt_stats.msg); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2121 | return 0; |
| 2122 | fail1: |
| 2123 | /* |
| 2124 | * Cleanup will be done as part of soc_detach, which will |
| 2125 | * be called on pdev attach failure |
| 2126 | */ |
| 2127 | fail0: |
| 2128 | return QDF_STATUS_E_FAILURE; |
| 2129 | } |
| 2130 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2131 | static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2132 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2133 | static void dp_lro_hash_setup(struct dp_soc *soc) |
| 2134 | { |
| 2135 | struct cdp_lro_hash_config lro_hash; |
| 2136 | |
| 2137 | if (!wlan_cfg_is_lro_enabled(soc->wlan_cfg_ctx) && |
| 2138 | !wlan_cfg_is_rx_hash_enabled(soc->wlan_cfg_ctx)) { |
| 2139 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2140 | FL("LRO disabled RX hash disabled")); |
| 2141 | return; |
| 2142 | } |
| 2143 | |
| 2144 | qdf_mem_zero(&lro_hash, sizeof(lro_hash)); |
| 2145 | |
| 2146 | if (wlan_cfg_is_lro_enabled(soc->wlan_cfg_ctx)) { |
| 2147 | lro_hash.lro_enable = 1; |
| 2148 | lro_hash.tcp_flag = QDF_TCPHDR_ACK; |
| 2149 | lro_hash.tcp_flag_mask = QDF_TCPHDR_FIN | QDF_TCPHDR_SYN | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 2150 | QDF_TCPHDR_RST | QDF_TCPHDR_ACK | QDF_TCPHDR_URG | |
| 2151 | QDF_TCPHDR_ECE | QDF_TCPHDR_CWR; |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2152 | } |
| 2153 | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 2154 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, FL("enabled")); |
| 2155 | qdf_get_random_bytes(lro_hash.toeplitz_hash_ipv4, |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2156 | (sizeof(lro_hash.toeplitz_hash_ipv4[0]) * |
| 2157 | LRO_IPV4_SEED_ARR_SZ)); |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2158 | qdf_get_random_bytes(lro_hash.toeplitz_hash_ipv6, |
| 2159 | (sizeof(lro_hash.toeplitz_hash_ipv6[0]) * |
| 2160 | LRO_IPV6_SEED_ARR_SZ)); |
| 2161 | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 2162 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
| 2163 | "lro_hash: lro_enable: 0x%x tcp_flag 0x%x tcp_flag_mask 0x%x", |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2164 | lro_hash.lro_enable, lro_hash.tcp_flag, |
| 2165 | lro_hash.tcp_flag_mask); |
| 2166 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2167 | qdf_trace_hex_dump(QDF_MODULE_ID_DP, |
| 2168 | QDF_TRACE_LEVEL_ERROR, |
| 2169 | (void *)lro_hash.toeplitz_hash_ipv4, |
| 2170 | (sizeof(lro_hash.toeplitz_hash_ipv4[0]) * |
| 2171 | LRO_IPV4_SEED_ARR_SZ)); |
| 2172 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2173 | qdf_trace_hex_dump(QDF_MODULE_ID_DP, |
| 2174 | QDF_TRACE_LEVEL_ERROR, |
| 2175 | (void *)lro_hash.toeplitz_hash_ipv6, |
| 2176 | (sizeof(lro_hash.toeplitz_hash_ipv6[0]) * |
| 2177 | LRO_IPV6_SEED_ARR_SZ)); |
| 2178 | |
| 2179 | qdf_assert(soc->cdp_soc.ol_ops->lro_hash_config); |
| 2180 | |
| 2181 | if (soc->cdp_soc.ol_ops->lro_hash_config) |
| 2182 | (void)soc->cdp_soc.ol_ops->lro_hash_config |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 2183 | (soc->ctrl_psoc, &lro_hash); |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2184 | } |
| 2185 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2186 | /* |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2187 | * dp_rxdma_ring_setup() - configure the RX DMA rings |
| 2188 | * @soc: data path SoC handle |
| 2189 | * @pdev: Physical device handle |
| 2190 | * |
| 2191 | * Return: 0 - success, > 0 - failure |
| 2192 | */ |
| 2193 | #ifdef QCA_HOST2FW_RXBUF_RING |
| 2194 | static int dp_rxdma_ring_setup(struct dp_soc *soc, |
| 2195 | struct dp_pdev *pdev) |
| 2196 | { |
| 2197 | int max_mac_rings = |
| 2198 | wlan_cfg_get_num_mac_rings |
| 2199 | (pdev->wlan_cfg_ctx); |
| 2200 | int i; |
| 2201 | |
| 2202 | for (i = 0; i < max_mac_rings; i++) { |
| 2203 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2204 | "%s: pdev_id %d mac_id %d\n", |
| 2205 | __func__, pdev->pdev_id, i); |
| 2206 | if (dp_srng_setup(soc, &pdev->rx_mac_buf_ring[i], |
| 2207 | RXDMA_BUF, 1, i, RXDMA_BUF_RING_SIZE)) { |
| 2208 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 2209 | QDF_TRACE_LEVEL_ERROR, |
| 2210 | FL("failed rx mac ring setup")); |
| 2211 | return QDF_STATUS_E_FAILURE; |
| 2212 | } |
| 2213 | } |
| 2214 | return QDF_STATUS_SUCCESS; |
| 2215 | } |
| 2216 | #else |
| 2217 | static int dp_rxdma_ring_setup(struct dp_soc *soc, |
| 2218 | struct dp_pdev *pdev) |
| 2219 | { |
| 2220 | return QDF_STATUS_SUCCESS; |
| 2221 | } |
| 2222 | #endif |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 2223 | |
| 2224 | /** |
| 2225 | * dp_dscp_tid_map_setup(): Initialize the dscp-tid maps |
| 2226 | * @pdev - DP_PDEV handle |
| 2227 | * |
| 2228 | * Return: void |
| 2229 | */ |
| 2230 | static inline void |
| 2231 | dp_dscp_tid_map_setup(struct dp_pdev *pdev) |
| 2232 | { |
| 2233 | uint8_t map_id; |
| 2234 | for (map_id = 0; map_id < DP_MAX_TID_MAPS; map_id++) { |
| 2235 | qdf_mem_copy(pdev->dscp_tid_map[map_id], default_dscp_tid_map, |
| 2236 | sizeof(default_dscp_tid_map)); |
| 2237 | } |
| 2238 | for (map_id = 0; map_id < HAL_MAX_HW_DSCP_TID_MAPS; map_id++) { |
| 2239 | hal_tx_set_dscp_tid_map(pdev->soc->hal_soc, |
| 2240 | pdev->dscp_tid_map[map_id], |
| 2241 | map_id); |
| 2242 | } |
| 2243 | } |
| 2244 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2245 | #ifdef QCA_SUPPORT_SON |
| 2246 | /** |
| 2247 | * dp_mark_peer_inact(): Update peer inactivity status |
| 2248 | * @peer_handle - datapath peer handle |
| 2249 | * |
| 2250 | * Return: void |
| 2251 | */ |
| 2252 | void dp_mark_peer_inact(void *peer_handle, bool inactive) |
| 2253 | { |
| 2254 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 2255 | struct dp_pdev *pdev; |
| 2256 | struct dp_soc *soc; |
| 2257 | bool inactive_old; |
| 2258 | |
| 2259 | if (!peer) |
| 2260 | return; |
| 2261 | |
| 2262 | pdev = peer->vdev->pdev; |
| 2263 | soc = pdev->soc; |
| 2264 | |
| 2265 | inactive_old = peer->peer_bs_inact_flag == 1; |
| 2266 | if (!inactive) |
| 2267 | peer->peer_bs_inact = soc->pdev_bs_inact_reload; |
| 2268 | peer->peer_bs_inact_flag = inactive ? 1 : 0; |
| 2269 | |
| 2270 | if (inactive_old != inactive) { |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2271 | /** |
| 2272 | * Note: a node lookup can happen in RX datapath context |
| 2273 | * when a node changes from inactive to active (at most once |
| 2274 | * per inactivity timeout threshold) |
| 2275 | */ |
| 2276 | if (soc->cdp_soc.ol_ops->record_act_change) { |
Srinivas Pitla | 0e3478d | 2018-02-21 10:43:28 +0530 | [diff] [blame] | 2277 | soc->cdp_soc.ol_ops->record_act_change(pdev->osif_pdev, |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2278 | peer->mac_addr.raw, !inactive); |
| 2279 | } |
| 2280 | } |
| 2281 | } |
| 2282 | |
| 2283 | /** |
| 2284 | * dp_txrx_peer_find_inact_timeout_handler(): Inactivity timeout function |
| 2285 | * |
| 2286 | * Periodically checks the inactivity status |
| 2287 | */ |
| 2288 | static os_timer_func(dp_txrx_peer_find_inact_timeout_handler) |
| 2289 | { |
| 2290 | struct dp_pdev *pdev; |
| 2291 | struct dp_vdev *vdev; |
| 2292 | struct dp_peer *peer; |
| 2293 | struct dp_soc *soc; |
| 2294 | int i; |
| 2295 | |
| 2296 | OS_GET_TIMER_ARG(soc, struct dp_soc *); |
| 2297 | |
| 2298 | qdf_spin_lock(&soc->peer_ref_mutex); |
| 2299 | |
| 2300 | for (i = 0; i < soc->pdev_count; i++) { |
| 2301 | pdev = soc->pdev_list[i]; |
| 2302 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 2303 | if (vdev->opmode != wlan_op_mode_ap) |
| 2304 | continue; |
| 2305 | |
| 2306 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 2307 | if (!peer->authorize) { |
| 2308 | /** |
| 2309 | * Inactivity check only interested in |
| 2310 | * connected node |
| 2311 | */ |
| 2312 | continue; |
| 2313 | } |
| 2314 | if (peer->peer_bs_inact > soc->pdev_bs_inact_reload) { |
| 2315 | /** |
| 2316 | * This check ensures we do not wait extra long |
| 2317 | * due to the potential race condition |
| 2318 | */ |
| 2319 | peer->peer_bs_inact = soc->pdev_bs_inact_reload; |
| 2320 | } |
| 2321 | if (peer->peer_bs_inact > 0) { |
| 2322 | /* Do not let it wrap around */ |
| 2323 | peer->peer_bs_inact--; |
| 2324 | } |
| 2325 | if (peer->peer_bs_inact == 0) |
| 2326 | dp_mark_peer_inact(peer, true); |
| 2327 | } |
| 2328 | } |
| 2329 | } |
| 2330 | |
| 2331 | qdf_spin_unlock(&soc->peer_ref_mutex); |
| 2332 | qdf_timer_mod(&soc->pdev_bs_inact_timer, |
| 2333 | soc->pdev_bs_inact_interval * 1000); |
| 2334 | } |
Subhranil Choudhury | eea6738 | 2018-01-18 20:24:36 +0530 | [diff] [blame] | 2335 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 2336 | |
| 2337 | /** |
| 2338 | * dp_free_inact_timer(): free inact timer |
| 2339 | * @timer - inact timer handle |
| 2340 | * |
| 2341 | * Return: bool |
| 2342 | */ |
| 2343 | void dp_free_inact_timer(struct dp_soc *soc) |
| 2344 | { |
| 2345 | qdf_timer_free(&soc->pdev_bs_inact_timer); |
| 2346 | } |
Subhranil Choudhury | eea6738 | 2018-01-18 20:24:36 +0530 | [diff] [blame] | 2347 | #else |
| 2348 | |
| 2349 | void dp_mark_peer_inact(void *peer, bool inactive) |
| 2350 | { |
| 2351 | return; |
| 2352 | } |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 2353 | |
| 2354 | void dp_free_inact_timer(struct dp_soc *soc) |
| 2355 | { |
| 2356 | return; |
| 2357 | } |
| 2358 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2359 | #endif |
| 2360 | |
Yun Park | 47e6af8 | 2018-01-17 12:15:01 -0800 | [diff] [blame] | 2361 | #ifdef IPA_OFFLOAD |
| 2362 | /** |
| 2363 | * dp_setup_ipa_rx_refill_buf_ring - Setup second Rx refill buffer ring |
| 2364 | * @soc: data path instance |
| 2365 | * @pdev: core txrx pdev context |
| 2366 | * |
| 2367 | * Return: QDF_STATUS_SUCCESS: success |
| 2368 | * QDF_STATUS_E_RESOURCES: Error return |
| 2369 | */ |
| 2370 | static int dp_setup_ipa_rx_refill_buf_ring(struct dp_soc *soc, |
| 2371 | struct dp_pdev *pdev) |
| 2372 | { |
| 2373 | /* Setup second Rx refill buffer ring */ |
| 2374 | if (dp_srng_setup(soc, &pdev->rx_refill_buf_ring2, RXDMA_BUF, |
| 2375 | IPA_RX_REFILL_BUF_RING_IDX, |
| 2376 | pdev->pdev_id, RXDMA_REFILL_RING_SIZE)) { |
| 2377 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2378 | FL("dp_srng_setup failed second rx refill ring")); |
| 2379 | return QDF_STATUS_E_FAILURE; |
| 2380 | } |
| 2381 | return QDF_STATUS_SUCCESS; |
| 2382 | } |
| 2383 | |
| 2384 | /** |
| 2385 | * dp_cleanup_ipa_rx_refill_buf_ring - Cleanup second Rx refill buffer ring |
| 2386 | * @soc: data path instance |
| 2387 | * @pdev: core txrx pdev context |
| 2388 | * |
| 2389 | * Return: void |
| 2390 | */ |
| 2391 | static void dp_cleanup_ipa_rx_refill_buf_ring(struct dp_soc *soc, |
| 2392 | struct dp_pdev *pdev) |
| 2393 | { |
| 2394 | dp_srng_cleanup(soc, &pdev->rx_refill_buf_ring2, RXDMA_BUF, |
| 2395 | IPA_RX_REFILL_BUF_RING_IDX); |
| 2396 | } |
| 2397 | |
| 2398 | #else |
| 2399 | |
| 2400 | static int dp_setup_ipa_rx_refill_buf_ring(struct dp_soc *soc, |
| 2401 | struct dp_pdev *pdev) |
| 2402 | { |
| 2403 | return QDF_STATUS_SUCCESS; |
| 2404 | } |
| 2405 | |
| 2406 | static void dp_cleanup_ipa_rx_refill_buf_ring(struct dp_soc *soc, |
| 2407 | struct dp_pdev *pdev) |
| 2408 | { |
| 2409 | } |
| 2410 | |
| 2411 | #endif |
| 2412 | |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2413 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2414 | * dp_pdev_attach_wifi3() - attach txrx pdev |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 2415 | * @ctrl_pdev: Opaque PDEV object |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2416 | * @txrx_soc: Datapath SOC handle |
| 2417 | * @htc_handle: HTC handle for host-target interface |
| 2418 | * @qdf_osdev: QDF OS device |
| 2419 | * @pdev_id: PDEV ID |
| 2420 | * |
| 2421 | * Return: DP PDEV handle on success, NULL on failure |
| 2422 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2423 | static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, |
| 2424 | struct cdp_cfg *ctrl_pdev, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2425 | HTC_HANDLE htc_handle, qdf_device_t qdf_osdev, uint8_t pdev_id) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2426 | { |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2427 | int tx_ring_size; |
| 2428 | int tx_comp_ring_size; |
| 2429 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2430 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
| 2431 | struct dp_pdev *pdev = qdf_mem_malloc(sizeof(*pdev)); |
| 2432 | |
| 2433 | if (!pdev) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2434 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2435 | FL("DP PDEV memory allocation failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2436 | goto fail0; |
| 2437 | } |
| 2438 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 2439 | pdev->wlan_cfg_ctx = wlan_cfg_pdev_attach(); |
| 2440 | |
| 2441 | if (!pdev->wlan_cfg_ctx) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2442 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2443 | FL("pdev cfg_attach failed")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2444 | |
| 2445 | qdf_mem_free(pdev); |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 2446 | goto fail0; |
| 2447 | } |
| 2448 | |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 2449 | /* |
| 2450 | * set nss pdev config based on soc config |
| 2451 | */ |
| 2452 | wlan_cfg_set_dp_pdev_nss_enabled(pdev->wlan_cfg_ctx, |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2453 | (wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx) & (1 << pdev_id))); |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 2454 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2455 | pdev->soc = soc; |
| 2456 | pdev->osif_pdev = ctrl_pdev; |
| 2457 | pdev->pdev_id = pdev_id; |
| 2458 | soc->pdev_list[pdev_id] = pdev; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 2459 | soc->pdev_count++; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2460 | |
| 2461 | TAILQ_INIT(&pdev->vdev_list); |
| 2462 | pdev->vdev_count = 0; |
| 2463 | |
Pamidipati, Vijay | 9c9a287 | 2017-05-31 10:06:34 +0530 | [diff] [blame] | 2464 | qdf_spinlock_create(&pdev->tx_mutex); |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 2465 | qdf_spinlock_create(&pdev->neighbour_peer_mutex); |
| 2466 | TAILQ_INIT(&pdev->neighbour_peers_list); |
| 2467 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2468 | if (dp_soc_cmn_setup(soc)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2469 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2470 | FL("dp_soc_cmn_setup failed")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2471 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2472 | } |
| 2473 | |
| 2474 | /* Setup per PDEV TCL rings if configured */ |
| 2475 | if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2476 | tx_ring_size = |
| 2477 | wlan_cfg_tx_ring_size(soc->wlan_cfg_ctx); |
| 2478 | tx_comp_ring_size = |
| 2479 | wlan_cfg_tx_comp_ring_size(soc->wlan_cfg_ctx); |
| 2480 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2481 | if (dp_srng_setup(soc, &soc->tcl_data_ring[pdev_id], TCL_DATA, |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2482 | pdev_id, pdev_id, tx_ring_size)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2483 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2484 | FL("dp_srng_setup failed for tcl_data_ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2485 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2486 | } |
| 2487 | if (dp_srng_setup(soc, &soc->tx_comp_ring[pdev_id], |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2488 | WBM2SW_RELEASE, pdev_id, pdev_id, tx_comp_ring_size)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2489 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2490 | FL("dp_srng_setup failed for tx_comp_ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2491 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2492 | } |
| 2493 | soc->num_tcl_data_rings++; |
| 2494 | } |
| 2495 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 2496 | /* Tx specific init */ |
| 2497 | if (dp_tx_pdev_attach(pdev)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2498 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2499 | FL("dp_tx_pdev_attach failed")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2500 | goto fail1; |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 2501 | } |
| 2502 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2503 | /* Setup per PDEV REO rings if configured */ |
| 2504 | if (wlan_cfg_per_pdev_rx_ring(soc->wlan_cfg_ctx)) { |
| 2505 | if (dp_srng_setup(soc, &soc->reo_dest_ring[pdev_id], REO_DST, |
| 2506 | pdev_id, pdev_id, REO_DST_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2507 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2508 | FL("dp_srng_setup failed for reo_dest_ringn")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2509 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2510 | } |
| 2511 | soc->num_reo_dest_rings++; |
| 2512 | |
| 2513 | } |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 2514 | if (dp_srng_setup(soc, &pdev->rx_refill_buf_ring, RXDMA_BUF, 0, pdev_id, |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2515 | RXDMA_REFILL_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2516 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2517 | FL("dp_srng_setup failed rx refill ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2518 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2519 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2520 | |
| 2521 | if (dp_rxdma_ring_setup(soc, pdev)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2522 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2523 | FL("RXDMA ring config failed")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2524 | goto fail1; |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 2525 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2526 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2527 | if (dp_srng_setup(soc, &pdev->rxdma_mon_buf_ring, RXDMA_MONITOR_BUF, 0, |
| 2528 | pdev_id, RXDMA_MONITOR_BUF_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2529 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2530 | FL("dp_srng_setup failed for rxdma_mon_buf_ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2531 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2532 | } |
| 2533 | |
| 2534 | if (dp_srng_setup(soc, &pdev->rxdma_mon_dst_ring, RXDMA_MONITOR_DST, 0, |
| 2535 | pdev_id, RXDMA_MONITOR_DST_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2536 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2537 | FL("dp_srng_setup failed for rxdma_mon_dst_ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2538 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2539 | } |
| 2540 | |
| 2541 | |
| 2542 | if (dp_srng_setup(soc, &pdev->rxdma_mon_status_ring, |
| 2543 | RXDMA_MONITOR_STATUS, 0, pdev_id, |
| 2544 | RXDMA_MONITOR_STATUS_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2545 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2546 | FL("dp_srng_setup failed for rxdma_mon_status_ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2547 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2548 | } |
| 2549 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2550 | if (dp_srng_setup(soc, &pdev->rxdma_mon_desc_ring, |
| 2551 | RXDMA_MONITOR_DESC, 0, pdev_id, RXDMA_MONITOR_DESC_RING_SIZE)) { |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2552 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2553 | "dp_srng_setup failed for rxdma_mon_desc_ring\n"); |
| 2554 | goto fail1; |
| 2555 | } |
| 2556 | |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 2557 | if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { |
| 2558 | if (dp_srng_setup(soc, &pdev->rxdma_err_dst_ring[0], RXDMA_DST, |
| 2559 | 0, pdev_id, RXDMA_ERR_DST_RING_SIZE)) { |
| 2560 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2561 | FL("dp_srng_setup failed for rxdma_err_dst_ring")); |
| 2562 | goto fail1; |
| 2563 | } |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 2564 | } |
| 2565 | |
Yun Park | 47e6af8 | 2018-01-17 12:15:01 -0800 | [diff] [blame] | 2566 | if (dp_setup_ipa_rx_refill_buf_ring(soc, pdev)) |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2567 | goto fail1; |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2568 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2569 | if (dp_ipa_ring_resource_setup(soc, pdev)) |
| 2570 | goto fail1; |
| 2571 | |
| 2572 | if (dp_ipa_uc_attach(soc, pdev) != QDF_STATUS_SUCCESS) { |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2573 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2574 | FL("dp_ipa_uc_attach failed")); |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2575 | goto fail1; |
| 2576 | } |
| 2577 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2578 | /* Rx specific init */ |
| 2579 | if (dp_rx_pdev_attach(pdev)) { |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2580 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2581 | FL("dp_rx_pdev_attach failed")); |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2582 | goto fail0; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2583 | } |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 2584 | DP_STATS_INIT(pdev); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2585 | |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 2586 | /* Monitor filter init */ |
| 2587 | pdev->mon_filter_mode = MON_FILTER_ALL; |
| 2588 | pdev->fp_mgmt_filter = FILTER_MGMT_ALL; |
| 2589 | pdev->fp_ctrl_filter = FILTER_CTRL_ALL; |
| 2590 | pdev->fp_data_filter = FILTER_DATA_ALL; |
| 2591 | pdev->mo_mgmt_filter = FILTER_MGMT_ALL; |
| 2592 | pdev->mo_ctrl_filter = FILTER_CTRL_ALL; |
| 2593 | pdev->mo_data_filter = FILTER_DATA_ALL; |
| 2594 | |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 2595 | #ifndef CONFIG_WIN |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2596 | /* MCL */ |
| 2597 | dp_local_peer_id_pool_init(pdev); |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 2598 | #endif |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 2599 | dp_dscp_tid_map_setup(pdev); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2600 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2601 | /* Rx monitor mode specific init */ |
| 2602 | if (dp_rx_pdev_mon_attach(pdev)) { |
| 2603 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 2604 | "dp_rx_pdev_attach failed\n"); |
| 2605 | goto fail1; |
| 2606 | } |
| 2607 | |
| 2608 | if (dp_wdi_event_attach(pdev)) { |
| 2609 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2610 | "dp_wdi_evet_attach failed\n"); |
| 2611 | goto fail1; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2612 | } |
| 2613 | |
Om Prakash Tripathi | a7fb93f | 2017-06-27 18:41:41 +0530 | [diff] [blame] | 2614 | /* set the reo destination during initialization */ |
| 2615 | pdev->reo_dest = pdev->pdev_id + 1; |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2616 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2617 | return (struct cdp_pdev *)pdev; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2618 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2619 | fail1: |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2620 | dp_pdev_detach_wifi3((struct cdp_pdev *)pdev, 0); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2621 | |
| 2622 | fail0: |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2623 | return NULL; |
| 2624 | } |
| 2625 | |
| 2626 | /* |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2627 | * dp_rxdma_ring_cleanup() - configure the RX DMA rings |
| 2628 | * @soc: data path SoC handle |
| 2629 | * @pdev: Physical device handle |
| 2630 | * |
| 2631 | * Return: void |
| 2632 | */ |
| 2633 | #ifdef QCA_HOST2FW_RXBUF_RING |
| 2634 | static void dp_rxdma_ring_cleanup(struct dp_soc *soc, |
| 2635 | struct dp_pdev *pdev) |
| 2636 | { |
| 2637 | int max_mac_rings = |
| 2638 | wlan_cfg_get_num_mac_rings(pdev->wlan_cfg_ctx); |
| 2639 | int i; |
| 2640 | |
| 2641 | max_mac_rings = max_mac_rings < MAX_RX_MAC_RINGS ? |
| 2642 | max_mac_rings : MAX_RX_MAC_RINGS; |
| 2643 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) |
| 2644 | dp_srng_cleanup(soc, &pdev->rx_mac_buf_ring[i], |
| 2645 | RXDMA_BUF, 1); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2646 | |
| 2647 | qdf_timer_free(&soc->mon_reap_timer); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2648 | } |
| 2649 | #else |
| 2650 | static void dp_rxdma_ring_cleanup(struct dp_soc *soc, |
| 2651 | struct dp_pdev *pdev) |
| 2652 | { |
| 2653 | } |
| 2654 | #endif |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 2655 | |
| 2656 | /* |
| 2657 | * dp_neighbour_peers_detach() - Detach neighbour peers(nac clients) |
| 2658 | * @pdev: device object |
| 2659 | * |
| 2660 | * Return: void |
| 2661 | */ |
| 2662 | static void dp_neighbour_peers_detach(struct dp_pdev *pdev) |
| 2663 | { |
| 2664 | struct dp_neighbour_peer *peer = NULL; |
| 2665 | struct dp_neighbour_peer *temp_peer = NULL; |
| 2666 | |
| 2667 | TAILQ_FOREACH_SAFE(peer, &pdev->neighbour_peers_list, |
| 2668 | neighbour_peer_list_elem, temp_peer) { |
| 2669 | /* delete this peer from the list */ |
| 2670 | TAILQ_REMOVE(&pdev->neighbour_peers_list, |
| 2671 | peer, neighbour_peer_list_elem); |
| 2672 | qdf_mem_free(peer); |
| 2673 | } |
| 2674 | |
| 2675 | qdf_spinlock_destroy(&pdev->neighbour_peer_mutex); |
| 2676 | } |
| 2677 | |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2678 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2679 | * dp_pdev_detach_wifi3() - detach txrx pdev |
| 2680 | * @txrx_pdev: Datapath PDEV handle |
| 2681 | * @force: Force detach |
| 2682 | * |
| 2683 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2684 | static void dp_pdev_detach_wifi3(struct cdp_pdev *txrx_pdev, int force) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2685 | { |
| 2686 | struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev; |
| 2687 | struct dp_soc *soc = pdev->soc; |
Tallapragada Kalyan | 9403463 | 2017-12-07 17:29:13 +0530 | [diff] [blame] | 2688 | qdf_nbuf_t curr_nbuf, next_nbuf; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2689 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 2690 | dp_wdi_event_detach(pdev); |
| 2691 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 2692 | dp_tx_pdev_detach(pdev); |
| 2693 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2694 | if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { |
| 2695 | dp_srng_cleanup(soc, &soc->tcl_data_ring[pdev->pdev_id], |
| 2696 | TCL_DATA, pdev->pdev_id); |
| 2697 | dp_srng_cleanup(soc, &soc->tx_comp_ring[pdev->pdev_id], |
| 2698 | WBM2SW_RELEASE, pdev->pdev_id); |
| 2699 | } |
| 2700 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2701 | dp_pktlogmod_exit(pdev); |
| 2702 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2703 | dp_rx_pdev_detach(pdev); |
| 2704 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2705 | dp_rx_pdev_mon_detach(pdev); |
| 2706 | |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 2707 | dp_neighbour_peers_detach(pdev); |
Pamidipati, Vijay | 9c9a287 | 2017-05-31 10:06:34 +0530 | [diff] [blame] | 2708 | qdf_spinlock_destroy(&pdev->tx_mutex); |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 2709 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2710 | dp_ipa_uc_detach(soc, pdev); |
| 2711 | |
Yun Park | 47e6af8 | 2018-01-17 12:15:01 -0800 | [diff] [blame] | 2712 | dp_cleanup_ipa_rx_refill_buf_ring(soc, pdev); |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2713 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2714 | /* Cleanup per PDEV REO rings if configured */ |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2715 | if (wlan_cfg_per_pdev_rx_ring(soc->wlan_cfg_ctx)) { |
| 2716 | dp_srng_cleanup(soc, &soc->reo_dest_ring[pdev->pdev_id], |
| 2717 | REO_DST, pdev->pdev_id); |
| 2718 | } |
| 2719 | |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 2720 | dp_srng_cleanup(soc, &pdev->rx_refill_buf_ring, RXDMA_BUF, 0); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2721 | |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2722 | dp_rxdma_ring_cleanup(soc, pdev); |
| 2723 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2724 | dp_srng_cleanup(soc, &pdev->rxdma_mon_buf_ring, RXDMA_MONITOR_BUF, 0); |
| 2725 | |
| 2726 | dp_srng_cleanup(soc, &pdev->rxdma_mon_dst_ring, RXDMA_MONITOR_DST, 0); |
| 2727 | |
| 2728 | dp_srng_cleanup(soc, &pdev->rxdma_mon_status_ring, |
| 2729 | RXDMA_MONITOR_STATUS, 0); |
| 2730 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2731 | dp_srng_cleanup(soc, &pdev->rxdma_mon_desc_ring, |
| 2732 | RXDMA_MONITOR_DESC, 0); |
| 2733 | |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 2734 | if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { |
| 2735 | dp_srng_cleanup(soc, &pdev->rxdma_err_dst_ring[0], RXDMA_DST, 0); |
| 2736 | } else { |
| 2737 | int i; |
| 2738 | |
| 2739 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) |
| 2740 | dp_srng_cleanup(soc, &pdev->rxdma_err_dst_ring[i], |
| 2741 | RXDMA_DST, 0); |
| 2742 | } |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 2743 | |
Tallapragada Kalyan | 9403463 | 2017-12-07 17:29:13 +0530 | [diff] [blame] | 2744 | curr_nbuf = pdev->invalid_peer_head_msdu; |
| 2745 | while (curr_nbuf) { |
| 2746 | next_nbuf = qdf_nbuf_next(curr_nbuf); |
| 2747 | qdf_nbuf_free(curr_nbuf); |
| 2748 | curr_nbuf = next_nbuf; |
| 2749 | } |
| 2750 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2751 | soc->pdev_list[pdev->pdev_id] = NULL; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 2752 | soc->pdev_count--; |
Manikandan Mohan | b01696b | 2017-05-09 18:03:19 -0700 | [diff] [blame] | 2753 | wlan_cfg_pdev_detach(pdev->wlan_cfg_ctx); |
Santosh Anbu | 2280e86 | 2018-01-03 22:25:53 +0530 | [diff] [blame] | 2754 | qdf_mem_free(pdev->dp_txrx_handle); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2755 | qdf_mem_free(pdev); |
| 2756 | } |
| 2757 | |
| 2758 | /* |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 2759 | * dp_reo_desc_freelist_destroy() - Flush REO descriptors from deferred freelist |
| 2760 | * @soc: DP SOC handle |
| 2761 | */ |
| 2762 | static inline void dp_reo_desc_freelist_destroy(struct dp_soc *soc) |
| 2763 | { |
| 2764 | struct reo_desc_list_node *desc; |
| 2765 | struct dp_rx_tid *rx_tid; |
| 2766 | |
| 2767 | qdf_spin_lock_bh(&soc->reo_desc_freelist_lock); |
| 2768 | while (qdf_list_remove_front(&soc->reo_desc_freelist, |
| 2769 | (qdf_list_node_t **)&desc) == QDF_STATUS_SUCCESS) { |
| 2770 | rx_tid = &desc->rx_tid; |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 2771 | qdf_mem_unmap_nbytes_single(soc->osdev, |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 2772 | rx_tid->hw_qdesc_paddr, |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 2773 | QDF_DMA_BIDIRECTIONAL, |
| 2774 | rx_tid->hw_qdesc_alloc_size); |
| 2775 | qdf_mem_free(rx_tid->hw_qdesc_vaddr_unaligned); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 2776 | qdf_mem_free(desc); |
| 2777 | } |
| 2778 | qdf_spin_unlock_bh(&soc->reo_desc_freelist_lock); |
| 2779 | qdf_list_destroy(&soc->reo_desc_freelist); |
| 2780 | qdf_spinlock_destroy(&soc->reo_desc_freelist_lock); |
| 2781 | } |
| 2782 | |
| 2783 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2784 | * dp_soc_detach_wifi3() - Detach txrx SOC |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 2785 | * @txrx_soc: DP SOC handle, struct cdp_soc_t is first element of struct dp_soc. |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2786 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 2787 | static void dp_soc_detach_wifi3(void *txrx_soc) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2788 | { |
| 2789 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2790 | int i; |
| 2791 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 2792 | qdf_atomic_set(&soc->cmn_init_done, 0); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2793 | |
Dustin Brown | f653d16 | 2017-09-19 11:29:41 -0700 | [diff] [blame] | 2794 | qdf_flush_work(&soc->htt_stats.work); |
| 2795 | qdf_disable_work(&soc->htt_stats.work); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2796 | |
| 2797 | /* Free pending htt stats messages */ |
| 2798 | qdf_nbuf_queue_free(&soc->htt_stats.msg); |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 2799 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 2800 | dp_free_inact_timer(soc); |
| 2801 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2802 | for (i = 0; i < MAX_PDEV_CNT; i++) { |
| 2803 | if (soc->pdev_list[i]) |
Kiran Venkatappa | 5dba3a3 | 2017-03-01 16:00:22 +0530 | [diff] [blame] | 2804 | dp_pdev_detach_wifi3( |
| 2805 | (struct cdp_pdev *)soc->pdev_list[i], 1); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2806 | } |
| 2807 | |
| 2808 | dp_peer_find_detach(soc); |
| 2809 | |
| 2810 | /* TBD: Call Tx and Rx cleanup functions to free buffers and |
| 2811 | * SW descriptors |
| 2812 | */ |
| 2813 | |
| 2814 | /* Free the ring memories */ |
| 2815 | /* Common rings */ |
| 2816 | dp_srng_cleanup(soc, &soc->wbm_desc_rel_ring, SW2WBM_RELEASE, 0); |
| 2817 | |
Manikandan Mohan | b01696b | 2017-05-09 18:03:19 -0700 | [diff] [blame] | 2818 | dp_tx_soc_detach(soc); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2819 | /* Tx data rings */ |
| 2820 | if (!wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { |
| 2821 | for (i = 0; i < soc->num_tcl_data_rings; i++) { |
| 2822 | dp_srng_cleanup(soc, &soc->tcl_data_ring[i], |
| 2823 | TCL_DATA, i); |
| 2824 | dp_srng_cleanup(soc, &soc->tx_comp_ring[i], |
| 2825 | WBM2SW_RELEASE, i); |
| 2826 | } |
| 2827 | } |
| 2828 | |
| 2829 | /* TCL command and status rings */ |
| 2830 | dp_srng_cleanup(soc, &soc->tcl_cmd_ring, TCL_CMD, 0); |
| 2831 | dp_srng_cleanup(soc, &soc->tcl_status_ring, TCL_STATUS, 0); |
| 2832 | |
| 2833 | /* Rx data rings */ |
| 2834 | if (!wlan_cfg_per_pdev_rx_ring(soc->wlan_cfg_ctx)) { |
| 2835 | soc->num_reo_dest_rings = |
| 2836 | wlan_cfg_num_reo_dest_rings(soc->wlan_cfg_ctx); |
| 2837 | for (i = 0; i < soc->num_reo_dest_rings; i++) { |
| 2838 | /* TODO: Get number of rings and ring sizes |
| 2839 | * from wlan_cfg |
| 2840 | */ |
| 2841 | dp_srng_cleanup(soc, &soc->reo_dest_ring[i], |
| 2842 | REO_DST, i); |
| 2843 | } |
| 2844 | } |
| 2845 | /* REO reinjection ring */ |
| 2846 | dp_srng_cleanup(soc, &soc->reo_reinject_ring, REO_REINJECT, 0); |
| 2847 | |
| 2848 | /* Rx release ring */ |
| 2849 | dp_srng_cleanup(soc, &soc->rx_rel_ring, WBM2SW_RELEASE, 0); |
| 2850 | |
| 2851 | /* Rx exception ring */ |
| 2852 | /* TODO: Better to store ring_type and ring_num in |
| 2853 | * dp_srng during setup |
| 2854 | */ |
| 2855 | dp_srng_cleanup(soc, &soc->reo_exception_ring, REO_EXCEPTION, 0); |
| 2856 | |
| 2857 | /* REO command and status rings */ |
| 2858 | dp_srng_cleanup(soc, &soc->reo_cmd_ring, REO_CMD, 0); |
| 2859 | dp_srng_cleanup(soc, &soc->reo_status_ring, REO_STATUS, 0); |
Manoj Ekbote | 525bcab | 2017-09-01 17:23:32 -0700 | [diff] [blame] | 2860 | dp_hw_link_desc_pool_cleanup(soc); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 2861 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2862 | qdf_spinlock_destroy(&soc->peer_ref_mutex); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2863 | qdf_spinlock_destroy(&soc->htt_stats.lock); |
| 2864 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2865 | htt_soc_detach(soc->htt_handle); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 2866 | |
Manoj Ekbote | 2a372d2 | 2017-06-29 14:54:57 -0700 | [diff] [blame] | 2867 | dp_reo_cmdlist_destroy(soc); |
| 2868 | qdf_spinlock_destroy(&soc->rx.reo_cmd_lock); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 2869 | dp_reo_desc_freelist_destroy(soc); |
Manoj Ekbote | 2a372d2 | 2017-06-29 14:54:57 -0700 | [diff] [blame] | 2870 | |
Manikandan Mohan | b01696b | 2017-05-09 18:03:19 -0700 | [diff] [blame] | 2871 | wlan_cfg_soc_detach(soc->wlan_cfg_ctx); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 2872 | |
| 2873 | dp_soc_wds_detach(soc); |
Yun Park | 92af713 | 2017-09-13 16:33:35 -0700 | [diff] [blame] | 2874 | qdf_spinlock_destroy(&soc->ast_lock); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 2875 | |
Venkata Sharath Chandra Manchala | 65bf230 | 2017-03-09 17:28:56 -0800 | [diff] [blame] | 2876 | qdf_mem_free(soc); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2877 | } |
| 2878 | |
| 2879 | /* |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2880 | * dp_rxdma_ring_config() - configure the RX DMA rings |
| 2881 | * |
| 2882 | * This function is used to configure the MAC rings. |
| 2883 | * On MCL host provides buffers in Host2FW ring |
| 2884 | * FW refills (copies) buffers to the ring and updates |
| 2885 | * ring_idx in register |
| 2886 | * |
| 2887 | * @soc: data path SoC handle |
| 2888 | * |
| 2889 | * Return: void |
| 2890 | */ |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2891 | #ifdef QCA_HOST2FW_RXBUF_RING |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2892 | static void dp_rxdma_ring_config(struct dp_soc *soc) |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2893 | { |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2894 | int i; |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2895 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2896 | for (i = 0; i < MAX_PDEV_CNT; i++) { |
| 2897 | struct dp_pdev *pdev = soc->pdev_list[i]; |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2898 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2899 | if (pdev) { |
| 2900 | int mac_id = 0; |
| 2901 | int j; |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 2902 | bool dbs_enable = 0; |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2903 | int max_mac_rings = |
| 2904 | wlan_cfg_get_num_mac_rings |
| 2905 | (pdev->wlan_cfg_ctx); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2906 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2907 | htt_srng_setup(soc->htt_handle, 0, |
| 2908 | pdev->rx_refill_buf_ring.hal_srng, |
| 2909 | RXDMA_BUF); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2910 | |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2911 | if (pdev->rx_refill_buf_ring2.hal_srng) |
| 2912 | htt_srng_setup(soc->htt_handle, 0, |
| 2913 | pdev->rx_refill_buf_ring2.hal_srng, |
| 2914 | RXDMA_BUF); |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2915 | |
Dhanashri Atre | 2c6381d | 2017-03-30 19:33:52 -0700 | [diff] [blame] | 2916 | if (soc->cdp_soc.ol_ops-> |
| 2917 | is_hw_dbs_2x2_capable) { |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 2918 | dbs_enable = soc->cdp_soc.ol_ops-> |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 2919 | is_hw_dbs_2x2_capable(soc->ctrl_psoc); |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 2920 | } |
| 2921 | |
| 2922 | if (dbs_enable) { |
| 2923 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 2924 | QDF_TRACE_LEVEL_ERROR, |
| 2925 | FL("DBS enabled max_mac_rings %d\n"), |
| 2926 | max_mac_rings); |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2927 | } else { |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 2928 | max_mac_rings = 1; |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2929 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 2930 | QDF_TRACE_LEVEL_ERROR, |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 2931 | FL("DBS disabled, max_mac_rings %d\n"), |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2932 | max_mac_rings); |
| 2933 | } |
| 2934 | |
| 2935 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2936 | FL("pdev_id %d max_mac_rings %d\n"), |
| 2937 | pdev->pdev_id, max_mac_rings); |
| 2938 | |
| 2939 | for (j = 0; j < max_mac_rings; j++) { |
| 2940 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 2941 | QDF_TRACE_LEVEL_ERROR, |
| 2942 | FL("mac_id %d\n"), mac_id); |
| 2943 | htt_srng_setup(soc->htt_handle, mac_id, |
| 2944 | pdev->rx_mac_buf_ring[j] |
| 2945 | .hal_srng, |
| 2946 | RXDMA_BUF); |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 2947 | htt_srng_setup(soc->htt_handle, mac_id, |
| 2948 | pdev->rxdma_err_dst_ring[j] |
| 2949 | .hal_srng, |
| 2950 | RXDMA_DST); |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2951 | mac_id++; |
| 2952 | } |
Ravi Joshi | 8851f4e | 2017-06-07 21:22:08 -0700 | [diff] [blame] | 2953 | |
| 2954 | /* Configure monitor mode rings */ |
| 2955 | htt_srng_setup(soc->htt_handle, i, |
| 2956 | pdev->rxdma_mon_buf_ring.hal_srng, |
| 2957 | RXDMA_MONITOR_BUF); |
| 2958 | |
| 2959 | htt_srng_setup(soc->htt_handle, i, |
| 2960 | pdev->rxdma_mon_dst_ring.hal_srng, |
| 2961 | RXDMA_MONITOR_DST); |
| 2962 | |
| 2963 | htt_srng_setup(soc->htt_handle, i, |
| 2964 | pdev->rxdma_mon_status_ring.hal_srng, |
| 2965 | RXDMA_MONITOR_STATUS); |
| 2966 | |
| 2967 | htt_srng_setup(soc->htt_handle, i, |
| 2968 | pdev->rxdma_mon_desc_ring.hal_srng, |
| 2969 | RXDMA_MONITOR_DESC); |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2970 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2971 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2972 | |
| 2973 | /* |
| 2974 | * Timer to reap rxdma status rings. |
| 2975 | * Needed until we enable ppdu end interrupts |
| 2976 | */ |
| 2977 | qdf_timer_init(soc->osdev, &soc->mon_reap_timer, |
| 2978 | dp_service_mon_rings, (void *)soc, |
| 2979 | QDF_TIMER_TYPE_WAKE_APPS); |
| 2980 | soc->reap_timer_init = 1; |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2981 | } |
| 2982 | #else |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2983 | static void dp_rxdma_ring_config(struct dp_soc *soc) |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2984 | { |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2985 | int i; |
| 2986 | |
| 2987 | for (i = 0; i < MAX_PDEV_CNT; i++) { |
| 2988 | struct dp_pdev *pdev = soc->pdev_list[i]; |
| 2989 | |
| 2990 | if (pdev) { |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 2991 | int ring_idx = dp_get_ring_id_for_mac_id(soc, i); |
| 2992 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 2993 | htt_srng_setup(soc->htt_handle, i, |
| 2994 | pdev->rx_refill_buf_ring.hal_srng, RXDMA_BUF); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2995 | |
| 2996 | htt_srng_setup(soc->htt_handle, i, |
| 2997 | pdev->rxdma_mon_buf_ring.hal_srng, |
| 2998 | RXDMA_MONITOR_BUF); |
| 2999 | htt_srng_setup(soc->htt_handle, i, |
| 3000 | pdev->rxdma_mon_dst_ring.hal_srng, |
| 3001 | RXDMA_MONITOR_DST); |
| 3002 | htt_srng_setup(soc->htt_handle, i, |
| 3003 | pdev->rxdma_mon_status_ring.hal_srng, |
| 3004 | RXDMA_MONITOR_STATUS); |
| 3005 | htt_srng_setup(soc->htt_handle, i, |
| 3006 | pdev->rxdma_mon_desc_ring.hal_srng, |
| 3007 | RXDMA_MONITOR_DESC); |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 3008 | htt_srng_setup(soc->htt_handle, i, |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 3009 | pdev->rxdma_err_dst_ring[ring_idx].hal_srng, |
| 3010 | RXDMA_DST); |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3011 | } |
| 3012 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3013 | } |
| 3014 | #endif |
| 3015 | |
| 3016 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3017 | * dp_soc_attach_target_wifi3() - SOC initialization in the target |
| 3018 | * @txrx_soc: Datapath SOC handle |
| 3019 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 3020 | static int dp_soc_attach_target_wifi3(struct cdp_soc_t *cdp_soc) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3021 | { |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3022 | struct dp_soc *soc = (struct dp_soc *)cdp_soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3023 | |
| 3024 | htt_soc_attach_target(soc->htt_handle); |
| 3025 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3026 | dp_rxdma_ring_config(soc); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3027 | |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 3028 | DP_STATS_INIT(soc); |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 3029 | |
| 3030 | /* initialize work queue for stats processing */ |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 3031 | qdf_create_work(0, &soc->htt_stats.work, htt_t2h_stats_handler, soc); |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 3032 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3033 | return 0; |
| 3034 | } |
| 3035 | |
| 3036 | /* |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 3037 | * dp_soc_get_nss_cfg_wifi3() - SOC get nss config |
| 3038 | * @txrx_soc: Datapath SOC handle |
| 3039 | */ |
| 3040 | static int dp_soc_get_nss_cfg_wifi3(struct cdp_soc_t *cdp_soc) |
| 3041 | { |
| 3042 | struct dp_soc *dsoc = (struct dp_soc *)cdp_soc; |
| 3043 | return wlan_cfg_get_dp_soc_nss_cfg(dsoc->wlan_cfg_ctx); |
| 3044 | } |
| 3045 | /* |
| 3046 | * dp_soc_set_nss_cfg_wifi3() - SOC set nss config |
| 3047 | * @txrx_soc: Datapath SOC handle |
| 3048 | * @nss_cfg: nss config |
| 3049 | */ |
| 3050 | static void dp_soc_set_nss_cfg_wifi3(struct cdp_soc_t *cdp_soc, int config) |
| 3051 | { |
| 3052 | struct dp_soc *dsoc = (struct dp_soc *)cdp_soc; |
Aniruddha Paul | 9d7dc27 | 2018-02-11 19:40:41 +0530 | [diff] [blame] | 3053 | struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx = dsoc->wlan_cfg_ctx; |
| 3054 | |
| 3055 | wlan_cfg_set_dp_soc_nss_cfg(wlan_cfg_ctx, config); |
| 3056 | |
| 3057 | /* |
| 3058 | * TODO: masked out based on the per offloaded radio |
| 3059 | */ |
| 3060 | if (config == dp_nss_cfg_dbdc) { |
| 3061 | wlan_cfg_set_num_tx_desc_pool(wlan_cfg_ctx, 0); |
| 3062 | wlan_cfg_set_num_tx_ext_desc_pool(wlan_cfg_ctx, 0); |
| 3063 | wlan_cfg_set_num_tx_desc(wlan_cfg_ctx, 0); |
| 3064 | wlan_cfg_set_num_tx_ext_desc(wlan_cfg_ctx, 0); |
| 3065 | } |
| 3066 | |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 3067 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3068 | FL("nss-wifi<0> nss config is enabled")); |
| 3069 | } |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 3070 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3071 | * dp_vdev_attach_wifi3() - attach txrx vdev |
| 3072 | * @txrx_pdev: Datapath PDEV handle |
| 3073 | * @vdev_mac_addr: MAC address of the virtual interface |
| 3074 | * @vdev_id: VDEV Id |
| 3075 | * @wlan_op_mode: VDEV operating mode |
| 3076 | * |
| 3077 | * Return: DP VDEV handle on success, NULL on failure |
| 3078 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3079 | static struct cdp_vdev *dp_vdev_attach_wifi3(struct cdp_pdev *txrx_pdev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3080 | uint8_t *vdev_mac_addr, uint8_t vdev_id, enum wlan_op_mode op_mode) |
| 3081 | { |
| 3082 | struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev; |
| 3083 | struct dp_soc *soc = pdev->soc; |
| 3084 | struct dp_vdev *vdev = qdf_mem_malloc(sizeof(*vdev)); |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 3085 | int tx_ring_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3086 | |
| 3087 | if (!vdev) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3088 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3089 | FL("DP VDEV memory allocation failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3090 | goto fail0; |
| 3091 | } |
| 3092 | |
| 3093 | vdev->pdev = pdev; |
| 3094 | vdev->vdev_id = vdev_id; |
| 3095 | vdev->opmode = op_mode; |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 3096 | vdev->osdev = soc->osdev; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3097 | |
| 3098 | vdev->osif_rx = NULL; |
Venkateswara Swamy Bandaru | bfbef4f | 2016-12-16 19:12:31 +0530 | [diff] [blame] | 3099 | vdev->osif_rsim_rx_decap = NULL; |
Venkateswara Swamy Bandaru | 3f4e1c4 | 2017-07-10 19:47:09 +0530 | [diff] [blame] | 3100 | vdev->osif_get_key = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3101 | vdev->osif_rx_mon = NULL; |
Venkateswara Swamy Bandaru | 9748234 | 2017-02-16 12:04:50 +0530 | [diff] [blame] | 3102 | vdev->osif_tx_free_ext = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3103 | vdev->osif_vdev = NULL; |
| 3104 | |
| 3105 | vdev->delete.pending = 0; |
| 3106 | vdev->safemode = 0; |
| 3107 | vdev->drop_unenc = 1; |
ruchi agrawal | 45f3ac4 | 2017-10-25 09:03:28 +0530 | [diff] [blame] | 3108 | vdev->sec_type = cdp_sec_type_none; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3109 | #ifdef notyet |
| 3110 | vdev->filters_num = 0; |
| 3111 | #endif |
| 3112 | |
| 3113 | qdf_mem_copy( |
| 3114 | &vdev->mac_addr.raw[0], vdev_mac_addr, OL_TXRX_MAC_ADDR_LEN); |
| 3115 | |
| 3116 | vdev->tx_encap_type = wlan_cfg_pkt_type(soc->wlan_cfg_ctx); |
| 3117 | vdev->rx_decap_type = wlan_cfg_pkt_type(soc->wlan_cfg_ctx); |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 3118 | vdev->dscp_tid_map_id = 0; |
Ishank Jain | c838b13 | 2017-02-17 11:08:18 +0530 | [diff] [blame] | 3119 | vdev->mcast_enhancement_en = 0; |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 3120 | tx_ring_size = wlan_cfg_tx_ring_size(soc->wlan_cfg_ctx); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3121 | |
| 3122 | /* TODO: Initialize default HTT meta data that will be used in |
| 3123 | * TCL descriptors for packets transmitted from this VDEV |
| 3124 | */ |
| 3125 | |
| 3126 | TAILQ_INIT(&vdev->peer_list); |
| 3127 | |
| 3128 | /* add this vdev into the pdev's list */ |
| 3129 | TAILQ_INSERT_TAIL(&pdev->vdev_list, vdev, vdev_list_elem); |
| 3130 | pdev->vdev_count++; |
| 3131 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 3132 | dp_tx_vdev_attach(vdev); |
| 3133 | |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 3134 | if (QDF_STATUS_SUCCESS != dp_tx_flow_pool_map_handler(pdev, vdev_id, |
| 3135 | FLOW_TYPE_VDEV, vdev_id, tx_ring_size)) |
| 3136 | goto fail1; |
| 3137 | |
| 3138 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 3139 | if ((soc->intr_mode == DP_INTR_POLL) && |
| 3140 | wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx) != 0) { |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 3141 | if (pdev->vdev_count == 1) |
| 3142 | qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); |
| 3143 | } |
Vijay Pamidipati | 88c40ff | 2016-11-17 21:27:02 +0530 | [diff] [blame] | 3144 | |
Dhanashri Atre | b178eb4 | 2017-03-21 12:32:33 -0700 | [diff] [blame] | 3145 | dp_lro_hash_setup(soc); |
| 3146 | |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 3147 | /* LRO */ |
| 3148 | if (wlan_cfg_is_lro_enabled(soc->wlan_cfg_ctx) && |
| 3149 | wlan_op_mode_sta == vdev->opmode) |
| 3150 | vdev->lro_enable = true; |
| 3151 | |
| 3152 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 3153 | "LRO: vdev_id %d lro_enable %d", vdev_id, vdev->lro_enable); |
| 3154 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3155 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3156 | "Created vdev %pK (%pM)", vdev, vdev->mac_addr.raw); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 3157 | DP_STATS_INIT(vdev); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3158 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 3159 | if (wlan_op_mode_sta == vdev->opmode) |
| 3160 | dp_peer_create_wifi3((struct cdp_vdev *)vdev, |
| 3161 | vdev->mac_addr.raw); |
| 3162 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3163 | return (struct cdp_vdev *)vdev; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3164 | |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 3165 | fail1: |
| 3166 | dp_tx_vdev_detach(vdev); |
| 3167 | qdf_mem_free(vdev); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3168 | fail0: |
| 3169 | return NULL; |
| 3170 | } |
| 3171 | |
| 3172 | /** |
| 3173 | * dp_vdev_register_wifi3() - Register VDEV operations from osif layer |
| 3174 | * @vdev: Datapath VDEV handle |
| 3175 | * @osif_vdev: OSIF vdev handle |
| 3176 | * @txrx_ops: Tx and Rx operations |
| 3177 | * |
| 3178 | * Return: DP VDEV handle on success, NULL on failure |
| 3179 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3180 | static void dp_vdev_register_wifi3(struct cdp_vdev *vdev_handle, |
| 3181 | void *osif_vdev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3182 | struct ol_txrx_ops *txrx_ops) |
| 3183 | { |
| 3184 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3185 | vdev->osif_vdev = osif_vdev; |
| 3186 | vdev->osif_rx = txrx_ops->rx.rx; |
Venkateswara Swamy Bandaru | bfbef4f | 2016-12-16 19:12:31 +0530 | [diff] [blame] | 3187 | vdev->osif_rsim_rx_decap = txrx_ops->rx.rsim_rx_decap; |
Venkateswara Swamy Bandaru | 3f4e1c4 | 2017-07-10 19:47:09 +0530 | [diff] [blame] | 3188 | vdev->osif_get_key = txrx_ops->get_key; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3189 | vdev->osif_rx_mon = txrx_ops->rx.mon; |
Venkateswara Swamy Bandaru | 9748234 | 2017-02-16 12:04:50 +0530 | [diff] [blame] | 3190 | vdev->osif_tx_free_ext = txrx_ops->tx.tx_free_ext; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3191 | #ifdef notyet |
| 3192 | #if ATH_SUPPORT_WAPI |
| 3193 | vdev->osif_check_wai = txrx_ops->rx.wai_check; |
| 3194 | #endif |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3195 | #endif |
Ishank Jain | 997955e | 2017-03-24 18:18:50 +0530 | [diff] [blame] | 3196 | #ifdef UMAC_SUPPORT_PROXY_ARP |
| 3197 | vdev->osif_proxy_arp = txrx_ops->proxy_arp; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3198 | #endif |
Ishank Jain | c838b13 | 2017-02-17 11:08:18 +0530 | [diff] [blame] | 3199 | vdev->me_convert = txrx_ops->me_convert; |
| 3200 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3201 | /* TODO: Enable the following once Tx code is integrated */ |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 3202 | if (vdev->mesh_vdev) |
| 3203 | txrx_ops->tx.tx = dp_tx_send_mesh; |
| 3204 | else |
| 3205 | txrx_ops->tx.tx = dp_tx_send; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3206 | |
Prathyusha Guduri | be41d97 | 2018-01-19 14:17:14 +0530 | [diff] [blame] | 3207 | txrx_ops->tx.tx_exception = dp_tx_send_exception; |
| 3208 | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 3209 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3210 | "DP Vdev Register success"); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3211 | } |
| 3212 | |
Vinay Adella | 4ca1bf6 | 2018-02-26 11:03:05 +0530 | [diff] [blame] | 3213 | /** |
| 3214 | * dp_vdev_flush_peers() - Forcibily Flush peers of vdev |
| 3215 | * @vdev: Datapath VDEV handle |
| 3216 | * |
| 3217 | * Return: void |
| 3218 | */ |
| 3219 | static void dp_vdev_flush_peers(struct dp_vdev *vdev) |
| 3220 | { |
| 3221 | struct dp_pdev *pdev = vdev->pdev; |
| 3222 | struct dp_soc *soc = pdev->soc; |
| 3223 | struct dp_peer *peer; |
| 3224 | uint16_t *peer_ids; |
| 3225 | uint8_t i = 0, j = 0; |
| 3226 | |
| 3227 | peer_ids = qdf_mem_malloc(soc->max_peers * sizeof(peer_ids[0])); |
| 3228 | if (!peer_ids) { |
| 3229 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3230 | "DP alloc failure - unable to flush peers"); |
| 3231 | return; |
| 3232 | } |
| 3233 | |
| 3234 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 3235 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 3236 | for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) |
| 3237 | if (peer->peer_ids[i] != HTT_INVALID_PEER) |
| 3238 | if (j < soc->max_peers) |
| 3239 | peer_ids[j++] = peer->peer_ids[i]; |
| 3240 | } |
| 3241 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3242 | |
| 3243 | for (i = 0; i < j ; i++) |
| 3244 | dp_rx_peer_unmap_handler(soc, peer_ids[i]); |
| 3245 | |
| 3246 | qdf_mem_free(peer_ids); |
| 3247 | |
| 3248 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
| 3249 | FL("Flushed peers for vdev object %pK "), vdev); |
| 3250 | } |
| 3251 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3252 | /* |
| 3253 | * dp_vdev_detach_wifi3() - Detach txrx vdev |
| 3254 | * @txrx_vdev: Datapath VDEV handle |
| 3255 | * @callback: Callback OL_IF on completion of detach |
| 3256 | * @cb_context: Callback context |
| 3257 | * |
| 3258 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3259 | static void dp_vdev_detach_wifi3(struct cdp_vdev *vdev_handle, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3260 | ol_txrx_vdev_delete_cb callback, void *cb_context) |
| 3261 | { |
| 3262 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3263 | struct dp_pdev *pdev = vdev->pdev; |
| 3264 | struct dp_soc *soc = pdev->soc; |
| 3265 | |
| 3266 | /* preconditions */ |
| 3267 | qdf_assert(vdev); |
| 3268 | |
| 3269 | /* remove the vdev from its parent pdev's list */ |
| 3270 | TAILQ_REMOVE(&pdev->vdev_list, vdev, vdev_list_elem); |
| 3271 | |
Tallapragada Kalyan | 9d9cbb6 | 2018-02-26 17:39:12 +0530 | [diff] [blame] | 3272 | if (wlan_op_mode_sta == vdev->opmode) |
| 3273 | dp_peer_delete_wifi3(vdev->vap_bss_peer, 0); |
| 3274 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3275 | /* |
Vinay Adella | 4ca1bf6 | 2018-02-26 11:03:05 +0530 | [diff] [blame] | 3276 | * If Target is hung, flush all peers before detaching vdev |
| 3277 | * this will free all references held due to missing |
| 3278 | * unmap commands from Target |
| 3279 | */ |
| 3280 | if (hif_get_target_status(soc->hif_handle) == TARGET_STATUS_RESET) |
| 3281 | dp_vdev_flush_peers(vdev); |
| 3282 | |
| 3283 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3284 | * Use peer_ref_mutex while accessing peer_list, in case |
| 3285 | * a peer is in the process of being removed from the list. |
| 3286 | */ |
| 3287 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 3288 | /* check that the vdev has no peers allocated */ |
| 3289 | if (!TAILQ_EMPTY(&vdev->peer_list)) { |
| 3290 | /* debug print - will be removed later */ |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3291 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3292 | FL("not deleting vdev object %pK (%pM)" |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3293 | "until deletion finishes for all its peers"), |
| 3294 | vdev, vdev->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3295 | /* indicate that the vdev needs to be deleted */ |
| 3296 | vdev->delete.pending = 1; |
| 3297 | vdev->delete.callback = callback; |
| 3298 | vdev->delete.context = cb_context; |
| 3299 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3300 | return; |
| 3301 | } |
| 3302 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3303 | |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 3304 | dp_tx_flow_pool_unmap_handler(pdev, vdev->vdev_id, FLOW_TYPE_VDEV, |
| 3305 | vdev->vdev_id); |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 3306 | dp_tx_vdev_detach(vdev); |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3307 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3308 | FL("deleting vdev object %pK (%pM)"), vdev, vdev->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3309 | |
| 3310 | qdf_mem_free(vdev); |
| 3311 | |
| 3312 | if (callback) |
| 3313 | callback(cb_context); |
| 3314 | } |
| 3315 | |
| 3316 | /* |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3317 | * dp_peer_create_wifi3() - attach txrx peer |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3318 | * @txrx_vdev: Datapath VDEV handle |
| 3319 | * @peer_mac_addr: Peer MAC address |
| 3320 | * |
| 3321 | * Return: DP peeer handle on success, NULL on failure |
| 3322 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3323 | static void *dp_peer_create_wifi3(struct cdp_vdev *vdev_handle, |
| 3324 | uint8_t *peer_mac_addr) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3325 | { |
| 3326 | struct dp_peer *peer; |
| 3327 | int i; |
| 3328 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3329 | struct dp_pdev *pdev; |
| 3330 | struct dp_soc *soc; |
| 3331 | |
| 3332 | /* preconditions */ |
| 3333 | qdf_assert(vdev); |
| 3334 | qdf_assert(peer_mac_addr); |
| 3335 | |
| 3336 | pdev = vdev->pdev; |
| 3337 | soc = pdev->soc; |
| 3338 | #ifdef notyet |
| 3339 | peer = (struct dp_peer *)qdf_mempool_alloc(soc->osdev, |
| 3340 | soc->mempool_ol_ath_peer); |
| 3341 | #else |
| 3342 | peer = (struct dp_peer *)qdf_mem_malloc(sizeof(*peer)); |
| 3343 | #endif |
| 3344 | |
| 3345 | if (!peer) |
| 3346 | return NULL; /* failure */ |
| 3347 | |
Tallapragada | 57d8660 | 2017-03-31 07:53:58 +0530 | [diff] [blame] | 3348 | qdf_mem_zero(peer, sizeof(struct dp_peer)); |
| 3349 | |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 3350 | TAILQ_INIT(&peer->ast_entry_list); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 3351 | |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 3352 | /* store provided params */ |
| 3353 | peer->vdev = vdev; |
| 3354 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 3355 | dp_peer_add_ast(soc, peer, peer_mac_addr, CDP_TXRX_AST_TYPE_STATIC, 0); |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 3356 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3357 | qdf_spinlock_create(&peer->peer_info_lock); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3358 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3359 | qdf_mem_copy( |
| 3360 | &peer->mac_addr.raw[0], peer_mac_addr, OL_TXRX_MAC_ADDR_LEN); |
| 3361 | |
| 3362 | /* TODO: See of rx_opt_proc is really required */ |
| 3363 | peer->rx_opt_proc = soc->rx_opt_proc; |
| 3364 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3365 | /* initialize the peer_id */ |
| 3366 | for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) |
| 3367 | peer->peer_ids[i] = HTT_INVALID_PEER; |
| 3368 | |
| 3369 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 3370 | |
| 3371 | qdf_atomic_init(&peer->ref_cnt); |
| 3372 | |
| 3373 | /* keep one reference for attach */ |
| 3374 | qdf_atomic_inc(&peer->ref_cnt); |
| 3375 | |
| 3376 | /* add this peer into the vdev's list */ |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 3377 | if (wlan_op_mode_sta == vdev->opmode) |
| 3378 | TAILQ_INSERT_HEAD(&vdev->peer_list, peer, peer_list_elem); |
| 3379 | else |
| 3380 | TAILQ_INSERT_TAIL(&vdev->peer_list, peer, peer_list_elem); |
| 3381 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3382 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3383 | |
| 3384 | /* TODO: See if hash based search is required */ |
| 3385 | dp_peer_find_hash_add(soc, peer); |
| 3386 | |
Varun Reddy Yeturu | b9ec57e | 2017-11-28 11:42:09 -0800 | [diff] [blame] | 3387 | /* Initialize the peer state */ |
| 3388 | peer->state = OL_TXRX_PEER_STATE_DISC; |
| 3389 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3390 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3391 | "vdev %pK created peer %pK (%pM) ref_cnt: %d", |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 3392 | vdev, peer, peer->mac_addr.raw, |
| 3393 | qdf_atomic_read(&peer->ref_cnt)); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3394 | /* |
| 3395 | * For every peer MAp message search and set if bss_peer |
| 3396 | */ |
| 3397 | if (memcmp(peer->mac_addr.raw, vdev->mac_addr.raw, 6) == 0) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3398 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
| 3399 | "vdev bss_peer!!!!"); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3400 | peer->bss_peer = 1; |
| 3401 | vdev->vap_bss_peer = peer; |
| 3402 | } |
| 3403 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 3404 | |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 3405 | #ifndef CONFIG_WIN |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3406 | dp_local_peer_id_alloc(pdev, peer); |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 3407 | #endif |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 3408 | DP_STATS_INIT(peer); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3409 | return (void *)peer; |
| 3410 | } |
| 3411 | |
| 3412 | /* |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3413 | * dp_peer_setup_wifi3() - initialize the peer |
| 3414 | * @vdev_hdl: virtual device object |
| 3415 | * @peer: Peer object |
| 3416 | * |
| 3417 | * Return: void |
| 3418 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3419 | static void dp_peer_setup_wifi3(struct cdp_vdev *vdev_hdl, void *peer_hdl) |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3420 | { |
| 3421 | struct dp_peer *peer = (struct dp_peer *)peer_hdl; |
| 3422 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_hdl; |
| 3423 | struct dp_pdev *pdev; |
| 3424 | struct dp_soc *soc; |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 3425 | bool hash_based = 0; |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3426 | enum cdp_host_reo_dest_ring reo_dest; |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3427 | |
| 3428 | /* preconditions */ |
| 3429 | qdf_assert(vdev); |
| 3430 | qdf_assert(peer); |
| 3431 | |
| 3432 | pdev = vdev->pdev; |
| 3433 | soc = pdev->soc; |
| 3434 | |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 3435 | peer->last_assoc_rcvd = 0; |
| 3436 | peer->last_disassoc_rcvd = 0; |
| 3437 | peer->last_deauth_rcvd = 0; |
| 3438 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 3439 | /* |
| 3440 | * hash based steering is disabled for Radios which are offloaded |
| 3441 | * to NSS |
| 3442 | */ |
| 3443 | if (!wlan_cfg_get_dp_pdev_nss_enabled(pdev->wlan_cfg_ctx)) |
| 3444 | hash_based = wlan_cfg_is_rx_hash_enabled(soc->wlan_cfg_ctx); |
| 3445 | |
| 3446 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 3447 | FL("hash based steering for pdev: %d is %d\n"), |
| 3448 | pdev->pdev_id, hash_based); |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 3449 | |
Tallapragada Kalyan | 61cb97c | 2017-09-20 12:42:10 +0530 | [diff] [blame] | 3450 | /* |
| 3451 | * Below line of code will ensure the proper reo_dest ring is choosen |
| 3452 | * for cases where toeplitz hash cannot be generated (ex: non TCP/UDP) |
| 3453 | */ |
| 3454 | reo_dest = pdev->reo_dest; |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3455 | |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3456 | if (soc->cdp_soc.ol_ops->peer_set_default_routing) { |
| 3457 | /* TODO: Check the destination ring number to be passed to FW */ |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 3458 | soc->cdp_soc.ol_ops->peer_set_default_routing( |
| 3459 | pdev->osif_pdev, peer->mac_addr.raw, |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3460 | peer->vdev->vdev_id, hash_based, reo_dest); |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3461 | } |
Ruchi, Agrawal | 8e2796b | 2018-02-07 19:07:43 +0530 | [diff] [blame] | 3462 | |
| 3463 | dp_peer_rx_init(pdev, peer); |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3464 | return; |
| 3465 | } |
| 3466 | |
| 3467 | /* |
Kalyan Tallapragada | 277f45e | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 3468 | * dp_set_vdev_tx_encap_type() - set the encap type of the vdev |
| 3469 | * @vdev_handle: virtual device object |
| 3470 | * @htt_pkt_type: type of pkt |
| 3471 | * |
| 3472 | * Return: void |
| 3473 | */ |
| 3474 | static void dp_set_vdev_tx_encap_type(struct cdp_vdev *vdev_handle, |
| 3475 | enum htt_cmn_pkt_type val) |
| 3476 | { |
| 3477 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3478 | vdev->tx_encap_type = val; |
| 3479 | } |
| 3480 | |
| 3481 | /* |
| 3482 | * dp_set_vdev_rx_decap_type() - set the decap type of the vdev |
| 3483 | * @vdev_handle: virtual device object |
| 3484 | * @htt_pkt_type: type of pkt |
| 3485 | * |
| 3486 | * Return: void |
| 3487 | */ |
| 3488 | static void dp_set_vdev_rx_decap_type(struct cdp_vdev *vdev_handle, |
| 3489 | enum htt_cmn_pkt_type val) |
| 3490 | { |
| 3491 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3492 | vdev->rx_decap_type = val; |
| 3493 | } |
| 3494 | |
| 3495 | /* |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3496 | * dp_set_pdev_reo_dest() - set the reo destination ring for this pdev |
| 3497 | * @pdev_handle: physical device object |
| 3498 | * @val: reo destination ring index (1 - 4) |
| 3499 | * |
| 3500 | * Return: void |
| 3501 | */ |
| 3502 | static void dp_set_pdev_reo_dest(struct cdp_pdev *pdev_handle, |
| 3503 | enum cdp_host_reo_dest_ring val) |
| 3504 | { |
| 3505 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3506 | |
| 3507 | if (pdev) |
| 3508 | pdev->reo_dest = val; |
| 3509 | } |
| 3510 | |
| 3511 | /* |
| 3512 | * dp_get_pdev_reo_dest() - get the reo destination for this pdev |
| 3513 | * @pdev_handle: physical device object |
| 3514 | * |
| 3515 | * Return: reo destination ring index |
| 3516 | */ |
| 3517 | static enum cdp_host_reo_dest_ring |
| 3518 | dp_get_pdev_reo_dest(struct cdp_pdev *pdev_handle) |
| 3519 | { |
| 3520 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3521 | |
| 3522 | if (pdev) |
| 3523 | return pdev->reo_dest; |
| 3524 | else |
| 3525 | return cdp_host_reo_dest_ring_unknown; |
| 3526 | } |
| 3527 | |
Bharat Bhushan Chakravarty | 145d393 | 2017-03-20 12:52:16 -0700 | [diff] [blame] | 3528 | #ifdef QCA_SUPPORT_SON |
| 3529 | static void dp_son_peer_authorize(struct dp_peer *peer) |
| 3530 | { |
| 3531 | struct dp_soc *soc; |
| 3532 | soc = peer->vdev->pdev->soc; |
| 3533 | peer->peer_bs_inact_flag = 0; |
| 3534 | peer->peer_bs_inact = soc->pdev_bs_inact_reload; |
| 3535 | return; |
| 3536 | } |
| 3537 | #else |
| 3538 | static void dp_son_peer_authorize(struct dp_peer *peer) |
| 3539 | { |
| 3540 | return; |
| 3541 | } |
| 3542 | #endif |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3543 | /* |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 3544 | * dp_set_filter_neighbour_peers() - set filter neighbour peers for smart mesh |
| 3545 | * @pdev_handle: device object |
| 3546 | * @val: value to be set |
| 3547 | * |
| 3548 | * Return: void |
| 3549 | */ |
| 3550 | static int dp_set_filter_neighbour_peers(struct cdp_pdev *pdev_handle, |
| 3551 | uint32_t val) |
| 3552 | { |
| 3553 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3554 | |
| 3555 | /* Enable/Disable smart mesh filtering. This flag will be checked |
| 3556 | * during rx processing to check if packets are from NAC clients. |
| 3557 | */ |
| 3558 | pdev->filter_neighbour_peers = val; |
| 3559 | return 0; |
| 3560 | } |
| 3561 | |
| 3562 | /* |
| 3563 | * dp_update_filter_neighbour_peers() - set neighbour peers(nac clients) |
| 3564 | * address for smart mesh filtering |
| 3565 | * @pdev_handle: device object |
| 3566 | * @cmd: Add/Del command |
| 3567 | * @macaddr: nac client mac address |
| 3568 | * |
| 3569 | * Return: void |
| 3570 | */ |
| 3571 | static int dp_update_filter_neighbour_peers(struct cdp_pdev *pdev_handle, |
| 3572 | uint32_t cmd, uint8_t *macaddr) |
| 3573 | { |
| 3574 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3575 | struct dp_neighbour_peer *peer = NULL; |
| 3576 | |
| 3577 | if (!macaddr) |
| 3578 | goto fail0; |
| 3579 | |
| 3580 | /* Store address of NAC (neighbour peer) which will be checked |
| 3581 | * against TA of received packets. |
| 3582 | */ |
| 3583 | if (cmd == DP_NAC_PARAM_ADD) { |
| 3584 | peer = (struct dp_neighbour_peer *) qdf_mem_malloc( |
| 3585 | sizeof(*peer)); |
| 3586 | |
| 3587 | if (!peer) { |
| 3588 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3589 | FL("DP neighbour peer node memory allocation failed")); |
| 3590 | goto fail0; |
| 3591 | } |
| 3592 | |
| 3593 | qdf_mem_copy(&peer->neighbour_peers_macaddr.raw[0], |
| 3594 | macaddr, DP_MAC_ADDR_LEN); |
| 3595 | |
| 3596 | |
| 3597 | qdf_spin_lock_bh(&pdev->neighbour_peer_mutex); |
| 3598 | /* add this neighbour peer into the list */ |
| 3599 | TAILQ_INSERT_TAIL(&pdev->neighbour_peers_list, peer, |
| 3600 | neighbour_peer_list_elem); |
| 3601 | qdf_spin_unlock_bh(&pdev->neighbour_peer_mutex); |
| 3602 | |
| 3603 | return 1; |
| 3604 | |
| 3605 | } else if (cmd == DP_NAC_PARAM_DEL) { |
| 3606 | qdf_spin_lock_bh(&pdev->neighbour_peer_mutex); |
| 3607 | TAILQ_FOREACH(peer, &pdev->neighbour_peers_list, |
| 3608 | neighbour_peer_list_elem) { |
| 3609 | if (!qdf_mem_cmp(&peer->neighbour_peers_macaddr.raw[0], |
| 3610 | macaddr, DP_MAC_ADDR_LEN)) { |
| 3611 | /* delete this peer from the list */ |
| 3612 | TAILQ_REMOVE(&pdev->neighbour_peers_list, |
| 3613 | peer, neighbour_peer_list_elem); |
| 3614 | qdf_mem_free(peer); |
| 3615 | break; |
| 3616 | } |
| 3617 | } |
| 3618 | qdf_spin_unlock_bh(&pdev->neighbour_peer_mutex); |
| 3619 | |
| 3620 | return 1; |
| 3621 | |
| 3622 | } |
| 3623 | |
| 3624 | fail0: |
| 3625 | return 0; |
| 3626 | } |
| 3627 | |
| 3628 | /* |
Chaitanya Kiran Godavarthi | 6228e3b | 2017-06-15 14:28:19 +0530 | [diff] [blame] | 3629 | * dp_get_sec_type() - Get the security type |
| 3630 | * @peer: Datapath peer handle |
| 3631 | * @sec_idx: Security id (mcast, ucast) |
| 3632 | * |
| 3633 | * return sec_type: Security type |
| 3634 | */ |
| 3635 | static int dp_get_sec_type(struct cdp_peer *peer, uint8_t sec_idx) |
| 3636 | { |
| 3637 | struct dp_peer *dpeer = (struct dp_peer *)peer; |
| 3638 | |
| 3639 | return dpeer->security[sec_idx].sec_type; |
| 3640 | } |
| 3641 | |
| 3642 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3643 | * dp_peer_authorize() - authorize txrx peer |
| 3644 | * @peer_handle: Datapath peer handle |
| 3645 | * @authorize |
| 3646 | * |
| 3647 | */ |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 3648 | static void dp_peer_authorize(struct cdp_peer *peer_handle, uint32_t authorize) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3649 | { |
| 3650 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 3651 | struct dp_soc *soc; |
| 3652 | |
| 3653 | if (peer != NULL) { |
| 3654 | soc = peer->vdev->pdev->soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3655 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
Bharat Bhushan Chakravarty | 145d393 | 2017-03-20 12:52:16 -0700 | [diff] [blame] | 3656 | dp_son_peer_authorize(peer); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3657 | peer->authorize = authorize ? 1 : 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3658 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3659 | } |
| 3660 | } |
| 3661 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3662 | #ifdef QCA_SUPPORT_SON |
| 3663 | /* |
| 3664 | * dp_txrx_update_inact_threshold() - Update inact timer threshold |
| 3665 | * @pdev_handle: Device handle |
| 3666 | * @new_threshold : updated threshold value |
| 3667 | * |
| 3668 | */ |
| 3669 | static void |
| 3670 | dp_txrx_update_inact_threshold(struct cdp_pdev *pdev_handle, |
| 3671 | u_int16_t new_threshold) |
| 3672 | { |
| 3673 | struct dp_vdev *vdev; |
| 3674 | struct dp_peer *peer; |
| 3675 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3676 | struct dp_soc *soc = pdev->soc; |
| 3677 | u_int16_t old_threshold = soc->pdev_bs_inact_reload; |
| 3678 | |
| 3679 | if (old_threshold == new_threshold) |
| 3680 | return; |
| 3681 | |
| 3682 | soc->pdev_bs_inact_reload = new_threshold; |
| 3683 | |
| 3684 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 3685 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 3686 | if (vdev->opmode != wlan_op_mode_ap) |
| 3687 | continue; |
| 3688 | |
| 3689 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 3690 | if (!peer->authorize) |
| 3691 | continue; |
| 3692 | |
| 3693 | if (old_threshold - peer->peer_bs_inact >= |
| 3694 | new_threshold) { |
| 3695 | dp_mark_peer_inact((void *)peer, true); |
| 3696 | peer->peer_bs_inact = 0; |
| 3697 | } else { |
| 3698 | peer->peer_bs_inact = new_threshold - |
| 3699 | (old_threshold - peer->peer_bs_inact); |
| 3700 | } |
| 3701 | } |
| 3702 | } |
| 3703 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3704 | } |
| 3705 | |
| 3706 | /** |
| 3707 | * dp_txrx_reset_inact_count(): Reset inact count |
| 3708 | * @pdev_handle - device handle |
| 3709 | * |
| 3710 | * Return: void |
| 3711 | */ |
| 3712 | static void |
| 3713 | dp_txrx_reset_inact_count(struct cdp_pdev *pdev_handle) |
| 3714 | { |
| 3715 | struct dp_vdev *vdev = NULL; |
| 3716 | struct dp_peer *peer = NULL; |
| 3717 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3718 | struct dp_soc *soc = pdev->soc; |
| 3719 | |
| 3720 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 3721 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 3722 | if (vdev->opmode != wlan_op_mode_ap) |
| 3723 | continue; |
| 3724 | |
| 3725 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 3726 | if (!peer->authorize) |
| 3727 | continue; |
| 3728 | |
| 3729 | peer->peer_bs_inact = soc->pdev_bs_inact_reload; |
| 3730 | } |
| 3731 | } |
| 3732 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3733 | } |
| 3734 | |
| 3735 | /** |
| 3736 | * dp_set_inact_params(): set inactivity params |
| 3737 | * @pdev_handle - device handle |
| 3738 | * @inact_check_interval - inactivity interval |
| 3739 | * @inact_normal - Inactivity normal |
| 3740 | * @inact_overload - Inactivity overload |
| 3741 | * |
| 3742 | * Return: bool |
| 3743 | */ |
| 3744 | bool dp_set_inact_params(struct cdp_pdev *pdev_handle, |
| 3745 | u_int16_t inact_check_interval, |
| 3746 | u_int16_t inact_normal, u_int16_t inact_overload) |
| 3747 | { |
| 3748 | struct dp_soc *soc; |
| 3749 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3750 | |
| 3751 | if (!pdev) |
| 3752 | return false; |
| 3753 | |
| 3754 | soc = pdev->soc; |
| 3755 | if (!soc) |
| 3756 | return false; |
| 3757 | |
| 3758 | soc->pdev_bs_inact_interval = inact_check_interval; |
| 3759 | soc->pdev_bs_inact_normal = inact_normal; |
| 3760 | soc->pdev_bs_inact_overload = inact_overload; |
| 3761 | |
| 3762 | dp_txrx_update_inact_threshold((struct cdp_pdev *)pdev, |
| 3763 | soc->pdev_bs_inact_normal); |
| 3764 | |
| 3765 | return true; |
| 3766 | } |
| 3767 | |
| 3768 | /** |
| 3769 | * dp_start_inact_timer(): Inactivity timer start |
| 3770 | * @pdev_handle - device handle |
| 3771 | * @enable - Inactivity timer start/stop |
| 3772 | * |
| 3773 | * Return: bool |
| 3774 | */ |
| 3775 | bool dp_start_inact_timer(struct cdp_pdev *pdev_handle, bool enable) |
| 3776 | { |
| 3777 | struct dp_soc *soc; |
| 3778 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3779 | |
| 3780 | if (!pdev) |
| 3781 | return false; |
| 3782 | |
| 3783 | soc = pdev->soc; |
| 3784 | if (!soc) |
| 3785 | return false; |
| 3786 | |
| 3787 | if (enable) { |
| 3788 | dp_txrx_reset_inact_count((struct cdp_pdev *)pdev); |
| 3789 | qdf_timer_mod(&soc->pdev_bs_inact_timer, |
| 3790 | soc->pdev_bs_inact_interval * 1000); |
| 3791 | } else { |
| 3792 | qdf_timer_stop(&soc->pdev_bs_inact_timer); |
| 3793 | } |
| 3794 | |
| 3795 | return true; |
| 3796 | } |
| 3797 | |
| 3798 | /** |
| 3799 | * dp_set_overload(): Set inactivity overload |
| 3800 | * @pdev_handle - device handle |
| 3801 | * @overload - overload status |
| 3802 | * |
| 3803 | * Return: void |
| 3804 | */ |
| 3805 | void dp_set_overload(struct cdp_pdev *pdev_handle, bool overload) |
| 3806 | { |
| 3807 | struct dp_soc *soc; |
| 3808 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3809 | |
| 3810 | if (!pdev) |
| 3811 | return; |
| 3812 | |
| 3813 | soc = pdev->soc; |
| 3814 | if (!soc) |
| 3815 | return; |
| 3816 | |
| 3817 | dp_txrx_update_inact_threshold((struct cdp_pdev *)pdev, |
| 3818 | overload ? soc->pdev_bs_inact_overload : |
| 3819 | soc->pdev_bs_inact_normal); |
| 3820 | } |
| 3821 | |
| 3822 | /** |
| 3823 | * dp_peer_is_inact(): check whether peer is inactive |
| 3824 | * @peer_handle - datapath peer handle |
| 3825 | * |
| 3826 | * Return: bool |
| 3827 | */ |
| 3828 | bool dp_peer_is_inact(void *peer_handle) |
| 3829 | { |
| 3830 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 3831 | |
| 3832 | if (!peer) |
| 3833 | return false; |
| 3834 | |
| 3835 | return peer->peer_bs_inact_flag == 1; |
| 3836 | } |
| 3837 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 3838 | /** |
| 3839 | * dp_init_inact_timer: initialize the inact timer |
| 3840 | * @soc - SOC handle |
| 3841 | * |
| 3842 | * Return: void |
| 3843 | */ |
| 3844 | void dp_init_inact_timer(struct dp_soc *soc) |
| 3845 | { |
| 3846 | qdf_timer_init(soc->osdev, &soc->pdev_bs_inact_timer, |
| 3847 | dp_txrx_peer_find_inact_timeout_handler, |
| 3848 | (void *)soc, QDF_TIMER_TYPE_WAKE_APPS); |
| 3849 | } |
| 3850 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3851 | #else |
| 3852 | |
| 3853 | bool dp_set_inact_params(struct cdp_pdev *pdev, u_int16_t inact_check_interval, |
| 3854 | u_int16_t inact_normal, u_int16_t inact_overload) |
| 3855 | { |
| 3856 | return false; |
| 3857 | } |
| 3858 | |
| 3859 | bool dp_start_inact_timer(struct cdp_pdev *pdev, bool enable) |
| 3860 | { |
| 3861 | return false; |
| 3862 | } |
| 3863 | |
| 3864 | void dp_set_overload(struct cdp_pdev *pdev, bool overload) |
| 3865 | { |
| 3866 | return; |
| 3867 | } |
| 3868 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 3869 | void dp_init_inact_timer(struct dp_soc *soc) |
| 3870 | { |
| 3871 | return; |
| 3872 | } |
| 3873 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3874 | bool dp_peer_is_inact(void *peer) |
| 3875 | { |
| 3876 | return false; |
| 3877 | } |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3878 | #endif |
| 3879 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3880 | /* |
| 3881 | * dp_peer_unref_delete() - unref and delete peer |
| 3882 | * @peer_handle: Datapath peer handle |
| 3883 | * |
| 3884 | */ |
| 3885 | void dp_peer_unref_delete(void *peer_handle) |
| 3886 | { |
| 3887 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 3888 | struct dp_peer *bss_peer = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3889 | struct dp_vdev *vdev = peer->vdev; |
Kiran Venkatappa | 9edb961 | 2017-03-16 11:37:35 +0530 | [diff] [blame] | 3890 | struct dp_pdev *pdev = vdev->pdev; |
| 3891 | struct dp_soc *soc = pdev->soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3892 | struct dp_peer *tmppeer; |
| 3893 | int found = 0; |
| 3894 | uint16_t peer_id; |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 3895 | uint16_t vdev_id; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3896 | |
| 3897 | /* |
| 3898 | * Hold the lock all the way from checking if the peer ref count |
| 3899 | * is zero until the peer references are removed from the hash |
| 3900 | * table and vdev list (if the peer ref count is zero). |
| 3901 | * This protects against a new HL tx operation starting to use the |
| 3902 | * peer object just after this function concludes it's done being used. |
| 3903 | * Furthermore, the lock needs to be held while checking whether the |
| 3904 | * vdev's list of peers is empty, to make sure that list is not modified |
| 3905 | * concurrently with the empty check. |
| 3906 | */ |
| 3907 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 3908 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3909 | "%s: peer %pK ref_cnt(before decrement): %d\n", __func__, |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 3910 | peer, qdf_atomic_read(&peer->ref_cnt)); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3911 | if (qdf_atomic_dec_and_test(&peer->ref_cnt)) { |
| 3912 | peer_id = peer->peer_ids[0]; |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 3913 | vdev_id = vdev->vdev_id; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3914 | |
| 3915 | /* |
| 3916 | * Make sure that the reference to the peer in |
| 3917 | * peer object map is removed |
| 3918 | */ |
| 3919 | if (peer_id != HTT_INVALID_PEER) |
| 3920 | soc->peer_id_to_obj_map[peer_id] = NULL; |
| 3921 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3922 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3923 | "Deleting peer %pK (%pM)", peer, peer->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3924 | |
| 3925 | /* remove the reference to the peer from the hash table */ |
| 3926 | dp_peer_find_hash_remove(soc, peer); |
| 3927 | |
| 3928 | TAILQ_FOREACH(tmppeer, &peer->vdev->peer_list, peer_list_elem) { |
| 3929 | if (tmppeer == peer) { |
| 3930 | found = 1; |
| 3931 | break; |
| 3932 | } |
| 3933 | } |
| 3934 | if (found) { |
| 3935 | TAILQ_REMOVE(&peer->vdev->peer_list, peer, |
| 3936 | peer_list_elem); |
| 3937 | } else { |
| 3938 | /*Ignoring the remove operation as peer not found*/ |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3939 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3940 | "peer %pK not found in vdev (%pK)->peer_list:%pK", |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3941 | peer, vdev, &peer->vdev->peer_list); |
| 3942 | } |
| 3943 | |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 3944 | /* cleanup the peer data */ |
| 3945 | dp_peer_cleanup(vdev, peer); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3946 | |
| 3947 | /* check whether the parent vdev has no peers left */ |
| 3948 | if (TAILQ_EMPTY(&vdev->peer_list)) { |
| 3949 | /* |
| 3950 | * Now that there are no references to the peer, we can |
| 3951 | * release the peer reference lock. |
| 3952 | */ |
| 3953 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3954 | /* |
| 3955 | * Check if the parent vdev was waiting for its peers |
| 3956 | * to be deleted, in order for it to be deleted too. |
| 3957 | */ |
| 3958 | if (vdev->delete.pending) { |
| 3959 | ol_txrx_vdev_delete_cb vdev_delete_cb = |
| 3960 | vdev->delete.callback; |
| 3961 | void *vdev_delete_context = |
| 3962 | vdev->delete.context; |
| 3963 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3964 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3965 | QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3966 | FL("deleting vdev object %pK (%pM)" |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3967 | " - its last peer is done"), |
| 3968 | vdev, vdev->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3969 | /* all peers are gone, go ahead and delete it */ |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 3970 | dp_tx_flow_pool_unmap_handler(pdev, vdev_id, |
chenguo | 7853b79 | 2017-12-28 20:59:12 +0800 | [diff] [blame] | 3971 | FLOW_TYPE_VDEV, |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 3972 | vdev_id); |
chenguo | 7853b79 | 2017-12-28 20:59:12 +0800 | [diff] [blame] | 3973 | dp_tx_vdev_detach(vdev); |
| 3974 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 3975 | QDF_TRACE_LEVEL_INFO_HIGH, |
| 3976 | FL("deleting vdev object %pK (%pM)"), |
| 3977 | vdev, vdev->mac_addr.raw); |
| 3978 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3979 | qdf_mem_free(vdev); |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 3980 | vdev = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3981 | if (vdev_delete_cb) |
| 3982 | vdev_delete_cb(vdev_delete_context); |
| 3983 | } |
| 3984 | } else { |
| 3985 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3986 | } |
chenguo | 1dead6f | 2018-01-08 14:51:44 +0800 | [diff] [blame] | 3987 | |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 3988 | if (vdev) { |
| 3989 | if (vdev->vap_bss_peer == peer) { |
| 3990 | vdev->vap_bss_peer = NULL; |
| 3991 | } |
| 3992 | } |
| 3993 | |
chenguo | 1dead6f | 2018-01-08 14:51:44 +0800 | [diff] [blame] | 3994 | if (soc->cdp_soc.ol_ops->peer_unref_delete) { |
| 3995 | soc->cdp_soc.ol_ops->peer_unref_delete(pdev->osif_pdev, |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 3996 | vdev_id, peer->mac_addr.raw); |
chenguo | 1dead6f | 2018-01-08 14:51:44 +0800 | [diff] [blame] | 3997 | } |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 3998 | |
| 3999 | if (!vdev || !vdev->vap_bss_peer) { |
| 4000 | goto free_peer; |
| 4001 | } |
| 4002 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4003 | #ifdef notyet |
| 4004 | qdf_mempool_free(soc->osdev, soc->mempool_ol_ath_peer, peer); |
| 4005 | #else |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4006 | bss_peer = vdev->vap_bss_peer; |
| 4007 | DP_UPDATE_STATS(bss_peer, peer); |
| 4008 | |
| 4009 | free_peer: |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4010 | qdf_mem_free(peer); |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4011 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4012 | #endif |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4013 | } else { |
| 4014 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 4015 | } |
| 4016 | } |
| 4017 | |
| 4018 | /* |
| 4019 | * dp_peer_detach_wifi3() – Detach txrx peer |
Naveen Rawat | 761329b | 2017-09-19 10:30:11 -0700 | [diff] [blame] | 4020 | * @peer_handle: Datapath peer handle |
| 4021 | * @bitmap: bitmap indicating special handling of request. |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4022 | * |
| 4023 | */ |
Naveen Rawat | 761329b | 2017-09-19 10:30:11 -0700 | [diff] [blame] | 4024 | static void dp_peer_delete_wifi3(void *peer_handle, uint32_t bitmap) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4025 | { |
| 4026 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 4027 | |
| 4028 | /* redirect the peer's rx delivery function to point to a |
| 4029 | * discard func |
| 4030 | */ |
| 4031 | peer->rx_opt_proc = dp_rx_discard; |
| 4032 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 4033 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4034 | FL("peer %pK (%pM)"), peer, peer->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4035 | |
Krishna Kumaar Natarajan | 604fe16 | 2017-01-28 18:37:01 -0800 | [diff] [blame] | 4036 | #ifndef CONFIG_WIN |
| 4037 | dp_local_peer_id_free(peer->vdev->pdev, peer); |
| 4038 | #endif |
| 4039 | qdf_spinlock_destroy(&peer->peer_info_lock); |
| 4040 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4041 | /* |
| 4042 | * Remove the reference added during peer_attach. |
| 4043 | * The peer will still be left allocated until the |
| 4044 | * PEER_UNMAP message arrives to remove the other |
| 4045 | * reference, added by the PEER_MAP message. |
| 4046 | */ |
| 4047 | dp_peer_unref_delete(peer_handle); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4048 | } |
| 4049 | |
| 4050 | /* |
| 4051 | * dp_get_vdev_mac_addr_wifi3() – Detach txrx peer |
| 4052 | * @peer_handle: Datapath peer handle |
| 4053 | * |
| 4054 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4055 | static uint8 *dp_get_vdev_mac_addr_wifi3(struct cdp_vdev *pvdev) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4056 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4057 | struct dp_vdev *vdev = (struct dp_vdev *)pvdev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4058 | return vdev->mac_addr.raw; |
| 4059 | } |
| 4060 | |
| 4061 | /* |
Karunakar Dasineni | ca79254 | 2017-01-16 10:08:58 -0800 | [diff] [blame] | 4062 | * dp_vdev_set_wds() - Enable per packet stats |
| 4063 | * @vdev_handle: DP VDEV handle |
| 4064 | * @val: value |
| 4065 | * |
| 4066 | * Return: none |
| 4067 | */ |
| 4068 | static int dp_vdev_set_wds(void *vdev_handle, uint32_t val) |
| 4069 | { |
| 4070 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4071 | |
| 4072 | vdev->wds_enabled = val; |
| 4073 | return 0; |
| 4074 | } |
| 4075 | |
| 4076 | /* |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4077 | * dp_get_vdev_from_vdev_id_wifi3() – Detach txrx peer |
| 4078 | * @peer_handle: Datapath peer handle |
| 4079 | * |
| 4080 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4081 | static struct cdp_vdev *dp_get_vdev_from_vdev_id_wifi3(struct cdp_pdev *dev, |
| 4082 | uint8_t vdev_id) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4083 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4084 | struct dp_pdev *pdev = (struct dp_pdev *)dev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4085 | struct dp_vdev *vdev = NULL; |
| 4086 | |
| 4087 | if (qdf_unlikely(!pdev)) |
| 4088 | return NULL; |
| 4089 | |
| 4090 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 4091 | if (vdev->vdev_id == vdev_id) |
| 4092 | break; |
| 4093 | } |
| 4094 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4095 | return (struct cdp_vdev *)vdev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4096 | } |
| 4097 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4098 | static int dp_get_opmode(struct cdp_vdev *vdev_handle) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4099 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4100 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4101 | |
| 4102 | return vdev->opmode; |
| 4103 | } |
| 4104 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4105 | static struct cdp_cfg *dp_get_ctrl_pdev_from_vdev_wifi3(struct cdp_vdev *pvdev) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4106 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4107 | struct dp_vdev *vdev = (struct dp_vdev *)pvdev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4108 | struct dp_pdev *pdev = vdev->pdev; |
| 4109 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4110 | return (struct cdp_cfg *)pdev->wlan_cfg_ctx; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4111 | } |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 4112 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4113 | /** |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4114 | * dp_reset_monitor_mode() - Disable monitor mode |
| 4115 | * @pdev_handle: Datapath PDEV handle |
| 4116 | * |
| 4117 | * Return: 0 on success, not 0 on failure |
| 4118 | */ |
| 4119 | static int dp_reset_monitor_mode(struct cdp_pdev *pdev_handle) |
| 4120 | { |
| 4121 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4122 | struct htt_rx_ring_tlv_filter htt_tlv_filter; |
| 4123 | struct dp_soc *soc; |
| 4124 | uint8_t pdev_id; |
| 4125 | |
| 4126 | pdev_id = pdev->pdev_id; |
| 4127 | soc = pdev->soc; |
| 4128 | |
| 4129 | pdev->monitor_vdev = NULL; |
| 4130 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 4131 | |
| 4132 | htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, |
| 4133 | pdev->rxdma_mon_buf_ring.hal_srng, |
| 4134 | RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4135 | |
| 4136 | htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, |
| 4137 | pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, |
| 4138 | RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4139 | |
| 4140 | return 0; |
| 4141 | } |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 4142 | |
| 4143 | /** |
| 4144 | * dp_set_nac() - set peer_nac |
| 4145 | * @peer_handle: Datapath PEER handle |
| 4146 | * |
| 4147 | * Return: void |
| 4148 | */ |
| 4149 | static void dp_set_nac(struct cdp_peer *peer_handle) |
| 4150 | { |
| 4151 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 4152 | |
| 4153 | peer->nac = 1; |
| 4154 | } |
| 4155 | |
| 4156 | /** |
| 4157 | * dp_get_tx_pending() - read pending tx |
| 4158 | * @pdev_handle: Datapath PDEV handle |
| 4159 | * |
| 4160 | * Return: outstanding tx |
| 4161 | */ |
| 4162 | static int dp_get_tx_pending(struct cdp_pdev *pdev_handle) |
| 4163 | { |
| 4164 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4165 | |
| 4166 | return qdf_atomic_read(&pdev->num_tx_outstanding); |
| 4167 | } |
| 4168 | |
| 4169 | /** |
| 4170 | * dp_get_peer_mac_from_peer_id() - get peer mac |
| 4171 | * @pdev_handle: Datapath PDEV handle |
| 4172 | * @peer_id: Peer ID |
| 4173 | * @peer_mac: MAC addr of PEER |
| 4174 | * |
| 4175 | * Return: void |
| 4176 | */ |
| 4177 | static void dp_get_peer_mac_from_peer_id(struct cdp_pdev *pdev_handle, |
| 4178 | uint32_t peer_id, uint8_t *peer_mac) |
| 4179 | { |
| 4180 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4181 | struct dp_peer *peer; |
| 4182 | |
| 4183 | if (pdev && peer_mac) { |
| 4184 | peer = dp_peer_find_by_id(pdev->soc, (uint16_t)peer_id); |
| 4185 | if (peer && peer->mac_addr.raw) { |
| 4186 | qdf_mem_copy(peer_mac, peer->mac_addr.raw, |
| 4187 | DP_MAC_ADDR_LEN); |
| 4188 | } |
| 4189 | } |
| 4190 | } |
| 4191 | |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4192 | /** |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4193 | * dp_vdev_set_monitor_mode() - Set DP VDEV to monitor mode |
| 4194 | * @vdev_handle: Datapath VDEV handle |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 4195 | * @smart_monitor: Flag to denote if its smart monitor mode |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4196 | * |
| 4197 | * Return: 0 on success, not 0 on failure |
| 4198 | */ |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 4199 | static int dp_vdev_set_monitor_mode(struct cdp_vdev *vdev_handle, |
| 4200 | uint8_t smart_monitor) |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4201 | { |
| 4202 | /* Many monitor VAPs can exists in a system but only one can be up at |
| 4203 | * anytime |
| 4204 | */ |
| 4205 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4206 | struct dp_pdev *pdev; |
| 4207 | struct htt_rx_ring_tlv_filter htt_tlv_filter; |
| 4208 | struct dp_soc *soc; |
| 4209 | uint8_t pdev_id; |
| 4210 | |
| 4211 | qdf_assert(vdev); |
| 4212 | |
| 4213 | pdev = vdev->pdev; |
| 4214 | pdev_id = pdev->pdev_id; |
| 4215 | soc = pdev->soc; |
| 4216 | |
| 4217 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4218 | "pdev=%pK, pdev_id=%d, soc=%pK vdev=%pK\n", |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4219 | pdev, pdev_id, soc, vdev); |
| 4220 | |
| 4221 | /*Check if current pdev's monitor_vdev exists */ |
| 4222 | if (pdev->monitor_vdev) { |
| 4223 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4224 | "vdev=%pK\n", vdev); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4225 | qdf_assert(vdev); |
| 4226 | } |
| 4227 | |
| 4228 | pdev->monitor_vdev = vdev; |
| 4229 | |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 4230 | /* If smart monitor mode, do not configure monitor ring */ |
| 4231 | if (smart_monitor) |
| 4232 | return QDF_STATUS_SUCCESS; |
| 4233 | |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4234 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 4235 | "MODE[%x] FP[%02x|%02x|%02x] MO[%02x|%02x|%02x]\n", |
| 4236 | pdev->mon_filter_mode, pdev->fp_mgmt_filter, |
| 4237 | pdev->fp_ctrl_filter, pdev->fp_data_filter, |
| 4238 | pdev->mo_mgmt_filter, pdev->mo_ctrl_filter, |
| 4239 | pdev->mo_data_filter); |
| 4240 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4241 | htt_tlv_filter.mpdu_start = 1; |
| 4242 | htt_tlv_filter.msdu_start = 1; |
| 4243 | htt_tlv_filter.packet = 1; |
| 4244 | htt_tlv_filter.msdu_end = 1; |
| 4245 | htt_tlv_filter.mpdu_end = 1; |
| 4246 | htt_tlv_filter.packet_header = 1; |
| 4247 | htt_tlv_filter.attention = 1; |
| 4248 | htt_tlv_filter.ppdu_start = 0; |
| 4249 | htt_tlv_filter.ppdu_end = 0; |
| 4250 | htt_tlv_filter.ppdu_end_user_stats = 0; |
| 4251 | htt_tlv_filter.ppdu_end_user_stats_ext = 0; |
| 4252 | htt_tlv_filter.ppdu_end_status_done = 0; |
sumedh baikady | 308ff00 | 2017-09-18 16:24:36 -0700 | [diff] [blame] | 4253 | htt_tlv_filter.header_per_msdu = 1; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4254 | htt_tlv_filter.enable_fp = |
| 4255 | (pdev->mon_filter_mode & MON_FILTER_PASS) ? 1 : 0; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4256 | htt_tlv_filter.enable_md = 0; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4257 | htt_tlv_filter.enable_mo = |
| 4258 | (pdev->mon_filter_mode & MON_FILTER_OTHER) ? 1 : 0; |
| 4259 | htt_tlv_filter.fp_mgmt_filter = pdev->fp_mgmt_filter; |
| 4260 | htt_tlv_filter.fp_ctrl_filter = pdev->fp_ctrl_filter; |
| 4261 | htt_tlv_filter.fp_data_filter = pdev->fp_data_filter; |
| 4262 | htt_tlv_filter.mo_mgmt_filter = pdev->mo_mgmt_filter; |
| 4263 | htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; |
| 4264 | htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4265 | |
| 4266 | htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, |
Karunakar Dasineni | 4055568 | 2017-03-26 22:44:39 -0700 | [diff] [blame] | 4267 | pdev->rxdma_mon_buf_ring.hal_srng, |
| 4268 | RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4269 | |
| 4270 | htt_tlv_filter.mpdu_start = 1; |
| 4271 | htt_tlv_filter.msdu_start = 1; |
| 4272 | htt_tlv_filter.packet = 0; |
| 4273 | htt_tlv_filter.msdu_end = 1; |
| 4274 | htt_tlv_filter.mpdu_end = 1; |
| 4275 | htt_tlv_filter.packet_header = 1; |
| 4276 | htt_tlv_filter.attention = 1; |
| 4277 | htt_tlv_filter.ppdu_start = 1; |
| 4278 | htt_tlv_filter.ppdu_end = 1; |
| 4279 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 4280 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 4281 | htt_tlv_filter.ppdu_end_status_done = 1; |
sumedh baikady | 308ff00 | 2017-09-18 16:24:36 -0700 | [diff] [blame] | 4282 | htt_tlv_filter.header_per_msdu = 0; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4283 | htt_tlv_filter.enable_fp = |
| 4284 | (pdev->mon_filter_mode & MON_FILTER_PASS) ? 1 : 0; |
Karunakar Dasineni | 4055568 | 2017-03-26 22:44:39 -0700 | [diff] [blame] | 4285 | htt_tlv_filter.enable_md = 0; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4286 | htt_tlv_filter.enable_mo = |
| 4287 | (pdev->mon_filter_mode & MON_FILTER_OTHER) ? 1 : 0; |
| 4288 | htt_tlv_filter.fp_mgmt_filter = pdev->fp_mgmt_filter; |
| 4289 | htt_tlv_filter.fp_ctrl_filter = pdev->fp_ctrl_filter; |
| 4290 | htt_tlv_filter.fp_data_filter = pdev->fp_data_filter; |
| 4291 | htt_tlv_filter.mo_mgmt_filter = pdev->mo_mgmt_filter; |
| 4292 | htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; |
| 4293 | htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; |
| 4294 | |
| 4295 | htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, |
| 4296 | pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, |
| 4297 | RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4298 | |
| 4299 | return QDF_STATUS_SUCCESS; |
| 4300 | } |
| 4301 | |
| 4302 | /** |
| 4303 | * dp_pdev_set_advance_monitor_filter() - Set DP PDEV monitor filter |
| 4304 | * @pdev_handle: Datapath PDEV handle |
| 4305 | * @filter_val: Flag to select Filter for monitor mode |
| 4306 | * Return: 0 on success, not 0 on failure |
| 4307 | */ |
| 4308 | static int dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle, |
| 4309 | struct cdp_monitor_filter *filter_val) |
| 4310 | { |
| 4311 | /* Many monitor VAPs can exists in a system but only one can be up at |
| 4312 | * anytime |
| 4313 | */ |
| 4314 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4315 | struct dp_vdev *vdev = pdev->monitor_vdev; |
| 4316 | struct htt_rx_ring_tlv_filter htt_tlv_filter; |
| 4317 | struct dp_soc *soc; |
| 4318 | uint8_t pdev_id; |
| 4319 | |
| 4320 | pdev_id = pdev->pdev_id; |
| 4321 | soc = pdev->soc; |
| 4322 | |
| 4323 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_WARN, |
| 4324 | "pdev=%pK, pdev_id=%d, soc=%pK vdev=%pK\n", |
| 4325 | pdev, pdev_id, soc, vdev); |
| 4326 | |
| 4327 | /*Check if current pdev's monitor_vdev exists */ |
| 4328 | if (!pdev->monitor_vdev) { |
| 4329 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 4330 | "vdev=%pK\n", vdev); |
| 4331 | qdf_assert(vdev); |
| 4332 | } |
| 4333 | |
| 4334 | /* update filter mode, type in pdev structure */ |
| 4335 | pdev->mon_filter_mode = filter_val->mode; |
| 4336 | pdev->fp_mgmt_filter = filter_val->fp_mgmt; |
| 4337 | pdev->fp_ctrl_filter = filter_val->fp_ctrl; |
| 4338 | pdev->fp_data_filter = filter_val->fp_data; |
| 4339 | pdev->mo_mgmt_filter = filter_val->mo_mgmt; |
| 4340 | pdev->mo_ctrl_filter = filter_val->mo_ctrl; |
| 4341 | pdev->mo_data_filter = filter_val->mo_data; |
| 4342 | |
| 4343 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 4344 | "MODE[%x] FP[%02x|%02x|%02x] MO[%02x|%02x|%02x]\n", |
| 4345 | pdev->mon_filter_mode, pdev->fp_mgmt_filter, |
| 4346 | pdev->fp_ctrl_filter, pdev->fp_data_filter, |
| 4347 | pdev->mo_mgmt_filter, pdev->mo_ctrl_filter, |
| 4348 | pdev->mo_data_filter); |
| 4349 | |
| 4350 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 4351 | |
| 4352 | htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, |
| 4353 | pdev->rxdma_mon_buf_ring.hal_srng, |
| 4354 | RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4355 | |
| 4356 | htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, |
| 4357 | pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, |
| 4358 | RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4359 | |
| 4360 | htt_tlv_filter.mpdu_start = 1; |
| 4361 | htt_tlv_filter.msdu_start = 1; |
| 4362 | htt_tlv_filter.packet = 1; |
| 4363 | htt_tlv_filter.msdu_end = 1; |
| 4364 | htt_tlv_filter.mpdu_end = 1; |
| 4365 | htt_tlv_filter.packet_header = 1; |
| 4366 | htt_tlv_filter.attention = 1; |
| 4367 | htt_tlv_filter.ppdu_start = 0; |
| 4368 | htt_tlv_filter.ppdu_end = 0; |
| 4369 | htt_tlv_filter.ppdu_end_user_stats = 0; |
| 4370 | htt_tlv_filter.ppdu_end_user_stats_ext = 0; |
| 4371 | htt_tlv_filter.ppdu_end_status_done = 0; |
| 4372 | htt_tlv_filter.header_per_msdu = 1; |
| 4373 | htt_tlv_filter.enable_fp = |
| 4374 | (pdev->mon_filter_mode & MON_FILTER_PASS) ? 1 : 0; |
| 4375 | htt_tlv_filter.enable_md = 0; |
| 4376 | htt_tlv_filter.enable_mo = |
| 4377 | (pdev->mon_filter_mode & MON_FILTER_OTHER) ? 1 : 0; |
| 4378 | htt_tlv_filter.fp_mgmt_filter = pdev->fp_mgmt_filter; |
| 4379 | htt_tlv_filter.fp_ctrl_filter = pdev->fp_ctrl_filter; |
| 4380 | htt_tlv_filter.fp_data_filter = pdev->fp_data_filter; |
| 4381 | htt_tlv_filter.mo_mgmt_filter = pdev->mo_mgmt_filter; |
| 4382 | htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; |
| 4383 | htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; |
| 4384 | |
| 4385 | htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, |
| 4386 | pdev->rxdma_mon_buf_ring.hal_srng, RXDMA_MONITOR_BUF, |
| 4387 | RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4388 | |
| 4389 | htt_tlv_filter.mpdu_start = 1; |
| 4390 | htt_tlv_filter.msdu_start = 1; |
| 4391 | htt_tlv_filter.packet = 0; |
| 4392 | htt_tlv_filter.msdu_end = 1; |
| 4393 | htt_tlv_filter.mpdu_end = 1; |
| 4394 | htt_tlv_filter.packet_header = 1; |
| 4395 | htt_tlv_filter.attention = 1; |
| 4396 | htt_tlv_filter.ppdu_start = 1; |
| 4397 | htt_tlv_filter.ppdu_end = 1; |
| 4398 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 4399 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 4400 | htt_tlv_filter.ppdu_end_status_done = 1; |
| 4401 | htt_tlv_filter.header_per_msdu = 0; |
| 4402 | htt_tlv_filter.enable_fp = |
| 4403 | (pdev->mon_filter_mode & MON_FILTER_PASS) ? 1 : 0; |
| 4404 | htt_tlv_filter.enable_md = 0; |
| 4405 | htt_tlv_filter.enable_mo = |
| 4406 | (pdev->mon_filter_mode & MON_FILTER_OTHER) ? 1 : 0; |
| 4407 | htt_tlv_filter.fp_mgmt_filter = pdev->fp_mgmt_filter; |
| 4408 | htt_tlv_filter.fp_ctrl_filter = pdev->fp_ctrl_filter; |
| 4409 | htt_tlv_filter.fp_data_filter = pdev->fp_data_filter; |
| 4410 | htt_tlv_filter.mo_mgmt_filter = pdev->mo_mgmt_filter; |
| 4411 | htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; |
| 4412 | htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; |
Karunakar Dasineni | 4055568 | 2017-03-26 22:44:39 -0700 | [diff] [blame] | 4413 | |
| 4414 | htt_h2t_rx_ring_cfg(soc->htt_handle, pdev_id, |
| 4415 | pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, |
| 4416 | RX_BUFFER_SIZE, &htt_tlv_filter); |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 4417 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4418 | return QDF_STATUS_SUCCESS; |
| 4419 | } |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4420 | |
nobelj | c8eb4d6 | 2018-01-04 14:29:32 -0800 | [diff] [blame] | 4421 | /** |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 4422 | * dp_get_pdev_id_frm_pdev() - get pdev_id |
| 4423 | * @pdev_handle: Datapath PDEV handle |
| 4424 | * |
| 4425 | * Return: pdev_id |
| 4426 | */ |
| 4427 | static |
| 4428 | uint8_t dp_get_pdev_id_frm_pdev(struct cdp_pdev *pdev_handle) |
| 4429 | { |
| 4430 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4431 | |
| 4432 | return pdev->pdev_id; |
| 4433 | } |
| 4434 | |
| 4435 | /** |
nobelj | c8eb4d6 | 2018-01-04 14:29:32 -0800 | [diff] [blame] | 4436 | * dp_vdev_get_filter_ucast_data() - get DP VDEV monitor ucast filter |
| 4437 | * @vdev_handle: Datapath VDEV handle |
| 4438 | * Return: true on ucast filter flag set |
| 4439 | */ |
| 4440 | static bool dp_vdev_get_filter_ucast_data(struct cdp_vdev *vdev_handle) |
| 4441 | { |
| 4442 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4443 | struct dp_pdev *pdev; |
| 4444 | |
| 4445 | pdev = vdev->pdev; |
| 4446 | |
| 4447 | if ((pdev->fp_data_filter & FILTER_DATA_UCAST) || |
| 4448 | (pdev->mo_data_filter & FILTER_DATA_UCAST)) |
| 4449 | return true; |
| 4450 | |
| 4451 | return false; |
| 4452 | } |
| 4453 | |
| 4454 | /** |
| 4455 | * dp_vdev_get_filter_mcast_data() - get DP VDEV monitor mcast filter |
| 4456 | * @vdev_handle: Datapath VDEV handle |
| 4457 | * Return: true on mcast filter flag set |
| 4458 | */ |
| 4459 | static bool dp_vdev_get_filter_mcast_data(struct cdp_vdev *vdev_handle) |
| 4460 | { |
| 4461 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4462 | struct dp_pdev *pdev; |
| 4463 | |
| 4464 | pdev = vdev->pdev; |
| 4465 | |
| 4466 | if ((pdev->fp_data_filter & FILTER_DATA_MCAST) || |
| 4467 | (pdev->mo_data_filter & FILTER_DATA_MCAST)) |
| 4468 | return true; |
| 4469 | |
| 4470 | return false; |
| 4471 | } |
| 4472 | |
| 4473 | /** |
| 4474 | * dp_vdev_get_filter_non_data() - get DP VDEV monitor non_data filter |
| 4475 | * @vdev_handle: Datapath VDEV handle |
| 4476 | * Return: true on non data filter flag set |
| 4477 | */ |
| 4478 | static bool dp_vdev_get_filter_non_data(struct cdp_vdev *vdev_handle) |
| 4479 | { |
| 4480 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4481 | struct dp_pdev *pdev; |
| 4482 | |
| 4483 | pdev = vdev->pdev; |
| 4484 | |
| 4485 | if ((pdev->fp_mgmt_filter & FILTER_MGMT_ALL) || |
| 4486 | (pdev->mo_mgmt_filter & FILTER_MGMT_ALL)) { |
| 4487 | if ((pdev->fp_ctrl_filter & FILTER_CTRL_ALL) || |
| 4488 | (pdev->mo_ctrl_filter & FILTER_CTRL_ALL)) { |
| 4489 | return true; |
| 4490 | } |
| 4491 | } |
| 4492 | |
| 4493 | return false; |
| 4494 | } |
| 4495 | |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 4496 | #ifdef MESH_MODE_SUPPORT |
Venkateswara Swamy Bandaru | ec4f8e6 | 2017-03-07 11:04:28 +0530 | [diff] [blame] | 4497 | void dp_peer_set_mesh_mode(struct cdp_vdev *vdev_hdl, uint32_t val) |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 4498 | { |
| 4499 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_hdl; |
| 4500 | |
| 4501 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
Venkateswara Swamy Bandaru | 5caa83a | 2017-03-06 11:33:15 +0530 | [diff] [blame] | 4502 | FL("val %d"), val); |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 4503 | vdev->mesh_vdev = val; |
| 4504 | } |
Venkateswara Swamy Bandaru | ec4f8e6 | 2017-03-07 11:04:28 +0530 | [diff] [blame] | 4505 | |
| 4506 | /* |
| 4507 | * dp_peer_set_mesh_rx_filter() - to set the mesh rx filter |
| 4508 | * @vdev_hdl: virtual device object |
| 4509 | * @val: value to be set |
| 4510 | * |
| 4511 | * Return: void |
| 4512 | */ |
| 4513 | void dp_peer_set_mesh_rx_filter(struct cdp_vdev *vdev_hdl, uint32_t val) |
| 4514 | { |
| 4515 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_hdl; |
| 4516 | |
| 4517 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 4518 | FL("val %d"), val); |
| 4519 | vdev->mesh_rx_filter = val; |
| 4520 | } |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 4521 | #endif |
| 4522 | |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4523 | /* |
| 4524 | * dp_aggregate_pdev_ctrl_frames_stats()- function to agreegate peer stats |
| 4525 | * Current scope is bar recieved count |
| 4526 | * |
| 4527 | * @pdev_handle: DP_PDEV handle |
| 4528 | * |
| 4529 | * Return: void |
| 4530 | */ |
Pratik Gandhi | 81fe062 | 2018-02-23 12:36:10 +0530 | [diff] [blame] | 4531 | #define STATS_PROC_TIMEOUT (HZ/1000) |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4532 | |
| 4533 | static void |
| 4534 | dp_aggregate_pdev_ctrl_frames_stats(struct dp_pdev *pdev) |
| 4535 | { |
| 4536 | struct dp_vdev *vdev; |
| 4537 | struct dp_peer *peer; |
| 4538 | uint32_t waitcnt; |
| 4539 | |
| 4540 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 4541 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 4542 | if (!peer) { |
| 4543 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 4544 | FL("DP Invalid Peer refernce")); |
| 4545 | return; |
| 4546 | } |
Pratik Gandhi | 81fe062 | 2018-02-23 12:36:10 +0530 | [diff] [blame] | 4547 | |
| 4548 | if (peer->delete_in_progress) { |
| 4549 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 4550 | FL("DP Peer deletion in progress")); |
| 4551 | continue; |
| 4552 | } |
| 4553 | |
| 4554 | qdf_atomic_inc(&peer->ref_cnt); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4555 | waitcnt = 0; |
| 4556 | dp_peer_rxtid_stats(peer, dp_rx_bar_stats_cb, pdev); |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 4557 | while (!(qdf_atomic_read(&(pdev->stats_cmd_complete))) |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4558 | && waitcnt < 10) { |
| 4559 | schedule_timeout_interruptible( |
| 4560 | STATS_PROC_TIMEOUT); |
| 4561 | waitcnt++; |
| 4562 | } |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 4563 | qdf_atomic_set(&(pdev->stats_cmd_complete), 0); |
Pratik Gandhi | 81fe062 | 2018-02-23 12:36:10 +0530 | [diff] [blame] | 4564 | dp_peer_unref_delete(peer); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4565 | } |
| 4566 | } |
| 4567 | } |
| 4568 | |
| 4569 | /** |
| 4570 | * dp_rx_bar_stats_cb(): BAR received stats callback |
| 4571 | * @soc: SOC handle |
| 4572 | * @cb_ctxt: Call back context |
| 4573 | * @reo_status: Reo status |
| 4574 | * |
| 4575 | * return: void |
| 4576 | */ |
| 4577 | void dp_rx_bar_stats_cb(struct dp_soc *soc, void *cb_ctxt, |
| 4578 | union hal_reo_status *reo_status) |
| 4579 | { |
| 4580 | struct dp_pdev *pdev = (struct dp_pdev *)cb_ctxt; |
| 4581 | struct hal_reo_queue_status *queue_status = &(reo_status->queue_status); |
| 4582 | |
| 4583 | if (queue_status->header.status != HAL_REO_CMD_SUCCESS) { |
| 4584 | DP_TRACE_STATS(FATAL, "REO stats failure %d \n", |
| 4585 | queue_status->header.status); |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 4586 | qdf_atomic_set(&(pdev->stats_cmd_complete), 1); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4587 | return; |
| 4588 | } |
| 4589 | |
| 4590 | pdev->stats.rx.bar_recv_cnt += queue_status->bar_rcvd_cnt; |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 4591 | qdf_atomic_set(&(pdev->stats_cmd_complete), 1); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4592 | |
| 4593 | } |
| 4594 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4595 | /** |
| 4596 | * dp_aggregate_vdev_stats(): Consolidate stats at VDEV level |
| 4597 | * @vdev: DP VDEV handle |
| 4598 | * |
| 4599 | * return: void |
| 4600 | */ |
| 4601 | void dp_aggregate_vdev_stats(struct dp_vdev *vdev) |
| 4602 | { |
| 4603 | struct dp_peer *peer = NULL; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4604 | struct dp_soc *soc = vdev->pdev->soc; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4605 | |
| 4606 | qdf_mem_set(&(vdev->stats.tx), sizeof(vdev->stats.tx), 0x0); |
| 4607 | qdf_mem_set(&(vdev->stats.rx), sizeof(vdev->stats.rx), 0x0); |
| 4608 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4609 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) |
| 4610 | DP_UPDATE_STATS(vdev, peer); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4611 | |
psimha | fb49db3 | 2017-08-31 15:33:33 -0700 | [diff] [blame] | 4612 | if (soc->cdp_soc.ol_ops->update_dp_stats) |
| 4613 | soc->cdp_soc.ol_ops->update_dp_stats(vdev->pdev->osif_pdev, |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4614 | &vdev->stats, (uint16_t) vdev->vdev_id, |
| 4615 | UPDATE_VDEV_STATS); |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 4616 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4617 | } |
| 4618 | |
| 4619 | /** |
| 4620 | * dp_aggregate_pdev_stats(): Consolidate stats at PDEV level |
| 4621 | * @pdev: DP PDEV handle |
| 4622 | * |
| 4623 | * return: void |
| 4624 | */ |
| 4625 | static inline void dp_aggregate_pdev_stats(struct dp_pdev *pdev) |
| 4626 | { |
| 4627 | struct dp_vdev *vdev = NULL; |
Pranita Solanke | a38c7a3 | 2018-01-04 10:50:59 +0530 | [diff] [blame] | 4628 | struct dp_soc *soc = pdev->soc; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4629 | |
| 4630 | qdf_mem_set(&(pdev->stats.tx), sizeof(pdev->stats.tx), 0x0); |
| 4631 | qdf_mem_set(&(pdev->stats.rx), sizeof(pdev->stats.rx), 0x0); |
| 4632 | qdf_mem_set(&(pdev->stats.tx_i), sizeof(pdev->stats.tx_i), 0x0); |
| 4633 | |
| 4634 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 4635 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4636 | dp_aggregate_vdev_stats(vdev); |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4637 | DP_UPDATE_STATS(pdev, vdev); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4638 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4639 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.nawds_mcast); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4640 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4641 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.rcvd); |
| 4642 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.processed); |
| 4643 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.reinject_pkts); |
| 4644 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.inspect_pkts); |
| 4645 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.raw.raw_pkt); |
| 4646 | DP_STATS_AGGR(pdev, vdev, tx_i.raw.dma_map_error); |
| 4647 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.tso.tso_pkt); |
| 4648 | DP_STATS_AGGR(pdev, vdev, tx_i.tso.dropped_host); |
| 4649 | DP_STATS_AGGR(pdev, vdev, tx_i.tso.dropped_target); |
| 4650 | DP_STATS_AGGR(pdev, vdev, tx_i.sg.dropped_host); |
| 4651 | DP_STATS_AGGR(pdev, vdev, tx_i.sg.dropped_target); |
| 4652 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.sg.sg_pkt); |
| 4653 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.mcast_en.mcast_pkt); |
| 4654 | DP_STATS_AGGR(pdev, vdev, |
| 4655 | tx_i.mcast_en.dropped_map_error); |
| 4656 | DP_STATS_AGGR(pdev, vdev, |
| 4657 | tx_i.mcast_en.dropped_self_mac); |
| 4658 | DP_STATS_AGGR(pdev, vdev, |
| 4659 | tx_i.mcast_en.dropped_send_fail); |
| 4660 | DP_STATS_AGGR(pdev, vdev, tx_i.mcast_en.ucast); |
| 4661 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.dma_error); |
| 4662 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.ring_full); |
| 4663 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.enqueue_fail); |
| 4664 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.desc_na); |
| 4665 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.res_full); |
| 4666 | DP_STATS_AGGR(pdev, vdev, tx_i.cce_classified); |
| 4667 | DP_STATS_AGGR(pdev, vdev, tx_i.cce_classified_raw); |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 4668 | DP_STATS_AGGR(pdev, vdev, tx_i.mesh.exception_fw); |
| 4669 | DP_STATS_AGGR(pdev, vdev, tx_i.mesh.completion_fw); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4670 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4671 | pdev->stats.tx_i.dropped.dropped_pkt.num = |
| 4672 | pdev->stats.tx_i.dropped.dma_error + |
| 4673 | pdev->stats.tx_i.dropped.ring_full + |
| 4674 | pdev->stats.tx_i.dropped.enqueue_fail + |
| 4675 | pdev->stats.tx_i.dropped.desc_na + |
| 4676 | pdev->stats.tx_i.dropped.res_full; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4677 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4678 | pdev->stats.tx.last_ack_rssi = |
| 4679 | vdev->stats.tx.last_ack_rssi; |
| 4680 | pdev->stats.tx_i.tso.num_seg = |
| 4681 | vdev->stats.tx_i.tso.num_seg; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4682 | } |
Pranita Solanke | a38c7a3 | 2018-01-04 10:50:59 +0530 | [diff] [blame] | 4683 | if (soc->cdp_soc.ol_ops->update_dp_stats) |
| 4684 | soc->cdp_soc.ol_ops->update_dp_stats(pdev->osif_pdev, |
| 4685 | &pdev->stats, pdev->pdev_id, UPDATE_PDEV_STATS); |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4686 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4687 | } |
| 4688 | |
| 4689 | /** |
| 4690 | * dp_print_pdev_tx_stats(): Print Pdev level TX stats |
| 4691 | * @pdev: DP_PDEV Handle |
| 4692 | * |
| 4693 | * Return:void |
| 4694 | */ |
| 4695 | static inline void |
| 4696 | dp_print_pdev_tx_stats(struct dp_pdev *pdev) |
| 4697 | { |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 4698 | uint8_t index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4699 | DP_PRINT_STATS("PDEV Tx Stats:\n"); |
| 4700 | DP_PRINT_STATS("Received From Stack:"); |
| 4701 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4702 | pdev->stats.tx_i.rcvd.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4703 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4704 | pdev->stats.tx_i.rcvd.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4705 | DP_PRINT_STATS("Processed:"); |
| 4706 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4707 | pdev->stats.tx_i.processed.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4708 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4709 | pdev->stats.tx_i.processed.bytes); |
Venkata Sharath Chandra Manchala | 65812e6 | 2018-02-15 16:04:52 -0800 | [diff] [blame] | 4710 | DP_PRINT_STATS("Total Completions:"); |
| 4711 | DP_PRINT_STATS(" Packets = %u", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4712 | pdev->stats.tx.comp_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4713 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4714 | pdev->stats.tx.comp_pkt.bytes); |
Venkata Sharath Chandra Manchala | 65812e6 | 2018-02-15 16:04:52 -0800 | [diff] [blame] | 4715 | DP_PRINT_STATS("Successful Completions:"); |
| 4716 | DP_PRINT_STATS(" Packets = %u", |
| 4717 | pdev->stats.tx.tx_success.num); |
| 4718 | DP_PRINT_STATS(" Bytes = %llu", |
| 4719 | pdev->stats.tx.tx_success.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4720 | DP_PRINT_STATS("Dropped:"); |
| 4721 | DP_PRINT_STATS(" Total = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4722 | pdev->stats.tx_i.dropped.dropped_pkt.num); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4723 | DP_PRINT_STATS(" Dma_map_error = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4724 | pdev->stats.tx_i.dropped.dma_error); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4725 | DP_PRINT_STATS(" Ring Full = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4726 | pdev->stats.tx_i.dropped.ring_full); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4727 | DP_PRINT_STATS(" Descriptor Not available = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4728 | pdev->stats.tx_i.dropped.desc_na); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4729 | DP_PRINT_STATS(" HW enqueue failed= %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4730 | pdev->stats.tx_i.dropped.enqueue_fail); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4731 | DP_PRINT_STATS(" Resources Full = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4732 | pdev->stats.tx_i.dropped.res_full); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4733 | DP_PRINT_STATS(" FW removed = %d", |
| 4734 | pdev->stats.tx.dropped.fw_rem); |
| 4735 | DP_PRINT_STATS(" FW removed transmitted = %d", |
| 4736 | pdev->stats.tx.dropped.fw_rem_tx); |
| 4737 | DP_PRINT_STATS(" FW removed untransmitted = %d", |
| 4738 | pdev->stats.tx.dropped.fw_rem_notx); |
Venkata Sharath Chandra Manchala | 65812e6 | 2018-02-15 16:04:52 -0800 | [diff] [blame] | 4739 | DP_PRINT_STATS(" FW removed untransmitted fw_reason1 = %d", |
| 4740 | pdev->stats.tx.dropped.fw_reason1); |
| 4741 | DP_PRINT_STATS(" FW removed untransmitted fw_reason2 = %d", |
| 4742 | pdev->stats.tx.dropped.fw_reason2); |
| 4743 | DP_PRINT_STATS(" FW removed untransmitted fw_reason3 = %d", |
| 4744 | pdev->stats.tx.dropped.fw_reason3); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4745 | DP_PRINT_STATS(" Aged Out from msdu/mpdu queues = %d", |
| 4746 | pdev->stats.tx.dropped.age_out); |
| 4747 | DP_PRINT_STATS("Scatter Gather:"); |
| 4748 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4749 | pdev->stats.tx_i.sg.sg_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4750 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4751 | pdev->stats.tx_i.sg.sg_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4752 | DP_PRINT_STATS(" Dropped By Host = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4753 | pdev->stats.tx_i.sg.dropped_host); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4754 | DP_PRINT_STATS(" Dropped By Target = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4755 | pdev->stats.tx_i.sg.dropped_target); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4756 | DP_PRINT_STATS("TSO:"); |
| 4757 | DP_PRINT_STATS(" Number of Segments = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4758 | pdev->stats.tx_i.tso.num_seg); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4759 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4760 | pdev->stats.tx_i.tso.tso_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4761 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4762 | pdev->stats.tx_i.tso.tso_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4763 | DP_PRINT_STATS(" Dropped By Host = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4764 | pdev->stats.tx_i.tso.dropped_host); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4765 | DP_PRINT_STATS("Mcast Enhancement:"); |
| 4766 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4767 | pdev->stats.tx_i.mcast_en.mcast_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4768 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4769 | pdev->stats.tx_i.mcast_en.mcast_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4770 | DP_PRINT_STATS(" Dropped: Map Errors = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4771 | pdev->stats.tx_i.mcast_en.dropped_map_error); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4772 | DP_PRINT_STATS(" Dropped: Self Mac = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4773 | pdev->stats.tx_i.mcast_en.dropped_self_mac); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4774 | DP_PRINT_STATS(" Dropped: Send Fail = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4775 | pdev->stats.tx_i.mcast_en.dropped_send_fail); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4776 | DP_PRINT_STATS(" Unicast sent = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4777 | pdev->stats.tx_i.mcast_en.ucast); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4778 | DP_PRINT_STATS("Raw:"); |
| 4779 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4780 | pdev->stats.tx_i.raw.raw_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4781 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4782 | pdev->stats.tx_i.raw.raw_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4783 | DP_PRINT_STATS(" DMA map error = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4784 | pdev->stats.tx_i.raw.dma_map_error); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4785 | DP_PRINT_STATS("Reinjected:"); |
| 4786 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4787 | pdev->stats.tx_i.reinject_pkts.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4788 | DP_PRINT_STATS("Bytes = %llu\n", |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4789 | pdev->stats.tx_i.reinject_pkts.bytes); |
| 4790 | DP_PRINT_STATS("Inspected:"); |
| 4791 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4792 | pdev->stats.tx_i.inspect_pkts.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4793 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4794 | pdev->stats.tx_i.inspect_pkts.bytes); |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 4795 | DP_PRINT_STATS("Nawds Multicast:"); |
| 4796 | DP_PRINT_STATS(" Packets = %d", |
| 4797 | pdev->stats.tx_i.nawds_mcast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4798 | DP_PRINT_STATS(" Bytes = %llu", |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 4799 | pdev->stats.tx_i.nawds_mcast.bytes); |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 4800 | DP_PRINT_STATS("CCE Classified:"); |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 4801 | DP_PRINT_STATS(" CCE Classified Packets: %u", |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 4802 | pdev->stats.tx_i.cce_classified); |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 4803 | DP_PRINT_STATS(" RAW CCE Classified Packets: %u", |
Ruchi, Agrawal | 4c1468f | 2017-12-08 00:04:33 +0530 | [diff] [blame] | 4804 | pdev->stats.tx_i.cce_classified_raw); |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 4805 | DP_PRINT_STATS("Mesh stats:"); |
| 4806 | DP_PRINT_STATS(" frames to firmware: %u", |
| 4807 | pdev->stats.tx_i.mesh.exception_fw); |
| 4808 | DP_PRINT_STATS(" completions from fw: %u", |
| 4809 | pdev->stats.tx_i.mesh.completion_fw); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 4810 | DP_PRINT_STATS("PPDU stats counter"); |
| 4811 | for (index = 0; index < CDP_PPDU_STATS_MAX_TAG; index++) { |
| 4812 | DP_PRINT_STATS(" Tag[%d] = %llu", index, |
| 4813 | pdev->stats.ppdu_stats_counter[index]); |
| 4814 | } |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4815 | } |
| 4816 | |
| 4817 | /** |
| 4818 | * dp_print_pdev_rx_stats(): Print Pdev level RX stats |
| 4819 | * @pdev: DP_PDEV Handle |
| 4820 | * |
| 4821 | * Return: void |
| 4822 | */ |
| 4823 | static inline void |
| 4824 | dp_print_pdev_rx_stats(struct dp_pdev *pdev) |
| 4825 | { |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4826 | DP_PRINT_STATS("PDEV Rx Stats:\n"); |
| 4827 | DP_PRINT_STATS("Received From HW (Per Rx Ring):"); |
| 4828 | DP_PRINT_STATS(" Packets = %d %d %d %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4829 | pdev->stats.rx.rcvd_reo[0].num, |
| 4830 | pdev->stats.rx.rcvd_reo[1].num, |
| 4831 | pdev->stats.rx.rcvd_reo[2].num, |
| 4832 | pdev->stats.rx.rcvd_reo[3].num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4833 | DP_PRINT_STATS(" Bytes = %llu %llu %llu %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4834 | pdev->stats.rx.rcvd_reo[0].bytes, |
| 4835 | pdev->stats.rx.rcvd_reo[1].bytes, |
| 4836 | pdev->stats.rx.rcvd_reo[2].bytes, |
| 4837 | pdev->stats.rx.rcvd_reo[3].bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4838 | DP_PRINT_STATS("Replenished:"); |
| 4839 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4840 | pdev->stats.replenish.pkts.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4841 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4842 | pdev->stats.replenish.pkts.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4843 | DP_PRINT_STATS(" Buffers Added To Freelist = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4844 | pdev->stats.buf_freelist); |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 4845 | DP_PRINT_STATS(" Low threshold intr = %d", |
| 4846 | pdev->stats.replenish.low_thresh_intrs); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4847 | DP_PRINT_STATS("Dropped:"); |
| 4848 | DP_PRINT_STATS(" msdu_not_done = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4849 | pdev->stats.dropped.msdu_not_done); |
Neil Zhao | 0bd967d | 2018-03-02 16:00:00 -0800 | [diff] [blame] | 4850 | DP_PRINT_STATS(" mon_rx_drop = %d", |
| 4851 | pdev->stats.dropped.mon_rx_drop); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4852 | DP_PRINT_STATS("Sent To Stack:"); |
| 4853 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4854 | pdev->stats.rx.to_stack.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4855 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4856 | pdev->stats.rx.to_stack.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4857 | DP_PRINT_STATS("Multicast/Broadcast:"); |
| 4858 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4859 | pdev->stats.rx.multicast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4860 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4861 | pdev->stats.rx.multicast.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4862 | DP_PRINT_STATS("Errors:"); |
| 4863 | DP_PRINT_STATS(" Rxdma Ring Un-inititalized = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4864 | pdev->stats.replenish.rxdma_err); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4865 | DP_PRINT_STATS(" Desc Alloc Failed: = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4866 | pdev->stats.err.desc_alloc_fail); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4867 | |
| 4868 | /* Get bar_recv_cnt */ |
| 4869 | dp_aggregate_pdev_ctrl_frames_stats(pdev); |
| 4870 | DP_PRINT_STATS("BAR Received Count: = %d", |
| 4871 | pdev->stats.rx.bar_recv_cnt); |
| 4872 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4873 | } |
| 4874 | |
| 4875 | /** |
| 4876 | * dp_print_soc_tx_stats(): Print SOC level stats |
| 4877 | * @soc DP_SOC Handle |
| 4878 | * |
| 4879 | * Return: void |
| 4880 | */ |
| 4881 | static inline void |
| 4882 | dp_print_soc_tx_stats(struct dp_soc *soc) |
| 4883 | { |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4884 | DP_PRINT_STATS("SOC Tx Stats:\n"); |
| 4885 | DP_PRINT_STATS("Tx Descriptors In Use = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4886 | soc->stats.tx.desc_in_use); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4887 | DP_PRINT_STATS("Invalid peer:"); |
| 4888 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 4889 | soc->stats.tx.tx_invalid_peer.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4890 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 4891 | soc->stats.tx.tx_invalid_peer.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4892 | DP_PRINT_STATS("Packets dropped due to TCL ring full = %d %d %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4893 | soc->stats.tx.tcl_ring_full[0], |
| 4894 | soc->stats.tx.tcl_ring_full[1], |
| 4895 | soc->stats.tx.tcl_ring_full[2]); |
| 4896 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4897 | } |
| 4898 | |
| 4899 | |
| 4900 | /** |
| 4901 | * dp_print_soc_rx_stats: Print SOC level Rx stats |
| 4902 | * @soc: DP_SOC Handle |
| 4903 | * |
| 4904 | * Return:void |
| 4905 | */ |
| 4906 | static inline void |
| 4907 | dp_print_soc_rx_stats(struct dp_soc *soc) |
| 4908 | { |
| 4909 | uint32_t i; |
| 4910 | char reo_error[DP_REO_ERR_LENGTH]; |
| 4911 | char rxdma_error[DP_RXDMA_ERR_LENGTH]; |
| 4912 | uint8_t index = 0; |
| 4913 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4914 | DP_PRINT_STATS("SOC Rx Stats:\n"); |
| 4915 | DP_PRINT_STATS("Errors:\n"); |
| 4916 | DP_PRINT_STATS("Rx Decrypt Errors = %d", |
Pamidipati, Vijay | c2cb427 | 2017-05-23 10:09:26 +0530 | [diff] [blame] | 4917 | (soc->stats.rx.err.rxdma_error[HAL_RXDMA_ERR_DECRYPT] + |
| 4918 | soc->stats.rx.err.rxdma_error[HAL_RXDMA_ERR_TKIP_MIC])); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4919 | DP_PRINT_STATS("Invalid RBM = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4920 | soc->stats.rx.err.invalid_rbm); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4921 | DP_PRINT_STATS("Invalid Vdev = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4922 | soc->stats.rx.err.invalid_vdev); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4923 | DP_PRINT_STATS("Invalid Pdev = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4924 | soc->stats.rx.err.invalid_pdev); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4925 | DP_PRINT_STATS("Invalid Peer = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 4926 | soc->stats.rx.err.rx_invalid_peer.num); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4927 | DP_PRINT_STATS("HAL Ring Access Fail = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4928 | soc->stats.rx.err.hal_ring_access_fail); |
Pamidipati, Vijay | c2cb427 | 2017-05-23 10:09:26 +0530 | [diff] [blame] | 4929 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4930 | for (i = 0; i < HAL_RXDMA_ERR_MAX; i++) { |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4931 | index += qdf_snprint(&rxdma_error[index], |
| 4932 | DP_RXDMA_ERR_LENGTH - index, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4933 | " %d", soc->stats.rx.err.rxdma_error[i]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4934 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4935 | DP_PRINT_STATS("RXDMA Error (0-31):%s", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4936 | rxdma_error); |
| 4937 | |
| 4938 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4939 | for (i = 0; i < HAL_REO_ERR_MAX; i++) { |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4940 | index += qdf_snprint(&reo_error[index], |
| 4941 | DP_REO_ERR_LENGTH - index, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 4942 | " %d", soc->stats.rx.err.reo_error[i]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4943 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4944 | DP_PRINT_STATS("REO Error(0-14):%s", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4945 | reo_error); |
| 4946 | } |
| 4947 | |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 4948 | |
| 4949 | /** |
| 4950 | * dp_print_ring_stat_from_hal(): Print hal level ring stats |
| 4951 | * @soc: DP_SOC handle |
| 4952 | * @srng: DP_SRNG handle |
| 4953 | * @ring_name: SRNG name |
| 4954 | * |
| 4955 | * Return: void |
| 4956 | */ |
| 4957 | static inline void |
| 4958 | dp_print_ring_stat_from_hal(struct dp_soc *soc, struct dp_srng *srng, |
| 4959 | char *ring_name) |
| 4960 | { |
| 4961 | uint32_t tailp; |
| 4962 | uint32_t headp; |
| 4963 | |
| 4964 | if (srng->hal_srng != NULL) { |
| 4965 | hal_api_get_tphp(soc->hal_soc, srng->hal_srng, &tailp, &headp); |
| 4966 | DP_PRINT_STATS("%s : Head pointer = %d Tail Pointer = %d\n", |
| 4967 | ring_name, headp, tailp); |
| 4968 | } |
| 4969 | } |
| 4970 | |
| 4971 | /** |
| 4972 | * dp_print_ring_stats(): Print tail and head pointer |
| 4973 | * @pdev: DP_PDEV handle |
| 4974 | * |
| 4975 | * Return:void |
| 4976 | */ |
| 4977 | static inline void |
| 4978 | dp_print_ring_stats(struct dp_pdev *pdev) |
| 4979 | { |
| 4980 | uint32_t i; |
| 4981 | char ring_name[STR_MAXLEN + 1]; |
| 4982 | |
| 4983 | dp_print_ring_stat_from_hal(pdev->soc, |
| 4984 | &pdev->soc->reo_exception_ring, |
| 4985 | "Reo Exception Ring"); |
| 4986 | dp_print_ring_stat_from_hal(pdev->soc, |
| 4987 | &pdev->soc->reo_reinject_ring, |
| 4988 | "Reo Inject Ring"); |
| 4989 | dp_print_ring_stat_from_hal(pdev->soc, |
| 4990 | &pdev->soc->reo_cmd_ring, |
| 4991 | "Reo Command Ring"); |
| 4992 | dp_print_ring_stat_from_hal(pdev->soc, |
| 4993 | &pdev->soc->reo_status_ring, |
| 4994 | "Reo Status Ring"); |
| 4995 | dp_print_ring_stat_from_hal(pdev->soc, |
| 4996 | &pdev->soc->rx_rel_ring, |
| 4997 | "Rx Release ring"); |
| 4998 | dp_print_ring_stat_from_hal(pdev->soc, |
| 4999 | &pdev->soc->tcl_cmd_ring, |
| 5000 | "Tcl command Ring"); |
| 5001 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5002 | &pdev->soc->tcl_status_ring, |
| 5003 | "Tcl Status Ring"); |
| 5004 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5005 | &pdev->soc->wbm_desc_rel_ring, |
| 5006 | "Wbm Desc Rel Ring"); |
| 5007 | for (i = 0; i < MAX_REO_DEST_RINGS; i++) { |
| 5008 | snprintf(ring_name, STR_MAXLEN, "Reo Dest Ring %d", i); |
| 5009 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5010 | &pdev->soc->reo_dest_ring[i], |
| 5011 | ring_name); |
| 5012 | } |
| 5013 | for (i = 0; i < pdev->soc->num_tcl_data_rings; i++) { |
| 5014 | snprintf(ring_name, STR_MAXLEN, "Tcl Data Ring %d", i); |
| 5015 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5016 | &pdev->soc->tcl_data_ring[i], |
| 5017 | ring_name); |
| 5018 | } |
| 5019 | for (i = 0; i < MAX_TCL_DATA_RINGS; i++) { |
| 5020 | snprintf(ring_name, STR_MAXLEN, "Tx Comp Ring %d", i); |
| 5021 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5022 | &pdev->soc->tx_comp_ring[i], |
| 5023 | ring_name); |
| 5024 | } |
| 5025 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5026 | &pdev->rx_refill_buf_ring, |
| 5027 | "Rx Refill Buf Ring"); |
| 5028 | |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5029 | dp_print_ring_stat_from_hal(pdev->soc, |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 5030 | &pdev->rx_refill_buf_ring2, |
| 5031 | "Second Rx Refill Buf Ring"); |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5032 | |
| 5033 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5034 | &pdev->rxdma_mon_buf_ring, |
| 5035 | "Rxdma Mon Buf Ring"); |
| 5036 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5037 | &pdev->rxdma_mon_dst_ring, |
| 5038 | "Rxdma Mon Dst Ring"); |
| 5039 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5040 | &pdev->rxdma_mon_status_ring, |
| 5041 | "Rxdma Mon Status Ring"); |
| 5042 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5043 | &pdev->rxdma_mon_desc_ring, |
| 5044 | "Rxdma mon desc Ring"); |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 5045 | |
| 5046 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) { |
| 5047 | snprintf(ring_name, STR_MAXLEN, "Rxdma err dst ring %d", i); |
| 5048 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5049 | &pdev->rxdma_err_dst_ring[i], |
| 5050 | ring_name); |
| 5051 | } |
| 5052 | |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5053 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) { |
| 5054 | snprintf(ring_name, STR_MAXLEN, "Rx mac buf ring %d", i); |
| 5055 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5056 | &pdev->rx_mac_buf_ring[i], |
| 5057 | ring_name); |
| 5058 | } |
| 5059 | } |
| 5060 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5061 | /** |
| 5062 | * dp_txrx_host_stats_clr(): Reinitialize the txrx stats |
| 5063 | * @vdev: DP_VDEV handle |
| 5064 | * |
| 5065 | * Return:void |
| 5066 | */ |
| 5067 | static inline void |
| 5068 | dp_txrx_host_stats_clr(struct dp_vdev *vdev) |
| 5069 | { |
| 5070 | struct dp_peer *peer = NULL; |
Anish Nataraj | 28490c4 | 2018-01-19 19:34:54 +0530 | [diff] [blame] | 5071 | struct dp_soc *soc = (struct dp_soc *)vdev->pdev->soc; |
| 5072 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5073 | DP_STATS_CLR(vdev->pdev); |
| 5074 | DP_STATS_CLR(vdev->pdev->soc); |
| 5075 | DP_STATS_CLR(vdev); |
| 5076 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 5077 | if (!peer) |
| 5078 | return; |
| 5079 | DP_STATS_CLR(peer); |
Anish Nataraj | 28490c4 | 2018-01-19 19:34:54 +0530 | [diff] [blame] | 5080 | |
| 5081 | if (soc->cdp_soc.ol_ops->update_dp_stats) { |
| 5082 | soc->cdp_soc.ol_ops->update_dp_stats( |
| 5083 | vdev->pdev->osif_pdev, |
| 5084 | &peer->stats, |
| 5085 | peer->peer_ids[0], |
| 5086 | UPDATE_PEER_STATS); |
| 5087 | } |
| 5088 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5089 | } |
| 5090 | |
Anish Nataraj | 28490c4 | 2018-01-19 19:34:54 +0530 | [diff] [blame] | 5091 | if (soc->cdp_soc.ol_ops->update_dp_stats) |
| 5092 | soc->cdp_soc.ol_ops->update_dp_stats(vdev->pdev->osif_pdev, |
| 5093 | &vdev->stats, (uint16_t)vdev->vdev_id, |
| 5094 | UPDATE_VDEV_STATS); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5095 | } |
| 5096 | |
| 5097 | /** |
| 5098 | * dp_print_rx_rates(): Print Rx rate stats |
| 5099 | * @vdev: DP_VDEV handle |
| 5100 | * |
| 5101 | * Return:void |
| 5102 | */ |
| 5103 | static inline void |
| 5104 | dp_print_rx_rates(struct dp_vdev *vdev) |
| 5105 | { |
| 5106 | struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5107 | uint8_t i, mcs, pkt_type; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5108 | uint8_t index = 0; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5109 | char nss[DP_NSS_LENGTH]; |
| 5110 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5111 | DP_PRINT_STATS("Rx Rate Info:\n"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5112 | |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5113 | for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { |
| 5114 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5115 | for (mcs = 0; mcs < MAX_MCS; mcs++) { |
| 5116 | if (!dp_rate_string[pkt_type][mcs].valid) |
| 5117 | continue; |
| 5118 | |
| 5119 | DP_PRINT_STATS(" %s = %d", |
| 5120 | dp_rate_string[pkt_type][mcs].mcs_type, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5121 | pdev->stats.rx.pkt_type[pkt_type]. |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5122 | mcs_count[mcs]); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5123 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5124 | |
| 5125 | DP_PRINT_STATS("\n"); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5126 | } |
| 5127 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5128 | index = 0; |
| 5129 | for (i = 0; i < SS_COUNT; i++) { |
| 5130 | index += qdf_snprint(&nss[index], DP_NSS_LENGTH - index, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5131 | " %d", pdev->stats.rx.nss[i]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5132 | } |
Anish Nataraj | 072d897 | 2018-01-09 18:23:33 +0530 | [diff] [blame] | 5133 | DP_PRINT_STATS("NSS(1-8) = %s", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5134 | nss); |
| 5135 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5136 | DP_PRINT_STATS("SGI =" |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5137 | " 0.8us %d," |
| 5138 | " 0.4us %d," |
| 5139 | " 1.6us %d," |
| 5140 | " 3.2us %d,", |
| 5141 | pdev->stats.rx.sgi_count[0], |
| 5142 | pdev->stats.rx.sgi_count[1], |
| 5143 | pdev->stats.rx.sgi_count[2], |
| 5144 | pdev->stats.rx.sgi_count[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5145 | DP_PRINT_STATS("BW Counts = 20MHZ %d, 40MHZ %d, 80MHZ %d, 160MHZ %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5146 | pdev->stats.rx.bw[0], pdev->stats.rx.bw[1], |
| 5147 | pdev->stats.rx.bw[2], pdev->stats.rx.bw[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5148 | DP_PRINT_STATS("Reception Type =" |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5149 | " SU: %d," |
| 5150 | " MU_MIMO:%d," |
| 5151 | " MU_OFDMA:%d," |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5152 | " MU_OFDMA_MIMO:%d\n", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5153 | pdev->stats.rx.reception_type[0], |
| 5154 | pdev->stats.rx.reception_type[1], |
| 5155 | pdev->stats.rx.reception_type[2], |
| 5156 | pdev->stats.rx.reception_type[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5157 | DP_PRINT_STATS("Aggregation:\n"); |
| 5158 | DP_PRINT_STATS("Number of Msdu's Part of Ampdus = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5159 | pdev->stats.rx.ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5160 | DP_PRINT_STATS("Number of Msdu's With No Mpdu Level Aggregation : %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5161 | pdev->stats.rx.non_ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5162 | DP_PRINT_STATS("Number of Msdu's Part of Amsdu: %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5163 | pdev->stats.rx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5164 | DP_PRINT_STATS("Number of Msdu's With No Msdu Level Aggregation: %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5165 | pdev->stats.rx.non_amsdu_cnt); |
| 5166 | } |
| 5167 | |
| 5168 | /** |
| 5169 | * dp_print_tx_rates(): Print tx rates |
| 5170 | * @vdev: DP_VDEV handle |
| 5171 | * |
| 5172 | * Return:void |
| 5173 | */ |
| 5174 | static inline void |
| 5175 | dp_print_tx_rates(struct dp_vdev *vdev) |
| 5176 | { |
| 5177 | struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5178 | uint8_t mcs, pkt_type; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5179 | uint32_t index; |
| 5180 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5181 | DP_PRINT_STATS("Tx Rate Info:\n"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5182 | |
| 5183 | for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { |
| 5184 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5185 | for (mcs = 0; mcs < MAX_MCS; mcs++) { |
| 5186 | if (!dp_rate_string[pkt_type][mcs].valid) |
| 5187 | continue; |
| 5188 | |
| 5189 | DP_PRINT_STATS(" %s = %d", |
| 5190 | dp_rate_string[pkt_type][mcs].mcs_type, |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5191 | pdev->stats.tx.pkt_type[pkt_type]. |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5192 | mcs_count[mcs]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5193 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5194 | |
| 5195 | DP_PRINT_STATS("\n"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5196 | } |
| 5197 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5198 | DP_PRINT_STATS("SGI =" |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5199 | " 0.8us %d" |
| 5200 | " 0.4us %d" |
| 5201 | " 1.6us %d" |
| 5202 | " 3.2us %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5203 | pdev->stats.tx.sgi_count[0], |
| 5204 | pdev->stats.tx.sgi_count[1], |
| 5205 | pdev->stats.tx.sgi_count[2], |
| 5206 | pdev->stats.tx.sgi_count[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5207 | |
| 5208 | DP_PRINT_STATS("BW Counts = 20MHZ %d, 40MHZ %d, 80MHZ %d, 160MHZ %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5209 | pdev->stats.tx.bw[0], pdev->stats.tx.bw[1], |
| 5210 | pdev->stats.tx.bw[2], pdev->stats.tx.bw[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5211 | |
| 5212 | DP_PRINT_STATS("OFDMA = %d", pdev->stats.tx.ofdma); |
| 5213 | DP_PRINT_STATS("STBC = %d", pdev->stats.tx.stbc); |
| 5214 | DP_PRINT_STATS("LDPC = %d", pdev->stats.tx.ldpc); |
| 5215 | DP_PRINT_STATS("Retries = %d", pdev->stats.tx.retries); |
| 5216 | DP_PRINT_STATS("Last ack rssi = %d\n", pdev->stats.tx.last_ack_rssi); |
| 5217 | |
| 5218 | DP_PRINT_STATS("Aggregation:\n"); |
| 5219 | DP_PRINT_STATS("Number of Msdu's Part of Amsdu = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5220 | pdev->stats.tx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5221 | DP_PRINT_STATS("Number of Msdu's With No Msdu Level Aggregation = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5222 | pdev->stats.tx.non_amsdu_cnt); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5223 | } |
| 5224 | |
| 5225 | /** |
| 5226 | * dp_print_peer_stats():print peer stats |
| 5227 | * @peer: DP_PEER handle |
| 5228 | * |
| 5229 | * return void |
| 5230 | */ |
| 5231 | static inline void dp_print_peer_stats(struct dp_peer *peer) |
| 5232 | { |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5233 | uint8_t i, mcs, pkt_type; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5234 | uint32_t index; |
| 5235 | char nss[DP_NSS_LENGTH]; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5236 | DP_PRINT_STATS("Node Tx Stats:\n"); |
| 5237 | DP_PRINT_STATS("Total Packet Completions = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5238 | peer->stats.tx.comp_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5239 | DP_PRINT_STATS("Total Bytes Completions = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5240 | peer->stats.tx.comp_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5241 | DP_PRINT_STATS("Success Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5242 | peer->stats.tx.tx_success.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5243 | DP_PRINT_STATS("Success Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5244 | peer->stats.tx.tx_success.bytes); |
Pranita Solanke | fc2ff39 | 2017-12-15 19:25:13 +0530 | [diff] [blame] | 5245 | DP_PRINT_STATS("Unicast Success Packets = %d", |
| 5246 | peer->stats.tx.ucast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5247 | DP_PRINT_STATS("Unicast Success Bytes = %llu", |
Pranita Solanke | fc2ff39 | 2017-12-15 19:25:13 +0530 | [diff] [blame] | 5248 | peer->stats.tx.ucast.bytes); |
| 5249 | DP_PRINT_STATS("Multicast Success Packets = %d", |
| 5250 | peer->stats.tx.mcast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5251 | DP_PRINT_STATS("Multicast Success Bytes = %llu", |
Pranita Solanke | fc2ff39 | 2017-12-15 19:25:13 +0530 | [diff] [blame] | 5252 | peer->stats.tx.mcast.bytes); |
Pranita Solanke | a5a3ae7 | 2018-01-18 21:45:27 +0530 | [diff] [blame] | 5253 | DP_PRINT_STATS("Broadcast Success Packets = %d", |
| 5254 | peer->stats.tx.bcast.num); |
| 5255 | DP_PRINT_STATS("Broadcast Success Bytes = %llu", |
| 5256 | peer->stats.tx.bcast.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5257 | DP_PRINT_STATS("Packets Failed = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5258 | peer->stats.tx.tx_failed); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5259 | DP_PRINT_STATS("Packets In OFDMA = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5260 | peer->stats.tx.ofdma); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5261 | DP_PRINT_STATS("Packets In STBC = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5262 | peer->stats.tx.stbc); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5263 | DP_PRINT_STATS("Packets In LDPC = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5264 | peer->stats.tx.ldpc); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5265 | DP_PRINT_STATS("Packet Retries = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5266 | peer->stats.tx.retries); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5267 | DP_PRINT_STATS("MSDU's Part of AMSDU = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5268 | peer->stats.tx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5269 | DP_PRINT_STATS("Last Packet RSSI = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5270 | peer->stats.tx.last_ack_rssi); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5271 | DP_PRINT_STATS("Dropped At FW: Removed = %d", |
| 5272 | peer->stats.tx.dropped.fw_rem); |
| 5273 | DP_PRINT_STATS("Dropped At FW: Removed transmitted = %d", |
| 5274 | peer->stats.tx.dropped.fw_rem_tx); |
| 5275 | DP_PRINT_STATS("Dropped At FW: Removed Untransmitted = %d", |
| 5276 | peer->stats.tx.dropped.fw_rem_notx); |
| 5277 | DP_PRINT_STATS("Dropped : Age Out = %d", |
| 5278 | peer->stats.tx.dropped.age_out); |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5279 | DP_PRINT_STATS("NAWDS : "); |
| 5280 | DP_PRINT_STATS(" Nawds multicast Drop Tx Packet = %d", |
| 5281 | peer->stats.tx.nawds_mcast_drop); |
| 5282 | DP_PRINT_STATS(" Nawds multicast Tx Packet Count = %d", |
| 5283 | peer->stats.tx.nawds_mcast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5284 | DP_PRINT_STATS(" Nawds multicast Tx Packet Bytes = %llu", |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5285 | peer->stats.tx.nawds_mcast.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5286 | |
| 5287 | DP_PRINT_STATS("Rate Info:"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5288 | |
| 5289 | for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { |
| 5290 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5291 | for (mcs = 0; mcs < MAX_MCS; mcs++) { |
| 5292 | if (!dp_rate_string[pkt_type][mcs].valid) |
| 5293 | continue; |
| 5294 | |
| 5295 | DP_PRINT_STATS(" %s = %d", |
| 5296 | dp_rate_string[pkt_type][mcs].mcs_type, |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5297 | peer->stats.tx.pkt_type[pkt_type]. |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5298 | mcs_count[mcs]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5299 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5300 | |
| 5301 | DP_PRINT_STATS("\n"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5302 | } |
| 5303 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5304 | DP_PRINT_STATS("SGI = " |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5305 | " 0.8us %d" |
| 5306 | " 0.4us %d" |
| 5307 | " 1.6us %d" |
| 5308 | " 3.2us %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5309 | peer->stats.tx.sgi_count[0], |
| 5310 | peer->stats.tx.sgi_count[1], |
| 5311 | peer->stats.tx.sgi_count[2], |
| 5312 | peer->stats.tx.sgi_count[3]); |
Pranita Solanke | a5a3ae7 | 2018-01-18 21:45:27 +0530 | [diff] [blame] | 5313 | DP_PRINT_STATS("Excess Retries per AC "); |
| 5314 | DP_PRINT_STATS(" Best effort = %d", |
| 5315 | peer->stats.tx.excess_retries_per_ac[0]); |
| 5316 | DP_PRINT_STATS(" Background= %d", |
| 5317 | peer->stats.tx.excess_retries_per_ac[1]); |
| 5318 | DP_PRINT_STATS(" Video = %d", |
| 5319 | peer->stats.tx.excess_retries_per_ac[2]); |
| 5320 | DP_PRINT_STATS(" Voice = %d", |
| 5321 | peer->stats.tx.excess_retries_per_ac[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5322 | DP_PRINT_STATS("BW Counts = 20MHZ %d 40MHZ %d 80MHZ %d 160MHZ %d\n", |
Pranita Solanke | d7e10ba | 2017-12-13 15:40:38 +0530 | [diff] [blame] | 5323 | peer->stats.tx.bw[2], peer->stats.tx.bw[3], |
| 5324 | peer->stats.tx.bw[4], peer->stats.tx.bw[5]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5325 | |
Pranita Solanke | ed0aba6 | 2018-01-12 19:14:31 +0530 | [diff] [blame] | 5326 | index = 0; |
| 5327 | for (i = 0; i < SS_COUNT; i++) { |
| 5328 | index += qdf_snprint(&nss[index], DP_NSS_LENGTH - index, |
| 5329 | " %d", peer->stats.tx.nss[i]); |
| 5330 | } |
| 5331 | DP_PRINT_STATS("NSS(1-8) = %s", |
| 5332 | nss); |
| 5333 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5334 | DP_PRINT_STATS("Aggregation:"); |
| 5335 | DP_PRINT_STATS(" Number of Msdu's Part of Amsdu = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5336 | peer->stats.tx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5337 | DP_PRINT_STATS(" Number of Msdu's With No Msdu Level Aggregation = %d\n", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5338 | peer->stats.tx.non_amsdu_cnt); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5339 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5340 | DP_PRINT_STATS("Node Rx Stats:"); |
| 5341 | DP_PRINT_STATS("Packets Sent To Stack = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5342 | peer->stats.rx.to_stack.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5343 | DP_PRINT_STATS("Bytes Sent To Stack = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5344 | peer->stats.rx.to_stack.bytes); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5345 | for (i = 0; i < CDP_MAX_RX_RINGS; i++) { |
Pranita Solanke | fc2ff39 | 2017-12-15 19:25:13 +0530 | [diff] [blame] | 5346 | DP_PRINT_STATS("Ring Id = %d", i); |
| 5347 | DP_PRINT_STATS(" Packets Received = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5348 | peer->stats.rx.rcvd_reo[i].num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5349 | DP_PRINT_STATS(" Bytes Received = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5350 | peer->stats.rx.rcvd_reo[i].bytes); |
| 5351 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5352 | DP_PRINT_STATS("Multicast Packets Received = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5353 | peer->stats.rx.multicast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5354 | DP_PRINT_STATS("Multicast Bytes Received = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5355 | peer->stats.rx.multicast.bytes); |
Pranita Solanke | a5a3ae7 | 2018-01-18 21:45:27 +0530 | [diff] [blame] | 5356 | DP_PRINT_STATS("Broadcast Packets Received = %d", |
| 5357 | peer->stats.rx.bcast.num); |
| 5358 | DP_PRINT_STATS("Broadcast Bytes Received = %llu", |
| 5359 | peer->stats.rx.bcast.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5360 | DP_PRINT_STATS("Intra BSS Packets Received = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5361 | peer->stats.rx.intra_bss.pkts.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5362 | DP_PRINT_STATS("Intra BSS Bytes Received = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5363 | peer->stats.rx.intra_bss.pkts.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5364 | DP_PRINT_STATS("Raw Packets Received = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5365 | peer->stats.rx.raw.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5366 | DP_PRINT_STATS("Raw Bytes Received = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5367 | peer->stats.rx.raw.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5368 | DP_PRINT_STATS("Errors: MIC Errors = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5369 | peer->stats.rx.err.mic_err); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5370 | DP_PRINT_STATS("Erros: Decryption Errors = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5371 | peer->stats.rx.err.decrypt_err); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5372 | DP_PRINT_STATS("Msdu's Received As Part of Ampdu = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5373 | peer->stats.rx.non_ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5374 | DP_PRINT_STATS("Msdu's Recived As Ampdu = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5375 | peer->stats.rx.ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5376 | DP_PRINT_STATS("Msdu's Received Not Part of Amsdu's = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5377 | peer->stats.rx.non_amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5378 | DP_PRINT_STATS("MSDUs Received As Part of Amsdu = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5379 | peer->stats.rx.amsdu_cnt); |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5380 | DP_PRINT_STATS("NAWDS : "); |
| 5381 | DP_PRINT_STATS(" Nawds multicast Drop Rx Packet = %d", |
| 5382 | peer->stats.rx.nawds_mcast_drop.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5383 | DP_PRINT_STATS(" Nawds multicast Drop Rx Packet Bytes = %llu", |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5384 | peer->stats.rx.nawds_mcast_drop.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5385 | DP_PRINT_STATS("SGI =" |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5386 | " 0.8us %d" |
| 5387 | " 0.4us %d" |
| 5388 | " 1.6us %d" |
| 5389 | " 3.2us %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5390 | peer->stats.rx.sgi_count[0], |
| 5391 | peer->stats.rx.sgi_count[1], |
| 5392 | peer->stats.rx.sgi_count[2], |
| 5393 | peer->stats.rx.sgi_count[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5394 | DP_PRINT_STATS("BW Counts = 20MHZ %d 40MHZ %d 80MHZ %d 160MHZ %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5395 | peer->stats.rx.bw[0], peer->stats.rx.bw[1], |
| 5396 | peer->stats.rx.bw[2], peer->stats.rx.bw[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5397 | DP_PRINT_STATS("Reception Type =" |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5398 | " SU %d," |
| 5399 | " MU_MIMO %d," |
| 5400 | " MU_OFDMA %d," |
| 5401 | " MU_OFDMA_MIMO %d", |
| 5402 | peer->stats.rx.reception_type[0], |
| 5403 | peer->stats.rx.reception_type[1], |
| 5404 | peer->stats.rx.reception_type[2], |
| 5405 | peer->stats.rx.reception_type[3]); |
| 5406 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5407 | |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5408 | for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { |
| 5409 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5410 | for (mcs = 0; mcs < MAX_MCS; mcs++) { |
| 5411 | if (!dp_rate_string[pkt_type][mcs].valid) |
| 5412 | continue; |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5413 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5414 | DP_PRINT_STATS(" %s = %d", |
| 5415 | dp_rate_string[pkt_type][mcs].mcs_type, |
| 5416 | peer->stats.rx.pkt_type[pkt_type]. |
| 5417 | mcs_count[mcs]); |
| 5418 | } |
| 5419 | |
| 5420 | DP_PRINT_STATS("\n"); |
| 5421 | } |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5422 | |
| 5423 | index = 0; |
| 5424 | for (i = 0; i < SS_COUNT; i++) { |
| 5425 | index += qdf_snprint(&nss[index], DP_NSS_LENGTH - index, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5426 | " %d", peer->stats.rx.nss[i]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5427 | } |
Anish Nataraj | 072d897 | 2018-01-09 18:23:33 +0530 | [diff] [blame] | 5428 | DP_PRINT_STATS("NSS(1-8) = %s", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5429 | nss); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5430 | |
| 5431 | DP_PRINT_STATS("Aggregation:"); |
| 5432 | DP_PRINT_STATS(" Msdu's Part of Ampdu = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5433 | peer->stats.rx.ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5434 | DP_PRINT_STATS(" Msdu's With No Mpdu Level Aggregation = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5435 | peer->stats.rx.non_ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5436 | DP_PRINT_STATS(" Msdu's Part of Amsdu = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5437 | peer->stats.rx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5438 | DP_PRINT_STATS(" Msdu's With No Msdu Level Aggregation = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5439 | peer->stats.rx.non_amsdu_cnt); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5440 | } |
| 5441 | |
| 5442 | /** |
| 5443 | * dp_print_host_stats()- Function to print the stats aggregated at host |
| 5444 | * @vdev_handle: DP_VDEV handle |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5445 | * @type: host stats type |
| 5446 | * |
| 5447 | * Available Stat types |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5448 | * TXRX_CLEAR_STATS : Clear the stats |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5449 | * TXRX_RX_RATE_STATS: Print Rx Rate Info |
| 5450 | * TXRX_TX_RATE_STATS: Print Tx Rate Info |
| 5451 | * TXRX_TX_HOST_STATS: Print Tx Stats |
| 5452 | * TXRX_RX_HOST_STATS: Print Rx Stats |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 5453 | * TXRX_AST_STATS: Print AST Stats |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5454 | * TXRX_SRNG_PTR_STATS: Print SRNG ring pointer stats |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5455 | * |
| 5456 | * Return: 0 on success, print error message in case of failure |
| 5457 | */ |
| 5458 | static int |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5459 | dp_print_host_stats(struct cdp_vdev *vdev_handle, enum cdp_host_txrx_stats type) |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5460 | { |
| 5461 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 5462 | struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; |
| 5463 | |
| 5464 | dp_aggregate_pdev_stats(pdev); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 5465 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5466 | switch (type) { |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5467 | case TXRX_CLEAR_STATS: |
| 5468 | dp_txrx_host_stats_clr(vdev); |
| 5469 | break; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5470 | case TXRX_RX_RATE_STATS: |
| 5471 | dp_print_rx_rates(vdev); |
| 5472 | break; |
| 5473 | case TXRX_TX_RATE_STATS: |
| 5474 | dp_print_tx_rates(vdev); |
| 5475 | break; |
| 5476 | case TXRX_TX_HOST_STATS: |
| 5477 | dp_print_pdev_tx_stats(pdev); |
| 5478 | dp_print_soc_tx_stats(pdev->soc); |
| 5479 | break; |
| 5480 | case TXRX_RX_HOST_STATS: |
| 5481 | dp_print_pdev_rx_stats(pdev); |
| 5482 | dp_print_soc_rx_stats(pdev->soc); |
| 5483 | break; |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 5484 | case TXRX_AST_STATS: |
| 5485 | dp_print_ast_stats(pdev->soc); |
| 5486 | break; |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5487 | case TXRX_SRNG_PTR_STATS: |
| 5488 | dp_print_ring_stats(pdev); |
| 5489 | break; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5490 | default: |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 5491 | DP_TRACE(FATAL, "Wrong Input For TxRx Host Stats"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5492 | break; |
| 5493 | } |
| 5494 | return 0; |
| 5495 | } |
| 5496 | |
| 5497 | /* |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5498 | * dp_get_host_peer_stats()- function to print peer stats |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5499 | * @pdev_handle: DP_PDEV handle |
| 5500 | * @mac_addr: mac address of the peer |
| 5501 | * |
| 5502 | * Return: void |
| 5503 | */ |
| 5504 | static void |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5505 | dp_get_host_peer_stats(struct cdp_pdev *pdev_handle, char *mac_addr) |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5506 | { |
| 5507 | struct dp_peer *peer; |
| 5508 | uint8_t local_id; |
| 5509 | peer = (struct dp_peer *)dp_find_peer_by_addr(pdev_handle, mac_addr, |
| 5510 | &local_id); |
| 5511 | |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 5512 | if (!peer) { |
| 5513 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 5514 | "%s: Invalid peer\n", __func__); |
| 5515 | return; |
| 5516 | } |
| 5517 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5518 | dp_print_peer_stats(peer); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 5519 | dp_peer_rxtid_stats(peer, dp_rx_tid_stats_cb, NULL); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5520 | return; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5521 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5522 | |
| 5523 | /* |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5524 | * dp_ppdu_ring_reset()- Reset PPDU Stats ring |
| 5525 | * @pdev: DP_PDEV handle |
| 5526 | * |
| 5527 | * Return: void |
| 5528 | */ |
| 5529 | static void |
| 5530 | dp_ppdu_ring_reset(struct dp_pdev *pdev) |
| 5531 | { |
| 5532 | struct htt_rx_ring_tlv_filter htt_tlv_filter; |
| 5533 | |
| 5534 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 5535 | |
| 5536 | htt_h2t_rx_ring_cfg(pdev->soc->htt_handle, pdev->pdev_id, |
| 5537 | pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, |
| 5538 | RX_BUFFER_SIZE, &htt_tlv_filter); |
| 5539 | |
| 5540 | } |
| 5541 | |
| 5542 | /* |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 5543 | * dp_ppdu_ring_cfg()- Configure PPDU Stats ring |
| 5544 | * @pdev: DP_PDEV handle |
| 5545 | * |
| 5546 | * Return: void |
| 5547 | */ |
| 5548 | static void |
| 5549 | dp_ppdu_ring_cfg(struct dp_pdev *pdev) |
| 5550 | { |
| 5551 | struct htt_rx_ring_tlv_filter htt_tlv_filter = {0}; |
| 5552 | |
| 5553 | htt_tlv_filter.mpdu_start = 0; |
| 5554 | htt_tlv_filter.msdu_start = 0; |
| 5555 | htt_tlv_filter.packet = 0; |
| 5556 | htt_tlv_filter.msdu_end = 0; |
| 5557 | htt_tlv_filter.mpdu_end = 0; |
| 5558 | htt_tlv_filter.packet_header = 1; |
| 5559 | htt_tlv_filter.attention = 1; |
| 5560 | htt_tlv_filter.ppdu_start = 1; |
| 5561 | htt_tlv_filter.ppdu_end = 1; |
| 5562 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 5563 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 5564 | htt_tlv_filter.ppdu_end_status_done = 1; |
| 5565 | htt_tlv_filter.enable_fp = 1; |
| 5566 | htt_tlv_filter.enable_md = 0; |
| 5567 | htt_tlv_filter.enable_mo = 0; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 5568 | htt_tlv_filter.fp_mgmt_filter = FILTER_MGMT_ALL; |
| 5569 | htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_ALL; |
| 5570 | htt_tlv_filter.fp_data_filter = FILTER_DATA_ALL; |
| 5571 | htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL; |
| 5572 | htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; |
| 5573 | htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 5574 | |
| 5575 | htt_h2t_rx_ring_cfg(pdev->soc->htt_handle, pdev->pdev_id, |
| 5576 | pdev->rxdma_mon_status_ring.hal_srng, RXDMA_MONITOR_STATUS, |
| 5577 | RX_BUFFER_SIZE, &htt_tlv_filter); |
| 5578 | } |
| 5579 | |
| 5580 | /* |
Soumya Bhat | 6fee59c | 2017-10-31 13:12:37 +0530 | [diff] [blame] | 5581 | * dp_config_debug_sniffer()- API to enable/disable debug sniffer |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5582 | * @pdev_handle: DP_PDEV handle |
| 5583 | * @val: user provided value |
| 5584 | * |
| 5585 | * Return: void |
| 5586 | */ |
| 5587 | static void |
Soumya Bhat | 6fee59c | 2017-10-31 13:12:37 +0530 | [diff] [blame] | 5588 | dp_config_debug_sniffer(struct cdp_pdev *pdev_handle, int val) |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5589 | { |
| 5590 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 5591 | |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 5592 | switch (val) { |
| 5593 | case 0: |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5594 | pdev->tx_sniffer_enable = 0; |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5595 | pdev->mcopy_mode = 0; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5596 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5597 | if (!pdev->pktlog_ppdu_stats && !pdev->enhanced_stats_en) { |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 5598 | dp_h2t_cfg_stats_msg_send(pdev, 0, pdev->pdev_id); |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5599 | dp_ppdu_ring_reset(pdev); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5600 | } else if (pdev->enhanced_stats_en) { |
| 5601 | dp_h2t_cfg_stats_msg_send(pdev, |
| 5602 | DP_PPDU_STATS_CFG_ENH_STATS, pdev->pdev_id); |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5603 | } |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 5604 | break; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5605 | |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 5606 | case 1: |
| 5607 | pdev->tx_sniffer_enable = 1; |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5608 | pdev->mcopy_mode = 0; |
| 5609 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5610 | if (!pdev->pktlog_ppdu_stats) |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5611 | dp_h2t_cfg_stats_msg_send(pdev, |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5612 | DP_PPDU_STATS_CFG_SNIFFER, pdev->pdev_id); |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 5613 | break; |
| 5614 | case 2: |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5615 | pdev->mcopy_mode = 1; |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 5616 | pdev->tx_sniffer_enable = 0; |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5617 | if (!pdev->enhanced_stats_en) |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5618 | dp_ppdu_ring_cfg(pdev); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5619 | |
| 5620 | if (!pdev->pktlog_ppdu_stats) |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5621 | dp_h2t_cfg_stats_msg_send(pdev, |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5622 | DP_PPDU_STATS_CFG_SNIFFER, pdev->pdev_id); |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 5623 | break; |
| 5624 | default: |
| 5625 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 5626 | "Invalid value\n"); |
| 5627 | break; |
| 5628 | } |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5629 | } |
| 5630 | |
| 5631 | /* |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 5632 | * dp_enable_enhanced_stats()- API to enable enhanced statistcs |
| 5633 | * @pdev_handle: DP_PDEV handle |
| 5634 | * |
| 5635 | * Return: void |
| 5636 | */ |
| 5637 | static void |
| 5638 | dp_enable_enhanced_stats(struct cdp_pdev *pdev_handle) |
| 5639 | { |
| 5640 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 5641 | pdev->enhanced_stats_en = 1; |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 5642 | |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5643 | if (!pdev->mcopy_mode) |
| 5644 | dp_ppdu_ring_cfg(pdev); |
| 5645 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5646 | if (!pdev->pktlog_ppdu_stats && !pdev->tx_sniffer_enable && !pdev->mcopy_mode) |
| 5647 | dp_h2t_cfg_stats_msg_send(pdev, DP_PPDU_STATS_CFG_ENH_STATS, pdev->pdev_id); |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 5648 | } |
| 5649 | |
| 5650 | /* |
| 5651 | * dp_disable_enhanced_stats()- API to disable enhanced statistcs |
| 5652 | * @pdev_handle: DP_PDEV handle |
| 5653 | * |
| 5654 | * Return: void |
| 5655 | */ |
| 5656 | static void |
| 5657 | dp_disable_enhanced_stats(struct cdp_pdev *pdev_handle) |
| 5658 | { |
| 5659 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5660 | |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 5661 | pdev->enhanced_stats_en = 0; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5662 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5663 | if (!pdev->pktlog_ppdu_stats && !pdev->tx_sniffer_enable && !pdev->mcopy_mode) |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 5664 | dp_h2t_cfg_stats_msg_send(pdev, 0, pdev->pdev_id); |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5665 | |
| 5666 | if (!pdev->mcopy_mode) |
| 5667 | dp_ppdu_ring_reset(pdev); |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 5668 | } |
| 5669 | |
| 5670 | /* |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5671 | * dp_get_fw_peer_stats()- function to print peer stats |
| 5672 | * @pdev_handle: DP_PDEV handle |
| 5673 | * @mac_addr: mac address of the peer |
| 5674 | * @cap: Type of htt stats requested |
| 5675 | * |
| 5676 | * Currently Supporting only MAC ID based requests Only |
| 5677 | * 1: HTT_PEER_STATS_REQ_MODE_NO_QUERY |
| 5678 | * 2: HTT_PEER_STATS_REQ_MODE_QUERY_TQM |
| 5679 | * 3: HTT_PEER_STATS_REQ_MODE_FLUSH_TQM |
| 5680 | * |
| 5681 | * Return: void |
| 5682 | */ |
| 5683 | static void |
| 5684 | dp_get_fw_peer_stats(struct cdp_pdev *pdev_handle, uint8_t *mac_addr, |
| 5685 | uint32_t cap) |
| 5686 | { |
| 5687 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Pamidipati, Vijay | c2cf669 | 2017-11-22 10:17:34 +0530 | [diff] [blame] | 5688 | int i; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5689 | uint32_t config_param0 = 0; |
| 5690 | uint32_t config_param1 = 0; |
| 5691 | uint32_t config_param2 = 0; |
| 5692 | uint32_t config_param3 = 0; |
| 5693 | |
| 5694 | HTT_DBG_EXT_STATS_PEER_INFO_IS_MAC_ADDR_SET(config_param0, 1); |
| 5695 | config_param0 |= (1 << (cap + 1)); |
| 5696 | |
Pamidipati, Vijay | c2cf669 | 2017-11-22 10:17:34 +0530 | [diff] [blame] | 5697 | for (i = 0; i < HTT_PEER_STATS_MAX_TLV; i++) { |
| 5698 | config_param1 |= (1 << i); |
| 5699 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5700 | |
| 5701 | config_param2 |= (mac_addr[0] & 0x000000ff); |
| 5702 | config_param2 |= ((mac_addr[1] << 8) & 0x0000ff00); |
| 5703 | config_param2 |= ((mac_addr[2] << 16) & 0x00ff0000); |
| 5704 | config_param2 |= ((mac_addr[3] << 24) & 0xff000000); |
| 5705 | |
| 5706 | config_param3 |= (mac_addr[4] & 0x000000ff); |
| 5707 | config_param3 |= ((mac_addr[5] << 8) & 0x0000ff00); |
| 5708 | |
| 5709 | dp_h2t_ext_stats_msg_send(pdev, HTT_DBG_EXT_STATS_PEER_INFO, |
| 5710 | config_param0, config_param1, config_param2, |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame^] | 5711 | config_param3, 0, 0, 0); |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 5712 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5713 | } |
| 5714 | |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 5715 | /* This struct definition will be removed from here |
| 5716 | * once it get added in FW headers*/ |
| 5717 | struct httstats_cmd_req { |
| 5718 | uint32_t config_param0; |
| 5719 | uint32_t config_param1; |
| 5720 | uint32_t config_param2; |
| 5721 | uint32_t config_param3; |
| 5722 | int cookie; |
| 5723 | u_int8_t stats_id; |
| 5724 | }; |
| 5725 | |
| 5726 | /* |
| 5727 | * dp_get_htt_stats: function to process the httstas request |
| 5728 | * @pdev_handle: DP pdev handle |
| 5729 | * @data: pointer to request data |
| 5730 | * @data_len: length for request data |
| 5731 | * |
| 5732 | * return: void |
| 5733 | */ |
| 5734 | static void |
| 5735 | dp_get_htt_stats(struct cdp_pdev *pdev_handle, void *data, uint32_t data_len) |
| 5736 | { |
| 5737 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 5738 | struct httstats_cmd_req *req = (struct httstats_cmd_req *)data; |
| 5739 | |
| 5740 | QDF_ASSERT(data_len == sizeof(struct httstats_cmd_req)); |
| 5741 | dp_h2t_ext_stats_msg_send(pdev, req->stats_id, |
| 5742 | req->config_param0, req->config_param1, |
| 5743 | req->config_param2, req->config_param3, |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame^] | 5744 | req->cookie, 0, 0); |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 5745 | } |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 5746 | /* |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5747 | * dp_set_pdev_param: function to set parameters in pdev |
| 5748 | * @pdev_handle: DP pdev handle |
| 5749 | * @param: parameter type to be set |
| 5750 | * @val: value of parameter to be set |
| 5751 | * |
| 5752 | * return: void |
| 5753 | */ |
| 5754 | static void dp_set_pdev_param(struct cdp_pdev *pdev_handle, |
| 5755 | enum cdp_pdev_param_type param, uint8_t val) |
| 5756 | { |
| 5757 | switch (param) { |
Soumya Bhat | 6fee59c | 2017-10-31 13:12:37 +0530 | [diff] [blame] | 5758 | case CDP_CONFIG_DEBUG_SNIFFER: |
| 5759 | dp_config_debug_sniffer(pdev_handle, val); |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 5760 | break; |
| 5761 | default: |
| 5762 | break; |
| 5763 | } |
| 5764 | } |
| 5765 | |
| 5766 | /* |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 5767 | * dp_set_vdev_param: function to set parameters in vdev |
| 5768 | * @param: parameter type to be set |
| 5769 | * @val: value of parameter to be set |
| 5770 | * |
| 5771 | * return: void |
| 5772 | */ |
| 5773 | static void dp_set_vdev_param(struct cdp_vdev *vdev_handle, |
| 5774 | enum cdp_vdev_param_type param, uint32_t val) |
| 5775 | { |
| 5776 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 5777 | switch (param) { |
Pamidipati, Vijay | c9a13a5 | 2017-04-06 17:45:49 +0530 | [diff] [blame] | 5778 | case CDP_ENABLE_WDS: |
| 5779 | vdev->wds_enabled = val; |
| 5780 | break; |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 5781 | case CDP_ENABLE_NAWDS: |
| 5782 | vdev->nawds_enabled = val; |
Ishank Jain | b463d9a | 2017-05-08 14:59:47 +0530 | [diff] [blame] | 5783 | break; |
Ishank Jain | c838b13 | 2017-02-17 11:08:18 +0530 | [diff] [blame] | 5784 | case CDP_ENABLE_MCAST_EN: |
| 5785 | vdev->mcast_enhancement_en = val; |
Pamidipati, Vijay | c9a13a5 | 2017-04-06 17:45:49 +0530 | [diff] [blame] | 5786 | break; |
| 5787 | case CDP_ENABLE_PROXYSTA: |
| 5788 | vdev->proxysta_vdev = val; |
| 5789 | break; |
Kabilan Kannan | 56bfd8f | 2017-04-26 13:26:47 -0700 | [diff] [blame] | 5790 | case CDP_UPDATE_TDLS_FLAGS: |
| 5791 | vdev->tdls_link_connected = val; |
Ishank Jain | b463d9a | 2017-05-08 14:59:47 +0530 | [diff] [blame] | 5792 | break; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 5793 | case CDP_CFG_WDS_AGING_TIMER: |
| 5794 | if (val == 0) |
| 5795 | qdf_timer_stop(&vdev->pdev->soc->wds_aging_timer); |
| 5796 | else if (val != vdev->wds_aging_timer_val) |
| 5797 | qdf_timer_mod(&vdev->pdev->soc->wds_aging_timer, val); |
| 5798 | |
| 5799 | vdev->wds_aging_timer_val = val; |
| 5800 | break; |
URAJ SASAN | 81d9571 | 2017-08-21 20:51:03 +0530 | [diff] [blame] | 5801 | case CDP_ENABLE_AP_BRIDGE: |
| 5802 | if (wlan_op_mode_sta != vdev->opmode) |
| 5803 | vdev->ap_bridge_enabled = val; |
| 5804 | else |
| 5805 | vdev->ap_bridge_enabled = false; |
| 5806 | break; |
ruchi agrawal | 45f3ac4 | 2017-10-25 09:03:28 +0530 | [diff] [blame] | 5807 | case CDP_ENABLE_CIPHER: |
| 5808 | vdev->sec_type = val; |
| 5809 | break; |
Nandha Kishore Easwaran | 47e7416 | 2017-12-12 11:54:01 +0530 | [diff] [blame] | 5810 | case CDP_ENABLE_QWRAP_ISOLATION: |
| 5811 | vdev->isolation_vdev = val; |
| 5812 | break; |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 5813 | default: |
| 5814 | break; |
| 5815 | } |
Pamidipati, Vijay | c9a13a5 | 2017-04-06 17:45:49 +0530 | [diff] [blame] | 5816 | |
| 5817 | dp_tx_vdev_update_search_flags(vdev); |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 5818 | } |
| 5819 | |
| 5820 | /** |
| 5821 | * dp_peer_set_nawds: set nawds bit in peer |
| 5822 | * @peer_handle: pointer to peer |
| 5823 | * @value: enable/disable nawds |
| 5824 | * |
| 5825 | * return: void |
| 5826 | */ |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 5827 | static void dp_peer_set_nawds(struct cdp_peer *peer_handle, uint8_t value) |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 5828 | { |
| 5829 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 5830 | peer->nawds_enabled = value; |
| 5831 | } |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5832 | |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 5833 | /* |
| 5834 | * dp_set_vdev_dscp_tid_map_wifi3(): Update Map ID selected for particular vdev |
| 5835 | * @vdev_handle: DP_VDEV handle |
| 5836 | * @map_id:ID of map that needs to be updated |
| 5837 | * |
| 5838 | * Return: void |
| 5839 | */ |
| 5840 | static void dp_set_vdev_dscp_tid_map_wifi3(struct cdp_vdev *vdev_handle, |
| 5841 | uint8_t map_id) |
| 5842 | { |
| 5843 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 5844 | vdev->dscp_tid_map_id = map_id; |
| 5845 | return; |
| 5846 | } |
| 5847 | |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 5848 | /* |
| 5849 | * dp_txrx_stats_publish(): publish pdev stats into a buffer |
| 5850 | * @pdev_handle: DP_PDEV handle |
| 5851 | * @buf: to hold pdev_stats |
| 5852 | * |
| 5853 | * Return: int |
| 5854 | */ |
| 5855 | static int |
| 5856 | dp_txrx_stats_publish(struct cdp_pdev *pdev_handle, void *buf) |
| 5857 | { |
| 5858 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 5859 | struct cdp_pdev_stats *buffer = (struct cdp_pdev_stats *) buf; |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 5860 | struct cdp_txrx_stats_req req = {0,}; |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 5861 | |
| 5862 | dp_aggregate_pdev_stats(pdev); |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 5863 | req.stats = HTT_DBG_EXT_STATS_PDEV_TX; |
| 5864 | req.cookie_val = 1; |
| 5865 | dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0, |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame^] | 5866 | req.param1, req.param2, req.param3, 0, |
| 5867 | req.cookie_val, 0); |
| 5868 | |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 5869 | msleep(DP_MAX_SLEEP_TIME); |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 5870 | |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 5871 | req.stats = HTT_DBG_EXT_STATS_PDEV_RX; |
| 5872 | req.cookie_val = 1; |
| 5873 | dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0, |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame^] | 5874 | req.param1, req.param2, req.param3, 0, |
| 5875 | req.cookie_val, 0); |
| 5876 | |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 5877 | msleep(DP_MAX_SLEEP_TIME); |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 5878 | qdf_mem_copy(buffer, &pdev->stats, sizeof(pdev->stats)); |
| 5879 | |
| 5880 | return TXRX_STATS_LEVEL; |
| 5881 | } |
| 5882 | |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 5883 | /** |
| 5884 | * dp_set_pdev_dscp_tid_map_wifi3(): update dscp tid map in pdev |
| 5885 | * @pdev: DP_PDEV handle |
| 5886 | * @map_id: ID of map that needs to be updated |
| 5887 | * @tos: index value in map |
| 5888 | * @tid: tid value passed by the user |
| 5889 | * |
| 5890 | * Return: void |
| 5891 | */ |
| 5892 | static void dp_set_pdev_dscp_tid_map_wifi3(struct cdp_pdev *pdev_handle, |
| 5893 | uint8_t map_id, uint8_t tos, uint8_t tid) |
| 5894 | { |
| 5895 | uint8_t dscp; |
| 5896 | struct dp_pdev *pdev = (struct dp_pdev *) pdev_handle; |
| 5897 | dscp = (tos >> DP_IP_DSCP_SHIFT) & DP_IP_DSCP_MASK; |
| 5898 | pdev->dscp_tid_map[map_id][dscp] = tid; |
Om Prakash Tripathi | 5425c52 | 2017-08-18 11:11:34 +0530 | [diff] [blame] | 5899 | if (map_id < HAL_MAX_HW_DSCP_TID_MAPS) |
| 5900 | hal_tx_update_dscp_tid(pdev->soc->hal_soc, tid, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 5901 | map_id, dscp); |
| 5902 | return; |
| 5903 | } |
| 5904 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5905 | /** |
| 5906 | * dp_fw_stats_process(): Process TxRX FW stats request |
| 5907 | * @vdev_handle: DP VDEV handle |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5908 | * @req: stats request |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5909 | * |
| 5910 | * return: int |
| 5911 | */ |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5912 | static int dp_fw_stats_process(struct cdp_vdev *vdev_handle, |
| 5913 | struct cdp_txrx_stats_req *req) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5914 | { |
| 5915 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 5916 | struct dp_pdev *pdev = NULL; |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5917 | uint32_t stats = req->stats; |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame^] | 5918 | uint8_t channel = req->channel; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5919 | |
| 5920 | if (!vdev) { |
| 5921 | DP_TRACE(NONE, "VDEV not found"); |
| 5922 | return 1; |
| 5923 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5924 | pdev = vdev->pdev; |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5925 | |
chenguo | cda2512 | 2018-01-24 17:39:38 +0800 | [diff] [blame] | 5926 | /* |
| 5927 | * For HTT_DBG_EXT_STATS_RESET command, FW need to config |
| 5928 | * from param0 to param3 according to below rule: |
| 5929 | * |
| 5930 | * PARAM: |
| 5931 | * - config_param0 : start_offset (stats type) |
| 5932 | * - config_param1 : stats bmask from start offset |
| 5933 | * - config_param2 : stats bmask from start offset + 32 |
| 5934 | * - config_param3 : stats bmask from start offset + 64 |
| 5935 | */ |
| 5936 | if (req->stats == CDP_TXRX_STATS_0) { |
| 5937 | req->param0 = HTT_DBG_EXT_STATS_PDEV_TX; |
| 5938 | req->param1 = 0xFFFFFFFF; |
| 5939 | req->param2 = 0xFFFFFFFF; |
| 5940 | req->param3 = 0xFFFFFFFF; |
| 5941 | } |
| 5942 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5943 | return dp_h2t_ext_stats_msg_send(pdev, stats, req->param0, |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame^] | 5944 | req->param1, req->param2, req->param3, |
| 5945 | 0, 0, channel); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5946 | } |
| 5947 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5948 | /** |
| 5949 | * dp_txrx_stats_request - function to map to firmware and host stats |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 5950 | * @vdev: virtual handle |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5951 | * @req: stats request |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 5952 | * |
| 5953 | * Return: integer |
| 5954 | */ |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5955 | static int dp_txrx_stats_request(struct cdp_vdev *vdev, |
| 5956 | struct cdp_txrx_stats_req *req) |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 5957 | { |
| 5958 | int host_stats; |
| 5959 | int fw_stats; |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5960 | enum cdp_stats stats; |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 5961 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5962 | if (!vdev || !req) { |
| 5963 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 5964 | "Invalid vdev/req instance"); |
| 5965 | return 0; |
| 5966 | } |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame^] | 5967 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5968 | stats = req->stats; |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 5969 | if (stats >= CDP_TXRX_MAX_STATS) |
| 5970 | return 0; |
| 5971 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5972 | /* |
| 5973 | * DP_CURR_FW_STATS_AVAIL: no of FW stats currently available |
| 5974 | * has to be updated if new FW HTT stats added |
| 5975 | */ |
| 5976 | if (stats > CDP_TXRX_STATS_HTT_MAX) |
| 5977 | stats = stats + DP_CURR_FW_STATS_AVAIL - DP_HTT_DBG_EXT_STATS_MAX; |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 5978 | fw_stats = dp_stats_mapping_table[stats][STATS_FW]; |
| 5979 | host_stats = dp_stats_mapping_table[stats][STATS_HOST]; |
| 5980 | |
| 5981 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 5982 | "stats: %u fw_stats_type: %d host_stats_type: %d", |
| 5983 | stats, fw_stats, host_stats); |
| 5984 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 5985 | if (fw_stats != TXRX_FW_STATS_INVALID) { |
| 5986 | /* update request with FW stats type */ |
| 5987 | req->stats = fw_stats; |
| 5988 | return dp_fw_stats_process(vdev, req); |
| 5989 | } |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 5990 | |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5991 | if ((host_stats != TXRX_HOST_STATS_INVALID) && |
| 5992 | (host_stats <= TXRX_HOST_STATS_MAX)) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5993 | return dp_print_host_stats(vdev, host_stats); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5994 | else |
| 5995 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 5996 | "Wrong Input for TxRx Stats"); |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 5997 | |
| 5998 | return 0; |
| 5999 | } |
| 6000 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6001 | /* |
psimha | 61b1a36 | 2017-07-27 15:45:49 -0700 | [diff] [blame] | 6002 | * dp_print_napi_stats(): NAPI stats |
| 6003 | * @soc - soc handle |
| 6004 | */ |
| 6005 | static void dp_print_napi_stats(struct dp_soc *soc) |
| 6006 | { |
| 6007 | hif_print_napi_stats(soc->hif_handle); |
| 6008 | } |
| 6009 | |
| 6010 | /* |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6011 | * dp_print_per_ring_stats(): Packet count per ring |
| 6012 | * @soc - soc handle |
| 6013 | */ |
| 6014 | static void dp_print_per_ring_stats(struct dp_soc *soc) |
| 6015 | { |
chenguo | 8107b66 | 2017-12-13 16:31:13 +0800 | [diff] [blame] | 6016 | uint8_t ring; |
| 6017 | uint16_t core; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6018 | uint64_t total_packets; |
| 6019 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6020 | DP_TRACE(FATAL, "Reo packets per ring:"); |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6021 | for (ring = 0; ring < MAX_REO_DEST_RINGS; ring++) { |
| 6022 | total_packets = 0; |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6023 | DP_TRACE(FATAL, "Packets on ring %u:", ring); |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6024 | for (core = 0; core < NR_CPUS; core++) { |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6025 | DP_TRACE(FATAL, "Packets arriving on core %u: %llu", |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6026 | core, soc->stats.rx.ring_packets[core][ring]); |
| 6027 | total_packets += soc->stats.rx.ring_packets[core][ring]; |
| 6028 | } |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6029 | DP_TRACE(FATAL, "Total packets on ring %u: %llu", |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6030 | ring, total_packets); |
| 6031 | } |
| 6032 | } |
| 6033 | |
| 6034 | /* |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6035 | * dp_txrx_path_stats() - Function to display dump stats |
| 6036 | * @soc - soc handle |
| 6037 | * |
| 6038 | * return: none |
| 6039 | */ |
| 6040 | static void dp_txrx_path_stats(struct dp_soc *soc) |
| 6041 | { |
| 6042 | uint8_t error_code; |
| 6043 | uint8_t loop_pdev; |
| 6044 | struct dp_pdev *pdev; |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6045 | uint8_t i; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6046 | |
| 6047 | for (loop_pdev = 0; loop_pdev < soc->pdev_count; loop_pdev++) { |
| 6048 | |
| 6049 | pdev = soc->pdev_list[loop_pdev]; |
| 6050 | dp_aggregate_pdev_stats(pdev); |
| 6051 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6052 | "Tx path Statistics:"); |
| 6053 | |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6054 | DP_TRACE(FATAL, "from stack: %u msdus (%llu bytes)", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6055 | pdev->stats.tx_i.rcvd.num, |
| 6056 | pdev->stats.tx_i.rcvd.bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6057 | DP_TRACE(FATAL, "processed from host: %u msdus (%llu bytes)", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6058 | pdev->stats.tx_i.processed.num, |
| 6059 | pdev->stats.tx_i.processed.bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6060 | DP_TRACE(FATAL, "successfully transmitted: %u msdus (%llu bytes)", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6061 | pdev->stats.tx.tx_success.num, |
| 6062 | pdev->stats.tx.tx_success.bytes); |
| 6063 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6064 | DP_TRACE(FATAL, "Dropped in host:"); |
| 6065 | DP_TRACE(FATAL, "Total packets dropped: %u,", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6066 | pdev->stats.tx_i.dropped.dropped_pkt.num); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6067 | DP_TRACE(FATAL, "Descriptor not available: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6068 | pdev->stats.tx_i.dropped.desc_na); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6069 | DP_TRACE(FATAL, "Ring full: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6070 | pdev->stats.tx_i.dropped.ring_full); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6071 | DP_TRACE(FATAL, "Enqueue fail: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6072 | pdev->stats.tx_i.dropped.enqueue_fail); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6073 | DP_TRACE(FATAL, "DMA Error: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6074 | pdev->stats.tx_i.dropped.dma_error); |
| 6075 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6076 | DP_TRACE(FATAL, "Dropped in hardware:"); |
| 6077 | DP_TRACE(FATAL, "total packets dropped: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6078 | pdev->stats.tx.tx_failed); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6079 | DP_TRACE(FATAL, "mpdu age out: %u", |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 6080 | pdev->stats.tx.dropped.age_out); |
| 6081 | DP_TRACE(FATAL, "firmware removed: %u", |
| 6082 | pdev->stats.tx.dropped.fw_rem); |
| 6083 | DP_TRACE(FATAL, "firmware removed tx: %u", |
| 6084 | pdev->stats.tx.dropped.fw_rem_tx); |
| 6085 | DP_TRACE(FATAL, "firmware removed notx %u", |
| 6086 | pdev->stats.tx.dropped.fw_rem_notx); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6087 | DP_TRACE(FATAL, "peer_invalid: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6088 | pdev->soc->stats.tx.tx_invalid_peer.num); |
| 6089 | |
| 6090 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6091 | DP_TRACE(FATAL, "Tx packets sent per interrupt:"); |
| 6092 | DP_TRACE(FATAL, "Single Packet: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6093 | pdev->stats.tx_comp_histogram.pkts_1); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6094 | DP_TRACE(FATAL, "2-20 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6095 | pdev->stats.tx_comp_histogram.pkts_2_20); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6096 | DP_TRACE(FATAL, "21-40 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6097 | pdev->stats.tx_comp_histogram.pkts_21_40); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6098 | DP_TRACE(FATAL, "41-60 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6099 | pdev->stats.tx_comp_histogram.pkts_41_60); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6100 | DP_TRACE(FATAL, "61-80 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6101 | pdev->stats.tx_comp_histogram.pkts_61_80); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6102 | DP_TRACE(FATAL, "81-100 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6103 | pdev->stats.tx_comp_histogram.pkts_81_100); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6104 | DP_TRACE(FATAL, "101-200 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6105 | pdev->stats.tx_comp_histogram.pkts_101_200); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6106 | DP_TRACE(FATAL, " 201+ Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6107 | pdev->stats.tx_comp_histogram.pkts_201_plus); |
| 6108 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6109 | DP_TRACE(FATAL, "Rx path statistics"); |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6110 | |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6111 | DP_TRACE(FATAL, "delivered %u msdus ( %llu bytes),", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6112 | pdev->stats.rx.to_stack.num, |
| 6113 | pdev->stats.rx.to_stack.bytes); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6114 | for (i = 0; i < CDP_MAX_RX_RINGS; i++) |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6115 | DP_TRACE(FATAL, "received on reo[%d] %u msdus ( %llu bytes),", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6116 | i, pdev->stats.rx.rcvd_reo[i].num, |
| 6117 | pdev->stats.rx.rcvd_reo[i].bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6118 | DP_TRACE(FATAL, "intra-bss packets %u msdus ( %llu bytes),", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6119 | pdev->stats.rx.intra_bss.pkts.num, |
| 6120 | pdev->stats.rx.intra_bss.pkts.bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6121 | DP_TRACE(FATAL, "intra-bss fails %u msdus ( %llu bytes),", |
Yun Park | 92af713 | 2017-09-13 16:33:35 -0700 | [diff] [blame] | 6122 | pdev->stats.rx.intra_bss.fail.num, |
| 6123 | pdev->stats.rx.intra_bss.fail.bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6124 | DP_TRACE(FATAL, "raw packets %u msdus ( %llu bytes),", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6125 | pdev->stats.rx.raw.num, |
| 6126 | pdev->stats.rx.raw.bytes); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6127 | DP_TRACE(FATAL, "dropped: error %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6128 | pdev->stats.rx.err.mic_err); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6129 | DP_TRACE(FATAL, "peer invalid %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6130 | pdev->soc->stats.rx.err.rx_invalid_peer.num); |
| 6131 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6132 | DP_TRACE(FATAL, "Reo Statistics"); |
| 6133 | DP_TRACE(FATAL, "rbm error: %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6134 | pdev->soc->stats.rx.err.invalid_rbm); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6135 | DP_TRACE(FATAL, "hal ring access fail: %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6136 | pdev->soc->stats.rx.err.hal_ring_access_fail); |
| 6137 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6138 | DP_TRACE(FATAL, "Reo errors"); |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6139 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 6140 | for (error_code = 0; error_code < HAL_REO_ERR_MAX; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6141 | error_code++) { |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6142 | DP_TRACE(FATAL, "Reo error number (%u): %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6143 | error_code, |
| 6144 | pdev->soc->stats.rx.err.reo_error[error_code]); |
| 6145 | } |
| 6146 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 6147 | for (error_code = 0; error_code < HAL_RXDMA_ERR_MAX; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6148 | error_code++) { |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6149 | DP_TRACE(FATAL, "Rxdma error number (%u): %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6150 | error_code, |
| 6151 | pdev->soc->stats.rx.err |
| 6152 | .rxdma_error[error_code]); |
| 6153 | } |
| 6154 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6155 | DP_TRACE(FATAL, "Rx packets reaped per interrupt:"); |
| 6156 | DP_TRACE(FATAL, "Single Packet: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6157 | pdev->stats.rx_ind_histogram.pkts_1); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6158 | DP_TRACE(FATAL, "2-20 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6159 | pdev->stats.rx_ind_histogram.pkts_2_20); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6160 | DP_TRACE(FATAL, "21-40 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6161 | pdev->stats.rx_ind_histogram.pkts_21_40); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6162 | DP_TRACE(FATAL, "41-60 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6163 | pdev->stats.rx_ind_histogram.pkts_41_60); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6164 | DP_TRACE(FATAL, "61-80 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6165 | pdev->stats.rx_ind_histogram.pkts_61_80); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6166 | DP_TRACE(FATAL, "81-100 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6167 | pdev->stats.rx_ind_histogram.pkts_81_100); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6168 | DP_TRACE(FATAL, "101-200 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6169 | pdev->stats.rx_ind_histogram.pkts_101_200); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6170 | DP_TRACE(FATAL, " 201+ Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6171 | pdev->stats.rx_ind_histogram.pkts_201_plus); |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 6172 | |
| 6173 | DP_TRACE_STATS(ERROR, "%s: tso_enable: %u lro_enable: %u rx_hash: %u napi_enable: %u", |
| 6174 | __func__, |
| 6175 | pdev->soc->wlan_cfg_ctx->tso_enabled, |
| 6176 | pdev->soc->wlan_cfg_ctx->lro_enabled, |
| 6177 | pdev->soc->wlan_cfg_ctx->rx_hash, |
| 6178 | pdev->soc->wlan_cfg_ctx->napi_enabled); |
| 6179 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
| 6180 | DP_TRACE_STATS(ERROR, "%s: Tx flow stop queue: %u tx flow start queue offset: %u", |
| 6181 | __func__, |
| 6182 | pdev->soc->wlan_cfg_ctx->tx_flow_stop_queue_threshold, |
| 6183 | pdev->soc->wlan_cfg_ctx->tx_flow_start_queue_offset); |
| 6184 | #endif |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6185 | } |
| 6186 | } |
| 6187 | |
| 6188 | /* |
| 6189 | * dp_txrx_dump_stats() - Dump statistics |
| 6190 | * @value - Statistics option |
| 6191 | */ |
Mohit Khanna | 90d7ebd | 2017-09-12 21:54:21 -0700 | [diff] [blame] | 6192 | static QDF_STATUS dp_txrx_dump_stats(void *psoc, uint16_t value, |
| 6193 | enum qdf_stats_verbosity_level level) |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6194 | { |
| 6195 | struct dp_soc *soc = |
| 6196 | (struct dp_soc *)psoc; |
| 6197 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6198 | |
| 6199 | if (!soc) { |
| 6200 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6201 | "%s: soc is NULL", __func__); |
| 6202 | return QDF_STATUS_E_INVAL; |
| 6203 | } |
| 6204 | |
| 6205 | switch (value) { |
| 6206 | case CDP_TXRX_PATH_STATS: |
| 6207 | dp_txrx_path_stats(soc); |
| 6208 | break; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6209 | |
| 6210 | case CDP_RX_RING_STATS: |
| 6211 | dp_print_per_ring_stats(soc); |
| 6212 | break; |
| 6213 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6214 | case CDP_TXRX_TSO_STATS: |
| 6215 | /* TODO: NOT IMPLEMENTED */ |
| 6216 | break; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6217 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6218 | case CDP_DUMP_TX_FLOW_POOL_INFO: |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 6219 | cdp_dump_flow_pool_info((struct cdp_soc_t *)soc); |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6220 | break; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6221 | |
psimha | 61b1a36 | 2017-07-27 15:45:49 -0700 | [diff] [blame] | 6222 | case CDP_DP_NAPI_STATS: |
| 6223 | dp_print_napi_stats(soc); |
| 6224 | break; |
| 6225 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6226 | case CDP_TXRX_DESC_STATS: |
| 6227 | /* TODO: NOT IMPLEMENTED */ |
| 6228 | break; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6229 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6230 | default: |
| 6231 | status = QDF_STATUS_E_INVAL; |
| 6232 | break; |
| 6233 | } |
| 6234 | |
| 6235 | return status; |
| 6236 | |
| 6237 | } |
| 6238 | |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 6239 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
| 6240 | /** |
| 6241 | * dp_update_flow_control_parameters() - API to store datapath |
| 6242 | * config parameters |
| 6243 | * @soc: soc handle |
| 6244 | * @cfg: ini parameter handle |
| 6245 | * |
| 6246 | * Return: void |
| 6247 | */ |
| 6248 | static inline |
| 6249 | void dp_update_flow_control_parameters(struct dp_soc *soc, |
| 6250 | struct cdp_config_params *params) |
| 6251 | { |
| 6252 | soc->wlan_cfg_ctx->tx_flow_stop_queue_threshold = |
| 6253 | params->tx_flow_stop_queue_threshold; |
| 6254 | soc->wlan_cfg_ctx->tx_flow_start_queue_offset = |
| 6255 | params->tx_flow_start_queue_offset; |
| 6256 | } |
| 6257 | #else |
| 6258 | static inline |
| 6259 | void dp_update_flow_control_parameters(struct dp_soc *soc, |
| 6260 | struct cdp_config_params *params) |
| 6261 | { |
| 6262 | } |
| 6263 | #endif |
| 6264 | |
| 6265 | /** |
| 6266 | * dp_update_config_parameters() - API to store datapath |
| 6267 | * config parameters |
| 6268 | * @soc: soc handle |
| 6269 | * @cfg: ini parameter handle |
| 6270 | * |
| 6271 | * Return: status |
| 6272 | */ |
| 6273 | static |
| 6274 | QDF_STATUS dp_update_config_parameters(struct cdp_soc *psoc, |
| 6275 | struct cdp_config_params *params) |
| 6276 | { |
| 6277 | struct dp_soc *soc = (struct dp_soc *)psoc; |
| 6278 | |
| 6279 | if (!(soc)) { |
| 6280 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6281 | "%s: Invalid handle", __func__); |
| 6282 | return QDF_STATUS_E_INVAL; |
| 6283 | } |
| 6284 | |
| 6285 | soc->wlan_cfg_ctx->tso_enabled = params->tso_enable; |
| 6286 | soc->wlan_cfg_ctx->lro_enabled = params->lro_enable; |
| 6287 | soc->wlan_cfg_ctx->rx_hash = params->flow_steering_enable; |
| 6288 | soc->wlan_cfg_ctx->tcp_udp_checksumoffload = |
| 6289 | params->tcp_udp_checksumoffload; |
| 6290 | soc->wlan_cfg_ctx->napi_enabled = params->napi_enable; |
| 6291 | |
| 6292 | dp_update_flow_control_parameters(soc, params); |
| 6293 | |
| 6294 | return QDF_STATUS_SUCCESS; |
| 6295 | } |
| 6296 | |
Tallapragada Kalyan | 2a5fc62 | 2017-12-08 21:07:43 +0530 | [diff] [blame] | 6297 | /** |
| 6298 | * dp_txrx_set_wds_rx_policy() - API to store datapath |
| 6299 | * config parameters |
| 6300 | * @vdev_handle - datapath vdev handle |
| 6301 | * @cfg: ini parameter handle |
| 6302 | * |
| 6303 | * Return: status |
| 6304 | */ |
| 6305 | #ifdef WDS_VENDOR_EXTENSION |
| 6306 | void |
| 6307 | dp_txrx_set_wds_rx_policy( |
| 6308 | struct cdp_vdev *vdev_handle, |
| 6309 | u_int32_t val) |
| 6310 | { |
| 6311 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 6312 | struct dp_peer *peer; |
| 6313 | if (vdev->opmode == wlan_op_mode_ap) { |
| 6314 | /* for ap, set it on bss_peer */ |
| 6315 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 6316 | if (peer->bss_peer) { |
| 6317 | peer->wds_ecm.wds_rx_filter = 1; |
| 6318 | peer->wds_ecm.wds_rx_ucast_4addr = (val & WDS_POLICY_RX_UCAST_4ADDR) ? 1:0; |
| 6319 | peer->wds_ecm.wds_rx_mcast_4addr = (val & WDS_POLICY_RX_MCAST_4ADDR) ? 1:0; |
| 6320 | break; |
| 6321 | } |
| 6322 | } |
| 6323 | } else if (vdev->opmode == wlan_op_mode_sta) { |
| 6324 | peer = TAILQ_FIRST(&vdev->peer_list); |
| 6325 | peer->wds_ecm.wds_rx_filter = 1; |
| 6326 | peer->wds_ecm.wds_rx_ucast_4addr = (val & WDS_POLICY_RX_UCAST_4ADDR) ? 1:0; |
| 6327 | peer->wds_ecm.wds_rx_mcast_4addr = (val & WDS_POLICY_RX_MCAST_4ADDR) ? 1:0; |
| 6328 | } |
| 6329 | } |
| 6330 | |
| 6331 | /** |
| 6332 | * dp_txrx_peer_wds_tx_policy_update() - API to set tx wds policy |
| 6333 | * |
| 6334 | * @peer_handle - datapath peer handle |
| 6335 | * @wds_tx_ucast: policy for unicast transmission |
| 6336 | * @wds_tx_mcast: policy for multicast transmission |
| 6337 | * |
| 6338 | * Return: void |
| 6339 | */ |
| 6340 | void |
| 6341 | dp_txrx_peer_wds_tx_policy_update(struct cdp_peer *peer_handle, |
| 6342 | int wds_tx_ucast, int wds_tx_mcast) |
| 6343 | { |
| 6344 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 6345 | if (wds_tx_ucast || wds_tx_mcast) { |
| 6346 | peer->wds_enabled = 1; |
| 6347 | peer->wds_ecm.wds_tx_ucast_4addr = wds_tx_ucast; |
| 6348 | peer->wds_ecm.wds_tx_mcast_4addr = wds_tx_mcast; |
| 6349 | } else { |
| 6350 | peer->wds_enabled = 0; |
| 6351 | peer->wds_ecm.wds_tx_ucast_4addr = 0; |
| 6352 | peer->wds_ecm.wds_tx_mcast_4addr = 0; |
| 6353 | } |
| 6354 | |
| 6355 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 6356 | FL("Policy Update set to :\ |
| 6357 | peer->wds_enabled %d\ |
| 6358 | peer->wds_ecm.wds_tx_ucast_4addr %d\ |
| 6359 | peer->wds_ecm.wds_tx_mcast_4addr %d\n"), |
| 6360 | peer->wds_enabled, peer->wds_ecm.wds_tx_ucast_4addr, |
| 6361 | peer->wds_ecm.wds_tx_mcast_4addr); |
| 6362 | return; |
| 6363 | } |
| 6364 | #endif |
| 6365 | |
Karunakar Dasineni | ca79254 | 2017-01-16 10:08:58 -0800 | [diff] [blame] | 6366 | static struct cdp_wds_ops dp_ops_wds = { |
| 6367 | .vdev_set_wds = dp_vdev_set_wds, |
Tallapragada Kalyan | 2a5fc62 | 2017-12-08 21:07:43 +0530 | [diff] [blame] | 6368 | #ifdef WDS_VENDOR_EXTENSION |
| 6369 | .txrx_set_wds_rx_policy = dp_txrx_set_wds_rx_policy, |
| 6370 | .txrx_wds_peer_tx_policy_update = dp_txrx_peer_wds_tx_policy_update, |
| 6371 | #endif |
Karunakar Dasineni | ca79254 | 2017-01-16 10:08:58 -0800 | [diff] [blame] | 6372 | }; |
| 6373 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6374 | /* |
| 6375 | * dp_peer_delete_ast_entries(): Delete all AST entries for a peer |
| 6376 | * @soc - datapath soc handle |
| 6377 | * @peer - datapath peer handle |
| 6378 | * |
| 6379 | * Delete the AST entries belonging to a peer |
| 6380 | */ |
| 6381 | #ifdef FEATURE_WDS |
| 6382 | static inline void dp_peer_delete_ast_entries(struct dp_soc *soc, |
| 6383 | struct dp_peer *peer) |
| 6384 | { |
Tallapragada Kalyan | 1c14d5d | 2017-07-26 00:31:35 +0530 | [diff] [blame] | 6385 | struct dp_ast_entry *ast_entry, *temp_ast_entry; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6386 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 6387 | qdf_spin_lock_bh(&soc->ast_lock); |
| 6388 | DP_PEER_ITERATE_ASE_LIST(peer, ast_entry, temp_ast_entry) |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6389 | dp_peer_del_ast(soc, ast_entry); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 6390 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6391 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 6392 | } |
| 6393 | #else |
| 6394 | static inline void dp_peer_delete_ast_entries(struct dp_soc *soc, |
| 6395 | struct dp_peer *peer) |
| 6396 | { |
| 6397 | } |
| 6398 | #endif |
| 6399 | |
Kabilan Kannan | 60e3b30 | 2017-09-07 20:06:17 -0700 | [diff] [blame] | 6400 | /* |
| 6401 | * dp_txrx_data_tx_cb_set(): set the callback for non standard tx |
| 6402 | * @vdev_handle - datapath vdev handle |
| 6403 | * @callback - callback function |
| 6404 | * @ctxt: callback context |
| 6405 | * |
| 6406 | */ |
| 6407 | static void |
| 6408 | dp_txrx_data_tx_cb_set(struct cdp_vdev *vdev_handle, |
| 6409 | ol_txrx_data_tx_cb callback, void *ctxt) |
| 6410 | { |
| 6411 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 6412 | |
| 6413 | vdev->tx_non_std_data_callback.func = callback; |
| 6414 | vdev->tx_non_std_data_callback.ctxt = ctxt; |
| 6415 | } |
| 6416 | |
Santosh Anbu | 2280e86 | 2018-01-03 22:25:53 +0530 | [diff] [blame] | 6417 | /** |
| 6418 | * dp_pdev_get_dp_txrx_handle() - get dp handle from pdev |
| 6419 | * @pdev_hdl: datapath pdev handle |
| 6420 | * |
| 6421 | * Return: opaque pointer to dp txrx handle |
| 6422 | */ |
| 6423 | static void *dp_pdev_get_dp_txrx_handle(struct cdp_pdev *pdev_hdl) |
| 6424 | { |
| 6425 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_hdl; |
| 6426 | |
| 6427 | return pdev->dp_txrx_handle; |
| 6428 | } |
| 6429 | |
| 6430 | /** |
| 6431 | * dp_pdev_set_dp_txrx_handle() - set dp handle in pdev |
| 6432 | * @pdev_hdl: datapath pdev handle |
| 6433 | * @dp_txrx_hdl: opaque pointer for dp_txrx_handle |
| 6434 | * |
| 6435 | * Return: void |
| 6436 | */ |
| 6437 | static void |
| 6438 | dp_pdev_set_dp_txrx_handle(struct cdp_pdev *pdev_hdl, void *dp_txrx_hdl) |
| 6439 | { |
| 6440 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_hdl; |
| 6441 | |
| 6442 | pdev->dp_txrx_handle = dp_txrx_hdl; |
| 6443 | } |
| 6444 | |
Pamidipati, Vijay | d3478ef | 2018-02-06 23:52:29 +0530 | [diff] [blame] | 6445 | /** |
| 6446 | * dp_soc_get_dp_txrx_handle() - get context for external-dp from dp soc |
| 6447 | * @soc_handle: datapath soc handle |
| 6448 | * |
| 6449 | * Return: opaque pointer to external dp (non-core DP) |
| 6450 | */ |
| 6451 | static void *dp_soc_get_dp_txrx_handle(struct cdp_soc *soc_handle) |
| 6452 | { |
| 6453 | struct dp_soc *soc = (struct dp_soc *)soc_handle; |
| 6454 | |
| 6455 | return soc->external_txrx_handle; |
| 6456 | } |
| 6457 | |
| 6458 | /** |
| 6459 | * dp_soc_set_dp_txrx_handle() - set external dp handle in soc |
| 6460 | * @soc_handle: datapath soc handle |
| 6461 | * @txrx_handle: opaque pointer to external dp (non-core DP) |
| 6462 | * |
| 6463 | * Return: void |
| 6464 | */ |
| 6465 | static void |
| 6466 | dp_soc_set_dp_txrx_handle(struct cdp_soc *soc_handle, void *txrx_handle) |
| 6467 | { |
| 6468 | struct dp_soc *soc = (struct dp_soc *)soc_handle; |
| 6469 | |
| 6470 | soc->external_txrx_handle = txrx_handle; |
| 6471 | } |
| 6472 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6473 | #ifdef CONFIG_WIN |
| 6474 | static void dp_peer_teardown_wifi3(struct cdp_vdev *vdev_hdl, void *peer_hdl) |
| 6475 | { |
| 6476 | struct dp_vdev *vdev = (struct dp_vdev *) vdev_hdl; |
| 6477 | struct dp_peer *peer = (struct dp_peer *) peer_hdl; |
| 6478 | struct dp_soc *soc = (struct dp_soc *) vdev->pdev->soc; |
| 6479 | |
Karunakar Dasineni | 372647d | 2018-01-15 22:27:39 -0800 | [diff] [blame] | 6480 | peer->delete_in_progress = true; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6481 | dp_peer_delete_ast_entries(soc, peer); |
| 6482 | } |
| 6483 | #endif |
| 6484 | |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 6485 | #ifdef ATH_SUPPORT_NAC_RSSI |
| 6486 | static QDF_STATUS dp_config_for_nac_rssi(struct cdp_vdev *vdev_handle, |
| 6487 | enum cdp_nac_param_cmd cmd, char *bssid, char *client_macaddr, |
| 6488 | uint8_t chan_num) |
| 6489 | { |
| 6490 | |
| 6491 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 6492 | struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; |
| 6493 | struct dp_soc *soc = (struct dp_soc *) vdev->pdev->soc; |
| 6494 | |
| 6495 | pdev->nac_rssi_filtering = 1; |
| 6496 | /* Store address of NAC (neighbour peer) which will be checked |
| 6497 | * against TA of received packets. |
| 6498 | */ |
| 6499 | |
| 6500 | if (cmd == CDP_NAC_PARAM_ADD) { |
| 6501 | qdf_mem_copy(vdev->cdp_nac_rssi.client_mac, |
| 6502 | client_macaddr, DP_MAC_ADDR_LEN); |
| 6503 | vdev->cdp_nac_rssi_enabled = 1; |
| 6504 | } else if (cmd == CDP_NAC_PARAM_DEL) { |
| 6505 | if (!qdf_mem_cmp(vdev->cdp_nac_rssi.client_mac, |
| 6506 | client_macaddr, DP_MAC_ADDR_LEN)) { |
| 6507 | /* delete this peer from the list */ |
| 6508 | qdf_mem_zero(vdev->cdp_nac_rssi.client_mac, |
| 6509 | DP_MAC_ADDR_LEN); |
| 6510 | } |
| 6511 | vdev->cdp_nac_rssi_enabled = 0; |
| 6512 | } |
| 6513 | |
| 6514 | if (soc->cdp_soc.ol_ops->config_bssid_in_fw_for_nac_rssi) |
| 6515 | soc->cdp_soc.ol_ops->config_bssid_in_fw_for_nac_rssi |
| 6516 | (vdev->pdev->osif_pdev, vdev->vdev_id, cmd, bssid); |
| 6517 | |
| 6518 | return QDF_STATUS_SUCCESS; |
| 6519 | } |
| 6520 | #endif |
| 6521 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6522 | static struct cdp_cmn_ops dp_ops_cmn = { |
| 6523 | .txrx_soc_attach_target = dp_soc_attach_target_wifi3, |
| 6524 | .txrx_vdev_attach = dp_vdev_attach_wifi3, |
| 6525 | .txrx_vdev_detach = dp_vdev_detach_wifi3, |
| 6526 | .txrx_pdev_attach = dp_pdev_attach_wifi3, |
| 6527 | .txrx_pdev_detach = dp_pdev_detach_wifi3, |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 6528 | .txrx_peer_create = dp_peer_create_wifi3, |
| 6529 | .txrx_peer_setup = dp_peer_setup_wifi3, |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6530 | #ifdef CONFIG_WIN |
| 6531 | .txrx_peer_teardown = dp_peer_teardown_wifi3, |
| 6532 | #else |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 6533 | .txrx_peer_teardown = NULL, |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6534 | #endif |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 6535 | .txrx_peer_add_ast = dp_peer_add_ast_wifi3, |
| 6536 | .txrx_peer_del_ast = dp_peer_del_ast_wifi3, |
| 6537 | .txrx_peer_update_ast = dp_peer_update_ast_wifi3, |
| 6538 | .txrx_peer_ast_hash_find = dp_peer_ast_hash_find_wifi3, |
| 6539 | .txrx_peer_ast_get_pdev_id = dp_peer_ast_get_pdev_id_wifi3, |
| 6540 | .txrx_peer_ast_get_next_hop = dp_peer_ast_get_next_hop_wifi3, |
| 6541 | .txrx_peer_ast_set_type = dp_peer_ast_set_type_wifi3, |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 6542 | .txrx_peer_delete = dp_peer_delete_wifi3, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6543 | .txrx_vdev_register = dp_vdev_register_wifi3, |
| 6544 | .txrx_soc_detach = dp_soc_detach_wifi3, |
| 6545 | .txrx_get_vdev_mac_addr = dp_get_vdev_mac_addr_wifi3, |
| 6546 | .txrx_get_vdev_from_vdev_id = dp_get_vdev_from_vdev_id_wifi3, |
| 6547 | .txrx_get_ctrl_pdev_from_vdev = dp_get_ctrl_pdev_from_vdev_wifi3, |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 6548 | .addba_requestprocess = dp_addba_requestprocess_wifi3, |
| 6549 | .addba_responsesetup = dp_addba_responsesetup_wifi3, |
| 6550 | .delba_process = dp_delba_process_wifi3, |
Gyanranjan Hazarika | 99a58d3 | 2017-12-22 21:56:17 -0800 | [diff] [blame] | 6551 | .set_addba_response = dp_set_addba_response, |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 6552 | .get_peer_mac_addr_frm_id = dp_get_peer_mac_addr_frm_id, |
Manikandan Mohan | e2fa8b7 | 2017-03-22 11:18:26 -0700 | [diff] [blame] | 6553 | .flush_cache_rx_queue = NULL, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 6554 | /* TODO: get API's for dscp-tid need to be added*/ |
| 6555 | .set_vdev_dscp_tid_map = dp_set_vdev_dscp_tid_map_wifi3, |
| 6556 | .set_pdev_dscp_tid_map = dp_set_pdev_dscp_tid_map_wifi3, |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6557 | .txrx_stats_request = dp_txrx_stats_request, |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 6558 | .txrx_set_monitor_mode = dp_vdev_set_monitor_mode, |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 6559 | .txrx_get_pdev_id_frm_pdev = dp_get_pdev_id_frm_pdev, |
| 6560 | .txrx_set_nac = dp_set_nac, |
| 6561 | .txrx_get_tx_pending = dp_get_tx_pending, |
| 6562 | .txrx_set_pdev_tx_capture = dp_config_debug_sniffer, |
| 6563 | .txrx_get_peer_mac_from_peer_id = dp_get_peer_mac_from_peer_id, |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6564 | .display_stats = dp_txrx_dump_stats, |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 6565 | .txrx_soc_set_nss_cfg = dp_soc_set_nss_cfg_wifi3, |
| 6566 | .txrx_soc_get_nss_cfg = dp_soc_get_nss_cfg_wifi3, |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 6567 | #ifdef DP_INTR_POLL_BASED |
| 6568 | .txrx_intr_attach = dp_soc_interrupt_attach_wrapper, |
| 6569 | #else |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 6570 | .txrx_intr_attach = dp_soc_interrupt_attach, |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 6571 | #endif |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 6572 | .txrx_intr_detach = dp_soc_interrupt_detach, |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 6573 | .set_pn_check = dp_set_pn_check_wifi3, |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 6574 | .update_config_parameters = dp_update_config_parameters, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6575 | /* TODO: Add other functions */ |
Santosh Anbu | 2280e86 | 2018-01-03 22:25:53 +0530 | [diff] [blame] | 6576 | .txrx_data_tx_cb_set = dp_txrx_data_tx_cb_set, |
| 6577 | .get_dp_txrx_handle = dp_pdev_get_dp_txrx_handle, |
| 6578 | .set_dp_txrx_handle = dp_pdev_set_dp_txrx_handle, |
Pamidipati, Vijay | d3478ef | 2018-02-06 23:52:29 +0530 | [diff] [blame] | 6579 | .get_soc_dp_txrx_handle = dp_soc_get_dp_txrx_handle, |
| 6580 | .set_soc_dp_txrx_handle = dp_soc_set_dp_txrx_handle, |
| 6581 | .tx_send = dp_tx_send, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6582 | }; |
| 6583 | |
| 6584 | static struct cdp_ctrl_ops dp_ops_ctrl = { |
| 6585 | .txrx_peer_authorize = dp_peer_authorize, |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 6586 | #ifdef QCA_SUPPORT_SON |
| 6587 | .txrx_set_inact_params = dp_set_inact_params, |
| 6588 | .txrx_start_inact_timer = dp_start_inact_timer, |
| 6589 | .txrx_set_overload = dp_set_overload, |
| 6590 | .txrx_peer_is_inact = dp_peer_is_inact, |
| 6591 | .txrx_mark_peer_inact = dp_mark_peer_inact, |
| 6592 | #endif |
Kalyan Tallapragada | 277f45e | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 6593 | .txrx_set_vdev_rx_decap_type = dp_set_vdev_rx_decap_type, |
| 6594 | .txrx_set_tx_encap_type = dp_set_vdev_tx_encap_type, |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 6595 | #ifdef MESH_MODE_SUPPORT |
| 6596 | .txrx_set_mesh_mode = dp_peer_set_mesh_mode, |
Venkateswara Swamy Bandaru | ec4f8e6 | 2017-03-07 11:04:28 +0530 | [diff] [blame] | 6597 | .txrx_set_mesh_rx_filter = dp_peer_set_mesh_rx_filter, |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 6598 | #endif |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 6599 | .txrx_set_vdev_param = dp_set_vdev_param, |
| 6600 | .txrx_peer_set_nawds = dp_peer_set_nawds, |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 6601 | .txrx_set_pdev_reo_dest = dp_set_pdev_reo_dest, |
| 6602 | .txrx_get_pdev_reo_dest = dp_get_pdev_reo_dest, |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 6603 | .txrx_set_filter_neighbour_peers = dp_set_filter_neighbour_peers, |
| 6604 | .txrx_update_filter_neighbour_peers = |
| 6605 | dp_update_filter_neighbour_peers, |
Chaitanya Kiran Godavarthi | 6228e3b | 2017-06-15 14:28:19 +0530 | [diff] [blame] | 6606 | .txrx_get_sec_type = dp_get_sec_type, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6607 | /* TODO: Add other functions */ |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 6608 | .txrx_wdi_event_sub = dp_wdi_event_sub, |
| 6609 | .txrx_wdi_event_unsub = dp_wdi_event_unsub, |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 6610 | #ifdef WDI_EVENT_ENABLE |
| 6611 | .txrx_get_pldev = dp_get_pldev, |
| 6612 | #endif |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6613 | .txrx_set_pdev_param = dp_set_pdev_param, |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 6614 | #ifdef ATH_SUPPORT_NAC_RSSI |
| 6615 | .txrx_vdev_config_for_nac_rssi = dp_config_for_nac_rssi, |
| 6616 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6617 | }; |
| 6618 | |
| 6619 | static struct cdp_me_ops dp_ops_me = { |
Ishank Jain | c838b13 | 2017-02-17 11:08:18 +0530 | [diff] [blame] | 6620 | #ifdef ATH_SUPPORT_IQUE |
| 6621 | .tx_me_alloc_descriptor = dp_tx_me_alloc_descriptor, |
| 6622 | .tx_me_free_descriptor = dp_tx_me_free_descriptor, |
| 6623 | .tx_me_convert_ucast = dp_tx_me_send_convert_ucast, |
| 6624 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6625 | }; |
| 6626 | |
| 6627 | static struct cdp_mon_ops dp_ops_mon = { |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 6628 | .txrx_monitor_set_filter_ucast_data = NULL, |
| 6629 | .txrx_monitor_set_filter_mcast_data = NULL, |
| 6630 | .txrx_monitor_set_filter_non_data = NULL, |
nobelj | c8eb4d6 | 2018-01-04 14:29:32 -0800 | [diff] [blame] | 6631 | .txrx_monitor_get_filter_ucast_data = dp_vdev_get_filter_ucast_data, |
| 6632 | .txrx_monitor_get_filter_mcast_data = dp_vdev_get_filter_mcast_data, |
| 6633 | .txrx_monitor_get_filter_non_data = dp_vdev_get_filter_non_data, |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 6634 | .txrx_reset_monitor_mode = dp_reset_monitor_mode, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 6635 | /* Added support for HK advance filter */ |
| 6636 | .txrx_set_advance_monitor_filter = dp_pdev_set_advance_monitor_filter, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6637 | }; |
| 6638 | |
| 6639 | static struct cdp_host_stats_ops dp_ops_host_stats = { |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6640 | .txrx_per_peer_stats = dp_get_host_peer_stats, |
| 6641 | .get_fw_peer_stats = dp_get_fw_peer_stats, |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 6642 | .get_htt_stats = dp_get_htt_stats, |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 6643 | .txrx_enable_enhanced_stats = dp_enable_enhanced_stats, |
| 6644 | .txrx_disable_enhanced_stats = dp_disable_enhanced_stats, |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 6645 | .txrx_stats_publish = dp_txrx_stats_publish, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6646 | /* TODO */ |
| 6647 | }; |
| 6648 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6649 | static struct cdp_raw_ops dp_ops_raw = { |
| 6650 | /* TODO */ |
| 6651 | }; |
| 6652 | |
| 6653 | #ifdef CONFIG_WIN |
| 6654 | static struct cdp_pflow_ops dp_ops_pflow = { |
| 6655 | /* TODO */ |
| 6656 | }; |
| 6657 | #endif /* CONFIG_WIN */ |
| 6658 | |
Yue Ma | 245b47b | 2017-02-21 16:35:31 -0800 | [diff] [blame] | 6659 | #ifdef FEATURE_RUNTIME_PM |
| 6660 | /** |
| 6661 | * dp_runtime_suspend() - ensure DP is ready to runtime suspend |
| 6662 | * @opaque_pdev: DP pdev context |
| 6663 | * |
| 6664 | * DP is ready to runtime suspend if there are no pending TX packets. |
| 6665 | * |
| 6666 | * Return: QDF_STATUS |
| 6667 | */ |
| 6668 | static QDF_STATUS dp_runtime_suspend(struct cdp_pdev *opaque_pdev) |
| 6669 | { |
| 6670 | struct dp_pdev *pdev = (struct dp_pdev *)opaque_pdev; |
| 6671 | struct dp_soc *soc = pdev->soc; |
| 6672 | |
| 6673 | /* Call DP TX flow control API to check if there is any |
| 6674 | pending packets */ |
| 6675 | |
| 6676 | if (soc->intr_mode == DP_INTR_POLL) |
| 6677 | qdf_timer_stop(&soc->int_timer); |
| 6678 | |
| 6679 | return QDF_STATUS_SUCCESS; |
| 6680 | } |
| 6681 | |
| 6682 | /** |
| 6683 | * dp_runtime_resume() - ensure DP is ready to runtime resume |
| 6684 | * @opaque_pdev: DP pdev context |
| 6685 | * |
| 6686 | * Resume DP for runtime PM. |
| 6687 | * |
| 6688 | * Return: QDF_STATUS |
| 6689 | */ |
| 6690 | static QDF_STATUS dp_runtime_resume(struct cdp_pdev *opaque_pdev) |
| 6691 | { |
| 6692 | struct dp_pdev *pdev = (struct dp_pdev *)opaque_pdev; |
| 6693 | struct dp_soc *soc = pdev->soc; |
| 6694 | void *hal_srng; |
| 6695 | int i; |
| 6696 | |
| 6697 | if (soc->intr_mode == DP_INTR_POLL) |
| 6698 | qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); |
| 6699 | |
| 6700 | for (i = 0; i < MAX_TCL_DATA_RINGS; i++) { |
| 6701 | hal_srng = soc->tcl_data_ring[i].hal_srng; |
| 6702 | if (hal_srng) { |
| 6703 | /* We actually only need to acquire the lock */ |
| 6704 | hal_srng_access_start(soc->hal_soc, hal_srng); |
| 6705 | /* Update SRC ring head pointer for HW to send |
| 6706 | all pending packets */ |
| 6707 | hal_srng_access_end(soc->hal_soc, hal_srng); |
| 6708 | } |
| 6709 | } |
| 6710 | |
| 6711 | return QDF_STATUS_SUCCESS; |
| 6712 | } |
| 6713 | #endif /* FEATURE_RUNTIME_PM */ |
| 6714 | |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 6715 | static QDF_STATUS dp_bus_suspend(struct cdp_pdev *opaque_pdev) |
| 6716 | { |
| 6717 | struct dp_pdev *pdev = (struct dp_pdev *)opaque_pdev; |
| 6718 | struct dp_soc *soc = pdev->soc; |
| 6719 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 6720 | if (soc->intr_mode == DP_INTR_POLL) |
| 6721 | qdf_timer_stop(&soc->int_timer); |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 6722 | |
| 6723 | return QDF_STATUS_SUCCESS; |
| 6724 | } |
| 6725 | |
| 6726 | static QDF_STATUS dp_bus_resume(struct cdp_pdev *opaque_pdev) |
| 6727 | { |
| 6728 | struct dp_pdev *pdev = (struct dp_pdev *)opaque_pdev; |
| 6729 | struct dp_soc *soc = pdev->soc; |
| 6730 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 6731 | if (soc->intr_mode == DP_INTR_POLL) |
| 6732 | qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 6733 | |
| 6734 | return QDF_STATUS_SUCCESS; |
| 6735 | } |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 6736 | |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 6737 | #ifndef CONFIG_WIN |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6738 | static struct cdp_misc_ops dp_ops_misc = { |
Kabilan Kannan | 60e3b30 | 2017-09-07 20:06:17 -0700 | [diff] [blame] | 6739 | .tx_non_std = dp_tx_non_std, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6740 | .get_opmode = dp_get_opmode, |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 6741 | #ifdef FEATURE_RUNTIME_PM |
Yue Ma | 245b47b | 2017-02-21 16:35:31 -0800 | [diff] [blame] | 6742 | .runtime_suspend = dp_runtime_suspend, |
| 6743 | .runtime_resume = dp_runtime_resume, |
| 6744 | #endif /* FEATURE_RUNTIME_PM */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 6745 | .pkt_log_init = dp_pkt_log_init, |
| 6746 | .pkt_log_con_service = dp_pkt_log_con_service, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6747 | }; |
| 6748 | |
| 6749 | static struct cdp_flowctl_ops dp_ops_flowctl = { |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 6750 | /* WIFI 3.0 DP implement as required. */ |
| 6751 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
| 6752 | .register_pause_cb = dp_txrx_register_pause_cb, |
| 6753 | .dump_flow_pool_info = dp_tx_dump_flow_pool_info, |
| 6754 | #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6755 | }; |
| 6756 | |
| 6757 | static struct cdp_lflowctl_ops dp_ops_l_flowctl = { |
| 6758 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
| 6759 | }; |
| 6760 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 6761 | #ifdef IPA_OFFLOAD |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6762 | static struct cdp_ipa_ops dp_ops_ipa = { |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 6763 | .ipa_get_resource = dp_ipa_get_resource, |
| 6764 | .ipa_set_doorbell_paddr = dp_ipa_set_doorbell_paddr, |
| 6765 | .ipa_op_response = dp_ipa_op_response, |
| 6766 | .ipa_register_op_cb = dp_ipa_register_op_cb, |
| 6767 | .ipa_get_stat = dp_ipa_get_stat, |
| 6768 | .ipa_tx_data_frame = dp_tx_send_ipa_data_frame, |
| 6769 | .ipa_enable_autonomy = dp_ipa_enable_autonomy, |
| 6770 | .ipa_disable_autonomy = dp_ipa_disable_autonomy, |
| 6771 | .ipa_setup = dp_ipa_setup, |
| 6772 | .ipa_cleanup = dp_ipa_cleanup, |
| 6773 | .ipa_setup_iface = dp_ipa_setup_iface, |
| 6774 | .ipa_cleanup_iface = dp_ipa_cleanup_iface, |
| 6775 | .ipa_enable_pipes = dp_ipa_enable_pipes, |
| 6776 | .ipa_disable_pipes = dp_ipa_disable_pipes, |
| 6777 | .ipa_set_perf_level = dp_ipa_set_perf_level |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6778 | }; |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 6779 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6780 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6781 | static struct cdp_bus_ops dp_ops_bus = { |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 6782 | .bus_suspend = dp_bus_suspend, |
| 6783 | .bus_resume = dp_bus_resume |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6784 | }; |
| 6785 | |
| 6786 | static struct cdp_ocb_ops dp_ops_ocb = { |
| 6787 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
| 6788 | }; |
| 6789 | |
| 6790 | |
| 6791 | static struct cdp_throttle_ops dp_ops_throttle = { |
| 6792 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
| 6793 | }; |
| 6794 | |
| 6795 | static struct cdp_mob_stats_ops dp_ops_mob_stats = { |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6796 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6797 | }; |
| 6798 | |
| 6799 | static struct cdp_cfg_ops dp_ops_cfg = { |
| 6800 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
| 6801 | }; |
| 6802 | |
Mohit Khanna | adfe908 | 2017-11-17 13:11:17 -0800 | [diff] [blame] | 6803 | /* |
| 6804 | * dp_wrapper_peer_get_ref_by_addr - wrapper function to get to peer |
| 6805 | * @dev: physical device instance |
| 6806 | * @peer_mac_addr: peer mac address |
| 6807 | * @local_id: local id for the peer |
| 6808 | * @debug_id: to track enum peer access |
| 6809 | |
| 6810 | * Return: peer instance pointer |
| 6811 | */ |
| 6812 | static inline void * |
| 6813 | dp_wrapper_peer_get_ref_by_addr(struct cdp_pdev *dev, u8 *peer_mac_addr, |
| 6814 | u8 *local_id, |
| 6815 | enum peer_debug_id_type debug_id) |
| 6816 | { |
| 6817 | /* |
| 6818 | * Currently this function does not implement the "get ref" |
| 6819 | * functionality and is mapped to dp_find_peer_by_addr which does not |
| 6820 | * increment the peer ref count. So the peer state is uncertain after |
| 6821 | * calling this API. The functionality needs to be implemented. |
| 6822 | * Accordingly the corresponding release_ref function is NULL. |
| 6823 | */ |
| 6824 | return dp_find_peer_by_addr(dev, peer_mac_addr, local_id); |
| 6825 | } |
| 6826 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6827 | static struct cdp_peer_ops dp_ops_peer = { |
| 6828 | .register_peer = dp_register_peer, |
| 6829 | .clear_peer = dp_clear_peer, |
| 6830 | .find_peer_by_addr = dp_find_peer_by_addr, |
| 6831 | .find_peer_by_addr_and_vdev = dp_find_peer_by_addr_and_vdev, |
Mohit Khanna | adfe908 | 2017-11-17 13:11:17 -0800 | [diff] [blame] | 6832 | .peer_get_ref_by_addr = dp_wrapper_peer_get_ref_by_addr, |
| 6833 | .peer_release_ref = NULL, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6834 | .local_peer_id = dp_local_peer_id, |
| 6835 | .peer_find_by_local_id = dp_peer_find_by_local_id, |
| 6836 | .peer_state_update = dp_peer_state_update, |
| 6837 | .get_vdevid = dp_get_vdevid, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 6838 | .get_vdev_by_sta_id = dp_get_vdev_by_sta_id, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6839 | .peer_get_peer_mac_addr = dp_peer_get_peer_mac_addr, |
| 6840 | .get_vdev_for_peer = dp_get_vdev_for_peer, |
| 6841 | .get_peer_state = dp_get_peer_state, |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 6842 | .last_assoc_received = dp_get_last_assoc_received, |
| 6843 | .last_disassoc_received = dp_get_last_disassoc_received, |
| 6844 | .last_deauth_received = dp_get_last_deauth_received, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6845 | }; |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 6846 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6847 | |
| 6848 | static struct cdp_ops dp_txrx_ops = { |
| 6849 | .cmn_drv_ops = &dp_ops_cmn, |
| 6850 | .ctrl_ops = &dp_ops_ctrl, |
| 6851 | .me_ops = &dp_ops_me, |
| 6852 | .mon_ops = &dp_ops_mon, |
| 6853 | .host_stats_ops = &dp_ops_host_stats, |
| 6854 | .wds_ops = &dp_ops_wds, |
| 6855 | .raw_ops = &dp_ops_raw, |
| 6856 | #ifdef CONFIG_WIN |
| 6857 | .pflow_ops = &dp_ops_pflow, |
| 6858 | #endif /* CONFIG_WIN */ |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 6859 | #ifndef CONFIG_WIN |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6860 | .misc_ops = &dp_ops_misc, |
| 6861 | .cfg_ops = &dp_ops_cfg, |
| 6862 | .flowctl_ops = &dp_ops_flowctl, |
| 6863 | .l_flowctl_ops = &dp_ops_l_flowctl, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 6864 | #ifdef IPA_OFFLOAD |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6865 | .ipa_ops = &dp_ops_ipa, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 6866 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6867 | .bus_ops = &dp_ops_bus, |
| 6868 | .ocb_ops = &dp_ops_ocb, |
| 6869 | .peer_ops = &dp_ops_peer, |
| 6870 | .throttle_ops = &dp_ops_throttle, |
| 6871 | .mob_stats_ops = &dp_ops_mob_stats, |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 6872 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6873 | }; |
| 6874 | |
| 6875 | /* |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 6876 | * dp_soc_set_txrx_ring_map() |
| 6877 | * @dp_soc: DP handler for soc |
| 6878 | * |
| 6879 | * Return: Void |
| 6880 | */ |
| 6881 | static void dp_soc_set_txrx_ring_map(struct dp_soc *soc) |
| 6882 | { |
| 6883 | uint32_t i; |
| 6884 | for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { |
| 6885 | soc->tx_ring_map[i] = dp_cpu_ring_map[DP_DEFAULT_MAP][i]; |
| 6886 | } |
| 6887 | } |
| 6888 | |
| 6889 | /* |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6890 | * dp_soc_attach_wifi3() - Attach txrx SOC |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 6891 | * @ctrl_psoc: Opaque SOC handle from control plane |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6892 | * @htc_handle: Opaque HTC handle |
| 6893 | * @hif_handle: Opaque HIF handle |
| 6894 | * @qdf_osdev: QDF device |
| 6895 | * |
| 6896 | * Return: DP SOC handle on success, NULL on failure |
| 6897 | */ |
Jeff Johnson | 0771857 | 2017-01-10 13:57:15 -0800 | [diff] [blame] | 6898 | /* |
| 6899 | * Local prototype added to temporarily address warning caused by |
| 6900 | * -Wmissing-prototypes. A more correct solution, namely to expose |
| 6901 | * a prototype in an appropriate header file, will come later. |
| 6902 | */ |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 6903 | void *dp_soc_attach_wifi3(void *ctrl_psoc, void *hif_handle, |
Jeff Johnson | 0771857 | 2017-01-10 13:57:15 -0800 | [diff] [blame] | 6904 | HTC_HANDLE htc_handle, qdf_device_t qdf_osdev, |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 6905 | struct ol_if_ops *ol_ops); |
| 6906 | void *dp_soc_attach_wifi3(void *ctrl_psoc, void *hif_handle, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6907 | HTC_HANDLE htc_handle, qdf_device_t qdf_osdev, |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 6908 | struct ol_if_ops *ol_ops) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6909 | { |
| 6910 | struct dp_soc *soc = qdf_mem_malloc(sizeof(*soc)); |
| 6911 | |
| 6912 | if (!soc) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 6913 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6914 | FL("DP SOC memory allocation failed")); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6915 | goto fail0; |
| 6916 | } |
| 6917 | |
| 6918 | soc->cdp_soc.ops = &dp_txrx_ops; |
| 6919 | soc->cdp_soc.ol_ops = ol_ops; |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 6920 | soc->ctrl_psoc = ctrl_psoc; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6921 | soc->osdev = qdf_osdev; |
| 6922 | soc->hif_handle = hif_handle; |
| 6923 | |
| 6924 | soc->hal_soc = hif_get_hal_handle(hif_handle); |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 6925 | soc->htt_handle = htt_soc_attach(soc, ctrl_psoc, htc_handle, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6926 | soc->hal_soc, qdf_osdev); |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 6927 | if (!soc->htt_handle) { |
| 6928 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6929 | FL("HTT attach failed")); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6930 | goto fail1; |
| 6931 | } |
| 6932 | |
| 6933 | soc->wlan_cfg_ctx = wlan_cfg_soc_attach(); |
| 6934 | if (!soc->wlan_cfg_ctx) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 6935 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6936 | FL("wlan_cfg_soc_attach failed")); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6937 | goto fail2; |
| 6938 | } |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 6939 | |
Tallapragada Kalyan | 4c183b8 | 2017-09-13 23:48:14 +0530 | [diff] [blame] | 6940 | wlan_cfg_set_rx_hash(soc->wlan_cfg_ctx, rx_hash); |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 6941 | soc->cce_disable = false; |
Tallapragada Kalyan | 4c183b8 | 2017-09-13 23:48:14 +0530 | [diff] [blame] | 6942 | |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 6943 | if (soc->cdp_soc.ol_ops->get_dp_cfg_param) { |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 6944 | int ret = soc->cdp_soc.ol_ops->get_dp_cfg_param(soc->ctrl_psoc, |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 6945 | CDP_CFG_MAX_PEER_ID); |
| 6946 | |
| 6947 | if (ret != -EINVAL) { |
| 6948 | wlan_cfg_set_max_peer_id(soc->wlan_cfg_ctx, ret); |
| 6949 | } |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 6950 | |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 6951 | ret = soc->cdp_soc.ol_ops->get_dp_cfg_param(soc->ctrl_psoc, |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 6952 | CDP_CFG_CCE_DISABLE); |
Ruchi, Agrawal | f279a4a | 2018-02-26 18:12:44 +0530 | [diff] [blame] | 6953 | if (ret == 1) |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 6954 | soc->cce_disable = true; |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 6955 | } |
| 6956 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6957 | qdf_spinlock_create(&soc->peer_ref_mutex); |
| 6958 | |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 6959 | qdf_spinlock_create(&soc->reo_desc_freelist_lock); |
| 6960 | qdf_list_create(&soc->reo_desc_freelist, REO_DESC_FREELIST_SIZE); |
| 6961 | |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 6962 | /* fill the tx/rx cpu ring map*/ |
| 6963 | dp_soc_set_txrx_ring_map(soc); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 6964 | |
| 6965 | qdf_spinlock_create(&soc->htt_stats.lock); |
| 6966 | /* initialize work queue for stats processing */ |
| 6967 | qdf_create_work(0, &soc->htt_stats.work, htt_t2h_stats_handler, soc); |
| 6968 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 6969 | /*Initialize inactivity timer for wifison */ |
| 6970 | dp_init_inact_timer(soc); |
| 6971 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 6972 | return (void *)soc; |
| 6973 | |
| 6974 | fail2: |
| 6975 | htt_soc_detach(soc->htt_handle); |
| 6976 | fail1: |
| 6977 | qdf_mem_free(soc); |
| 6978 | fail0: |
| 6979 | return NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 6980 | } |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 6981 | |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 6982 | /* |
| 6983 | * dp_get_pdev_for_mac_id() - Return pdev for mac_id |
| 6984 | * |
| 6985 | * @soc: handle to DP soc |
| 6986 | * @mac_id: MAC id |
| 6987 | * |
| 6988 | * Return: Return pdev corresponding to MAC |
| 6989 | */ |
| 6990 | void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id) |
| 6991 | { |
| 6992 | if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) |
| 6993 | return soc->pdev_list[mac_id]; |
| 6994 | |
| 6995 | /* Typically for MCL as there only 1 PDEV*/ |
| 6996 | return soc->pdev_list[0]; |
| 6997 | } |
| 6998 | |
| 6999 | /* |
| 7000 | * dp_get_ring_id_for_mac_id() - Return pdev for mac_id |
| 7001 | * |
| 7002 | * @soc: handle to DP soc |
| 7003 | * @mac_id: MAC id |
| 7004 | * |
| 7005 | * Return: ring id |
| 7006 | */ |
| 7007 | int dp_get_ring_id_for_mac_id(struct dp_soc *soc, uint32_t mac_id) |
| 7008 | { |
| 7009 | /* |
| 7010 | * Single pdev using both MACs will operate on both MAC rings, |
| 7011 | * which is the case for MCL. |
| 7012 | */ |
| 7013 | if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) |
| 7014 | return mac_id; |
| 7015 | |
| 7016 | /* For WIN each PDEV will operate one ring, so index is zero. */ |
| 7017 | return 0; |
| 7018 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7019 | |
| 7020 | /* |
| 7021 | * dp_is_hw_dbs_enable() - Procedure to check if DBS is supported |
| 7022 | * @soc: DP SoC context |
| 7023 | * @max_mac_rings: No of MAC rings |
| 7024 | * |
| 7025 | * Return: None |
| 7026 | */ |
| 7027 | static |
| 7028 | void dp_is_hw_dbs_enable(struct dp_soc *soc, |
| 7029 | int *max_mac_rings) |
| 7030 | { |
| 7031 | bool dbs_enable = false; |
| 7032 | if (soc->cdp_soc.ol_ops->is_hw_dbs_2x2_capable) |
| 7033 | dbs_enable = soc->cdp_soc.ol_ops-> |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7034 | is_hw_dbs_2x2_capable(soc->ctrl_psoc); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7035 | |
| 7036 | *max_mac_rings = (dbs_enable)?(*max_mac_rings):1; |
| 7037 | } |
| 7038 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7039 | /* |
| 7040 | * dp_set_pktlog_wifi3() - attach txrx vdev |
| 7041 | * @pdev: Datapath PDEV handle |
| 7042 | * @event: which event's notifications are being subscribed to |
| 7043 | * @enable: WDI event subscribe or not. (True or False) |
| 7044 | * |
| 7045 | * Return: Success, NULL on failure |
| 7046 | */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7047 | #ifdef WDI_EVENT_ENABLE |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7048 | int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, |
| 7049 | bool enable) |
| 7050 | { |
| 7051 | struct dp_soc *soc = pdev->soc; |
| 7052 | struct htt_rx_ring_tlv_filter htt_tlv_filter = {0}; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7053 | int max_mac_rings = wlan_cfg_get_num_mac_rings |
| 7054 | (pdev->wlan_cfg_ctx); |
| 7055 | uint8_t mac_id = 0; |
| 7056 | |
| 7057 | dp_is_hw_dbs_enable(soc, &max_mac_rings); |
| 7058 | |
| 7059 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, |
| 7060 | FL("Max_mac_rings %d \n"), |
| 7061 | max_mac_rings); |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7062 | |
| 7063 | if (enable) { |
| 7064 | switch (event) { |
| 7065 | case WDI_EVENT_RX_DESC: |
| 7066 | if (pdev->monitor_vdev) { |
| 7067 | /* Nothing needs to be done if monitor mode is |
| 7068 | * enabled |
| 7069 | */ |
| 7070 | return 0; |
| 7071 | } |
| 7072 | if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_FULL) { |
| 7073 | pdev->rx_pktlog_mode = DP_RX_PKTLOG_FULL; |
| 7074 | htt_tlv_filter.mpdu_start = 1; |
| 7075 | htt_tlv_filter.msdu_start = 1; |
| 7076 | htt_tlv_filter.msdu_end = 1; |
| 7077 | htt_tlv_filter.mpdu_end = 1; |
| 7078 | htt_tlv_filter.packet_header = 1; |
| 7079 | htt_tlv_filter.attention = 1; |
| 7080 | htt_tlv_filter.ppdu_start = 1; |
| 7081 | htt_tlv_filter.ppdu_end = 1; |
| 7082 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 7083 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 7084 | htt_tlv_filter.ppdu_end_status_done = 1; |
| 7085 | htt_tlv_filter.enable_fp = 1; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 7086 | htt_tlv_filter.fp_mgmt_filter = FILTER_MGMT_ALL; |
| 7087 | htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_ALL; |
| 7088 | htt_tlv_filter.fp_data_filter = FILTER_DATA_ALL; |
| 7089 | htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL; |
| 7090 | htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; |
| 7091 | htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7092 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7093 | for (mac_id = 0; mac_id < max_mac_rings; |
| 7094 | mac_id++) { |
| 7095 | htt_h2t_rx_ring_cfg(soc->htt_handle, |
| 7096 | pdev->pdev_id + mac_id, |
| 7097 | pdev->rxdma_mon_status_ring |
| 7098 | .hal_srng, |
| 7099 | RXDMA_MONITOR_STATUS, |
| 7100 | RX_BUFFER_SIZE, |
| 7101 | &htt_tlv_filter); |
| 7102 | |
| 7103 | } |
| 7104 | |
| 7105 | if (soc->reap_timer_init) |
| 7106 | qdf_timer_mod(&soc->mon_reap_timer, |
| 7107 | DP_INTR_POLL_TIMER_MS); |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7108 | } |
| 7109 | break; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7110 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7111 | case WDI_EVENT_LITE_RX: |
| 7112 | if (pdev->monitor_vdev) { |
| 7113 | /* Nothing needs to be done if monitor mode is |
| 7114 | * enabled |
| 7115 | */ |
| 7116 | return 0; |
| 7117 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7118 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7119 | if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_LITE) { |
| 7120 | pdev->rx_pktlog_mode = DP_RX_PKTLOG_LITE; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7121 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7122 | htt_tlv_filter.ppdu_start = 1; |
| 7123 | htt_tlv_filter.ppdu_end = 1; |
| 7124 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 7125 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 7126 | htt_tlv_filter.ppdu_end_status_done = 1; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7127 | htt_tlv_filter.mpdu_start = 1; |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7128 | htt_tlv_filter.enable_fp = 1; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 7129 | htt_tlv_filter.fp_mgmt_filter = FILTER_MGMT_ALL; |
| 7130 | htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_ALL; |
| 7131 | htt_tlv_filter.fp_data_filter = FILTER_DATA_ALL; |
| 7132 | htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL; |
| 7133 | htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; |
| 7134 | htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7135 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7136 | for (mac_id = 0; mac_id < max_mac_rings; |
| 7137 | mac_id++) { |
| 7138 | htt_h2t_rx_ring_cfg(soc->htt_handle, |
| 7139 | pdev->pdev_id + mac_id, |
| 7140 | pdev->rxdma_mon_status_ring |
| 7141 | .hal_srng, |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7142 | RXDMA_MONITOR_STATUS, |
| 7143 | RX_BUFFER_SIZE_PKTLOG_LITE, |
| 7144 | &htt_tlv_filter); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7145 | } |
| 7146 | |
| 7147 | if (soc->reap_timer_init) |
| 7148 | qdf_timer_mod(&soc->mon_reap_timer, |
| 7149 | DP_INTR_POLL_TIMER_MS); |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7150 | } |
| 7151 | break; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7152 | |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7153 | case WDI_EVENT_LITE_T2H: |
| 7154 | if (pdev->monitor_vdev) { |
| 7155 | /* Nothing needs to be done if monitor mode is |
| 7156 | * enabled |
| 7157 | */ |
| 7158 | return 0; |
| 7159 | } |
| 7160 | /* To enable HTT_H2T_MSG_TYPE_PPDU_STATS_CFG in FW |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7161 | * passing value 0xffff. Once these macros will define |
| 7162 | * in htt header file will use proper macros |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7163 | */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7164 | for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 7165 | pdev->pktlog_ppdu_stats = true; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7166 | dp_h2t_cfg_stats_msg_send(pdev, 0xffff, |
| 7167 | pdev->pdev_id + mac_id); |
| 7168 | } |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7169 | break; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7170 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7171 | default: |
| 7172 | /* Nothing needs to be done for other pktlog types */ |
| 7173 | break; |
| 7174 | } |
| 7175 | } else { |
| 7176 | switch (event) { |
| 7177 | case WDI_EVENT_RX_DESC: |
| 7178 | case WDI_EVENT_LITE_RX: |
| 7179 | if (pdev->monitor_vdev) { |
| 7180 | /* Nothing needs to be done if monitor mode is |
| 7181 | * enabled |
| 7182 | */ |
| 7183 | return 0; |
| 7184 | } |
| 7185 | if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) { |
| 7186 | pdev->rx_pktlog_mode = DP_RX_PKTLOG_DISABLED; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7187 | |
| 7188 | for (mac_id = 0; mac_id < max_mac_rings; |
| 7189 | mac_id++) { |
| 7190 | htt_h2t_rx_ring_cfg(soc->htt_handle, |
| 7191 | pdev->pdev_id + mac_id, |
| 7192 | pdev->rxdma_mon_status_ring |
| 7193 | .hal_srng, |
| 7194 | RXDMA_MONITOR_STATUS, |
| 7195 | RX_BUFFER_SIZE, |
| 7196 | &htt_tlv_filter); |
| 7197 | } |
| 7198 | |
| 7199 | if (soc->reap_timer_init) |
| 7200 | qdf_timer_stop(&soc->mon_reap_timer); |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7201 | } |
| 7202 | break; |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7203 | case WDI_EVENT_LITE_T2H: |
| 7204 | if (pdev->monitor_vdev) { |
| 7205 | /* Nothing needs to be done if monitor mode is |
| 7206 | * enabled |
| 7207 | */ |
| 7208 | return 0; |
| 7209 | } |
| 7210 | /* To disable HTT_H2T_MSG_TYPE_PPDU_STATS_CFG in FW |
| 7211 | * passing value 0. Once these macros will define in htt |
| 7212 | * header file will use proper macros |
| 7213 | */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7214 | for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 7215 | pdev->pktlog_ppdu_stats = false; |
| 7216 | if (!pdev->enhanced_stats_en && !pdev->tx_sniffer_enable && !pdev->mcopy_mode) { |
| 7217 | dp_h2t_cfg_stats_msg_send(pdev, 0, |
| 7218 | pdev->pdev_id + mac_id); |
| 7219 | } else if (pdev->tx_sniffer_enable || pdev->mcopy_mode) { |
| 7220 | dp_h2t_cfg_stats_msg_send(pdev, DP_PPDU_STATS_CFG_SNIFFER, |
| 7221 | pdev->pdev_id + mac_id); |
| 7222 | } else if (pdev->enhanced_stats_en) { |
| 7223 | dp_h2t_cfg_stats_msg_send(pdev, DP_PPDU_STATS_CFG_ENH_STATS, |
| 7224 | pdev->pdev_id + mac_id); |
| 7225 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7226 | } |
| 7227 | |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7228 | break; |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7229 | default: |
| 7230 | /* Nothing needs to be done for other pktlog types */ |
| 7231 | break; |
| 7232 | } |
| 7233 | } |
| 7234 | return 0; |
| 7235 | } |
| 7236 | #endif |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7237 | |
| 7238 | #ifdef CONFIG_MCL |
| 7239 | /* |
| 7240 | * dp_service_mon_rings()- timer to reap monitor rings |
| 7241 | * reqd as we are not getting ppdu end interrupts |
| 7242 | * @arg: SoC Handle |
| 7243 | * |
| 7244 | * Return: |
| 7245 | * |
| 7246 | */ |
| 7247 | static void dp_service_mon_rings(void *arg) |
| 7248 | { |
| 7249 | struct dp_soc *soc = (struct dp_soc *) arg; |
| 7250 | int ring = 0, work_done; |
| 7251 | |
| 7252 | work_done = dp_mon_process(soc, ring, QCA_NAPI_BUDGET); |
| 7253 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 7254 | FL("Reaped %d descs from Monitor rings"), work_done); |
| 7255 | |
| 7256 | qdf_timer_mod(&soc->mon_reap_timer, DP_INTR_POLL_TIMER_MS); |
| 7257 | } |
| 7258 | |
| 7259 | #ifndef REMOVE_PKT_LOG |
| 7260 | /** |
| 7261 | * dp_pkt_log_init() - API to initialize packet log |
| 7262 | * @ppdev: physical device handle |
| 7263 | * @scn: HIF context |
| 7264 | * |
| 7265 | * Return: none |
| 7266 | */ |
| 7267 | void dp_pkt_log_init(struct cdp_pdev *ppdev, void *scn) |
| 7268 | { |
| 7269 | struct dp_pdev *handle = (struct dp_pdev *)ppdev; |
| 7270 | |
| 7271 | if (handle->pkt_log_init) { |
| 7272 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7273 | "%s: Packet log not initialized", __func__); |
| 7274 | return; |
| 7275 | } |
| 7276 | |
| 7277 | pktlog_sethandle(&handle->pl_dev, scn); |
| 7278 | pktlog_set_callback_regtype(PKTLOG_LITE_CALLBACK_REGISTRATION); |
| 7279 | |
| 7280 | if (pktlogmod_init(scn)) { |
| 7281 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7282 | "%s: pktlogmod_init failed", __func__); |
| 7283 | handle->pkt_log_init = false; |
| 7284 | } else { |
| 7285 | handle->pkt_log_init = true; |
| 7286 | } |
| 7287 | } |
| 7288 | |
| 7289 | /** |
| 7290 | * dp_pkt_log_con_service() - connect packet log service |
| 7291 | * @ppdev: physical device handle |
| 7292 | * @scn: device context |
| 7293 | * |
| 7294 | * Return: none |
| 7295 | */ |
| 7296 | static void dp_pkt_log_con_service(struct cdp_pdev *ppdev, void *scn) |
| 7297 | { |
| 7298 | struct dp_pdev *pdev = (struct dp_pdev *)ppdev; |
| 7299 | |
| 7300 | dp_pkt_log_init((struct cdp_pdev *)pdev, scn); |
| 7301 | pktlog_htc_attach(); |
| 7302 | } |
| 7303 | |
| 7304 | /** |
| 7305 | * dp_pktlogmod_exit() - API to cleanup pktlog info |
| 7306 | * @handle: Pdev handle |
| 7307 | * |
| 7308 | * Return: none |
| 7309 | */ |
| 7310 | static void dp_pktlogmod_exit(struct dp_pdev *handle) |
| 7311 | { |
| 7312 | void *scn = (void *)handle->soc->hif_handle; |
| 7313 | |
| 7314 | if (!scn) { |
| 7315 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7316 | "%s: Invalid hif(scn) handle", __func__); |
| 7317 | return; |
| 7318 | } |
| 7319 | |
| 7320 | pktlogmod_exit(scn); |
| 7321 | handle->pkt_log_init = false; |
| 7322 | } |
| 7323 | #endif |
| 7324 | #else |
| 7325 | static void dp_pktlogmod_exit(struct dp_pdev *handle) { } |
| 7326 | #endif |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 7327 | |