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, |
Pramod Simha | 6e10cb2 | 2018-06-20 12:05:44 -0700 | [diff] [blame] | 65 | uint8_t *peer_mac_addr, void *ol_peer); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 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 |
Vinay Adella | 873dc40 | 2018-05-28 12:06:34 +0530 | [diff] [blame] | 99 | /* PPDU stats mask sent to FW to support BPR feature*/ |
| 100 | #define DP_PPDU_STATS_CFG_BPR 0x2000 |
| 101 | /* PPDU stats mask sent to FW to support BPR and enhanced stats feature */ |
| 102 | #define DP_PPDU_STATS_CFG_BPR_ENH (DP_PPDU_STATS_CFG_BPR | \ |
| 103 | DP_PPDU_STATS_CFG_ENH_STATS) |
| 104 | /* PPDU stats mask sent to FW to support BPR and pcktlog stats feature */ |
| 105 | #define DP_PPDU_STATS_CFG_BPR_PKTLOG (DP_PPDU_STATS_CFG_BPR | \ |
| 106 | DP_PPDU_TXLITE_STATS_BITMASK_CFG) |
| 107 | |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 108 | /** |
| 109 | * default_dscp_tid_map - Default DSCP-TID mapping |
| 110 | * |
Pamidipati, Vijay | ef2cbc6 | 2017-09-27 23:09:06 +0530 | [diff] [blame] | 111 | * DSCP TID |
| 112 | * 000000 0 |
| 113 | * 001000 1 |
| 114 | * 010000 2 |
| 115 | * 011000 3 |
| 116 | * 100000 4 |
| 117 | * 101000 5 |
| 118 | * 110000 6 |
| 119 | * 111000 7 |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 120 | */ |
| 121 | static uint8_t default_dscp_tid_map[DSCP_TID_MAP_MAX] = { |
| 122 | 0, 0, 0, 0, 0, 0, 0, 0, |
| 123 | 1, 1, 1, 1, 1, 1, 1, 1, |
Pamidipati, Vijay | ef2cbc6 | 2017-09-27 23:09:06 +0530 | [diff] [blame] | 124 | 2, 2, 2, 2, 2, 2, 2, 2, |
| 125 | 3, 3, 3, 3, 3, 3, 3, 3, |
| 126 | 4, 4, 4, 4, 4, 4, 4, 4, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 127 | 5, 5, 5, 5, 5, 5, 5, 5, |
| 128 | 6, 6, 6, 6, 6, 6, 6, 6, |
Pamidipati, Vijay | ef2cbc6 | 2017-09-27 23:09:06 +0530 | [diff] [blame] | 129 | 7, 7, 7, 7, 7, 7, 7, 7, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 130 | }; |
| 131 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 132 | /* |
| 133 | * struct dp_rate_debug |
| 134 | * |
| 135 | * @mcs_type: print string for a given mcs |
| 136 | * @valid: valid mcs rate? |
| 137 | */ |
| 138 | struct dp_rate_debug { |
| 139 | char mcs_type[DP_MAX_MCS_STRING_LEN]; |
| 140 | uint8_t valid; |
| 141 | }; |
| 142 | |
| 143 | #define MCS_VALID 1 |
| 144 | #define MCS_INVALID 0 |
| 145 | |
| 146 | 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] | 147 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 148 | { |
| 149 | {"OFDM 48 Mbps", MCS_VALID}, |
| 150 | {"OFDM 24 Mbps", MCS_VALID}, |
| 151 | {"OFDM 12 Mbps", MCS_VALID}, |
| 152 | {"OFDM 6 Mbps ", MCS_VALID}, |
| 153 | {"OFDM 54 Mbps", MCS_VALID}, |
| 154 | {"OFDM 36 Mbps", MCS_VALID}, |
| 155 | {"OFDM 18 Mbps", MCS_VALID}, |
| 156 | {"OFDM 9 Mbps ", MCS_VALID}, |
| 157 | {"INVALID ", MCS_INVALID}, |
| 158 | {"INVALID ", MCS_INVALID}, |
| 159 | {"INVALID ", MCS_INVALID}, |
| 160 | {"INVALID ", MCS_INVALID}, |
| 161 | {"INVALID ", MCS_VALID}, |
| 162 | }, |
| 163 | { |
Anish Nataraj | 072d897 | 2018-01-09 18:23:33 +0530 | [diff] [blame] | 164 | {"CCK 11 Mbps Long ", MCS_VALID}, |
| 165 | {"CCK 5.5 Mbps Long ", MCS_VALID}, |
| 166 | {"CCK 2 Mbps Long ", MCS_VALID}, |
| 167 | {"CCK 1 Mbps Long ", MCS_VALID}, |
| 168 | {"CCK 11 Mbps Short ", MCS_VALID}, |
| 169 | {"CCK 5.5 Mbps Short", MCS_VALID}, |
| 170 | {"CCK 2 Mbps Short ", MCS_VALID}, |
| 171 | {"INVALID ", MCS_INVALID}, |
| 172 | {"INVALID ", MCS_INVALID}, |
| 173 | {"INVALID ", MCS_INVALID}, |
| 174 | {"INVALID ", MCS_INVALID}, |
| 175 | {"INVALID ", MCS_INVALID}, |
| 176 | {"INVALID ", MCS_VALID}, |
| 177 | }, |
| 178 | { |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 179 | {"HT MCS 0 (BPSK 1/2) ", MCS_VALID}, |
| 180 | {"HT MCS 1 (QPSK 1/2) ", MCS_VALID}, |
| 181 | {"HT MCS 2 (QPSK 3/4) ", MCS_VALID}, |
| 182 | {"HT MCS 3 (16-QAM 1/2)", MCS_VALID}, |
| 183 | {"HT MCS 4 (16-QAM 3/4)", MCS_VALID}, |
| 184 | {"HT MCS 5 (64-QAM 2/3)", MCS_VALID}, |
| 185 | {"HT MCS 6 (64-QAM 3/4)", MCS_VALID}, |
| 186 | {"HT MCS 7 (64-QAM 5/6)", MCS_VALID}, |
| 187 | {"INVALID ", MCS_INVALID}, |
| 188 | {"INVALID ", MCS_INVALID}, |
| 189 | {"INVALID ", MCS_INVALID}, |
| 190 | {"INVALID ", MCS_INVALID}, |
| 191 | {"INVALID ", MCS_VALID}, |
| 192 | }, |
| 193 | { |
| 194 | {"VHT MCS 0 (BPSK 1/2) ", MCS_VALID}, |
| 195 | {"VHT MCS 1 (QPSK 1/2) ", MCS_VALID}, |
| 196 | {"VHT MCS 2 (QPSK 3/4) ", MCS_VALID}, |
| 197 | {"VHT MCS 3 (16-QAM 1/2) ", MCS_VALID}, |
| 198 | {"VHT MCS 4 (16-QAM 3/4) ", MCS_VALID}, |
| 199 | {"VHT MCS 5 (64-QAM 2/3) ", MCS_VALID}, |
| 200 | {"VHT MCS 6 (64-QAM 3/4) ", MCS_VALID}, |
| 201 | {"VHT MCS 7 (64-QAM 5/6) ", MCS_VALID}, |
| 202 | {"VHT MCS 8 (256-QAM 3/4) ", MCS_VALID}, |
| 203 | {"VHT MCS 9 (256-QAM 5/6) ", MCS_VALID}, |
| 204 | {"VHT MCS 10 (1024-QAM 3/4)", MCS_VALID}, |
Pamidipati, Vijay | 57a435a | 2017-10-17 11:03:39 +0530 | [diff] [blame] | 205 | {"VHT MCS 11 (1024-QAM 5/6)", MCS_VALID}, |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 206 | {"INVALID ", MCS_VALID}, |
| 207 | }, |
| 208 | { |
| 209 | {"HE MCS 0 (BPSK 1/2) ", MCS_VALID}, |
| 210 | {"HE MCS 1 (QPSK 1/2) ", MCS_VALID}, |
| 211 | {"HE MCS 2 (QPSK 3/4) ", MCS_VALID}, |
| 212 | {"HE MCS 3 (16-QAM 1/2) ", MCS_VALID}, |
| 213 | {"HE MCS 4 (16-QAM 3/4) ", MCS_VALID}, |
| 214 | {"HE MCS 5 (64-QAM 2/3) ", MCS_VALID}, |
| 215 | {"HE MCS 6 (64-QAM 3/4) ", MCS_VALID}, |
| 216 | {"HE MCS 7 (64-QAM 5/6) ", MCS_VALID}, |
| 217 | {"HE MCS 8 (256-QAM 3/4) ", MCS_VALID}, |
| 218 | {"HE MCS 9 (256-QAM 5/6) ", MCS_VALID}, |
| 219 | {"HE MCS 10 (1024-QAM 3/4)", MCS_VALID}, |
Pamidipati, Vijay | 57a435a | 2017-10-17 11:03:39 +0530 | [diff] [blame] | 220 | {"HE MCS 11 (1024-QAM 5/6)", MCS_VALID}, |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 221 | {"INVALID ", MCS_VALID}, |
| 222 | } |
| 223 | }; |
| 224 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 225 | /** |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 226 | * @brief Cpu ring map types |
| 227 | */ |
| 228 | enum dp_cpu_ring_map_types { |
| 229 | DP_DEFAULT_MAP, |
| 230 | DP_NSS_FIRST_RADIO_OFFLOADED_MAP, |
| 231 | DP_NSS_SECOND_RADIO_OFFLOADED_MAP, |
| 232 | DP_NSS_ALL_RADIO_OFFLOADED_MAP, |
| 233 | DP_CPU_RING_MAP_MAX |
| 234 | }; |
| 235 | |
| 236 | /** |
| 237 | * @brief Cpu to tx ring map |
| 238 | */ |
| 239 | static uint8_t dp_cpu_ring_map[DP_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS] = { |
| 240 | {0x0, 0x1, 0x2, 0x0}, |
| 241 | {0x1, 0x2, 0x1, 0x2}, |
| 242 | {0x0, 0x2, 0x0, 0x2}, |
| 243 | {0x2, 0x2, 0x2, 0x2} |
| 244 | }; |
| 245 | |
| 246 | /** |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 247 | * @brief Select the type of statistics |
| 248 | */ |
| 249 | enum dp_stats_type { |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 250 | STATS_FW = 0, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 251 | STATS_HOST = 1, |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 252 | STATS_TYPE_MAX = 2, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 253 | }; |
| 254 | |
| 255 | /** |
| 256 | * @brief General Firmware statistics options |
| 257 | * |
| 258 | */ |
| 259 | enum dp_fw_stats { |
| 260 | TXRX_FW_STATS_INVALID = -1, |
| 261 | }; |
| 262 | |
| 263 | /** |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 264 | * dp_stats_mapping_table - Firmware and Host statistics |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 265 | * currently supported |
| 266 | */ |
| 267 | const int dp_stats_mapping_table[][STATS_TYPE_MAX] = { |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 268 | {HTT_DBG_EXT_STATS_RESET, TXRX_HOST_STATS_INVALID}, |
| 269 | {HTT_DBG_EXT_STATS_PDEV_TX, TXRX_HOST_STATS_INVALID}, |
| 270 | {HTT_DBG_EXT_STATS_PDEV_RX, TXRX_HOST_STATS_INVALID}, |
| 271 | {HTT_DBG_EXT_STATS_PDEV_TX_HWQ, TXRX_HOST_STATS_INVALID}, |
| 272 | {HTT_DBG_EXT_STATS_PDEV_TX_SCHED, TXRX_HOST_STATS_INVALID}, |
| 273 | {HTT_DBG_EXT_STATS_PDEV_ERROR, TXRX_HOST_STATS_INVALID}, |
| 274 | {HTT_DBG_EXT_STATS_PDEV_TQM, TXRX_HOST_STATS_INVALID}, |
| 275 | {HTT_DBG_EXT_STATS_TQM_CMDQ, TXRX_HOST_STATS_INVALID}, |
| 276 | {HTT_DBG_EXT_STATS_TX_DE_INFO, TXRX_HOST_STATS_INVALID}, |
| 277 | {HTT_DBG_EXT_STATS_PDEV_TX_RATE, TXRX_HOST_STATS_INVALID}, |
| 278 | {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] | 279 | {TXRX_FW_STATS_INVALID, TXRX_HOST_STATS_INVALID}, |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 280 | {HTT_DBG_EXT_STATS_TX_SELFGEN_INFO, TXRX_HOST_STATS_INVALID}, |
| 281 | {HTT_DBG_EXT_STATS_TX_MU_HWQ, TXRX_HOST_STATS_INVALID}, |
| 282 | {HTT_DBG_EXT_STATS_RING_IF_INFO, TXRX_HOST_STATS_INVALID}, |
| 283 | {HTT_DBG_EXT_STATS_SRNG_INFO, TXRX_HOST_STATS_INVALID}, |
| 284 | {HTT_DBG_EXT_STATS_SFM_INFO, TXRX_HOST_STATS_INVALID}, |
| 285 | {HTT_DBG_EXT_STATS_PDEV_TX_MU, TXRX_HOST_STATS_INVALID}, |
| 286 | {HTT_DBG_EXT_STATS_ACTIVE_PEERS_LIST, TXRX_HOST_STATS_INVALID}, |
| 287 | /* Last ENUM for HTT FW STATS */ |
| 288 | {DP_HTT_DBG_EXT_STATS_MAX, TXRX_HOST_STATS_INVALID}, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 289 | {TXRX_FW_STATS_INVALID, TXRX_CLEAR_STATS}, |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 290 | {TXRX_FW_STATS_INVALID, TXRX_RX_RATE_STATS}, |
| 291 | {TXRX_FW_STATS_INVALID, TXRX_TX_RATE_STATS}, |
| 292 | {TXRX_FW_STATS_INVALID, TXRX_TX_HOST_STATS}, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 293 | {TXRX_FW_STATS_INVALID, TXRX_RX_HOST_STATS}, |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 294 | {TXRX_FW_STATS_INVALID, TXRX_AST_STATS}, |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 295 | {TXRX_FW_STATS_INVALID, TXRX_SRNG_PTR_STATS}, |
Kai Chen | 783e038 | 2018-01-25 16:29:08 -0800 | [diff] [blame] | 296 | {TXRX_FW_STATS_INVALID, TXRX_RX_MON_STATS}, |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 297 | }; |
| 298 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 299 | static int dp_peer_add_ast_wifi3(struct cdp_soc_t *soc_hdl, |
| 300 | struct cdp_peer *peer_hdl, |
| 301 | uint8_t *mac_addr, |
| 302 | enum cdp_txrx_ast_entry_type type, |
| 303 | uint32_t flags) |
| 304 | { |
| 305 | |
| 306 | return dp_peer_add_ast((struct dp_soc *)soc_hdl, |
| 307 | (struct dp_peer *)peer_hdl, |
| 308 | mac_addr, |
| 309 | type, |
| 310 | flags); |
| 311 | } |
| 312 | |
| 313 | static void dp_peer_del_ast_wifi3(struct cdp_soc_t *soc_hdl, |
| 314 | void *ast_entry_hdl) |
| 315 | { |
| 316 | struct dp_soc *soc = (struct dp_soc *)soc_hdl; |
| 317 | qdf_spin_lock_bh(&soc->ast_lock); |
| 318 | dp_peer_del_ast((struct dp_soc *)soc_hdl, |
| 319 | (struct dp_ast_entry *)ast_entry_hdl); |
| 320 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 321 | } |
| 322 | |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 323 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 324 | static int dp_peer_update_ast_wifi3(struct cdp_soc_t *soc_hdl, |
| 325 | struct cdp_peer *peer_hdl, |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 326 | uint8_t *wds_macaddr, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 327 | uint32_t flags) |
| 328 | { |
| 329 | int status; |
| 330 | struct dp_soc *soc = (struct dp_soc *)soc_hdl; |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 331 | struct dp_ast_entry *ast_entry = NULL; |
| 332 | |
| 333 | qdf_spin_lock_bh(&soc->ast_lock); |
| 334 | ast_entry = dp_peer_ast_hash_find(soc, wds_macaddr); |
| 335 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 336 | status = dp_peer_update_ast(soc, |
| 337 | (struct dp_peer *)peer_hdl, |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 338 | ast_entry, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 339 | flags); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 340 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 341 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 342 | return status; |
| 343 | } |
| 344 | |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 345 | /* |
| 346 | * dp_wds_reset_ast_wifi3() - Reset the is_active param for ast entry |
Santosh Anbu | 76693bc | 2018-04-23 16:38:54 +0530 | [diff] [blame] | 347 | * @soc_handle: Datapath SOC handle |
| 348 | * @wds_macaddr: MAC address of the WDS entry to be added |
| 349 | * @vdev_hdl: vdev handle |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 350 | * Return: None |
| 351 | */ |
| 352 | static void dp_wds_reset_ast_wifi3(struct cdp_soc_t *soc_hdl, |
Santosh Anbu | 76693bc | 2018-04-23 16:38:54 +0530 | [diff] [blame] | 353 | uint8_t *wds_macaddr, void *vdev_hdl) |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 354 | { |
| 355 | struct dp_soc *soc = (struct dp_soc *)soc_hdl; |
| 356 | struct dp_ast_entry *ast_entry = NULL; |
| 357 | |
| 358 | qdf_spin_lock_bh(&soc->ast_lock); |
| 359 | ast_entry = dp_peer_ast_hash_find(soc, wds_macaddr); |
| 360 | |
| 361 | if (ast_entry->type != CDP_TXRX_AST_TYPE_STATIC) { |
| 362 | ast_entry->is_active = TRUE; |
| 363 | } |
| 364 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 365 | } |
| 366 | |
| 367 | /* |
| 368 | * dp_wds_reset_ast_table_wifi3() - Reset the is_active param for all ast entry |
Santosh Anbu | 76693bc | 2018-04-23 16:38:54 +0530 | [diff] [blame] | 369 | * @soc: Datapath SOC handle |
| 370 | * @vdev_hdl: vdev handle |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 371 | * |
| 372 | * Return: None |
| 373 | */ |
Santosh Anbu | 76693bc | 2018-04-23 16:38:54 +0530 | [diff] [blame] | 374 | static void dp_wds_reset_ast_table_wifi3(struct cdp_soc_t *soc_hdl, |
| 375 | void *vdev_hdl) |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 376 | { |
| 377 | struct dp_soc *soc = (struct dp_soc *) soc_hdl; |
| 378 | struct dp_pdev *pdev; |
| 379 | struct dp_vdev *vdev; |
| 380 | struct dp_peer *peer; |
| 381 | struct dp_ast_entry *ase, *temp_ase; |
| 382 | int i; |
| 383 | |
| 384 | qdf_spin_lock_bh(&soc->ast_lock); |
| 385 | |
| 386 | for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { |
| 387 | pdev = soc->pdev_list[i]; |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 388 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 389 | DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) { |
| 390 | DP_VDEV_ITERATE_PEER_LIST(vdev, peer) { |
| 391 | DP_PEER_ITERATE_ASE_LIST(peer, ase, temp_ase) { |
| 392 | if (ase->type == |
| 393 | CDP_TXRX_AST_TYPE_STATIC) |
| 394 | continue; |
| 395 | ase->is_active = TRUE; |
| 396 | } |
| 397 | } |
| 398 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 399 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 400 | } |
| 401 | |
| 402 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 403 | } |
| 404 | |
| 405 | /* |
| 406 | * dp_wds_flush_ast_table_wifi3() - Delete all wds and hmwds ast entry |
| 407 | * @soc: Datapath SOC handle |
| 408 | * |
| 409 | * Return: None |
| 410 | */ |
| 411 | static void dp_wds_flush_ast_table_wifi3(struct cdp_soc_t *soc_hdl) |
| 412 | { |
| 413 | struct dp_soc *soc = (struct dp_soc *) soc_hdl; |
| 414 | struct dp_pdev *pdev; |
| 415 | struct dp_vdev *vdev; |
| 416 | struct dp_peer *peer; |
| 417 | struct dp_ast_entry *ase, *temp_ase; |
| 418 | int i; |
| 419 | |
| 420 | qdf_spin_lock_bh(&soc->ast_lock); |
| 421 | |
| 422 | for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { |
| 423 | pdev = soc->pdev_list[i]; |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 424 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 425 | DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) { |
| 426 | DP_VDEV_ITERATE_PEER_LIST(vdev, peer) { |
| 427 | DP_PEER_ITERATE_ASE_LIST(peer, ase, temp_ase) { |
| 428 | if (ase->type == |
| 429 | CDP_TXRX_AST_TYPE_STATIC) |
| 430 | continue; |
| 431 | dp_peer_del_ast(soc, ase); |
| 432 | } |
| 433 | } |
| 434 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 435 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 439 | } |
| 440 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 441 | static void *dp_peer_ast_hash_find_wifi3(struct cdp_soc_t *soc_hdl, |
| 442 | uint8_t *ast_mac_addr) |
| 443 | { |
| 444 | struct dp_ast_entry *ast_entry; |
| 445 | struct dp_soc *soc = (struct dp_soc *)soc_hdl; |
| 446 | qdf_spin_lock_bh(&soc->ast_lock); |
| 447 | ast_entry = dp_peer_ast_hash_find(soc, ast_mac_addr); |
| 448 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 449 | return (void *)ast_entry; |
| 450 | } |
| 451 | |
| 452 | static uint8_t dp_peer_ast_get_pdev_id_wifi3(struct cdp_soc_t *soc_hdl, |
| 453 | void *ast_entry_hdl) |
| 454 | { |
| 455 | return dp_peer_ast_get_pdev_id((struct dp_soc *)soc_hdl, |
| 456 | (struct dp_ast_entry *)ast_entry_hdl); |
| 457 | } |
| 458 | |
| 459 | static uint8_t dp_peer_ast_get_next_hop_wifi3(struct cdp_soc_t *soc_hdl, |
| 460 | void *ast_entry_hdl) |
| 461 | { |
| 462 | return dp_peer_ast_get_next_hop((struct dp_soc *)soc_hdl, |
| 463 | (struct dp_ast_entry *)ast_entry_hdl); |
| 464 | } |
| 465 | |
| 466 | static void dp_peer_ast_set_type_wifi3( |
| 467 | struct cdp_soc_t *soc_hdl, |
| 468 | void *ast_entry_hdl, |
| 469 | enum cdp_txrx_ast_entry_type type) |
| 470 | { |
| 471 | dp_peer_ast_set_type((struct dp_soc *)soc_hdl, |
| 472 | (struct dp_ast_entry *)ast_entry_hdl, |
| 473 | type); |
| 474 | } |
| 475 | |
| 476 | |
| 477 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 478 | /** |
| 479 | * dp_srng_find_ring_in_mask() - find which ext_group a ring belongs |
| 480 | * @ring_num: ring num of the ring being queried |
| 481 | * @grp_mask: the grp_mask array for the ring type in question. |
| 482 | * |
| 483 | * The grp_mask array is indexed by group number and the bit fields correspond |
| 484 | * to ring numbers. We are finding which interrupt group a ring belongs to. |
| 485 | * |
| 486 | * Return: the index in the grp_mask array with the ring number. |
| 487 | * -QDF_STATUS_E_NOENT if no entry is found |
| 488 | */ |
| 489 | static int dp_srng_find_ring_in_mask(int ring_num, int *grp_mask) |
| 490 | { |
| 491 | int ext_group_num; |
| 492 | int mask = 1 << ring_num; |
| 493 | |
| 494 | for (ext_group_num = 0; ext_group_num < WLAN_CFG_INT_NUM_CONTEXTS; |
| 495 | ext_group_num++) { |
| 496 | if (mask & grp_mask[ext_group_num]) |
| 497 | return ext_group_num; |
| 498 | } |
| 499 | |
| 500 | return -QDF_STATUS_E_NOENT; |
| 501 | } |
| 502 | |
| 503 | static int dp_srng_calculate_msi_group(struct dp_soc *soc, |
| 504 | enum hal_ring_type ring_type, |
| 505 | int ring_num) |
| 506 | { |
| 507 | int *grp_mask; |
| 508 | |
| 509 | switch (ring_type) { |
| 510 | case WBM2SW_RELEASE: |
| 511 | /* dp_tx_comp_handler - soc->tx_comp_ring */ |
| 512 | if (ring_num < 3) |
| 513 | grp_mask = &soc->wlan_cfg_ctx->int_tx_ring_mask[0]; |
| 514 | |
| 515 | /* dp_rx_wbm_err_process - soc->rx_rel_ring */ |
| 516 | else if (ring_num == 3) { |
| 517 | /* sw treats this as a separate ring type */ |
| 518 | grp_mask = &soc->wlan_cfg_ctx-> |
| 519 | int_rx_wbm_rel_ring_mask[0]; |
| 520 | ring_num = 0; |
| 521 | } else { |
| 522 | qdf_assert(0); |
| 523 | return -QDF_STATUS_E_NOENT; |
| 524 | } |
| 525 | break; |
| 526 | |
| 527 | case REO_EXCEPTION: |
| 528 | /* dp_rx_err_process - &soc->reo_exception_ring */ |
| 529 | grp_mask = &soc->wlan_cfg_ctx->int_rx_err_ring_mask[0]; |
| 530 | break; |
| 531 | |
| 532 | case REO_DST: |
| 533 | /* dp_rx_process - soc->reo_dest_ring */ |
| 534 | grp_mask = &soc->wlan_cfg_ctx->int_rx_ring_mask[0]; |
| 535 | break; |
| 536 | |
| 537 | case REO_STATUS: |
| 538 | /* dp_reo_status_ring_handler - soc->reo_status_ring */ |
| 539 | grp_mask = &soc->wlan_cfg_ctx->int_reo_status_ring_mask[0]; |
| 540 | break; |
| 541 | |
| 542 | /* dp_rx_mon_status_srng_process - pdev->rxdma_mon_status_ring*/ |
| 543 | case RXDMA_MONITOR_STATUS: |
| 544 | /* dp_rx_mon_dest_process - pdev->rxdma_mon_dst_ring */ |
| 545 | case RXDMA_MONITOR_DST: |
| 546 | /* dp_mon_process */ |
| 547 | grp_mask = &soc->wlan_cfg_ctx->int_rx_mon_ring_mask[0]; |
| 548 | break; |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 549 | case RXDMA_DST: |
| 550 | /* dp_rxdma_err_process */ |
| 551 | grp_mask = &soc->wlan_cfg_ctx->int_rxdma2host_ring_mask[0]; |
| 552 | break; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 553 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 554 | case RXDMA_BUF: |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 555 | grp_mask = &soc->wlan_cfg_ctx->int_host2rxdma_ring_mask[0]; |
| 556 | break; |
| 557 | |
| 558 | case RXDMA_MONITOR_BUF: |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 559 | /* TODO: support low_thresh interrupt */ |
| 560 | return -QDF_STATUS_E_NOENT; |
| 561 | break; |
| 562 | |
| 563 | case TCL_DATA: |
| 564 | case TCL_CMD: |
| 565 | case REO_CMD: |
| 566 | case SW2WBM_RELEASE: |
| 567 | case WBM_IDLE_LINK: |
| 568 | /* normally empty SW_TO_HW rings */ |
| 569 | return -QDF_STATUS_E_NOENT; |
| 570 | break; |
| 571 | |
| 572 | case TCL_STATUS: |
| 573 | case REO_REINJECT: |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 574 | /* misc unused rings */ |
| 575 | return -QDF_STATUS_E_NOENT; |
| 576 | break; |
| 577 | |
| 578 | case CE_SRC: |
| 579 | case CE_DST: |
| 580 | case CE_DST_STATUS: |
| 581 | /* CE_rings - currently handled by hif */ |
| 582 | default: |
| 583 | return -QDF_STATUS_E_NOENT; |
| 584 | break; |
| 585 | } |
| 586 | |
| 587 | return dp_srng_find_ring_in_mask(ring_num, grp_mask); |
| 588 | } |
| 589 | |
| 590 | static void dp_srng_msi_setup(struct dp_soc *soc, struct hal_srng_params |
| 591 | *ring_params, int ring_type, int ring_num) |
| 592 | { |
| 593 | int msi_group_number; |
| 594 | int msi_data_count; |
| 595 | int ret; |
| 596 | uint32_t msi_data_start, msi_irq_start, addr_low, addr_high; |
| 597 | |
| 598 | ret = pld_get_user_msi_assignment(soc->osdev->dev, "DP", |
| 599 | &msi_data_count, &msi_data_start, |
| 600 | &msi_irq_start); |
| 601 | |
| 602 | if (ret) |
| 603 | return; |
| 604 | |
| 605 | msi_group_number = dp_srng_calculate_msi_group(soc, ring_type, |
| 606 | ring_num); |
| 607 | if (msi_group_number < 0) { |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 608 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 609 | FL("ring not part of an ext_group; ring_type: %d,ring_num %d"), |
| 610 | ring_type, ring_num); |
| 611 | ring_params->msi_addr = 0; |
| 612 | ring_params->msi_data = 0; |
| 613 | return; |
| 614 | } |
| 615 | |
| 616 | if (msi_group_number > msi_data_count) { |
| 617 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_WARN, |
| 618 | FL("2 msi_groups will share an msi; msi_group_num %d"), |
| 619 | msi_group_number); |
| 620 | |
| 621 | QDF_ASSERT(0); |
| 622 | } |
| 623 | |
| 624 | pld_get_msi_address(soc->osdev->dev, &addr_low, &addr_high); |
| 625 | |
| 626 | ring_params->msi_addr = addr_low; |
| 627 | ring_params->msi_addr |= (qdf_dma_addr_t)(((uint64_t)addr_high) << 32); |
| 628 | ring_params->msi_data = (msi_group_number % msi_data_count) |
| 629 | + msi_data_start; |
| 630 | ring_params->flags |= HAL_SRNG_MSI_INTR; |
| 631 | } |
| 632 | |
| 633 | /** |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 634 | * dp_print_ast_stats() - Dump AST table contents |
| 635 | * @soc: Datapath soc handle |
| 636 | * |
| 637 | * return void |
| 638 | */ |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 639 | #ifdef FEATURE_AST |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 640 | static void dp_print_ast_stats(struct dp_soc *soc) |
| 641 | { |
| 642 | uint8_t i; |
| 643 | uint8_t num_entries = 0; |
| 644 | struct dp_vdev *vdev; |
| 645 | struct dp_pdev *pdev; |
| 646 | struct dp_peer *peer; |
| 647 | struct dp_ast_entry *ase, *tmp_ase; |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 648 | char type[5][10] = {"NONE", "STATIC", "WDS", "MEC", "HMWDS"}; |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 649 | |
| 650 | DP_PRINT_STATS("AST Stats:"); |
| 651 | DP_PRINT_STATS(" Entries Added = %d", soc->stats.ast.added); |
| 652 | DP_PRINT_STATS(" Entries Deleted = %d", soc->stats.ast.deleted); |
| 653 | DP_PRINT_STATS(" Entries Agedout = %d", soc->stats.ast.aged_out); |
| 654 | DP_PRINT_STATS("AST Table:"); |
| 655 | for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { |
| 656 | pdev = soc->pdev_list[i]; |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 657 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 658 | DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) { |
| 659 | DP_VDEV_ITERATE_PEER_LIST(vdev, peer) { |
| 660 | DP_PEER_ITERATE_ASE_LIST(peer, ase, tmp_ase) { |
| 661 | DP_PRINT_STATS("%6d mac_addr = %pM" |
| 662 | " peer_mac_addr = %pM" |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 663 | " type = %s" |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 664 | " next_hop = %d" |
| 665 | " is_active = %d" |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 666 | " is_bss = %d" |
| 667 | " ast_idx = %d" |
| 668 | " pdev_id = %d" |
| 669 | " vdev_id = %d", |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 670 | ++num_entries, |
| 671 | ase->mac_addr.raw, |
| 672 | ase->peer->mac_addr.raw, |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 673 | type[ase->type], |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 674 | ase->next_hop, |
| 675 | ase->is_active, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 676 | ase->is_bss, |
| 677 | ase->ast_idx, |
| 678 | ase->pdev_id, |
| 679 | ase->vdev_id); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 680 | } |
| 681 | } |
| 682 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 683 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 684 | } |
| 685 | } |
| 686 | #else |
| 687 | static void dp_print_ast_stats(struct dp_soc *soc) |
| 688 | { |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 689 | DP_PRINT_STATS("AST Stats not available.Enable FEATURE_AST"); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 690 | return; |
| 691 | } |
| 692 | #endif |
| 693 | |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 694 | static void dp_print_peer_table(struct dp_vdev *vdev) |
| 695 | { |
| 696 | struct dp_peer *peer = NULL; |
| 697 | |
| 698 | DP_PRINT_STATS("Dumping Peer Table Stats:"); |
| 699 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 700 | if (!peer) { |
| 701 | DP_PRINT_STATS("Invalid Peer"); |
| 702 | return; |
| 703 | } |
| 704 | DP_PRINT_STATS(" peer_mac_addr = %pM" |
| 705 | " nawds_enabled = %d" |
| 706 | " bss_peer = %d" |
| 707 | " wapi = %d" |
| 708 | " wds_enabled = %d" |
| 709 | " delete in progress = %d", |
| 710 | peer->mac_addr.raw, |
| 711 | peer->nawds_enabled, |
| 712 | peer->bss_peer, |
| 713 | peer->wapi, |
| 714 | peer->wds_enabled, |
| 715 | peer->delete_in_progress); |
| 716 | } |
| 717 | } |
| 718 | |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 719 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 720 | * dp_setup_srng - Internal function to setup SRNG rings used by data path |
| 721 | */ |
| 722 | 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] | 723 | 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] | 724 | { |
| 725 | void *hal_soc = soc->hal_soc; |
| 726 | uint32_t entry_size = hal_srng_get_entrysize(hal_soc, ring_type); |
| 727 | /* TODO: See if we should get align size from hal */ |
| 728 | uint32_t ring_base_align = 8; |
| 729 | struct hal_srng_params ring_params; |
Karunakar Dasineni | d0ea21f | 2017-01-31 22:58:15 -0800 | [diff] [blame] | 730 | uint32_t max_entries = hal_srng_max_entries(hal_soc, ring_type); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 731 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 732 | /* TODO: Currently hal layer takes care of endianness related settings. |
| 733 | * See if these settings need to passed from DP layer |
| 734 | */ |
| 735 | ring_params.flags = 0; |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 736 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 737 | FL("Ring type: %d, num:%d"), ring_type, ring_num); |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 738 | |
Karunakar Dasineni | d0ea21f | 2017-01-31 22:58:15 -0800 | [diff] [blame] | 739 | num_entries = (num_entries > max_entries) ? max_entries : num_entries; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 740 | srng->hal_srng = NULL; |
| 741 | srng->alloc_size = (num_entries * entry_size) + ring_base_align - 1; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 742 | srng->num_entries = num_entries; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 743 | srng->base_vaddr_unaligned = qdf_mem_alloc_consistent( |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 744 | soc->osdev, soc->osdev->dev, srng->alloc_size, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 745 | &(srng->base_paddr_unaligned)); |
| 746 | |
| 747 | if (!srng->base_vaddr_unaligned) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 748 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 749 | FL("alloc failed - ring_type: %d, ring_num %d"), |
| 750 | ring_type, ring_num); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 751 | return QDF_STATUS_E_NOMEM; |
| 752 | } |
| 753 | |
| 754 | ring_params.ring_base_vaddr = srng->base_vaddr_unaligned + |
| 755 | ((unsigned long)srng->base_vaddr_unaligned % ring_base_align); |
| 756 | ring_params.ring_base_paddr = srng->base_paddr_unaligned + |
| 757 | ((unsigned long)(ring_params.ring_base_vaddr) - |
| 758 | (unsigned long)srng->base_vaddr_unaligned); |
| 759 | ring_params.num_entries = num_entries; |
| 760 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 761 | if (soc->intr_mode == DP_INTR_MSI) { |
| 762 | dp_srng_msi_setup(soc, &ring_params, ring_type, ring_num); |
| 763 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 764 | FL("Using MSI for ring_type: %d, ring_num %d"), |
| 765 | ring_type, ring_num); |
| 766 | |
| 767 | } else { |
| 768 | ring_params.msi_data = 0; |
| 769 | ring_params.msi_addr = 0; |
| 770 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 771 | FL("Skipping MSI for ring_type: %d, ring_num %d"), |
| 772 | ring_type, ring_num); |
| 773 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 774 | |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 775 | /* |
| 776 | * Setup interrupt timer and batch counter thresholds for |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 777 | * interrupt mitigation based on ring type |
| 778 | */ |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 779 | if (ring_type == REO_DST) { |
| 780 | ring_params.intr_timer_thres_us = |
| 781 | wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx); |
| 782 | ring_params.intr_batch_cntr_thres_entries = |
| 783 | wlan_cfg_get_int_batch_threshold_rx(soc->wlan_cfg_ctx); |
| 784 | } else if (ring_type == WBM2SW_RELEASE && (ring_num < 3)) { |
| 785 | ring_params.intr_timer_thres_us = |
| 786 | wlan_cfg_get_int_timer_threshold_tx(soc->wlan_cfg_ctx); |
| 787 | ring_params.intr_batch_cntr_thres_entries = |
| 788 | wlan_cfg_get_int_batch_threshold_tx(soc->wlan_cfg_ctx); |
| 789 | } else { |
| 790 | ring_params.intr_timer_thres_us = |
| 791 | wlan_cfg_get_int_timer_threshold_other(soc->wlan_cfg_ctx); |
| 792 | ring_params.intr_batch_cntr_thres_entries = |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 793 | wlan_cfg_get_int_batch_threshold_other(soc->wlan_cfg_ctx); |
Pamidipati, Vijay | 45b1df2 | 2017-06-21 03:20:25 +0530 | [diff] [blame] | 794 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 795 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 796 | /* Enable low threshold interrupts for rx buffer rings (regular and |
| 797 | * monitor buffer rings. |
| 798 | * TODO: See if this is required for any other ring |
| 799 | */ |
Karunakar Dasineni | 37995ac | 2018-02-06 12:37:30 -0800 | [diff] [blame] | 800 | if ((ring_type == RXDMA_BUF) || (ring_type == RXDMA_MONITOR_BUF) || |
| 801 | (ring_type == RXDMA_MONITOR_STATUS)) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 802 | /* TODO: Setting low threshold to 1/8th of ring size |
| 803 | * see if this needs to be configurable |
| 804 | */ |
| 805 | ring_params.low_threshold = num_entries >> 3; |
| 806 | ring_params.flags |= HAL_SRNG_LOW_THRES_INTR_ENABLE; |
Karunakar Dasineni | bef3b1b | 2018-03-28 22:23:57 -0700 | [diff] [blame] | 807 | ring_params.intr_timer_thres_us = |
| 808 | wlan_cfg_get_int_timer_threshold_rx(soc->wlan_cfg_ctx); |
| 809 | ring_params.intr_batch_cntr_thres_entries = 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | srng->hal_srng = hal_srng_setup(hal_soc, ring_type, ring_num, |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 813 | mac_id, &ring_params); |
Manoj Ekbote | 376116e | 2017-12-19 10:44:41 -0800 | [diff] [blame] | 814 | |
| 815 | if (!srng->hal_srng) { |
| 816 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
| 817 | srng->alloc_size, |
| 818 | srng->base_vaddr_unaligned, |
| 819 | srng->base_paddr_unaligned, 0); |
| 820 | } |
| 821 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 822 | return 0; |
| 823 | } |
| 824 | |
| 825 | /** |
| 826 | * dp_srng_cleanup - Internal function to cleanup SRNG rings used by data path |
| 827 | * Any buffers allocated and attached to ring entries are expected to be freed |
| 828 | * before calling this function. |
| 829 | */ |
| 830 | static void dp_srng_cleanup(struct dp_soc *soc, struct dp_srng *srng, |
| 831 | int ring_type, int ring_num) |
| 832 | { |
| 833 | if (!srng->hal_srng) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 834 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 835 | FL("Ring type: %d, num:%d not setup"), |
| 836 | ring_type, ring_num); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 837 | return; |
| 838 | } |
| 839 | |
| 840 | hal_srng_cleanup(soc->hal_soc, srng->hal_srng); |
| 841 | |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 842 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 843 | srng->alloc_size, |
| 844 | srng->base_vaddr_unaligned, |
| 845 | srng->base_paddr_unaligned, 0); |
Manoj Ekbote | 525bcab | 2017-09-01 17:23:32 -0700 | [diff] [blame] | 846 | srng->hal_srng = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 847 | } |
| 848 | |
| 849 | /* TODO: Need this interface from HIF */ |
| 850 | void *hif_get_hal_handle(void *hif_handle); |
| 851 | |
| 852 | /* |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 853 | * dp_service_srngs() - Top level interrupt handler for DP Ring interrupts |
| 854 | * @dp_ctx: DP SOC handle |
| 855 | * @budget: Number of frames/descriptors that can be processed in one shot |
| 856 | * |
| 857 | * Return: remaining budget/quota for the soc device |
| 858 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 859 | 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] | 860 | { |
| 861 | struct dp_intr *int_ctx = (struct dp_intr *)dp_ctx; |
| 862 | struct dp_soc *soc = int_ctx->soc; |
| 863 | int ring = 0; |
| 864 | uint32_t work_done = 0; |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 865 | int budget = dp_budget; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 866 | uint8_t tx_mask = int_ctx->tx_ring_mask; |
| 867 | uint8_t rx_mask = int_ctx->rx_ring_mask; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 868 | uint8_t rx_err_mask = int_ctx->rx_err_ring_mask; |
| 869 | 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] | 870 | uint8_t reo_status_mask = int_ctx->reo_status_ring_mask; |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 871 | uint32_t remaining_quota = dp_budget; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 872 | struct dp_pdev *pdev = NULL; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 873 | int mac_id; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 874 | |
| 875 | /* Process Tx completion interrupts first to return back buffers */ |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 876 | while (tx_mask) { |
| 877 | if (tx_mask & 0x1) { |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 878 | work_done = dp_tx_comp_handler(soc, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 879 | soc->tx_comp_ring[ring].hal_srng, |
| 880 | remaining_quota); |
| 881 | |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 882 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 883 | "tx mask 0x%x ring %d, budget %d, work_done %d", |
| 884 | tx_mask, ring, budget, work_done); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 885 | |
| 886 | budget -= work_done; |
| 887 | if (budget <= 0) |
| 888 | goto budget_done; |
| 889 | |
| 890 | remaining_quota = budget; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 891 | } |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 892 | tx_mask = tx_mask >> 1; |
| 893 | ring++; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 894 | } |
| 895 | |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 896 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 897 | /* Process REO Exception ring interrupt */ |
| 898 | if (rx_err_mask) { |
| 899 | work_done = dp_rx_err_process(soc, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 900 | soc->reo_exception_ring.hal_srng, |
| 901 | remaining_quota); |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 902 | |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 903 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 904 | "REO Exception Ring: work_done %d budget %d", |
| 905 | work_done, budget); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 906 | |
| 907 | budget -= work_done; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 908 | if (budget <= 0) { |
| 909 | goto budget_done; |
| 910 | } |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 911 | remaining_quota = budget; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 912 | } |
| 913 | |
| 914 | /* Process Rx WBM release ring interrupt */ |
| 915 | if (rx_wbm_rel_mask) { |
| 916 | work_done = dp_rx_wbm_err_process(soc, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 917 | soc->rx_rel_ring.hal_srng, remaining_quota); |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 918 | |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 919 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 920 | "WBM Release Ring: work_done %d budget %d", |
| 921 | work_done, budget); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 922 | |
| 923 | budget -= work_done; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 924 | if (budget <= 0) { |
| 925 | goto budget_done; |
| 926 | } |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 927 | remaining_quota = budget; |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 928 | } |
| 929 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 930 | /* Process Rx interrupts */ |
| 931 | if (rx_mask) { |
| 932 | for (ring = 0; ring < soc->num_reo_dest_rings; ring++) { |
| 933 | if (rx_mask & (1 << ring)) { |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 934 | work_done = dp_rx_process(int_ctx, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 935 | soc->reo_dest_ring[ring].hal_srng, |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 936 | remaining_quota); |
| 937 | |
Houston Hoffman | ae850c6 | 2017-08-11 16:47:50 -0700 | [diff] [blame] | 938 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 939 | "rx mask 0x%x ring %d, work_done %d budget %d", |
| 940 | rx_mask, ring, work_done, budget); |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 941 | |
| 942 | budget -= work_done; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 943 | if (budget <= 0) |
| 944 | goto budget_done; |
Pamidipati, Vijay | 9e34025 | 2017-08-14 16:24:17 +0530 | [diff] [blame] | 945 | remaining_quota = budget; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 946 | } |
| 947 | } |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 948 | for (ring = 0; ring < MAX_RX_MAC_RINGS; ring++) { |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 949 | work_done = dp_rxdma_err_process(soc, ring, |
| 950 | remaining_quota); |
| 951 | budget -= work_done; |
| 952 | } |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 953 | } |
| 954 | |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 955 | if (reo_status_mask) |
| 956 | dp_reo_status_ring_handler(soc); |
| 957 | |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 958 | /* Process LMAC interrupts */ |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 959 | for (ring = 0 ; ring < MAX_PDEV_CNT; ring++) { |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 960 | pdev = soc->pdev_list[ring]; |
| 961 | if (pdev == NULL) |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 962 | continue; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 963 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 964 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, |
| 965 | pdev->pdev_id); |
| 966 | |
| 967 | if (int_ctx->rx_mon_ring_mask & (1 << mac_for_pdev)) { |
| 968 | work_done = dp_mon_process(soc, mac_for_pdev, |
| 969 | remaining_quota); |
| 970 | budget -= work_done; |
| 971 | if (budget <= 0) |
| 972 | goto budget_done; |
| 973 | remaining_quota = budget; |
| 974 | } |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 975 | |
chenguo | cd0f313 | 2018-02-28 15:53:50 -0800 | [diff] [blame] | 976 | if (int_ctx->rxdma2host_ring_mask & |
| 977 | (1 << mac_for_pdev)) { |
| 978 | work_done = dp_rxdma_err_process(soc, |
| 979 | mac_for_pdev, |
| 980 | remaining_quota); |
| 981 | budget -= work_done; |
| 982 | if (budget <= 0) |
| 983 | goto budget_done; |
| 984 | remaining_quota = budget; |
| 985 | } |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 986 | |
chenguo | cd0f313 | 2018-02-28 15:53:50 -0800 | [diff] [blame] | 987 | if (int_ctx->host2rxdma_ring_mask & |
| 988 | (1 << mac_for_pdev)) { |
| 989 | union dp_rx_desc_list_elem_t *desc_list = NULL; |
| 990 | union dp_rx_desc_list_elem_t *tail = NULL; |
| 991 | struct dp_srng *rx_refill_buf_ring = |
| 992 | &pdev->rx_refill_buf_ring; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 993 | |
chenguo | cd0f313 | 2018-02-28 15:53:50 -0800 | [diff] [blame] | 994 | DP_STATS_INC(pdev, replenish.low_thresh_intrs, |
| 995 | 1); |
| 996 | dp_rx_buffers_replenish(soc, mac_for_pdev, |
| 997 | rx_refill_buf_ring, |
| 998 | &soc->rx_desc_buf[mac_for_pdev], 0, |
Venkata Sharath Chandra Manchala | 16fcceb | 2018-01-03 11:27:15 -0800 | [diff] [blame] | 999 | &desc_list, &tail); |
chenguo | cd0f313 | 2018-02-28 15:53:50 -0800 | [diff] [blame] | 1000 | } |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 1001 | } |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1002 | } |
| 1003 | |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 1004 | qdf_lro_flush(int_ctx->lro_ctx); |
| 1005 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1006 | budget_done: |
| 1007 | return dp_budget - budget; |
| 1008 | } |
| 1009 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1010 | #ifdef DP_INTR_POLL_BASED |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1011 | /* dp_interrupt_timer()- timer poll for interrupts |
| 1012 | * |
| 1013 | * @arg: SoC Handle |
| 1014 | * |
| 1015 | * Return: |
| 1016 | * |
| 1017 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 1018 | static void dp_interrupt_timer(void *arg) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1019 | { |
| 1020 | struct dp_soc *soc = (struct dp_soc *) arg; |
| 1021 | int i; |
| 1022 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 1023 | if (qdf_atomic_read(&soc->cmn_init_done)) { |
| 1024 | for (i = 0; |
| 1025 | i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) |
| 1026 | dp_service_srngs(&soc->intr_ctx[i], 0xffff); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1027 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 1028 | qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); |
| 1029 | } |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1030 | } |
| 1031 | |
| 1032 | /* |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1033 | * dp_soc_interrupt_attach_poll() - Register handlers for DP interrupts |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1034 | * @txrx_soc: DP SOC handle |
| 1035 | * |
| 1036 | * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI |
| 1037 | * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and |
| 1038 | * rx_monitor_ring mask to indicate the rings that are processed by the handler. |
| 1039 | * |
| 1040 | * Return: 0 for success. nonzero for failure. |
| 1041 | */ |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1042 | static QDF_STATUS dp_soc_interrupt_attach_poll(void *txrx_soc) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1043 | { |
| 1044 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
| 1045 | int i; |
| 1046 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1047 | soc->intr_mode = DP_INTR_POLL; |
| 1048 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1049 | 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] | 1050 | soc->intr_ctx[i].dp_intr_id = i; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 1051 | soc->intr_ctx[i].tx_ring_mask = |
| 1052 | wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx, i); |
| 1053 | soc->intr_ctx[i].rx_ring_mask = |
| 1054 | wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx, i); |
| 1055 | soc->intr_ctx[i].rx_mon_ring_mask = |
| 1056 | wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, i); |
| 1057 | soc->intr_ctx[i].rx_err_ring_mask = |
| 1058 | wlan_cfg_get_rx_err_ring_mask(soc->wlan_cfg_ctx, i); |
| 1059 | soc->intr_ctx[i].rx_wbm_rel_ring_mask = |
| 1060 | wlan_cfg_get_rx_wbm_rel_ring_mask(soc->wlan_cfg_ctx, i); |
| 1061 | soc->intr_ctx[i].reo_status_ring_mask = |
| 1062 | wlan_cfg_get_reo_status_ring_mask(soc->wlan_cfg_ctx, i); |
| 1063 | soc->intr_ctx[i].rxdma2host_ring_mask = |
| 1064 | wlan_cfg_get_rxdma2host_ring_mask(soc->wlan_cfg_ctx, i); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1065 | soc->intr_ctx[i].soc = soc; |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 1066 | soc->intr_ctx[i].lro_ctx = qdf_lro_init(); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1067 | } |
| 1068 | |
| 1069 | qdf_timer_init(soc->osdev, &soc->int_timer, |
| 1070 | dp_interrupt_timer, (void *)soc, |
| 1071 | QDF_TIMER_TYPE_WAKE_APPS); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1072 | |
| 1073 | return QDF_STATUS_SUCCESS; |
| 1074 | } |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 1075 | |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 1076 | #if defined(CONFIG_MCL) |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 1077 | extern int con_mode_monitor; |
| 1078 | static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc); |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 1079 | /* |
| 1080 | * dp_soc_interrupt_attach_wrapper() - Register handlers for DP interrupts |
| 1081 | * @txrx_soc: DP SOC handle |
| 1082 | * |
| 1083 | * Call the appropriate attach function based on the mode of operation. |
| 1084 | * This is a WAR for enabling monitor mode. |
| 1085 | * |
| 1086 | * Return: 0 for success. nonzero for failure. |
| 1087 | */ |
| 1088 | static QDF_STATUS dp_soc_interrupt_attach_wrapper(void *txrx_soc) |
| 1089 | { |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 1090 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
| 1091 | |
| 1092 | if (!(soc->wlan_cfg_ctx->napi_enabled) || |
| 1093 | con_mode_monitor == QDF_GLOBAL_MONITOR_MODE) { |
Mohit Khanna | 9a6fdd5 | 2017-12-12 10:55:48 +0800 | [diff] [blame] | 1094 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 1095 | "%s: Poll mode", __func__); |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 1096 | return dp_soc_interrupt_attach_poll(txrx_soc); |
| 1097 | } else { |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 1098 | |
Mohit Khanna | 9a6fdd5 | 2017-12-12 10:55:48 +0800 | [diff] [blame] | 1099 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 1100 | "%s: Interrupt mode", __func__); |
D Harilakshmi | 5da9ee7 | 2017-10-04 16:14:12 +0530 | [diff] [blame] | 1101 | return dp_soc_interrupt_attach(txrx_soc); |
| 1102 | } |
| 1103 | } |
| 1104 | #else |
| 1105 | static QDF_STATUS dp_soc_interrupt_attach_wrapper(void *txrx_soc) |
| 1106 | { |
| 1107 | return dp_soc_interrupt_attach_poll(txrx_soc); |
| 1108 | } |
| 1109 | #endif |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1110 | #endif |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1111 | |
| 1112 | static void dp_soc_interrupt_map_calculate_integrated(struct dp_soc *soc, |
| 1113 | int intr_ctx_num, int *irq_id_map, int *num_irq_r) |
| 1114 | { |
| 1115 | int j; |
| 1116 | int num_irq = 0; |
| 1117 | |
| 1118 | int tx_mask = |
| 1119 | wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num); |
| 1120 | int rx_mask = |
| 1121 | wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num); |
| 1122 | int rx_mon_mask = |
| 1123 | wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num); |
| 1124 | int rx_err_ring_mask = wlan_cfg_get_rx_err_ring_mask( |
| 1125 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1126 | int rx_wbm_rel_ring_mask = wlan_cfg_get_rx_wbm_rel_ring_mask( |
| 1127 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1128 | int reo_status_ring_mask = wlan_cfg_get_reo_status_ring_mask( |
| 1129 | soc->wlan_cfg_ctx, intr_ctx_num); |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1130 | int rxdma2host_ring_mask = wlan_cfg_get_rxdma2host_ring_mask( |
| 1131 | soc->wlan_cfg_ctx, intr_ctx_num); |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1132 | int host2rxdma_ring_mask = wlan_cfg_get_host2rxdma_ring_mask( |
| 1133 | soc->wlan_cfg_ctx, intr_ctx_num); |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1134 | |
| 1135 | for (j = 0; j < HIF_MAX_GRP_IRQ; j++) { |
| 1136 | |
| 1137 | if (tx_mask & (1 << j)) { |
| 1138 | irq_id_map[num_irq++] = |
| 1139 | (wbm2host_tx_completions_ring1 - j); |
| 1140 | } |
| 1141 | |
| 1142 | if (rx_mask & (1 << j)) { |
| 1143 | irq_id_map[num_irq++] = |
| 1144 | (reo2host_destination_ring1 - j); |
| 1145 | } |
| 1146 | |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1147 | if (rxdma2host_ring_mask & (1 << j)) { |
| 1148 | irq_id_map[num_irq++] = |
| 1149 | rxdma2host_destination_ring_mac1 - |
| 1150 | wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j); |
| 1151 | } |
| 1152 | |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1153 | if (host2rxdma_ring_mask & (1 << j)) { |
| 1154 | irq_id_map[num_irq++] = |
| 1155 | host2rxdma_host_buf_ring_mac1 - |
| 1156 | wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j); |
| 1157 | } |
| 1158 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1159 | if (rx_mon_mask & (1 << j)) { |
| 1160 | irq_id_map[num_irq++] = |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1161 | ppdu_end_interrupts_mac1 - |
| 1162 | wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j); |
Karunakar Dasineni | 37995ac | 2018-02-06 12:37:30 -0800 | [diff] [blame] | 1163 | irq_id_map[num_irq++] = |
| 1164 | rxdma2host_monitor_status_ring_mac1 - |
| 1165 | wlan_cfg_get_hw_mac_idx(soc->wlan_cfg_ctx, j); |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1166 | } |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1167 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1168 | if (rx_wbm_rel_ring_mask & (1 << j)) |
| 1169 | irq_id_map[num_irq++] = wbm2host_rx_release; |
| 1170 | |
| 1171 | if (rx_err_ring_mask & (1 << j)) |
| 1172 | irq_id_map[num_irq++] = reo2host_exception; |
| 1173 | |
| 1174 | if (reo_status_ring_mask & (1 << j)) |
| 1175 | irq_id_map[num_irq++] = reo2host_status; |
| 1176 | |
| 1177 | } |
| 1178 | *num_irq_r = num_irq; |
| 1179 | } |
| 1180 | |
| 1181 | static void dp_soc_interrupt_map_calculate_msi(struct dp_soc *soc, |
| 1182 | int intr_ctx_num, int *irq_id_map, int *num_irq_r, |
| 1183 | int msi_vector_count, int msi_vector_start) |
| 1184 | { |
| 1185 | int tx_mask = wlan_cfg_get_tx_ring_mask( |
| 1186 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1187 | int rx_mask = wlan_cfg_get_rx_ring_mask( |
| 1188 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1189 | int rx_mon_mask = wlan_cfg_get_rx_mon_ring_mask( |
| 1190 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1191 | int rx_err_ring_mask = wlan_cfg_get_rx_err_ring_mask( |
| 1192 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1193 | int rx_wbm_rel_ring_mask = wlan_cfg_get_rx_wbm_rel_ring_mask( |
| 1194 | soc->wlan_cfg_ctx, intr_ctx_num); |
| 1195 | int reo_status_ring_mask = wlan_cfg_get_reo_status_ring_mask( |
| 1196 | soc->wlan_cfg_ctx, intr_ctx_num); |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1197 | int rxdma2host_ring_mask = wlan_cfg_get_rxdma2host_ring_mask( |
| 1198 | soc->wlan_cfg_ctx, intr_ctx_num); |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1199 | |
| 1200 | unsigned int vector = |
| 1201 | (intr_ctx_num % msi_vector_count) + msi_vector_start; |
| 1202 | int num_irq = 0; |
| 1203 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1204 | soc->intr_mode = DP_INTR_MSI; |
| 1205 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1206 | if (tx_mask | rx_mask | rx_mon_mask | rx_err_ring_mask | |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1207 | rx_wbm_rel_ring_mask | reo_status_ring_mask | rxdma2host_ring_mask) |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1208 | irq_id_map[num_irq++] = |
| 1209 | pld_get_msi_irq(soc->osdev->dev, vector); |
| 1210 | |
| 1211 | *num_irq_r = num_irq; |
| 1212 | } |
| 1213 | |
| 1214 | static void dp_soc_interrupt_map_calculate(struct dp_soc *soc, int intr_ctx_num, |
| 1215 | int *irq_id_map, int *num_irq) |
| 1216 | { |
| 1217 | int msi_vector_count, ret; |
| 1218 | uint32_t msi_base_data, msi_vector_start; |
| 1219 | |
| 1220 | ret = pld_get_user_msi_assignment(soc->osdev->dev, "DP", |
| 1221 | &msi_vector_count, |
| 1222 | &msi_base_data, |
| 1223 | &msi_vector_start); |
| 1224 | if (ret) |
| 1225 | return dp_soc_interrupt_map_calculate_integrated(soc, |
| 1226 | intr_ctx_num, irq_id_map, num_irq); |
| 1227 | |
| 1228 | else |
| 1229 | dp_soc_interrupt_map_calculate_msi(soc, |
| 1230 | intr_ctx_num, irq_id_map, num_irq, |
| 1231 | msi_vector_count, msi_vector_start); |
| 1232 | } |
| 1233 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1234 | /* |
| 1235 | * dp_soc_interrupt_attach() - Register handlers for DP interrupts |
| 1236 | * @txrx_soc: DP SOC handle |
| 1237 | * |
| 1238 | * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI |
| 1239 | * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and |
| 1240 | * rx_monitor_ring mask to indicate the rings that are processed by the handler. |
| 1241 | * |
| 1242 | * Return: 0 for success. nonzero for failure. |
| 1243 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 1244 | static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1245 | { |
| 1246 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
| 1247 | |
| 1248 | int i = 0; |
| 1249 | int num_irq = 0; |
| 1250 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1251 | 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] | 1252 | int ret = 0; |
| 1253 | |
| 1254 | /* Map of IRQ ids registered with one interrupt context */ |
| 1255 | int irq_id_map[HIF_MAX_GRP_IRQ]; |
| 1256 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1257 | int tx_mask = |
| 1258 | wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx, i); |
| 1259 | int rx_mask = |
| 1260 | wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx, i); |
| 1261 | int rx_mon_mask = |
| 1262 | 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] | 1263 | int rx_err_ring_mask = |
| 1264 | wlan_cfg_get_rx_err_ring_mask(soc->wlan_cfg_ctx, i); |
| 1265 | int rx_wbm_rel_ring_mask = |
| 1266 | wlan_cfg_get_rx_wbm_rel_ring_mask(soc->wlan_cfg_ctx, i); |
| 1267 | int reo_status_ring_mask = |
| 1268 | wlan_cfg_get_reo_status_ring_mask(soc->wlan_cfg_ctx, i); |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 1269 | int rxdma2host_ring_mask = |
| 1270 | wlan_cfg_get_rxdma2host_ring_mask(soc->wlan_cfg_ctx, i); |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1271 | int host2rxdma_ring_mask = |
| 1272 | wlan_cfg_get_host2rxdma_ring_mask(soc->wlan_cfg_ctx, i); |
| 1273 | |
Pamidipati, Vijay | 3d8e1e8 | 2017-05-29 14:29:31 +0530 | [diff] [blame] | 1274 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1275 | soc->intr_ctx[i].dp_intr_id = i; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1276 | soc->intr_ctx[i].tx_ring_mask = tx_mask; |
| 1277 | soc->intr_ctx[i].rx_ring_mask = rx_mask; |
| 1278 | soc->intr_ctx[i].rx_mon_ring_mask = rx_mon_mask; |
Pamidipati, Vijay | 3d8e1e8 | 2017-05-29 14:29:31 +0530 | [diff] [blame] | 1279 | soc->intr_ctx[i].rx_err_ring_mask = rx_err_ring_mask; |
Karunakar Dasineni | 1018547 | 2017-06-19 16:32:06 -0700 | [diff] [blame] | 1280 | soc->intr_ctx[i].rxdma2host_ring_mask = rxdma2host_ring_mask; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1281 | soc->intr_ctx[i].host2rxdma_ring_mask = host2rxdma_ring_mask; |
Pamidipati, Vijay | 3d8e1e8 | 2017-05-29 14:29:31 +0530 | [diff] [blame] | 1282 | soc->intr_ctx[i].rx_wbm_rel_ring_mask = rx_wbm_rel_ring_mask; |
| 1283 | soc->intr_ctx[i].reo_status_ring_mask = reo_status_ring_mask; |
| 1284 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1285 | soc->intr_ctx[i].soc = soc; |
| 1286 | |
| 1287 | num_irq = 0; |
| 1288 | |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1289 | dp_soc_interrupt_map_calculate(soc, i, &irq_id_map[0], |
| 1290 | &num_irq); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1291 | |
Houston Hoffman | def86a3 | 2017-04-21 20:23:45 -0700 | [diff] [blame] | 1292 | ret = hif_register_ext_group(soc->hif_handle, |
| 1293 | num_irq, irq_id_map, dp_service_srngs, |
| 1294 | &soc->intr_ctx[i], "dp_intr", |
chenguo | f254886 | 2017-11-08 16:33:25 +0800 | [diff] [blame] | 1295 | HIF_EXEC_NAPI_TYPE, QCA_NAPI_DEF_SCALE_BIN_SHIFT); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1296 | |
| 1297 | if (ret) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1298 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1299 | FL("failed, ret = %d"), ret); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1300 | |
| 1301 | return QDF_STATUS_E_FAILURE; |
| 1302 | } |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 1303 | soc->intr_ctx[i].lro_ctx = qdf_lro_init(); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1304 | } |
| 1305 | |
Venkateswara Swamy Bandaru | 19dc8b2 | 2017-03-13 15:09:24 +0530 | [diff] [blame] | 1306 | hif_configure_ext_group_interrupts(soc->hif_handle); |
| 1307 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1308 | return QDF_STATUS_SUCCESS; |
| 1309 | } |
| 1310 | |
| 1311 | /* |
| 1312 | * dp_soc_interrupt_detach() - Deregister any allocations done for interrupts |
| 1313 | * @txrx_soc: DP SOC handle |
| 1314 | * |
| 1315 | * Return: void |
| 1316 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 1317 | static void dp_soc_interrupt_detach(void *txrx_soc) |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1318 | { |
| 1319 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1320 | int i; |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1321 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1322 | if (soc->intr_mode == DP_INTR_POLL) { |
| 1323 | qdf_timer_stop(&soc->int_timer); |
| 1324 | qdf_timer_free(&soc->int_timer); |
psimha | a079b8c | 2017-08-02 17:27:14 -0700 | [diff] [blame] | 1325 | } else { |
| 1326 | hif_deregister_exec_group(soc->hif_handle, "dp_intr"); |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 1327 | } |
| 1328 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1329 | for (i = 0; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) { |
| 1330 | soc->intr_ctx[i].tx_ring_mask = 0; |
| 1331 | soc->intr_ctx[i].rx_ring_mask = 0; |
| 1332 | soc->intr_ctx[i].rx_mon_ring_mask = 0; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1333 | soc->intr_ctx[i].rx_err_ring_mask = 0; |
| 1334 | soc->intr_ctx[i].rx_wbm_rel_ring_mask = 0; |
| 1335 | soc->intr_ctx[i].reo_status_ring_mask = 0; |
Karunakar Dasineni | ea027c5 | 2017-09-20 16:27:46 -0700 | [diff] [blame] | 1336 | soc->intr_ctx[i].rxdma2host_ring_mask = 0; |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1337 | soc->intr_ctx[i].host2rxdma_ring_mask = 0; |
Houston Hoffman | 648a918 | 2017-05-21 23:27:50 -0700 | [diff] [blame] | 1338 | |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 1339 | qdf_lro_deinit(soc->intr_ctx[i].lro_ctx); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1340 | } |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1341 | } |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 1342 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1343 | #define AVG_MAX_MPDUS_PER_TID 128 |
| 1344 | #define AVG_TIDS_PER_CLIENT 2 |
| 1345 | #define AVG_FLOWS_PER_TID 2 |
| 1346 | #define AVG_MSDUS_PER_FLOW 128 |
| 1347 | #define AVG_MSDUS_PER_MPDU 4 |
| 1348 | |
| 1349 | /* |
| 1350 | * Allocate and setup link descriptor pool that will be used by HW for |
| 1351 | * various link and queue descriptors and managed by WBM |
| 1352 | */ |
| 1353 | static int dp_hw_link_desc_pool_setup(struct dp_soc *soc) |
| 1354 | { |
| 1355 | int link_desc_size = hal_get_link_desc_size(soc->hal_soc); |
| 1356 | int link_desc_align = hal_get_link_desc_align(soc->hal_soc); |
| 1357 | uint32_t max_clients = wlan_cfg_get_max_clients(soc->wlan_cfg_ctx); |
| 1358 | uint32_t num_mpdus_per_link_desc = |
| 1359 | hal_num_mpdus_per_link_desc(soc->hal_soc); |
| 1360 | uint32_t num_msdus_per_link_desc = |
| 1361 | hal_num_msdus_per_link_desc(soc->hal_soc); |
| 1362 | uint32_t num_mpdu_links_per_queue_desc = |
| 1363 | hal_num_mpdu_links_per_queue_desc(soc->hal_soc); |
| 1364 | uint32_t max_alloc_size = wlan_cfg_max_alloc_size(soc->wlan_cfg_ctx); |
| 1365 | uint32_t total_link_descs, total_mem_size; |
| 1366 | uint32_t num_mpdu_link_descs, num_mpdu_queue_descs; |
| 1367 | uint32_t num_tx_msdu_link_descs, num_rx_msdu_link_descs; |
| 1368 | uint32_t num_link_desc_banks; |
| 1369 | uint32_t last_bank_size = 0; |
| 1370 | uint32_t entry_size, num_entries; |
| 1371 | int i; |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1372 | uint32_t desc_id = 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1373 | |
| 1374 | /* Only Tx queue descriptors are allocated from common link descriptor |
| 1375 | * pool Rx queue descriptors are not included in this because (REO queue |
| 1376 | * extension descriptors) they are expected to be allocated contiguously |
| 1377 | * with REO queue descriptors |
| 1378 | */ |
| 1379 | num_mpdu_link_descs = (max_clients * AVG_TIDS_PER_CLIENT * |
| 1380 | AVG_MAX_MPDUS_PER_TID) / num_mpdus_per_link_desc; |
| 1381 | |
| 1382 | num_mpdu_queue_descs = num_mpdu_link_descs / |
| 1383 | num_mpdu_links_per_queue_desc; |
| 1384 | |
| 1385 | num_tx_msdu_link_descs = (max_clients * AVG_TIDS_PER_CLIENT * |
| 1386 | AVG_FLOWS_PER_TID * AVG_MSDUS_PER_FLOW) / |
| 1387 | num_msdus_per_link_desc; |
| 1388 | |
| 1389 | num_rx_msdu_link_descs = (max_clients * AVG_TIDS_PER_CLIENT * |
| 1390 | AVG_MAX_MPDUS_PER_TID * AVG_MSDUS_PER_MPDU) / 6; |
| 1391 | |
| 1392 | num_entries = num_mpdu_link_descs + num_mpdu_queue_descs + |
| 1393 | num_tx_msdu_link_descs + num_rx_msdu_link_descs; |
| 1394 | |
| 1395 | /* Round up to power of 2 */ |
| 1396 | total_link_descs = 1; |
| 1397 | while (total_link_descs < num_entries) |
| 1398 | total_link_descs <<= 1; |
| 1399 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1400 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
| 1401 | FL("total_link_descs: %u, link_desc_size: %d"), |
| 1402 | total_link_descs, link_desc_size); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1403 | total_mem_size = total_link_descs * link_desc_size; |
| 1404 | |
| 1405 | total_mem_size += link_desc_align; |
| 1406 | |
| 1407 | if (total_mem_size <= max_alloc_size) { |
| 1408 | num_link_desc_banks = 0; |
| 1409 | last_bank_size = total_mem_size; |
| 1410 | } else { |
| 1411 | num_link_desc_banks = (total_mem_size) / |
| 1412 | (max_alloc_size - link_desc_align); |
| 1413 | last_bank_size = total_mem_size % |
| 1414 | (max_alloc_size - link_desc_align); |
| 1415 | } |
| 1416 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1417 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
| 1418 | FL("total_mem_size: %d, num_link_desc_banks: %u"), |
| 1419 | total_mem_size, num_link_desc_banks); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1420 | |
| 1421 | for (i = 0; i < num_link_desc_banks; i++) { |
| 1422 | soc->link_desc_banks[i].base_vaddr_unaligned = |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1423 | qdf_mem_alloc_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1424 | max_alloc_size, |
| 1425 | &(soc->link_desc_banks[i].base_paddr_unaligned)); |
| 1426 | soc->link_desc_banks[i].size = max_alloc_size; |
| 1427 | |
| 1428 | soc->link_desc_banks[i].base_vaddr = (void *)((unsigned long)( |
| 1429 | soc->link_desc_banks[i].base_vaddr_unaligned) + |
| 1430 | ((unsigned long)( |
| 1431 | soc->link_desc_banks[i].base_vaddr_unaligned) % |
| 1432 | link_desc_align)); |
| 1433 | |
| 1434 | soc->link_desc_banks[i].base_paddr = (unsigned long)( |
| 1435 | soc->link_desc_banks[i].base_paddr_unaligned) + |
| 1436 | ((unsigned long)(soc->link_desc_banks[i].base_vaddr) - |
| 1437 | (unsigned long)( |
| 1438 | soc->link_desc_banks[i].base_vaddr_unaligned)); |
| 1439 | |
| 1440 | if (!soc->link_desc_banks[i].base_vaddr_unaligned) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1441 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1442 | FL("Link descriptor memory alloc failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1443 | goto fail; |
| 1444 | } |
| 1445 | } |
| 1446 | |
| 1447 | if (last_bank_size) { |
| 1448 | /* Allocate last bank in case total memory required is not exact |
| 1449 | * multiple of max_alloc_size |
| 1450 | */ |
| 1451 | soc->link_desc_banks[i].base_vaddr_unaligned = |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1452 | qdf_mem_alloc_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1453 | last_bank_size, |
| 1454 | &(soc->link_desc_banks[i].base_paddr_unaligned)); |
| 1455 | soc->link_desc_banks[i].size = last_bank_size; |
| 1456 | |
| 1457 | soc->link_desc_banks[i].base_vaddr = (void *)((unsigned long) |
| 1458 | (soc->link_desc_banks[i].base_vaddr_unaligned) + |
| 1459 | ((unsigned long)( |
| 1460 | soc->link_desc_banks[i].base_vaddr_unaligned) % |
| 1461 | link_desc_align)); |
| 1462 | |
| 1463 | soc->link_desc_banks[i].base_paddr = |
| 1464 | (unsigned long)( |
| 1465 | soc->link_desc_banks[i].base_paddr_unaligned) + |
| 1466 | ((unsigned long)(soc->link_desc_banks[i].base_vaddr) - |
| 1467 | (unsigned long)( |
| 1468 | soc->link_desc_banks[i].base_vaddr_unaligned)); |
| 1469 | } |
| 1470 | |
| 1471 | |
| 1472 | /* Allocate and setup link descriptor idle list for HW internal use */ |
| 1473 | entry_size = hal_srng_get_entrysize(soc->hal_soc, WBM_IDLE_LINK); |
| 1474 | total_mem_size = entry_size * total_link_descs; |
| 1475 | |
| 1476 | if (total_mem_size <= max_alloc_size) { |
| 1477 | void *desc; |
| 1478 | |
| 1479 | if (dp_srng_setup(soc, &soc->wbm_idle_link_ring, |
| 1480 | WBM_IDLE_LINK, 0, 0, total_link_descs)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1481 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1482 | FL("Link desc idle ring setup failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1483 | goto fail; |
| 1484 | } |
| 1485 | |
| 1486 | hal_srng_access_start_unlocked(soc->hal_soc, |
| 1487 | soc->wbm_idle_link_ring.hal_srng); |
| 1488 | |
| 1489 | for (i = 0; i < MAX_LINK_DESC_BANKS && |
| 1490 | soc->link_desc_banks[i].base_paddr; i++) { |
| 1491 | uint32_t num_entries = (soc->link_desc_banks[i].size - |
Karunakar Dasineni | c45b01e | 2017-06-07 11:38:01 -0700 | [diff] [blame] | 1492 | ((unsigned long)( |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1493 | soc->link_desc_banks[i].base_vaddr) - |
| 1494 | (unsigned long)( |
Karunakar Dasineni | c45b01e | 2017-06-07 11:38:01 -0700 | [diff] [blame] | 1495 | soc->link_desc_banks[i].base_vaddr_unaligned))) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1496 | / link_desc_size; |
| 1497 | unsigned long paddr = (unsigned long)( |
| 1498 | soc->link_desc_banks[i].base_paddr); |
| 1499 | |
| 1500 | while (num_entries && (desc = hal_srng_src_get_next( |
| 1501 | soc->hal_soc, |
| 1502 | soc->wbm_idle_link_ring.hal_srng))) { |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1503 | hal_set_link_desc_addr(desc, |
| 1504 | LINK_DESC_COOKIE(desc_id, i), paddr); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1505 | num_entries--; |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1506 | desc_id++; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1507 | paddr += link_desc_size; |
| 1508 | } |
| 1509 | } |
| 1510 | hal_srng_access_end_unlocked(soc->hal_soc, |
| 1511 | soc->wbm_idle_link_ring.hal_srng); |
| 1512 | } else { |
| 1513 | uint32_t num_scatter_bufs; |
| 1514 | uint32_t num_entries_per_buf; |
| 1515 | uint32_t rem_entries; |
| 1516 | uint8_t *scatter_buf_ptr; |
| 1517 | uint16_t scatter_buf_num; |
| 1518 | |
| 1519 | soc->wbm_idle_scatter_buf_size = |
| 1520 | hal_idle_list_scatter_buf_size(soc->hal_soc); |
| 1521 | num_entries_per_buf = hal_idle_scatter_buf_num_entries( |
| 1522 | soc->hal_soc, soc->wbm_idle_scatter_buf_size); |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1523 | num_scatter_bufs = hal_idle_list_num_scatter_bufs( |
| 1524 | soc->hal_soc, total_mem_size, |
| 1525 | soc->wbm_idle_scatter_buf_size); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1526 | |
Shaakir Mohamed | 41323bb | 2018-03-20 15:57:15 -0700 | [diff] [blame] | 1527 | if (num_scatter_bufs > MAX_IDLE_SCATTER_BUFS) { |
| 1528 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 1529 | FL("scatter bufs size out of bounds")); |
| 1530 | goto fail; |
| 1531 | } |
| 1532 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1533 | for (i = 0; i < num_scatter_bufs; i++) { |
| 1534 | soc->wbm_idle_scatter_buf_base_vaddr[i] = |
Shaakir Mohamed | 41323bb | 2018-03-20 15:57:15 -0700 | [diff] [blame] | 1535 | qdf_mem_alloc_consistent(soc->osdev, |
| 1536 | soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1537 | soc->wbm_idle_scatter_buf_size, |
| 1538 | &(soc->wbm_idle_scatter_buf_base_paddr[i])); |
| 1539 | if (soc->wbm_idle_scatter_buf_base_vaddr[i] == NULL) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1540 | QDF_TRACE(QDF_MODULE_ID_DP, |
Shaakir Mohamed | 41323bb | 2018-03-20 15:57:15 -0700 | [diff] [blame] | 1541 | QDF_TRACE_LEVEL_ERROR, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 1542 | FL("Scatter list memory alloc failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1543 | goto fail; |
| 1544 | } |
| 1545 | } |
| 1546 | |
| 1547 | /* Populate idle list scatter buffers with link descriptor |
| 1548 | * pointers |
| 1549 | */ |
| 1550 | scatter_buf_num = 0; |
| 1551 | scatter_buf_ptr = (uint8_t *)( |
| 1552 | soc->wbm_idle_scatter_buf_base_vaddr[scatter_buf_num]); |
| 1553 | rem_entries = num_entries_per_buf; |
| 1554 | |
| 1555 | for (i = 0; i < MAX_LINK_DESC_BANKS && |
| 1556 | soc->link_desc_banks[i].base_paddr; i++) { |
| 1557 | uint32_t num_link_descs = |
| 1558 | (soc->link_desc_banks[i].size - |
Karunakar Dasineni | c45b01e | 2017-06-07 11:38:01 -0700 | [diff] [blame] | 1559 | ((unsigned long)( |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1560 | soc->link_desc_banks[i].base_vaddr) - |
| 1561 | (unsigned long)( |
Karunakar Dasineni | c45b01e | 2017-06-07 11:38:01 -0700 | [diff] [blame] | 1562 | soc->link_desc_banks[i].base_vaddr_unaligned))) |
| 1563 | / link_desc_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1564 | unsigned long paddr = (unsigned long)( |
| 1565 | soc->link_desc_banks[i].base_paddr); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1566 | |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1567 | while (num_link_descs) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1568 | hal_set_link_desc_addr((void *)scatter_buf_ptr, |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1569 | LINK_DESC_COOKIE(desc_id, i), paddr); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1570 | num_link_descs--; |
Karunakar Dasineni | dbaf4be | 2017-07-19 18:12:43 -0700 | [diff] [blame] | 1571 | desc_id++; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1572 | paddr += link_desc_size; |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1573 | rem_entries--; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1574 | if (rem_entries) { |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1575 | scatter_buf_ptr += entry_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1576 | } else { |
| 1577 | rem_entries = num_entries_per_buf; |
| 1578 | scatter_buf_num++; |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1579 | |
| 1580 | if (scatter_buf_num >= num_scatter_bufs) |
| 1581 | break; |
| 1582 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1583 | scatter_buf_ptr = (uint8_t *)( |
| 1584 | soc->wbm_idle_scatter_buf_base_vaddr[ |
| 1585 | scatter_buf_num]); |
| 1586 | } |
| 1587 | } |
| 1588 | } |
| 1589 | /* Setup link descriptor idle list in HW */ |
| 1590 | hal_setup_link_idle_list(soc->hal_soc, |
| 1591 | soc->wbm_idle_scatter_buf_base_paddr, |
| 1592 | soc->wbm_idle_scatter_buf_base_vaddr, |
| 1593 | num_scatter_bufs, soc->wbm_idle_scatter_buf_size, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1594 | (uint32_t)(scatter_buf_ptr - |
Pramod Simha | ccb15fb | 2017-06-19 12:21:13 -0700 | [diff] [blame] | 1595 | (uint8_t *)(soc->wbm_idle_scatter_buf_base_vaddr[ |
| 1596 | scatter_buf_num-1])), total_link_descs); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1597 | } |
| 1598 | return 0; |
| 1599 | |
| 1600 | fail: |
| 1601 | if (soc->wbm_idle_link_ring.hal_srng) { |
| 1602 | dp_srng_cleanup(soc->hal_soc, &soc->wbm_idle_link_ring, |
| 1603 | WBM_IDLE_LINK, 0); |
| 1604 | } |
| 1605 | |
| 1606 | for (i = 0; i < MAX_IDLE_SCATTER_BUFS; i++) { |
| 1607 | if (soc->wbm_idle_scatter_buf_base_vaddr[i]) { |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1608 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1609 | soc->wbm_idle_scatter_buf_size, |
| 1610 | soc->wbm_idle_scatter_buf_base_vaddr[i], |
| 1611 | soc->wbm_idle_scatter_buf_base_paddr[i], 0); |
Karunakar Dasineni | b71ad04 | 2018-01-22 16:50:20 -0800 | [diff] [blame] | 1612 | soc->wbm_idle_scatter_buf_base_vaddr[i] = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1613 | } |
| 1614 | } |
| 1615 | |
| 1616 | for (i = 0; i < MAX_LINK_DESC_BANKS; i++) { |
| 1617 | if (soc->link_desc_banks[i].base_vaddr_unaligned) { |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1618 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1619 | soc->link_desc_banks[i].size, |
| 1620 | soc->link_desc_banks[i].base_vaddr_unaligned, |
| 1621 | soc->link_desc_banks[i].base_paddr_unaligned, |
| 1622 | 0); |
Karunakar Dasineni | b71ad04 | 2018-01-22 16:50:20 -0800 | [diff] [blame] | 1623 | soc->link_desc_banks[i].base_vaddr_unaligned = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1624 | } |
| 1625 | } |
| 1626 | return QDF_STATUS_E_FAILURE; |
| 1627 | } |
| 1628 | |
| 1629 | /* |
| 1630 | * Free link descriptor pool that was setup HW |
| 1631 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 1632 | static void dp_hw_link_desc_pool_cleanup(struct dp_soc *soc) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1633 | { |
| 1634 | int i; |
| 1635 | |
| 1636 | if (soc->wbm_idle_link_ring.hal_srng) { |
Manoj Ekbote | 525bcab | 2017-09-01 17:23:32 -0700 | [diff] [blame] | 1637 | dp_srng_cleanup(soc, &soc->wbm_idle_link_ring, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1638 | WBM_IDLE_LINK, 0); |
| 1639 | } |
| 1640 | |
| 1641 | for (i = 0; i < MAX_IDLE_SCATTER_BUFS; i++) { |
| 1642 | if (soc->wbm_idle_scatter_buf_base_vaddr[i]) { |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1643 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1644 | soc->wbm_idle_scatter_buf_size, |
| 1645 | soc->wbm_idle_scatter_buf_base_vaddr[i], |
| 1646 | soc->wbm_idle_scatter_buf_base_paddr[i], 0); |
Karunakar Dasineni | b71ad04 | 2018-01-22 16:50:20 -0800 | [diff] [blame] | 1647 | soc->wbm_idle_scatter_buf_base_vaddr[i] = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1648 | } |
| 1649 | } |
| 1650 | |
| 1651 | for (i = 0; i < MAX_LINK_DESC_BANKS; i++) { |
| 1652 | if (soc->link_desc_banks[i].base_vaddr_unaligned) { |
Dhanashri Atre | 57e420d | 2016-10-25 21:13:54 -0700 | [diff] [blame] | 1653 | qdf_mem_free_consistent(soc->osdev, soc->osdev->dev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1654 | soc->link_desc_banks[i].size, |
| 1655 | soc->link_desc_banks[i].base_vaddr_unaligned, |
| 1656 | soc->link_desc_banks[i].base_paddr_unaligned, |
| 1657 | 0); |
Karunakar Dasineni | b71ad04 | 2018-01-22 16:50:20 -0800 | [diff] [blame] | 1658 | soc->link_desc_banks[i].base_vaddr_unaligned = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1659 | } |
| 1660 | } |
| 1661 | } |
| 1662 | |
| 1663 | /* TODO: Following should be configurable */ |
| 1664 | #define WBM_RELEASE_RING_SIZE 64 |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1665 | #define TCL_CMD_RING_SIZE 32 |
| 1666 | #define TCL_STATUS_RING_SIZE 32 |
Ajit Pal Singh | d27d746 | 2017-07-07 17:17:43 +0530 | [diff] [blame] | 1667 | #if defined(QCA_WIFI_QCA6290) |
| 1668 | #define REO_DST_RING_SIZE 1024 |
| 1669 | #else |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1670 | #define REO_DST_RING_SIZE 2048 |
Ajit Pal Singh | d27d746 | 2017-07-07 17:17:43 +0530 | [diff] [blame] | 1671 | #endif |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1672 | #define REO_REINJECT_RING_SIZE 32 |
Karunakar Dasineni | d0ea21f | 2017-01-31 22:58:15 -0800 | [diff] [blame] | 1673 | #define RX_RELEASE_RING_SIZE 1024 |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1674 | #define REO_EXCEPTION_RING_SIZE 128 |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1675 | #define REO_CMD_RING_SIZE 64 |
| 1676 | #define REO_STATUS_RING_SIZE 128 |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 1677 | #define RXDMA_BUF_RING_SIZE 1024 |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1678 | #define RXDMA_REFILL_RING_SIZE 4096 |
Kai Chen | ad516ae | 2017-09-08 18:35:47 -0700 | [diff] [blame] | 1679 | #define RXDMA_MONITOR_BUF_RING_SIZE 4096 |
| 1680 | #define RXDMA_MONITOR_DST_RING_SIZE 2048 |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 1681 | #define RXDMA_MONITOR_STATUS_RING_SIZE 1024 |
Karunakar Dasineni | 37995ac | 2018-02-06 12:37:30 -0800 | [diff] [blame] | 1682 | #define RXDMA_MONITOR_DESC_RING_SIZE 4096 |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 1683 | #define RXDMA_ERR_DST_RING_SIZE 1024 |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1684 | |
| 1685 | /* |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1686 | * dp_wds_aging_timer_fn() - Timer callback function for WDS aging |
| 1687 | * @soc: Datapath SOC handle |
| 1688 | * |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 1689 | * This is a timer function used to age out stale AST nodes from |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1690 | * AST table |
| 1691 | */ |
| 1692 | #ifdef FEATURE_WDS |
| 1693 | static void dp_wds_aging_timer_fn(void *soc_hdl) |
| 1694 | { |
| 1695 | struct dp_soc *soc = (struct dp_soc *) soc_hdl; |
| 1696 | struct dp_pdev *pdev; |
| 1697 | struct dp_vdev *vdev; |
| 1698 | struct dp_peer *peer; |
Tallapragada Kalyan | 1c14d5d | 2017-07-26 00:31:35 +0530 | [diff] [blame] | 1699 | struct dp_ast_entry *ase, *temp_ase; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1700 | int i; |
| 1701 | |
| 1702 | qdf_spin_lock_bh(&soc->ast_lock); |
| 1703 | |
| 1704 | for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { |
| 1705 | pdev = soc->pdev_list[i]; |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 1706 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1707 | DP_PDEV_ITERATE_VDEV_LIST(pdev, vdev) { |
| 1708 | DP_VDEV_ITERATE_PEER_LIST(vdev, peer) { |
Tallapragada Kalyan | 1c14d5d | 2017-07-26 00:31:35 +0530 | [diff] [blame] | 1709 | DP_PEER_ITERATE_ASE_LIST(peer, ase, temp_ase) { |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1710 | /* |
| 1711 | * Do not expire static ast entries |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 1712 | * and HM WDS entries |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1713 | */ |
Tallapragada Kalyan | 1f49bff | 2018-04-12 19:21:21 +0530 | [diff] [blame] | 1714 | if (ase->type != CDP_TXRX_AST_TYPE_WDS) |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1715 | continue; |
| 1716 | |
| 1717 | if (ase->is_active) { |
| 1718 | ase->is_active = FALSE; |
| 1719 | continue; |
| 1720 | } |
| 1721 | |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 1722 | DP_STATS_INC(soc, ast.aged_out, 1); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1723 | dp_peer_del_ast(soc, ase); |
| 1724 | } |
| 1725 | } |
| 1726 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 1727 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1728 | } |
| 1729 | |
| 1730 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 1731 | |
| 1732 | if (qdf_atomic_read(&soc->cmn_init_done)) |
| 1733 | qdf_timer_mod(&soc->wds_aging_timer, DP_WDS_AGING_TIMER_DEFAULT_MS); |
| 1734 | } |
| 1735 | |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 1736 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1737 | /* |
| 1738 | * dp_soc_wds_attach() - Setup WDS timer and AST table |
| 1739 | * @soc: Datapath SOC handle |
| 1740 | * |
| 1741 | * Return: None |
| 1742 | */ |
| 1743 | static void dp_soc_wds_attach(struct dp_soc *soc) |
| 1744 | { |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1745 | qdf_timer_init(soc->osdev, &soc->wds_aging_timer, |
| 1746 | dp_wds_aging_timer_fn, (void *)soc, |
| 1747 | QDF_TIMER_TYPE_WAKE_APPS); |
| 1748 | |
| 1749 | qdf_timer_mod(&soc->wds_aging_timer, DP_WDS_AGING_TIMER_DEFAULT_MS); |
| 1750 | } |
| 1751 | |
| 1752 | /* |
| 1753 | * dp_soc_wds_detach() - Detach WDS data structures and timers |
| 1754 | * @txrx_soc: DP SOC handle |
| 1755 | * |
| 1756 | * Return: None |
| 1757 | */ |
| 1758 | static void dp_soc_wds_detach(struct dp_soc *soc) |
| 1759 | { |
| 1760 | qdf_timer_stop(&soc->wds_aging_timer); |
| 1761 | qdf_timer_free(&soc->wds_aging_timer); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1762 | } |
| 1763 | #else |
| 1764 | static void dp_soc_wds_attach(struct dp_soc *soc) |
| 1765 | { |
| 1766 | } |
| 1767 | |
| 1768 | static void dp_soc_wds_detach(struct dp_soc *soc) |
| 1769 | { |
| 1770 | } |
| 1771 | #endif |
| 1772 | |
| 1773 | /* |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 1774 | * dp_soc_reset_ring_map() - Reset cpu ring map |
| 1775 | * @soc: Datapath soc handler |
| 1776 | * |
| 1777 | * This api resets the default cpu ring map |
| 1778 | */ |
| 1779 | |
| 1780 | static void dp_soc_reset_cpu_ring_map(struct dp_soc *soc) |
| 1781 | { |
| 1782 | uint8_t i; |
| 1783 | int nss_config = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); |
| 1784 | |
| 1785 | for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { |
| 1786 | if (nss_config == 1) { |
| 1787 | /* |
| 1788 | * Setting Tx ring map for one nss offloaded radio |
| 1789 | */ |
| 1790 | soc->tx_ring_map[i] = dp_cpu_ring_map[DP_NSS_FIRST_RADIO_OFFLOADED_MAP][i]; |
| 1791 | } else if (nss_config == 2) { |
| 1792 | /* |
| 1793 | * Setting Tx ring for two nss offloaded radios |
| 1794 | */ |
| 1795 | soc->tx_ring_map[i] = dp_cpu_ring_map[DP_NSS_SECOND_RADIO_OFFLOADED_MAP][i]; |
| 1796 | } else { |
| 1797 | /* |
| 1798 | * Setting Tx ring map for all nss offloaded radios |
| 1799 | */ |
| 1800 | soc->tx_ring_map[i] = dp_cpu_ring_map[DP_NSS_ALL_RADIO_OFFLOADED_MAP][i]; |
| 1801 | } |
| 1802 | } |
| 1803 | } |
| 1804 | |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 1805 | /* |
| 1806 | * dp_soc_ring_if_nss_offloaded() - find if ring is offloaded to NSS |
| 1807 | * @dp_soc - DP soc handle |
| 1808 | * @ring_type - ring type |
| 1809 | * @ring_num - ring_num |
| 1810 | * |
| 1811 | * return 0 or 1 |
| 1812 | */ |
| 1813 | static uint8_t dp_soc_ring_if_nss_offloaded(struct dp_soc *soc, enum hal_ring_type ring_type, int ring_num) |
| 1814 | { |
| 1815 | uint8_t nss_config = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); |
| 1816 | uint8_t status = 0; |
| 1817 | |
| 1818 | switch (ring_type) { |
| 1819 | case WBM2SW_RELEASE: |
| 1820 | case REO_DST: |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1821 | case RXDMA_BUF: |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 1822 | status = ((nss_config) & (1 << ring_num)); |
| 1823 | break; |
| 1824 | default: |
| 1825 | break; |
| 1826 | } |
| 1827 | |
| 1828 | return status; |
| 1829 | } |
| 1830 | |
| 1831 | /* |
| 1832 | * dp_soc_reset_intr_mask() - reset interrupt mask |
| 1833 | * @dp_soc - DP Soc handle |
| 1834 | * |
| 1835 | * Return: Return void |
| 1836 | */ |
| 1837 | static void dp_soc_reset_intr_mask(struct dp_soc *soc) |
| 1838 | { |
| 1839 | uint8_t j; |
| 1840 | int *grp_mask = NULL; |
| 1841 | int group_number, mask, num_ring; |
| 1842 | |
| 1843 | /* number of tx ring */ |
| 1844 | num_ring = wlan_cfg_num_tcl_data_rings(soc->wlan_cfg_ctx); |
| 1845 | |
| 1846 | /* |
| 1847 | * group mask for tx completion ring. |
| 1848 | */ |
| 1849 | grp_mask = &soc->wlan_cfg_ctx->int_tx_ring_mask[0]; |
| 1850 | |
| 1851 | /* loop and reset the mask for only offloaded ring */ |
| 1852 | for (j = 0; j < num_ring; j++) { |
| 1853 | if (!dp_soc_ring_if_nss_offloaded(soc, WBM2SW_RELEASE, j)) { |
| 1854 | continue; |
| 1855 | } |
| 1856 | |
| 1857 | /* |
| 1858 | * Group number corresponding to tx offloaded ring. |
| 1859 | */ |
| 1860 | group_number = dp_srng_find_ring_in_mask(j, grp_mask); |
| 1861 | if (group_number < 0) { |
| 1862 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1863 | 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] | 1864 | WBM2SW_RELEASE, j); |
| 1865 | return; |
| 1866 | } |
| 1867 | |
| 1868 | /* reset the tx mask for offloaded ring */ |
| 1869 | mask = wlan_cfg_get_tx_ring_mask(soc->wlan_cfg_ctx, group_number); |
| 1870 | mask &= (~(1 << j)); |
| 1871 | |
| 1872 | /* |
| 1873 | * reset the interrupt mask for offloaded ring. |
| 1874 | */ |
| 1875 | wlan_cfg_set_tx_ring_mask(soc->wlan_cfg_ctx, group_number, mask); |
| 1876 | } |
| 1877 | |
| 1878 | /* number of rx rings */ |
| 1879 | num_ring = wlan_cfg_num_reo_dest_rings(soc->wlan_cfg_ctx); |
| 1880 | |
| 1881 | /* |
| 1882 | * group mask for reo destination ring. |
| 1883 | */ |
| 1884 | grp_mask = &soc->wlan_cfg_ctx->int_rx_ring_mask[0]; |
| 1885 | |
| 1886 | /* loop and reset the mask for only offloaded ring */ |
| 1887 | for (j = 0; j < num_ring; j++) { |
| 1888 | if (!dp_soc_ring_if_nss_offloaded(soc, REO_DST, j)) { |
| 1889 | continue; |
| 1890 | } |
| 1891 | |
| 1892 | /* |
| 1893 | * Group number corresponding to rx offloaded ring. |
| 1894 | */ |
| 1895 | group_number = dp_srng_find_ring_in_mask(j, grp_mask); |
| 1896 | if (group_number < 0) { |
| 1897 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1898 | 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] | 1899 | REO_DST, j); |
| 1900 | return; |
| 1901 | } |
| 1902 | |
| 1903 | /* set the interrupt mask for offloaded ring */ |
| 1904 | mask = wlan_cfg_get_rx_ring_mask(soc->wlan_cfg_ctx, group_number); |
| 1905 | mask &= (~(1 << j)); |
| 1906 | |
| 1907 | /* |
| 1908 | * set the interrupt mask to zero for rx offloaded radio. |
| 1909 | */ |
| 1910 | wlan_cfg_set_rx_ring_mask(soc->wlan_cfg_ctx, group_number, mask); |
| 1911 | } |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 1912 | |
| 1913 | /* |
| 1914 | * group mask for Rx buffer refill ring |
| 1915 | */ |
| 1916 | grp_mask = &soc->wlan_cfg_ctx->int_host2rxdma_ring_mask[0]; |
| 1917 | |
| 1918 | /* loop and reset the mask for only offloaded ring */ |
| 1919 | for (j = 0; j < MAX_PDEV_CNT; j++) { |
| 1920 | if (!dp_soc_ring_if_nss_offloaded(soc, RXDMA_BUF, j)) { |
| 1921 | continue; |
| 1922 | } |
| 1923 | |
| 1924 | /* |
| 1925 | * Group number corresponding to rx offloaded ring. |
| 1926 | */ |
| 1927 | group_number = dp_srng_find_ring_in_mask(j, grp_mask); |
| 1928 | if (group_number < 0) { |
| 1929 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 1930 | FL("ring not part of any group; ring_type: %d,ring_num %d"), |
| 1931 | REO_DST, j); |
| 1932 | return; |
| 1933 | } |
| 1934 | |
| 1935 | /* set the interrupt mask for offloaded ring */ |
| 1936 | mask = wlan_cfg_get_host2rxdma_ring_mask(soc->wlan_cfg_ctx, |
| 1937 | group_number); |
| 1938 | mask &= (~(1 << j)); |
| 1939 | |
| 1940 | /* |
| 1941 | * set the interrupt mask to zero for rx offloaded radio. |
| 1942 | */ |
| 1943 | wlan_cfg_set_host2rxdma_ring_mask(soc->wlan_cfg_ctx, |
| 1944 | group_number, mask); |
| 1945 | } |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 1946 | } |
| 1947 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 1948 | #ifdef IPA_OFFLOAD |
| 1949 | /** |
| 1950 | * dp_reo_remap_config() - configure reo remap register value based |
| 1951 | * nss configuration. |
| 1952 | * based on offload_radio value below remap configuration |
| 1953 | * get applied. |
| 1954 | * 0 - both Radios handled by host (remap rings 1, 2, 3 & 4) |
| 1955 | * 1 - 1st Radio handled by NSS (remap rings 2, 3 & 4) |
| 1956 | * 2 - 2nd Radio handled by NSS (remap rings 1, 2 & 4) |
| 1957 | * 3 - both Radios handled by NSS (remap not required) |
| 1958 | * 4 - IPA OFFLOAD enabled (remap rings 1,2 & 3) |
| 1959 | * |
| 1960 | * @remap1: output parameter indicates reo remap 1 register value |
| 1961 | * @remap2: output parameter indicates reo remap 2 register value |
| 1962 | * Return: bool type, true if remap is configured else false. |
| 1963 | */ |
| 1964 | static bool dp_reo_remap_config(struct dp_soc *soc, |
| 1965 | uint32_t *remap1, |
| 1966 | uint32_t *remap2) |
| 1967 | { |
| 1968 | |
| 1969 | *remap1 = ((0x1 << 0) | (0x2 << 3) | (0x3 << 6) | (0x1 << 9) | |
| 1970 | (0x2 << 12) | (0x3 << 15) | (0x1 << 18) | (0x2 << 21)) << 8; |
| 1971 | |
| 1972 | *remap2 = ((0x3 << 0) | (0x1 << 3) | (0x2 << 6) | (0x3 << 9) | |
| 1973 | (0x1 << 12) | (0x2 << 15) | (0x3 << 18) | (0x1 << 21)) << 8; |
| 1974 | |
| 1975 | return true; |
| 1976 | } |
| 1977 | #else |
| 1978 | static bool dp_reo_remap_config(struct dp_soc *soc, |
| 1979 | uint32_t *remap1, |
| 1980 | uint32_t *remap2) |
| 1981 | { |
| 1982 | uint8_t offload_radio = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); |
| 1983 | |
| 1984 | switch (offload_radio) { |
| 1985 | case 0: |
| 1986 | *remap1 = ((0x1 << 0) | (0x2 << 3) | (0x3 << 6) | |
| 1987 | (0x4 << 9) | (0x1 << 12) | (0x2 << 15) | |
| 1988 | (0x3 << 18) | (0x4 << 21)) << 8; |
| 1989 | |
| 1990 | *remap2 = ((0x1 << 0) | (0x2 << 3) | (0x3 << 6) | |
| 1991 | (0x4 << 9) | (0x1 << 12) | (0x2 << 15) | |
| 1992 | (0x3 << 18) | (0x4 << 21)) << 8; |
| 1993 | break; |
| 1994 | |
| 1995 | case 1: |
| 1996 | *remap1 = ((0x2 << 0) | (0x3 << 3) | (0x4 << 6) | |
| 1997 | (0x2 << 9) | (0x3 << 12) | (0x4 << 15) | |
| 1998 | (0x2 << 18) | (0x3 << 21)) << 8; |
| 1999 | |
| 2000 | *remap2 = ((0x4 << 0) | (0x2 << 3) | (0x3 << 6) | |
| 2001 | (0x4 << 9) | (0x2 << 12) | (0x3 << 15) | |
| 2002 | (0x4 << 18) | (0x2 << 21)) << 8; |
| 2003 | break; |
| 2004 | |
| 2005 | case 2: |
| 2006 | *remap1 = ((0x1 << 0) | (0x3 << 3) | (0x4 << 6) | |
| 2007 | (0x1 << 9) | (0x3 << 12) | (0x4 << 15) | |
| 2008 | (0x1 << 18) | (0x3 << 21)) << 8; |
| 2009 | |
| 2010 | *remap2 = ((0x4 << 0) | (0x1 << 3) | (0x3 << 6) | |
| 2011 | (0x4 << 9) | (0x1 << 12) | (0x3 << 15) | |
| 2012 | (0x4 << 18) | (0x1 << 21)) << 8; |
| 2013 | break; |
| 2014 | |
| 2015 | case 3: |
| 2016 | /* return false if both radios are offloaded to NSS */ |
| 2017 | return false; |
| 2018 | } |
| 2019 | return true; |
| 2020 | } |
| 2021 | #endif |
| 2022 | |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2023 | /* |
Aniruddha Paul | 91dfd50 | 2018-01-08 11:24:34 +0530 | [diff] [blame] | 2024 | * dp_reo_frag_dst_set() - configure reo register to set the |
| 2025 | * fragment destination ring |
| 2026 | * @soc : Datapath soc |
| 2027 | * @frag_dst_ring : output parameter to set fragment destination ring |
| 2028 | * |
| 2029 | * Based on offload_radio below fragment destination rings is selected |
| 2030 | * 0 - TCL |
| 2031 | * 1 - SW1 |
| 2032 | * 2 - SW2 |
| 2033 | * 3 - SW3 |
| 2034 | * 4 - SW4 |
| 2035 | * 5 - Release |
| 2036 | * 6 - FW |
| 2037 | * 7 - alternate select |
| 2038 | * |
| 2039 | * return: void |
| 2040 | */ |
| 2041 | static void dp_reo_frag_dst_set(struct dp_soc *soc, uint8_t *frag_dst_ring) |
| 2042 | { |
| 2043 | uint8_t offload_radio = wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx); |
| 2044 | |
| 2045 | switch (offload_radio) { |
| 2046 | case 0: |
| 2047 | *frag_dst_ring = HAL_SRNG_REO_EXCEPTION; |
| 2048 | break; |
| 2049 | case 3: |
| 2050 | *frag_dst_ring = HAL_SRNG_REO_ALTERNATE_SELECT; |
| 2051 | break; |
| 2052 | default: |
| 2053 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2054 | FL("dp_reo_frag_dst_set invalid offload radio config")); |
| 2055 | break; |
| 2056 | } |
| 2057 | } |
| 2058 | |
| 2059 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2060 | * dp_soc_cmn_setup() - Common SoC level initializion |
| 2061 | * @soc: Datapath SOC handle |
| 2062 | * |
| 2063 | * This is an internal function used to setup common SOC data structures, |
| 2064 | * to be called from PDEV attach after receiving HW mode capabilities from FW |
| 2065 | */ |
| 2066 | static int dp_soc_cmn_setup(struct dp_soc *soc) |
| 2067 | { |
| 2068 | int i; |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2069 | struct hal_reo_params reo_params; |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2070 | int tx_ring_size; |
| 2071 | int tx_comp_ring_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2072 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 2073 | if (qdf_atomic_read(&soc->cmn_init_done)) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2074 | return 0; |
| 2075 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2076 | if (dp_hw_link_desc_pool_setup(soc)) |
| 2077 | goto fail1; |
| 2078 | |
| 2079 | /* Setup SRNG rings */ |
| 2080 | /* Common rings */ |
| 2081 | if (dp_srng_setup(soc, &soc->wbm_desc_rel_ring, SW2WBM_RELEASE, 0, 0, |
| 2082 | WBM_RELEASE_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2083 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2084 | FL("dp_srng_setup failed for wbm_desc_rel_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2085 | goto fail1; |
| 2086 | } |
| 2087 | |
| 2088 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 2089 | soc->num_tcl_data_rings = 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2090 | /* Tx data rings */ |
| 2091 | if (!wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { |
| 2092 | soc->num_tcl_data_rings = |
| 2093 | wlan_cfg_num_tcl_data_rings(soc->wlan_cfg_ctx); |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2094 | tx_comp_ring_size = |
| 2095 | wlan_cfg_tx_comp_ring_size(soc->wlan_cfg_ctx); |
| 2096 | tx_ring_size = |
| 2097 | wlan_cfg_tx_ring_size(soc->wlan_cfg_ctx); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2098 | for (i = 0; i < soc->num_tcl_data_rings; i++) { |
| 2099 | if (dp_srng_setup(soc, &soc->tcl_data_ring[i], |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2100 | TCL_DATA, i, 0, tx_ring_size)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2101 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2102 | QDF_TRACE_LEVEL_ERROR, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2103 | FL("dp_srng_setup failed for tcl_data_ring[%d]"), i); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2104 | goto fail1; |
| 2105 | } |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2106 | /* |
| 2107 | * TBD: Set IPA WBM ring size with ini IPA UC tx buffer |
| 2108 | * count |
| 2109 | */ |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2110 | if (dp_srng_setup(soc, &soc->tx_comp_ring[i], |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2111 | WBM2SW_RELEASE, i, 0, tx_comp_ring_size)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2112 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2113 | QDF_TRACE_LEVEL_ERROR, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2114 | FL("dp_srng_setup failed for tx_comp_ring[%d]"), i); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2115 | goto fail1; |
| 2116 | } |
| 2117 | } |
| 2118 | } else { |
| 2119 | /* This will be incremented during per pdev ring setup */ |
| 2120 | soc->num_tcl_data_rings = 0; |
| 2121 | } |
| 2122 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 2123 | if (dp_tx_soc_attach(soc)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2124 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2125 | FL("dp_tx_soc_attach failed")); |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 2126 | goto fail1; |
| 2127 | } |
| 2128 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2129 | /* TCL command and status rings */ |
| 2130 | if (dp_srng_setup(soc, &soc->tcl_cmd_ring, TCL_CMD, 0, 0, |
| 2131 | TCL_CMD_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2132 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2133 | FL("dp_srng_setup failed for tcl_cmd_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2134 | goto fail1; |
| 2135 | } |
| 2136 | |
| 2137 | if (dp_srng_setup(soc, &soc->tcl_status_ring, TCL_STATUS, 0, 0, |
| 2138 | TCL_STATUS_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2139 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2140 | FL("dp_srng_setup failed for tcl_status_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2141 | goto fail1; |
| 2142 | } |
| 2143 | |
| 2144 | |
| 2145 | /* TBD: call dp_tx_init to setup Tx SW descriptors and MSDU extension |
| 2146 | * descriptors |
| 2147 | */ |
| 2148 | |
| 2149 | /* Rx data rings */ |
| 2150 | if (!wlan_cfg_per_pdev_rx_ring(soc->wlan_cfg_ctx)) { |
| 2151 | soc->num_reo_dest_rings = |
| 2152 | wlan_cfg_num_reo_dest_rings(soc->wlan_cfg_ctx); |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2153 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 2154 | QDF_TRACE_LEVEL_ERROR, |
| 2155 | FL("num_reo_dest_rings %d\n"), soc->num_reo_dest_rings); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2156 | for (i = 0; i < soc->num_reo_dest_rings; i++) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2157 | if (dp_srng_setup(soc, &soc->reo_dest_ring[i], REO_DST, |
| 2158 | i, 0, REO_DST_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2159 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2160 | QDF_TRACE_LEVEL_ERROR, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2161 | FL("dp_srng_setup failed for reo_dest_ring[%d]"), i); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2162 | goto fail1; |
| 2163 | } |
| 2164 | } |
| 2165 | } else { |
| 2166 | /* This will be incremented during per pdev ring setup */ |
| 2167 | soc->num_reo_dest_rings = 0; |
| 2168 | } |
| 2169 | |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 2170 | /* LMAC RxDMA to SW Rings configuration */ |
| 2171 | if (!wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { |
| 2172 | /* Only valid for MCL */ |
| 2173 | struct dp_pdev *pdev = soc->pdev_list[0]; |
| 2174 | |
| 2175 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) { |
| 2176 | if (dp_srng_setup(soc, &pdev->rxdma_err_dst_ring[i], |
| 2177 | RXDMA_DST, 0, i, RXDMA_ERR_DST_RING_SIZE)) { |
| 2178 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 2179 | QDF_TRACE_LEVEL_ERROR, |
| 2180 | FL("dp_srng_setup failed for rxdma_err_dst_ring")); |
| 2181 | goto fail1; |
| 2182 | } |
| 2183 | } |
| 2184 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2185 | /* TBD: call dp_rx_init to setup Rx SW descriptors */ |
| 2186 | |
| 2187 | /* REO reinjection ring */ |
| 2188 | if (dp_srng_setup(soc, &soc->reo_reinject_ring, REO_REINJECT, 0, 0, |
| 2189 | REO_REINJECT_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2190 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2191 | FL("dp_srng_setup failed for reo_reinject_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2192 | goto fail1; |
| 2193 | } |
| 2194 | |
| 2195 | |
| 2196 | /* Rx release ring */ |
| 2197 | if (dp_srng_setup(soc, &soc->rx_rel_ring, WBM2SW_RELEASE, 3, 0, |
| 2198 | RX_RELEASE_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2199 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2200 | FL("dp_srng_setup failed for rx_rel_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2201 | goto fail1; |
| 2202 | } |
| 2203 | |
| 2204 | |
| 2205 | /* Rx exception ring */ |
| 2206 | if (dp_srng_setup(soc, &soc->reo_exception_ring, REO_EXCEPTION, 0, |
| 2207 | MAX_REO_DEST_RINGS, REO_EXCEPTION_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2208 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2209 | FL("dp_srng_setup failed for reo_exception_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2210 | goto fail1; |
| 2211 | } |
| 2212 | |
| 2213 | |
| 2214 | /* REO command and status rings */ |
| 2215 | if (dp_srng_setup(soc, &soc->reo_cmd_ring, REO_CMD, 0, 0, |
| 2216 | REO_CMD_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2217 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2218 | FL("dp_srng_setup failed for reo_cmd_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2219 | goto fail1; |
| 2220 | } |
| 2221 | |
Manoj Ekbote | 4f0c6b1 | 2016-10-30 16:01:38 -0700 | [diff] [blame] | 2222 | hal_reo_init_cmd_ring(soc->hal_soc, soc->reo_cmd_ring.hal_srng); |
| 2223 | TAILQ_INIT(&soc->rx.reo_cmd_list); |
| 2224 | qdf_spinlock_create(&soc->rx.reo_cmd_lock); |
| 2225 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2226 | if (dp_srng_setup(soc, &soc->reo_status_ring, REO_STATUS, 0, 0, |
| 2227 | REO_STATUS_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2228 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2229 | FL("dp_srng_setup failed for reo_status_ring")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2230 | goto fail1; |
| 2231 | } |
| 2232 | |
Yun Park | 92af713 | 2017-09-13 16:33:35 -0700 | [diff] [blame] | 2233 | qdf_spinlock_create(&soc->ast_lock); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 2234 | dp_soc_wds_attach(soc); |
| 2235 | |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2236 | /* Reset the cpu ring map if radio is NSS offloaded */ |
| 2237 | if (wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx)) { |
| 2238 | dp_soc_reset_cpu_ring_map(soc); |
Aniruddha Paul | e3a0334 | 2017-09-19 16:42:10 +0530 | [diff] [blame] | 2239 | dp_soc_reset_intr_mask(soc); |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2240 | } |
| 2241 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2242 | /* Setup HW REO */ |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2243 | qdf_mem_zero(&reo_params, sizeof(reo_params)); |
| 2244 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 2245 | if (wlan_cfg_is_rx_hash_enabled(soc->wlan_cfg_ctx)) { |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2246 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 2247 | /* |
| 2248 | * Reo ring remap is not required if both radios |
| 2249 | * are offloaded to NSS |
| 2250 | */ |
| 2251 | if (!dp_reo_remap_config(soc, |
| 2252 | &reo_params.remap1, |
| 2253 | &reo_params.remap2)) |
| 2254 | goto out; |
| 2255 | |
| 2256 | reo_params.rx_hash_enabled = true; |
| 2257 | } |
| 2258 | |
psimha | fc2f91b | 2018-01-10 15:30:03 -0800 | [diff] [blame] | 2259 | /* setup the global rx defrag waitlist */ |
| 2260 | TAILQ_INIT(&soc->rx.defrag.waitlist); |
| 2261 | soc->rx.defrag.timeout_ms = |
| 2262 | wlan_cfg_get_rx_defrag_min_timeout(soc->wlan_cfg_ctx); |
| 2263 | soc->rx.flags.defrag_timeout_check = |
| 2264 | wlan_cfg_get_defrag_timeout_check(soc->wlan_cfg_ctx); |
Lin Bai | f1c577e | 2018-05-22 20:45:42 +0800 | [diff] [blame] | 2265 | qdf_spinlock_create(&soc->rx.defrag.defrag_lock); |
psimha | fc2f91b | 2018-01-10 15:30:03 -0800 | [diff] [blame] | 2266 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 2267 | out: |
Aniruddha Paul | 91dfd50 | 2018-01-08 11:24:34 +0530 | [diff] [blame] | 2268 | /* |
| 2269 | * set the fragment destination ring |
| 2270 | */ |
| 2271 | dp_reo_frag_dst_set(soc, &reo_params.frag_dst_ring); |
| 2272 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2273 | hal_reo_setup(soc->hal_soc, &reo_params); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2274 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 2275 | qdf_atomic_set(&soc->cmn_init_done, 1); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2276 | qdf_nbuf_queue_init(&soc->htt_stats.msg); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2277 | return 0; |
| 2278 | fail1: |
| 2279 | /* |
| 2280 | * Cleanup will be done as part of soc_detach, which will |
| 2281 | * be called on pdev attach failure |
| 2282 | */ |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2283 | return QDF_STATUS_E_FAILURE; |
| 2284 | } |
| 2285 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2286 | 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] | 2287 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2288 | static void dp_lro_hash_setup(struct dp_soc *soc) |
| 2289 | { |
| 2290 | struct cdp_lro_hash_config lro_hash; |
| 2291 | |
| 2292 | if (!wlan_cfg_is_lro_enabled(soc->wlan_cfg_ctx) && |
| 2293 | !wlan_cfg_is_rx_hash_enabled(soc->wlan_cfg_ctx)) { |
| 2294 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2295 | FL("LRO disabled RX hash disabled")); |
| 2296 | return; |
| 2297 | } |
| 2298 | |
| 2299 | qdf_mem_zero(&lro_hash, sizeof(lro_hash)); |
| 2300 | |
| 2301 | if (wlan_cfg_is_lro_enabled(soc->wlan_cfg_ctx)) { |
| 2302 | lro_hash.lro_enable = 1; |
| 2303 | lro_hash.tcp_flag = QDF_TCPHDR_ACK; |
| 2304 | lro_hash.tcp_flag_mask = QDF_TCPHDR_FIN | QDF_TCPHDR_SYN | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 2305 | QDF_TCPHDR_RST | QDF_TCPHDR_ACK | QDF_TCPHDR_URG | |
| 2306 | QDF_TCPHDR_ECE | QDF_TCPHDR_CWR; |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2307 | } |
| 2308 | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 2309 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, FL("enabled")); |
| 2310 | qdf_get_random_bytes(lro_hash.toeplitz_hash_ipv4, |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2311 | (sizeof(lro_hash.toeplitz_hash_ipv4[0]) * |
| 2312 | LRO_IPV4_SEED_ARR_SZ)); |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2313 | qdf_get_random_bytes(lro_hash.toeplitz_hash_ipv6, |
| 2314 | (sizeof(lro_hash.toeplitz_hash_ipv6[0]) * |
| 2315 | LRO_IPV6_SEED_ARR_SZ)); |
| 2316 | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 2317 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
| 2318 | "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] | 2319 | lro_hash.lro_enable, lro_hash.tcp_flag, |
| 2320 | lro_hash.tcp_flag_mask); |
| 2321 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2322 | qdf_trace_hex_dump(QDF_MODULE_ID_DP, |
| 2323 | QDF_TRACE_LEVEL_ERROR, |
| 2324 | (void *)lro_hash.toeplitz_hash_ipv4, |
| 2325 | (sizeof(lro_hash.toeplitz_hash_ipv4[0]) * |
| 2326 | LRO_IPV4_SEED_ARR_SZ)); |
| 2327 | |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2328 | qdf_trace_hex_dump(QDF_MODULE_ID_DP, |
| 2329 | QDF_TRACE_LEVEL_ERROR, |
| 2330 | (void *)lro_hash.toeplitz_hash_ipv6, |
| 2331 | (sizeof(lro_hash.toeplitz_hash_ipv6[0]) * |
| 2332 | LRO_IPV6_SEED_ARR_SZ)); |
| 2333 | |
| 2334 | qdf_assert(soc->cdp_soc.ol_ops->lro_hash_config); |
| 2335 | |
| 2336 | if (soc->cdp_soc.ol_ops->lro_hash_config) |
| 2337 | (void)soc->cdp_soc.ol_ops->lro_hash_config |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 2338 | (soc->ctrl_psoc, &lro_hash); |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 2339 | } |
| 2340 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2341 | /* |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2342 | * dp_rxdma_ring_setup() - configure the RX DMA rings |
| 2343 | * @soc: data path SoC handle |
| 2344 | * @pdev: Physical device handle |
| 2345 | * |
| 2346 | * Return: 0 - success, > 0 - failure |
| 2347 | */ |
| 2348 | #ifdef QCA_HOST2FW_RXBUF_RING |
| 2349 | static int dp_rxdma_ring_setup(struct dp_soc *soc, |
| 2350 | struct dp_pdev *pdev) |
| 2351 | { |
| 2352 | int max_mac_rings = |
| 2353 | wlan_cfg_get_num_mac_rings |
| 2354 | (pdev->wlan_cfg_ctx); |
| 2355 | int i; |
| 2356 | |
| 2357 | for (i = 0; i < max_mac_rings; i++) { |
| 2358 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2359 | "%s: pdev_id %d mac_id %d\n", |
| 2360 | __func__, pdev->pdev_id, i); |
| 2361 | if (dp_srng_setup(soc, &pdev->rx_mac_buf_ring[i], |
| 2362 | RXDMA_BUF, 1, i, RXDMA_BUF_RING_SIZE)) { |
| 2363 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 2364 | QDF_TRACE_LEVEL_ERROR, |
| 2365 | FL("failed rx mac ring setup")); |
| 2366 | return QDF_STATUS_E_FAILURE; |
| 2367 | } |
| 2368 | } |
| 2369 | return QDF_STATUS_SUCCESS; |
| 2370 | } |
| 2371 | #else |
| 2372 | static int dp_rxdma_ring_setup(struct dp_soc *soc, |
| 2373 | struct dp_pdev *pdev) |
| 2374 | { |
| 2375 | return QDF_STATUS_SUCCESS; |
| 2376 | } |
| 2377 | #endif |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 2378 | |
| 2379 | /** |
| 2380 | * dp_dscp_tid_map_setup(): Initialize the dscp-tid maps |
| 2381 | * @pdev - DP_PDEV handle |
| 2382 | * |
| 2383 | * Return: void |
| 2384 | */ |
| 2385 | static inline void |
| 2386 | dp_dscp_tid_map_setup(struct dp_pdev *pdev) |
| 2387 | { |
| 2388 | uint8_t map_id; |
| 2389 | for (map_id = 0; map_id < DP_MAX_TID_MAPS; map_id++) { |
| 2390 | qdf_mem_copy(pdev->dscp_tid_map[map_id], default_dscp_tid_map, |
| 2391 | sizeof(default_dscp_tid_map)); |
| 2392 | } |
| 2393 | for (map_id = 0; map_id < HAL_MAX_HW_DSCP_TID_MAPS; map_id++) { |
| 2394 | hal_tx_set_dscp_tid_map(pdev->soc->hal_soc, |
| 2395 | pdev->dscp_tid_map[map_id], |
| 2396 | map_id); |
| 2397 | } |
| 2398 | } |
| 2399 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2400 | #ifdef QCA_SUPPORT_SON |
| 2401 | /** |
| 2402 | * dp_mark_peer_inact(): Update peer inactivity status |
| 2403 | * @peer_handle - datapath peer handle |
| 2404 | * |
| 2405 | * Return: void |
| 2406 | */ |
| 2407 | void dp_mark_peer_inact(void *peer_handle, bool inactive) |
| 2408 | { |
| 2409 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 2410 | struct dp_pdev *pdev; |
| 2411 | struct dp_soc *soc; |
| 2412 | bool inactive_old; |
| 2413 | |
| 2414 | if (!peer) |
| 2415 | return; |
| 2416 | |
| 2417 | pdev = peer->vdev->pdev; |
| 2418 | soc = pdev->soc; |
| 2419 | |
| 2420 | inactive_old = peer->peer_bs_inact_flag == 1; |
| 2421 | if (!inactive) |
| 2422 | peer->peer_bs_inact = soc->pdev_bs_inact_reload; |
| 2423 | peer->peer_bs_inact_flag = inactive ? 1 : 0; |
| 2424 | |
| 2425 | if (inactive_old != inactive) { |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2426 | /** |
| 2427 | * Note: a node lookup can happen in RX datapath context |
| 2428 | * when a node changes from inactive to active (at most once |
| 2429 | * per inactivity timeout threshold) |
| 2430 | */ |
| 2431 | if (soc->cdp_soc.ol_ops->record_act_change) { |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 2432 | soc->cdp_soc.ol_ops->record_act_change( |
| 2433 | (void *)pdev->ctrl_pdev, |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2434 | peer->mac_addr.raw, !inactive); |
| 2435 | } |
| 2436 | } |
| 2437 | } |
| 2438 | |
| 2439 | /** |
| 2440 | * dp_txrx_peer_find_inact_timeout_handler(): Inactivity timeout function |
| 2441 | * |
| 2442 | * Periodically checks the inactivity status |
| 2443 | */ |
| 2444 | static os_timer_func(dp_txrx_peer_find_inact_timeout_handler) |
| 2445 | { |
| 2446 | struct dp_pdev *pdev; |
| 2447 | struct dp_vdev *vdev; |
| 2448 | struct dp_peer *peer; |
| 2449 | struct dp_soc *soc; |
| 2450 | int i; |
| 2451 | |
| 2452 | OS_GET_TIMER_ARG(soc, struct dp_soc *); |
| 2453 | |
| 2454 | qdf_spin_lock(&soc->peer_ref_mutex); |
| 2455 | |
| 2456 | for (i = 0; i < soc->pdev_count; i++) { |
| 2457 | pdev = soc->pdev_list[i]; |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 2458 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2459 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 2460 | if (vdev->opmode != wlan_op_mode_ap) |
| 2461 | continue; |
| 2462 | |
| 2463 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 2464 | if (!peer->authorize) { |
| 2465 | /** |
| 2466 | * Inactivity check only interested in |
| 2467 | * connected node |
| 2468 | */ |
| 2469 | continue; |
| 2470 | } |
| 2471 | if (peer->peer_bs_inact > soc->pdev_bs_inact_reload) { |
| 2472 | /** |
| 2473 | * This check ensures we do not wait extra long |
| 2474 | * due to the potential race condition |
| 2475 | */ |
| 2476 | peer->peer_bs_inact = soc->pdev_bs_inact_reload; |
| 2477 | } |
| 2478 | if (peer->peer_bs_inact > 0) { |
| 2479 | /* Do not let it wrap around */ |
| 2480 | peer->peer_bs_inact--; |
| 2481 | } |
| 2482 | if (peer->peer_bs_inact == 0) |
| 2483 | dp_mark_peer_inact(peer, true); |
| 2484 | } |
| 2485 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 2486 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2487 | } |
| 2488 | |
| 2489 | qdf_spin_unlock(&soc->peer_ref_mutex); |
| 2490 | qdf_timer_mod(&soc->pdev_bs_inact_timer, |
| 2491 | soc->pdev_bs_inact_interval * 1000); |
| 2492 | } |
Subhranil Choudhury | eea6738 | 2018-01-18 20:24:36 +0530 | [diff] [blame] | 2493 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 2494 | |
| 2495 | /** |
| 2496 | * dp_free_inact_timer(): free inact timer |
| 2497 | * @timer - inact timer handle |
| 2498 | * |
| 2499 | * Return: bool |
| 2500 | */ |
| 2501 | void dp_free_inact_timer(struct dp_soc *soc) |
| 2502 | { |
| 2503 | qdf_timer_free(&soc->pdev_bs_inact_timer); |
| 2504 | } |
Subhranil Choudhury | eea6738 | 2018-01-18 20:24:36 +0530 | [diff] [blame] | 2505 | #else |
| 2506 | |
| 2507 | void dp_mark_peer_inact(void *peer, bool inactive) |
| 2508 | { |
| 2509 | return; |
| 2510 | } |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 2511 | |
| 2512 | void dp_free_inact_timer(struct dp_soc *soc) |
| 2513 | { |
| 2514 | return; |
| 2515 | } |
| 2516 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 2517 | #endif |
| 2518 | |
Yun Park | 47e6af8 | 2018-01-17 12:15:01 -0800 | [diff] [blame] | 2519 | #ifdef IPA_OFFLOAD |
| 2520 | /** |
| 2521 | * dp_setup_ipa_rx_refill_buf_ring - Setup second Rx refill buffer ring |
| 2522 | * @soc: data path instance |
| 2523 | * @pdev: core txrx pdev context |
| 2524 | * |
| 2525 | * Return: QDF_STATUS_SUCCESS: success |
| 2526 | * QDF_STATUS_E_RESOURCES: Error return |
| 2527 | */ |
| 2528 | static int dp_setup_ipa_rx_refill_buf_ring(struct dp_soc *soc, |
| 2529 | struct dp_pdev *pdev) |
| 2530 | { |
| 2531 | /* Setup second Rx refill buffer ring */ |
| 2532 | if (dp_srng_setup(soc, &pdev->rx_refill_buf_ring2, RXDMA_BUF, |
| 2533 | IPA_RX_REFILL_BUF_RING_IDX, |
| 2534 | pdev->pdev_id, RXDMA_REFILL_RING_SIZE)) { |
| 2535 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2536 | FL("dp_srng_setup failed second rx refill ring")); |
| 2537 | return QDF_STATUS_E_FAILURE; |
| 2538 | } |
| 2539 | return QDF_STATUS_SUCCESS; |
| 2540 | } |
| 2541 | |
| 2542 | /** |
| 2543 | * dp_cleanup_ipa_rx_refill_buf_ring - Cleanup second Rx refill buffer ring |
| 2544 | * @soc: data path instance |
| 2545 | * @pdev: core txrx pdev context |
| 2546 | * |
| 2547 | * Return: void |
| 2548 | */ |
| 2549 | static void dp_cleanup_ipa_rx_refill_buf_ring(struct dp_soc *soc, |
| 2550 | struct dp_pdev *pdev) |
| 2551 | { |
| 2552 | dp_srng_cleanup(soc, &pdev->rx_refill_buf_ring2, RXDMA_BUF, |
| 2553 | IPA_RX_REFILL_BUF_RING_IDX); |
| 2554 | } |
| 2555 | |
| 2556 | #else |
| 2557 | |
| 2558 | static int dp_setup_ipa_rx_refill_buf_ring(struct dp_soc *soc, |
| 2559 | struct dp_pdev *pdev) |
| 2560 | { |
| 2561 | return QDF_STATUS_SUCCESS; |
| 2562 | } |
| 2563 | |
| 2564 | static void dp_cleanup_ipa_rx_refill_buf_ring(struct dp_soc *soc, |
| 2565 | struct dp_pdev *pdev) |
| 2566 | { |
| 2567 | } |
| 2568 | |
| 2569 | #endif |
| 2570 | |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2571 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2572 | * dp_pdev_attach_wifi3() - attach txrx pdev |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 2573 | * @ctrl_pdev: Opaque PDEV object |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2574 | * @txrx_soc: Datapath SOC handle |
| 2575 | * @htc_handle: HTC handle for host-target interface |
| 2576 | * @qdf_osdev: QDF OS device |
| 2577 | * @pdev_id: PDEV ID |
| 2578 | * |
| 2579 | * Return: DP PDEV handle on success, NULL on failure |
| 2580 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2581 | static struct cdp_pdev *dp_pdev_attach_wifi3(struct cdp_soc_t *txrx_soc, |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 2582 | struct cdp_ctrl_objmgr_pdev *ctrl_pdev, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2583 | 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] | 2584 | { |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2585 | int tx_ring_size; |
| 2586 | int tx_comp_ring_size; |
| 2587 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2588 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
| 2589 | struct dp_pdev *pdev = qdf_mem_malloc(sizeof(*pdev)); |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2590 | int mac_id; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2591 | |
| 2592 | if (!pdev) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2593 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2594 | FL("DP PDEV memory allocation failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2595 | goto fail0; |
| 2596 | } |
| 2597 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 2598 | pdev->wlan_cfg_ctx = wlan_cfg_pdev_attach(); |
| 2599 | |
| 2600 | if (!pdev->wlan_cfg_ctx) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2601 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2602 | FL("pdev cfg_attach failed")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2603 | |
| 2604 | qdf_mem_free(pdev); |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 2605 | goto fail0; |
| 2606 | } |
| 2607 | |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 2608 | /* |
| 2609 | * set nss pdev config based on soc config |
| 2610 | */ |
| 2611 | wlan_cfg_set_dp_pdev_nss_enabled(pdev->wlan_cfg_ctx, |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2612 | (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] | 2613 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2614 | pdev->soc = soc; |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 2615 | pdev->ctrl_pdev = ctrl_pdev; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2616 | pdev->pdev_id = pdev_id; |
| 2617 | soc->pdev_list[pdev_id] = pdev; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 2618 | soc->pdev_count++; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2619 | |
| 2620 | TAILQ_INIT(&pdev->vdev_list); |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 2621 | qdf_spinlock_create(&pdev->vdev_list_lock); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2622 | pdev->vdev_count = 0; |
| 2623 | |
Pamidipati, Vijay | 9c9a287 | 2017-05-31 10:06:34 +0530 | [diff] [blame] | 2624 | qdf_spinlock_create(&pdev->tx_mutex); |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 2625 | qdf_spinlock_create(&pdev->neighbour_peer_mutex); |
| 2626 | TAILQ_INIT(&pdev->neighbour_peers_list); |
| 2627 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2628 | if (dp_soc_cmn_setup(soc)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2629 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2630 | FL("dp_soc_cmn_setup failed")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2631 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2632 | } |
| 2633 | |
| 2634 | /* Setup per PDEV TCL rings if configured */ |
| 2635 | if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2636 | tx_ring_size = |
| 2637 | wlan_cfg_tx_ring_size(soc->wlan_cfg_ctx); |
| 2638 | tx_comp_ring_size = |
| 2639 | wlan_cfg_tx_comp_ring_size(soc->wlan_cfg_ctx); |
| 2640 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2641 | 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] | 2642 | pdev_id, pdev_id, tx_ring_size)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2643 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2644 | FL("dp_srng_setup failed for tcl_data_ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2645 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2646 | } |
| 2647 | if (dp_srng_setup(soc, &soc->tx_comp_ring[pdev_id], |
Pamidipati, Vijay | bea353e | 2017-07-05 03:09:20 +0530 | [diff] [blame] | 2648 | WBM2SW_RELEASE, pdev_id, pdev_id, tx_comp_ring_size)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2649 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2650 | FL("dp_srng_setup failed for tx_comp_ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2651 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2652 | } |
| 2653 | soc->num_tcl_data_rings++; |
| 2654 | } |
| 2655 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 2656 | /* Tx specific init */ |
| 2657 | if (dp_tx_pdev_attach(pdev)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2658 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2659 | FL("dp_tx_pdev_attach failed")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2660 | goto fail1; |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 2661 | } |
| 2662 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2663 | /* Setup per PDEV REO rings if configured */ |
| 2664 | if (wlan_cfg_per_pdev_rx_ring(soc->wlan_cfg_ctx)) { |
| 2665 | if (dp_srng_setup(soc, &soc->reo_dest_ring[pdev_id], REO_DST, |
| 2666 | pdev_id, pdev_id, REO_DST_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2667 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2668 | FL("dp_srng_setup failed for reo_dest_ringn")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2669 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2670 | } |
| 2671 | soc->num_reo_dest_rings++; |
| 2672 | |
| 2673 | } |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 2674 | 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] | 2675 | RXDMA_REFILL_RING_SIZE)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2676 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2677 | FL("dp_srng_setup failed rx refill ring")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2678 | goto fail1; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2679 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2680 | |
| 2681 | if (dp_rxdma_ring_setup(soc, pdev)) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 2682 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2683 | FL("RXDMA ring config failed")); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2684 | goto fail1; |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 2685 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2686 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2687 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 2688 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2689 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2690 | if (dp_srng_setup(soc, &pdev->rxdma_mon_buf_ring[mac_id], |
| 2691 | RXDMA_MONITOR_BUF, 0, mac_for_pdev, |
| 2692 | RXDMA_MONITOR_BUF_RING_SIZE)) { |
| 2693 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2694 | FL("dp_srng_setup failed for rxdma_mon_buf_ring")); |
| 2695 | goto fail1; |
| 2696 | } |
| 2697 | |
| 2698 | if (dp_srng_setup(soc, &pdev->rxdma_mon_dst_ring[mac_id], |
| 2699 | RXDMA_MONITOR_DST, 0, mac_for_pdev, |
| 2700 | RXDMA_MONITOR_DST_RING_SIZE)) { |
| 2701 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2702 | FL("dp_srng_setup failed for rxdma_mon_dst_ring")); |
| 2703 | goto fail1; |
| 2704 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2705 | |
| 2706 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2707 | if (dp_srng_setup(soc, &pdev->rxdma_mon_status_ring[mac_id], |
| 2708 | RXDMA_MONITOR_STATUS, 0, mac_for_pdev, |
| 2709 | RXDMA_MONITOR_STATUS_RING_SIZE)) { |
| 2710 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2711 | FL("dp_srng_setup failed for rxdma_mon_status_ring")); |
| 2712 | goto fail1; |
| 2713 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2714 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2715 | if (dp_srng_setup(soc, &pdev->rxdma_mon_desc_ring[mac_id], |
| 2716 | RXDMA_MONITOR_DESC, 0, mac_for_pdev, |
| 2717 | RXDMA_MONITOR_DESC_RING_SIZE)) { |
| 2718 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2719 | "dp_srng_setup failed for rxdma_mon_desc_ring\n"); |
| 2720 | goto fail1; |
| 2721 | } |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2722 | } |
| 2723 | |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 2724 | if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) { |
| 2725 | if (dp_srng_setup(soc, &pdev->rxdma_err_dst_ring[0], RXDMA_DST, |
| 2726 | 0, pdev_id, RXDMA_ERR_DST_RING_SIZE)) { |
| 2727 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2728 | FL("dp_srng_setup failed for rxdma_err_dst_ring")); |
| 2729 | goto fail1; |
| 2730 | } |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 2731 | } |
| 2732 | |
Yun Park | 47e6af8 | 2018-01-17 12:15:01 -0800 | [diff] [blame] | 2733 | if (dp_setup_ipa_rx_refill_buf_ring(soc, pdev)) |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2734 | goto fail1; |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2735 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2736 | if (dp_ipa_ring_resource_setup(soc, pdev)) |
| 2737 | goto fail1; |
| 2738 | |
| 2739 | if (dp_ipa_uc_attach(soc, pdev) != QDF_STATUS_SUCCESS) { |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2740 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 2741 | FL("dp_ipa_uc_attach failed")); |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2742 | goto fail1; |
| 2743 | } |
| 2744 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2745 | /* Rx specific init */ |
| 2746 | if (dp_rx_pdev_attach(pdev)) { |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2747 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2748 | FL("dp_rx_pdev_attach failed")); |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2749 | goto fail0; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2750 | } |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 2751 | DP_STATS_INIT(pdev); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2752 | |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 2753 | /* Monitor filter init */ |
| 2754 | pdev->mon_filter_mode = MON_FILTER_ALL; |
| 2755 | pdev->fp_mgmt_filter = FILTER_MGMT_ALL; |
| 2756 | pdev->fp_ctrl_filter = FILTER_CTRL_ALL; |
| 2757 | pdev->fp_data_filter = FILTER_DATA_ALL; |
| 2758 | pdev->mo_mgmt_filter = FILTER_MGMT_ALL; |
| 2759 | pdev->mo_ctrl_filter = FILTER_CTRL_ALL; |
| 2760 | pdev->mo_data_filter = FILTER_DATA_ALL; |
| 2761 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2762 | dp_local_peer_id_pool_init(pdev); |
Sravan Kumar Kairam | f1e0766 | 2018-06-18 21:36:14 +0530 | [diff] [blame] | 2763 | |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 2764 | dp_dscp_tid_map_setup(pdev); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2765 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2766 | /* Rx monitor mode specific init */ |
| 2767 | if (dp_rx_pdev_mon_attach(pdev)) { |
| 2768 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 2769 | "dp_rx_pdev_attach failed\n"); |
| 2770 | goto fail1; |
| 2771 | } |
| 2772 | |
| 2773 | if (dp_wdi_event_attach(pdev)) { |
| 2774 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2775 | "dp_wdi_evet_attach failed\n"); |
| 2776 | goto fail1; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2777 | } |
| 2778 | |
Om Prakash Tripathi | a7fb93f | 2017-06-27 18:41:41 +0530 | [diff] [blame] | 2779 | /* set the reo destination during initialization */ |
| 2780 | pdev->reo_dest = pdev->pdev_id + 1; |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 2781 | |
Anish Nataraj | b9e7d01 | 2018-02-16 00:38:10 +0530 | [diff] [blame] | 2782 | /* |
| 2783 | * initialize ppdu tlv list |
| 2784 | */ |
| 2785 | TAILQ_INIT(&pdev->ppdu_info_list); |
| 2786 | pdev->tlv_count = 0; |
| 2787 | pdev->list_depth = 0; |
| 2788 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2789 | return (struct cdp_pdev *)pdev; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2790 | |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2791 | fail1: |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2792 | dp_pdev_detach_wifi3((struct cdp_pdev *)pdev, 0); |
Vijay Pamidipati | b775e13 | 2016-10-19 21:19:52 +0530 | [diff] [blame] | 2793 | |
| 2794 | fail0: |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2795 | return NULL; |
| 2796 | } |
| 2797 | |
| 2798 | /* |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2799 | * dp_rxdma_ring_cleanup() - configure the RX DMA rings |
| 2800 | * @soc: data path SoC handle |
| 2801 | * @pdev: Physical device handle |
| 2802 | * |
| 2803 | * Return: void |
| 2804 | */ |
| 2805 | #ifdef QCA_HOST2FW_RXBUF_RING |
| 2806 | static void dp_rxdma_ring_cleanup(struct dp_soc *soc, |
| 2807 | struct dp_pdev *pdev) |
| 2808 | { |
| 2809 | int max_mac_rings = |
| 2810 | wlan_cfg_get_num_mac_rings(pdev->wlan_cfg_ctx); |
| 2811 | int i; |
| 2812 | |
| 2813 | max_mac_rings = max_mac_rings < MAX_RX_MAC_RINGS ? |
| 2814 | max_mac_rings : MAX_RX_MAC_RINGS; |
| 2815 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) |
| 2816 | dp_srng_cleanup(soc, &pdev->rx_mac_buf_ring[i], |
| 2817 | RXDMA_BUF, 1); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2818 | |
| 2819 | qdf_timer_free(&soc->mon_reap_timer); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2820 | } |
| 2821 | #else |
| 2822 | static void dp_rxdma_ring_cleanup(struct dp_soc *soc, |
| 2823 | struct dp_pdev *pdev) |
| 2824 | { |
| 2825 | } |
| 2826 | #endif |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 2827 | |
| 2828 | /* |
| 2829 | * dp_neighbour_peers_detach() - Detach neighbour peers(nac clients) |
| 2830 | * @pdev: device object |
| 2831 | * |
| 2832 | * Return: void |
| 2833 | */ |
| 2834 | static void dp_neighbour_peers_detach(struct dp_pdev *pdev) |
| 2835 | { |
| 2836 | struct dp_neighbour_peer *peer = NULL; |
| 2837 | struct dp_neighbour_peer *temp_peer = NULL; |
| 2838 | |
| 2839 | TAILQ_FOREACH_SAFE(peer, &pdev->neighbour_peers_list, |
| 2840 | neighbour_peer_list_elem, temp_peer) { |
| 2841 | /* delete this peer from the list */ |
| 2842 | TAILQ_REMOVE(&pdev->neighbour_peers_list, |
| 2843 | peer, neighbour_peer_list_elem); |
| 2844 | qdf_mem_free(peer); |
| 2845 | } |
| 2846 | |
| 2847 | qdf_spinlock_destroy(&pdev->neighbour_peer_mutex); |
| 2848 | } |
| 2849 | |
Anish Nataraj | cf526b7 | 2018-03-26 15:55:30 +0530 | [diff] [blame] | 2850 | /** |
| 2851 | * dp_htt_ppdu_stats_detach() - detach stats resources |
| 2852 | * @pdev: Datapath PDEV handle |
| 2853 | * |
| 2854 | * Return: void |
| 2855 | */ |
| 2856 | static void dp_htt_ppdu_stats_detach(struct dp_pdev *pdev) |
| 2857 | { |
| 2858 | struct ppdu_info *ppdu_info, *ppdu_info_next; |
| 2859 | |
| 2860 | TAILQ_FOREACH_SAFE(ppdu_info, &pdev->ppdu_info_list, |
| 2861 | ppdu_info_list_elem, ppdu_info_next) { |
| 2862 | if (!ppdu_info) |
| 2863 | break; |
| 2864 | qdf_assert_always(ppdu_info->nbuf); |
| 2865 | qdf_nbuf_free(ppdu_info->nbuf); |
| 2866 | qdf_mem_free(ppdu_info); |
| 2867 | } |
| 2868 | } |
| 2869 | |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2870 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2871 | * dp_pdev_detach_wifi3() - detach txrx pdev |
| 2872 | * @txrx_pdev: Datapath PDEV handle |
| 2873 | * @force: Force detach |
| 2874 | * |
| 2875 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2876 | 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] | 2877 | { |
| 2878 | struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev; |
| 2879 | struct dp_soc *soc = pdev->soc; |
Tallapragada Kalyan | 9403463 | 2017-12-07 17:29:13 +0530 | [diff] [blame] | 2880 | qdf_nbuf_t curr_nbuf, next_nbuf; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2881 | int mac_id; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2882 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 2883 | dp_wdi_event_detach(pdev); |
| 2884 | |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 2885 | dp_tx_pdev_detach(pdev); |
| 2886 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2887 | if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { |
| 2888 | dp_srng_cleanup(soc, &soc->tcl_data_ring[pdev->pdev_id], |
| 2889 | TCL_DATA, pdev->pdev_id); |
| 2890 | dp_srng_cleanup(soc, &soc->tx_comp_ring[pdev->pdev_id], |
| 2891 | WBM2SW_RELEASE, pdev->pdev_id); |
| 2892 | } |
| 2893 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 2894 | dp_pktlogmod_exit(pdev); |
| 2895 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2896 | dp_rx_pdev_detach(pdev); |
| 2897 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2898 | dp_rx_pdev_mon_detach(pdev); |
| 2899 | |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 2900 | dp_neighbour_peers_detach(pdev); |
Pamidipati, Vijay | 9c9a287 | 2017-05-31 10:06:34 +0530 | [diff] [blame] | 2901 | qdf_spinlock_destroy(&pdev->tx_mutex); |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 2902 | qdf_spinlock_destroy(&pdev->vdev_list_lock); |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 2903 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2904 | dp_ipa_uc_detach(soc, pdev); |
| 2905 | |
Yun Park | 47e6af8 | 2018-01-17 12:15:01 -0800 | [diff] [blame] | 2906 | dp_cleanup_ipa_rx_refill_buf_ring(soc, pdev); |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2907 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2908 | /* Cleanup per PDEV REO rings if configured */ |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2909 | if (wlan_cfg_per_pdev_rx_ring(soc->wlan_cfg_ctx)) { |
| 2910 | dp_srng_cleanup(soc, &soc->reo_dest_ring[pdev->pdev_id], |
| 2911 | REO_DST, pdev->pdev_id); |
| 2912 | } |
| 2913 | |
Dhanashri Atre | 7351d17 | 2016-10-12 13:08:09 -0700 | [diff] [blame] | 2914 | dp_srng_cleanup(soc, &pdev->rx_refill_buf_ring, RXDMA_BUF, 0); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2915 | |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 2916 | dp_rxdma_ring_cleanup(soc, pdev); |
| 2917 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2918 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 2919 | dp_srng_cleanup(soc, &pdev->rxdma_mon_buf_ring[mac_id], |
| 2920 | RXDMA_MONITOR_BUF, 0); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2921 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2922 | dp_srng_cleanup(soc, &pdev->rxdma_mon_dst_ring[mac_id], |
| 2923 | RXDMA_MONITOR_DST, 0); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2924 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2925 | dp_srng_cleanup(soc, &pdev->rxdma_mon_status_ring[mac_id], |
| 2926 | RXDMA_MONITOR_STATUS, 0); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2927 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2928 | dp_srng_cleanup(soc, &pdev->rxdma_mon_desc_ring[mac_id], |
| 2929 | RXDMA_MONITOR_DESC, 0); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 2930 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 2931 | dp_srng_cleanup(soc, &pdev->rxdma_err_dst_ring[mac_id], |
| 2932 | RXDMA_DST, 0); |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 2933 | } |
Pramod Simha | e382ff8 | 2017-06-05 18:09:26 -0700 | [diff] [blame] | 2934 | |
Tallapragada Kalyan | 9403463 | 2017-12-07 17:29:13 +0530 | [diff] [blame] | 2935 | curr_nbuf = pdev->invalid_peer_head_msdu; |
| 2936 | while (curr_nbuf) { |
| 2937 | next_nbuf = qdf_nbuf_next(curr_nbuf); |
| 2938 | qdf_nbuf_free(curr_nbuf); |
| 2939 | curr_nbuf = next_nbuf; |
| 2940 | } |
| 2941 | |
Anish Nataraj | cf526b7 | 2018-03-26 15:55:30 +0530 | [diff] [blame] | 2942 | dp_htt_ppdu_stats_detach(pdev); |
| 2943 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2944 | soc->pdev_list[pdev->pdev_id] = NULL; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 2945 | soc->pdev_count--; |
Manikandan Mohan | b01696b | 2017-05-09 18:03:19 -0700 | [diff] [blame] | 2946 | wlan_cfg_pdev_detach(pdev->wlan_cfg_ctx); |
Santosh Anbu | 2280e86 | 2018-01-03 22:25:53 +0530 | [diff] [blame] | 2947 | qdf_mem_free(pdev->dp_txrx_handle); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2948 | qdf_mem_free(pdev); |
| 2949 | } |
| 2950 | |
| 2951 | /* |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 2952 | * dp_reo_desc_freelist_destroy() - Flush REO descriptors from deferred freelist |
| 2953 | * @soc: DP SOC handle |
| 2954 | */ |
| 2955 | static inline void dp_reo_desc_freelist_destroy(struct dp_soc *soc) |
| 2956 | { |
| 2957 | struct reo_desc_list_node *desc; |
| 2958 | struct dp_rx_tid *rx_tid; |
| 2959 | |
| 2960 | qdf_spin_lock_bh(&soc->reo_desc_freelist_lock); |
| 2961 | while (qdf_list_remove_front(&soc->reo_desc_freelist, |
| 2962 | (qdf_list_node_t **)&desc) == QDF_STATUS_SUCCESS) { |
| 2963 | rx_tid = &desc->rx_tid; |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 2964 | qdf_mem_unmap_nbytes_single(soc->osdev, |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 2965 | rx_tid->hw_qdesc_paddr, |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 2966 | QDF_DMA_BIDIRECTIONAL, |
| 2967 | rx_tid->hw_qdesc_alloc_size); |
| 2968 | qdf_mem_free(rx_tid->hw_qdesc_vaddr_unaligned); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 2969 | qdf_mem_free(desc); |
| 2970 | } |
| 2971 | qdf_spin_unlock_bh(&soc->reo_desc_freelist_lock); |
| 2972 | qdf_list_destroy(&soc->reo_desc_freelist); |
| 2973 | qdf_spinlock_destroy(&soc->reo_desc_freelist_lock); |
| 2974 | } |
| 2975 | |
| 2976 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2977 | * dp_soc_detach_wifi3() - Detach txrx SOC |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 2978 | * @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] | 2979 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 2980 | static void dp_soc_detach_wifi3(void *txrx_soc) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2981 | { |
| 2982 | struct dp_soc *soc = (struct dp_soc *)txrx_soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2983 | int i; |
| 2984 | |
Ravi Joshi | 86e9826 | 2017-03-01 13:47:03 -0800 | [diff] [blame] | 2985 | qdf_atomic_set(&soc->cmn_init_done, 0); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2986 | |
Dustin Brown | f653d16 | 2017-09-19 11:29:41 -0700 | [diff] [blame] | 2987 | qdf_flush_work(&soc->htt_stats.work); |
| 2988 | qdf_disable_work(&soc->htt_stats.work); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 2989 | |
| 2990 | /* Free pending htt stats messages */ |
| 2991 | qdf_nbuf_queue_free(&soc->htt_stats.msg); |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 2992 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 2993 | dp_free_inact_timer(soc); |
| 2994 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2995 | for (i = 0; i < MAX_PDEV_CNT; i++) { |
| 2996 | if (soc->pdev_list[i]) |
Kiran Venkatappa | 5dba3a3 | 2017-03-01 16:00:22 +0530 | [diff] [blame] | 2997 | dp_pdev_detach_wifi3( |
| 2998 | (struct cdp_pdev *)soc->pdev_list[i], 1); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 2999 | } |
| 3000 | |
| 3001 | dp_peer_find_detach(soc); |
| 3002 | |
| 3003 | /* TBD: Call Tx and Rx cleanup functions to free buffers and |
| 3004 | * SW descriptors |
| 3005 | */ |
| 3006 | |
| 3007 | /* Free the ring memories */ |
| 3008 | /* Common rings */ |
| 3009 | dp_srng_cleanup(soc, &soc->wbm_desc_rel_ring, SW2WBM_RELEASE, 0); |
| 3010 | |
Manikandan Mohan | b01696b | 2017-05-09 18:03:19 -0700 | [diff] [blame] | 3011 | dp_tx_soc_detach(soc); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3012 | /* Tx data rings */ |
| 3013 | if (!wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) { |
| 3014 | for (i = 0; i < soc->num_tcl_data_rings; i++) { |
| 3015 | dp_srng_cleanup(soc, &soc->tcl_data_ring[i], |
| 3016 | TCL_DATA, i); |
| 3017 | dp_srng_cleanup(soc, &soc->tx_comp_ring[i], |
| 3018 | WBM2SW_RELEASE, i); |
| 3019 | } |
| 3020 | } |
| 3021 | |
| 3022 | /* TCL command and status rings */ |
| 3023 | dp_srng_cleanup(soc, &soc->tcl_cmd_ring, TCL_CMD, 0); |
| 3024 | dp_srng_cleanup(soc, &soc->tcl_status_ring, TCL_STATUS, 0); |
| 3025 | |
| 3026 | /* Rx data rings */ |
| 3027 | if (!wlan_cfg_per_pdev_rx_ring(soc->wlan_cfg_ctx)) { |
| 3028 | soc->num_reo_dest_rings = |
| 3029 | wlan_cfg_num_reo_dest_rings(soc->wlan_cfg_ctx); |
| 3030 | for (i = 0; i < soc->num_reo_dest_rings; i++) { |
| 3031 | /* TODO: Get number of rings and ring sizes |
| 3032 | * from wlan_cfg |
| 3033 | */ |
| 3034 | dp_srng_cleanup(soc, &soc->reo_dest_ring[i], |
| 3035 | REO_DST, i); |
| 3036 | } |
| 3037 | } |
| 3038 | /* REO reinjection ring */ |
| 3039 | dp_srng_cleanup(soc, &soc->reo_reinject_ring, REO_REINJECT, 0); |
| 3040 | |
| 3041 | /* Rx release ring */ |
| 3042 | dp_srng_cleanup(soc, &soc->rx_rel_ring, WBM2SW_RELEASE, 0); |
| 3043 | |
| 3044 | /* Rx exception ring */ |
| 3045 | /* TODO: Better to store ring_type and ring_num in |
| 3046 | * dp_srng during setup |
| 3047 | */ |
| 3048 | dp_srng_cleanup(soc, &soc->reo_exception_ring, REO_EXCEPTION, 0); |
| 3049 | |
| 3050 | /* REO command and status rings */ |
| 3051 | dp_srng_cleanup(soc, &soc->reo_cmd_ring, REO_CMD, 0); |
| 3052 | dp_srng_cleanup(soc, &soc->reo_status_ring, REO_STATUS, 0); |
Manoj Ekbote | 525bcab | 2017-09-01 17:23:32 -0700 | [diff] [blame] | 3053 | dp_hw_link_desc_pool_cleanup(soc); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 3054 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3055 | qdf_spinlock_destroy(&soc->peer_ref_mutex); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 3056 | qdf_spinlock_destroy(&soc->htt_stats.lock); |
| 3057 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3058 | htt_soc_detach(soc->htt_handle); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 3059 | |
Lin Bai | f1c577e | 2018-05-22 20:45:42 +0800 | [diff] [blame] | 3060 | qdf_spinlock_destroy(&soc->rx.defrag.defrag_lock); |
| 3061 | |
Manoj Ekbote | 2a372d2 | 2017-06-29 14:54:57 -0700 | [diff] [blame] | 3062 | dp_reo_cmdlist_destroy(soc); |
| 3063 | qdf_spinlock_destroy(&soc->rx.reo_cmd_lock); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 3064 | dp_reo_desc_freelist_destroy(soc); |
Manoj Ekbote | 2a372d2 | 2017-06-29 14:54:57 -0700 | [diff] [blame] | 3065 | |
Manikandan Mohan | b01696b | 2017-05-09 18:03:19 -0700 | [diff] [blame] | 3066 | wlan_cfg_soc_detach(soc->wlan_cfg_ctx); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 3067 | |
| 3068 | dp_soc_wds_detach(soc); |
Yun Park | 92af713 | 2017-09-13 16:33:35 -0700 | [diff] [blame] | 3069 | qdf_spinlock_destroy(&soc->ast_lock); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 3070 | |
Venkata Sharath Chandra Manchala | 65bf230 | 2017-03-09 17:28:56 -0800 | [diff] [blame] | 3071 | qdf_mem_free(soc); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3072 | } |
| 3073 | |
| 3074 | /* |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 3075 | * dp_rxdma_ring_config() - configure the RX DMA rings |
| 3076 | * |
| 3077 | * This function is used to configure the MAC rings. |
| 3078 | * On MCL host provides buffers in Host2FW ring |
| 3079 | * FW refills (copies) buffers to the ring and updates |
| 3080 | * ring_idx in register |
| 3081 | * |
| 3082 | * @soc: data path SoC handle |
| 3083 | * |
| 3084 | * Return: void |
| 3085 | */ |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3086 | #ifdef QCA_HOST2FW_RXBUF_RING |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3087 | static void dp_rxdma_ring_config(struct dp_soc *soc) |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3088 | { |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3089 | int i; |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3090 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3091 | for (i = 0; i < MAX_PDEV_CNT; i++) { |
| 3092 | struct dp_pdev *pdev = soc->pdev_list[i]; |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3093 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3094 | if (pdev) { |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3095 | int mac_id; |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 3096 | bool dbs_enable = 0; |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3097 | int max_mac_rings = |
| 3098 | wlan_cfg_get_num_mac_rings |
| 3099 | (pdev->wlan_cfg_ctx); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3100 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3101 | htt_srng_setup(soc->htt_handle, 0, |
| 3102 | pdev->rx_refill_buf_ring.hal_srng, |
| 3103 | RXDMA_BUF); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3104 | |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 3105 | if (pdev->rx_refill_buf_ring2.hal_srng) |
| 3106 | htt_srng_setup(soc->htt_handle, 0, |
| 3107 | pdev->rx_refill_buf_ring2.hal_srng, |
| 3108 | RXDMA_BUF); |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 3109 | |
Dhanashri Atre | 2c6381d | 2017-03-30 19:33:52 -0700 | [diff] [blame] | 3110 | if (soc->cdp_soc.ol_ops-> |
| 3111 | is_hw_dbs_2x2_capable) { |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 3112 | dbs_enable = soc->cdp_soc.ol_ops-> |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 3113 | is_hw_dbs_2x2_capable(soc->ctrl_psoc); |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 3114 | } |
| 3115 | |
| 3116 | if (dbs_enable) { |
| 3117 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 3118 | QDF_TRACE_LEVEL_ERROR, |
| 3119 | FL("DBS enabled max_mac_rings %d\n"), |
| 3120 | max_mac_rings); |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3121 | } else { |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 3122 | max_mac_rings = 1; |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3123 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 3124 | QDF_TRACE_LEVEL_ERROR, |
Dhanashri Atre | 398935e | 2017-03-31 15:34:28 -0700 | [diff] [blame] | 3125 | FL("DBS disabled, max_mac_rings %d\n"), |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3126 | max_mac_rings); |
| 3127 | } |
| 3128 | |
| 3129 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 3130 | FL("pdev_id %d max_mac_rings %d\n"), |
| 3131 | pdev->pdev_id, max_mac_rings); |
| 3132 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3133 | for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { |
| 3134 | int mac_for_pdev = dp_get_mac_id_for_pdev( |
| 3135 | mac_id, pdev->pdev_id); |
| 3136 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3137 | QDF_TRACE(QDF_MODULE_ID_TXRX, |
| 3138 | QDF_TRACE_LEVEL_ERROR, |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3139 | FL("mac_id %d\n"), mac_for_pdev); |
| 3140 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3141 | pdev->rx_mac_buf_ring[mac_id] |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3142 | .hal_srng, |
| 3143 | RXDMA_BUF); |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3144 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3145 | pdev->rxdma_err_dst_ring[mac_id] |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 3146 | .hal_srng, |
| 3147 | RXDMA_DST); |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3148 | |
| 3149 | /* Configure monitor mode rings */ |
| 3150 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3151 | pdev->rxdma_mon_buf_ring[mac_id].hal_srng, |
| 3152 | RXDMA_MONITOR_BUF); |
| 3153 | |
| 3154 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3155 | pdev->rxdma_mon_dst_ring[mac_id].hal_srng, |
| 3156 | RXDMA_MONITOR_DST); |
| 3157 | |
| 3158 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3159 | pdev->rxdma_mon_status_ring[mac_id].hal_srng, |
| 3160 | RXDMA_MONITOR_STATUS); |
| 3161 | |
| 3162 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3163 | pdev->rxdma_mon_desc_ring[mac_id].hal_srng, |
| 3164 | RXDMA_MONITOR_DESC); |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3165 | } |
| 3166 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3167 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 3168 | |
| 3169 | /* |
| 3170 | * Timer to reap rxdma status rings. |
| 3171 | * Needed until we enable ppdu end interrupts |
| 3172 | */ |
| 3173 | qdf_timer_init(soc->osdev, &soc->mon_reap_timer, |
| 3174 | dp_service_mon_rings, (void *)soc, |
| 3175 | QDF_TIMER_TYPE_WAKE_APPS); |
| 3176 | soc->reap_timer_init = 1; |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3177 | } |
| 3178 | #else |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3179 | /* This is only for WIN */ |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3180 | static void dp_rxdma_ring_config(struct dp_soc *soc) |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3181 | { |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3182 | int i; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3183 | int mac_id; |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3184 | |
| 3185 | for (i = 0; i < MAX_PDEV_CNT; i++) { |
| 3186 | struct dp_pdev *pdev = soc->pdev_list[i]; |
| 3187 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3188 | if (pdev == NULL) |
| 3189 | continue; |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 3190 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3191 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 3192 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, i); |
| 3193 | |
| 3194 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3195 | pdev->rx_refill_buf_ring.hal_srng, RXDMA_BUF); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 3196 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3197 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3198 | pdev->rxdma_mon_buf_ring[mac_id].hal_srng, |
| 3199 | RXDMA_MONITOR_BUF); |
| 3200 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3201 | pdev->rxdma_mon_dst_ring[mac_id].hal_srng, |
| 3202 | RXDMA_MONITOR_DST); |
| 3203 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3204 | pdev->rxdma_mon_status_ring[mac_id].hal_srng, |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 3205 | RXDMA_MONITOR_STATUS); |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3206 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3207 | pdev->rxdma_mon_desc_ring[mac_id].hal_srng, |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 3208 | RXDMA_MONITOR_DESC); |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 3209 | htt_srng_setup(soc->htt_handle, mac_for_pdev, |
| 3210 | pdev->rxdma_err_dst_ring[mac_id].hal_srng, |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 3211 | RXDMA_DST); |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3212 | } |
| 3213 | } |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3214 | } |
| 3215 | #endif |
| 3216 | |
| 3217 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3218 | * dp_soc_attach_target_wifi3() - SOC initialization in the target |
| 3219 | * @txrx_soc: Datapath SOC handle |
| 3220 | */ |
Jeff Johnson | f135257 | 2017-01-10 14:24:10 -0800 | [diff] [blame] | 3221 | 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] | 3222 | { |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3223 | struct dp_soc *soc = (struct dp_soc *)cdp_soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3224 | |
| 3225 | htt_soc_attach_target(soc->htt_handle); |
| 3226 | |
Dhanashri Atre | 2ea8c0f | 2017-02-08 11:09:56 -0800 | [diff] [blame] | 3227 | dp_rxdma_ring_config(soc); |
Dhanashri Atre | d4032ab | 2017-01-17 15:05:41 -0800 | [diff] [blame] | 3228 | |
Ishank Jain | bc2d91f | 2017-01-03 18:14:54 +0530 | [diff] [blame] | 3229 | DP_STATS_INIT(soc); |
Om Prakash Tripathi | 2cd7fab | 2017-07-07 20:27:25 +0530 | [diff] [blame] | 3230 | |
| 3231 | /* initialize work queue for stats processing */ |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 3232 | 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] | 3233 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3234 | return 0; |
| 3235 | } |
| 3236 | |
| 3237 | /* |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 3238 | * dp_soc_get_nss_cfg_wifi3() - SOC get nss config |
| 3239 | * @txrx_soc: Datapath SOC handle |
| 3240 | */ |
| 3241 | static int dp_soc_get_nss_cfg_wifi3(struct cdp_soc_t *cdp_soc) |
| 3242 | { |
| 3243 | struct dp_soc *dsoc = (struct dp_soc *)cdp_soc; |
| 3244 | return wlan_cfg_get_dp_soc_nss_cfg(dsoc->wlan_cfg_ctx); |
| 3245 | } |
| 3246 | /* |
| 3247 | * dp_soc_set_nss_cfg_wifi3() - SOC set nss config |
| 3248 | * @txrx_soc: Datapath SOC handle |
| 3249 | * @nss_cfg: nss config |
| 3250 | */ |
| 3251 | static void dp_soc_set_nss_cfg_wifi3(struct cdp_soc_t *cdp_soc, int config) |
| 3252 | { |
| 3253 | struct dp_soc *dsoc = (struct dp_soc *)cdp_soc; |
Aniruddha Paul | 9d7dc27 | 2018-02-11 19:40:41 +0530 | [diff] [blame] | 3254 | struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx = dsoc->wlan_cfg_ctx; |
| 3255 | |
| 3256 | wlan_cfg_set_dp_soc_nss_cfg(wlan_cfg_ctx, config); |
| 3257 | |
| 3258 | /* |
| 3259 | * TODO: masked out based on the per offloaded radio |
| 3260 | */ |
| 3261 | if (config == dp_nss_cfg_dbdc) { |
| 3262 | wlan_cfg_set_num_tx_desc_pool(wlan_cfg_ctx, 0); |
| 3263 | wlan_cfg_set_num_tx_ext_desc_pool(wlan_cfg_ctx, 0); |
| 3264 | wlan_cfg_set_num_tx_desc(wlan_cfg_ctx, 0); |
| 3265 | wlan_cfg_set_num_tx_ext_desc(wlan_cfg_ctx, 0); |
| 3266 | } |
| 3267 | |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 3268 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3269 | FL("nss-wifi<0> nss config is enabled")); |
| 3270 | } |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 3271 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3272 | * dp_vdev_attach_wifi3() - attach txrx vdev |
| 3273 | * @txrx_pdev: Datapath PDEV handle |
| 3274 | * @vdev_mac_addr: MAC address of the virtual interface |
| 3275 | * @vdev_id: VDEV Id |
| 3276 | * @wlan_op_mode: VDEV operating mode |
| 3277 | * |
| 3278 | * Return: DP VDEV handle on success, NULL on failure |
| 3279 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3280 | 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] | 3281 | uint8_t *vdev_mac_addr, uint8_t vdev_id, enum wlan_op_mode op_mode) |
| 3282 | { |
| 3283 | struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev; |
| 3284 | struct dp_soc *soc = pdev->soc; |
| 3285 | struct dp_vdev *vdev = qdf_mem_malloc(sizeof(*vdev)); |
| 3286 | |
| 3287 | if (!vdev) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3288 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3289 | FL("DP VDEV memory allocation failed")); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3290 | goto fail0; |
| 3291 | } |
| 3292 | |
| 3293 | vdev->pdev = pdev; |
| 3294 | vdev->vdev_id = vdev_id; |
| 3295 | vdev->opmode = op_mode; |
Vijay Pamidipati | d41d6d6 | 2016-10-19 21:19:00 +0530 | [diff] [blame] | 3296 | vdev->osdev = soc->osdev; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3297 | |
| 3298 | vdev->osif_rx = NULL; |
Venkateswara Swamy Bandaru | bfbef4f | 2016-12-16 19:12:31 +0530 | [diff] [blame] | 3299 | vdev->osif_rsim_rx_decap = NULL; |
Venkateswara Swamy Bandaru | 3f4e1c4 | 2017-07-10 19:47:09 +0530 | [diff] [blame] | 3300 | vdev->osif_get_key = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3301 | vdev->osif_rx_mon = NULL; |
Venkateswara Swamy Bandaru | 9748234 | 2017-02-16 12:04:50 +0530 | [diff] [blame] | 3302 | vdev->osif_tx_free_ext = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3303 | vdev->osif_vdev = NULL; |
| 3304 | |
| 3305 | vdev->delete.pending = 0; |
| 3306 | vdev->safemode = 0; |
| 3307 | vdev->drop_unenc = 1; |
ruchi agrawal | 45f3ac4 | 2017-10-25 09:03:28 +0530 | [diff] [blame] | 3308 | vdev->sec_type = cdp_sec_type_none; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3309 | #ifdef notyet |
| 3310 | vdev->filters_num = 0; |
| 3311 | #endif |
| 3312 | |
| 3313 | qdf_mem_copy( |
| 3314 | &vdev->mac_addr.raw[0], vdev_mac_addr, OL_TXRX_MAC_ADDR_LEN); |
| 3315 | |
| 3316 | vdev->tx_encap_type = wlan_cfg_pkt_type(soc->wlan_cfg_ctx); |
| 3317 | vdev->rx_decap_type = wlan_cfg_pkt_type(soc->wlan_cfg_ctx); |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 3318 | vdev->dscp_tid_map_id = 0; |
Ishank Jain | c838b13 | 2017-02-17 11:08:18 +0530 | [diff] [blame] | 3319 | vdev->mcast_enhancement_en = 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3320 | |
| 3321 | /* TODO: Initialize default HTT meta data that will be used in |
| 3322 | * TCL descriptors for packets transmitted from this VDEV |
| 3323 | */ |
| 3324 | |
| 3325 | TAILQ_INIT(&vdev->peer_list); |
| 3326 | |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 3327 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3328 | /* add this vdev into the pdev's list */ |
| 3329 | TAILQ_INSERT_TAIL(&pdev->vdev_list, vdev, vdev_list_elem); |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 3330 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3331 | pdev->vdev_count++; |
| 3332 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 3333 | dp_tx_vdev_attach(vdev); |
| 3334 | |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 3335 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 3336 | if ((soc->intr_mode == DP_INTR_POLL) && |
| 3337 | wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx) != 0) { |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 3338 | if (pdev->vdev_count == 1) |
| 3339 | qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); |
| 3340 | } |
Vijay Pamidipati | 88c40ff | 2016-11-17 21:27:02 +0530 | [diff] [blame] | 3341 | |
Dhanashri Atre | b178eb4 | 2017-03-21 12:32:33 -0700 | [diff] [blame] | 3342 | dp_lro_hash_setup(soc); |
| 3343 | |
Dhanashri Atre | 0da3122 | 2017-03-23 12:30:58 -0700 | [diff] [blame] | 3344 | /* LRO */ |
| 3345 | if (wlan_cfg_is_lro_enabled(soc->wlan_cfg_ctx) && |
| 3346 | wlan_op_mode_sta == vdev->opmode) |
| 3347 | vdev->lro_enable = true; |
| 3348 | |
| 3349 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 3350 | "LRO: vdev_id %d lro_enable %d", vdev_id, vdev->lro_enable); |
| 3351 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3352 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3353 | "Created vdev %pK (%pM)", vdev, vdev->mac_addr.raw); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 3354 | DP_STATS_INIT(vdev); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3355 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 3356 | if (wlan_op_mode_sta == vdev->opmode) |
| 3357 | dp_peer_create_wifi3((struct cdp_vdev *)vdev, |
Pramod Simha | 6e10cb2 | 2018-06-20 12:05:44 -0700 | [diff] [blame] | 3358 | vdev->mac_addr.raw, NULL); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 3359 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3360 | return (struct cdp_vdev *)vdev; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3361 | |
| 3362 | fail0: |
| 3363 | return NULL; |
| 3364 | } |
| 3365 | |
| 3366 | /** |
| 3367 | * dp_vdev_register_wifi3() - Register VDEV operations from osif layer |
| 3368 | * @vdev: Datapath VDEV handle |
| 3369 | * @osif_vdev: OSIF vdev handle |
| 3370 | * @txrx_ops: Tx and Rx operations |
| 3371 | * |
| 3372 | * Return: DP VDEV handle on success, NULL on failure |
| 3373 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3374 | static void dp_vdev_register_wifi3(struct cdp_vdev *vdev_handle, |
| 3375 | void *osif_vdev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3376 | struct ol_txrx_ops *txrx_ops) |
| 3377 | { |
| 3378 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3379 | vdev->osif_vdev = osif_vdev; |
| 3380 | vdev->osif_rx = txrx_ops->rx.rx; |
Venkateswara Swamy Bandaru | bfbef4f | 2016-12-16 19:12:31 +0530 | [diff] [blame] | 3381 | vdev->osif_rsim_rx_decap = txrx_ops->rx.rsim_rx_decap; |
Venkateswara Swamy Bandaru | 3f4e1c4 | 2017-07-10 19:47:09 +0530 | [diff] [blame] | 3382 | vdev->osif_get_key = txrx_ops->get_key; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3383 | vdev->osif_rx_mon = txrx_ops->rx.mon; |
Venkateswara Swamy Bandaru | 9748234 | 2017-02-16 12:04:50 +0530 | [diff] [blame] | 3384 | vdev->osif_tx_free_ext = txrx_ops->tx.tx_free_ext; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3385 | #ifdef notyet |
| 3386 | #if ATH_SUPPORT_WAPI |
| 3387 | vdev->osif_check_wai = txrx_ops->rx.wai_check; |
| 3388 | #endif |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3389 | #endif |
Ishank Jain | 997955e | 2017-03-24 18:18:50 +0530 | [diff] [blame] | 3390 | #ifdef UMAC_SUPPORT_PROXY_ARP |
| 3391 | vdev->osif_proxy_arp = txrx_ops->proxy_arp; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3392 | #endif |
Ishank Jain | c838b13 | 2017-02-17 11:08:18 +0530 | [diff] [blame] | 3393 | vdev->me_convert = txrx_ops->me_convert; |
| 3394 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3395 | /* TODO: Enable the following once Tx code is integrated */ |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 3396 | if (vdev->mesh_vdev) |
| 3397 | txrx_ops->tx.tx = dp_tx_send_mesh; |
| 3398 | else |
| 3399 | txrx_ops->tx.tx = dp_tx_send; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3400 | |
Prathyusha Guduri | be41d97 | 2018-01-19 14:17:14 +0530 | [diff] [blame] | 3401 | txrx_ops->tx.tx_exception = dp_tx_send_exception; |
| 3402 | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 3403 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3404 | "DP Vdev Register success"); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3405 | } |
| 3406 | |
Vinay Adella | 4ca1bf6 | 2018-02-26 11:03:05 +0530 | [diff] [blame] | 3407 | /** |
| 3408 | * dp_vdev_flush_peers() - Forcibily Flush peers of vdev |
| 3409 | * @vdev: Datapath VDEV handle |
| 3410 | * |
| 3411 | * Return: void |
| 3412 | */ |
| 3413 | static void dp_vdev_flush_peers(struct dp_vdev *vdev) |
| 3414 | { |
| 3415 | struct dp_pdev *pdev = vdev->pdev; |
| 3416 | struct dp_soc *soc = pdev->soc; |
| 3417 | struct dp_peer *peer; |
| 3418 | uint16_t *peer_ids; |
| 3419 | uint8_t i = 0, j = 0; |
| 3420 | |
| 3421 | peer_ids = qdf_mem_malloc(soc->max_peers * sizeof(peer_ids[0])); |
| 3422 | if (!peer_ids) { |
| 3423 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3424 | "DP alloc failure - unable to flush peers"); |
| 3425 | return; |
| 3426 | } |
| 3427 | |
| 3428 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 3429 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 3430 | for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) |
| 3431 | if (peer->peer_ids[i] != HTT_INVALID_PEER) |
| 3432 | if (j < soc->max_peers) |
| 3433 | peer_ids[j++] = peer->peer_ids[i]; |
| 3434 | } |
| 3435 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3436 | |
| 3437 | for (i = 0; i < j ; i++) |
| 3438 | dp_rx_peer_unmap_handler(soc, peer_ids[i]); |
| 3439 | |
| 3440 | qdf_mem_free(peer_ids); |
| 3441 | |
| 3442 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
| 3443 | FL("Flushed peers for vdev object %pK "), vdev); |
| 3444 | } |
| 3445 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3446 | /* |
| 3447 | * dp_vdev_detach_wifi3() - Detach txrx vdev |
| 3448 | * @txrx_vdev: Datapath VDEV handle |
| 3449 | * @callback: Callback OL_IF on completion of detach |
| 3450 | * @cb_context: Callback context |
| 3451 | * |
| 3452 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3453 | static void dp_vdev_detach_wifi3(struct cdp_vdev *vdev_handle, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3454 | ol_txrx_vdev_delete_cb callback, void *cb_context) |
| 3455 | { |
| 3456 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3457 | struct dp_pdev *pdev = vdev->pdev; |
| 3458 | struct dp_soc *soc = pdev->soc; |
| 3459 | |
| 3460 | /* preconditions */ |
| 3461 | qdf_assert(vdev); |
| 3462 | |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 3463 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3464 | /* remove the vdev from its parent pdev's list */ |
| 3465 | TAILQ_REMOVE(&pdev->vdev_list, vdev, vdev_list_elem); |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 3466 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3467 | |
Tallapragada Kalyan | 9d9cbb6 | 2018-02-26 17:39:12 +0530 | [diff] [blame] | 3468 | if (wlan_op_mode_sta == vdev->opmode) |
| 3469 | dp_peer_delete_wifi3(vdev->vap_bss_peer, 0); |
| 3470 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3471 | /* |
Vinay Adella | 4ca1bf6 | 2018-02-26 11:03:05 +0530 | [diff] [blame] | 3472 | * If Target is hung, flush all peers before detaching vdev |
| 3473 | * this will free all references held due to missing |
| 3474 | * unmap commands from Target |
| 3475 | */ |
| 3476 | if (hif_get_target_status(soc->hif_handle) == TARGET_STATUS_RESET) |
| 3477 | dp_vdev_flush_peers(vdev); |
| 3478 | |
| 3479 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3480 | * Use peer_ref_mutex while accessing peer_list, in case |
| 3481 | * a peer is in the process of being removed from the list. |
| 3482 | */ |
| 3483 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 3484 | /* check that the vdev has no peers allocated */ |
| 3485 | if (!TAILQ_EMPTY(&vdev->peer_list)) { |
| 3486 | /* debug print - will be removed later */ |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3487 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3488 | FL("not deleting vdev object %pK (%pM)" |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3489 | "until deletion finishes for all its peers"), |
| 3490 | vdev, vdev->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3491 | /* indicate that the vdev needs to be deleted */ |
| 3492 | vdev->delete.pending = 1; |
| 3493 | vdev->delete.callback = callback; |
| 3494 | vdev->delete.context = cb_context; |
| 3495 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3496 | return; |
| 3497 | } |
| 3498 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3499 | |
Pamidipati, Vijay | 576bd15 | 2016-09-27 20:58:18 +0530 | [diff] [blame] | 3500 | dp_tx_vdev_detach(vdev); |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3501 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3502 | FL("deleting vdev object %pK (%pM)"), vdev, vdev->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3503 | |
| 3504 | qdf_mem_free(vdev); |
| 3505 | |
| 3506 | if (callback) |
| 3507 | callback(cb_context); |
| 3508 | } |
| 3509 | |
| 3510 | /* |
Tallapragada Kalyan | 46f90ce | 2018-05-15 15:03:06 +0530 | [diff] [blame] | 3511 | * dp_peer_delete_ast_entries(): Delete all AST entries for a peer |
| 3512 | * @soc - datapath soc handle |
| 3513 | * @peer - datapath peer handle |
| 3514 | * |
| 3515 | * Delete the AST entries belonging to a peer |
| 3516 | */ |
| 3517 | #ifdef FEATURE_AST |
| 3518 | static inline void dp_peer_delete_ast_entries(struct dp_soc *soc, |
| 3519 | struct dp_peer *peer) |
| 3520 | { |
| 3521 | struct dp_ast_entry *ast_entry, *temp_ast_entry; |
| 3522 | |
| 3523 | qdf_spin_lock_bh(&soc->ast_lock); |
| 3524 | DP_PEER_ITERATE_ASE_LIST(peer, ast_entry, temp_ast_entry) |
| 3525 | dp_peer_del_ast(soc, ast_entry); |
| 3526 | |
| 3527 | TAILQ_INIT(&peer->ast_entry_list); |
| 3528 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 3529 | } |
| 3530 | #else |
| 3531 | static inline void dp_peer_delete_ast_entries(struct dp_soc *soc, |
| 3532 | struct dp_peer *peer) |
| 3533 | { |
| 3534 | } |
| 3535 | #endif |
| 3536 | |
| 3537 | /* |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3538 | * dp_peer_create_wifi3() - attach txrx peer |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3539 | * @txrx_vdev: Datapath VDEV handle |
| 3540 | * @peer_mac_addr: Peer MAC address |
| 3541 | * |
| 3542 | * Return: DP peeer handle on success, NULL on failure |
| 3543 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3544 | static void *dp_peer_create_wifi3(struct cdp_vdev *vdev_handle, |
Pramod Simha | 6e10cb2 | 2018-06-20 12:05:44 -0700 | [diff] [blame] | 3545 | uint8_t *peer_mac_addr, void *ol_peer) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3546 | { |
| 3547 | struct dp_peer *peer; |
| 3548 | int i; |
| 3549 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3550 | struct dp_pdev *pdev; |
| 3551 | struct dp_soc *soc; |
Tallapragada Kalyan | 46f90ce | 2018-05-15 15:03:06 +0530 | [diff] [blame] | 3552 | struct dp_ast_entry *ast_entry; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3553 | |
| 3554 | /* preconditions */ |
| 3555 | qdf_assert(vdev); |
| 3556 | qdf_assert(peer_mac_addr); |
| 3557 | |
| 3558 | pdev = vdev->pdev; |
| 3559 | soc = pdev->soc; |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 3560 | |
| 3561 | peer = dp_peer_find_hash_find(pdev->soc, peer_mac_addr, |
| 3562 | 0, vdev->vdev_id); |
| 3563 | |
| 3564 | if (peer) { |
| 3565 | peer->delete_in_progress = false; |
Tallapragada Kalyan | 1f49bff | 2018-04-12 19:21:21 +0530 | [diff] [blame] | 3566 | |
Tallapragada Kalyan | 46f90ce | 2018-05-15 15:03:06 +0530 | [diff] [blame] | 3567 | dp_peer_delete_ast_entries(soc, peer); |
Tallapragada Kalyan | 1f49bff | 2018-04-12 19:21:21 +0530 | [diff] [blame] | 3568 | |
Ruchi, Agrawal | 44461ef | 2018-04-05 15:25:09 +0530 | [diff] [blame] | 3569 | /* |
| 3570 | * on peer create, peer ref count decrements, sice new peer is not |
| 3571 | * getting created earlier reference is reused, peer_unref_delete will |
| 3572 | * take care of incrementing count |
| 3573 | * */ |
| 3574 | if (soc->cdp_soc.ol_ops->peer_unref_delete) { |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 3575 | soc->cdp_soc.ol_ops->peer_unref_delete(pdev->ctrl_pdev, |
Ruchi, Agrawal | 44461ef | 2018-04-05 15:25:09 +0530 | [diff] [blame] | 3576 | vdev->vdev_id, peer->mac_addr.raw); |
| 3577 | } |
| 3578 | |
Sravan Kumar Kairam | da54217 | 2018-06-08 12:51:21 +0530 | [diff] [blame] | 3579 | dp_local_peer_id_alloc(pdev, peer); |
Tallapragada Kalyan | 1f49bff | 2018-04-12 19:21:21 +0530 | [diff] [blame] | 3580 | DP_STATS_INIT(peer); |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 3581 | return (void *)peer; |
Tallapragada Kalyan | 46f90ce | 2018-05-15 15:03:06 +0530 | [diff] [blame] | 3582 | } else { |
| 3583 | /* |
| 3584 | * When a STA roams from RPTR AP to ROOT AP and vice versa, we |
| 3585 | * need to remove the AST entry which was earlier added as a WDS |
| 3586 | * entry. |
| 3587 | */ |
| 3588 | ast_entry = dp_peer_ast_hash_find(soc, peer_mac_addr); |
| 3589 | if (ast_entry) |
| 3590 | dp_peer_del_ast(soc, ast_entry); |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 3591 | } |
| 3592 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3593 | #ifdef notyet |
| 3594 | peer = (struct dp_peer *)qdf_mempool_alloc(soc->osdev, |
| 3595 | soc->mempool_ol_ath_peer); |
| 3596 | #else |
| 3597 | peer = (struct dp_peer *)qdf_mem_malloc(sizeof(*peer)); |
| 3598 | #endif |
| 3599 | |
| 3600 | if (!peer) |
| 3601 | return NULL; /* failure */ |
| 3602 | |
Tallapragada | 57d8660 | 2017-03-31 07:53:58 +0530 | [diff] [blame] | 3603 | qdf_mem_zero(peer, sizeof(struct dp_peer)); |
| 3604 | |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 3605 | TAILQ_INIT(&peer->ast_entry_list); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 3606 | |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 3607 | /* store provided params */ |
| 3608 | peer->vdev = vdev; |
| 3609 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 3610 | 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] | 3611 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3612 | qdf_spinlock_create(&peer->peer_info_lock); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3613 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3614 | qdf_mem_copy( |
| 3615 | &peer->mac_addr.raw[0], peer_mac_addr, OL_TXRX_MAC_ADDR_LEN); |
| 3616 | |
| 3617 | /* TODO: See of rx_opt_proc is really required */ |
| 3618 | peer->rx_opt_proc = soc->rx_opt_proc; |
| 3619 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3620 | /* initialize the peer_id */ |
| 3621 | for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) |
| 3622 | peer->peer_ids[i] = HTT_INVALID_PEER; |
| 3623 | |
| 3624 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 3625 | |
| 3626 | qdf_atomic_init(&peer->ref_cnt); |
| 3627 | |
| 3628 | /* keep one reference for attach */ |
| 3629 | qdf_atomic_inc(&peer->ref_cnt); |
| 3630 | |
| 3631 | /* add this peer into the vdev's list */ |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 3632 | if (wlan_op_mode_sta == vdev->opmode) |
| 3633 | TAILQ_INSERT_HEAD(&vdev->peer_list, peer, peer_list_elem); |
| 3634 | else |
| 3635 | TAILQ_INSERT_TAIL(&vdev->peer_list, peer, peer_list_elem); |
| 3636 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3637 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3638 | |
| 3639 | /* TODO: See if hash based search is required */ |
| 3640 | dp_peer_find_hash_add(soc, peer); |
| 3641 | |
Varun Reddy Yeturu | b9ec57e | 2017-11-28 11:42:09 -0800 | [diff] [blame] | 3642 | /* Initialize the peer state */ |
| 3643 | peer->state = OL_TXRX_PEER_STATE_DISC; |
| 3644 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3645 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 3646 | "vdev %pK created peer %pK (%pM) ref_cnt: %d", |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 3647 | vdev, peer, peer->mac_addr.raw, |
| 3648 | qdf_atomic_read(&peer->ref_cnt)); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3649 | /* |
| 3650 | * For every peer MAp message search and set if bss_peer |
| 3651 | */ |
| 3652 | if (memcmp(peer->mac_addr.raw, vdev->mac_addr.raw, 6) == 0) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 3653 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
| 3654 | "vdev bss_peer!!!!"); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3655 | peer->bss_peer = 1; |
| 3656 | vdev->vap_bss_peer = peer; |
| 3657 | } |
| 3658 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 3659 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 3660 | dp_local_peer_id_alloc(pdev, peer); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 3661 | DP_STATS_INIT(peer); |
Pramod Simha | 6e10cb2 | 2018-06-20 12:05:44 -0700 | [diff] [blame] | 3662 | peer->ol_peer = ol_peer; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3663 | return (void *)peer; |
| 3664 | } |
| 3665 | |
| 3666 | /* |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3667 | * dp_peer_setup_wifi3() - initialize the peer |
| 3668 | * @vdev_hdl: virtual device object |
| 3669 | * @peer: Peer object |
| 3670 | * |
| 3671 | * Return: void |
| 3672 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 3673 | 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] | 3674 | { |
| 3675 | struct dp_peer *peer = (struct dp_peer *)peer_hdl; |
| 3676 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_hdl; |
| 3677 | struct dp_pdev *pdev; |
| 3678 | struct dp_soc *soc; |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 3679 | bool hash_based = 0; |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3680 | enum cdp_host_reo_dest_ring reo_dest; |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3681 | |
| 3682 | /* preconditions */ |
| 3683 | qdf_assert(vdev); |
| 3684 | qdf_assert(peer); |
| 3685 | |
| 3686 | pdev = vdev->pdev; |
| 3687 | soc = pdev->soc; |
| 3688 | |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 3689 | peer->last_assoc_rcvd = 0; |
| 3690 | peer->last_disassoc_rcvd = 0; |
| 3691 | peer->last_deauth_rcvd = 0; |
| 3692 | |
Tallapragada Kalyan | dbbb0c8 | 2017-08-24 20:58:04 +0530 | [diff] [blame] | 3693 | /* |
| 3694 | * hash based steering is disabled for Radios which are offloaded |
| 3695 | * to NSS |
| 3696 | */ |
| 3697 | if (!wlan_cfg_get_dp_pdev_nss_enabled(pdev->wlan_cfg_ctx)) |
| 3698 | hash_based = wlan_cfg_is_rx_hash_enabled(soc->wlan_cfg_ctx); |
| 3699 | |
| 3700 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 3701 | FL("hash based steering for pdev: %d is %d\n"), |
| 3702 | pdev->pdev_id, hash_based); |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 3703 | |
Tallapragada Kalyan | 61cb97c | 2017-09-20 12:42:10 +0530 | [diff] [blame] | 3704 | /* |
Jeff Johnson | 23dbde8 | 2018-05-05 23:55:52 -0700 | [diff] [blame] | 3705 | * Below line of code will ensure the proper reo_dest ring is chosen |
Tallapragada Kalyan | 61cb97c | 2017-09-20 12:42:10 +0530 | [diff] [blame] | 3706 | * for cases where toeplitz hash cannot be generated (ex: non TCP/UDP) |
| 3707 | */ |
| 3708 | reo_dest = pdev->reo_dest; |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3709 | |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3710 | if (soc->cdp_soc.ol_ops->peer_set_default_routing) { |
| 3711 | /* TODO: Check the destination ring number to be passed to FW */ |
Dhanashri Atre | 1404917 | 2016-11-11 18:32:36 -0800 | [diff] [blame] | 3712 | soc->cdp_soc.ol_ops->peer_set_default_routing( |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 3713 | pdev->ctrl_pdev, peer->mac_addr.raw, |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3714 | peer->vdev->vdev_id, hash_based, reo_dest); |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3715 | } |
Ruchi, Agrawal | 8e2796b | 2018-02-07 19:07:43 +0530 | [diff] [blame] | 3716 | |
| 3717 | dp_peer_rx_init(pdev, peer); |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 3718 | return; |
| 3719 | } |
| 3720 | |
| 3721 | /* |
Kalyan Tallapragada | 277f45e | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 3722 | * dp_set_vdev_tx_encap_type() - set the encap type of the vdev |
| 3723 | * @vdev_handle: virtual device object |
| 3724 | * @htt_pkt_type: type of pkt |
| 3725 | * |
| 3726 | * Return: void |
| 3727 | */ |
| 3728 | static void dp_set_vdev_tx_encap_type(struct cdp_vdev *vdev_handle, |
| 3729 | enum htt_cmn_pkt_type val) |
| 3730 | { |
| 3731 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3732 | vdev->tx_encap_type = val; |
| 3733 | } |
| 3734 | |
| 3735 | /* |
| 3736 | * dp_set_vdev_rx_decap_type() - set the decap type of the vdev |
| 3737 | * @vdev_handle: virtual device object |
| 3738 | * @htt_pkt_type: type of pkt |
| 3739 | * |
| 3740 | * Return: void |
| 3741 | */ |
| 3742 | static void dp_set_vdev_rx_decap_type(struct cdp_vdev *vdev_handle, |
| 3743 | enum htt_cmn_pkt_type val) |
| 3744 | { |
| 3745 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 3746 | vdev->rx_decap_type = val; |
| 3747 | } |
| 3748 | |
| 3749 | /* |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3750 | * dp_set_pdev_reo_dest() - set the reo destination ring for this pdev |
| 3751 | * @pdev_handle: physical device object |
| 3752 | * @val: reo destination ring index (1 - 4) |
| 3753 | * |
| 3754 | * Return: void |
| 3755 | */ |
| 3756 | static void dp_set_pdev_reo_dest(struct cdp_pdev *pdev_handle, |
| 3757 | enum cdp_host_reo_dest_ring val) |
| 3758 | { |
| 3759 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3760 | |
| 3761 | if (pdev) |
| 3762 | pdev->reo_dest = val; |
| 3763 | } |
| 3764 | |
| 3765 | /* |
| 3766 | * dp_get_pdev_reo_dest() - get the reo destination for this pdev |
| 3767 | * @pdev_handle: physical device object |
| 3768 | * |
| 3769 | * Return: reo destination ring index |
| 3770 | */ |
| 3771 | static enum cdp_host_reo_dest_ring |
| 3772 | dp_get_pdev_reo_dest(struct cdp_pdev *pdev_handle) |
| 3773 | { |
| 3774 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3775 | |
| 3776 | if (pdev) |
| 3777 | return pdev->reo_dest; |
| 3778 | else |
| 3779 | return cdp_host_reo_dest_ring_unknown; |
| 3780 | } |
| 3781 | |
Bharat Bhushan Chakravarty | 145d393 | 2017-03-20 12:52:16 -0700 | [diff] [blame] | 3782 | #ifdef QCA_SUPPORT_SON |
| 3783 | static void dp_son_peer_authorize(struct dp_peer *peer) |
| 3784 | { |
| 3785 | struct dp_soc *soc; |
| 3786 | soc = peer->vdev->pdev->soc; |
| 3787 | peer->peer_bs_inact_flag = 0; |
| 3788 | peer->peer_bs_inact = soc->pdev_bs_inact_reload; |
| 3789 | return; |
| 3790 | } |
| 3791 | #else |
| 3792 | static void dp_son_peer_authorize(struct dp_peer *peer) |
| 3793 | { |
| 3794 | return; |
| 3795 | } |
| 3796 | #endif |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 3797 | /* |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 3798 | * dp_set_filter_neighbour_peers() - set filter neighbour peers for smart mesh |
| 3799 | * @pdev_handle: device object |
| 3800 | * @val: value to be set |
| 3801 | * |
| 3802 | * Return: void |
| 3803 | */ |
| 3804 | static int dp_set_filter_neighbour_peers(struct cdp_pdev *pdev_handle, |
| 3805 | uint32_t val) |
| 3806 | { |
| 3807 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3808 | |
| 3809 | /* Enable/Disable smart mesh filtering. This flag will be checked |
| 3810 | * during rx processing to check if packets are from NAC clients. |
| 3811 | */ |
| 3812 | pdev->filter_neighbour_peers = val; |
| 3813 | return 0; |
| 3814 | } |
| 3815 | |
| 3816 | /* |
| 3817 | * dp_update_filter_neighbour_peers() - set neighbour peers(nac clients) |
| 3818 | * address for smart mesh filtering |
| 3819 | * @pdev_handle: device object |
| 3820 | * @cmd: Add/Del command |
| 3821 | * @macaddr: nac client mac address |
| 3822 | * |
| 3823 | * Return: void |
| 3824 | */ |
| 3825 | static int dp_update_filter_neighbour_peers(struct cdp_pdev *pdev_handle, |
| 3826 | uint32_t cmd, uint8_t *macaddr) |
| 3827 | { |
| 3828 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3829 | struct dp_neighbour_peer *peer = NULL; |
| 3830 | |
| 3831 | if (!macaddr) |
| 3832 | goto fail0; |
| 3833 | |
| 3834 | /* Store address of NAC (neighbour peer) which will be checked |
| 3835 | * against TA of received packets. |
| 3836 | */ |
| 3837 | if (cmd == DP_NAC_PARAM_ADD) { |
| 3838 | peer = (struct dp_neighbour_peer *) qdf_mem_malloc( |
| 3839 | sizeof(*peer)); |
| 3840 | |
| 3841 | if (!peer) { |
| 3842 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 3843 | FL("DP neighbour peer node memory allocation failed")); |
| 3844 | goto fail0; |
| 3845 | } |
| 3846 | |
| 3847 | qdf_mem_copy(&peer->neighbour_peers_macaddr.raw[0], |
| 3848 | macaddr, DP_MAC_ADDR_LEN); |
| 3849 | |
| 3850 | |
| 3851 | qdf_spin_lock_bh(&pdev->neighbour_peer_mutex); |
| 3852 | /* add this neighbour peer into the list */ |
| 3853 | TAILQ_INSERT_TAIL(&pdev->neighbour_peers_list, peer, |
| 3854 | neighbour_peer_list_elem); |
| 3855 | qdf_spin_unlock_bh(&pdev->neighbour_peer_mutex); |
| 3856 | |
| 3857 | return 1; |
| 3858 | |
| 3859 | } else if (cmd == DP_NAC_PARAM_DEL) { |
| 3860 | qdf_spin_lock_bh(&pdev->neighbour_peer_mutex); |
| 3861 | TAILQ_FOREACH(peer, &pdev->neighbour_peers_list, |
| 3862 | neighbour_peer_list_elem) { |
| 3863 | if (!qdf_mem_cmp(&peer->neighbour_peers_macaddr.raw[0], |
| 3864 | macaddr, DP_MAC_ADDR_LEN)) { |
| 3865 | /* delete this peer from the list */ |
| 3866 | TAILQ_REMOVE(&pdev->neighbour_peers_list, |
| 3867 | peer, neighbour_peer_list_elem); |
| 3868 | qdf_mem_free(peer); |
| 3869 | break; |
| 3870 | } |
| 3871 | } |
| 3872 | qdf_spin_unlock_bh(&pdev->neighbour_peer_mutex); |
| 3873 | |
| 3874 | return 1; |
| 3875 | |
| 3876 | } |
| 3877 | |
| 3878 | fail0: |
| 3879 | return 0; |
| 3880 | } |
| 3881 | |
| 3882 | /* |
Chaitanya Kiran Godavarthi | 6228e3b | 2017-06-15 14:28:19 +0530 | [diff] [blame] | 3883 | * dp_get_sec_type() - Get the security type |
| 3884 | * @peer: Datapath peer handle |
| 3885 | * @sec_idx: Security id (mcast, ucast) |
| 3886 | * |
| 3887 | * return sec_type: Security type |
| 3888 | */ |
| 3889 | static int dp_get_sec_type(struct cdp_peer *peer, uint8_t sec_idx) |
| 3890 | { |
| 3891 | struct dp_peer *dpeer = (struct dp_peer *)peer; |
| 3892 | |
| 3893 | return dpeer->security[sec_idx].sec_type; |
| 3894 | } |
| 3895 | |
| 3896 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3897 | * dp_peer_authorize() - authorize txrx peer |
| 3898 | * @peer_handle: Datapath peer handle |
| 3899 | * @authorize |
| 3900 | * |
| 3901 | */ |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 3902 | 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] | 3903 | { |
| 3904 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 3905 | struct dp_soc *soc; |
| 3906 | |
| 3907 | if (peer != NULL) { |
| 3908 | soc = peer->vdev->pdev->soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3909 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
Bharat Bhushan Chakravarty | 145d393 | 2017-03-20 12:52:16 -0700 | [diff] [blame] | 3910 | dp_son_peer_authorize(peer); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3911 | peer->authorize = authorize ? 1 : 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 3912 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3913 | } |
| 3914 | } |
| 3915 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3916 | #ifdef QCA_SUPPORT_SON |
| 3917 | /* |
| 3918 | * dp_txrx_update_inact_threshold() - Update inact timer threshold |
| 3919 | * @pdev_handle: Device handle |
| 3920 | * @new_threshold : updated threshold value |
| 3921 | * |
| 3922 | */ |
| 3923 | static void |
| 3924 | dp_txrx_update_inact_threshold(struct cdp_pdev *pdev_handle, |
| 3925 | u_int16_t new_threshold) |
| 3926 | { |
| 3927 | struct dp_vdev *vdev; |
| 3928 | struct dp_peer *peer; |
| 3929 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3930 | struct dp_soc *soc = pdev->soc; |
| 3931 | u_int16_t old_threshold = soc->pdev_bs_inact_reload; |
| 3932 | |
| 3933 | if (old_threshold == new_threshold) |
| 3934 | return; |
| 3935 | |
| 3936 | soc->pdev_bs_inact_reload = new_threshold; |
| 3937 | |
| 3938 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 3939 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3940 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 3941 | if (vdev->opmode != wlan_op_mode_ap) |
| 3942 | continue; |
| 3943 | |
| 3944 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 3945 | if (!peer->authorize) |
| 3946 | continue; |
| 3947 | |
| 3948 | if (old_threshold - peer->peer_bs_inact >= |
| 3949 | new_threshold) { |
| 3950 | dp_mark_peer_inact((void *)peer, true); |
| 3951 | peer->peer_bs_inact = 0; |
| 3952 | } else { |
| 3953 | peer->peer_bs_inact = new_threshold - |
| 3954 | (old_threshold - peer->peer_bs_inact); |
| 3955 | } |
| 3956 | } |
| 3957 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 3958 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3959 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3960 | } |
| 3961 | |
| 3962 | /** |
| 3963 | * dp_txrx_reset_inact_count(): Reset inact count |
| 3964 | * @pdev_handle - device handle |
| 3965 | * |
| 3966 | * Return: void |
| 3967 | */ |
| 3968 | static void |
| 3969 | dp_txrx_reset_inact_count(struct cdp_pdev *pdev_handle) |
| 3970 | { |
| 3971 | struct dp_vdev *vdev = NULL; |
| 3972 | struct dp_peer *peer = NULL; |
| 3973 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 3974 | struct dp_soc *soc = pdev->soc; |
| 3975 | |
| 3976 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 3977 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3978 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 3979 | if (vdev->opmode != wlan_op_mode_ap) |
| 3980 | continue; |
| 3981 | |
| 3982 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 3983 | if (!peer->authorize) |
| 3984 | continue; |
| 3985 | |
| 3986 | peer->peer_bs_inact = soc->pdev_bs_inact_reload; |
| 3987 | } |
| 3988 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 3989 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 3990 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 3991 | } |
| 3992 | |
| 3993 | /** |
| 3994 | * dp_set_inact_params(): set inactivity params |
| 3995 | * @pdev_handle - device handle |
| 3996 | * @inact_check_interval - inactivity interval |
| 3997 | * @inact_normal - Inactivity normal |
| 3998 | * @inact_overload - Inactivity overload |
| 3999 | * |
| 4000 | * Return: bool |
| 4001 | */ |
| 4002 | bool dp_set_inact_params(struct cdp_pdev *pdev_handle, |
| 4003 | u_int16_t inact_check_interval, |
| 4004 | u_int16_t inact_normal, u_int16_t inact_overload) |
| 4005 | { |
| 4006 | struct dp_soc *soc; |
| 4007 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4008 | |
| 4009 | if (!pdev) |
| 4010 | return false; |
| 4011 | |
| 4012 | soc = pdev->soc; |
| 4013 | if (!soc) |
| 4014 | return false; |
| 4015 | |
| 4016 | soc->pdev_bs_inact_interval = inact_check_interval; |
| 4017 | soc->pdev_bs_inact_normal = inact_normal; |
| 4018 | soc->pdev_bs_inact_overload = inact_overload; |
| 4019 | |
| 4020 | dp_txrx_update_inact_threshold((struct cdp_pdev *)pdev, |
| 4021 | soc->pdev_bs_inact_normal); |
| 4022 | |
| 4023 | return true; |
| 4024 | } |
| 4025 | |
| 4026 | /** |
| 4027 | * dp_start_inact_timer(): Inactivity timer start |
| 4028 | * @pdev_handle - device handle |
| 4029 | * @enable - Inactivity timer start/stop |
| 4030 | * |
| 4031 | * Return: bool |
| 4032 | */ |
| 4033 | bool dp_start_inact_timer(struct cdp_pdev *pdev_handle, bool enable) |
| 4034 | { |
| 4035 | struct dp_soc *soc; |
| 4036 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4037 | |
| 4038 | if (!pdev) |
| 4039 | return false; |
| 4040 | |
| 4041 | soc = pdev->soc; |
| 4042 | if (!soc) |
| 4043 | return false; |
| 4044 | |
| 4045 | if (enable) { |
| 4046 | dp_txrx_reset_inact_count((struct cdp_pdev *)pdev); |
| 4047 | qdf_timer_mod(&soc->pdev_bs_inact_timer, |
| 4048 | soc->pdev_bs_inact_interval * 1000); |
| 4049 | } else { |
| 4050 | qdf_timer_stop(&soc->pdev_bs_inact_timer); |
| 4051 | } |
| 4052 | |
| 4053 | return true; |
| 4054 | } |
| 4055 | |
| 4056 | /** |
| 4057 | * dp_set_overload(): Set inactivity overload |
| 4058 | * @pdev_handle - device handle |
| 4059 | * @overload - overload status |
| 4060 | * |
| 4061 | * Return: void |
| 4062 | */ |
| 4063 | void dp_set_overload(struct cdp_pdev *pdev_handle, bool overload) |
| 4064 | { |
| 4065 | struct dp_soc *soc; |
| 4066 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4067 | |
| 4068 | if (!pdev) |
| 4069 | return; |
| 4070 | |
| 4071 | soc = pdev->soc; |
| 4072 | if (!soc) |
| 4073 | return; |
| 4074 | |
| 4075 | dp_txrx_update_inact_threshold((struct cdp_pdev *)pdev, |
| 4076 | overload ? soc->pdev_bs_inact_overload : |
| 4077 | soc->pdev_bs_inact_normal); |
| 4078 | } |
| 4079 | |
| 4080 | /** |
| 4081 | * dp_peer_is_inact(): check whether peer is inactive |
| 4082 | * @peer_handle - datapath peer handle |
| 4083 | * |
| 4084 | * Return: bool |
| 4085 | */ |
| 4086 | bool dp_peer_is_inact(void *peer_handle) |
| 4087 | { |
| 4088 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 4089 | |
| 4090 | if (!peer) |
| 4091 | return false; |
| 4092 | |
| 4093 | return peer->peer_bs_inact_flag == 1; |
| 4094 | } |
| 4095 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 4096 | /** |
| 4097 | * dp_init_inact_timer: initialize the inact timer |
| 4098 | * @soc - SOC handle |
| 4099 | * |
| 4100 | * Return: void |
| 4101 | */ |
| 4102 | void dp_init_inact_timer(struct dp_soc *soc) |
| 4103 | { |
| 4104 | qdf_timer_init(soc->osdev, &soc->pdev_bs_inact_timer, |
| 4105 | dp_txrx_peer_find_inact_timeout_handler, |
| 4106 | (void *)soc, QDF_TIMER_TYPE_WAKE_APPS); |
| 4107 | } |
| 4108 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 4109 | #else |
| 4110 | |
| 4111 | bool dp_set_inact_params(struct cdp_pdev *pdev, u_int16_t inact_check_interval, |
| 4112 | u_int16_t inact_normal, u_int16_t inact_overload) |
| 4113 | { |
| 4114 | return false; |
| 4115 | } |
| 4116 | |
| 4117 | bool dp_start_inact_timer(struct cdp_pdev *pdev, bool enable) |
| 4118 | { |
| 4119 | return false; |
| 4120 | } |
| 4121 | |
| 4122 | void dp_set_overload(struct cdp_pdev *pdev, bool overload) |
| 4123 | { |
| 4124 | return; |
| 4125 | } |
| 4126 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 4127 | void dp_init_inact_timer(struct dp_soc *soc) |
| 4128 | { |
| 4129 | return; |
| 4130 | } |
| 4131 | |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 4132 | bool dp_peer_is_inact(void *peer) |
| 4133 | { |
| 4134 | return false; |
| 4135 | } |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 4136 | #endif |
| 4137 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4138 | /* |
| 4139 | * dp_peer_unref_delete() - unref and delete peer |
| 4140 | * @peer_handle: Datapath peer handle |
| 4141 | * |
| 4142 | */ |
| 4143 | void dp_peer_unref_delete(void *peer_handle) |
| 4144 | { |
| 4145 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4146 | struct dp_peer *bss_peer = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4147 | struct dp_vdev *vdev = peer->vdev; |
Kiran Venkatappa | 9edb961 | 2017-03-16 11:37:35 +0530 | [diff] [blame] | 4148 | struct dp_pdev *pdev = vdev->pdev; |
| 4149 | struct dp_soc *soc = pdev->soc; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4150 | struct dp_peer *tmppeer; |
| 4151 | int found = 0; |
| 4152 | uint16_t peer_id; |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4153 | uint16_t vdev_id; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4154 | |
| 4155 | /* |
| 4156 | * Hold the lock all the way from checking if the peer ref count |
| 4157 | * is zero until the peer references are removed from the hash |
| 4158 | * table and vdev list (if the peer ref count is zero). |
| 4159 | * This protects against a new HL tx operation starting to use the |
| 4160 | * peer object just after this function concludes it's done being used. |
| 4161 | * Furthermore, the lock needs to be held while checking whether the |
| 4162 | * vdev's list of peers is empty, to make sure that list is not modified |
| 4163 | * concurrently with the empty check. |
| 4164 | */ |
| 4165 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 4166 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4167 | "%s: peer %pK ref_cnt(before decrement): %d\n", __func__, |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 4168 | peer, qdf_atomic_read(&peer->ref_cnt)); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4169 | if (qdf_atomic_dec_and_test(&peer->ref_cnt)) { |
| 4170 | peer_id = peer->peer_ids[0]; |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4171 | vdev_id = vdev->vdev_id; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4172 | |
| 4173 | /* |
| 4174 | * Make sure that the reference to the peer in |
| 4175 | * peer object map is removed |
| 4176 | */ |
| 4177 | if (peer_id != HTT_INVALID_PEER) |
| 4178 | soc->peer_id_to_obj_map[peer_id] = NULL; |
| 4179 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 4180 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4181 | "Deleting peer %pK (%pM)", peer, peer->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4182 | |
| 4183 | /* remove the reference to the peer from the hash table */ |
| 4184 | dp_peer_find_hash_remove(soc, peer); |
| 4185 | |
| 4186 | TAILQ_FOREACH(tmppeer, &peer->vdev->peer_list, peer_list_elem) { |
| 4187 | if (tmppeer == peer) { |
| 4188 | found = 1; |
| 4189 | break; |
| 4190 | } |
| 4191 | } |
| 4192 | if (found) { |
| 4193 | TAILQ_REMOVE(&peer->vdev->peer_list, peer, |
| 4194 | peer_list_elem); |
| 4195 | } else { |
| 4196 | /*Ignoring the remove operation as peer not found*/ |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 4197 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4198 | "peer %pK not found in vdev (%pK)->peer_list:%pK", |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4199 | peer, vdev, &peer->vdev->peer_list); |
| 4200 | } |
| 4201 | |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 4202 | /* cleanup the peer data */ |
| 4203 | dp_peer_cleanup(vdev, peer); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4204 | |
| 4205 | /* check whether the parent vdev has no peers left */ |
| 4206 | if (TAILQ_EMPTY(&vdev->peer_list)) { |
| 4207 | /* |
| 4208 | * Now that there are no references to the peer, we can |
| 4209 | * release the peer reference lock. |
| 4210 | */ |
| 4211 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 4212 | /* |
| 4213 | * Check if the parent vdev was waiting for its peers |
| 4214 | * to be deleted, in order for it to be deleted too. |
| 4215 | */ |
| 4216 | if (vdev->delete.pending) { |
| 4217 | ol_txrx_vdev_delete_cb vdev_delete_cb = |
| 4218 | vdev->delete.callback; |
| 4219 | void *vdev_delete_context = |
| 4220 | vdev->delete.context; |
| 4221 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 4222 | QDF_TRACE(QDF_MODULE_ID_DP, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4223 | QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4224 | FL("deleting vdev object %pK (%pM)" |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 4225 | " - its last peer is done"), |
| 4226 | vdev, vdev->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4227 | /* all peers are gone, go ahead and delete it */ |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4228 | dp_tx_flow_pool_unmap_handler(pdev, vdev_id, |
chenguo | 7853b79 | 2017-12-28 20:59:12 +0800 | [diff] [blame] | 4229 | FLOW_TYPE_VDEV, |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4230 | vdev_id); |
chenguo | 7853b79 | 2017-12-28 20:59:12 +0800 | [diff] [blame] | 4231 | dp_tx_vdev_detach(vdev); |
| 4232 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 4233 | QDF_TRACE_LEVEL_INFO_HIGH, |
| 4234 | FL("deleting vdev object %pK (%pM)"), |
| 4235 | vdev, vdev->mac_addr.raw); |
| 4236 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4237 | qdf_mem_free(vdev); |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4238 | vdev = NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4239 | if (vdev_delete_cb) |
| 4240 | vdev_delete_cb(vdev_delete_context); |
| 4241 | } |
| 4242 | } else { |
| 4243 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 4244 | } |
chenguo | 1dead6f | 2018-01-08 14:51:44 +0800 | [diff] [blame] | 4245 | |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4246 | if (vdev) { |
| 4247 | if (vdev->vap_bss_peer == peer) { |
| 4248 | vdev->vap_bss_peer = NULL; |
| 4249 | } |
| 4250 | } |
| 4251 | |
chenguo | 1dead6f | 2018-01-08 14:51:44 +0800 | [diff] [blame] | 4252 | if (soc->cdp_soc.ol_ops->peer_unref_delete) { |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 4253 | soc->cdp_soc.ol_ops->peer_unref_delete(pdev->ctrl_pdev, |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4254 | vdev_id, peer->mac_addr.raw); |
chenguo | 1dead6f | 2018-01-08 14:51:44 +0800 | [diff] [blame] | 4255 | } |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4256 | |
| 4257 | if (!vdev || !vdev->vap_bss_peer) { |
| 4258 | goto free_peer; |
| 4259 | } |
| 4260 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4261 | #ifdef notyet |
| 4262 | qdf_mempool_free(soc->osdev, soc->mempool_ol_ath_peer, peer); |
| 4263 | #else |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4264 | bss_peer = vdev->vap_bss_peer; |
| 4265 | DP_UPDATE_STATS(bss_peer, peer); |
| 4266 | |
| 4267 | free_peer: |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4268 | qdf_mem_free(peer); |
Manoj Ekbote | 4a59d8d | 2018-02-14 10:13:27 -0800 | [diff] [blame] | 4269 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4270 | #endif |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4271 | } else { |
| 4272 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 4273 | } |
| 4274 | } |
| 4275 | |
| 4276 | /* |
| 4277 | * dp_peer_detach_wifi3() – Detach txrx peer |
Naveen Rawat | 761329b | 2017-09-19 10:30:11 -0700 | [diff] [blame] | 4278 | * @peer_handle: Datapath peer handle |
| 4279 | * @bitmap: bitmap indicating special handling of request. |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4280 | * |
| 4281 | */ |
Naveen Rawat | 761329b | 2017-09-19 10:30:11 -0700 | [diff] [blame] | 4282 | static void dp_peer_delete_wifi3(void *peer_handle, uint32_t bitmap) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4283 | { |
| 4284 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 4285 | |
| 4286 | /* redirect the peer's rx delivery function to point to a |
| 4287 | * discard func |
| 4288 | */ |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 4289 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4290 | peer->rx_opt_proc = dp_rx_discard; |
| 4291 | |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 4292 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4293 | FL("peer %pK (%pM)"), peer, peer->mac_addr.raw); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4294 | |
Krishna Kumaar Natarajan | 604fe16 | 2017-01-28 18:37:01 -0800 | [diff] [blame] | 4295 | dp_local_peer_id_free(peer->vdev->pdev, peer); |
Krishna Kumaar Natarajan | 604fe16 | 2017-01-28 18:37:01 -0800 | [diff] [blame] | 4296 | qdf_spinlock_destroy(&peer->peer_info_lock); |
| 4297 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 4298 | /* |
| 4299 | * Remove the reference added during peer_attach. |
| 4300 | * The peer will still be left allocated until the |
| 4301 | * PEER_UNMAP message arrives to remove the other |
| 4302 | * reference, added by the PEER_MAP message. |
| 4303 | */ |
| 4304 | dp_peer_unref_delete(peer_handle); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4305 | } |
| 4306 | |
| 4307 | /* |
| 4308 | * dp_get_vdev_mac_addr_wifi3() – Detach txrx peer |
| 4309 | * @peer_handle: Datapath peer handle |
| 4310 | * |
| 4311 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4312 | static uint8 *dp_get_vdev_mac_addr_wifi3(struct cdp_vdev *pvdev) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4313 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4314 | struct dp_vdev *vdev = (struct dp_vdev *)pvdev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4315 | return vdev->mac_addr.raw; |
| 4316 | } |
| 4317 | |
| 4318 | /* |
Karunakar Dasineni | ca79254 | 2017-01-16 10:08:58 -0800 | [diff] [blame] | 4319 | * dp_vdev_set_wds() - Enable per packet stats |
| 4320 | * @vdev_handle: DP VDEV handle |
| 4321 | * @val: value |
| 4322 | * |
| 4323 | * Return: none |
| 4324 | */ |
| 4325 | static int dp_vdev_set_wds(void *vdev_handle, uint32_t val) |
| 4326 | { |
| 4327 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4328 | |
| 4329 | vdev->wds_enabled = val; |
| 4330 | return 0; |
| 4331 | } |
| 4332 | |
| 4333 | /* |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4334 | * dp_get_vdev_from_vdev_id_wifi3() – Detach txrx peer |
| 4335 | * @peer_handle: Datapath peer handle |
| 4336 | * |
| 4337 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4338 | static struct cdp_vdev *dp_get_vdev_from_vdev_id_wifi3(struct cdp_pdev *dev, |
| 4339 | uint8_t vdev_id) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4340 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4341 | struct dp_pdev *pdev = (struct dp_pdev *)dev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4342 | struct dp_vdev *vdev = NULL; |
| 4343 | |
| 4344 | if (qdf_unlikely(!pdev)) |
| 4345 | return NULL; |
| 4346 | |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 4347 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4348 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 4349 | if (vdev->vdev_id == vdev_id) |
| 4350 | break; |
| 4351 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 4352 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4353 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4354 | return (struct cdp_vdev *)vdev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4355 | } |
| 4356 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4357 | static int dp_get_opmode(struct cdp_vdev *vdev_handle) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4358 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4359 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4360 | |
| 4361 | return vdev->opmode; |
| 4362 | } |
| 4363 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4364 | 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] | 4365 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4366 | struct dp_vdev *vdev = (struct dp_vdev *)pvdev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4367 | struct dp_pdev *pdev = vdev->pdev; |
| 4368 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 4369 | return (struct cdp_cfg *)pdev->wlan_cfg_ctx; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4370 | } |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 4371 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4372 | /** |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4373 | * dp_reset_monitor_mode() - Disable monitor mode |
| 4374 | * @pdev_handle: Datapath PDEV handle |
| 4375 | * |
| 4376 | * Return: 0 on success, not 0 on failure |
| 4377 | */ |
| 4378 | static int dp_reset_monitor_mode(struct cdp_pdev *pdev_handle) |
| 4379 | { |
| 4380 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4381 | struct htt_rx_ring_tlv_filter htt_tlv_filter; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4382 | struct dp_soc *soc = pdev->soc; |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4383 | uint8_t pdev_id; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4384 | int mac_id; |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4385 | |
| 4386 | pdev_id = pdev->pdev_id; |
| 4387 | soc = pdev->soc; |
| 4388 | |
Sumedh Baikady | 12b2b2c | 2018-03-05 16:50:58 -0800 | [diff] [blame] | 4389 | qdf_spin_lock_bh(&pdev->mon_lock); |
| 4390 | |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4391 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 4392 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4393 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 4394 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4395 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4396 | htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, |
| 4397 | pdev->rxdma_mon_buf_ring[mac_id].hal_srng, |
| 4398 | RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4399 | |
| 4400 | htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, |
| 4401 | pdev->rxdma_mon_status_ring[mac_id].hal_srng, |
| 4402 | RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4403 | } |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4404 | |
Sumedh Baikady | 12b2b2c | 2018-03-05 16:50:58 -0800 | [diff] [blame] | 4405 | pdev->monitor_vdev = NULL; |
| 4406 | |
| 4407 | qdf_spin_unlock_bh(&pdev->mon_lock); |
| 4408 | |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4409 | return 0; |
| 4410 | } |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 4411 | |
| 4412 | /** |
| 4413 | * dp_set_nac() - set peer_nac |
| 4414 | * @peer_handle: Datapath PEER handle |
| 4415 | * |
| 4416 | * Return: void |
| 4417 | */ |
| 4418 | static void dp_set_nac(struct cdp_peer *peer_handle) |
| 4419 | { |
| 4420 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 4421 | |
| 4422 | peer->nac = 1; |
| 4423 | } |
| 4424 | |
| 4425 | /** |
| 4426 | * dp_get_tx_pending() - read pending tx |
| 4427 | * @pdev_handle: Datapath PDEV handle |
| 4428 | * |
| 4429 | * Return: outstanding tx |
| 4430 | */ |
| 4431 | static int dp_get_tx_pending(struct cdp_pdev *pdev_handle) |
| 4432 | { |
| 4433 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4434 | |
| 4435 | return qdf_atomic_read(&pdev->num_tx_outstanding); |
| 4436 | } |
| 4437 | |
| 4438 | /** |
| 4439 | * dp_get_peer_mac_from_peer_id() - get peer mac |
| 4440 | * @pdev_handle: Datapath PDEV handle |
| 4441 | * @peer_id: Peer ID |
| 4442 | * @peer_mac: MAC addr of PEER |
| 4443 | * |
| 4444 | * Return: void |
| 4445 | */ |
| 4446 | static void dp_get_peer_mac_from_peer_id(struct cdp_pdev *pdev_handle, |
| 4447 | uint32_t peer_id, uint8_t *peer_mac) |
| 4448 | { |
| 4449 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4450 | struct dp_peer *peer; |
| 4451 | |
| 4452 | if (pdev && peer_mac) { |
| 4453 | peer = dp_peer_find_by_id(pdev->soc, (uint16_t)peer_id); |
| 4454 | if (peer && peer->mac_addr.raw) { |
| 4455 | qdf_mem_copy(peer_mac, peer->mac_addr.raw, |
| 4456 | DP_MAC_ADDR_LEN); |
| 4457 | } |
| 4458 | } |
| 4459 | } |
| 4460 | |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 4461 | /** |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4462 | * dp_vdev_set_monitor_mode() - Set DP VDEV to monitor mode |
| 4463 | * @vdev_handle: Datapath VDEV handle |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 4464 | * @smart_monitor: Flag to denote if its smart monitor mode |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4465 | * |
| 4466 | * Return: 0 on success, not 0 on failure |
| 4467 | */ |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 4468 | static int dp_vdev_set_monitor_mode(struct cdp_vdev *vdev_handle, |
| 4469 | uint8_t smart_monitor) |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4470 | { |
| 4471 | /* Many monitor VAPs can exists in a system but only one can be up at |
| 4472 | * anytime |
| 4473 | */ |
| 4474 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4475 | struct dp_pdev *pdev; |
| 4476 | struct htt_rx_ring_tlv_filter htt_tlv_filter; |
| 4477 | struct dp_soc *soc; |
| 4478 | uint8_t pdev_id; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4479 | int mac_id; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4480 | |
| 4481 | qdf_assert(vdev); |
| 4482 | |
| 4483 | pdev = vdev->pdev; |
| 4484 | pdev_id = pdev->pdev_id; |
| 4485 | soc = pdev->soc; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4486 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4487 | "pdev=%pK, pdev_id=%d, soc=%pK vdev=%pK\n", |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4488 | pdev, pdev_id, soc, vdev); |
| 4489 | |
| 4490 | /*Check if current pdev's monitor_vdev exists */ |
| 4491 | if (pdev->monitor_vdev) { |
| 4492 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 4493 | "vdev=%pK\n", vdev); |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4494 | qdf_assert(vdev); |
| 4495 | } |
| 4496 | |
| 4497 | pdev->monitor_vdev = vdev; |
| 4498 | |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 4499 | /* If smart monitor mode, do not configure monitor ring */ |
| 4500 | if (smart_monitor) |
| 4501 | return QDF_STATUS_SUCCESS; |
| 4502 | |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4503 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 4504 | "MODE[%x] FP[%02x|%02x|%02x] MO[%02x|%02x|%02x]\n", |
| 4505 | pdev->mon_filter_mode, pdev->fp_mgmt_filter, |
| 4506 | pdev->fp_ctrl_filter, pdev->fp_data_filter, |
| 4507 | pdev->mo_mgmt_filter, pdev->mo_ctrl_filter, |
| 4508 | pdev->mo_data_filter); |
| 4509 | |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4510 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 4511 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4512 | htt_tlv_filter.mpdu_start = 1; |
| 4513 | htt_tlv_filter.msdu_start = 1; |
| 4514 | htt_tlv_filter.packet = 1; |
| 4515 | htt_tlv_filter.msdu_end = 1; |
| 4516 | htt_tlv_filter.mpdu_end = 1; |
| 4517 | htt_tlv_filter.packet_header = 1; |
| 4518 | htt_tlv_filter.attention = 1; |
| 4519 | htt_tlv_filter.ppdu_start = 0; |
| 4520 | htt_tlv_filter.ppdu_end = 0; |
| 4521 | htt_tlv_filter.ppdu_end_user_stats = 0; |
| 4522 | htt_tlv_filter.ppdu_end_user_stats_ext = 0; |
| 4523 | htt_tlv_filter.ppdu_end_status_done = 0; |
sumedh baikady | 308ff00 | 2017-09-18 16:24:36 -0700 | [diff] [blame] | 4524 | htt_tlv_filter.header_per_msdu = 1; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4525 | htt_tlv_filter.enable_fp = |
| 4526 | (pdev->mon_filter_mode & MON_FILTER_PASS) ? 1 : 0; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4527 | htt_tlv_filter.enable_md = 0; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4528 | htt_tlv_filter.enable_mo = |
| 4529 | (pdev->mon_filter_mode & MON_FILTER_OTHER) ? 1 : 0; |
| 4530 | htt_tlv_filter.fp_mgmt_filter = pdev->fp_mgmt_filter; |
| 4531 | htt_tlv_filter.fp_ctrl_filter = pdev->fp_ctrl_filter; |
| 4532 | htt_tlv_filter.fp_data_filter = pdev->fp_data_filter; |
| 4533 | htt_tlv_filter.mo_mgmt_filter = pdev->mo_mgmt_filter; |
| 4534 | htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; |
| 4535 | htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4536 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4537 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 4538 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); |
| 4539 | |
| 4540 | htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, |
| 4541 | pdev->rxdma_mon_buf_ring[mac_id].hal_srng, |
| 4542 | RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4543 | } |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4544 | |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4545 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 4546 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4547 | htt_tlv_filter.mpdu_start = 1; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4548 | htt_tlv_filter.msdu_start = 0; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4549 | htt_tlv_filter.packet = 0; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4550 | htt_tlv_filter.msdu_end = 0; |
| 4551 | htt_tlv_filter.mpdu_end = 0; |
| 4552 | htt_tlv_filter.attention = 0; |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4553 | htt_tlv_filter.ppdu_start = 1; |
| 4554 | htt_tlv_filter.ppdu_end = 1; |
| 4555 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 4556 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 4557 | htt_tlv_filter.ppdu_end_status_done = 1; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4558 | htt_tlv_filter.enable_fp = 1; |
Karunakar Dasineni | 4055568 | 2017-03-26 22:44:39 -0700 | [diff] [blame] | 4559 | htt_tlv_filter.enable_md = 0; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4560 | htt_tlv_filter.enable_mo = 1; |
| 4561 | if (pdev->mcopy_mode) { |
| 4562 | htt_tlv_filter.packet_header = 1; |
| 4563 | } |
| 4564 | htt_tlv_filter.fp_mgmt_filter = FILTER_MGMT_ALL; |
| 4565 | htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_ALL; |
| 4566 | htt_tlv_filter.fp_data_filter = FILTER_DATA_ALL; |
| 4567 | htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL; |
| 4568 | htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; |
| 4569 | htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4570 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4571 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4572 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, |
| 4573 | pdev->pdev_id); |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4574 | |
| 4575 | htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, |
| 4576 | pdev->rxdma_mon_status_ring[mac_id].hal_srng, |
| 4577 | RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4578 | } |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4579 | |
| 4580 | return QDF_STATUS_SUCCESS; |
| 4581 | } |
| 4582 | |
| 4583 | /** |
| 4584 | * dp_pdev_set_advance_monitor_filter() - Set DP PDEV monitor filter |
| 4585 | * @pdev_handle: Datapath PDEV handle |
| 4586 | * @filter_val: Flag to select Filter for monitor mode |
| 4587 | * Return: 0 on success, not 0 on failure |
| 4588 | */ |
| 4589 | static int dp_pdev_set_advance_monitor_filter(struct cdp_pdev *pdev_handle, |
| 4590 | struct cdp_monitor_filter *filter_val) |
| 4591 | { |
| 4592 | /* Many monitor VAPs can exists in a system but only one can be up at |
| 4593 | * anytime |
| 4594 | */ |
| 4595 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4596 | struct dp_vdev *vdev = pdev->monitor_vdev; |
| 4597 | struct htt_rx_ring_tlv_filter htt_tlv_filter; |
| 4598 | struct dp_soc *soc; |
| 4599 | uint8_t pdev_id; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4600 | int mac_id; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4601 | |
| 4602 | pdev_id = pdev->pdev_id; |
| 4603 | soc = pdev->soc; |
| 4604 | |
| 4605 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_WARN, |
| 4606 | "pdev=%pK, pdev_id=%d, soc=%pK vdev=%pK\n", |
| 4607 | pdev, pdev_id, soc, vdev); |
| 4608 | |
| 4609 | /*Check if current pdev's monitor_vdev exists */ |
| 4610 | if (!pdev->monitor_vdev) { |
| 4611 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 4612 | "vdev=%pK\n", vdev); |
| 4613 | qdf_assert(vdev); |
| 4614 | } |
| 4615 | |
| 4616 | /* update filter mode, type in pdev structure */ |
| 4617 | pdev->mon_filter_mode = filter_val->mode; |
| 4618 | pdev->fp_mgmt_filter = filter_val->fp_mgmt; |
| 4619 | pdev->fp_ctrl_filter = filter_val->fp_ctrl; |
| 4620 | pdev->fp_data_filter = filter_val->fp_data; |
| 4621 | pdev->mo_mgmt_filter = filter_val->mo_mgmt; |
| 4622 | pdev->mo_ctrl_filter = filter_val->mo_ctrl; |
| 4623 | pdev->mo_data_filter = filter_val->mo_data; |
| 4624 | |
| 4625 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 4626 | "MODE[%x] FP[%02x|%02x|%02x] MO[%02x|%02x|%02x]\n", |
| 4627 | pdev->mon_filter_mode, pdev->fp_mgmt_filter, |
| 4628 | pdev->fp_ctrl_filter, pdev->fp_data_filter, |
| 4629 | pdev->mo_mgmt_filter, pdev->mo_ctrl_filter, |
| 4630 | pdev->mo_data_filter); |
| 4631 | |
| 4632 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 4633 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4634 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 4635 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4636 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4637 | htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, |
| 4638 | pdev->rxdma_mon_buf_ring[mac_id].hal_srng, |
| 4639 | RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4640 | |
| 4641 | htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, |
| 4642 | pdev->rxdma_mon_status_ring[mac_id].hal_srng, |
| 4643 | RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4644 | } |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4645 | |
| 4646 | htt_tlv_filter.mpdu_start = 1; |
| 4647 | htt_tlv_filter.msdu_start = 1; |
| 4648 | htt_tlv_filter.packet = 1; |
| 4649 | htt_tlv_filter.msdu_end = 1; |
| 4650 | htt_tlv_filter.mpdu_end = 1; |
| 4651 | htt_tlv_filter.packet_header = 1; |
| 4652 | htt_tlv_filter.attention = 1; |
| 4653 | htt_tlv_filter.ppdu_start = 0; |
| 4654 | htt_tlv_filter.ppdu_end = 0; |
| 4655 | htt_tlv_filter.ppdu_end_user_stats = 0; |
| 4656 | htt_tlv_filter.ppdu_end_user_stats_ext = 0; |
| 4657 | htt_tlv_filter.ppdu_end_status_done = 0; |
| 4658 | htt_tlv_filter.header_per_msdu = 1; |
| 4659 | htt_tlv_filter.enable_fp = |
| 4660 | (pdev->mon_filter_mode & MON_FILTER_PASS) ? 1 : 0; |
| 4661 | htt_tlv_filter.enable_md = 0; |
| 4662 | htt_tlv_filter.enable_mo = |
| 4663 | (pdev->mon_filter_mode & MON_FILTER_OTHER) ? 1 : 0; |
| 4664 | htt_tlv_filter.fp_mgmt_filter = pdev->fp_mgmt_filter; |
| 4665 | htt_tlv_filter.fp_ctrl_filter = pdev->fp_ctrl_filter; |
| 4666 | htt_tlv_filter.fp_data_filter = pdev->fp_data_filter; |
| 4667 | htt_tlv_filter.mo_mgmt_filter = pdev->mo_mgmt_filter; |
| 4668 | htt_tlv_filter.mo_ctrl_filter = pdev->mo_ctrl_filter; |
| 4669 | htt_tlv_filter.mo_data_filter = pdev->mo_data_filter; |
| 4670 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4671 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 4672 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev_id); |
| 4673 | |
| 4674 | htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, |
| 4675 | pdev->rxdma_mon_buf_ring[mac_id].hal_srng, |
| 4676 | RXDMA_MONITOR_BUF, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4677 | } |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4678 | |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4679 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 4680 | |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4681 | htt_tlv_filter.mpdu_start = 1; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4682 | htt_tlv_filter.msdu_start = 0; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4683 | htt_tlv_filter.packet = 0; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4684 | htt_tlv_filter.msdu_end = 0; |
| 4685 | htt_tlv_filter.mpdu_end = 0; |
| 4686 | htt_tlv_filter.attention = 0; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4687 | htt_tlv_filter.ppdu_start = 1; |
| 4688 | htt_tlv_filter.ppdu_end = 1; |
| 4689 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 4690 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 4691 | htt_tlv_filter.ppdu_end_status_done = 1; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4692 | htt_tlv_filter.enable_fp = 1; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 4693 | htt_tlv_filter.enable_md = 0; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4694 | htt_tlv_filter.enable_mo = 1; |
| 4695 | if (pdev->mcopy_mode) { |
| 4696 | htt_tlv_filter.packet_header = 1; |
| 4697 | } |
| 4698 | htt_tlv_filter.fp_mgmt_filter = FILTER_MGMT_ALL; |
| 4699 | htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_ALL; |
| 4700 | htt_tlv_filter.fp_data_filter = FILTER_DATA_ALL; |
| 4701 | htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL; |
| 4702 | htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; |
| 4703 | htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; |
Karunakar Dasineni | 4055568 | 2017-03-26 22:44:39 -0700 | [diff] [blame] | 4704 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4705 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 4706 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, |
| 4707 | pdev->pdev_id); |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 4708 | |
| 4709 | htt_h2t_rx_ring_cfg(soc->htt_handle, mac_for_pdev, |
| 4710 | pdev->rxdma_mon_status_ring[mac_id].hal_srng, |
| 4711 | RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 4712 | } |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 4713 | |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 4714 | return QDF_STATUS_SUCCESS; |
| 4715 | } |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 4716 | |
nobelj | c8eb4d6 | 2018-01-04 14:29:32 -0800 | [diff] [blame] | 4717 | /** |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 4718 | * dp_get_pdev_id_frm_pdev() - get pdev_id |
| 4719 | * @pdev_handle: Datapath PDEV handle |
| 4720 | * |
| 4721 | * Return: pdev_id |
| 4722 | */ |
| 4723 | static |
| 4724 | uint8_t dp_get_pdev_id_frm_pdev(struct cdp_pdev *pdev_handle) |
| 4725 | { |
| 4726 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 4727 | |
| 4728 | return pdev->pdev_id; |
| 4729 | } |
| 4730 | |
| 4731 | /** |
nobelj | c8eb4d6 | 2018-01-04 14:29:32 -0800 | [diff] [blame] | 4732 | * dp_vdev_get_filter_ucast_data() - get DP VDEV monitor ucast filter |
| 4733 | * @vdev_handle: Datapath VDEV handle |
| 4734 | * Return: true on ucast filter flag set |
| 4735 | */ |
| 4736 | static bool dp_vdev_get_filter_ucast_data(struct cdp_vdev *vdev_handle) |
| 4737 | { |
| 4738 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4739 | struct dp_pdev *pdev; |
| 4740 | |
| 4741 | pdev = vdev->pdev; |
| 4742 | |
| 4743 | if ((pdev->fp_data_filter & FILTER_DATA_UCAST) || |
| 4744 | (pdev->mo_data_filter & FILTER_DATA_UCAST)) |
| 4745 | return true; |
| 4746 | |
| 4747 | return false; |
| 4748 | } |
| 4749 | |
| 4750 | /** |
| 4751 | * dp_vdev_get_filter_mcast_data() - get DP VDEV monitor mcast filter |
| 4752 | * @vdev_handle: Datapath VDEV handle |
| 4753 | * Return: true on mcast filter flag set |
| 4754 | */ |
| 4755 | static bool dp_vdev_get_filter_mcast_data(struct cdp_vdev *vdev_handle) |
| 4756 | { |
| 4757 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4758 | struct dp_pdev *pdev; |
| 4759 | |
| 4760 | pdev = vdev->pdev; |
| 4761 | |
| 4762 | if ((pdev->fp_data_filter & FILTER_DATA_MCAST) || |
| 4763 | (pdev->mo_data_filter & FILTER_DATA_MCAST)) |
| 4764 | return true; |
| 4765 | |
| 4766 | return false; |
| 4767 | } |
| 4768 | |
| 4769 | /** |
| 4770 | * dp_vdev_get_filter_non_data() - get DP VDEV monitor non_data filter |
| 4771 | * @vdev_handle: Datapath VDEV handle |
| 4772 | * Return: true on non data filter flag set |
| 4773 | */ |
| 4774 | static bool dp_vdev_get_filter_non_data(struct cdp_vdev *vdev_handle) |
| 4775 | { |
| 4776 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4777 | struct dp_pdev *pdev; |
| 4778 | |
| 4779 | pdev = vdev->pdev; |
| 4780 | |
| 4781 | if ((pdev->fp_mgmt_filter & FILTER_MGMT_ALL) || |
| 4782 | (pdev->mo_mgmt_filter & FILTER_MGMT_ALL)) { |
| 4783 | if ((pdev->fp_ctrl_filter & FILTER_CTRL_ALL) || |
| 4784 | (pdev->mo_ctrl_filter & FILTER_CTRL_ALL)) { |
| 4785 | return true; |
| 4786 | } |
| 4787 | } |
| 4788 | |
| 4789 | return false; |
| 4790 | } |
| 4791 | |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 4792 | #ifdef MESH_MODE_SUPPORT |
Venkateswara Swamy Bandaru | ec4f8e6 | 2017-03-07 11:04:28 +0530 | [diff] [blame] | 4793 | 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] | 4794 | { |
| 4795 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_hdl; |
| 4796 | |
| 4797 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
Venkateswara Swamy Bandaru | 5caa83a | 2017-03-06 11:33:15 +0530 | [diff] [blame] | 4798 | FL("val %d"), val); |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 4799 | vdev->mesh_vdev = val; |
| 4800 | } |
Venkateswara Swamy Bandaru | ec4f8e6 | 2017-03-07 11:04:28 +0530 | [diff] [blame] | 4801 | |
| 4802 | /* |
| 4803 | * dp_peer_set_mesh_rx_filter() - to set the mesh rx filter |
| 4804 | * @vdev_hdl: virtual device object |
| 4805 | * @val: value to be set |
| 4806 | * |
| 4807 | * Return: void |
| 4808 | */ |
| 4809 | void dp_peer_set_mesh_rx_filter(struct cdp_vdev *vdev_hdl, uint32_t val) |
| 4810 | { |
| 4811 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_hdl; |
| 4812 | |
| 4813 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 4814 | FL("val %d"), val); |
| 4815 | vdev->mesh_rx_filter = val; |
| 4816 | } |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 4817 | #endif |
| 4818 | |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4819 | /* |
| 4820 | * dp_aggregate_pdev_ctrl_frames_stats()- function to agreegate peer stats |
Jeff Johnson | 2d821eb | 2018-05-06 16:25:49 -0700 | [diff] [blame] | 4821 | * Current scope is bar received count |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4822 | * |
| 4823 | * @pdev_handle: DP_PDEV handle |
| 4824 | * |
| 4825 | * Return: void |
| 4826 | */ |
Pratik Gandhi | 81fe062 | 2018-02-23 12:36:10 +0530 | [diff] [blame] | 4827 | #define STATS_PROC_TIMEOUT (HZ/1000) |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4828 | |
| 4829 | static void |
| 4830 | dp_aggregate_pdev_ctrl_frames_stats(struct dp_pdev *pdev) |
| 4831 | { |
| 4832 | struct dp_vdev *vdev; |
| 4833 | struct dp_peer *peer; |
| 4834 | uint32_t waitcnt; |
| 4835 | |
| 4836 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
| 4837 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 4838 | if (!peer) { |
| 4839 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 4840 | FL("DP Invalid Peer refernce")); |
| 4841 | return; |
| 4842 | } |
Pratik Gandhi | 81fe062 | 2018-02-23 12:36:10 +0530 | [diff] [blame] | 4843 | |
| 4844 | if (peer->delete_in_progress) { |
| 4845 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 4846 | FL("DP Peer deletion in progress")); |
| 4847 | continue; |
| 4848 | } |
| 4849 | |
| 4850 | qdf_atomic_inc(&peer->ref_cnt); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4851 | waitcnt = 0; |
| 4852 | dp_peer_rxtid_stats(peer, dp_rx_bar_stats_cb, pdev); |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 4853 | while (!(qdf_atomic_read(&(pdev->stats_cmd_complete))) |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4854 | && waitcnt < 10) { |
| 4855 | schedule_timeout_interruptible( |
| 4856 | STATS_PROC_TIMEOUT); |
| 4857 | waitcnt++; |
| 4858 | } |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 4859 | qdf_atomic_set(&(pdev->stats_cmd_complete), 0); |
Pratik Gandhi | 81fe062 | 2018-02-23 12:36:10 +0530 | [diff] [blame] | 4860 | dp_peer_unref_delete(peer); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4861 | } |
| 4862 | } |
| 4863 | } |
| 4864 | |
| 4865 | /** |
| 4866 | * dp_rx_bar_stats_cb(): BAR received stats callback |
| 4867 | * @soc: SOC handle |
| 4868 | * @cb_ctxt: Call back context |
| 4869 | * @reo_status: Reo status |
| 4870 | * |
| 4871 | * return: void |
| 4872 | */ |
| 4873 | void dp_rx_bar_stats_cb(struct dp_soc *soc, void *cb_ctxt, |
| 4874 | union hal_reo_status *reo_status) |
| 4875 | { |
| 4876 | struct dp_pdev *pdev = (struct dp_pdev *)cb_ctxt; |
| 4877 | struct hal_reo_queue_status *queue_status = &(reo_status->queue_status); |
| 4878 | |
| 4879 | if (queue_status->header.status != HAL_REO_CMD_SUCCESS) { |
| 4880 | DP_TRACE_STATS(FATAL, "REO stats failure %d \n", |
| 4881 | queue_status->header.status); |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 4882 | qdf_atomic_set(&(pdev->stats_cmd_complete), 1); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4883 | return; |
| 4884 | } |
| 4885 | |
| 4886 | pdev->stats.rx.bar_recv_cnt += queue_status->bar_rcvd_cnt; |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 4887 | qdf_atomic_set(&(pdev->stats_cmd_complete), 1); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 4888 | |
| 4889 | } |
| 4890 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4891 | /** |
| 4892 | * dp_aggregate_vdev_stats(): Consolidate stats at VDEV level |
| 4893 | * @vdev: DP VDEV handle |
| 4894 | * |
| 4895 | * return: void |
| 4896 | */ |
| 4897 | void dp_aggregate_vdev_stats(struct dp_vdev *vdev) |
| 4898 | { |
| 4899 | struct dp_peer *peer = NULL; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4900 | struct dp_soc *soc = vdev->pdev->soc; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4901 | |
| 4902 | qdf_mem_set(&(vdev->stats.tx), sizeof(vdev->stats.tx), 0x0); |
| 4903 | qdf_mem_set(&(vdev->stats.rx), sizeof(vdev->stats.rx), 0x0); |
| 4904 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4905 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) |
| 4906 | DP_UPDATE_STATS(vdev, peer); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 4907 | |
psimha | fb49db3 | 2017-08-31 15:33:33 -0700 | [diff] [blame] | 4908 | if (soc->cdp_soc.ol_ops->update_dp_stats) |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 4909 | soc->cdp_soc.ol_ops->update_dp_stats(vdev->pdev->ctrl_pdev, |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 4910 | &vdev->stats, (uint16_t) vdev->vdev_id, |
| 4911 | UPDATE_VDEV_STATS); |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 4912 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4913 | } |
| 4914 | |
| 4915 | /** |
| 4916 | * dp_aggregate_pdev_stats(): Consolidate stats at PDEV level |
| 4917 | * @pdev: DP PDEV handle |
| 4918 | * |
| 4919 | * return: void |
| 4920 | */ |
| 4921 | static inline void dp_aggregate_pdev_stats(struct dp_pdev *pdev) |
| 4922 | { |
| 4923 | struct dp_vdev *vdev = NULL; |
Pranita Solanke | a38c7a3 | 2018-01-04 10:50:59 +0530 | [diff] [blame] | 4924 | struct dp_soc *soc = pdev->soc; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4925 | |
| 4926 | qdf_mem_set(&(pdev->stats.tx), sizeof(pdev->stats.tx), 0x0); |
| 4927 | qdf_mem_set(&(pdev->stats.rx), sizeof(pdev->stats.rx), 0x0); |
| 4928 | qdf_mem_set(&(pdev->stats.tx_i), sizeof(pdev->stats.tx_i), 0x0); |
| 4929 | |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 4930 | qdf_spin_lock_bh(&pdev->vdev_list_lock); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4931 | TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) { |
Pamidipati, Vijay | 038d090 | 2017-07-17 09:53:31 +0530 | [diff] [blame] | 4932 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4933 | dp_aggregate_vdev_stats(vdev); |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4934 | DP_UPDATE_STATS(pdev, vdev); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4935 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4936 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.nawds_mcast); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4937 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4938 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.rcvd); |
| 4939 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.processed); |
| 4940 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.reinject_pkts); |
| 4941 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.inspect_pkts); |
| 4942 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.raw.raw_pkt); |
| 4943 | DP_STATS_AGGR(pdev, vdev, tx_i.raw.dma_map_error); |
| 4944 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.tso.tso_pkt); |
| 4945 | DP_STATS_AGGR(pdev, vdev, tx_i.tso.dropped_host); |
| 4946 | DP_STATS_AGGR(pdev, vdev, tx_i.tso.dropped_target); |
| 4947 | DP_STATS_AGGR(pdev, vdev, tx_i.sg.dropped_host); |
| 4948 | DP_STATS_AGGR(pdev, vdev, tx_i.sg.dropped_target); |
| 4949 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.sg.sg_pkt); |
| 4950 | DP_STATS_AGGR_PKT(pdev, vdev, tx_i.mcast_en.mcast_pkt); |
| 4951 | DP_STATS_AGGR(pdev, vdev, |
| 4952 | tx_i.mcast_en.dropped_map_error); |
| 4953 | DP_STATS_AGGR(pdev, vdev, |
| 4954 | tx_i.mcast_en.dropped_self_mac); |
| 4955 | DP_STATS_AGGR(pdev, vdev, |
| 4956 | tx_i.mcast_en.dropped_send_fail); |
| 4957 | DP_STATS_AGGR(pdev, vdev, tx_i.mcast_en.ucast); |
| 4958 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.dma_error); |
| 4959 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.ring_full); |
| 4960 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.enqueue_fail); |
| 4961 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.desc_na); |
| 4962 | DP_STATS_AGGR(pdev, vdev, tx_i.dropped.res_full); |
| 4963 | DP_STATS_AGGR(pdev, vdev, tx_i.cce_classified); |
| 4964 | DP_STATS_AGGR(pdev, vdev, tx_i.cce_classified_raw); |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 4965 | DP_STATS_AGGR(pdev, vdev, tx_i.mesh.exception_fw); |
| 4966 | DP_STATS_AGGR(pdev, vdev, tx_i.mesh.completion_fw); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4967 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4968 | pdev->stats.tx_i.dropped.dropped_pkt.num = |
| 4969 | pdev->stats.tx_i.dropped.dma_error + |
| 4970 | pdev->stats.tx_i.dropped.ring_full + |
| 4971 | pdev->stats.tx_i.dropped.enqueue_fail + |
| 4972 | pdev->stats.tx_i.dropped.desc_na + |
| 4973 | pdev->stats.tx_i.dropped.res_full; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4974 | |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4975 | pdev->stats.tx.last_ack_rssi = |
| 4976 | vdev->stats.tx.last_ack_rssi; |
| 4977 | pdev->stats.tx_i.tso.num_seg = |
| 4978 | vdev->stats.tx_i.tso.num_seg; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4979 | } |
Anish Nataraj | 4c9a4ed | 2018-04-08 21:25:13 +0530 | [diff] [blame] | 4980 | qdf_spin_unlock_bh(&pdev->vdev_list_lock); |
Pranita Solanke | a38c7a3 | 2018-01-04 10:50:59 +0530 | [diff] [blame] | 4981 | if (soc->cdp_soc.ol_ops->update_dp_stats) |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 4982 | soc->cdp_soc.ol_ops->update_dp_stats(pdev->ctrl_pdev, |
Pranita Solanke | a38c7a3 | 2018-01-04 10:50:59 +0530 | [diff] [blame] | 4983 | &pdev->stats, pdev->pdev_id, UPDATE_PDEV_STATS); |
Tallapragada Kalyan | 4f89492 | 2018-01-03 14:26:28 +0530 | [diff] [blame] | 4984 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 4985 | } |
| 4986 | |
| 4987 | /** |
Chaithanya Garrepalli | 2faa46f | 2018-04-09 12:34:20 +0530 | [diff] [blame] | 4988 | * dp_vdev_getstats() - get vdev packet level stats |
| 4989 | * @vdev_handle: Datapath VDEV handle |
| 4990 | * @stats: cdp network device stats structure |
| 4991 | * |
| 4992 | * Return: void |
| 4993 | */ |
| 4994 | static void dp_vdev_getstats(void *vdev_handle, |
| 4995 | struct cdp_dev_stats *stats) |
| 4996 | { |
| 4997 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 4998 | |
| 4999 | dp_aggregate_vdev_stats(vdev); |
| 5000 | } |
| 5001 | |
| 5002 | |
| 5003 | /** |
Anish Nataraj | f12b0a3 | 2018-03-14 14:27:13 +0530 | [diff] [blame] | 5004 | * dp_pdev_getstats() - get pdev packet level stats |
| 5005 | * @pdev_handle: Datapath PDEV handle |
| 5006 | * @stats: cdp network device stats structure |
| 5007 | * |
| 5008 | * Return: void |
| 5009 | */ |
Chaithanya Garrepalli | 2faa46f | 2018-04-09 12:34:20 +0530 | [diff] [blame] | 5010 | static void dp_pdev_getstats(void *pdev_handle, |
Anish Nataraj | f12b0a3 | 2018-03-14 14:27:13 +0530 | [diff] [blame] | 5011 | struct cdp_dev_stats *stats) |
| 5012 | { |
| 5013 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 5014 | |
| 5015 | dp_aggregate_pdev_stats(pdev); |
| 5016 | |
| 5017 | stats->tx_packets = pdev->stats.tx_i.rcvd.num; |
| 5018 | stats->tx_bytes = pdev->stats.tx_i.rcvd.bytes; |
| 5019 | |
| 5020 | stats->tx_errors = pdev->stats.tx.tx_failed + |
| 5021 | pdev->stats.tx_i.dropped.dropped_pkt.num; |
| 5022 | stats->tx_dropped = stats->tx_errors; |
| 5023 | |
| 5024 | stats->rx_packets = pdev->stats.rx.unicast.num + |
Pamidipati, Vijay | 3b0f916 | 2018-04-16 19:06:20 +0530 | [diff] [blame] | 5025 | pdev->stats.rx.multicast.num + |
| 5026 | pdev->stats.rx.bcast.num; |
Anish Nataraj | f12b0a3 | 2018-03-14 14:27:13 +0530 | [diff] [blame] | 5027 | stats->rx_bytes = pdev->stats.rx.unicast.bytes + |
Pamidipati, Vijay | 3b0f916 | 2018-04-16 19:06:20 +0530 | [diff] [blame] | 5028 | pdev->stats.rx.multicast.bytes + |
| 5029 | pdev->stats.rx.bcast.bytes; |
Anish Nataraj | f12b0a3 | 2018-03-14 14:27:13 +0530 | [diff] [blame] | 5030 | } |
| 5031 | |
| 5032 | /** |
Chaithanya Garrepalli | 2faa46f | 2018-04-09 12:34:20 +0530 | [diff] [blame] | 5033 | * dp_get_device_stats() - get interface level packet stats |
| 5034 | * @handle: device handle |
| 5035 | * @stats: cdp network device stats structure |
| 5036 | * @type: device type pdev/vdev |
| 5037 | * |
| 5038 | * Return: void |
| 5039 | */ |
| 5040 | static void dp_get_device_stats(void *handle, |
| 5041 | struct cdp_dev_stats *stats, uint8_t type) |
| 5042 | { |
| 5043 | switch (type) { |
| 5044 | case UPDATE_VDEV_STATS: |
| 5045 | dp_vdev_getstats(handle, stats); |
| 5046 | break; |
| 5047 | case UPDATE_PDEV_STATS: |
| 5048 | dp_pdev_getstats(handle, stats); |
| 5049 | break; |
| 5050 | default: |
| 5051 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 5052 | "apstats cannot be updated for this input " |
| 5053 | "type %d\n", type); |
| 5054 | break; |
| 5055 | } |
| 5056 | |
| 5057 | } |
| 5058 | |
| 5059 | |
| 5060 | /** |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5061 | * dp_print_pdev_tx_stats(): Print Pdev level TX stats |
| 5062 | * @pdev: DP_PDEV Handle |
| 5063 | * |
| 5064 | * Return:void |
| 5065 | */ |
| 5066 | static inline void |
| 5067 | dp_print_pdev_tx_stats(struct dp_pdev *pdev) |
| 5068 | { |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5069 | uint8_t index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5070 | DP_PRINT_STATS("PDEV Tx Stats:\n"); |
| 5071 | DP_PRINT_STATS("Received From Stack:"); |
| 5072 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5073 | pdev->stats.tx_i.rcvd.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5074 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5075 | pdev->stats.tx_i.rcvd.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5076 | DP_PRINT_STATS("Processed:"); |
| 5077 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5078 | pdev->stats.tx_i.processed.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5079 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5080 | pdev->stats.tx_i.processed.bytes); |
Venkata Sharath Chandra Manchala | 65812e6 | 2018-02-15 16:04:52 -0800 | [diff] [blame] | 5081 | DP_PRINT_STATS("Total Completions:"); |
| 5082 | DP_PRINT_STATS(" Packets = %u", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5083 | pdev->stats.tx.comp_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5084 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5085 | pdev->stats.tx.comp_pkt.bytes); |
Venkata Sharath Chandra Manchala | 65812e6 | 2018-02-15 16:04:52 -0800 | [diff] [blame] | 5086 | DP_PRINT_STATS("Successful Completions:"); |
| 5087 | DP_PRINT_STATS(" Packets = %u", |
| 5088 | pdev->stats.tx.tx_success.num); |
| 5089 | DP_PRINT_STATS(" Bytes = %llu", |
| 5090 | pdev->stats.tx.tx_success.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5091 | DP_PRINT_STATS("Dropped:"); |
| 5092 | DP_PRINT_STATS(" Total = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5093 | pdev->stats.tx_i.dropped.dropped_pkt.num); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5094 | DP_PRINT_STATS(" Dma_map_error = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5095 | pdev->stats.tx_i.dropped.dma_error); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5096 | DP_PRINT_STATS(" Ring Full = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5097 | pdev->stats.tx_i.dropped.ring_full); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5098 | DP_PRINT_STATS(" Descriptor Not available = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5099 | pdev->stats.tx_i.dropped.desc_na); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5100 | DP_PRINT_STATS(" HW enqueue failed= %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5101 | pdev->stats.tx_i.dropped.enqueue_fail); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5102 | DP_PRINT_STATS(" Resources Full = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5103 | pdev->stats.tx_i.dropped.res_full); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5104 | DP_PRINT_STATS(" FW removed = %d", |
| 5105 | pdev->stats.tx.dropped.fw_rem); |
| 5106 | DP_PRINT_STATS(" FW removed transmitted = %d", |
| 5107 | pdev->stats.tx.dropped.fw_rem_tx); |
| 5108 | DP_PRINT_STATS(" FW removed untransmitted = %d", |
| 5109 | pdev->stats.tx.dropped.fw_rem_notx); |
Venkata Sharath Chandra Manchala | 65812e6 | 2018-02-15 16:04:52 -0800 | [diff] [blame] | 5110 | DP_PRINT_STATS(" FW removed untransmitted fw_reason1 = %d", |
| 5111 | pdev->stats.tx.dropped.fw_reason1); |
| 5112 | DP_PRINT_STATS(" FW removed untransmitted fw_reason2 = %d", |
| 5113 | pdev->stats.tx.dropped.fw_reason2); |
| 5114 | DP_PRINT_STATS(" FW removed untransmitted fw_reason3 = %d", |
| 5115 | pdev->stats.tx.dropped.fw_reason3); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5116 | DP_PRINT_STATS(" Aged Out from msdu/mpdu queues = %d", |
| 5117 | pdev->stats.tx.dropped.age_out); |
| 5118 | DP_PRINT_STATS("Scatter Gather:"); |
| 5119 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5120 | pdev->stats.tx_i.sg.sg_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5121 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5122 | pdev->stats.tx_i.sg.sg_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5123 | DP_PRINT_STATS(" Dropped By Host = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5124 | pdev->stats.tx_i.sg.dropped_host); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5125 | DP_PRINT_STATS(" Dropped By Target = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5126 | pdev->stats.tx_i.sg.dropped_target); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5127 | DP_PRINT_STATS("TSO:"); |
| 5128 | DP_PRINT_STATS(" Number of Segments = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5129 | pdev->stats.tx_i.tso.num_seg); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5130 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5131 | pdev->stats.tx_i.tso.tso_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5132 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5133 | pdev->stats.tx_i.tso.tso_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5134 | DP_PRINT_STATS(" Dropped By Host = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5135 | pdev->stats.tx_i.tso.dropped_host); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5136 | DP_PRINT_STATS("Mcast Enhancement:"); |
| 5137 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5138 | pdev->stats.tx_i.mcast_en.mcast_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5139 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5140 | pdev->stats.tx_i.mcast_en.mcast_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5141 | DP_PRINT_STATS(" Dropped: Map Errors = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5142 | pdev->stats.tx_i.mcast_en.dropped_map_error); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5143 | DP_PRINT_STATS(" Dropped: Self Mac = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5144 | pdev->stats.tx_i.mcast_en.dropped_self_mac); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5145 | DP_PRINT_STATS(" Dropped: Send Fail = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5146 | pdev->stats.tx_i.mcast_en.dropped_send_fail); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5147 | DP_PRINT_STATS(" Unicast sent = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5148 | pdev->stats.tx_i.mcast_en.ucast); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5149 | DP_PRINT_STATS("Raw:"); |
| 5150 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5151 | pdev->stats.tx_i.raw.raw_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5152 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5153 | pdev->stats.tx_i.raw.raw_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5154 | DP_PRINT_STATS(" DMA map error = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5155 | pdev->stats.tx_i.raw.dma_map_error); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5156 | DP_PRINT_STATS("Reinjected:"); |
| 5157 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5158 | pdev->stats.tx_i.reinject_pkts.num); |
chenguo | 6a027fb | 2018-05-21 18:42:54 +0800 | [diff] [blame] | 5159 | DP_PRINT_STATS(" Bytes = %llu\n", |
| 5160 | pdev->stats.tx_i.reinject_pkts.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5161 | DP_PRINT_STATS("Inspected:"); |
| 5162 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5163 | pdev->stats.tx_i.inspect_pkts.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5164 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5165 | pdev->stats.tx_i.inspect_pkts.bytes); |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5166 | DP_PRINT_STATS("Nawds Multicast:"); |
| 5167 | DP_PRINT_STATS(" Packets = %d", |
| 5168 | pdev->stats.tx_i.nawds_mcast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5169 | DP_PRINT_STATS(" Bytes = %llu", |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5170 | pdev->stats.tx_i.nawds_mcast.bytes); |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 5171 | DP_PRINT_STATS("CCE Classified:"); |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 5172 | DP_PRINT_STATS(" CCE Classified Packets: %u", |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 5173 | pdev->stats.tx_i.cce_classified); |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 5174 | DP_PRINT_STATS(" RAW CCE Classified Packets: %u", |
Ruchi, Agrawal | 4c1468f | 2017-12-08 00:04:33 +0530 | [diff] [blame] | 5175 | pdev->stats.tx_i.cce_classified_raw); |
Venkateswara Swamy Bandaru | 58c8085 | 2018-01-29 17:52:02 +0530 | [diff] [blame] | 5176 | DP_PRINT_STATS("Mesh stats:"); |
| 5177 | DP_PRINT_STATS(" frames to firmware: %u", |
| 5178 | pdev->stats.tx_i.mesh.exception_fw); |
| 5179 | DP_PRINT_STATS(" completions from fw: %u", |
| 5180 | pdev->stats.tx_i.mesh.completion_fw); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 5181 | DP_PRINT_STATS("PPDU stats counter"); |
| 5182 | for (index = 0; index < CDP_PPDU_STATS_MAX_TAG; index++) { |
| 5183 | DP_PRINT_STATS(" Tag[%d] = %llu", index, |
| 5184 | pdev->stats.ppdu_stats_counter[index]); |
| 5185 | } |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5186 | } |
| 5187 | |
| 5188 | /** |
| 5189 | * dp_print_pdev_rx_stats(): Print Pdev level RX stats |
| 5190 | * @pdev: DP_PDEV Handle |
| 5191 | * |
| 5192 | * Return: void |
| 5193 | */ |
| 5194 | static inline void |
| 5195 | dp_print_pdev_rx_stats(struct dp_pdev *pdev) |
| 5196 | { |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5197 | DP_PRINT_STATS("PDEV Rx Stats:\n"); |
| 5198 | DP_PRINT_STATS("Received From HW (Per Rx Ring):"); |
| 5199 | DP_PRINT_STATS(" Packets = %d %d %d %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5200 | pdev->stats.rx.rcvd_reo[0].num, |
| 5201 | pdev->stats.rx.rcvd_reo[1].num, |
| 5202 | pdev->stats.rx.rcvd_reo[2].num, |
| 5203 | pdev->stats.rx.rcvd_reo[3].num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5204 | DP_PRINT_STATS(" Bytes = %llu %llu %llu %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5205 | pdev->stats.rx.rcvd_reo[0].bytes, |
| 5206 | pdev->stats.rx.rcvd_reo[1].bytes, |
| 5207 | pdev->stats.rx.rcvd_reo[2].bytes, |
| 5208 | pdev->stats.rx.rcvd_reo[3].bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5209 | DP_PRINT_STATS("Replenished:"); |
| 5210 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5211 | pdev->stats.replenish.pkts.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5212 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5213 | pdev->stats.replenish.pkts.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5214 | DP_PRINT_STATS(" Buffers Added To Freelist = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5215 | pdev->stats.buf_freelist); |
Karunakar Dasineni | 87f0c5d | 2017-10-29 21:54:21 -0700 | [diff] [blame] | 5216 | DP_PRINT_STATS(" Low threshold intr = %d", |
| 5217 | pdev->stats.replenish.low_thresh_intrs); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5218 | DP_PRINT_STATS("Dropped:"); |
| 5219 | DP_PRINT_STATS(" msdu_not_done = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5220 | pdev->stats.dropped.msdu_not_done); |
Neil Zhao | 0bd967d | 2018-03-02 16:00:00 -0800 | [diff] [blame] | 5221 | DP_PRINT_STATS(" mon_rx_drop = %d", |
| 5222 | pdev->stats.dropped.mon_rx_drop); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5223 | DP_PRINT_STATS("Sent To Stack:"); |
| 5224 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5225 | pdev->stats.rx.to_stack.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5226 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5227 | pdev->stats.rx.to_stack.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5228 | DP_PRINT_STATS("Multicast/Broadcast:"); |
| 5229 | DP_PRINT_STATS(" Packets = %d", |
Pamidipati, Vijay | 3b0f916 | 2018-04-16 19:06:20 +0530 | [diff] [blame] | 5230 | (pdev->stats.rx.multicast.num + |
| 5231 | pdev->stats.rx.bcast.num)); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5232 | DP_PRINT_STATS(" Bytes = %llu", |
Pamidipati, Vijay | 3b0f916 | 2018-04-16 19:06:20 +0530 | [diff] [blame] | 5233 | (pdev->stats.rx.multicast.bytes + |
| 5234 | pdev->stats.rx.bcast.bytes)); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5235 | DP_PRINT_STATS("Errors:"); |
| 5236 | DP_PRINT_STATS(" Rxdma Ring Un-inititalized = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5237 | pdev->stats.replenish.rxdma_err); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5238 | DP_PRINT_STATS(" Desc Alloc Failed: = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5239 | pdev->stats.err.desc_alloc_fail); |
chenguo | 6a027fb | 2018-05-21 18:42:54 +0800 | [diff] [blame] | 5240 | DP_PRINT_STATS(" IP checksum error = %d", |
Tallapragada Kalyan | 51198fc | 2018-04-18 14:30:44 +0530 | [diff] [blame] | 5241 | pdev->stats.err.ip_csum_err); |
chenguo | 6a027fb | 2018-05-21 18:42:54 +0800 | [diff] [blame] | 5242 | DP_PRINT_STATS(" TCP/UDP checksum error = %d", |
Tallapragada Kalyan | 51198fc | 2018-04-18 14:30:44 +0530 | [diff] [blame] | 5243 | pdev->stats.err.tcp_udp_csum_err); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 5244 | |
| 5245 | /* Get bar_recv_cnt */ |
| 5246 | dp_aggregate_pdev_ctrl_frames_stats(pdev); |
| 5247 | DP_PRINT_STATS("BAR Received Count: = %d", |
| 5248 | pdev->stats.rx.bar_recv_cnt); |
| 5249 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5250 | } |
| 5251 | |
| 5252 | /** |
Kai Chen | 783e038 | 2018-01-25 16:29:08 -0800 | [diff] [blame] | 5253 | * dp_print_pdev_rx_mon_stats(): Print Pdev level RX monitor stats |
| 5254 | * @pdev: DP_PDEV Handle |
| 5255 | * |
| 5256 | * Return: void |
| 5257 | */ |
| 5258 | static inline void |
| 5259 | dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev) |
| 5260 | { |
| 5261 | struct cdp_pdev_mon_stats *rx_mon_stats; |
| 5262 | |
| 5263 | rx_mon_stats = &pdev->rx_mon_stats; |
| 5264 | |
| 5265 | DP_PRINT_STATS("PDEV Rx Monitor Stats:\n"); |
| 5266 | |
| 5267 | dp_rx_mon_print_dbg_ppdu_stats(rx_mon_stats); |
| 5268 | |
| 5269 | DP_PRINT_STATS("status_ppdu_done_cnt = %d", |
| 5270 | rx_mon_stats->status_ppdu_done); |
| 5271 | DP_PRINT_STATS("dest_ppdu_done_cnt = %d", |
| 5272 | rx_mon_stats->dest_ppdu_done); |
| 5273 | DP_PRINT_STATS("dest_mpdu_done_cnt = %d", |
| 5274 | rx_mon_stats->dest_mpdu_done); |
Karunakar Dasineni | bb7848e | 2018-05-07 15:09:46 -0700 | [diff] [blame] | 5275 | DP_PRINT_STATS("dest_mpdu_drop_cnt = %d", |
| 5276 | rx_mon_stats->dest_mpdu_drop); |
Kai Chen | 783e038 | 2018-01-25 16:29:08 -0800 | [diff] [blame] | 5277 | } |
| 5278 | |
| 5279 | /** |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5280 | * dp_print_soc_tx_stats(): Print SOC level stats |
| 5281 | * @soc DP_SOC Handle |
| 5282 | * |
| 5283 | * Return: void |
| 5284 | */ |
| 5285 | static inline void |
| 5286 | dp_print_soc_tx_stats(struct dp_soc *soc) |
| 5287 | { |
Soumya Bhat | dbb8530 | 2018-05-18 11:01:34 +0530 | [diff] [blame] | 5288 | uint8_t desc_pool_id; |
| 5289 | soc->stats.tx.desc_in_use = 0; |
| 5290 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5291 | DP_PRINT_STATS("SOC Tx Stats:\n"); |
Soumya Bhat | dbb8530 | 2018-05-18 11:01:34 +0530 | [diff] [blame] | 5292 | |
| 5293 | for (desc_pool_id = 0; |
| 5294 | desc_pool_id < wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx); |
| 5295 | desc_pool_id++) |
| 5296 | soc->stats.tx.desc_in_use += |
| 5297 | soc->tx_desc[desc_pool_id].num_allocated; |
| 5298 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5299 | DP_PRINT_STATS("Tx Descriptors In Use = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5300 | soc->stats.tx.desc_in_use); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5301 | DP_PRINT_STATS("Invalid peer:"); |
| 5302 | DP_PRINT_STATS(" Packets = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5303 | soc->stats.tx.tx_invalid_peer.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5304 | DP_PRINT_STATS(" Bytes = %llu", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5305 | soc->stats.tx.tx_invalid_peer.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5306 | 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] | 5307 | soc->stats.tx.tcl_ring_full[0], |
| 5308 | soc->stats.tx.tcl_ring_full[1], |
| 5309 | soc->stats.tx.tcl_ring_full[2]); |
| 5310 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5311 | } |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5312 | /** |
| 5313 | * dp_print_soc_rx_stats: Print SOC level Rx stats |
| 5314 | * @soc: DP_SOC Handle |
| 5315 | * |
| 5316 | * Return:void |
| 5317 | */ |
| 5318 | static inline void |
| 5319 | dp_print_soc_rx_stats(struct dp_soc *soc) |
| 5320 | { |
| 5321 | uint32_t i; |
| 5322 | char reo_error[DP_REO_ERR_LENGTH]; |
| 5323 | char rxdma_error[DP_RXDMA_ERR_LENGTH]; |
| 5324 | uint8_t index = 0; |
| 5325 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5326 | DP_PRINT_STATS("SOC Rx Stats:\n"); |
| 5327 | DP_PRINT_STATS("Errors:\n"); |
| 5328 | DP_PRINT_STATS("Rx Decrypt Errors = %d", |
Pamidipati, Vijay | c2cb427 | 2017-05-23 10:09:26 +0530 | [diff] [blame] | 5329 | (soc->stats.rx.err.rxdma_error[HAL_RXDMA_ERR_DECRYPT] + |
| 5330 | soc->stats.rx.err.rxdma_error[HAL_RXDMA_ERR_TKIP_MIC])); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5331 | DP_PRINT_STATS("Invalid RBM = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5332 | soc->stats.rx.err.invalid_rbm); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5333 | DP_PRINT_STATS("Invalid Vdev = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5334 | soc->stats.rx.err.invalid_vdev); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5335 | DP_PRINT_STATS("Invalid Pdev = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5336 | soc->stats.rx.err.invalid_pdev); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5337 | DP_PRINT_STATS("Invalid Peer = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5338 | soc->stats.rx.err.rx_invalid_peer.num); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5339 | DP_PRINT_STATS("HAL Ring Access Fail = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5340 | soc->stats.rx.err.hal_ring_access_fail); |
Pamidipati, Vijay | c2cb427 | 2017-05-23 10:09:26 +0530 | [diff] [blame] | 5341 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5342 | for (i = 0; i < HAL_RXDMA_ERR_MAX; i++) { |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5343 | index += qdf_snprint(&rxdma_error[index], |
| 5344 | DP_RXDMA_ERR_LENGTH - index, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5345 | " %d", soc->stats.rx.err.rxdma_error[i]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5346 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5347 | DP_PRINT_STATS("RXDMA Error (0-31):%s", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5348 | rxdma_error); |
| 5349 | |
| 5350 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5351 | for (i = 0; i < HAL_REO_ERR_MAX; i++) { |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5352 | index += qdf_snprint(&reo_error[index], |
| 5353 | DP_REO_ERR_LENGTH - index, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5354 | " %d", soc->stats.rx.err.reo_error[i]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5355 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5356 | DP_PRINT_STATS("REO Error(0-14):%s", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5357 | reo_error); |
| 5358 | } |
| 5359 | |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5360 | |
| 5361 | /** |
| 5362 | * dp_print_ring_stat_from_hal(): Print hal level ring stats |
| 5363 | * @soc: DP_SOC handle |
| 5364 | * @srng: DP_SRNG handle |
| 5365 | * @ring_name: SRNG name |
| 5366 | * |
| 5367 | * Return: void |
| 5368 | */ |
| 5369 | static inline void |
| 5370 | dp_print_ring_stat_from_hal(struct dp_soc *soc, struct dp_srng *srng, |
| 5371 | char *ring_name) |
| 5372 | { |
| 5373 | uint32_t tailp; |
| 5374 | uint32_t headp; |
| 5375 | |
| 5376 | if (srng->hal_srng != NULL) { |
| 5377 | hal_api_get_tphp(soc->hal_soc, srng->hal_srng, &tailp, &headp); |
| 5378 | DP_PRINT_STATS("%s : Head pointer = %d Tail Pointer = %d\n", |
| 5379 | ring_name, headp, tailp); |
| 5380 | } |
| 5381 | } |
| 5382 | |
| 5383 | /** |
| 5384 | * dp_print_ring_stats(): Print tail and head pointer |
| 5385 | * @pdev: DP_PDEV handle |
| 5386 | * |
| 5387 | * Return:void |
| 5388 | */ |
| 5389 | static inline void |
| 5390 | dp_print_ring_stats(struct dp_pdev *pdev) |
| 5391 | { |
| 5392 | uint32_t i; |
| 5393 | char ring_name[STR_MAXLEN + 1]; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 5394 | int mac_id; |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5395 | |
| 5396 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5397 | &pdev->soc->reo_exception_ring, |
| 5398 | "Reo Exception Ring"); |
| 5399 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5400 | &pdev->soc->reo_reinject_ring, |
| 5401 | "Reo Inject Ring"); |
| 5402 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5403 | &pdev->soc->reo_cmd_ring, |
| 5404 | "Reo Command Ring"); |
| 5405 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5406 | &pdev->soc->reo_status_ring, |
| 5407 | "Reo Status Ring"); |
| 5408 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5409 | &pdev->soc->rx_rel_ring, |
| 5410 | "Rx Release ring"); |
| 5411 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5412 | &pdev->soc->tcl_cmd_ring, |
| 5413 | "Tcl command Ring"); |
| 5414 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5415 | &pdev->soc->tcl_status_ring, |
| 5416 | "Tcl Status Ring"); |
| 5417 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5418 | &pdev->soc->wbm_desc_rel_ring, |
| 5419 | "Wbm Desc Rel Ring"); |
| 5420 | for (i = 0; i < MAX_REO_DEST_RINGS; i++) { |
| 5421 | snprintf(ring_name, STR_MAXLEN, "Reo Dest Ring %d", i); |
| 5422 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5423 | &pdev->soc->reo_dest_ring[i], |
| 5424 | ring_name); |
| 5425 | } |
| 5426 | for (i = 0; i < pdev->soc->num_tcl_data_rings; i++) { |
| 5427 | snprintf(ring_name, STR_MAXLEN, "Tcl Data Ring %d", i); |
| 5428 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5429 | &pdev->soc->tcl_data_ring[i], |
| 5430 | ring_name); |
| 5431 | } |
| 5432 | for (i = 0; i < MAX_TCL_DATA_RINGS; i++) { |
| 5433 | snprintf(ring_name, STR_MAXLEN, "Tx Comp Ring %d", i); |
| 5434 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5435 | &pdev->soc->tx_comp_ring[i], |
| 5436 | ring_name); |
| 5437 | } |
| 5438 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5439 | &pdev->rx_refill_buf_ring, |
| 5440 | "Rx Refill Buf Ring"); |
| 5441 | |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5442 | dp_print_ring_stat_from_hal(pdev->soc, |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 5443 | &pdev->rx_refill_buf_ring2, |
| 5444 | "Second Rx Refill Buf Ring"); |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5445 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 5446 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 5447 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5448 | &pdev->rxdma_mon_buf_ring[mac_id], |
| 5449 | "Rxdma Mon Buf Ring"); |
| 5450 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5451 | &pdev->rxdma_mon_dst_ring[mac_id], |
| 5452 | "Rxdma Mon Dst Ring"); |
| 5453 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5454 | &pdev->rxdma_mon_status_ring[mac_id], |
| 5455 | "Rxdma Mon Status Ring"); |
| 5456 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5457 | &pdev->rxdma_mon_desc_ring[mac_id], |
| 5458 | "Rxdma mon desc Ring"); |
| 5459 | } |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 5460 | |
| 5461 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) { |
| 5462 | snprintf(ring_name, STR_MAXLEN, "Rxdma err dst ring %d", i); |
| 5463 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5464 | &pdev->rxdma_err_dst_ring[i], |
| 5465 | ring_name); |
| 5466 | } |
| 5467 | |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5468 | for (i = 0; i < MAX_RX_MAC_RINGS; i++) { |
| 5469 | snprintf(ring_name, STR_MAXLEN, "Rx mac buf ring %d", i); |
| 5470 | dp_print_ring_stat_from_hal(pdev->soc, |
| 5471 | &pdev->rx_mac_buf_ring[i], |
| 5472 | ring_name); |
| 5473 | } |
| 5474 | } |
| 5475 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5476 | /** |
| 5477 | * dp_txrx_host_stats_clr(): Reinitialize the txrx stats |
| 5478 | * @vdev: DP_VDEV handle |
| 5479 | * |
| 5480 | * Return:void |
| 5481 | */ |
| 5482 | static inline void |
| 5483 | dp_txrx_host_stats_clr(struct dp_vdev *vdev) |
| 5484 | { |
| 5485 | struct dp_peer *peer = NULL; |
Anish Nataraj | 28490c4 | 2018-01-19 19:34:54 +0530 | [diff] [blame] | 5486 | struct dp_soc *soc = (struct dp_soc *)vdev->pdev->soc; |
| 5487 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5488 | DP_STATS_CLR(vdev->pdev); |
| 5489 | DP_STATS_CLR(vdev->pdev->soc); |
| 5490 | DP_STATS_CLR(vdev); |
| 5491 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 5492 | if (!peer) |
| 5493 | return; |
| 5494 | DP_STATS_CLR(peer); |
Anish Nataraj | 28490c4 | 2018-01-19 19:34:54 +0530 | [diff] [blame] | 5495 | |
| 5496 | if (soc->cdp_soc.ol_ops->update_dp_stats) { |
| 5497 | soc->cdp_soc.ol_ops->update_dp_stats( |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 5498 | vdev->pdev->ctrl_pdev, |
Anish Nataraj | 28490c4 | 2018-01-19 19:34:54 +0530 | [diff] [blame] | 5499 | &peer->stats, |
| 5500 | peer->peer_ids[0], |
| 5501 | UPDATE_PEER_STATS); |
| 5502 | } |
| 5503 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5504 | } |
| 5505 | |
Anish Nataraj | 28490c4 | 2018-01-19 19:34:54 +0530 | [diff] [blame] | 5506 | if (soc->cdp_soc.ol_ops->update_dp_stats) |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 5507 | soc->cdp_soc.ol_ops->update_dp_stats(vdev->pdev->ctrl_pdev, |
Anish Nataraj | 28490c4 | 2018-01-19 19:34:54 +0530 | [diff] [blame] | 5508 | &vdev->stats, (uint16_t)vdev->vdev_id, |
| 5509 | UPDATE_VDEV_STATS); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5510 | } |
| 5511 | |
| 5512 | /** |
| 5513 | * dp_print_rx_rates(): Print Rx rate stats |
| 5514 | * @vdev: DP_VDEV handle |
| 5515 | * |
| 5516 | * Return:void |
| 5517 | */ |
| 5518 | static inline void |
| 5519 | dp_print_rx_rates(struct dp_vdev *vdev) |
| 5520 | { |
| 5521 | struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5522 | uint8_t i, mcs, pkt_type; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5523 | uint8_t index = 0; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5524 | char nss[DP_NSS_LENGTH]; |
| 5525 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5526 | DP_PRINT_STATS("Rx Rate Info:\n"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5527 | |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5528 | for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { |
| 5529 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5530 | for (mcs = 0; mcs < MAX_MCS; mcs++) { |
| 5531 | if (!dp_rate_string[pkt_type][mcs].valid) |
| 5532 | continue; |
| 5533 | |
| 5534 | DP_PRINT_STATS(" %s = %d", |
| 5535 | dp_rate_string[pkt_type][mcs].mcs_type, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5536 | pdev->stats.rx.pkt_type[pkt_type]. |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5537 | mcs_count[mcs]); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5538 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5539 | |
| 5540 | DP_PRINT_STATS("\n"); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5541 | } |
| 5542 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5543 | index = 0; |
| 5544 | for (i = 0; i < SS_COUNT; i++) { |
| 5545 | index += qdf_snprint(&nss[index], DP_NSS_LENGTH - index, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5546 | " %d", pdev->stats.rx.nss[i]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5547 | } |
Anish Nataraj | 072d897 | 2018-01-09 18:23:33 +0530 | [diff] [blame] | 5548 | DP_PRINT_STATS("NSS(1-8) = %s", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5549 | nss); |
| 5550 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5551 | DP_PRINT_STATS("SGI =" |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5552 | " 0.8us %d," |
| 5553 | " 0.4us %d," |
| 5554 | " 1.6us %d," |
| 5555 | " 3.2us %d,", |
| 5556 | pdev->stats.rx.sgi_count[0], |
| 5557 | pdev->stats.rx.sgi_count[1], |
| 5558 | pdev->stats.rx.sgi_count[2], |
| 5559 | pdev->stats.rx.sgi_count[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5560 | 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] | 5561 | pdev->stats.rx.bw[0], pdev->stats.rx.bw[1], |
| 5562 | pdev->stats.rx.bw[2], pdev->stats.rx.bw[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5563 | DP_PRINT_STATS("Reception Type =" |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5564 | " SU: %d," |
| 5565 | " MU_MIMO:%d," |
| 5566 | " MU_OFDMA:%d," |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5567 | " MU_OFDMA_MIMO:%d\n", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5568 | pdev->stats.rx.reception_type[0], |
| 5569 | pdev->stats.rx.reception_type[1], |
| 5570 | pdev->stats.rx.reception_type[2], |
| 5571 | pdev->stats.rx.reception_type[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5572 | DP_PRINT_STATS("Aggregation:\n"); |
| 5573 | DP_PRINT_STATS("Number of Msdu's Part of Ampdus = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5574 | pdev->stats.rx.ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5575 | 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] | 5576 | pdev->stats.rx.non_ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5577 | DP_PRINT_STATS("Number of Msdu's Part of Amsdu: %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5578 | pdev->stats.rx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5579 | 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] | 5580 | pdev->stats.rx.non_amsdu_cnt); |
| 5581 | } |
| 5582 | |
| 5583 | /** |
| 5584 | * dp_print_tx_rates(): Print tx rates |
| 5585 | * @vdev: DP_VDEV handle |
| 5586 | * |
| 5587 | * Return:void |
| 5588 | */ |
| 5589 | static inline void |
| 5590 | dp_print_tx_rates(struct dp_vdev *vdev) |
| 5591 | { |
| 5592 | struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5593 | uint8_t mcs, pkt_type; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5594 | uint32_t index; |
| 5595 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5596 | DP_PRINT_STATS("Tx Rate Info:\n"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5597 | |
| 5598 | for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { |
| 5599 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5600 | for (mcs = 0; mcs < MAX_MCS; mcs++) { |
| 5601 | if (!dp_rate_string[pkt_type][mcs].valid) |
| 5602 | continue; |
| 5603 | |
| 5604 | DP_PRINT_STATS(" %s = %d", |
| 5605 | dp_rate_string[pkt_type][mcs].mcs_type, |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5606 | pdev->stats.tx.pkt_type[pkt_type]. |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5607 | mcs_count[mcs]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5608 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5609 | |
| 5610 | DP_PRINT_STATS("\n"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5611 | } |
| 5612 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5613 | DP_PRINT_STATS("SGI =" |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5614 | " 0.8us %d" |
| 5615 | " 0.4us %d" |
| 5616 | " 1.6us %d" |
| 5617 | " 3.2us %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5618 | pdev->stats.tx.sgi_count[0], |
| 5619 | pdev->stats.tx.sgi_count[1], |
| 5620 | pdev->stats.tx.sgi_count[2], |
| 5621 | pdev->stats.tx.sgi_count[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5622 | |
| 5623 | DP_PRINT_STATS("BW Counts = 20MHZ %d, 40MHZ %d, 80MHZ %d, 160MHZ %d", |
chenguo | ec84983 | 2018-04-11 19:14:06 +0800 | [diff] [blame] | 5624 | pdev->stats.tx.bw[0], pdev->stats.tx.bw[1], |
| 5625 | pdev->stats.tx.bw[2], pdev->stats.tx.bw[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5626 | |
| 5627 | DP_PRINT_STATS("OFDMA = %d", pdev->stats.tx.ofdma); |
| 5628 | DP_PRINT_STATS("STBC = %d", pdev->stats.tx.stbc); |
| 5629 | DP_PRINT_STATS("LDPC = %d", pdev->stats.tx.ldpc); |
| 5630 | DP_PRINT_STATS("Retries = %d", pdev->stats.tx.retries); |
| 5631 | DP_PRINT_STATS("Last ack rssi = %d\n", pdev->stats.tx.last_ack_rssi); |
| 5632 | |
| 5633 | DP_PRINT_STATS("Aggregation:\n"); |
| 5634 | DP_PRINT_STATS("Number of Msdu's Part of Amsdu = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5635 | pdev->stats.tx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5636 | 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] | 5637 | pdev->stats.tx.non_amsdu_cnt); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5638 | } |
| 5639 | |
| 5640 | /** |
| 5641 | * dp_print_peer_stats():print peer stats |
| 5642 | * @peer: DP_PEER handle |
| 5643 | * |
| 5644 | * return void |
| 5645 | */ |
| 5646 | static inline void dp_print_peer_stats(struct dp_peer *peer) |
| 5647 | { |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5648 | uint8_t i, mcs, pkt_type; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5649 | uint32_t index; |
| 5650 | char nss[DP_NSS_LENGTH]; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5651 | DP_PRINT_STATS("Node Tx Stats:\n"); |
| 5652 | DP_PRINT_STATS("Total Packet Completions = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5653 | peer->stats.tx.comp_pkt.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5654 | DP_PRINT_STATS("Total Bytes Completions = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5655 | peer->stats.tx.comp_pkt.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5656 | DP_PRINT_STATS("Success Packets = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5657 | peer->stats.tx.tx_success.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5658 | DP_PRINT_STATS("Success Bytes = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5659 | peer->stats.tx.tx_success.bytes); |
Pranita Solanke | fc2ff39 | 2017-12-15 19:25:13 +0530 | [diff] [blame] | 5660 | DP_PRINT_STATS("Unicast Success Packets = %d", |
| 5661 | peer->stats.tx.ucast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5662 | DP_PRINT_STATS("Unicast Success Bytes = %llu", |
Pranita Solanke | fc2ff39 | 2017-12-15 19:25:13 +0530 | [diff] [blame] | 5663 | peer->stats.tx.ucast.bytes); |
| 5664 | DP_PRINT_STATS("Multicast Success Packets = %d", |
| 5665 | peer->stats.tx.mcast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5666 | DP_PRINT_STATS("Multicast Success Bytes = %llu", |
Pranita Solanke | fc2ff39 | 2017-12-15 19:25:13 +0530 | [diff] [blame] | 5667 | peer->stats.tx.mcast.bytes); |
Pranita Solanke | a5a3ae7 | 2018-01-18 21:45:27 +0530 | [diff] [blame] | 5668 | DP_PRINT_STATS("Broadcast Success Packets = %d", |
| 5669 | peer->stats.tx.bcast.num); |
| 5670 | DP_PRINT_STATS("Broadcast Success Bytes = %llu", |
| 5671 | peer->stats.tx.bcast.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5672 | DP_PRINT_STATS("Packets Failed = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5673 | peer->stats.tx.tx_failed); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5674 | DP_PRINT_STATS("Packets In OFDMA = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5675 | peer->stats.tx.ofdma); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5676 | DP_PRINT_STATS("Packets In STBC = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5677 | peer->stats.tx.stbc); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5678 | DP_PRINT_STATS("Packets In LDPC = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5679 | peer->stats.tx.ldpc); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5680 | DP_PRINT_STATS("Packet Retries = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5681 | peer->stats.tx.retries); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5682 | DP_PRINT_STATS("MSDU's Part of AMSDU = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5683 | peer->stats.tx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5684 | DP_PRINT_STATS("Last Packet RSSI = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5685 | peer->stats.tx.last_ack_rssi); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5686 | DP_PRINT_STATS("Dropped At FW: Removed = %d", |
| 5687 | peer->stats.tx.dropped.fw_rem); |
| 5688 | DP_PRINT_STATS("Dropped At FW: Removed transmitted = %d", |
| 5689 | peer->stats.tx.dropped.fw_rem_tx); |
| 5690 | DP_PRINT_STATS("Dropped At FW: Removed Untransmitted = %d", |
| 5691 | peer->stats.tx.dropped.fw_rem_notx); |
| 5692 | DP_PRINT_STATS("Dropped : Age Out = %d", |
| 5693 | peer->stats.tx.dropped.age_out); |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5694 | DP_PRINT_STATS("NAWDS : "); |
| 5695 | DP_PRINT_STATS(" Nawds multicast Drop Tx Packet = %d", |
| 5696 | peer->stats.tx.nawds_mcast_drop); |
| 5697 | DP_PRINT_STATS(" Nawds multicast Tx Packet Count = %d", |
| 5698 | peer->stats.tx.nawds_mcast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5699 | DP_PRINT_STATS(" Nawds multicast Tx Packet Bytes = %llu", |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5700 | peer->stats.tx.nawds_mcast.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5701 | |
| 5702 | DP_PRINT_STATS("Rate Info:"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5703 | |
| 5704 | for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { |
| 5705 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5706 | for (mcs = 0; mcs < MAX_MCS; mcs++) { |
| 5707 | if (!dp_rate_string[pkt_type][mcs].valid) |
| 5708 | continue; |
| 5709 | |
| 5710 | DP_PRINT_STATS(" %s = %d", |
| 5711 | dp_rate_string[pkt_type][mcs].mcs_type, |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5712 | peer->stats.tx.pkt_type[pkt_type]. |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5713 | mcs_count[mcs]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5714 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5715 | |
| 5716 | DP_PRINT_STATS("\n"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5717 | } |
| 5718 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5719 | DP_PRINT_STATS("SGI = " |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5720 | " 0.8us %d" |
| 5721 | " 0.4us %d" |
| 5722 | " 1.6us %d" |
| 5723 | " 3.2us %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5724 | peer->stats.tx.sgi_count[0], |
| 5725 | peer->stats.tx.sgi_count[1], |
| 5726 | peer->stats.tx.sgi_count[2], |
| 5727 | peer->stats.tx.sgi_count[3]); |
Pranita Solanke | a5a3ae7 | 2018-01-18 21:45:27 +0530 | [diff] [blame] | 5728 | DP_PRINT_STATS("Excess Retries per AC "); |
| 5729 | DP_PRINT_STATS(" Best effort = %d", |
| 5730 | peer->stats.tx.excess_retries_per_ac[0]); |
| 5731 | DP_PRINT_STATS(" Background= %d", |
| 5732 | peer->stats.tx.excess_retries_per_ac[1]); |
| 5733 | DP_PRINT_STATS(" Video = %d", |
| 5734 | peer->stats.tx.excess_retries_per_ac[2]); |
| 5735 | DP_PRINT_STATS(" Voice = %d", |
| 5736 | peer->stats.tx.excess_retries_per_ac[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5737 | 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] | 5738 | peer->stats.tx.bw[2], peer->stats.tx.bw[3], |
| 5739 | peer->stats.tx.bw[4], peer->stats.tx.bw[5]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5740 | |
Pranita Solanke | ed0aba6 | 2018-01-12 19:14:31 +0530 | [diff] [blame] | 5741 | index = 0; |
| 5742 | for (i = 0; i < SS_COUNT; i++) { |
| 5743 | index += qdf_snprint(&nss[index], DP_NSS_LENGTH - index, |
| 5744 | " %d", peer->stats.tx.nss[i]); |
| 5745 | } |
| 5746 | DP_PRINT_STATS("NSS(1-8) = %s", |
| 5747 | nss); |
| 5748 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5749 | DP_PRINT_STATS("Aggregation:"); |
| 5750 | DP_PRINT_STATS(" Number of Msdu's Part of Amsdu = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5751 | peer->stats.tx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5752 | 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] | 5753 | peer->stats.tx.non_amsdu_cnt); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5754 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5755 | DP_PRINT_STATS("Node Rx Stats:"); |
| 5756 | DP_PRINT_STATS("Packets Sent To Stack = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5757 | peer->stats.rx.to_stack.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5758 | DP_PRINT_STATS("Bytes Sent To Stack = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5759 | peer->stats.rx.to_stack.bytes); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5760 | for (i = 0; i < CDP_MAX_RX_RINGS; i++) { |
Pranita Solanke | fc2ff39 | 2017-12-15 19:25:13 +0530 | [diff] [blame] | 5761 | DP_PRINT_STATS("Ring Id = %d", i); |
| 5762 | DP_PRINT_STATS(" Packets Received = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5763 | peer->stats.rx.rcvd_reo[i].num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5764 | DP_PRINT_STATS(" Bytes Received = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5765 | peer->stats.rx.rcvd_reo[i].bytes); |
| 5766 | } |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5767 | DP_PRINT_STATS("Multicast Packets Received = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5768 | peer->stats.rx.multicast.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5769 | DP_PRINT_STATS("Multicast Bytes Received = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5770 | peer->stats.rx.multicast.bytes); |
Pranita Solanke | a5a3ae7 | 2018-01-18 21:45:27 +0530 | [diff] [blame] | 5771 | DP_PRINT_STATS("Broadcast Packets Received = %d", |
| 5772 | peer->stats.rx.bcast.num); |
| 5773 | DP_PRINT_STATS("Broadcast Bytes Received = %llu", |
| 5774 | peer->stats.rx.bcast.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5775 | DP_PRINT_STATS("Intra BSS Packets Received = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5776 | peer->stats.rx.intra_bss.pkts.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5777 | DP_PRINT_STATS("Intra BSS Bytes Received = %llu", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5778 | peer->stats.rx.intra_bss.pkts.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5779 | DP_PRINT_STATS("Raw Packets Received = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5780 | peer->stats.rx.raw.num); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 5781 | DP_PRINT_STATS("Raw Bytes Received = %llu", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5782 | peer->stats.rx.raw.bytes); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5783 | DP_PRINT_STATS("Errors: MIC Errors = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5784 | peer->stats.rx.err.mic_err); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5785 | DP_PRINT_STATS("Erros: Decryption Errors = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5786 | peer->stats.rx.err.decrypt_err); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5787 | DP_PRINT_STATS("Msdu's Received As Part of Ampdu = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5788 | peer->stats.rx.non_ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5789 | DP_PRINT_STATS("Msdu's Recived As Ampdu = %d", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5790 | peer->stats.rx.ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5791 | DP_PRINT_STATS("Msdu's Received Not Part of Amsdu's = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5792 | peer->stats.rx.non_amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5793 | DP_PRINT_STATS("MSDUs Received As Part of Amsdu = %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5794 | peer->stats.rx.amsdu_cnt); |
Ruchi, Agrawal | bd894b3 | 2017-11-03 17:24:56 +0530 | [diff] [blame] | 5795 | DP_PRINT_STATS("NAWDS : "); |
| 5796 | DP_PRINT_STATS(" Nawds multicast Drop Rx Packet = %d", |
Ruchi, Agrawal | 2755048 | 2018-02-20 19:43:41 +0530 | [diff] [blame] | 5797 | peer->stats.rx.nawds_mcast_drop); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5798 | DP_PRINT_STATS("SGI =" |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5799 | " 0.8us %d" |
| 5800 | " 0.4us %d" |
| 5801 | " 1.6us %d" |
| 5802 | " 3.2us %d", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5803 | peer->stats.rx.sgi_count[0], |
| 5804 | peer->stats.rx.sgi_count[1], |
| 5805 | peer->stats.rx.sgi_count[2], |
| 5806 | peer->stats.rx.sgi_count[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5807 | 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] | 5808 | peer->stats.rx.bw[0], peer->stats.rx.bw[1], |
| 5809 | peer->stats.rx.bw[2], peer->stats.rx.bw[3]); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5810 | DP_PRINT_STATS("Reception Type =" |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5811 | " SU %d," |
| 5812 | " MU_MIMO %d," |
| 5813 | " MU_OFDMA %d," |
| 5814 | " MU_OFDMA_MIMO %d", |
| 5815 | peer->stats.rx.reception_type[0], |
| 5816 | peer->stats.rx.reception_type[1], |
| 5817 | peer->stats.rx.reception_type[2], |
| 5818 | peer->stats.rx.reception_type[3]); |
| 5819 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5820 | |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5821 | for (pkt_type = 0; pkt_type < DOT11_MAX; pkt_type++) { |
| 5822 | index = 0; |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5823 | for (mcs = 0; mcs < MAX_MCS; mcs++) { |
| 5824 | if (!dp_rate_string[pkt_type][mcs].valid) |
| 5825 | continue; |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5826 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5827 | DP_PRINT_STATS(" %s = %d", |
| 5828 | dp_rate_string[pkt_type][mcs].mcs_type, |
| 5829 | peer->stats.rx.pkt_type[pkt_type]. |
| 5830 | mcs_count[mcs]); |
| 5831 | } |
| 5832 | |
| 5833 | DP_PRINT_STATS("\n"); |
| 5834 | } |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5835 | |
| 5836 | index = 0; |
| 5837 | for (i = 0; i < SS_COUNT; i++) { |
| 5838 | index += qdf_snprint(&nss[index], DP_NSS_LENGTH - index, |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 5839 | " %d", peer->stats.rx.nss[i]); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5840 | } |
Anish Nataraj | 072d897 | 2018-01-09 18:23:33 +0530 | [diff] [blame] | 5841 | DP_PRINT_STATS("NSS(1-8) = %s", |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5842 | nss); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5843 | |
| 5844 | DP_PRINT_STATS("Aggregation:"); |
| 5845 | DP_PRINT_STATS(" Msdu's Part of Ampdu = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5846 | peer->stats.rx.ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5847 | DP_PRINT_STATS(" Msdu's With No Mpdu Level Aggregation = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5848 | peer->stats.rx.non_ampdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5849 | DP_PRINT_STATS(" Msdu's Part of Amsdu = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5850 | peer->stats.rx.amsdu_cnt); |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 5851 | DP_PRINT_STATS(" Msdu's With No Msdu Level Aggregation = %d", |
Ishank Jain | e73c403 | 2017-03-16 11:48:15 +0530 | [diff] [blame] | 5852 | peer->stats.rx.non_amsdu_cnt); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5853 | } |
| 5854 | |
| 5855 | /** |
| 5856 | * dp_print_host_stats()- Function to print the stats aggregated at host |
| 5857 | * @vdev_handle: DP_VDEV handle |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5858 | * @type: host stats type |
| 5859 | * |
| 5860 | * Available Stat types |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5861 | * TXRX_CLEAR_STATS : Clear the stats |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5862 | * TXRX_RX_RATE_STATS: Print Rx Rate Info |
| 5863 | * TXRX_TX_RATE_STATS: Print Tx Rate Info |
| 5864 | * TXRX_TX_HOST_STATS: Print Tx Stats |
| 5865 | * TXRX_RX_HOST_STATS: Print Rx Stats |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 5866 | * TXRX_AST_STATS: Print AST Stats |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5867 | * TXRX_SRNG_PTR_STATS: Print SRNG ring pointer stats |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5868 | * |
| 5869 | * Return: 0 on success, print error message in case of failure |
| 5870 | */ |
| 5871 | static int |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5872 | 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] | 5873 | { |
| 5874 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 5875 | struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; |
| 5876 | |
| 5877 | dp_aggregate_pdev_stats(pdev); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 5878 | |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5879 | switch (type) { |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5880 | case TXRX_CLEAR_STATS: |
| 5881 | dp_txrx_host_stats_clr(vdev); |
| 5882 | break; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5883 | case TXRX_RX_RATE_STATS: |
| 5884 | dp_print_rx_rates(vdev); |
| 5885 | break; |
| 5886 | case TXRX_TX_RATE_STATS: |
| 5887 | dp_print_tx_rates(vdev); |
| 5888 | break; |
| 5889 | case TXRX_TX_HOST_STATS: |
| 5890 | dp_print_pdev_tx_stats(pdev); |
| 5891 | dp_print_soc_tx_stats(pdev->soc); |
| 5892 | break; |
| 5893 | case TXRX_RX_HOST_STATS: |
| 5894 | dp_print_pdev_rx_stats(pdev); |
| 5895 | dp_print_soc_rx_stats(pdev->soc); |
| 5896 | break; |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 5897 | case TXRX_AST_STATS: |
| 5898 | dp_print_ast_stats(pdev->soc); |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 5899 | dp_print_peer_table(vdev); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 5900 | break; |
sumedh baikady | 72b1c71 | 2017-08-24 12:11:46 -0700 | [diff] [blame] | 5901 | case TXRX_SRNG_PTR_STATS: |
Kai Chen | 783e038 | 2018-01-25 16:29:08 -0800 | [diff] [blame] | 5902 | dp_print_ring_stats(pdev); |
| 5903 | break; |
| 5904 | case TXRX_RX_MON_STATS: |
| 5905 | dp_print_pdev_rx_mon_stats(pdev); |
| 5906 | break; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5907 | default: |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 5908 | DP_TRACE(FATAL, "Wrong Input For TxRx Host Stats"); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5909 | break; |
| 5910 | } |
| 5911 | return 0; |
| 5912 | } |
| 5913 | |
| 5914 | /* |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5915 | * dp_get_host_peer_stats()- function to print peer stats |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5916 | * @pdev_handle: DP_PDEV handle |
| 5917 | * @mac_addr: mac address of the peer |
| 5918 | * |
| 5919 | * Return: void |
| 5920 | */ |
| 5921 | static void |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5922 | 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] | 5923 | { |
| 5924 | struct dp_peer *peer; |
| 5925 | uint8_t local_id; |
| 5926 | peer = (struct dp_peer *)dp_find_peer_by_addr(pdev_handle, mac_addr, |
| 5927 | &local_id); |
| 5928 | |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 5929 | if (!peer) { |
| 5930 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 5931 | "%s: Invalid peer\n", __func__); |
| 5932 | return; |
| 5933 | } |
| 5934 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5935 | dp_print_peer_stats(peer); |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 5936 | dp_peer_rxtid_stats(peer, dp_rx_tid_stats_cb, NULL); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5937 | return; |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 5938 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 5939 | |
| 5940 | /* |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5941 | * dp_ppdu_ring_reset()- Reset PPDU Stats ring |
| 5942 | * @pdev: DP_PDEV handle |
| 5943 | * |
| 5944 | * Return: void |
| 5945 | */ |
| 5946 | static void |
| 5947 | dp_ppdu_ring_reset(struct dp_pdev *pdev) |
| 5948 | { |
| 5949 | struct htt_rx_ring_tlv_filter htt_tlv_filter; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 5950 | int mac_id; |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5951 | |
| 5952 | qdf_mem_set(&(htt_tlv_filter), sizeof(htt_tlv_filter), 0x0); |
| 5953 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 5954 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 5955 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, |
| 5956 | pdev->pdev_id); |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5957 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 5958 | htt_h2t_rx_ring_cfg(pdev->soc->htt_handle, mac_for_pdev, |
| 5959 | pdev->rxdma_mon_status_ring[mac_id].hal_srng, |
| 5960 | RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 5961 | } |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 5962 | } |
| 5963 | |
| 5964 | /* |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 5965 | * dp_ppdu_ring_cfg()- Configure PPDU Stats ring |
| 5966 | * @pdev: DP_PDEV handle |
| 5967 | * |
| 5968 | * Return: void |
| 5969 | */ |
| 5970 | static void |
| 5971 | dp_ppdu_ring_cfg(struct dp_pdev *pdev) |
| 5972 | { |
| 5973 | struct htt_rx_ring_tlv_filter htt_tlv_filter = {0}; |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 5974 | int mac_id; |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 5975 | |
Soumya Bhat | 35fc699 | 2018-03-09 18:39:03 +0530 | [diff] [blame] | 5976 | htt_tlv_filter.mpdu_start = 1; |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 5977 | htt_tlv_filter.msdu_start = 0; |
| 5978 | htt_tlv_filter.packet = 0; |
| 5979 | htt_tlv_filter.msdu_end = 0; |
| 5980 | htt_tlv_filter.mpdu_end = 0; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 5981 | htt_tlv_filter.attention = 0; |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 5982 | htt_tlv_filter.ppdu_start = 1; |
| 5983 | htt_tlv_filter.ppdu_end = 1; |
| 5984 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 5985 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 5986 | htt_tlv_filter.ppdu_end_status_done = 1; |
| 5987 | htt_tlv_filter.enable_fp = 1; |
| 5988 | htt_tlv_filter.enable_md = 0; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 5989 | if (pdev->mcopy_mode) { |
| 5990 | htt_tlv_filter.packet_header = 1; |
Soumya Bhat | 2f54de2 | 2018-02-21 09:54:28 +0530 | [diff] [blame] | 5991 | htt_tlv_filter.enable_mo = 1; |
nobelj | 1c31fee | 2018-03-21 11:47:05 -0700 | [diff] [blame] | 5992 | } |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 5993 | htt_tlv_filter.fp_mgmt_filter = FILTER_MGMT_ALL; |
| 5994 | htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_ALL; |
| 5995 | htt_tlv_filter.fp_data_filter = FILTER_DATA_ALL; |
| 5996 | htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL; |
| 5997 | htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; |
| 5998 | htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 5999 | |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 6000 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 6001 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, |
| 6002 | pdev->pdev_id); |
| 6003 | |
| 6004 | htt_h2t_rx_ring_cfg(pdev->soc->htt_handle, mac_for_pdev, |
| 6005 | pdev->rxdma_mon_status_ring[mac_id].hal_srng, |
| 6006 | RXDMA_MONITOR_STATUS, RX_BUFFER_SIZE, &htt_tlv_filter); |
| 6007 | } |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 6008 | } |
| 6009 | |
| 6010 | /* |
Vinay Adella | 873dc40 | 2018-05-28 12:06:34 +0530 | [diff] [blame] | 6011 | *dp_set_bpr_enable() - API to enable/disable bpr feature |
| 6012 | *@pdev_handle: DP_PDEV handle. |
| 6013 | *@val: Provided value. |
| 6014 | * |
| 6015 | *Return: void |
| 6016 | */ |
| 6017 | static void |
| 6018 | dp_set_bpr_enable(struct cdp_pdev *pdev_handle, int val) |
| 6019 | { |
| 6020 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 6021 | |
| 6022 | switch (val) { |
| 6023 | case CDP_BPR_DISABLE: |
| 6024 | pdev->bpr_enable = CDP_BPR_DISABLE; |
| 6025 | if (!pdev->pktlog_ppdu_stats && !pdev->enhanced_stats_en && |
| 6026 | !pdev->tx_sniffer_enable && !pdev->mcopy_mode) { |
| 6027 | dp_h2t_cfg_stats_msg_send(pdev, 0, pdev->pdev_id); |
| 6028 | } else if (pdev->enhanced_stats_en && |
| 6029 | !pdev->tx_sniffer_enable && !pdev->mcopy_mode && |
| 6030 | !pdev->pktlog_ppdu_stats) { |
| 6031 | dp_h2t_cfg_stats_msg_send(pdev, |
| 6032 | DP_PPDU_STATS_CFG_ENH_STATS, |
| 6033 | pdev->pdev_id); |
| 6034 | } |
| 6035 | break; |
| 6036 | case CDP_BPR_ENABLE: |
| 6037 | pdev->bpr_enable = CDP_BPR_ENABLE; |
| 6038 | if (!pdev->enhanced_stats_en && !pdev->tx_sniffer_enable && |
| 6039 | !pdev->mcopy_mode && !pdev->pktlog_ppdu_stats) { |
| 6040 | dp_h2t_cfg_stats_msg_send(pdev, |
| 6041 | DP_PPDU_STATS_CFG_BPR, |
| 6042 | pdev->pdev_id); |
| 6043 | } else if (pdev->enhanced_stats_en && |
| 6044 | !pdev->tx_sniffer_enable && !pdev->mcopy_mode && |
| 6045 | !pdev->pktlog_ppdu_stats) { |
| 6046 | dp_h2t_cfg_stats_msg_send(pdev, |
| 6047 | DP_PPDU_STATS_CFG_BPR_ENH, |
| 6048 | pdev->pdev_id); |
| 6049 | } else if (pdev->pktlog_ppdu_stats) { |
| 6050 | dp_h2t_cfg_stats_msg_send(pdev, |
| 6051 | DP_PPDU_STATS_CFG_BPR_PKTLOG, |
| 6052 | pdev->pdev_id); |
| 6053 | } |
| 6054 | break; |
| 6055 | default: |
| 6056 | break; |
| 6057 | } |
| 6058 | } |
| 6059 | |
| 6060 | /* |
Soumya Bhat | 6fee59c | 2017-10-31 13:12:37 +0530 | [diff] [blame] | 6061 | * dp_config_debug_sniffer()- API to enable/disable debug sniffer |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6062 | * @pdev_handle: DP_PDEV handle |
| 6063 | * @val: user provided value |
| 6064 | * |
| 6065 | * Return: void |
| 6066 | */ |
| 6067 | static void |
Soumya Bhat | 6fee59c | 2017-10-31 13:12:37 +0530 | [diff] [blame] | 6068 | dp_config_debug_sniffer(struct cdp_pdev *pdev_handle, int val) |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6069 | { |
| 6070 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 6071 | |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 6072 | switch (val) { |
| 6073 | case 0: |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6074 | pdev->tx_sniffer_enable = 0; |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6075 | pdev->mcopy_mode = 0; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6076 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6077 | if (!pdev->pktlog_ppdu_stats && !pdev->enhanced_stats_en) { |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 6078 | dp_h2t_cfg_stats_msg_send(pdev, 0, pdev->pdev_id); |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6079 | dp_ppdu_ring_reset(pdev); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6080 | } else if (pdev->enhanced_stats_en) { |
| 6081 | dp_h2t_cfg_stats_msg_send(pdev, |
| 6082 | DP_PPDU_STATS_CFG_ENH_STATS, pdev->pdev_id); |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6083 | } |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 6084 | break; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6085 | |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 6086 | case 1: |
| 6087 | pdev->tx_sniffer_enable = 1; |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6088 | pdev->mcopy_mode = 0; |
| 6089 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6090 | if (!pdev->pktlog_ppdu_stats) |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6091 | dp_h2t_cfg_stats_msg_send(pdev, |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6092 | DP_PPDU_STATS_CFG_SNIFFER, pdev->pdev_id); |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 6093 | break; |
| 6094 | case 2: |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6095 | pdev->mcopy_mode = 1; |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 6096 | pdev->tx_sniffer_enable = 0; |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6097 | if (!pdev->enhanced_stats_en) |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6098 | dp_ppdu_ring_cfg(pdev); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6099 | |
| 6100 | if (!pdev->pktlog_ppdu_stats) |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6101 | dp_h2t_cfg_stats_msg_send(pdev, |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6102 | DP_PPDU_STATS_CFG_SNIFFER, pdev->pdev_id); |
Soumya Bhat | 89647ef | 2017-11-16 17:23:48 +0530 | [diff] [blame] | 6103 | break; |
| 6104 | default: |
| 6105 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6106 | "Invalid value\n"); |
| 6107 | break; |
| 6108 | } |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6109 | } |
| 6110 | |
| 6111 | /* |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 6112 | * dp_enable_enhanced_stats()- API to enable enhanced statistcs |
| 6113 | * @pdev_handle: DP_PDEV handle |
| 6114 | * |
| 6115 | * Return: void |
| 6116 | */ |
| 6117 | static void |
| 6118 | dp_enable_enhanced_stats(struct cdp_pdev *pdev_handle) |
| 6119 | { |
| 6120 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 6121 | pdev->enhanced_stats_en = 1; |
Anish Nataraj | 38a2956 | 2017-08-18 19:41:17 +0530 | [diff] [blame] | 6122 | |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6123 | if (!pdev->mcopy_mode) |
| 6124 | dp_ppdu_ring_cfg(pdev); |
| 6125 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6126 | if (!pdev->pktlog_ppdu_stats && !pdev->tx_sniffer_enable && !pdev->mcopy_mode) |
| 6127 | 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] | 6128 | } |
| 6129 | |
| 6130 | /* |
| 6131 | * dp_disable_enhanced_stats()- API to disable enhanced statistcs |
| 6132 | * @pdev_handle: DP_PDEV handle |
| 6133 | * |
| 6134 | * Return: void |
| 6135 | */ |
| 6136 | static void |
| 6137 | dp_disable_enhanced_stats(struct cdp_pdev *pdev_handle) |
| 6138 | { |
| 6139 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6140 | |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 6141 | pdev->enhanced_stats_en = 0; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6142 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 6143 | 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] | 6144 | dp_h2t_cfg_stats_msg_send(pdev, 0, pdev->pdev_id); |
Soumya Bhat | 7422db8 | 2017-12-15 13:48:53 +0530 | [diff] [blame] | 6145 | |
| 6146 | if (!pdev->mcopy_mode) |
| 6147 | dp_ppdu_ring_reset(pdev); |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 6148 | } |
| 6149 | |
| 6150 | /* |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6151 | * dp_get_fw_peer_stats()- function to print peer stats |
| 6152 | * @pdev_handle: DP_PDEV handle |
| 6153 | * @mac_addr: mac address of the peer |
| 6154 | * @cap: Type of htt stats requested |
| 6155 | * |
| 6156 | * Currently Supporting only MAC ID based requests Only |
| 6157 | * 1: HTT_PEER_STATS_REQ_MODE_NO_QUERY |
| 6158 | * 2: HTT_PEER_STATS_REQ_MODE_QUERY_TQM |
| 6159 | * 3: HTT_PEER_STATS_REQ_MODE_FLUSH_TQM |
| 6160 | * |
| 6161 | * Return: void |
| 6162 | */ |
| 6163 | static void |
| 6164 | dp_get_fw_peer_stats(struct cdp_pdev *pdev_handle, uint8_t *mac_addr, |
| 6165 | uint32_t cap) |
| 6166 | { |
| 6167 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Pamidipati, Vijay | c2cf669 | 2017-11-22 10:17:34 +0530 | [diff] [blame] | 6168 | int i; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6169 | uint32_t config_param0 = 0; |
| 6170 | uint32_t config_param1 = 0; |
| 6171 | uint32_t config_param2 = 0; |
| 6172 | uint32_t config_param3 = 0; |
| 6173 | |
| 6174 | HTT_DBG_EXT_STATS_PEER_INFO_IS_MAC_ADDR_SET(config_param0, 1); |
| 6175 | config_param0 |= (1 << (cap + 1)); |
| 6176 | |
Pamidipati, Vijay | c2cf669 | 2017-11-22 10:17:34 +0530 | [diff] [blame] | 6177 | for (i = 0; i < HTT_PEER_STATS_MAX_TLV; i++) { |
| 6178 | config_param1 |= (1 << i); |
| 6179 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6180 | |
| 6181 | config_param2 |= (mac_addr[0] & 0x000000ff); |
| 6182 | config_param2 |= ((mac_addr[1] << 8) & 0x0000ff00); |
| 6183 | config_param2 |= ((mac_addr[2] << 16) & 0x00ff0000); |
| 6184 | config_param2 |= ((mac_addr[3] << 24) & 0xff000000); |
| 6185 | |
| 6186 | config_param3 |= (mac_addr[4] & 0x000000ff); |
| 6187 | config_param3 |= ((mac_addr[5] << 8) & 0x0000ff00); |
| 6188 | |
| 6189 | dp_h2t_ext_stats_msg_send(pdev, HTT_DBG_EXT_STATS_PEER_INFO, |
| 6190 | config_param0, config_param1, config_param2, |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame] | 6191 | config_param3, 0, 0, 0); |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 6192 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6193 | } |
| 6194 | |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 6195 | /* This struct definition will be removed from here |
| 6196 | * once it get added in FW headers*/ |
| 6197 | struct httstats_cmd_req { |
| 6198 | uint32_t config_param0; |
| 6199 | uint32_t config_param1; |
| 6200 | uint32_t config_param2; |
| 6201 | uint32_t config_param3; |
| 6202 | int cookie; |
| 6203 | u_int8_t stats_id; |
| 6204 | }; |
| 6205 | |
| 6206 | /* |
| 6207 | * dp_get_htt_stats: function to process the httstas request |
| 6208 | * @pdev_handle: DP pdev handle |
| 6209 | * @data: pointer to request data |
| 6210 | * @data_len: length for request data |
| 6211 | * |
| 6212 | * return: void |
| 6213 | */ |
| 6214 | static void |
| 6215 | dp_get_htt_stats(struct cdp_pdev *pdev_handle, void *data, uint32_t data_len) |
| 6216 | { |
| 6217 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 6218 | struct httstats_cmd_req *req = (struct httstats_cmd_req *)data; |
| 6219 | |
| 6220 | QDF_ASSERT(data_len == sizeof(struct httstats_cmd_req)); |
| 6221 | dp_h2t_ext_stats_msg_send(pdev, req->stats_id, |
| 6222 | req->config_param0, req->config_param1, |
| 6223 | req->config_param2, req->config_param3, |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame] | 6224 | req->cookie, 0, 0); |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 6225 | } |
Vinay Adella | 873dc40 | 2018-05-28 12:06:34 +0530 | [diff] [blame] | 6226 | |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 6227 | /* |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6228 | * dp_set_pdev_param: function to set parameters in pdev |
| 6229 | * @pdev_handle: DP pdev handle |
| 6230 | * @param: parameter type to be set |
| 6231 | * @val: value of parameter to be set |
| 6232 | * |
| 6233 | * return: void |
| 6234 | */ |
| 6235 | static void dp_set_pdev_param(struct cdp_pdev *pdev_handle, |
| 6236 | enum cdp_pdev_param_type param, uint8_t val) |
| 6237 | { |
| 6238 | switch (param) { |
Soumya Bhat | 6fee59c | 2017-10-31 13:12:37 +0530 | [diff] [blame] | 6239 | case CDP_CONFIG_DEBUG_SNIFFER: |
| 6240 | dp_config_debug_sniffer(pdev_handle, val); |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6241 | break; |
Vinay Adella | 873dc40 | 2018-05-28 12:06:34 +0530 | [diff] [blame] | 6242 | case CDP_CONFIG_BPR_ENABLE: |
| 6243 | dp_set_bpr_enable(pdev_handle, val); |
| 6244 | break; |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 6245 | default: |
| 6246 | break; |
| 6247 | } |
| 6248 | } |
| 6249 | |
| 6250 | /* |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 6251 | * dp_set_vdev_param: function to set parameters in vdev |
| 6252 | * @param: parameter type to be set |
| 6253 | * @val: value of parameter to be set |
| 6254 | * |
| 6255 | * return: void |
| 6256 | */ |
| 6257 | static void dp_set_vdev_param(struct cdp_vdev *vdev_handle, |
| 6258 | enum cdp_vdev_param_type param, uint32_t val) |
| 6259 | { |
| 6260 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 6261 | switch (param) { |
Pamidipati, Vijay | c9a13a5 | 2017-04-06 17:45:49 +0530 | [diff] [blame] | 6262 | case CDP_ENABLE_WDS: |
| 6263 | vdev->wds_enabled = val; |
| 6264 | break; |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 6265 | case CDP_ENABLE_NAWDS: |
| 6266 | vdev->nawds_enabled = val; |
Ishank Jain | b463d9a | 2017-05-08 14:59:47 +0530 | [diff] [blame] | 6267 | break; |
Ishank Jain | c838b13 | 2017-02-17 11:08:18 +0530 | [diff] [blame] | 6268 | case CDP_ENABLE_MCAST_EN: |
| 6269 | vdev->mcast_enhancement_en = val; |
Pamidipati, Vijay | c9a13a5 | 2017-04-06 17:45:49 +0530 | [diff] [blame] | 6270 | break; |
| 6271 | case CDP_ENABLE_PROXYSTA: |
| 6272 | vdev->proxysta_vdev = val; |
| 6273 | break; |
Kabilan Kannan | 56bfd8f | 2017-04-26 13:26:47 -0700 | [diff] [blame] | 6274 | case CDP_UPDATE_TDLS_FLAGS: |
| 6275 | vdev->tdls_link_connected = val; |
Ishank Jain | b463d9a | 2017-05-08 14:59:47 +0530 | [diff] [blame] | 6276 | break; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6277 | case CDP_CFG_WDS_AGING_TIMER: |
| 6278 | if (val == 0) |
| 6279 | qdf_timer_stop(&vdev->pdev->soc->wds_aging_timer); |
| 6280 | else if (val != vdev->wds_aging_timer_val) |
| 6281 | qdf_timer_mod(&vdev->pdev->soc->wds_aging_timer, val); |
| 6282 | |
| 6283 | vdev->wds_aging_timer_val = val; |
| 6284 | break; |
URAJ SASAN | 81d9571 | 2017-08-21 20:51:03 +0530 | [diff] [blame] | 6285 | case CDP_ENABLE_AP_BRIDGE: |
| 6286 | if (wlan_op_mode_sta != vdev->opmode) |
| 6287 | vdev->ap_bridge_enabled = val; |
| 6288 | else |
| 6289 | vdev->ap_bridge_enabled = false; |
| 6290 | break; |
ruchi agrawal | 45f3ac4 | 2017-10-25 09:03:28 +0530 | [diff] [blame] | 6291 | case CDP_ENABLE_CIPHER: |
| 6292 | vdev->sec_type = val; |
| 6293 | break; |
Nandha Kishore Easwaran | 47e7416 | 2017-12-12 11:54:01 +0530 | [diff] [blame] | 6294 | case CDP_ENABLE_QWRAP_ISOLATION: |
| 6295 | vdev->isolation_vdev = val; |
| 6296 | break; |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 6297 | default: |
| 6298 | break; |
| 6299 | } |
Pamidipati, Vijay | c9a13a5 | 2017-04-06 17:45:49 +0530 | [diff] [blame] | 6300 | |
| 6301 | dp_tx_vdev_update_search_flags(vdev); |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 6302 | } |
| 6303 | |
| 6304 | /** |
| 6305 | * dp_peer_set_nawds: set nawds bit in peer |
| 6306 | * @peer_handle: pointer to peer |
| 6307 | * @value: enable/disable nawds |
| 6308 | * |
| 6309 | * return: void |
| 6310 | */ |
c_cgodav | bd5b3c2 | 2017-06-07 12:31:40 +0530 | [diff] [blame] | 6311 | 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] | 6312 | { |
| 6313 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 6314 | peer->nawds_enabled = value; |
| 6315 | } |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 6316 | |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 6317 | /* |
| 6318 | * dp_set_vdev_dscp_tid_map_wifi3(): Update Map ID selected for particular vdev |
| 6319 | * @vdev_handle: DP_VDEV handle |
| 6320 | * @map_id:ID of map that needs to be updated |
| 6321 | * |
| 6322 | * Return: void |
| 6323 | */ |
| 6324 | static void dp_set_vdev_dscp_tid_map_wifi3(struct cdp_vdev *vdev_handle, |
| 6325 | uint8_t map_id) |
| 6326 | { |
| 6327 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 6328 | vdev->dscp_tid_map_id = map_id; |
| 6329 | return; |
| 6330 | } |
| 6331 | |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 6332 | /* |
| 6333 | * dp_txrx_stats_publish(): publish pdev stats into a buffer |
| 6334 | * @pdev_handle: DP_PDEV handle |
| 6335 | * @buf: to hold pdev_stats |
| 6336 | * |
| 6337 | * Return: int |
| 6338 | */ |
| 6339 | static int |
| 6340 | dp_txrx_stats_publish(struct cdp_pdev *pdev_handle, void *buf) |
| 6341 | { |
| 6342 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 6343 | struct cdp_pdev_stats *buffer = (struct cdp_pdev_stats *) buf; |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 6344 | struct cdp_txrx_stats_req req = {0,}; |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 6345 | |
| 6346 | dp_aggregate_pdev_stats(pdev); |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 6347 | req.stats = HTT_DBG_EXT_STATS_PDEV_TX; |
| 6348 | req.cookie_val = 1; |
| 6349 | 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] | 6350 | req.param1, req.param2, req.param3, 0, |
| 6351 | req.cookie_val, 0); |
| 6352 | |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 6353 | msleep(DP_MAX_SLEEP_TIME); |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 6354 | |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 6355 | req.stats = HTT_DBG_EXT_STATS_PDEV_RX; |
| 6356 | req.cookie_val = 1; |
| 6357 | 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] | 6358 | req.param1, req.param2, req.param3, 0, |
| 6359 | req.cookie_val, 0); |
| 6360 | |
Prathyusha Guduri | 43bb056 | 2018-02-12 18:30:54 +0530 | [diff] [blame] | 6361 | msleep(DP_MAX_SLEEP_TIME); |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 6362 | qdf_mem_copy(buffer, &pdev->stats, sizeof(pdev->stats)); |
| 6363 | |
| 6364 | return TXRX_STATS_LEVEL; |
| 6365 | } |
| 6366 | |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 6367 | /** |
| 6368 | * dp_set_pdev_dscp_tid_map_wifi3(): update dscp tid map in pdev |
| 6369 | * @pdev: DP_PDEV handle |
| 6370 | * @map_id: ID of map that needs to be updated |
| 6371 | * @tos: index value in map |
| 6372 | * @tid: tid value passed by the user |
| 6373 | * |
| 6374 | * Return: void |
| 6375 | */ |
| 6376 | static void dp_set_pdev_dscp_tid_map_wifi3(struct cdp_pdev *pdev_handle, |
| 6377 | uint8_t map_id, uint8_t tos, uint8_t tid) |
| 6378 | { |
| 6379 | uint8_t dscp; |
| 6380 | struct dp_pdev *pdev = (struct dp_pdev *) pdev_handle; |
| 6381 | dscp = (tos >> DP_IP_DSCP_SHIFT) & DP_IP_DSCP_MASK; |
| 6382 | pdev->dscp_tid_map[map_id][dscp] = tid; |
Om Prakash Tripathi | 5425c52 | 2017-08-18 11:11:34 +0530 | [diff] [blame] | 6383 | if (map_id < HAL_MAX_HW_DSCP_TID_MAPS) |
| 6384 | hal_tx_update_dscp_tid(pdev->soc->hal_soc, tid, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 6385 | map_id, dscp); |
| 6386 | return; |
| 6387 | } |
| 6388 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6389 | /** |
| 6390 | * dp_fw_stats_process(): Process TxRX FW stats request |
| 6391 | * @vdev_handle: DP VDEV handle |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6392 | * @req: stats request |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6393 | * |
| 6394 | * return: int |
| 6395 | */ |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6396 | static int dp_fw_stats_process(struct cdp_vdev *vdev_handle, |
| 6397 | struct cdp_txrx_stats_req *req) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6398 | { |
| 6399 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 6400 | struct dp_pdev *pdev = NULL; |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6401 | uint32_t stats = req->stats; |
Venkata Sharath Chandra Manchala | 4face24 | 2018-04-23 11:48:28 -0700 | [diff] [blame] | 6402 | uint8_t mac_id = req->mac_id; |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6403 | |
| 6404 | if (!vdev) { |
| 6405 | DP_TRACE(NONE, "VDEV not found"); |
| 6406 | return 1; |
| 6407 | } |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6408 | pdev = vdev->pdev; |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6409 | |
chenguo | cda2512 | 2018-01-24 17:39:38 +0800 | [diff] [blame] | 6410 | /* |
| 6411 | * For HTT_DBG_EXT_STATS_RESET command, FW need to config |
| 6412 | * from param0 to param3 according to below rule: |
| 6413 | * |
| 6414 | * PARAM: |
| 6415 | * - config_param0 : start_offset (stats type) |
| 6416 | * - config_param1 : stats bmask from start offset |
| 6417 | * - config_param2 : stats bmask from start offset + 32 |
| 6418 | * - config_param3 : stats bmask from start offset + 64 |
| 6419 | */ |
| 6420 | if (req->stats == CDP_TXRX_STATS_0) { |
| 6421 | req->param0 = HTT_DBG_EXT_STATS_PDEV_TX; |
| 6422 | req->param1 = 0xFFFFFFFF; |
| 6423 | req->param2 = 0xFFFFFFFF; |
| 6424 | req->param3 = 0xFFFFFFFF; |
| 6425 | } |
| 6426 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6427 | 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] | 6428 | req->param1, req->param2, req->param3, |
Venkata Sharath Chandra Manchala | 4face24 | 2018-04-23 11:48:28 -0700 | [diff] [blame] | 6429 | 0, 0, mac_id); |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6430 | } |
| 6431 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6432 | /** |
| 6433 | * 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] | 6434 | * @vdev: virtual handle |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6435 | * @req: stats request |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 6436 | * |
| 6437 | * Return: integer |
| 6438 | */ |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6439 | static int dp_txrx_stats_request(struct cdp_vdev *vdev, |
| 6440 | struct cdp_txrx_stats_req *req) |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 6441 | { |
| 6442 | int host_stats; |
| 6443 | int fw_stats; |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6444 | enum cdp_stats stats; |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 6445 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6446 | if (!vdev || !req) { |
| 6447 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6448 | "Invalid vdev/req instance"); |
| 6449 | return 0; |
| 6450 | } |
Venkata Sharath Chandra Manchala | ac863c4 | 2018-02-19 22:47:07 -0800 | [diff] [blame] | 6451 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6452 | stats = req->stats; |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 6453 | if (stats >= CDP_TXRX_MAX_STATS) |
| 6454 | return 0; |
| 6455 | |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6456 | /* |
| 6457 | * DP_CURR_FW_STATS_AVAIL: no of FW stats currently available |
| 6458 | * has to be updated if new FW HTT stats added |
| 6459 | */ |
| 6460 | if (stats > CDP_TXRX_STATS_HTT_MAX) |
| 6461 | 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] | 6462 | fw_stats = dp_stats_mapping_table[stats][STATS_FW]; |
| 6463 | host_stats = dp_stats_mapping_table[stats][STATS_HOST]; |
| 6464 | |
| 6465 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 6466 | "stats: %u fw_stats_type: %d host_stats_type: %d", |
| 6467 | stats, fw_stats, host_stats); |
| 6468 | |
Om Prakash Tripathi | 03efb6a | 2017-08-23 22:51:28 +0530 | [diff] [blame] | 6469 | if (fw_stats != TXRX_FW_STATS_INVALID) { |
| 6470 | /* update request with FW stats type */ |
| 6471 | req->stats = fw_stats; |
| 6472 | return dp_fw_stats_process(vdev, req); |
| 6473 | } |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 6474 | |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6475 | if ((host_stats != TXRX_HOST_STATS_INVALID) && |
| 6476 | (host_stats <= TXRX_HOST_STATS_MAX)) |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 6477 | return dp_print_host_stats(vdev, host_stats); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6478 | else |
| 6479 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 6480 | "Wrong Input for TxRx Stats"); |
Venkata Sharath Chandra Manchala | a77da0d | 2017-02-27 22:44:37 -0800 | [diff] [blame] | 6481 | |
| 6482 | return 0; |
| 6483 | } |
| 6484 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6485 | /* |
psimha | 61b1a36 | 2017-07-27 15:45:49 -0700 | [diff] [blame] | 6486 | * dp_print_napi_stats(): NAPI stats |
| 6487 | * @soc - soc handle |
| 6488 | */ |
| 6489 | static void dp_print_napi_stats(struct dp_soc *soc) |
| 6490 | { |
| 6491 | hif_print_napi_stats(soc->hif_handle); |
| 6492 | } |
| 6493 | |
| 6494 | /* |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6495 | * dp_print_per_ring_stats(): Packet count per ring |
| 6496 | * @soc - soc handle |
| 6497 | */ |
| 6498 | static void dp_print_per_ring_stats(struct dp_soc *soc) |
| 6499 | { |
chenguo | 8107b66 | 2017-12-13 16:31:13 +0800 | [diff] [blame] | 6500 | uint8_t ring; |
| 6501 | uint16_t core; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6502 | uint64_t total_packets; |
| 6503 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6504 | DP_TRACE(FATAL, "Reo packets per ring:"); |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6505 | for (ring = 0; ring < MAX_REO_DEST_RINGS; ring++) { |
| 6506 | total_packets = 0; |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6507 | DP_TRACE(FATAL, "Packets on ring %u:", ring); |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6508 | for (core = 0; core < NR_CPUS; core++) { |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6509 | DP_TRACE(FATAL, "Packets arriving on core %u: %llu", |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6510 | core, soc->stats.rx.ring_packets[core][ring]); |
| 6511 | total_packets += soc->stats.rx.ring_packets[core][ring]; |
| 6512 | } |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6513 | DP_TRACE(FATAL, "Total packets on ring %u: %llu", |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6514 | ring, total_packets); |
| 6515 | } |
| 6516 | } |
| 6517 | |
| 6518 | /* |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6519 | * dp_txrx_path_stats() - Function to display dump stats |
| 6520 | * @soc - soc handle |
| 6521 | * |
| 6522 | * return: none |
| 6523 | */ |
| 6524 | static void dp_txrx_path_stats(struct dp_soc *soc) |
| 6525 | { |
| 6526 | uint8_t error_code; |
| 6527 | uint8_t loop_pdev; |
| 6528 | struct dp_pdev *pdev; |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6529 | uint8_t i; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6530 | |
| 6531 | for (loop_pdev = 0; loop_pdev < soc->pdev_count; loop_pdev++) { |
| 6532 | |
| 6533 | pdev = soc->pdev_list[loop_pdev]; |
| 6534 | dp_aggregate_pdev_stats(pdev); |
| 6535 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6536 | "Tx path Statistics:"); |
| 6537 | |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6538 | DP_TRACE(FATAL, "from stack: %u msdus (%llu bytes)", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6539 | pdev->stats.tx_i.rcvd.num, |
| 6540 | pdev->stats.tx_i.rcvd.bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6541 | DP_TRACE(FATAL, "processed from host: %u msdus (%llu bytes)", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6542 | pdev->stats.tx_i.processed.num, |
| 6543 | pdev->stats.tx_i.processed.bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6544 | DP_TRACE(FATAL, "successfully transmitted: %u msdus (%llu bytes)", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6545 | pdev->stats.tx.tx_success.num, |
| 6546 | pdev->stats.tx.tx_success.bytes); |
| 6547 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6548 | DP_TRACE(FATAL, "Dropped in host:"); |
| 6549 | DP_TRACE(FATAL, "Total packets dropped: %u,", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6550 | pdev->stats.tx_i.dropped.dropped_pkt.num); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6551 | DP_TRACE(FATAL, "Descriptor not available: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6552 | pdev->stats.tx_i.dropped.desc_na); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6553 | DP_TRACE(FATAL, "Ring full: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6554 | pdev->stats.tx_i.dropped.ring_full); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6555 | DP_TRACE(FATAL, "Enqueue fail: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6556 | pdev->stats.tx_i.dropped.enqueue_fail); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6557 | DP_TRACE(FATAL, "DMA Error: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6558 | pdev->stats.tx_i.dropped.dma_error); |
| 6559 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6560 | DP_TRACE(FATAL, "Dropped in hardware:"); |
| 6561 | DP_TRACE(FATAL, "total packets dropped: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6562 | pdev->stats.tx.tx_failed); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6563 | DP_TRACE(FATAL, "mpdu age out: %u", |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 6564 | pdev->stats.tx.dropped.age_out); |
| 6565 | DP_TRACE(FATAL, "firmware removed: %u", |
| 6566 | pdev->stats.tx.dropped.fw_rem); |
| 6567 | DP_TRACE(FATAL, "firmware removed tx: %u", |
| 6568 | pdev->stats.tx.dropped.fw_rem_tx); |
| 6569 | DP_TRACE(FATAL, "firmware removed notx %u", |
| 6570 | pdev->stats.tx.dropped.fw_rem_notx); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6571 | DP_TRACE(FATAL, "peer_invalid: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6572 | pdev->soc->stats.tx.tx_invalid_peer.num); |
| 6573 | |
| 6574 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6575 | DP_TRACE(FATAL, "Tx packets sent per interrupt:"); |
| 6576 | DP_TRACE(FATAL, "Single Packet: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6577 | pdev->stats.tx_comp_histogram.pkts_1); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6578 | DP_TRACE(FATAL, "2-20 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6579 | pdev->stats.tx_comp_histogram.pkts_2_20); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6580 | DP_TRACE(FATAL, "21-40 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6581 | pdev->stats.tx_comp_histogram.pkts_21_40); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6582 | DP_TRACE(FATAL, "41-60 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6583 | pdev->stats.tx_comp_histogram.pkts_41_60); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6584 | DP_TRACE(FATAL, "61-80 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6585 | pdev->stats.tx_comp_histogram.pkts_61_80); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6586 | DP_TRACE(FATAL, "81-100 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6587 | pdev->stats.tx_comp_histogram.pkts_81_100); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6588 | DP_TRACE(FATAL, "101-200 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6589 | pdev->stats.tx_comp_histogram.pkts_101_200); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6590 | DP_TRACE(FATAL, " 201+ Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6591 | pdev->stats.tx_comp_histogram.pkts_201_plus); |
| 6592 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6593 | DP_TRACE(FATAL, "Rx path statistics"); |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6594 | |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6595 | DP_TRACE(FATAL, "delivered %u msdus ( %llu bytes),", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6596 | pdev->stats.rx.to_stack.num, |
| 6597 | pdev->stats.rx.to_stack.bytes); |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6598 | for (i = 0; i < CDP_MAX_RX_RINGS; i++) |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6599 | DP_TRACE(FATAL, "received on reo[%d] %u msdus ( %llu bytes),", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6600 | i, pdev->stats.rx.rcvd_reo[i].num, |
| 6601 | pdev->stats.rx.rcvd_reo[i].bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6602 | DP_TRACE(FATAL, "intra-bss packets %u msdus ( %llu bytes),", |
Ishank Jain | 57c42a1 | 2017-04-12 10:42:22 +0530 | [diff] [blame] | 6603 | pdev->stats.rx.intra_bss.pkts.num, |
| 6604 | pdev->stats.rx.intra_bss.pkts.bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6605 | DP_TRACE(FATAL, "intra-bss fails %u msdus ( %llu bytes),", |
Yun Park | 92af713 | 2017-09-13 16:33:35 -0700 | [diff] [blame] | 6606 | pdev->stats.rx.intra_bss.fail.num, |
| 6607 | pdev->stats.rx.intra_bss.fail.bytes); |
Pamidipati, Vijay | 8e79865 | 2018-01-03 15:32:12 +0530 | [diff] [blame] | 6608 | DP_TRACE(FATAL, "raw packets %u msdus ( %llu bytes),", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6609 | pdev->stats.rx.raw.num, |
| 6610 | pdev->stats.rx.raw.bytes); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6611 | DP_TRACE(FATAL, "dropped: error %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6612 | pdev->stats.rx.err.mic_err); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6613 | DP_TRACE(FATAL, "peer invalid %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6614 | pdev->soc->stats.rx.err.rx_invalid_peer.num); |
| 6615 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6616 | DP_TRACE(FATAL, "Reo Statistics"); |
| 6617 | DP_TRACE(FATAL, "rbm error: %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6618 | pdev->soc->stats.rx.err.invalid_rbm); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6619 | DP_TRACE(FATAL, "hal ring access fail: %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6620 | pdev->soc->stats.rx.err.hal_ring_access_fail); |
| 6621 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6622 | DP_TRACE(FATAL, "Reo errors"); |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6623 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 6624 | for (error_code = 0; error_code < HAL_REO_ERR_MAX; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6625 | error_code++) { |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6626 | DP_TRACE(FATAL, "Reo error number (%u): %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6627 | error_code, |
| 6628 | pdev->soc->stats.rx.err.reo_error[error_code]); |
| 6629 | } |
| 6630 | |
Pamidipati, Vijay | 623fbee | 2017-07-07 10:58:15 +0530 | [diff] [blame] | 6631 | for (error_code = 0; error_code < HAL_RXDMA_ERR_MAX; |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6632 | error_code++) { |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6633 | DP_TRACE(FATAL, "Rxdma error number (%u): %u msdus", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6634 | error_code, |
| 6635 | pdev->soc->stats.rx.err |
| 6636 | .rxdma_error[error_code]); |
| 6637 | } |
| 6638 | |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6639 | DP_TRACE(FATAL, "Rx packets reaped per interrupt:"); |
| 6640 | DP_TRACE(FATAL, "Single Packet: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6641 | pdev->stats.rx_ind_histogram.pkts_1); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6642 | DP_TRACE(FATAL, "2-20 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6643 | pdev->stats.rx_ind_histogram.pkts_2_20); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6644 | DP_TRACE(FATAL, "21-40 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6645 | pdev->stats.rx_ind_histogram.pkts_21_40); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6646 | DP_TRACE(FATAL, "41-60 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6647 | pdev->stats.rx_ind_histogram.pkts_41_60); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6648 | DP_TRACE(FATAL, "61-80 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6649 | pdev->stats.rx_ind_histogram.pkts_61_80); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6650 | DP_TRACE(FATAL, "81-100 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6651 | pdev->stats.rx_ind_histogram.pkts_81_100); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6652 | DP_TRACE(FATAL, "101-200 Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6653 | pdev->stats.rx_ind_histogram.pkts_101_200); |
Adil Saeed Musthafa | 03e2ac2 | 2017-05-19 16:55:23 -0700 | [diff] [blame] | 6654 | DP_TRACE(FATAL, " 201+ Packets: %u", |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6655 | pdev->stats.rx_ind_histogram.pkts_201_plus); |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 6656 | |
| 6657 | DP_TRACE_STATS(ERROR, "%s: tso_enable: %u lro_enable: %u rx_hash: %u napi_enable: %u", |
| 6658 | __func__, |
| 6659 | pdev->soc->wlan_cfg_ctx->tso_enabled, |
| 6660 | pdev->soc->wlan_cfg_ctx->lro_enabled, |
| 6661 | pdev->soc->wlan_cfg_ctx->rx_hash, |
| 6662 | pdev->soc->wlan_cfg_ctx->napi_enabled); |
| 6663 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
| 6664 | DP_TRACE_STATS(ERROR, "%s: Tx flow stop queue: %u tx flow start queue offset: %u", |
| 6665 | __func__, |
| 6666 | pdev->soc->wlan_cfg_ctx->tx_flow_stop_queue_threshold, |
| 6667 | pdev->soc->wlan_cfg_ctx->tx_flow_start_queue_offset); |
| 6668 | #endif |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6669 | } |
| 6670 | } |
| 6671 | |
| 6672 | /* |
| 6673 | * dp_txrx_dump_stats() - Dump statistics |
| 6674 | * @value - Statistics option |
| 6675 | */ |
Mohit Khanna | 90d7ebd | 2017-09-12 21:54:21 -0700 | [diff] [blame] | 6676 | static QDF_STATUS dp_txrx_dump_stats(void *psoc, uint16_t value, |
| 6677 | enum qdf_stats_verbosity_level level) |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6678 | { |
| 6679 | struct dp_soc *soc = |
| 6680 | (struct dp_soc *)psoc; |
| 6681 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 6682 | |
| 6683 | if (!soc) { |
| 6684 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6685 | "%s: soc is NULL", __func__); |
| 6686 | return QDF_STATUS_E_INVAL; |
| 6687 | } |
| 6688 | |
| 6689 | switch (value) { |
| 6690 | case CDP_TXRX_PATH_STATS: |
| 6691 | dp_txrx_path_stats(soc); |
| 6692 | break; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6693 | |
| 6694 | case CDP_RX_RING_STATS: |
| 6695 | dp_print_per_ring_stats(soc); |
| 6696 | break; |
| 6697 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6698 | case CDP_TXRX_TSO_STATS: |
| 6699 | /* TODO: NOT IMPLEMENTED */ |
| 6700 | break; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6701 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6702 | case CDP_DUMP_TX_FLOW_POOL_INFO: |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 6703 | cdp_dump_flow_pool_info((struct cdp_soc_t *)soc); |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6704 | break; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6705 | |
psimha | 61b1a36 | 2017-07-27 15:45:49 -0700 | [diff] [blame] | 6706 | case CDP_DP_NAPI_STATS: |
| 6707 | dp_print_napi_stats(soc); |
| 6708 | break; |
| 6709 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6710 | case CDP_TXRX_DESC_STATS: |
| 6711 | /* TODO: NOT IMPLEMENTED */ |
| 6712 | break; |
Venkata Sharath Chandra Manchala | 918aefe | 2017-04-10 10:21:56 -0700 | [diff] [blame] | 6713 | |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 6714 | default: |
| 6715 | status = QDF_STATUS_E_INVAL; |
| 6716 | break; |
| 6717 | } |
| 6718 | |
| 6719 | return status; |
| 6720 | |
| 6721 | } |
| 6722 | |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 6723 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
| 6724 | /** |
| 6725 | * dp_update_flow_control_parameters() - API to store datapath |
| 6726 | * config parameters |
| 6727 | * @soc: soc handle |
| 6728 | * @cfg: ini parameter handle |
| 6729 | * |
| 6730 | * Return: void |
| 6731 | */ |
| 6732 | static inline |
| 6733 | void dp_update_flow_control_parameters(struct dp_soc *soc, |
| 6734 | struct cdp_config_params *params) |
| 6735 | { |
| 6736 | soc->wlan_cfg_ctx->tx_flow_stop_queue_threshold = |
| 6737 | params->tx_flow_stop_queue_threshold; |
| 6738 | soc->wlan_cfg_ctx->tx_flow_start_queue_offset = |
| 6739 | params->tx_flow_start_queue_offset; |
| 6740 | } |
| 6741 | #else |
| 6742 | static inline |
| 6743 | void dp_update_flow_control_parameters(struct dp_soc *soc, |
| 6744 | struct cdp_config_params *params) |
| 6745 | { |
| 6746 | } |
| 6747 | #endif |
| 6748 | |
| 6749 | /** |
| 6750 | * dp_update_config_parameters() - API to store datapath |
| 6751 | * config parameters |
| 6752 | * @soc: soc handle |
| 6753 | * @cfg: ini parameter handle |
| 6754 | * |
| 6755 | * Return: status |
| 6756 | */ |
| 6757 | static |
| 6758 | QDF_STATUS dp_update_config_parameters(struct cdp_soc *psoc, |
| 6759 | struct cdp_config_params *params) |
| 6760 | { |
| 6761 | struct dp_soc *soc = (struct dp_soc *)psoc; |
| 6762 | |
| 6763 | if (!(soc)) { |
| 6764 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 6765 | "%s: Invalid handle", __func__); |
| 6766 | return QDF_STATUS_E_INVAL; |
| 6767 | } |
| 6768 | |
| 6769 | soc->wlan_cfg_ctx->tso_enabled = params->tso_enable; |
| 6770 | soc->wlan_cfg_ctx->lro_enabled = params->lro_enable; |
| 6771 | soc->wlan_cfg_ctx->rx_hash = params->flow_steering_enable; |
| 6772 | soc->wlan_cfg_ctx->tcp_udp_checksumoffload = |
| 6773 | params->tcp_udp_checksumoffload; |
| 6774 | soc->wlan_cfg_ctx->napi_enabled = params->napi_enable; |
| 6775 | |
| 6776 | dp_update_flow_control_parameters(soc, params); |
| 6777 | |
| 6778 | return QDF_STATUS_SUCCESS; |
| 6779 | } |
| 6780 | |
Tallapragada Kalyan | 2a5fc62 | 2017-12-08 21:07:43 +0530 | [diff] [blame] | 6781 | /** |
| 6782 | * dp_txrx_set_wds_rx_policy() - API to store datapath |
| 6783 | * config parameters |
| 6784 | * @vdev_handle - datapath vdev handle |
| 6785 | * @cfg: ini parameter handle |
| 6786 | * |
| 6787 | * Return: status |
| 6788 | */ |
| 6789 | #ifdef WDS_VENDOR_EXTENSION |
| 6790 | void |
| 6791 | dp_txrx_set_wds_rx_policy( |
| 6792 | struct cdp_vdev *vdev_handle, |
| 6793 | u_int32_t val) |
| 6794 | { |
| 6795 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 6796 | struct dp_peer *peer; |
| 6797 | if (vdev->opmode == wlan_op_mode_ap) { |
| 6798 | /* for ap, set it on bss_peer */ |
| 6799 | TAILQ_FOREACH(peer, &vdev->peer_list, peer_list_elem) { |
| 6800 | if (peer->bss_peer) { |
| 6801 | peer->wds_ecm.wds_rx_filter = 1; |
| 6802 | peer->wds_ecm.wds_rx_ucast_4addr = (val & WDS_POLICY_RX_UCAST_4ADDR) ? 1:0; |
| 6803 | peer->wds_ecm.wds_rx_mcast_4addr = (val & WDS_POLICY_RX_MCAST_4ADDR) ? 1:0; |
| 6804 | break; |
| 6805 | } |
| 6806 | } |
| 6807 | } else if (vdev->opmode == wlan_op_mode_sta) { |
| 6808 | peer = TAILQ_FIRST(&vdev->peer_list); |
| 6809 | peer->wds_ecm.wds_rx_filter = 1; |
| 6810 | peer->wds_ecm.wds_rx_ucast_4addr = (val & WDS_POLICY_RX_UCAST_4ADDR) ? 1:0; |
| 6811 | peer->wds_ecm.wds_rx_mcast_4addr = (val & WDS_POLICY_RX_MCAST_4ADDR) ? 1:0; |
| 6812 | } |
| 6813 | } |
| 6814 | |
| 6815 | /** |
| 6816 | * dp_txrx_peer_wds_tx_policy_update() - API to set tx wds policy |
| 6817 | * |
| 6818 | * @peer_handle - datapath peer handle |
| 6819 | * @wds_tx_ucast: policy for unicast transmission |
| 6820 | * @wds_tx_mcast: policy for multicast transmission |
| 6821 | * |
| 6822 | * Return: void |
| 6823 | */ |
| 6824 | void |
| 6825 | dp_txrx_peer_wds_tx_policy_update(struct cdp_peer *peer_handle, |
| 6826 | int wds_tx_ucast, int wds_tx_mcast) |
| 6827 | { |
| 6828 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 6829 | if (wds_tx_ucast || wds_tx_mcast) { |
| 6830 | peer->wds_enabled = 1; |
| 6831 | peer->wds_ecm.wds_tx_ucast_4addr = wds_tx_ucast; |
| 6832 | peer->wds_ecm.wds_tx_mcast_4addr = wds_tx_mcast; |
| 6833 | } else { |
| 6834 | peer->wds_enabled = 0; |
| 6835 | peer->wds_ecm.wds_tx_ucast_4addr = 0; |
| 6836 | peer->wds_ecm.wds_tx_mcast_4addr = 0; |
| 6837 | } |
| 6838 | |
| 6839 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 6840 | FL("Policy Update set to :\ |
| 6841 | peer->wds_enabled %d\ |
| 6842 | peer->wds_ecm.wds_tx_ucast_4addr %d\ |
| 6843 | peer->wds_ecm.wds_tx_mcast_4addr %d\n"), |
| 6844 | peer->wds_enabled, peer->wds_ecm.wds_tx_ucast_4addr, |
| 6845 | peer->wds_ecm.wds_tx_mcast_4addr); |
| 6846 | return; |
| 6847 | } |
| 6848 | #endif |
| 6849 | |
Karunakar Dasineni | ca79254 | 2017-01-16 10:08:58 -0800 | [diff] [blame] | 6850 | static struct cdp_wds_ops dp_ops_wds = { |
| 6851 | .vdev_set_wds = dp_vdev_set_wds, |
Tallapragada Kalyan | 2a5fc62 | 2017-12-08 21:07:43 +0530 | [diff] [blame] | 6852 | #ifdef WDS_VENDOR_EXTENSION |
| 6853 | .txrx_set_wds_rx_policy = dp_txrx_set_wds_rx_policy, |
| 6854 | .txrx_wds_peer_tx_policy_update = dp_txrx_peer_wds_tx_policy_update, |
| 6855 | #endif |
Karunakar Dasineni | ca79254 | 2017-01-16 10:08:58 -0800 | [diff] [blame] | 6856 | }; |
| 6857 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6858 | /* |
Kabilan Kannan | 60e3b30 | 2017-09-07 20:06:17 -0700 | [diff] [blame] | 6859 | * dp_txrx_data_tx_cb_set(): set the callback for non standard tx |
| 6860 | * @vdev_handle - datapath vdev handle |
| 6861 | * @callback - callback function |
| 6862 | * @ctxt: callback context |
| 6863 | * |
| 6864 | */ |
| 6865 | static void |
| 6866 | dp_txrx_data_tx_cb_set(struct cdp_vdev *vdev_handle, |
| 6867 | ol_txrx_data_tx_cb callback, void *ctxt) |
| 6868 | { |
| 6869 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 6870 | |
| 6871 | vdev->tx_non_std_data_callback.func = callback; |
| 6872 | vdev->tx_non_std_data_callback.ctxt = ctxt; |
| 6873 | } |
| 6874 | |
Santosh Anbu | 2280e86 | 2018-01-03 22:25:53 +0530 | [diff] [blame] | 6875 | /** |
| 6876 | * dp_pdev_get_dp_txrx_handle() - get dp handle from pdev |
| 6877 | * @pdev_hdl: datapath pdev handle |
| 6878 | * |
| 6879 | * Return: opaque pointer to dp txrx handle |
| 6880 | */ |
| 6881 | static void *dp_pdev_get_dp_txrx_handle(struct cdp_pdev *pdev_hdl) |
| 6882 | { |
| 6883 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_hdl; |
| 6884 | |
| 6885 | return pdev->dp_txrx_handle; |
| 6886 | } |
| 6887 | |
| 6888 | /** |
| 6889 | * dp_pdev_set_dp_txrx_handle() - set dp handle in pdev |
| 6890 | * @pdev_hdl: datapath pdev handle |
| 6891 | * @dp_txrx_hdl: opaque pointer for dp_txrx_handle |
| 6892 | * |
| 6893 | * Return: void |
| 6894 | */ |
| 6895 | static void |
| 6896 | dp_pdev_set_dp_txrx_handle(struct cdp_pdev *pdev_hdl, void *dp_txrx_hdl) |
| 6897 | { |
| 6898 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_hdl; |
| 6899 | |
| 6900 | pdev->dp_txrx_handle = dp_txrx_hdl; |
| 6901 | } |
| 6902 | |
Pamidipati, Vijay | d3478ef | 2018-02-06 23:52:29 +0530 | [diff] [blame] | 6903 | /** |
| 6904 | * dp_soc_get_dp_txrx_handle() - get context for external-dp from dp soc |
| 6905 | * @soc_handle: datapath soc handle |
| 6906 | * |
| 6907 | * Return: opaque pointer to external dp (non-core DP) |
| 6908 | */ |
| 6909 | static void *dp_soc_get_dp_txrx_handle(struct cdp_soc *soc_handle) |
| 6910 | { |
| 6911 | struct dp_soc *soc = (struct dp_soc *)soc_handle; |
| 6912 | |
| 6913 | return soc->external_txrx_handle; |
| 6914 | } |
| 6915 | |
| 6916 | /** |
| 6917 | * dp_soc_set_dp_txrx_handle() - set external dp handle in soc |
| 6918 | * @soc_handle: datapath soc handle |
| 6919 | * @txrx_handle: opaque pointer to external dp (non-core DP) |
| 6920 | * |
| 6921 | * Return: void |
| 6922 | */ |
| 6923 | static void |
| 6924 | dp_soc_set_dp_txrx_handle(struct cdp_soc *soc_handle, void *txrx_handle) |
| 6925 | { |
| 6926 | struct dp_soc *soc = (struct dp_soc *)soc_handle; |
| 6927 | |
| 6928 | soc->external_txrx_handle = txrx_handle; |
| 6929 | } |
| 6930 | |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 6931 | #ifdef FEATURE_AST |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6932 | static void dp_peer_teardown_wifi3(struct cdp_vdev *vdev_hdl, void *peer_hdl) |
| 6933 | { |
| 6934 | struct dp_vdev *vdev = (struct dp_vdev *) vdev_hdl; |
| 6935 | struct dp_peer *peer = (struct dp_peer *) peer_hdl; |
| 6936 | struct dp_soc *soc = (struct dp_soc *) vdev->pdev->soc; |
| 6937 | |
Aditya Sathish | 6add3db | 2018-04-10 19:43:34 +0530 | [diff] [blame] | 6938 | /* |
| 6939 | * For BSS peer, new peer is not created on alloc_node if the |
| 6940 | * peer with same address already exists , instead refcnt is |
| 6941 | * increased for existing peer. Correspondingly in delete path, |
| 6942 | * only refcnt is decreased; and peer is only deleted , when all |
| 6943 | * references are deleted. So delete_in_progress should not be set |
| 6944 | * for bss_peer, unless only 2 reference remains (peer map reference |
| 6945 | * and peer hash table reference). |
| 6946 | */ |
| 6947 | if (peer->bss_peer && (qdf_atomic_read(&peer->ref_cnt) > 2)) { |
| 6948 | return; |
| 6949 | } |
| 6950 | |
Karunakar Dasineni | 372647d | 2018-01-15 22:27:39 -0800 | [diff] [blame] | 6951 | peer->delete_in_progress = true; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 6952 | dp_peer_delete_ast_entries(soc, peer); |
| 6953 | } |
| 6954 | #endif |
| 6955 | |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 6956 | #ifdef ATH_SUPPORT_NAC_RSSI |
| 6957 | static QDF_STATUS dp_config_for_nac_rssi(struct cdp_vdev *vdev_handle, |
| 6958 | enum cdp_nac_param_cmd cmd, char *bssid, char *client_macaddr, |
| 6959 | uint8_t chan_num) |
| 6960 | { |
| 6961 | |
| 6962 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 6963 | struct dp_pdev *pdev = (struct dp_pdev *)vdev->pdev; |
| 6964 | struct dp_soc *soc = (struct dp_soc *) vdev->pdev->soc; |
| 6965 | |
| 6966 | pdev->nac_rssi_filtering = 1; |
| 6967 | /* Store address of NAC (neighbour peer) which will be checked |
| 6968 | * against TA of received packets. |
| 6969 | */ |
| 6970 | |
| 6971 | if (cmd == CDP_NAC_PARAM_ADD) { |
| 6972 | qdf_mem_copy(vdev->cdp_nac_rssi.client_mac, |
| 6973 | client_macaddr, DP_MAC_ADDR_LEN); |
| 6974 | vdev->cdp_nac_rssi_enabled = 1; |
| 6975 | } else if (cmd == CDP_NAC_PARAM_DEL) { |
| 6976 | if (!qdf_mem_cmp(vdev->cdp_nac_rssi.client_mac, |
| 6977 | client_macaddr, DP_MAC_ADDR_LEN)) { |
| 6978 | /* delete this peer from the list */ |
| 6979 | qdf_mem_zero(vdev->cdp_nac_rssi.client_mac, |
| 6980 | DP_MAC_ADDR_LEN); |
| 6981 | } |
| 6982 | vdev->cdp_nac_rssi_enabled = 0; |
| 6983 | } |
| 6984 | |
| 6985 | if (soc->cdp_soc.ol_ops->config_bssid_in_fw_for_nac_rssi) |
| 6986 | soc->cdp_soc.ol_ops->config_bssid_in_fw_for_nac_rssi |
Akshay Kosigi | 1a9c6d1 | 2018-04-26 00:54:23 +0530 | [diff] [blame^] | 6987 | ((void *)vdev->pdev->ctrl_pdev, |
| 6988 | vdev->vdev_id, cmd, bssid); |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 6989 | |
| 6990 | return QDF_STATUS_SUCCESS; |
| 6991 | } |
| 6992 | #endif |
| 6993 | |
Chaithanya Garrepalli | 2f57279 | 2018-04-11 17:49:28 +0530 | [diff] [blame] | 6994 | static QDF_STATUS dp_peer_map_attach_wifi3(struct cdp_soc_t *soc_hdl, |
| 6995 | uint32_t max_peers) |
| 6996 | { |
| 6997 | struct dp_soc *soc = (struct dp_soc *)soc_hdl; |
| 6998 | |
| 6999 | soc->max_peers = max_peers; |
| 7000 | |
| 7001 | qdf_print ("%s max_peers %u\n", __func__, max_peers); |
| 7002 | |
| 7003 | if (dp_peer_find_attach(soc)) |
| 7004 | return QDF_STATUS_E_FAILURE; |
| 7005 | |
| 7006 | return QDF_STATUS_SUCCESS; |
| 7007 | } |
| 7008 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7009 | static struct cdp_cmn_ops dp_ops_cmn = { |
| 7010 | .txrx_soc_attach_target = dp_soc_attach_target_wifi3, |
| 7011 | .txrx_vdev_attach = dp_vdev_attach_wifi3, |
| 7012 | .txrx_vdev_detach = dp_vdev_detach_wifi3, |
| 7013 | .txrx_pdev_attach = dp_pdev_attach_wifi3, |
| 7014 | .txrx_pdev_detach = dp_pdev_detach_wifi3, |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 7015 | .txrx_peer_create = dp_peer_create_wifi3, |
| 7016 | .txrx_peer_setup = dp_peer_setup_wifi3, |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 7017 | #ifdef FEATURE_AST |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 7018 | .txrx_peer_teardown = dp_peer_teardown_wifi3, |
| 7019 | #else |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 7020 | .txrx_peer_teardown = NULL, |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 7021 | #endif |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 7022 | .txrx_peer_add_ast = dp_peer_add_ast_wifi3, |
| 7023 | .txrx_peer_del_ast = dp_peer_del_ast_wifi3, |
| 7024 | .txrx_peer_update_ast = dp_peer_update_ast_wifi3, |
| 7025 | .txrx_peer_ast_hash_find = dp_peer_ast_hash_find_wifi3, |
| 7026 | .txrx_peer_ast_get_pdev_id = dp_peer_ast_get_pdev_id_wifi3, |
| 7027 | .txrx_peer_ast_get_next_hop = dp_peer_ast_get_next_hop_wifi3, |
| 7028 | .txrx_peer_ast_set_type = dp_peer_ast_set_type_wifi3, |
Dhanashri Atre | 6d90ef3 | 2016-11-10 16:27:38 -0800 | [diff] [blame] | 7029 | .txrx_peer_delete = dp_peer_delete_wifi3, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7030 | .txrx_vdev_register = dp_vdev_register_wifi3, |
| 7031 | .txrx_soc_detach = dp_soc_detach_wifi3, |
| 7032 | .txrx_get_vdev_mac_addr = dp_get_vdev_mac_addr_wifi3, |
| 7033 | .txrx_get_vdev_from_vdev_id = dp_get_vdev_from_vdev_id_wifi3, |
| 7034 | .txrx_get_ctrl_pdev_from_vdev = dp_get_ctrl_pdev_from_vdev_wifi3, |
Chaithanya Garrepalli | 2faa46f | 2018-04-09 12:34:20 +0530 | [diff] [blame] | 7035 | .txrx_ath_getstats = dp_get_device_stats, |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 7036 | .addba_requestprocess = dp_addba_requestprocess_wifi3, |
| 7037 | .addba_responsesetup = dp_addba_responsesetup_wifi3, |
| 7038 | .delba_process = dp_delba_process_wifi3, |
Gyanranjan Hazarika | 99a58d3 | 2017-12-22 21:56:17 -0800 | [diff] [blame] | 7039 | .set_addba_response = dp_set_addba_response, |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 7040 | .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] | 7041 | .flush_cache_rx_queue = NULL, |
Ishank Jain | 949674c | 2017-02-27 17:09:29 +0530 | [diff] [blame] | 7042 | /* TODO: get API's for dscp-tid need to be added*/ |
| 7043 | .set_vdev_dscp_tid_map = dp_set_vdev_dscp_tid_map_wifi3, |
| 7044 | .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] | 7045 | .txrx_stats_request = dp_txrx_stats_request, |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 7046 | .txrx_set_monitor_mode = dp_vdev_set_monitor_mode, |
phadiman | 7821bf8 | 2018-02-06 16:03:54 +0530 | [diff] [blame] | 7047 | .txrx_get_pdev_id_frm_pdev = dp_get_pdev_id_frm_pdev, |
| 7048 | .txrx_set_nac = dp_set_nac, |
| 7049 | .txrx_get_tx_pending = dp_get_tx_pending, |
| 7050 | .txrx_set_pdev_tx_capture = dp_config_debug_sniffer, |
| 7051 | .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] | 7052 | .display_stats = dp_txrx_dump_stats, |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 7053 | .txrx_soc_set_nss_cfg = dp_soc_set_nss_cfg_wifi3, |
| 7054 | .txrx_soc_get_nss_cfg = dp_soc_get_nss_cfg_wifi3, |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 7055 | #ifdef DP_INTR_POLL_BASED |
| 7056 | .txrx_intr_attach = dp_soc_interrupt_attach_wrapper, |
| 7057 | #else |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 7058 | .txrx_intr_attach = dp_soc_interrupt_attach, |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 7059 | #endif |
Venkateswara Swamy Bandaru | a95b324 | 2017-05-19 20:20:30 +0530 | [diff] [blame] | 7060 | .txrx_intr_detach = dp_soc_interrupt_detach, |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 7061 | .set_pn_check = dp_set_pn_check_wifi3, |
Venkata Sharath Chandra Manchala | 3e8add8 | 2017-07-10 11:59:54 -0700 | [diff] [blame] | 7062 | .update_config_parameters = dp_update_config_parameters, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7063 | /* TODO: Add other functions */ |
Santosh Anbu | 2280e86 | 2018-01-03 22:25:53 +0530 | [diff] [blame] | 7064 | .txrx_data_tx_cb_set = dp_txrx_data_tx_cb_set, |
| 7065 | .get_dp_txrx_handle = dp_pdev_get_dp_txrx_handle, |
| 7066 | .set_dp_txrx_handle = dp_pdev_set_dp_txrx_handle, |
Pamidipati, Vijay | d3478ef | 2018-02-06 23:52:29 +0530 | [diff] [blame] | 7067 | .get_soc_dp_txrx_handle = dp_soc_get_dp_txrx_handle, |
| 7068 | .set_soc_dp_txrx_handle = dp_soc_set_dp_txrx_handle, |
| 7069 | .tx_send = dp_tx_send, |
Ruchi, Agrawal | 89219d9 | 2018-02-26 16:43:06 +0530 | [diff] [blame] | 7070 | .txrx_peer_reset_ast = dp_wds_reset_ast_wifi3, |
| 7071 | .txrx_peer_reset_ast_table = dp_wds_reset_ast_table_wifi3, |
| 7072 | .txrx_peer_flush_ast_table = dp_wds_flush_ast_table_wifi3, |
Chaithanya Garrepalli | 2f57279 | 2018-04-11 17:49:28 +0530 | [diff] [blame] | 7073 | .txrx_peer_map_attach = dp_peer_map_attach_wifi3, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7074 | }; |
| 7075 | |
| 7076 | static struct cdp_ctrl_ops dp_ops_ctrl = { |
| 7077 | .txrx_peer_authorize = dp_peer_authorize, |
Stephan Raj Ignatious Durairaj | ba29129 | 2018-01-04 13:36:34 +0530 | [diff] [blame] | 7078 | #ifdef QCA_SUPPORT_SON |
| 7079 | .txrx_set_inact_params = dp_set_inact_params, |
| 7080 | .txrx_start_inact_timer = dp_start_inact_timer, |
| 7081 | .txrx_set_overload = dp_set_overload, |
| 7082 | .txrx_peer_is_inact = dp_peer_is_inact, |
| 7083 | .txrx_mark_peer_inact = dp_mark_peer_inact, |
| 7084 | #endif |
Kalyan Tallapragada | 277f45e | 2017-01-30 14:25:27 +0530 | [diff] [blame] | 7085 | .txrx_set_vdev_rx_decap_type = dp_set_vdev_rx_decap_type, |
| 7086 | .txrx_set_tx_encap_type = dp_set_vdev_tx_encap_type, |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 7087 | #ifdef MESH_MODE_SUPPORT |
| 7088 | .txrx_set_mesh_mode = dp_peer_set_mesh_mode, |
Venkateswara Swamy Bandaru | ec4f8e6 | 2017-03-07 11:04:28 +0530 | [diff] [blame] | 7089 | .txrx_set_mesh_rx_filter = dp_peer_set_mesh_rx_filter, |
Venkateswara Swamy Bandaru | 3f62370 | 2017-02-25 00:12:59 +0530 | [diff] [blame] | 7090 | #endif |
Ishank Jain | 9f174c6 | 2017-03-30 18:37:42 +0530 | [diff] [blame] | 7091 | .txrx_set_vdev_param = dp_set_vdev_param, |
| 7092 | .txrx_peer_set_nawds = dp_peer_set_nawds, |
Tallapragada Kalyan | fd1edcc | 2017-03-07 19:34:29 +0530 | [diff] [blame] | 7093 | .txrx_set_pdev_reo_dest = dp_set_pdev_reo_dest, |
| 7094 | .txrx_get_pdev_reo_dest = dp_get_pdev_reo_dest, |
Pratik Gandhi | 8b8334b | 2017-03-09 17:41:40 +0530 | [diff] [blame] | 7095 | .txrx_set_filter_neighbour_peers = dp_set_filter_neighbour_peers, |
| 7096 | .txrx_update_filter_neighbour_peers = |
| 7097 | dp_update_filter_neighbour_peers, |
Chaitanya Kiran Godavarthi | 6228e3b | 2017-06-15 14:28:19 +0530 | [diff] [blame] | 7098 | .txrx_get_sec_type = dp_get_sec_type, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7099 | /* TODO: Add other functions */ |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7100 | .txrx_wdi_event_sub = dp_wdi_event_sub, |
| 7101 | .txrx_wdi_event_unsub = dp_wdi_event_unsub, |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7102 | #ifdef WDI_EVENT_ENABLE |
| 7103 | .txrx_get_pldev = dp_get_pldev, |
| 7104 | #endif |
Soumya Bhat | cfbb895 | 2017-10-03 15:04:09 +0530 | [diff] [blame] | 7105 | .txrx_set_pdev_param = dp_set_pdev_param, |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 7106 | #ifdef ATH_SUPPORT_NAC_RSSI |
| 7107 | .txrx_vdev_config_for_nac_rssi = dp_config_for_nac_rssi, |
| 7108 | #endif |
Pramod Simha | 6e10cb2 | 2018-06-20 12:05:44 -0700 | [diff] [blame] | 7109 | .set_key = dp_set_michael_key, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7110 | }; |
| 7111 | |
| 7112 | static struct cdp_me_ops dp_ops_me = { |
Ishank Jain | c838b13 | 2017-02-17 11:08:18 +0530 | [diff] [blame] | 7113 | #ifdef ATH_SUPPORT_IQUE |
| 7114 | .tx_me_alloc_descriptor = dp_tx_me_alloc_descriptor, |
| 7115 | .tx_me_free_descriptor = dp_tx_me_free_descriptor, |
| 7116 | .tx_me_convert_ucast = dp_tx_me_send_convert_ucast, |
| 7117 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7118 | }; |
| 7119 | |
| 7120 | static struct cdp_mon_ops dp_ops_mon = { |
Kai Chen | 6eca1a6 | 2017-01-12 10:17:53 -0800 | [diff] [blame] | 7121 | .txrx_monitor_set_filter_ucast_data = NULL, |
| 7122 | .txrx_monitor_set_filter_mcast_data = NULL, |
| 7123 | .txrx_monitor_set_filter_non_data = NULL, |
nobelj | c8eb4d6 | 2018-01-04 14:29:32 -0800 | [diff] [blame] | 7124 | .txrx_monitor_get_filter_ucast_data = dp_vdev_get_filter_ucast_data, |
| 7125 | .txrx_monitor_get_filter_mcast_data = dp_vdev_get_filter_mcast_data, |
| 7126 | .txrx_monitor_get_filter_non_data = dp_vdev_get_filter_non_data, |
sumedh baikady | 84613b0 | 2017-09-19 16:36:14 -0700 | [diff] [blame] | 7127 | .txrx_reset_monitor_mode = dp_reset_monitor_mode, |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 7128 | /* Added support for HK advance filter */ |
| 7129 | .txrx_set_advance_monitor_filter = dp_pdev_set_advance_monitor_filter, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7130 | }; |
| 7131 | |
| 7132 | static struct cdp_host_stats_ops dp_ops_host_stats = { |
Ishank Jain | 6290a3c | 2017-03-21 10:49:39 +0530 | [diff] [blame] | 7133 | .txrx_per_peer_stats = dp_get_host_peer_stats, |
| 7134 | .get_fw_peer_stats = dp_get_fw_peer_stats, |
Chaithanya Garrepalli | 30927c5 | 2017-11-22 14:31:47 +0530 | [diff] [blame] | 7135 | .get_htt_stats = dp_get_htt_stats, |
Pamidipati, Vijay | be37945 | 2017-06-21 00:31:06 +0530 | [diff] [blame] | 7136 | .txrx_enable_enhanced_stats = dp_enable_enhanced_stats, |
| 7137 | .txrx_disable_enhanced_stats = dp_disable_enhanced_stats, |
Prathyusha Guduri | 184b640 | 2018-02-04 23:01:49 +0530 | [diff] [blame] | 7138 | .txrx_stats_publish = dp_txrx_stats_publish, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7139 | /* TODO */ |
| 7140 | }; |
| 7141 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7142 | static struct cdp_raw_ops dp_ops_raw = { |
| 7143 | /* TODO */ |
| 7144 | }; |
| 7145 | |
| 7146 | #ifdef CONFIG_WIN |
| 7147 | static struct cdp_pflow_ops dp_ops_pflow = { |
| 7148 | /* TODO */ |
| 7149 | }; |
| 7150 | #endif /* CONFIG_WIN */ |
| 7151 | |
Yue Ma | 245b47b | 2017-02-21 16:35:31 -0800 | [diff] [blame] | 7152 | #ifdef FEATURE_RUNTIME_PM |
| 7153 | /** |
| 7154 | * dp_runtime_suspend() - ensure DP is ready to runtime suspend |
| 7155 | * @opaque_pdev: DP pdev context |
| 7156 | * |
| 7157 | * DP is ready to runtime suspend if there are no pending TX packets. |
| 7158 | * |
| 7159 | * Return: QDF_STATUS |
| 7160 | */ |
| 7161 | static QDF_STATUS dp_runtime_suspend(struct cdp_pdev *opaque_pdev) |
| 7162 | { |
| 7163 | struct dp_pdev *pdev = (struct dp_pdev *)opaque_pdev; |
| 7164 | struct dp_soc *soc = pdev->soc; |
| 7165 | |
| 7166 | /* Call DP TX flow control API to check if there is any |
| 7167 | pending packets */ |
| 7168 | |
| 7169 | if (soc->intr_mode == DP_INTR_POLL) |
| 7170 | qdf_timer_stop(&soc->int_timer); |
| 7171 | |
| 7172 | return QDF_STATUS_SUCCESS; |
| 7173 | } |
| 7174 | |
| 7175 | /** |
| 7176 | * dp_runtime_resume() - ensure DP is ready to runtime resume |
| 7177 | * @opaque_pdev: DP pdev context |
| 7178 | * |
| 7179 | * Resume DP for runtime PM. |
| 7180 | * |
| 7181 | * Return: QDF_STATUS |
| 7182 | */ |
| 7183 | static QDF_STATUS dp_runtime_resume(struct cdp_pdev *opaque_pdev) |
| 7184 | { |
| 7185 | struct dp_pdev *pdev = (struct dp_pdev *)opaque_pdev; |
| 7186 | struct dp_soc *soc = pdev->soc; |
| 7187 | void *hal_srng; |
| 7188 | int i; |
| 7189 | |
| 7190 | if (soc->intr_mode == DP_INTR_POLL) |
| 7191 | qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); |
| 7192 | |
| 7193 | for (i = 0; i < MAX_TCL_DATA_RINGS; i++) { |
| 7194 | hal_srng = soc->tcl_data_ring[i].hal_srng; |
| 7195 | if (hal_srng) { |
| 7196 | /* We actually only need to acquire the lock */ |
| 7197 | hal_srng_access_start(soc->hal_soc, hal_srng); |
| 7198 | /* Update SRC ring head pointer for HW to send |
| 7199 | all pending packets */ |
| 7200 | hal_srng_access_end(soc->hal_soc, hal_srng); |
| 7201 | } |
| 7202 | } |
| 7203 | |
| 7204 | return QDF_STATUS_SUCCESS; |
| 7205 | } |
| 7206 | #endif /* FEATURE_RUNTIME_PM */ |
| 7207 | |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 7208 | static QDF_STATUS dp_bus_suspend(struct cdp_pdev *opaque_pdev) |
| 7209 | { |
| 7210 | struct dp_pdev *pdev = (struct dp_pdev *)opaque_pdev; |
| 7211 | struct dp_soc *soc = pdev->soc; |
| 7212 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 7213 | if (soc->intr_mode == DP_INTR_POLL) |
| 7214 | qdf_timer_stop(&soc->int_timer); |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 7215 | |
| 7216 | return QDF_STATUS_SUCCESS; |
| 7217 | } |
| 7218 | |
| 7219 | static QDF_STATUS dp_bus_resume(struct cdp_pdev *opaque_pdev) |
| 7220 | { |
| 7221 | struct dp_pdev *pdev = (struct dp_pdev *)opaque_pdev; |
| 7222 | struct dp_soc *soc = pdev->soc; |
| 7223 | |
psimha | c983d7e | 2017-07-26 15:20:07 -0700 | [diff] [blame] | 7224 | if (soc->intr_mode == DP_INTR_POLL) |
| 7225 | qdf_timer_mod(&soc->int_timer, DP_INTR_POLL_TIMER_MS); |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 7226 | |
| 7227 | return QDF_STATUS_SUCCESS; |
| 7228 | } |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 7229 | |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 7230 | #ifndef CONFIG_WIN |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7231 | static struct cdp_misc_ops dp_ops_misc = { |
Kabilan Kannan | 60e3b30 | 2017-09-07 20:06:17 -0700 | [diff] [blame] | 7232 | .tx_non_std = dp_tx_non_std, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7233 | .get_opmode = dp_get_opmode, |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 7234 | #ifdef FEATURE_RUNTIME_PM |
Yue Ma | 245b47b | 2017-02-21 16:35:31 -0800 | [diff] [blame] | 7235 | .runtime_suspend = dp_runtime_suspend, |
| 7236 | .runtime_resume = dp_runtime_resume, |
| 7237 | #endif /* FEATURE_RUNTIME_PM */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7238 | .pkt_log_init = dp_pkt_log_init, |
| 7239 | .pkt_log_con_service = dp_pkt_log_con_service, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7240 | }; |
| 7241 | |
| 7242 | static struct cdp_flowctl_ops dp_ops_flowctl = { |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 7243 | /* WIFI 3.0 DP implement as required. */ |
| 7244 | #ifdef QCA_LL_TX_FLOW_CONTROL_V2 |
Manjunathappa Prakash | 38205cc | 2018-03-06 14:22:44 -0800 | [diff] [blame] | 7245 | .flow_pool_map_handler = dp_tx_flow_pool_map, |
| 7246 | .flow_pool_unmap_handler = dp_tx_flow_pool_unmap, |
Manjunathappa Prakash | ced7ea6 | 2017-07-02 03:02:15 -0700 | [diff] [blame] | 7247 | .register_pause_cb = dp_txrx_register_pause_cb, |
| 7248 | .dump_flow_pool_info = dp_tx_dump_flow_pool_info, |
| 7249 | #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7250 | }; |
| 7251 | |
| 7252 | static struct cdp_lflowctl_ops dp_ops_l_flowctl = { |
| 7253 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
| 7254 | }; |
| 7255 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 7256 | #ifdef IPA_OFFLOAD |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7257 | static struct cdp_ipa_ops dp_ops_ipa = { |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 7258 | .ipa_get_resource = dp_ipa_get_resource, |
| 7259 | .ipa_set_doorbell_paddr = dp_ipa_set_doorbell_paddr, |
| 7260 | .ipa_op_response = dp_ipa_op_response, |
| 7261 | .ipa_register_op_cb = dp_ipa_register_op_cb, |
| 7262 | .ipa_get_stat = dp_ipa_get_stat, |
| 7263 | .ipa_tx_data_frame = dp_tx_send_ipa_data_frame, |
| 7264 | .ipa_enable_autonomy = dp_ipa_enable_autonomy, |
| 7265 | .ipa_disable_autonomy = dp_ipa_disable_autonomy, |
| 7266 | .ipa_setup = dp_ipa_setup, |
| 7267 | .ipa_cleanup = dp_ipa_cleanup, |
| 7268 | .ipa_setup_iface = dp_ipa_setup_iface, |
| 7269 | .ipa_cleanup_iface = dp_ipa_cleanup_iface, |
| 7270 | .ipa_enable_pipes = dp_ipa_enable_pipes, |
| 7271 | .ipa_disable_pipes = dp_ipa_disable_pipes, |
| 7272 | .ipa_set_perf_level = dp_ipa_set_perf_level |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7273 | }; |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 7274 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7275 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7276 | static struct cdp_bus_ops dp_ops_bus = { |
Dustin Brown | 4a3b96b | 2017-05-10 15:49:38 -0700 | [diff] [blame] | 7277 | .bus_suspend = dp_bus_suspend, |
| 7278 | .bus_resume = dp_bus_resume |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7279 | }; |
| 7280 | |
| 7281 | static struct cdp_ocb_ops dp_ops_ocb = { |
| 7282 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
| 7283 | }; |
| 7284 | |
| 7285 | |
| 7286 | static struct cdp_throttle_ops dp_ops_throttle = { |
| 7287 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
| 7288 | }; |
| 7289 | |
| 7290 | static struct cdp_mob_stats_ops dp_ops_mob_stats = { |
Venkata Sharath Chandra Manchala | a405eb7 | 2017-03-06 14:35:00 -0800 | [diff] [blame] | 7291 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7292 | }; |
| 7293 | |
| 7294 | static struct cdp_cfg_ops dp_ops_cfg = { |
| 7295 | /* WIFI 3.0 DP NOT IMPLEMENTED YET */ |
| 7296 | }; |
| 7297 | |
Mohit Khanna | adfe908 | 2017-11-17 13:11:17 -0800 | [diff] [blame] | 7298 | /* |
| 7299 | * dp_wrapper_peer_get_ref_by_addr - wrapper function to get to peer |
| 7300 | * @dev: physical device instance |
| 7301 | * @peer_mac_addr: peer mac address |
| 7302 | * @local_id: local id for the peer |
| 7303 | * @debug_id: to track enum peer access |
| 7304 | |
| 7305 | * Return: peer instance pointer |
| 7306 | */ |
| 7307 | static inline void * |
| 7308 | dp_wrapper_peer_get_ref_by_addr(struct cdp_pdev *dev, u8 *peer_mac_addr, |
| 7309 | u8 *local_id, |
| 7310 | enum peer_debug_id_type debug_id) |
| 7311 | { |
| 7312 | /* |
| 7313 | * Currently this function does not implement the "get ref" |
| 7314 | * functionality and is mapped to dp_find_peer_by_addr which does not |
| 7315 | * increment the peer ref count. So the peer state is uncertain after |
| 7316 | * calling this API. The functionality needs to be implemented. |
| 7317 | * Accordingly the corresponding release_ref function is NULL. |
| 7318 | */ |
| 7319 | return dp_find_peer_by_addr(dev, peer_mac_addr, local_id); |
| 7320 | } |
| 7321 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7322 | static struct cdp_peer_ops dp_ops_peer = { |
| 7323 | .register_peer = dp_register_peer, |
| 7324 | .clear_peer = dp_clear_peer, |
| 7325 | .find_peer_by_addr = dp_find_peer_by_addr, |
| 7326 | .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] | 7327 | .peer_get_ref_by_addr = dp_wrapper_peer_get_ref_by_addr, |
| 7328 | .peer_release_ref = NULL, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7329 | .local_peer_id = dp_local_peer_id, |
| 7330 | .peer_find_by_local_id = dp_peer_find_by_local_id, |
| 7331 | .peer_state_update = dp_peer_state_update, |
| 7332 | .get_vdevid = dp_get_vdevid, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 7333 | .get_vdev_by_sta_id = dp_get_vdev_by_sta_id, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7334 | .peer_get_peer_mac_addr = dp_peer_get_peer_mac_addr, |
| 7335 | .get_vdev_for_peer = dp_get_vdev_for_peer, |
| 7336 | .get_peer_state = dp_get_peer_state, |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 7337 | .last_assoc_received = dp_get_last_assoc_received, |
| 7338 | .last_disassoc_received = dp_get_last_disassoc_received, |
| 7339 | .last_deauth_received = dp_get_last_deauth_received, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7340 | }; |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 7341 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7342 | |
| 7343 | static struct cdp_ops dp_txrx_ops = { |
| 7344 | .cmn_drv_ops = &dp_ops_cmn, |
| 7345 | .ctrl_ops = &dp_ops_ctrl, |
| 7346 | .me_ops = &dp_ops_me, |
| 7347 | .mon_ops = &dp_ops_mon, |
| 7348 | .host_stats_ops = &dp_ops_host_stats, |
| 7349 | .wds_ops = &dp_ops_wds, |
| 7350 | .raw_ops = &dp_ops_raw, |
| 7351 | #ifdef CONFIG_WIN |
| 7352 | .pflow_ops = &dp_ops_pflow, |
| 7353 | #endif /* CONFIG_WIN */ |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 7354 | #ifndef CONFIG_WIN |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7355 | .misc_ops = &dp_ops_misc, |
| 7356 | .cfg_ops = &dp_ops_cfg, |
| 7357 | .flowctl_ops = &dp_ops_flowctl, |
| 7358 | .l_flowctl_ops = &dp_ops_l_flowctl, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 7359 | #ifdef IPA_OFFLOAD |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7360 | .ipa_ops = &dp_ops_ipa, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 7361 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7362 | .bus_ops = &dp_ops_bus, |
| 7363 | .ocb_ops = &dp_ops_ocb, |
| 7364 | .peer_ops = &dp_ops_peer, |
| 7365 | .throttle_ops = &dp_ops_throttle, |
| 7366 | .mob_stats_ops = &dp_ops_mob_stats, |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 7367 | #endif |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7368 | }; |
| 7369 | |
| 7370 | /* |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 7371 | * dp_soc_set_txrx_ring_map() |
| 7372 | * @dp_soc: DP handler for soc |
| 7373 | * |
| 7374 | * Return: Void |
| 7375 | */ |
| 7376 | static void dp_soc_set_txrx_ring_map(struct dp_soc *soc) |
| 7377 | { |
| 7378 | uint32_t i; |
| 7379 | for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { |
| 7380 | soc->tx_ring_map[i] = dp_cpu_ring_map[DP_DEFAULT_MAP][i]; |
| 7381 | } |
| 7382 | } |
| 7383 | |
| 7384 | /* |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7385 | * dp_soc_attach_wifi3() - Attach txrx SOC |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7386 | * @ctrl_psoc: Opaque SOC handle from control plane |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7387 | * @htc_handle: Opaque HTC handle |
| 7388 | * @hif_handle: Opaque HIF handle |
| 7389 | * @qdf_osdev: QDF device |
| 7390 | * |
| 7391 | * Return: DP SOC handle on success, NULL on failure |
| 7392 | */ |
Jeff Johnson | 0771857 | 2017-01-10 13:57:15 -0800 | [diff] [blame] | 7393 | /* |
| 7394 | * Local prototype added to temporarily address warning caused by |
| 7395 | * -Wmissing-prototypes. A more correct solution, namely to expose |
| 7396 | * a prototype in an appropriate header file, will come later. |
| 7397 | */ |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7398 | void *dp_soc_attach_wifi3(void *ctrl_psoc, void *hif_handle, |
Jeff Johnson | 0771857 | 2017-01-10 13:57:15 -0800 | [diff] [blame] | 7399 | HTC_HANDLE htc_handle, qdf_device_t qdf_osdev, |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7400 | struct ol_if_ops *ol_ops); |
| 7401 | void *dp_soc_attach_wifi3(void *ctrl_psoc, void *hif_handle, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7402 | HTC_HANDLE htc_handle, qdf_device_t qdf_osdev, |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7403 | struct ol_if_ops *ol_ops) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7404 | { |
| 7405 | struct dp_soc *soc = qdf_mem_malloc(sizeof(*soc)); |
| 7406 | |
| 7407 | if (!soc) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 7408 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7409 | FL("DP SOC memory allocation failed")); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7410 | goto fail0; |
| 7411 | } |
| 7412 | |
| 7413 | soc->cdp_soc.ops = &dp_txrx_ops; |
| 7414 | soc->cdp_soc.ol_ops = ol_ops; |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7415 | soc->ctrl_psoc = ctrl_psoc; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7416 | soc->osdev = qdf_osdev; |
| 7417 | soc->hif_handle = hif_handle; |
| 7418 | |
| 7419 | soc->hal_soc = hif_get_hal_handle(hif_handle); |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7420 | soc->htt_handle = htt_soc_attach(soc, ctrl_psoc, htc_handle, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7421 | soc->hal_soc, qdf_osdev); |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 7422 | if (!soc->htt_handle) { |
| 7423 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7424 | FL("HTT attach failed")); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7425 | goto fail1; |
| 7426 | } |
| 7427 | |
| 7428 | soc->wlan_cfg_ctx = wlan_cfg_soc_attach(); |
| 7429 | if (!soc->wlan_cfg_ctx) { |
Tallapragada Kalyan | 1ef5480 | 2016-11-30 12:54:55 +0530 | [diff] [blame] | 7430 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7431 | FL("wlan_cfg_soc_attach failed")); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7432 | goto fail2; |
| 7433 | } |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 7434 | |
Tallapragada Kalyan | 4c183b8 | 2017-09-13 23:48:14 +0530 | [diff] [blame] | 7435 | wlan_cfg_set_rx_hash(soc->wlan_cfg_ctx, rx_hash); |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 7436 | soc->cce_disable = false; |
Tallapragada Kalyan | 4c183b8 | 2017-09-13 23:48:14 +0530 | [diff] [blame] | 7437 | |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 7438 | if (soc->cdp_soc.ol_ops->get_dp_cfg_param) { |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7439 | 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] | 7440 | CDP_CFG_MAX_PEER_ID); |
| 7441 | |
| 7442 | if (ret != -EINVAL) { |
| 7443 | wlan_cfg_set_max_peer_id(soc->wlan_cfg_ctx, ret); |
| 7444 | } |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 7445 | |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7446 | 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] | 7447 | CDP_CFG_CCE_DISABLE); |
Ruchi, Agrawal | f279a4a | 2018-02-26 18:12:44 +0530 | [diff] [blame] | 7448 | if (ret == 1) |
Ruchi, Agrawal | 3472139 | 2017-11-13 18:02:09 +0530 | [diff] [blame] | 7449 | soc->cce_disable = true; |
Pamidipati, Vijay | 6b0d2a8 | 2017-06-09 04:46:32 +0530 | [diff] [blame] | 7450 | } |
| 7451 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7452 | qdf_spinlock_create(&soc->peer_ref_mutex); |
| 7453 | |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 7454 | qdf_spinlock_create(&soc->reo_desc_freelist_lock); |
| 7455 | qdf_list_create(&soc->reo_desc_freelist, REO_DESC_FREELIST_SIZE); |
| 7456 | |
Aniruddha Paul | 0b1c4d2 | 2017-07-13 19:38:08 +0530 | [diff] [blame] | 7457 | /* fill the tx/rx cpu ring map*/ |
| 7458 | dp_soc_set_txrx_ring_map(soc); |
Om Prakash Tripathi | 1212682 | 2017-08-03 10:21:24 +0530 | [diff] [blame] | 7459 | |
| 7460 | qdf_spinlock_create(&soc->htt_stats.lock); |
| 7461 | /* initialize work queue for stats processing */ |
| 7462 | qdf_create_work(0, &soc->htt_stats.work, htt_t2h_stats_handler, soc); |
| 7463 | |
Stephan Raj Ignatious Durairaj | e5dd51c | 2018-02-09 16:39:12 +0530 | [diff] [blame] | 7464 | /*Initialize inactivity timer for wifison */ |
| 7465 | dp_init_inact_timer(soc); |
| 7466 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 7467 | return (void *)soc; |
| 7468 | |
| 7469 | fail2: |
| 7470 | htt_soc_detach(soc->htt_handle); |
| 7471 | fail1: |
| 7472 | qdf_mem_free(soc); |
| 7473 | fail0: |
| 7474 | return NULL; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 7475 | } |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7476 | |
Manjunathappa Prakash | e23acaf | 2017-11-10 00:17:24 -0800 | [diff] [blame] | 7477 | /* |
| 7478 | * dp_get_pdev_for_mac_id() - Return pdev for mac_id |
| 7479 | * |
| 7480 | * @soc: handle to DP soc |
| 7481 | * @mac_id: MAC id |
| 7482 | * |
| 7483 | * Return: Return pdev corresponding to MAC |
| 7484 | */ |
| 7485 | void *dp_get_pdev_for_mac_id(struct dp_soc *soc, uint32_t mac_id) |
| 7486 | { |
| 7487 | if (wlan_cfg_per_pdev_lmac_ring(soc->wlan_cfg_ctx)) |
| 7488 | return soc->pdev_list[mac_id]; |
| 7489 | |
| 7490 | /* Typically for MCL as there only 1 PDEV*/ |
| 7491 | return soc->pdev_list[0]; |
| 7492 | } |
| 7493 | |
| 7494 | /* |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7495 | * dp_is_hw_dbs_enable() - Procedure to check if DBS is supported |
| 7496 | * @soc: DP SoC context |
| 7497 | * @max_mac_rings: No of MAC rings |
| 7498 | * |
| 7499 | * Return: None |
| 7500 | */ |
| 7501 | static |
| 7502 | void dp_is_hw_dbs_enable(struct dp_soc *soc, |
| 7503 | int *max_mac_rings) |
| 7504 | { |
| 7505 | bool dbs_enable = false; |
| 7506 | if (soc->cdp_soc.ol_ops->is_hw_dbs_2x2_capable) |
| 7507 | dbs_enable = soc->cdp_soc.ol_ops-> |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 7508 | is_hw_dbs_2x2_capable(soc->ctrl_psoc); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7509 | |
| 7510 | *max_mac_rings = (dbs_enable)?(*max_mac_rings):1; |
| 7511 | } |
| 7512 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7513 | /* |
| 7514 | * dp_set_pktlog_wifi3() - attach txrx vdev |
| 7515 | * @pdev: Datapath PDEV handle |
| 7516 | * @event: which event's notifications are being subscribed to |
| 7517 | * @enable: WDI event subscribe or not. (True or False) |
| 7518 | * |
| 7519 | * Return: Success, NULL on failure |
| 7520 | */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7521 | #ifdef WDI_EVENT_ENABLE |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7522 | int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event, |
| 7523 | bool enable) |
| 7524 | { |
| 7525 | struct dp_soc *soc = pdev->soc; |
| 7526 | struct htt_rx_ring_tlv_filter htt_tlv_filter = {0}; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7527 | int max_mac_rings = wlan_cfg_get_num_mac_rings |
| 7528 | (pdev->wlan_cfg_ctx); |
| 7529 | uint8_t mac_id = 0; |
| 7530 | |
| 7531 | dp_is_hw_dbs_enable(soc, &max_mac_rings); |
| 7532 | |
| 7533 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, |
| 7534 | FL("Max_mac_rings %d \n"), |
| 7535 | max_mac_rings); |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7536 | |
| 7537 | if (enable) { |
| 7538 | switch (event) { |
| 7539 | case WDI_EVENT_RX_DESC: |
| 7540 | if (pdev->monitor_vdev) { |
| 7541 | /* Nothing needs to be done if monitor mode is |
| 7542 | * enabled |
| 7543 | */ |
| 7544 | return 0; |
| 7545 | } |
| 7546 | if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_FULL) { |
| 7547 | pdev->rx_pktlog_mode = DP_RX_PKTLOG_FULL; |
| 7548 | htt_tlv_filter.mpdu_start = 1; |
| 7549 | htt_tlv_filter.msdu_start = 1; |
| 7550 | htt_tlv_filter.msdu_end = 1; |
| 7551 | htt_tlv_filter.mpdu_end = 1; |
| 7552 | htt_tlv_filter.packet_header = 1; |
| 7553 | htt_tlv_filter.attention = 1; |
| 7554 | htt_tlv_filter.ppdu_start = 1; |
| 7555 | htt_tlv_filter.ppdu_end = 1; |
| 7556 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 7557 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 7558 | htt_tlv_filter.ppdu_end_status_done = 1; |
| 7559 | htt_tlv_filter.enable_fp = 1; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 7560 | htt_tlv_filter.fp_mgmt_filter = FILTER_MGMT_ALL; |
| 7561 | htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_ALL; |
| 7562 | htt_tlv_filter.fp_data_filter = FILTER_DATA_ALL; |
| 7563 | htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL; |
| 7564 | htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; |
| 7565 | htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7566 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7567 | for (mac_id = 0; mac_id < max_mac_rings; |
| 7568 | mac_id++) { |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7569 | int mac_for_pdev = |
| 7570 | dp_get_mac_id_for_pdev(mac_id, |
| 7571 | pdev->pdev_id); |
| 7572 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7573 | htt_h2t_rx_ring_cfg(soc->htt_handle, |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7574 | mac_for_pdev, |
| 7575 | pdev->rxdma_mon_status_ring[mac_id] |
| 7576 | .hal_srng, |
| 7577 | RXDMA_MONITOR_STATUS, |
| 7578 | RX_BUFFER_SIZE, |
| 7579 | &htt_tlv_filter); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7580 | |
| 7581 | } |
| 7582 | |
| 7583 | if (soc->reap_timer_init) |
| 7584 | qdf_timer_mod(&soc->mon_reap_timer, |
| 7585 | DP_INTR_POLL_TIMER_MS); |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7586 | } |
| 7587 | break; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7588 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7589 | case WDI_EVENT_LITE_RX: |
| 7590 | if (pdev->monitor_vdev) { |
| 7591 | /* Nothing needs to be done if monitor mode is |
| 7592 | * enabled |
| 7593 | */ |
| 7594 | return 0; |
| 7595 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7596 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7597 | if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_LITE) { |
| 7598 | pdev->rx_pktlog_mode = DP_RX_PKTLOG_LITE; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7599 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7600 | htt_tlv_filter.ppdu_start = 1; |
| 7601 | htt_tlv_filter.ppdu_end = 1; |
| 7602 | htt_tlv_filter.ppdu_end_user_stats = 1; |
| 7603 | htt_tlv_filter.ppdu_end_user_stats_ext = 1; |
| 7604 | htt_tlv_filter.ppdu_end_status_done = 1; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7605 | htt_tlv_filter.mpdu_start = 1; |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7606 | htt_tlv_filter.enable_fp = 1; |
nobelj | d124b74 | 2017-10-16 11:59:12 -0700 | [diff] [blame] | 7607 | htt_tlv_filter.fp_mgmt_filter = FILTER_MGMT_ALL; |
| 7608 | htt_tlv_filter.fp_ctrl_filter = FILTER_CTRL_ALL; |
| 7609 | htt_tlv_filter.fp_data_filter = FILTER_DATA_ALL; |
| 7610 | htt_tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL; |
| 7611 | htt_tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL; |
| 7612 | htt_tlv_filter.mo_data_filter = FILTER_DATA_ALL; |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7613 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7614 | for (mac_id = 0; mac_id < max_mac_rings; |
| 7615 | mac_id++) { |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7616 | int mac_for_pdev = |
| 7617 | dp_get_mac_id_for_pdev(mac_id, |
| 7618 | pdev->pdev_id); |
| 7619 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7620 | htt_h2t_rx_ring_cfg(soc->htt_handle, |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7621 | mac_for_pdev, |
| 7622 | pdev->rxdma_mon_status_ring[mac_id] |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7623 | .hal_srng, |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7624 | RXDMA_MONITOR_STATUS, |
| 7625 | RX_BUFFER_SIZE_PKTLOG_LITE, |
| 7626 | &htt_tlv_filter); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7627 | } |
| 7628 | |
| 7629 | if (soc->reap_timer_init) |
| 7630 | qdf_timer_mod(&soc->mon_reap_timer, |
| 7631 | DP_INTR_POLL_TIMER_MS); |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7632 | } |
| 7633 | break; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7634 | |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7635 | case WDI_EVENT_LITE_T2H: |
| 7636 | if (pdev->monitor_vdev) { |
| 7637 | /* Nothing needs to be done if monitor mode is |
| 7638 | * enabled |
| 7639 | */ |
| 7640 | return 0; |
| 7641 | } |
Venkata Sharath Chandra Manchala | 0ad4fda | 2018-03-01 13:45:46 -0800 | [diff] [blame] | 7642 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7643 | for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7644 | int mac_for_pdev = dp_get_mac_id_for_pdev( |
| 7645 | mac_id, pdev->pdev_id); |
| 7646 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 7647 | pdev->pktlog_ppdu_stats = true; |
Venkata Sharath Chandra Manchala | 0ad4fda | 2018-03-01 13:45:46 -0800 | [diff] [blame] | 7648 | dp_h2t_cfg_stats_msg_send(pdev, |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7649 | DP_PPDU_TXLITE_STATS_BITMASK_CFG, |
| 7650 | mac_for_pdev); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7651 | } |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7652 | break; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7653 | |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7654 | default: |
| 7655 | /* Nothing needs to be done for other pktlog types */ |
| 7656 | break; |
| 7657 | } |
| 7658 | } else { |
| 7659 | switch (event) { |
| 7660 | case WDI_EVENT_RX_DESC: |
| 7661 | case WDI_EVENT_LITE_RX: |
| 7662 | if (pdev->monitor_vdev) { |
| 7663 | /* Nothing needs to be done if monitor mode is |
| 7664 | * enabled |
| 7665 | */ |
| 7666 | return 0; |
| 7667 | } |
| 7668 | if (pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) { |
| 7669 | pdev->rx_pktlog_mode = DP_RX_PKTLOG_DISABLED; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7670 | |
| 7671 | for (mac_id = 0; mac_id < max_mac_rings; |
| 7672 | mac_id++) { |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7673 | int mac_for_pdev = |
| 7674 | dp_get_mac_id_for_pdev(mac_id, |
| 7675 | pdev->pdev_id); |
| 7676 | |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7677 | htt_h2t_rx_ring_cfg(soc->htt_handle, |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7678 | mac_for_pdev, |
| 7679 | pdev->rxdma_mon_status_ring[mac_id] |
| 7680 | .hal_srng, |
| 7681 | RXDMA_MONITOR_STATUS, |
| 7682 | RX_BUFFER_SIZE, |
| 7683 | &htt_tlv_filter); |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7684 | } |
| 7685 | |
| 7686 | if (soc->reap_timer_init) |
| 7687 | qdf_timer_stop(&soc->mon_reap_timer); |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7688 | } |
| 7689 | break; |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7690 | case WDI_EVENT_LITE_T2H: |
| 7691 | if (pdev->monitor_vdev) { |
| 7692 | /* Nothing needs to be done if monitor mode is |
| 7693 | * enabled |
| 7694 | */ |
| 7695 | return 0; |
| 7696 | } |
| 7697 | /* To disable HTT_H2T_MSG_TYPE_PPDU_STATS_CFG in FW |
| 7698 | * passing value 0. Once these macros will define in htt |
| 7699 | * header file will use proper macros |
| 7700 | */ |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7701 | for (mac_id = 0; mac_id < max_mac_rings; mac_id++) { |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7702 | int mac_for_pdev = |
| 7703 | dp_get_mac_id_for_pdev(mac_id, |
| 7704 | pdev->pdev_id); |
| 7705 | |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 7706 | pdev->pktlog_ppdu_stats = false; |
| 7707 | if (!pdev->enhanced_stats_en && !pdev->tx_sniffer_enable && !pdev->mcopy_mode) { |
| 7708 | dp_h2t_cfg_stats_msg_send(pdev, 0, |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7709 | mac_for_pdev); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 7710 | } else if (pdev->tx_sniffer_enable || pdev->mcopy_mode) { |
| 7711 | dp_h2t_cfg_stats_msg_send(pdev, DP_PPDU_STATS_CFG_SNIFFER, |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7712 | mac_for_pdev); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 7713 | } else if (pdev->enhanced_stats_en) { |
| 7714 | dp_h2t_cfg_stats_msg_send(pdev, DP_PPDU_STATS_CFG_ENH_STATS, |
Manjunathappa Prakash | d9ce350 | 2018-02-05 14:09:17 -0800 | [diff] [blame] | 7715 | mac_for_pdev); |
Soumya Bhat | 0d6245c | 2018-02-08 21:02:57 +0530 | [diff] [blame] | 7716 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7717 | } |
| 7718 | |
Keyur Parekh | db0fa14 | 2017-07-13 19:40:22 -0700 | [diff] [blame] | 7719 | break; |
Keyur Parekh | fad6d08 | 2017-05-07 08:54:47 -0700 | [diff] [blame] | 7720 | default: |
| 7721 | /* Nothing needs to be done for other pktlog types */ |
| 7722 | break; |
| 7723 | } |
| 7724 | } |
| 7725 | return 0; |
| 7726 | } |
| 7727 | #endif |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7728 | |
| 7729 | #ifdef CONFIG_MCL |
| 7730 | /* |
| 7731 | * dp_service_mon_rings()- timer to reap monitor rings |
| 7732 | * reqd as we are not getting ppdu end interrupts |
| 7733 | * @arg: SoC Handle |
| 7734 | * |
| 7735 | * Return: |
| 7736 | * |
| 7737 | */ |
| 7738 | static void dp_service_mon_rings(void *arg) |
| 7739 | { |
| 7740 | struct dp_soc *soc = (struct dp_soc *) arg; |
chenguo | 07e2404 | 2018-03-07 17:00:38 +0800 | [diff] [blame] | 7741 | int ring = 0, work_done, mac_id; |
| 7742 | struct dp_pdev *pdev = NULL; |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7743 | |
chenguo | 07e2404 | 2018-03-07 17:00:38 +0800 | [diff] [blame] | 7744 | for (ring = 0 ; ring < MAX_PDEV_CNT; ring++) { |
| 7745 | pdev = soc->pdev_list[ring]; |
| 7746 | if (pdev == NULL) |
| 7747 | continue; |
| 7748 | for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { |
| 7749 | int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, |
| 7750 | pdev->pdev_id); |
| 7751 | work_done = dp_mon_process(soc, mac_for_pdev, |
| 7752 | QCA_NAPI_BUDGET); |
| 7753 | |
| 7754 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, |
| 7755 | FL("Reaped %d descs from Monitor rings"), |
| 7756 | work_done); |
| 7757 | } |
| 7758 | } |
Venkata Sharath Chandra Manchala | 5a6f429 | 2017-11-03 14:57:41 -0700 | [diff] [blame] | 7759 | |
| 7760 | qdf_timer_mod(&soc->mon_reap_timer, DP_INTR_POLL_TIMER_MS); |
| 7761 | } |
| 7762 | |
| 7763 | #ifndef REMOVE_PKT_LOG |
| 7764 | /** |
| 7765 | * dp_pkt_log_init() - API to initialize packet log |
| 7766 | * @ppdev: physical device handle |
| 7767 | * @scn: HIF context |
| 7768 | * |
| 7769 | * Return: none |
| 7770 | */ |
| 7771 | void dp_pkt_log_init(struct cdp_pdev *ppdev, void *scn) |
| 7772 | { |
| 7773 | struct dp_pdev *handle = (struct dp_pdev *)ppdev; |
| 7774 | |
| 7775 | if (handle->pkt_log_init) { |
| 7776 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7777 | "%s: Packet log not initialized", __func__); |
| 7778 | return; |
| 7779 | } |
| 7780 | |
| 7781 | pktlog_sethandle(&handle->pl_dev, scn); |
| 7782 | pktlog_set_callback_regtype(PKTLOG_LITE_CALLBACK_REGISTRATION); |
| 7783 | |
| 7784 | if (pktlogmod_init(scn)) { |
| 7785 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7786 | "%s: pktlogmod_init failed", __func__); |
| 7787 | handle->pkt_log_init = false; |
| 7788 | } else { |
| 7789 | handle->pkt_log_init = true; |
| 7790 | } |
| 7791 | } |
| 7792 | |
| 7793 | /** |
| 7794 | * dp_pkt_log_con_service() - connect packet log service |
| 7795 | * @ppdev: physical device handle |
| 7796 | * @scn: device context |
| 7797 | * |
| 7798 | * Return: none |
| 7799 | */ |
| 7800 | static void dp_pkt_log_con_service(struct cdp_pdev *ppdev, void *scn) |
| 7801 | { |
| 7802 | struct dp_pdev *pdev = (struct dp_pdev *)ppdev; |
| 7803 | |
| 7804 | dp_pkt_log_init((struct cdp_pdev *)pdev, scn); |
| 7805 | pktlog_htc_attach(); |
| 7806 | } |
| 7807 | |
| 7808 | /** |
| 7809 | * dp_pktlogmod_exit() - API to cleanup pktlog info |
| 7810 | * @handle: Pdev handle |
| 7811 | * |
| 7812 | * Return: none |
| 7813 | */ |
| 7814 | static void dp_pktlogmod_exit(struct dp_pdev *handle) |
| 7815 | { |
| 7816 | void *scn = (void *)handle->soc->hif_handle; |
| 7817 | |
| 7818 | if (!scn) { |
| 7819 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 7820 | "%s: Invalid hif(scn) handle", __func__); |
| 7821 | return; |
| 7822 | } |
| 7823 | |
| 7824 | pktlogmod_exit(scn); |
| 7825 | handle->pkt_log_init = false; |
| 7826 | } |
| 7827 | #endif |
| 7828 | #else |
| 7829 | static void dp_pktlogmod_exit(struct dp_pdev *handle) { } |
| 7830 | #endif |
Soumya Bhat | bc719e6 | 2018-02-18 18:21:25 +0530 | [diff] [blame] | 7831 | |