Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1 | /* |
Gyanranjan Hazarika | 99a58d3 | 2017-12-22 21:56:17 -0800 | [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 |
Harilakshmi Deshkumar | 1ea2109 | 2017-05-08 21:16:27 +0530 | [diff] [blame] | 16 | * PERFORMANCE OF THIS SOFTWARE. |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 17 | */ |
| 18 | |
| 19 | #include <qdf_types.h> |
| 20 | #include <qdf_lock.h> |
| 21 | #include "dp_htt.h" |
| 22 | #include "dp_types.h" |
| 23 | #include "dp_internal.h" |
Jeff Johnson | 2cb8fc7 | 2016-12-17 10:45:08 -0800 | [diff] [blame] | 24 | #include "dp_peer.h" |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 25 | #include <hal_api.h> |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 26 | #include <hal_reo.h> |
Venkata Sharath Chandra Manchala | 8e8d8f1 | 2017-01-13 00:00:58 -0800 | [diff] [blame] | 27 | #ifdef CONFIG_MCL |
| 28 | #include <cds_ieee80211_common.h> |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 29 | #include <cds_api.h> |
Venkata Sharath Chandra Manchala | 8e8d8f1 | 2017-01-13 00:00:58 -0800 | [diff] [blame] | 30 | #endif |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 31 | #include <cdp_txrx_handle.h> |
Ravi Joshi | af9ace8 | 2017-02-17 12:41:48 -0800 | [diff] [blame] | 32 | #include <wlan_cfg.h> |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 33 | |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 34 | #ifdef DP_LFR |
| 35 | static inline void |
| 36 | dp_set_ssn_valid_flag(struct hal_reo_cmd_params *params, |
| 37 | uint8_t valid) |
| 38 | { |
| 39 | params->u.upd_queue_params.update_svld = 1; |
| 40 | params->u.upd_queue_params.svld = valid; |
| 41 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, |
| 42 | "%s: Setting SSN valid bit to %d\n", |
| 43 | __func__, valid); |
| 44 | } |
| 45 | #else |
| 46 | static inline void |
| 47 | dp_set_ssn_valid_flag(struct hal_reo_cmd_params *params, |
| 48 | uint8_t valid) {}; |
| 49 | #endif |
| 50 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 51 | static inline int dp_peer_find_mac_addr_cmp( |
| 52 | union dp_align_mac_addr *mac_addr1, |
| 53 | union dp_align_mac_addr *mac_addr2) |
| 54 | { |
| 55 | return !((mac_addr1->align4.bytes_abcd == mac_addr2->align4.bytes_abcd) |
| 56 | /* |
| 57 | * Intentionally use & rather than &&. |
| 58 | * because the operands are binary rather than generic boolean, |
| 59 | * the functionality is equivalent. |
| 60 | * Using && has the advantage of short-circuited evaluation, |
| 61 | * but using & has the advantage of no conditional branching, |
| 62 | * which is a more significant benefit. |
| 63 | */ |
| 64 | & |
| 65 | (mac_addr1->align4.bytes_ef == mac_addr2->align4.bytes_ef)); |
| 66 | } |
| 67 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 68 | static int dp_peer_find_map_attach(struct dp_soc *soc) |
| 69 | { |
| 70 | uint32_t max_peers, peer_map_size; |
| 71 | |
| 72 | /* allocate the peer ID -> peer object map */ |
| 73 | max_peers = wlan_cfg_max_peer_id(soc->wlan_cfg_ctx) + 1; |
| 74 | soc->max_peers = max_peers; |
| 75 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO, |
| 76 | "\n<=== cfg max peer id %d ====>\n", max_peers); |
| 77 | peer_map_size = max_peers * sizeof(soc->peer_id_to_obj_map[0]); |
| 78 | soc->peer_id_to_obj_map = qdf_mem_malloc(peer_map_size); |
| 79 | if (!soc->peer_id_to_obj_map) { |
| 80 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 81 | "%s: peer map memory allocation failed\n", __func__); |
| 82 | return QDF_STATUS_E_NOMEM; |
| 83 | } |
| 84 | |
| 85 | /* |
| 86 | * The peer_id_to_obj_map doesn't really need to be initialized, |
| 87 | * since elements are only used after they have been individually |
| 88 | * initialized. |
| 89 | * However, it is convenient for debugging to have all elements |
| 90 | * that are not in use set to 0. |
| 91 | */ |
| 92 | qdf_mem_zero(soc->peer_id_to_obj_map, peer_map_size); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 93 | return 0; /* success */ |
| 94 | } |
| 95 | |
| 96 | static int dp_log2_ceil(unsigned value) |
| 97 | { |
| 98 | unsigned tmp = value; |
| 99 | int log2 = -1; |
| 100 | |
| 101 | while (tmp) { |
| 102 | log2++; |
| 103 | tmp >>= 1; |
| 104 | } |
| 105 | if (1 << log2 != value) |
| 106 | log2++; |
| 107 | return log2; |
| 108 | } |
| 109 | |
| 110 | static int dp_peer_find_add_id_to_obj( |
| 111 | struct dp_peer *peer, |
| 112 | uint16_t peer_id) |
| 113 | { |
| 114 | int i; |
| 115 | |
| 116 | for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) { |
| 117 | if (peer->peer_ids[i] == HTT_INVALID_PEER) { |
| 118 | peer->peer_ids[i] = peer_id; |
| 119 | return 0; /* success */ |
| 120 | } |
| 121 | } |
| 122 | return QDF_STATUS_E_FAILURE; /* failure */ |
| 123 | } |
| 124 | |
| 125 | #define DP_PEER_HASH_LOAD_MULT 2 |
| 126 | #define DP_PEER_HASH_LOAD_SHIFT 0 |
| 127 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 128 | #define DP_AST_HASH_LOAD_MULT 2 |
| 129 | #define DP_AST_HASH_LOAD_SHIFT 0 |
| 130 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 131 | static int dp_peer_find_hash_attach(struct dp_soc *soc) |
| 132 | { |
| 133 | int i, hash_elems, log2; |
| 134 | |
| 135 | /* allocate the peer MAC address -> peer object hash table */ |
| 136 | hash_elems = wlan_cfg_max_peer_id(soc->wlan_cfg_ctx) + 1; |
| 137 | hash_elems *= DP_PEER_HASH_LOAD_MULT; |
| 138 | hash_elems >>= DP_PEER_HASH_LOAD_SHIFT; |
| 139 | log2 = dp_log2_ceil(hash_elems); |
| 140 | hash_elems = 1 << log2; |
| 141 | |
| 142 | soc->peer_hash.mask = hash_elems - 1; |
| 143 | soc->peer_hash.idx_bits = log2; |
| 144 | /* allocate an array of TAILQ peer object lists */ |
| 145 | soc->peer_hash.bins = qdf_mem_malloc( |
| 146 | hash_elems * sizeof(TAILQ_HEAD(anonymous_tail_q, dp_peer))); |
| 147 | if (!soc->peer_hash.bins) |
| 148 | return QDF_STATUS_E_NOMEM; |
| 149 | |
| 150 | for (i = 0; i < hash_elems; i++) |
| 151 | TAILQ_INIT(&soc->peer_hash.bins[i]); |
| 152 | |
| 153 | return 0; |
| 154 | } |
| 155 | |
| 156 | static void dp_peer_find_hash_detach(struct dp_soc *soc) |
| 157 | { |
| 158 | qdf_mem_free(soc->peer_hash.bins); |
| 159 | } |
| 160 | |
| 161 | static inline unsigned dp_peer_find_hash_index(struct dp_soc *soc, |
| 162 | union dp_align_mac_addr *mac_addr) |
| 163 | { |
| 164 | unsigned index; |
| 165 | |
| 166 | index = |
| 167 | mac_addr->align2.bytes_ab ^ |
| 168 | mac_addr->align2.bytes_cd ^ |
| 169 | mac_addr->align2.bytes_ef; |
| 170 | index ^= index >> soc->peer_hash.idx_bits; |
| 171 | index &= soc->peer_hash.mask; |
| 172 | return index; |
| 173 | } |
| 174 | |
| 175 | |
| 176 | void dp_peer_find_hash_add(struct dp_soc *soc, struct dp_peer *peer) |
| 177 | { |
| 178 | unsigned index; |
| 179 | |
| 180 | index = dp_peer_find_hash_index(soc, &peer->mac_addr); |
| 181 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 182 | /* |
| 183 | * It is important to add the new peer at the tail of the peer list |
| 184 | * with the bin index. Together with having the hash_find function |
| 185 | * search from head to tail, this ensures that if two entries with |
| 186 | * the same MAC address are stored, the one added first will be |
| 187 | * found first. |
| 188 | */ |
| 189 | TAILQ_INSERT_TAIL(&soc->peer_hash.bins[index], peer, hash_list_elem); |
| 190 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 191 | } |
| 192 | |
Tallapragada Kalyan | 71c46b9 | 2018-03-01 13:17:10 +0530 | [diff] [blame] | 193 | #ifdef FEATURE_AST |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 194 | /* |
| 195 | * dp_peer_ast_hash_attach() - Allocate and initialize AST Hash Table |
| 196 | * @soc: SoC handle |
| 197 | * |
| 198 | * Return: None |
| 199 | */ |
| 200 | static int dp_peer_ast_hash_attach(struct dp_soc *soc) |
| 201 | { |
| 202 | int i, hash_elems, log2; |
| 203 | |
| 204 | hash_elems = ((WLAN_UMAC_PSOC_MAX_PEERS * DP_AST_HASH_LOAD_MULT) >> |
| 205 | DP_AST_HASH_LOAD_SHIFT); |
| 206 | |
| 207 | log2 = dp_log2_ceil(hash_elems); |
| 208 | hash_elems = 1 << log2; |
| 209 | |
| 210 | soc->ast_hash.mask = hash_elems - 1; |
| 211 | soc->ast_hash.idx_bits = log2; |
| 212 | |
| 213 | /* allocate an array of TAILQ peer object lists */ |
| 214 | soc->ast_hash.bins = qdf_mem_malloc( |
| 215 | hash_elems * sizeof(TAILQ_HEAD(anonymous_tail_q, |
| 216 | dp_ast_entry))); |
| 217 | |
| 218 | if (!soc->ast_hash.bins) |
| 219 | return QDF_STATUS_E_NOMEM; |
| 220 | |
| 221 | for (i = 0; i < hash_elems; i++) |
| 222 | TAILQ_INIT(&soc->ast_hash.bins[i]); |
| 223 | |
| 224 | return 0; |
| 225 | } |
| 226 | |
| 227 | /* |
| 228 | * dp_peer_ast_hash_detach() - Free AST Hash table |
| 229 | * @soc: SoC handle |
| 230 | * |
| 231 | * Return: None |
| 232 | */ |
| 233 | static void dp_peer_ast_hash_detach(struct dp_soc *soc) |
| 234 | { |
| 235 | qdf_mem_free(soc->ast_hash.bins); |
| 236 | } |
| 237 | |
| 238 | /* |
| 239 | * dp_peer_ast_hash_index() - Compute the AST hash from MAC address |
| 240 | * @soc: SoC handle |
| 241 | * |
| 242 | * Return: AST hash |
| 243 | */ |
| 244 | static inline uint32_t dp_peer_ast_hash_index(struct dp_soc *soc, |
| 245 | union dp_align_mac_addr *mac_addr) |
| 246 | { |
| 247 | uint32_t index; |
| 248 | |
| 249 | index = |
| 250 | mac_addr->align2.bytes_ab ^ |
| 251 | mac_addr->align2.bytes_cd ^ |
| 252 | mac_addr->align2.bytes_ef; |
| 253 | index ^= index >> soc->ast_hash.idx_bits; |
| 254 | index &= soc->ast_hash.mask; |
| 255 | return index; |
| 256 | } |
| 257 | |
| 258 | /* |
| 259 | * dp_peer_ast_hash_add() - Add AST entry into hash table |
| 260 | * @soc: SoC handle |
| 261 | * |
| 262 | * This function adds the AST entry into SoC AST hash table |
| 263 | * It assumes caller has taken the ast lock to protect the access to this table |
| 264 | * |
| 265 | * Return: None |
| 266 | */ |
| 267 | static inline void dp_peer_ast_hash_add(struct dp_soc *soc, |
| 268 | struct dp_ast_entry *ase) |
| 269 | { |
| 270 | uint32_t index; |
| 271 | |
| 272 | index = dp_peer_ast_hash_index(soc, &ase->mac_addr); |
| 273 | TAILQ_INSERT_TAIL(&soc->ast_hash.bins[index], ase, hash_list_elem); |
| 274 | } |
| 275 | |
| 276 | /* |
| 277 | * dp_peer_ast_hash_remove() - Look up and remove AST entry from hash table |
| 278 | * @soc: SoC handle |
| 279 | * |
| 280 | * This function removes the AST entry from soc AST hash table |
| 281 | * It assumes caller has taken the ast lock to protect the access to this table |
| 282 | * |
| 283 | * Return: None |
| 284 | */ |
| 285 | static inline void dp_peer_ast_hash_remove(struct dp_soc *soc, |
| 286 | struct dp_ast_entry *ase) |
| 287 | { |
| 288 | unsigned index; |
| 289 | struct dp_ast_entry *tmpase; |
| 290 | int found = 0; |
| 291 | |
| 292 | index = dp_peer_ast_hash_index(soc, &ase->mac_addr); |
| 293 | /* Check if tail is not empty before delete*/ |
| 294 | QDF_ASSERT(!TAILQ_EMPTY(&soc->ast_hash.bins[index])); |
| 295 | |
| 296 | TAILQ_FOREACH(tmpase, &soc->ast_hash.bins[index], hash_list_elem) { |
| 297 | if (tmpase == ase) { |
| 298 | found = 1; |
| 299 | break; |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | QDF_ASSERT(found); |
| 304 | TAILQ_REMOVE(&soc->ast_hash.bins[index], ase, hash_list_elem); |
| 305 | } |
| 306 | |
| 307 | /* |
| 308 | * dp_peer_ast_hash_find() - Find AST entry by MAC address |
| 309 | * @soc: SoC handle |
| 310 | * |
| 311 | * It assumes caller has taken the ast lock to protect the access to |
| 312 | * AST hash table |
| 313 | * |
| 314 | * Return: AST entry |
| 315 | */ |
| 316 | struct dp_ast_entry *dp_peer_ast_hash_find(struct dp_soc *soc, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 317 | uint8_t *ast_mac_addr) |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 318 | { |
| 319 | union dp_align_mac_addr local_mac_addr_aligned, *mac_addr; |
| 320 | unsigned index; |
| 321 | struct dp_ast_entry *ase; |
| 322 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 323 | qdf_mem_copy(&local_mac_addr_aligned.raw[0], |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 324 | ast_mac_addr, DP_MAC_ADDR_LEN); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 325 | mac_addr = &local_mac_addr_aligned; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 326 | |
| 327 | index = dp_peer_ast_hash_index(soc, mac_addr); |
| 328 | TAILQ_FOREACH(ase, &soc->ast_hash.bins[index], hash_list_elem) { |
| 329 | if (dp_peer_find_mac_addr_cmp(mac_addr, &ase->mac_addr) == 0) { |
| 330 | return ase; |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | return NULL; |
| 335 | } |
| 336 | |
| 337 | /* |
| 338 | * dp_peer_map_ast() - Map the ast entry with HW AST Index |
| 339 | * @soc: SoC handle |
| 340 | * @peer: peer to which ast node belongs |
| 341 | * @mac_addr: MAC address of ast node |
| 342 | * @hw_peer_id: HW AST Index returned by target in peer map event |
| 343 | * @vdev_id: vdev id for VAP to which the peer belongs to |
| 344 | * |
| 345 | * Return: None |
| 346 | */ |
| 347 | static inline void dp_peer_map_ast(struct dp_soc *soc, |
| 348 | struct dp_peer *peer, uint8_t *mac_addr, uint16_t hw_peer_id, |
| 349 | uint8_t vdev_id) |
| 350 | { |
| 351 | struct dp_ast_entry *ast_entry; |
Chandru Neginahal | 2a4e5d2 | 2017-11-08 12:20:49 +0530 | [diff] [blame] | 352 | enum cdp_txrx_ast_entry_type peer_type = CDP_TXRX_AST_TYPE_STATIC; |
| 353 | bool ast_entry_found = FALSE; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 354 | |
| 355 | if (!peer) { |
| 356 | return; |
| 357 | } |
| 358 | |
| 359 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 360 | "%s: peer %pK ID %d vid %d mac %02x:%02x:%02x:%02x:%02x:%02x\n", |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 361 | __func__, peer, hw_peer_id, vdev_id, mac_addr[0], |
| 362 | mac_addr[1], mac_addr[2], mac_addr[3], |
| 363 | mac_addr[4], mac_addr[5]); |
| 364 | |
| 365 | qdf_spin_lock_bh(&soc->ast_lock); |
| 366 | TAILQ_FOREACH(ast_entry, &peer->ast_entry_list, ase_list_elem) { |
| 367 | if (!(qdf_mem_cmp(mac_addr, ast_entry->mac_addr.raw, |
| 368 | DP_MAC_ADDR_LEN))) { |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 369 | ast_entry->ast_idx = hw_peer_id; |
| 370 | soc->ast_table[hw_peer_id] = ast_entry; |
| 371 | ast_entry->is_active = TRUE; |
Radha krishna Simha Jiguru | f70f991 | 2017-08-02 18:32:22 +0530 | [diff] [blame] | 372 | peer_type = ast_entry->type; |
Chandru Neginahal | 2a4e5d2 | 2017-11-08 12:20:49 +0530 | [diff] [blame] | 373 | ast_entry_found = TRUE; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 374 | } |
| 375 | } |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 376 | |
Chandru Neginahal | 2a4e5d2 | 2017-11-08 12:20:49 +0530 | [diff] [blame] | 377 | if (ast_entry_found || (peer->vdev && peer->vdev->proxysta_vdev)) { |
| 378 | if (soc->cdp_soc.ol_ops->peer_map_event) { |
| 379 | soc->cdp_soc.ol_ops->peer_map_event( |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 380 | soc->ctrl_psoc, peer->peer_ids[0], |
Chandru Neginahal | 2a4e5d2 | 2017-11-08 12:20:49 +0530 | [diff] [blame] | 381 | hw_peer_id, vdev_id, |
| 382 | mac_addr, peer_type); |
| 383 | } |
| 384 | } else { |
| 385 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 386 | "AST entry not found\n"); |
Chandru Neginahal | 2a4e5d2 | 2017-11-08 12:20:49 +0530 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | qdf_spin_unlock_bh(&soc->ast_lock); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 390 | return; |
| 391 | } |
| 392 | |
| 393 | /* |
| 394 | * dp_peer_add_ast() - Allocate and add AST entry into peer list |
| 395 | * @soc: SoC handle |
| 396 | * @peer: peer to which ast node belongs |
| 397 | * @mac_addr: MAC address of ast node |
| 398 | * @is_self: Is this base AST entry with peer mac address |
| 399 | * |
| 400 | * This API is used by WDS source port learning funtion to |
| 401 | * add a new AST entry into peer AST list |
| 402 | * |
| 403 | * Return: 0 if new entry is allocated, |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 404 | * -1 if entry add failed |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 405 | */ |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 406 | int dp_peer_add_ast(struct dp_soc *soc, |
| 407 | struct dp_peer *peer, |
| 408 | uint8_t *mac_addr, |
| 409 | enum cdp_txrx_ast_entry_type type, |
| 410 | uint32_t flags) |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 411 | { |
| 412 | struct dp_ast_entry *ast_entry; |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 413 | struct dp_vdev *vdev = peer->vdev; |
| 414 | uint8_t next_node_mac[6]; |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 415 | int ret = -1; |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 416 | |
| 417 | if (!vdev) { |
| 418 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 419 | FL("Peers vdev is NULL")); |
| 420 | QDF_ASSERT(0); |
| 421 | return ret; |
| 422 | } |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 423 | |
| 424 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 425 | "%s: peer %pK mac %02x:%02x:%02x:%02x:%02x:%02x\n", |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 426 | __func__, peer, mac_addr[0], mac_addr[1], mac_addr[2], |
| 427 | mac_addr[3], mac_addr[4], mac_addr[5]); |
| 428 | |
| 429 | qdf_spin_lock_bh(&soc->ast_lock); |
| 430 | |
| 431 | /* If AST entry already exists , just return from here */ |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 432 | ast_entry = dp_peer_ast_hash_find(soc, mac_addr); |
| 433 | |
Tallapragada Kalyan | 1c14d5d | 2017-07-26 00:31:35 +0530 | [diff] [blame] | 434 | if (ast_entry) { |
Radha krishna Simha Jiguru | f70f991 | 2017-08-02 18:32:22 +0530 | [diff] [blame] | 435 | if (ast_entry->type == CDP_TXRX_AST_TYPE_MEC) |
Tallapragada Kalyan | 1c14d5d | 2017-07-26 00:31:35 +0530 | [diff] [blame] | 436 | ast_entry->is_active = TRUE; |
| 437 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 438 | qdf_spin_unlock_bh(&soc->ast_lock); |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 439 | return 0; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | ast_entry = (struct dp_ast_entry *) |
| 443 | qdf_mem_malloc(sizeof(struct dp_ast_entry)); |
| 444 | |
| 445 | if (!ast_entry) { |
| 446 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 447 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 448 | FL("fail to allocate ast_entry")); |
| 449 | QDF_ASSERT(0); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 450 | return ret; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 451 | } |
| 452 | |
| 453 | qdf_mem_copy(&ast_entry->mac_addr.raw[0], mac_addr, DP_MAC_ADDR_LEN); |
| 454 | ast_entry->peer = peer; |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 455 | ast_entry->pdev_id = vdev->pdev->pdev_id; |
| 456 | ast_entry->vdev_id = vdev->vdev_id; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 457 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 458 | switch (type) { |
| 459 | case CDP_TXRX_AST_TYPE_STATIC: |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 460 | peer->self_ast_entry = ast_entry; |
Radha krishna Simha Jiguru | f70f991 | 2017-08-02 18:32:22 +0530 | [diff] [blame] | 461 | ast_entry->type = CDP_TXRX_AST_TYPE_STATIC; |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 462 | break; |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 463 | case CDP_TXRX_AST_TYPE_WDS: |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 464 | ast_entry->next_hop = 1; |
Radha krishna Simha Jiguru | f70f991 | 2017-08-02 18:32:22 +0530 | [diff] [blame] | 465 | ast_entry->type = CDP_TXRX_AST_TYPE_WDS; |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 466 | break; |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 467 | case CDP_TXRX_AST_TYPE_WDS_HM: |
| 468 | ast_entry->next_hop = 1; |
| 469 | ast_entry->type = CDP_TXRX_AST_TYPE_WDS_HM; |
| 470 | break; |
| 471 | case CDP_TXRX_AST_TYPE_MEC: |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 472 | ast_entry->next_hop = 1; |
Radha krishna Simha Jiguru | f70f991 | 2017-08-02 18:32:22 +0530 | [diff] [blame] | 473 | ast_entry->type = CDP_TXRX_AST_TYPE_MEC; |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 474 | break; |
| 475 | default: |
| 476 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, |
| 477 | FL("Incorrect AST entry type")); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 478 | } |
| 479 | |
| 480 | ast_entry->is_active = TRUE; |
| 481 | TAILQ_INSERT_TAIL(&peer->ast_entry_list, ast_entry, ase_list_elem); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 482 | DP_STATS_INC(soc, ast.added, 1); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 483 | dp_peer_ast_hash_add(soc, ast_entry); |
| 484 | qdf_spin_unlock_bh(&soc->ast_lock); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 485 | |
Ruchi, Agrawal | d536f88 | 2018-03-02 15:51:23 +0530 | [diff] [blame] | 486 | if (ast_entry->type == CDP_TXRX_AST_TYPE_MEC) |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 487 | qdf_mem_copy(next_node_mac, peer->vdev->mac_addr.raw, 6); |
Ruchi, Agrawal | d536f88 | 2018-03-02 15:51:23 +0530 | [diff] [blame] | 488 | else |
| 489 | qdf_mem_copy(next_node_mac, peer->mac_addr.raw, 6); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 490 | |
| 491 | if (ast_entry->type != CDP_TXRX_AST_TYPE_STATIC) { |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 492 | if (QDF_STATUS_SUCCESS == |
| 493 | soc->cdp_soc.ol_ops->peer_add_wds_entry( |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 494 | peer->vdev->osif_vdev, |
| 495 | mac_addr, |
| 496 | next_node_mac, |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 497 | flags)) |
| 498 | return 0; |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | return ret; |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 502 | } |
| 503 | |
| 504 | /* |
| 505 | * dp_peer_del_ast() - Delete and free AST entry |
| 506 | * @soc: SoC handle |
| 507 | * @ast_entry: AST entry of the node |
| 508 | * |
| 509 | * This function removes the AST entry from peer and soc tables |
| 510 | * It assumes caller has taken the ast lock to protect the access to these |
| 511 | * tables |
| 512 | * |
| 513 | * Return: None |
| 514 | */ |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 515 | void dp_peer_del_ast(struct dp_soc *soc, struct dp_ast_entry *ast_entry) |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 516 | { |
| 517 | struct dp_peer *peer = ast_entry->peer; |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 518 | |
| 519 | if (ast_entry->next_hop) |
| 520 | soc->cdp_soc.ol_ops->peer_del_wds_entry(peer->vdev->osif_vdev, |
| 521 | ast_entry->mac_addr.raw); |
| 522 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 523 | soc->ast_table[ast_entry->ast_idx] = NULL; |
| 524 | TAILQ_REMOVE(&peer->ast_entry_list, ast_entry, ase_list_elem); |
Pamidipati, Vijay | 899e775 | 2017-07-25 22:09:28 +0530 | [diff] [blame] | 525 | DP_STATS_INC(soc, ast.deleted, 1); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 526 | dp_peer_ast_hash_remove(soc, ast_entry); |
| 527 | qdf_mem_free(ast_entry); |
| 528 | } |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 529 | |
| 530 | /* |
| 531 | * dp_peer_update_ast() - Delete and free AST entry |
| 532 | * @soc: SoC handle |
| 533 | * @peer: peer to which ast node belongs |
| 534 | * @ast_entry: AST entry of the node |
| 535 | * @flags: wds or hmwds |
| 536 | * |
| 537 | * This function update the AST entry to the roamed peer and soc tables |
| 538 | * It assumes caller has taken the ast lock to protect the access to these |
| 539 | * tables |
| 540 | * |
| 541 | * Return: 0 if ast entry is updated successfully |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 542 | * -1 failure |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 543 | */ |
| 544 | int dp_peer_update_ast(struct dp_soc *soc, struct dp_peer *peer, |
| 545 | struct dp_ast_entry *ast_entry, uint32_t flags) |
| 546 | { |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 547 | int ret = -1; |
Tallapragada Kalyan | 7a47aac | 2018-02-28 22:01:59 +0530 | [diff] [blame] | 548 | struct dp_peer *old_peer; |
| 549 | |
Chaithanya Garrepalli | 4c7099f | 2018-03-23 12:20:18 +0530 | [diff] [blame] | 550 | qdf_spin_lock_bh(&soc->ast_lock); |
| 551 | |
Tallapragada Kalyan | 7a47aac | 2018-02-28 22:01:59 +0530 | [diff] [blame] | 552 | old_peer = ast_entry->peer; |
| 553 | TAILQ_REMOVE(&old_peer->ast_entry_list, ast_entry, ase_list_elem); |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 554 | |
| 555 | ast_entry->peer = peer; |
Tallapragada Kalyan | 7a47aac | 2018-02-28 22:01:59 +0530 | [diff] [blame] | 556 | ast_entry->type = CDP_TXRX_AST_TYPE_WDS; |
| 557 | ast_entry->pdev_id = peer->vdev->pdev->pdev_id; |
| 558 | ast_entry->vdev_id = peer->vdev->vdev_id; |
| 559 | ast_entry->is_active = TRUE; |
| 560 | TAILQ_INSERT_TAIL(&peer->ast_entry_list, ast_entry, ase_list_elem); |
| 561 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 562 | if (ast_entry->type != CDP_TXRX_AST_TYPE_STATIC) { |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 563 | if (QDF_STATUS_SUCCESS == |
| 564 | soc->cdp_soc.ol_ops->peer_update_wds_entry( |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 565 | peer->vdev->osif_vdev, |
| 566 | ast_entry->mac_addr.raw, |
| 567 | peer->mac_addr.raw, |
Chaithanya Garrepalli | 4c7099f | 2018-03-23 12:20:18 +0530 | [diff] [blame] | 568 | flags)) { |
| 569 | qdf_spin_unlock_bh(&soc->ast_lock); |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 570 | return 0; |
Chaithanya Garrepalli | 4c7099f | 2018-03-23 12:20:18 +0530 | [diff] [blame] | 571 | } |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 572 | } |
Ruchi, Agrawal | d6ba7ae | 2018-02-23 16:54:58 +0530 | [diff] [blame] | 573 | |
Chaithanya Garrepalli | 4c7099f | 2018-03-23 12:20:18 +0530 | [diff] [blame] | 574 | qdf_spin_unlock_bh(&soc->ast_lock); |
| 575 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 576 | return ret; |
| 577 | } |
| 578 | |
| 579 | /* |
| 580 | * dp_peer_ast_get_pdev_id() - get pdev_id from the ast entry |
| 581 | * @soc: SoC handle |
| 582 | * @ast_entry: AST entry of the node |
| 583 | * |
| 584 | * This function gets the pdev_id from the ast entry. |
| 585 | * |
| 586 | * Return: (uint8_t) pdev_id |
| 587 | */ |
| 588 | uint8_t dp_peer_ast_get_pdev_id(struct dp_soc *soc, |
| 589 | struct dp_ast_entry *ast_entry) |
| 590 | { |
| 591 | return ast_entry->pdev_id; |
| 592 | } |
| 593 | |
| 594 | /* |
| 595 | * dp_peer_ast_get_next_hop() - get next_hop from the ast entry |
| 596 | * @soc: SoC handle |
| 597 | * @ast_entry: AST entry of the node |
| 598 | * |
| 599 | * This function gets the next hop from the ast entry. |
| 600 | * |
| 601 | * Return: (uint8_t) next_hop |
| 602 | */ |
| 603 | uint8_t dp_peer_ast_get_next_hop(struct dp_soc *soc, |
| 604 | struct dp_ast_entry *ast_entry) |
| 605 | { |
| 606 | return ast_entry->next_hop; |
| 607 | } |
| 608 | |
| 609 | /* |
| 610 | * dp_peer_ast_set_type() - set type from the ast entry |
| 611 | * @soc: SoC handle |
| 612 | * @ast_entry: AST entry of the node |
| 613 | * |
| 614 | * This function sets the type in the ast entry. |
| 615 | * |
| 616 | * Return: |
| 617 | */ |
| 618 | void dp_peer_ast_set_type(struct dp_soc *soc, |
| 619 | struct dp_ast_entry *ast_entry, |
| 620 | enum cdp_txrx_ast_entry_type type) |
| 621 | { |
| 622 | ast_entry->type = type; |
| 623 | } |
| 624 | |
Manjunathappa Prakash | c850ec6 | 2017-11-13 16:55:50 -0800 | [diff] [blame] | 625 | #else |
| 626 | int dp_peer_add_ast(struct dp_soc *soc, struct dp_peer *peer, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 627 | uint8_t *mac_addr, enum cdp_txrx_ast_entry_type type, |
| 628 | uint32_t flags) |
Manjunathappa Prakash | c850ec6 | 2017-11-13 16:55:50 -0800 | [diff] [blame] | 629 | { |
| 630 | return 1; |
| 631 | } |
| 632 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 633 | void dp_peer_del_ast(struct dp_soc *soc, struct dp_ast_entry *ast_entry) |
Manjunathappa Prakash | c850ec6 | 2017-11-13 16:55:50 -0800 | [diff] [blame] | 634 | { |
| 635 | } |
| 636 | |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 637 | int dp_peer_update_ast(struct dp_soc *soc, struct dp_peer *peer, |
| 638 | struct dp_ast_entry *ast_entry, uint32_t flags) |
| 639 | { |
| 640 | return 1; |
| 641 | } |
Manjunathappa Prakash | c850ec6 | 2017-11-13 16:55:50 -0800 | [diff] [blame] | 642 | |
| 643 | struct dp_ast_entry *dp_peer_ast_hash_find(struct dp_soc *soc, |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 644 | uint8_t *ast_mac_addr) |
Manjunathappa Prakash | c850ec6 | 2017-11-13 16:55:50 -0800 | [diff] [blame] | 645 | { |
| 646 | return NULL; |
| 647 | } |
| 648 | |
| 649 | static int dp_peer_ast_hash_attach(struct dp_soc *soc) |
| 650 | { |
| 651 | return 0; |
| 652 | } |
| 653 | |
| 654 | static inline void dp_peer_map_ast(struct dp_soc *soc, |
| 655 | struct dp_peer *peer, uint8_t *mac_addr, uint16_t hw_peer_id, |
| 656 | uint8_t vdev_id) |
| 657 | { |
| 658 | return; |
| 659 | } |
| 660 | |
| 661 | static void dp_peer_ast_hash_detach(struct dp_soc *soc) |
| 662 | { |
| 663 | } |
Tallapragada Kalyan | 57b6bb3 | 2018-01-02 12:58:33 +0530 | [diff] [blame] | 664 | |
| 665 | void dp_peer_ast_set_type(struct dp_soc *soc, |
| 666 | struct dp_ast_entry *ast_entry, |
| 667 | enum cdp_txrx_ast_entry_type type) |
| 668 | { |
| 669 | } |
| 670 | |
| 671 | uint8_t dp_peer_ast_get_pdev_id(struct dp_soc *soc, |
| 672 | struct dp_ast_entry *ast_entry) |
| 673 | { |
| 674 | return 0xff; |
| 675 | } |
| 676 | |
| 677 | |
| 678 | uint8_t dp_peer_ast_get_next_hop(struct dp_soc *soc, |
| 679 | struct dp_ast_entry *ast_entry) |
| 680 | { |
| 681 | return 0xff; |
| 682 | } |
Manjunathappa Prakash | c850ec6 | 2017-11-13 16:55:50 -0800 | [diff] [blame] | 683 | #endif |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 684 | |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 685 | struct dp_peer *dp_peer_find_hash_find(struct dp_soc *soc, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 686 | uint8_t *peer_mac_addr, int mac_addr_is_aligned, uint8_t vdev_id) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 687 | { |
| 688 | union dp_align_mac_addr local_mac_addr_aligned, *mac_addr; |
| 689 | unsigned index; |
| 690 | struct dp_peer *peer; |
| 691 | |
| 692 | if (mac_addr_is_aligned) { |
| 693 | mac_addr = (union dp_align_mac_addr *) peer_mac_addr; |
| 694 | } else { |
| 695 | qdf_mem_copy( |
| 696 | &local_mac_addr_aligned.raw[0], |
| 697 | peer_mac_addr, DP_MAC_ADDR_LEN); |
| 698 | mac_addr = &local_mac_addr_aligned; |
| 699 | } |
| 700 | index = dp_peer_find_hash_index(soc, mac_addr); |
| 701 | qdf_spin_lock_bh(&soc->peer_ref_mutex); |
| 702 | TAILQ_FOREACH(peer, &soc->peer_hash.bins[index], hash_list_elem) { |
| 703 | #if ATH_SUPPORT_WRAP |
| 704 | /* ProxySTA may have multiple BSS peer with same MAC address, |
| 705 | * modified find will take care of finding the correct BSS peer. |
| 706 | */ |
| 707 | if (dp_peer_find_mac_addr_cmp(mac_addr, &peer->mac_addr) == 0 && |
| 708 | (peer->vdev->vdev_id == vdev_id)) { |
| 709 | #else |
| 710 | if (dp_peer_find_mac_addr_cmp(mac_addr, &peer->mac_addr) == 0) { |
| 711 | #endif |
| 712 | /* found it - increment the ref count before releasing |
| 713 | * the lock |
| 714 | */ |
| 715 | qdf_atomic_inc(&peer->ref_cnt); |
| 716 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 717 | return peer; |
| 718 | } |
| 719 | } |
| 720 | qdf_spin_unlock_bh(&soc->peer_ref_mutex); |
| 721 | return NULL; /* failure */ |
| 722 | } |
| 723 | |
| 724 | void dp_peer_find_hash_remove(struct dp_soc *soc, struct dp_peer *peer) |
| 725 | { |
| 726 | unsigned index; |
| 727 | struct dp_peer *tmppeer = NULL; |
| 728 | int found = 0; |
| 729 | |
| 730 | index = dp_peer_find_hash_index(soc, &peer->mac_addr); |
| 731 | /* Check if tail is not empty before delete*/ |
| 732 | QDF_ASSERT(!TAILQ_EMPTY(&soc->peer_hash.bins[index])); |
| 733 | /* |
| 734 | * DO NOT take the peer_ref_mutex lock here - it needs to be taken |
| 735 | * by the caller. |
| 736 | * The caller needs to hold the lock from the time the peer object's |
| 737 | * reference count is decremented and tested up through the time the |
| 738 | * reference to the peer object is removed from the hash table, by |
| 739 | * this function. |
| 740 | * Holding the lock only while removing the peer object reference |
| 741 | * from the hash table keeps the hash table consistent, but does not |
| 742 | * protect against a new HL tx context starting to use the peer object |
| 743 | * if it looks up the peer object from its MAC address just after the |
| 744 | * peer ref count is decremented to zero, but just before the peer |
| 745 | * object reference is removed from the hash table. |
| 746 | */ |
| 747 | TAILQ_FOREACH(tmppeer, &soc->peer_hash.bins[index], hash_list_elem) { |
| 748 | if (tmppeer == peer) { |
| 749 | found = 1; |
| 750 | break; |
| 751 | } |
| 752 | } |
| 753 | QDF_ASSERT(found); |
| 754 | TAILQ_REMOVE(&soc->peer_hash.bins[index], peer, hash_list_elem); |
| 755 | } |
| 756 | |
| 757 | void dp_peer_find_hash_erase(struct dp_soc *soc) |
| 758 | { |
| 759 | int i; |
| 760 | |
| 761 | /* |
| 762 | * Not really necessary to take peer_ref_mutex lock - by this point, |
| 763 | * it's known that the soc is no longer in use. |
| 764 | */ |
| 765 | for (i = 0; i <= soc->peer_hash.mask; i++) { |
| 766 | if (!TAILQ_EMPTY(&soc->peer_hash.bins[i])) { |
| 767 | struct dp_peer *peer, *peer_next; |
| 768 | |
| 769 | /* |
| 770 | * TAILQ_FOREACH_SAFE must be used here to avoid any |
| 771 | * memory access violation after peer is freed |
| 772 | */ |
| 773 | TAILQ_FOREACH_SAFE(peer, &soc->peer_hash.bins[i], |
| 774 | hash_list_elem, peer_next) { |
| 775 | /* |
| 776 | * Don't remove the peer from the hash table - |
| 777 | * that would modify the list we are currently |
| 778 | * traversing, and it's not necessary anyway. |
| 779 | */ |
| 780 | /* |
| 781 | * Artificially adjust the peer's ref count to |
| 782 | * 1, so it will get deleted by |
| 783 | * dp_peer_unref_delete. |
| 784 | */ |
| 785 | /* set to zero */ |
| 786 | qdf_atomic_init(&peer->ref_cnt); |
| 787 | /* incr to one */ |
| 788 | qdf_atomic_inc(&peer->ref_cnt); |
| 789 | dp_peer_unref_delete(peer); |
| 790 | } |
| 791 | } |
| 792 | } |
| 793 | } |
| 794 | |
| 795 | static void dp_peer_find_map_detach(struct dp_soc *soc) |
| 796 | { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 797 | qdf_mem_free(soc->peer_id_to_obj_map); |
| 798 | } |
| 799 | |
| 800 | int dp_peer_find_attach(struct dp_soc *soc) |
| 801 | { |
| 802 | if (dp_peer_find_map_attach(soc)) |
| 803 | return 1; |
| 804 | |
| 805 | if (dp_peer_find_hash_attach(soc)) { |
| 806 | dp_peer_find_map_detach(soc); |
| 807 | return 1; |
| 808 | } |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 809 | |
| 810 | if (dp_peer_ast_hash_attach(soc)) { |
| 811 | dp_peer_find_hash_detach(soc); |
| 812 | dp_peer_find_map_detach(soc); |
| 813 | return 1; |
| 814 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 815 | return 0; /* success */ |
| 816 | } |
| 817 | |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 818 | void dp_rx_tid_stats_cb(struct dp_soc *soc, void *cb_ctxt, |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 819 | union hal_reo_status *reo_status) |
| 820 | { |
| 821 | struct dp_rx_tid *rx_tid = (struct dp_rx_tid *)cb_ctxt; |
| 822 | struct hal_reo_queue_status *queue_status = &(reo_status->queue_status); |
| 823 | |
| 824 | if (queue_status->header.status != HAL_REO_CMD_SUCCESS) { |
| 825 | DP_TRACE_STATS(FATAL, "REO stats failure %d for TID %d\n", |
| 826 | queue_status->header.status, rx_tid->tid); |
| 827 | return; |
| 828 | } |
| 829 | |
| 830 | DP_TRACE_STATS(FATAL, "REO queue stats (TID: %d): \n" |
| 831 | "ssn: %d\n" |
| 832 | "curr_idx : %d\n" |
| 833 | "pn_31_0 : %08x\n" |
| 834 | "pn_63_32 : %08x\n" |
| 835 | "pn_95_64 : %08x\n" |
| 836 | "pn_127_96 : %08x\n" |
| 837 | "last_rx_enq_tstamp : %08x\n" |
| 838 | "last_rx_deq_tstamp : %08x\n" |
| 839 | "rx_bitmap_31_0 : %08x\n" |
| 840 | "rx_bitmap_63_32 : %08x\n" |
| 841 | "rx_bitmap_95_64 : %08x\n" |
| 842 | "rx_bitmap_127_96 : %08x\n" |
| 843 | "rx_bitmap_159_128 : %08x\n" |
| 844 | "rx_bitmap_191_160 : %08x\n" |
| 845 | "rx_bitmap_223_192 : %08x\n" |
Karunakar Dasineni | 3da0811 | 2017-06-15 14:42:39 -0700 | [diff] [blame] | 846 | "rx_bitmap_255_224 : %08x\n", |
| 847 | rx_tid->tid, |
| 848 | queue_status->ssn, queue_status->curr_idx, |
| 849 | queue_status->pn_31_0, queue_status->pn_63_32, |
| 850 | queue_status->pn_95_64, queue_status->pn_127_96, |
| 851 | queue_status->last_rx_enq_tstamp, |
| 852 | queue_status->last_rx_deq_tstamp, |
| 853 | queue_status->rx_bitmap_31_0, queue_status->rx_bitmap_63_32, |
| 854 | queue_status->rx_bitmap_95_64, queue_status->rx_bitmap_127_96, |
| 855 | queue_status->rx_bitmap_159_128, |
| 856 | queue_status->rx_bitmap_191_160, |
| 857 | queue_status->rx_bitmap_223_192, |
| 858 | queue_status->rx_bitmap_255_224); |
| 859 | |
| 860 | DP_TRACE_STATS(FATAL, |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 861 | "curr_mpdu_cnt : %d\n" |
| 862 | "curr_msdu_cnt : %d\n" |
| 863 | "fwd_timeout_cnt : %d\n" |
| 864 | "fwd_bar_cnt : %d\n" |
| 865 | "dup_cnt : %d\n" |
| 866 | "frms_in_order_cnt : %d\n" |
| 867 | "bar_rcvd_cnt : %d\n" |
| 868 | "mpdu_frms_cnt : %d\n" |
| 869 | "msdu_frms_cnt : %d\n" |
| 870 | "total_byte_cnt : %d\n" |
| 871 | "late_recv_mpdu_cnt : %d\n" |
| 872 | "win_jump_2k : %d\n" |
| 873 | "hole_cnt : %d\n", |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 874 | queue_status->curr_mpdu_cnt, queue_status->curr_msdu_cnt, |
| 875 | queue_status->fwd_timeout_cnt, queue_status->fwd_bar_cnt, |
| 876 | queue_status->dup_cnt, queue_status->frms_in_order_cnt, |
| 877 | queue_status->bar_rcvd_cnt, queue_status->mpdu_frms_cnt, |
| 878 | queue_status->msdu_frms_cnt, queue_status->total_cnt, |
| 879 | queue_status->late_recv_mpdu_cnt, queue_status->win_jump_2k, |
| 880 | queue_status->hole_cnt); |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 881 | |
| 882 | DP_PRINT_STATS("Num of Addba Req = %d\n", rx_tid->num_of_addba_req); |
| 883 | DP_PRINT_STATS("Num of Addba Resp = %d\n", rx_tid->num_of_addba_resp); |
| 884 | DP_PRINT_STATS("Num of Delba Req = %d\n", rx_tid->num_of_delba_req); |
| 885 | DP_PRINT_STATS("BA window size = %d\n", rx_tid->ba_win_size); |
| 886 | DP_PRINT_STATS("Pn size = %d\n", rx_tid->pn_size); |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 887 | } |
| 888 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 889 | static inline struct dp_peer *dp_peer_find_add_id(struct dp_soc *soc, |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 890 | uint8_t *peer_mac_addr, uint16_t peer_id, uint16_t hw_peer_id, |
| 891 | uint8_t vdev_id) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 892 | { |
| 893 | struct dp_peer *peer; |
| 894 | |
| 895 | QDF_ASSERT(peer_id <= wlan_cfg_max_peer_id(soc->wlan_cfg_ctx) + 1); |
| 896 | /* check if there's already a peer object with this MAC address */ |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 897 | peer = dp_peer_find_hash_find(soc, peer_mac_addr, |
| 898 | 0 /* is aligned */, vdev_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 899 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 900 | "%s: peer %pK ID %d vid %d mac %02x:%02x:%02x:%02x:%02x:%02x\n", |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 901 | __func__, peer, peer_id, vdev_id, peer_mac_addr[0], |
| 902 | peer_mac_addr[1], peer_mac_addr[2], peer_mac_addr[3], |
| 903 | peer_mac_addr[4], peer_mac_addr[5]); |
| 904 | |
| 905 | if (peer) { |
| 906 | /* peer's ref count was already incremented by |
| 907 | * peer_find_hash_find |
| 908 | */ |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 909 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 910 | "%s: ref_cnt: %d", __func__, |
| 911 | qdf_atomic_read(&peer->ref_cnt)); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 912 | soc->peer_id_to_obj_map[peer_id] = peer; |
| 913 | |
| 914 | if (dp_peer_find_add_id_to_obj(peer, peer_id)) { |
| 915 | /* TBDXXX: assert for now */ |
| 916 | QDF_ASSERT(0); |
| 917 | } |
| 918 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 919 | return peer; |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 920 | } |
| 921 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 922 | return NULL; |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 923 | } |
| 924 | |
| 925 | /** |
| 926 | * dp_rx_peer_map_handler() - handle peer map event from firmware |
| 927 | * @soc_handle - genereic soc handle |
| 928 | * @peeri_id - peer_id from firmware |
| 929 | * @hw_peer_id - ast index for this peer |
| 930 | * vdev_id - vdev ID |
| 931 | * peer_mac_addr - macc assress of the peer |
| 932 | * |
| 933 | * associate the peer_id that firmware provided with peer entry |
| 934 | * and update the ast table in the host with the hw_peer_id. |
| 935 | * |
| 936 | * Return: none |
| 937 | */ |
| 938 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 939 | void |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 940 | dp_rx_peer_map_handler(void *soc_handle, uint16_t peer_id, uint16_t hw_peer_id, |
| 941 | uint8_t vdev_id, uint8_t *peer_mac_addr) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 942 | { |
| 943 | struct dp_soc *soc = (struct dp_soc *)soc_handle; |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 944 | struct dp_peer *peer = NULL; |
| 945 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 946 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 947 | "peer_map_event (soc:%pK): peer_id %di, hw_peer_id %d, peer_mac " |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 948 | "%02x:%02x:%02x:%02x:%02x:%02x, vdev_id %d\n", soc, peer_id, |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 949 | hw_peer_id, peer_mac_addr[0], peer_mac_addr[1], |
| 950 | peer_mac_addr[2], peer_mac_addr[3], peer_mac_addr[4], |
| 951 | peer_mac_addr[5], vdev_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 952 | |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 953 | peer = soc->peer_id_to_obj_map[peer_id]; |
| 954 | |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 955 | if ((hw_peer_id < 0) || (hw_peer_id > (WLAN_UMAC_PSOC_MAX_PEERS * 2))) { |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 956 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 957 | "invalid hw_peer_id: %d", hw_peer_id); |
Tallapragada Kalyan | fb72b63 | 2017-07-07 12:51:58 +0530 | [diff] [blame] | 958 | qdf_assert_always(0); |
Tallapragada Kalyan | 6f6166e | 2017-02-17 17:00:23 +0530 | [diff] [blame] | 959 | } |
| 960 | |
| 961 | /* |
| 962 | * check if peer already exists for this peer_id, if so |
| 963 | * this peer map event is in response for a wds peer add |
| 964 | * wmi command sent during wds source port learning. |
| 965 | * in this case just add the ast entry to the existing |
| 966 | * peer ast_list. |
| 967 | */ |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 968 | if (!peer) |
| 969 | peer = dp_peer_find_add_id(soc, peer_mac_addr, peer_id, |
| 970 | hw_peer_id, vdev_id); |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 971 | |
sumedh baikady | 68450ab | 2018-03-23 18:36:29 -0700 | [diff] [blame^] | 972 | if (peer) { |
| 973 | qdf_assert_always(peer->vdev); |
| 974 | /* |
| 975 | * For every peer MAp message search and set if bss_peer |
| 976 | */ |
| 977 | if (!(qdf_mem_cmp(peer->mac_addr.raw, peer->vdev->mac_addr.raw, |
| 978 | DP_MAC_ADDR_LEN))) { |
| 979 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH, |
Anish Nataraj | 0dae676 | 2018-03-02 22:31:45 +0530 | [diff] [blame] | 980 | "vdev bss_peer!!!!"); |
sumedh baikady | 68450ab | 2018-03-23 18:36:29 -0700 | [diff] [blame^] | 981 | peer->bss_peer = 1; |
| 982 | peer->vdev->vap_bss_peer = peer; |
| 983 | } |
Anish Nataraj | 0dae676 | 2018-03-02 22:31:45 +0530 | [diff] [blame] | 984 | } |
| 985 | |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 986 | dp_peer_map_ast(soc, peer, peer_mac_addr, |
| 987 | hw_peer_id, vdev_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 988 | } |
| 989 | |
| 990 | void |
| 991 | dp_rx_peer_unmap_handler(void *soc_handle, uint16_t peer_id) |
| 992 | { |
| 993 | struct dp_peer *peer; |
| 994 | struct dp_soc *soc = (struct dp_soc *)soc_handle; |
| 995 | uint8_t i; |
Chaithanya Garrepalli | 974da26 | 2018-02-22 20:32:19 +0530 | [diff] [blame] | 996 | |
| 997 | peer = __dp_peer_find_by_id(soc, peer_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 998 | |
| 999 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1000 | "peer_unmap_event (soc:%pK) peer_id %d peer %pK\n", |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1001 | soc, peer_id, peer); |
| 1002 | |
| 1003 | /* |
| 1004 | * Currently peer IDs are assigned for vdevs as well as peers. |
| 1005 | * If the peer ID is for a vdev, then the peer pointer stored |
| 1006 | * in peer_id_to_obj_map will be NULL. |
| 1007 | */ |
Chaithanya Garrepalli | 974da26 | 2018-02-22 20:32:19 +0530 | [diff] [blame] | 1008 | if (!peer) { |
| 1009 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 1010 | "%s: Received unmap event for invalid peer_id" |
| 1011 | " %u\n", __func__, peer_id); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1012 | return; |
Chaithanya Garrepalli | 974da26 | 2018-02-22 20:32:19 +0530 | [diff] [blame] | 1013 | } |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1014 | |
| 1015 | soc->peer_id_to_obj_map[peer_id] = NULL; |
| 1016 | for (i = 0; i < MAX_NUM_PEER_ID_PER_PEER; i++) { |
| 1017 | if (peer->peer_ids[i] == peer_id) { |
| 1018 | peer->peer_ids[i] = HTT_INVALID_PEER; |
| 1019 | break; |
| 1020 | } |
| 1021 | } |
| 1022 | |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 1023 | if (soc->cdp_soc.ol_ops->peer_unmap_event) { |
Sathyanarayanan Esakkiappan | 38c6f98 | 2017-12-05 12:00:31 +0530 | [diff] [blame] | 1024 | soc->cdp_soc.ol_ops->peer_unmap_event(soc->ctrl_psoc, |
Bharat Kumar M | 9a5d537 | 2017-05-08 17:41:42 +0530 | [diff] [blame] | 1025 | peer_id); |
| 1026 | } |
| 1027 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1028 | /* |
| 1029 | * Remove a reference to the peer. |
| 1030 | * If there are no more references, delete the peer object. |
| 1031 | */ |
| 1032 | dp_peer_unref_delete(peer); |
| 1033 | } |
| 1034 | |
| 1035 | void |
| 1036 | dp_peer_find_detach(struct dp_soc *soc) |
| 1037 | { |
| 1038 | dp_peer_find_map_detach(soc); |
| 1039 | dp_peer_find_hash_detach(soc); |
Pamidipati, Vijay | b8bbf16 | 2017-06-26 23:47:39 +0530 | [diff] [blame] | 1040 | dp_peer_ast_hash_detach(soc); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1041 | } |
| 1042 | |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1043 | static void dp_rx_tid_update_cb(struct dp_soc *soc, void *cb_ctxt, |
| 1044 | union hal_reo_status *reo_status) |
| 1045 | { |
| 1046 | struct dp_rx_tid *rx_tid = (struct dp_rx_tid *)cb_ctxt; |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1047 | |
Karunakar Dasineni | 31b98d4 | 2018-02-27 23:05:08 -0800 | [diff] [blame] | 1048 | if ((reo_status->rx_queue_status.header.status != |
| 1049 | HAL_REO_CMD_SUCCESS) && |
| 1050 | (reo_status->rx_queue_status.header.status != |
| 1051 | HAL_REO_CMD_DRAIN)) { |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1052 | /* Should not happen normally. Just print error for now */ |
| 1053 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 1054 | "%s: Rx tid HW desc update failed(%d): tid %d\n", |
| 1055 | __func__, |
| 1056 | reo_status->rx_queue_status.header.status, |
| 1057 | rx_tid->tid); |
| 1058 | } |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1059 | } |
| 1060 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1061 | /* |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1062 | * dp_find_peer_by_addr - find peer instance by mac address |
| 1063 | * @dev: physical device instance |
| 1064 | * @peer_mac_addr: peer mac address |
| 1065 | * @local_id: local id for the peer |
| 1066 | * |
| 1067 | * Return: peer instance pointer |
| 1068 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1069 | void *dp_find_peer_by_addr(struct cdp_pdev *dev, uint8_t *peer_mac_addr, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1070 | uint8_t *local_id) |
| 1071 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1072 | struct dp_pdev *pdev = (struct dp_pdev *)dev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1073 | struct dp_peer *peer; |
| 1074 | |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 1075 | peer = dp_peer_find_hash_find(pdev->soc, peer_mac_addr, 0, 0); |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 1076 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1077 | if (!peer) |
| 1078 | return NULL; |
| 1079 | |
| 1080 | /* Multiple peer ids? How can know peer id? */ |
| 1081 | *local_id = peer->local_id; |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1082 | DP_TRACE(INFO, "%s: peer %pK id %d", __func__, peer, *local_id); |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 1083 | |
| 1084 | /* ref_cnt is incremented inside dp_peer_find_hash_find(). |
| 1085 | * Decrement it here. |
| 1086 | */ |
| 1087 | qdf_atomic_dec(&peer->ref_cnt); |
| 1088 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1089 | return peer; |
| 1090 | } |
| 1091 | |
| 1092 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1093 | * dp_rx_tid_update_wifi3() – Update receive TID state |
| 1094 | * @peer: Datapath peer handle |
| 1095 | * @tid: TID |
| 1096 | * @ba_window_size: BlockAck window size |
| 1097 | * @start_seq: Starting sequence number |
| 1098 | * |
| 1099 | * Return: 0 on success, error code on failure |
| 1100 | */ |
Jeff Johnson | 416168b | 2017-01-06 09:42:43 -0800 | [diff] [blame] | 1101 | static int dp_rx_tid_update_wifi3(struct dp_peer *peer, int tid, uint32_t |
| 1102 | ba_window_size, uint32_t start_seq) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1103 | { |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1104 | struct dp_rx_tid *rx_tid = &peer->rx_tid[tid]; |
| 1105 | struct dp_soc *soc = peer->vdev->pdev->soc; |
| 1106 | struct hal_reo_cmd_params params; |
| 1107 | |
| 1108 | qdf_mem_zero(¶ms, sizeof(params)); |
| 1109 | |
| 1110 | params.std.need_status = 1; |
| 1111 | params.std.addr_lo = rx_tid->hw_qdesc_paddr & 0xffffffff; |
| 1112 | params.std.addr_hi = (uint64_t)(rx_tid->hw_qdesc_paddr) >> 32; |
| 1113 | params.u.upd_queue_params.update_ba_window_size = 1; |
| 1114 | params.u.upd_queue_params.ba_window_size = ba_window_size; |
| 1115 | |
| 1116 | if (start_seq < IEEE80211_SEQ_MAX) { |
| 1117 | params.u.upd_queue_params.update_ssn = 1; |
| 1118 | params.u.upd_queue_params.ssn = start_seq; |
| 1119 | } |
| 1120 | |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 1121 | dp_set_ssn_valid_flag(¶ms, 0); |
| 1122 | |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1123 | dp_reo_send_cmd(soc, CMD_UPDATE_RX_REO_QUEUE, ¶ms, dp_rx_tid_update_cb, rx_tid); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1124 | return 0; |
| 1125 | } |
| 1126 | |
| 1127 | /* |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1128 | * dp_reo_desc_free() - Callback free reo descriptor memory after |
| 1129 | * HW cache flush |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1130 | * |
| 1131 | * @soc: DP SOC handle |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1132 | * @cb_ctxt: Callback context |
| 1133 | * @reo_status: REO command status |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1134 | */ |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1135 | static void dp_reo_desc_free(struct dp_soc *soc, void *cb_ctxt, |
| 1136 | union hal_reo_status *reo_status) |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1137 | { |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1138 | struct reo_desc_list_node *freedesc = |
| 1139 | (struct reo_desc_list_node *)cb_ctxt; |
| 1140 | struct dp_rx_tid *rx_tid = &freedesc->rx_tid; |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1141 | |
Karunakar Dasineni | 31b98d4 | 2018-02-27 23:05:08 -0800 | [diff] [blame] | 1142 | if ((reo_status->fl_cache_status.header.status != |
| 1143 | HAL_REO_CMD_SUCCESS) && |
| 1144 | (reo_status->fl_cache_status.header.status != |
| 1145 | HAL_REO_CMD_DRAIN)) { |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1146 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 1147 | "%s: Rx tid HW desc flush failed(%d): tid %d\n", |
| 1148 | __func__, |
| 1149 | reo_status->rx_queue_status.header.status, |
| 1150 | freedesc->rx_tid.tid); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1151 | } |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1152 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO, |
| 1153 | "%s: hw_qdesc_paddr: %pK, tid:%d\n", __func__, |
| 1154 | (void *)(rx_tid->hw_qdesc_paddr), rx_tid->tid); |
| 1155 | qdf_mem_unmap_nbytes_single(soc->osdev, |
| 1156 | rx_tid->hw_qdesc_paddr, |
| 1157 | QDF_DMA_BIDIRECTIONAL, |
| 1158 | rx_tid->hw_qdesc_alloc_size); |
| 1159 | qdf_mem_free(rx_tid->hw_qdesc_vaddr_unaligned); |
| 1160 | qdf_mem_free(freedesc); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1161 | } |
| 1162 | |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1163 | #if defined(QCA_WIFI_QCA8074) && defined(BUILD_X86) |
| 1164 | /* Hawkeye emulation requires bus address to be >= 0x50000000 */ |
| 1165 | static inline int dp_reo_desc_addr_chk(qdf_dma_addr_t dma_addr) |
| 1166 | { |
| 1167 | if (dma_addr < 0x50000000) |
| 1168 | return QDF_STATUS_E_FAILURE; |
| 1169 | else |
| 1170 | return QDF_STATUS_SUCCESS; |
| 1171 | } |
| 1172 | #else |
| 1173 | static inline int dp_reo_desc_addr_chk(qdf_dma_addr_t dma_addr) |
| 1174 | { |
| 1175 | return QDF_STATUS_SUCCESS; |
| 1176 | } |
| 1177 | #endif |
| 1178 | |
| 1179 | |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1180 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1181 | * dp_rx_tid_setup_wifi3() – Setup receive TID state |
| 1182 | * @peer: Datapath peer handle |
| 1183 | * @tid: TID |
| 1184 | * @ba_window_size: BlockAck window size |
| 1185 | * @start_seq: Starting sequence number |
| 1186 | * |
| 1187 | * Return: 0 on success, error code on failure |
| 1188 | */ |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1189 | int dp_rx_tid_setup_wifi3(struct dp_peer *peer, int tid, |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1190 | uint32_t ba_window_size, uint32_t start_seq) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1191 | { |
| 1192 | struct dp_rx_tid *rx_tid = &peer->rx_tid[tid]; |
| 1193 | struct dp_vdev *vdev = peer->vdev; |
| 1194 | struct dp_soc *soc = vdev->pdev->soc; |
| 1195 | uint32_t hw_qdesc_size; |
| 1196 | uint32_t hw_qdesc_align; |
| 1197 | int hal_pn_type; |
| 1198 | void *hw_qdesc_vaddr; |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1199 | uint32_t alloc_tries = 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1200 | |
Karunakar Dasineni | 372647d | 2018-01-15 22:27:39 -0800 | [diff] [blame] | 1201 | if (peer->delete_in_progress) |
| 1202 | return QDF_STATUS_E_FAILURE; |
| 1203 | |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1204 | rx_tid->ba_win_size = ba_window_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1205 | if (rx_tid->hw_qdesc_vaddr_unaligned != NULL) |
| 1206 | return dp_rx_tid_update_wifi3(peer, tid, ba_window_size, |
| 1207 | start_seq); |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1208 | rx_tid->num_of_addba_req = 0; |
| 1209 | rx_tid->num_of_delba_req = 0; |
| 1210 | rx_tid->num_of_addba_resp = 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1211 | #ifdef notyet |
| 1212 | hw_qdesc_size = hal_get_reo_qdesc_size(soc->hal_soc, ba_window_size); |
| 1213 | #else |
| 1214 | /* TODO: Allocating HW queue descriptors based on max BA window size |
| 1215 | * for all QOS TIDs so that same descriptor can be used later when |
| 1216 | * ADDBA request is recevied. This should be changed to allocate HW |
| 1217 | * queue descriptors based on BA window size being negotiated (0 for |
| 1218 | * non BA cases), and reallocate when BA window size changes and also |
| 1219 | * send WMI message to FW to change the REO queue descriptor in Rx |
| 1220 | * peer entry as part of dp_rx_tid_update. |
| 1221 | */ |
| 1222 | if (tid != DP_NON_QOS_TID) |
| 1223 | hw_qdesc_size = hal_get_reo_qdesc_size(soc->hal_soc, |
| 1224 | HAL_RX_MAX_BA_WINDOW); |
| 1225 | else |
| 1226 | hw_qdesc_size = hal_get_reo_qdesc_size(soc->hal_soc, |
| 1227 | ba_window_size); |
| 1228 | #endif |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1229 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1230 | hw_qdesc_align = hal_get_reo_qdesc_align(soc->hal_soc); |
| 1231 | /* To avoid unnecessary extra allocation for alignment, try allocating |
| 1232 | * exact size and see if we already have aligned address. |
| 1233 | */ |
| 1234 | rx_tid->hw_qdesc_alloc_size = hw_qdesc_size; |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1235 | |
| 1236 | try_desc_alloc: |
| 1237 | rx_tid->hw_qdesc_vaddr_unaligned = |
| 1238 | qdf_mem_malloc(rx_tid->hw_qdesc_alloc_size); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1239 | |
| 1240 | if (!rx_tid->hw_qdesc_vaddr_unaligned) { |
| 1241 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 1242 | "%s: Rx tid HW desc alloc failed: tid %d\n", |
| 1243 | __func__, tid); |
| 1244 | return QDF_STATUS_E_NOMEM; |
| 1245 | } |
| 1246 | |
| 1247 | if ((unsigned long)(rx_tid->hw_qdesc_vaddr_unaligned) % |
| 1248 | hw_qdesc_align) { |
| 1249 | /* Address allocated above is not alinged. Allocate extra |
| 1250 | * memory for alignment |
| 1251 | */ |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1252 | qdf_mem_free(rx_tid->hw_qdesc_vaddr_unaligned); |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1253 | rx_tid->hw_qdesc_vaddr_unaligned = |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 1254 | qdf_mem_malloc(rx_tid->hw_qdesc_alloc_size + |
| 1255 | hw_qdesc_align - 1); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1256 | |
| 1257 | if (!rx_tid->hw_qdesc_vaddr_unaligned) { |
| 1258 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 1259 | "%s: Rx tid HW desc alloc failed: tid %d\n", |
| 1260 | __func__, tid); |
| 1261 | return QDF_STATUS_E_NOMEM; |
| 1262 | } |
| 1263 | |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 1264 | hw_qdesc_vaddr = (void *)qdf_align((unsigned long) |
| 1265 | rx_tid->hw_qdesc_vaddr_unaligned, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1266 | hw_qdesc_align); |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 1267 | |
| 1268 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1269 | "%s: Total Size %d Aligned Addr %pK\n", |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 1270 | __func__, rx_tid->hw_qdesc_alloc_size, |
| 1271 | hw_qdesc_vaddr); |
| 1272 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1273 | } else { |
| 1274 | hw_qdesc_vaddr = rx_tid->hw_qdesc_vaddr_unaligned; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1275 | } |
| 1276 | |
| 1277 | /* TODO: Ensure that sec_type is set before ADDBA is received. |
| 1278 | * Currently this is set based on htt indication |
| 1279 | * HTT_T2H_MSG_TYPE_SEC_IND from target |
| 1280 | */ |
| 1281 | switch (peer->security[dp_sec_ucast].sec_type) { |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1282 | case cdp_sec_type_tkip_nomic: |
| 1283 | case cdp_sec_type_aes_ccmp: |
| 1284 | case cdp_sec_type_aes_ccmp_256: |
| 1285 | case cdp_sec_type_aes_gcmp: |
| 1286 | case cdp_sec_type_aes_gcmp_256: |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1287 | hal_pn_type = HAL_PN_WPA; |
| 1288 | break; |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1289 | case cdp_sec_type_wapi: |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1290 | if (vdev->opmode == wlan_op_mode_ap) |
| 1291 | hal_pn_type = HAL_PN_WAPI_EVEN; |
| 1292 | else |
| 1293 | hal_pn_type = HAL_PN_WAPI_UNEVEN; |
| 1294 | break; |
| 1295 | default: |
| 1296 | hal_pn_type = HAL_PN_NONE; |
| 1297 | break; |
| 1298 | } |
| 1299 | |
| 1300 | hal_reo_qdesc_setup(soc->hal_soc, tid, ba_window_size, start_seq, |
| 1301 | hw_qdesc_vaddr, rx_tid->hw_qdesc_paddr, hal_pn_type); |
| 1302 | |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 1303 | qdf_mem_map_nbytes_single(soc->osdev, hw_qdesc_vaddr, |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1304 | QDF_DMA_BIDIRECTIONAL, rx_tid->hw_qdesc_alloc_size, |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 1305 | &(rx_tid->hw_qdesc_paddr)); |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1306 | |
Pramod Simha | 6b23f75 | 2017-03-30 11:54:18 -0700 | [diff] [blame] | 1307 | if (dp_reo_desc_addr_chk(rx_tid->hw_qdesc_paddr) != |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1308 | QDF_STATUS_SUCCESS) { |
| 1309 | if (alloc_tries++ < 10) |
| 1310 | goto try_desc_alloc; |
| 1311 | else { |
| 1312 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 1313 | "%s: Rx tid HW desc alloc failed (lowmem): tid %d\n", |
| 1314 | __func__, tid); |
| 1315 | return QDF_STATUS_E_NOMEM; |
| 1316 | } |
| 1317 | } |
| 1318 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1319 | if (soc->cdp_soc.ol_ops->peer_rx_reorder_queue_setup) { |
Manoj Ekbote | 1f2c0b5 | 2017-02-11 23:24:43 -0800 | [diff] [blame] | 1320 | soc->cdp_soc.ol_ops->peer_rx_reorder_queue_setup( |
| 1321 | vdev->pdev->osif_pdev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1322 | peer->vdev->vdev_id, peer->mac_addr.raw, |
| 1323 | rx_tid->hw_qdesc_paddr, tid, tid); |
Dhanashri Atre | 8abb9ee | 2016-11-22 17:41:02 -0800 | [diff] [blame] | 1324 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1325 | } |
| 1326 | return 0; |
| 1327 | } |
| 1328 | |
| 1329 | /* |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1330 | * dp_rx_tid_delete_cb() - Callback to flush reo descriptor HW cache |
| 1331 | * after deleting the entries (ie., setting valid=0) |
| 1332 | * |
| 1333 | * @soc: DP SOC handle |
| 1334 | * @cb_ctxt: Callback context |
| 1335 | * @reo_status: REO command status |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1336 | */ |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1337 | static void dp_rx_tid_delete_cb(struct dp_soc *soc, void *cb_ctxt, |
| 1338 | union hal_reo_status *reo_status) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1339 | { |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1340 | struct reo_desc_list_node *freedesc = |
| 1341 | (struct reo_desc_list_node *)cb_ctxt; |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1342 | uint32_t list_size; |
| 1343 | struct reo_desc_list_node *desc; |
| 1344 | unsigned long curr_ts = qdf_get_system_timestamp(); |
| 1345 | uint32_t desc_size, tot_desc_size; |
| 1346 | struct hal_reo_cmd_params params; |
| 1347 | |
Karunakar Dasineni | 31b98d4 | 2018-02-27 23:05:08 -0800 | [diff] [blame] | 1348 | if (reo_status->rx_queue_status.header.status == HAL_REO_CMD_DRAIN) { |
| 1349 | qdf_mem_zero(reo_status, sizeof(*reo_status)); |
| 1350 | reo_status->fl_cache_status.header.status = HAL_REO_CMD_DRAIN; |
| 1351 | dp_reo_desc_free(soc, (void *)freedesc, reo_status); |
| 1352 | return; |
| 1353 | } else if (reo_status->rx_queue_status.header.status != |
| 1354 | HAL_REO_CMD_SUCCESS) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1355 | /* Should not happen normally. Just print error for now */ |
| 1356 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1357 | "%s: Rx tid HW desc deletion failed(%d): tid %d\n", |
| 1358 | __func__, |
| 1359 | reo_status->rx_queue_status.header.status, |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1360 | freedesc->rx_tid.tid); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1361 | } |
| 1362 | |
Houston Hoffman | 41b912c | 2017-08-30 14:27:51 -0700 | [diff] [blame] | 1363 | QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW, |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1364 | "%s: rx_tid: %d status: %d\n", __func__, |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1365 | freedesc->rx_tid.tid, |
| 1366 | reo_status->rx_queue_status.header.status); |
Krishna Kumaar Natarajan | 1741dc4 | 2017-01-26 19:24:48 -0800 | [diff] [blame] | 1367 | |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1368 | qdf_spin_lock_bh(&soc->reo_desc_freelist_lock); |
| 1369 | freedesc->free_ts = curr_ts; |
| 1370 | qdf_list_insert_back_size(&soc->reo_desc_freelist, |
| 1371 | (qdf_list_node_t *)freedesc, &list_size); |
| 1372 | |
| 1373 | while ((qdf_list_peek_front(&soc->reo_desc_freelist, |
| 1374 | (qdf_list_node_t **)&desc) == QDF_STATUS_SUCCESS) && |
| 1375 | ((list_size >= REO_DESC_FREELIST_SIZE) || |
| 1376 | ((curr_ts - desc->free_ts) > REO_DESC_FREE_DEFER_MS))) { |
| 1377 | struct dp_rx_tid *rx_tid; |
| 1378 | |
| 1379 | qdf_list_remove_front(&soc->reo_desc_freelist, |
| 1380 | (qdf_list_node_t **)&desc); |
| 1381 | list_size--; |
| 1382 | rx_tid = &desc->rx_tid; |
| 1383 | |
| 1384 | /* Flush and invalidate REO descriptor from HW cache: Base and |
| 1385 | * extension descriptors should be flushed separately */ |
| 1386 | tot_desc_size = hal_get_reo_qdesc_size(soc->hal_soc, |
| 1387 | rx_tid->ba_win_size); |
| 1388 | desc_size = hal_get_reo_qdesc_size(soc->hal_soc, 0); |
| 1389 | |
| 1390 | /* Flush reo extension descriptors */ |
| 1391 | while ((tot_desc_size -= desc_size) > 0) { |
| 1392 | qdf_mem_zero(¶ms, sizeof(params)); |
| 1393 | params.std.addr_lo = |
| 1394 | ((uint64_t)(rx_tid->hw_qdesc_paddr) + |
| 1395 | tot_desc_size) & 0xffffffff; |
| 1396 | params.std.addr_hi = |
| 1397 | (uint64_t)(rx_tid->hw_qdesc_paddr) >> 32; |
| 1398 | |
| 1399 | if (QDF_STATUS_SUCCESS != dp_reo_send_cmd(soc, |
| 1400 | CMD_FLUSH_CACHE, |
| 1401 | ¶ms, |
| 1402 | NULL, |
| 1403 | NULL)) { |
| 1404 | QDF_TRACE(QDF_MODULE_ID_DP, |
| 1405 | QDF_TRACE_LEVEL_ERROR, |
| 1406 | "%s: fail to send CMD_CACHE_FLUSH:" |
| 1407 | "tid %d desc %pK\n", __func__, |
| 1408 | rx_tid->tid, |
| 1409 | (void *)(rx_tid->hw_qdesc_paddr)); |
| 1410 | } |
| 1411 | } |
| 1412 | |
| 1413 | /* Flush base descriptor */ |
| 1414 | qdf_mem_zero(¶ms, sizeof(params)); |
| 1415 | params.std.need_status = 1; |
| 1416 | params.std.addr_lo = |
| 1417 | (uint64_t)(rx_tid->hw_qdesc_paddr) & 0xffffffff; |
| 1418 | params.std.addr_hi = (uint64_t)(rx_tid->hw_qdesc_paddr) >> 32; |
| 1419 | |
| 1420 | if (QDF_STATUS_SUCCESS != dp_reo_send_cmd(soc, |
| 1421 | CMD_FLUSH_CACHE, |
| 1422 | ¶ms, |
| 1423 | dp_reo_desc_free, |
| 1424 | (void *)desc)) { |
| 1425 | union hal_reo_status reo_status; |
| 1426 | /* |
| 1427 | * If dp_reo_send_cmd return failure, related TID queue desc |
| 1428 | * should be unmapped. Also locally reo_desc, together with |
| 1429 | * TID queue desc also need to be freed accordingly. |
| 1430 | * |
| 1431 | * Here invoke desc_free function directly to do clean up. |
| 1432 | */ |
| 1433 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 1434 | "%s: fail to send REO cmd to flush cache: tid %d\n", |
| 1435 | __func__, rx_tid->tid); |
| 1436 | qdf_mem_zero(&reo_status, sizeof(reo_status)); |
| 1437 | reo_status.fl_cache_status.header.status = 0; |
| 1438 | dp_reo_desc_free(soc, (void *)desc, &reo_status); |
| 1439 | } |
| 1440 | } |
| 1441 | qdf_spin_unlock_bh(&soc->reo_desc_freelist_lock); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1442 | } |
| 1443 | |
| 1444 | /* |
| 1445 | * dp_rx_tid_delete_wifi3() – Delete receive TID queue |
| 1446 | * @peer: Datapath peer handle |
| 1447 | * @tid: TID |
| 1448 | * |
| 1449 | * Return: 0 on success, error code on failure |
| 1450 | */ |
Jeff Johnson | 416168b | 2017-01-06 09:42:43 -0800 | [diff] [blame] | 1451 | static int dp_rx_tid_delete_wifi3(struct dp_peer *peer, int tid) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1452 | { |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1453 | struct dp_rx_tid *rx_tid = &(peer->rx_tid[tid]); |
| 1454 | struct dp_soc *soc = peer->vdev->pdev->soc; |
| 1455 | struct hal_reo_cmd_params params; |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1456 | struct reo_desc_list_node *freedesc = |
| 1457 | qdf_mem_malloc(sizeof(*freedesc)); |
Lin Bai | fca7640 | 2017-12-11 15:03:49 +0800 | [diff] [blame] | 1458 | |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1459 | if (!freedesc) { |
Karunakar Dasineni | a8c779b | 2017-01-11 13:57:55 -0800 | [diff] [blame] | 1460 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1461 | "%s: malloc failed for freedesc: tid %d\n", |
| 1462 | __func__, tid); |
Karunakar Dasineni | a8c779b | 2017-01-11 13:57:55 -0800 | [diff] [blame] | 1463 | return -ENOMEM; |
| 1464 | } |
| 1465 | |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1466 | freedesc->rx_tid = *rx_tid; |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1467 | |
| 1468 | qdf_mem_zero(¶ms, sizeof(params)); |
| 1469 | |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1470 | params.std.need_status = 0; |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1471 | params.std.addr_lo = rx_tid->hw_qdesc_paddr & 0xffffffff; |
| 1472 | params.std.addr_hi = (uint64_t)(rx_tid->hw_qdesc_paddr) >> 32; |
| 1473 | params.u.upd_queue_params.update_vld = 1; |
| 1474 | params.u.upd_queue_params.vld = 0; |
| 1475 | |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1476 | dp_reo_send_cmd(soc, CMD_UPDATE_RX_REO_QUEUE, ¶ms, |
| 1477 | dp_rx_tid_delete_cb, (void *)freedesc); |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1478 | |
Karunakar Dasineni | a8c779b | 2017-01-11 13:57:55 -0800 | [diff] [blame] | 1479 | rx_tid->hw_qdesc_vaddr_unaligned = NULL; |
| 1480 | rx_tid->hw_qdesc_alloc_size = 0; |
Karunakar Dasineni | 8bebb00 | 2017-02-09 22:15:23 -0800 | [diff] [blame] | 1481 | rx_tid->hw_qdesc_paddr = 0; |
Karunakar Dasineni | a8c779b | 2017-01-11 13:57:55 -0800 | [diff] [blame] | 1482 | |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 1483 | return 0; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1484 | } |
| 1485 | |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 1486 | #ifdef DP_LFR |
| 1487 | static void dp_peer_setup_remaining_tids(struct dp_peer *peer) |
| 1488 | { |
| 1489 | int tid; |
| 1490 | |
| 1491 | for (tid = 1; tid < DP_MAX_TIDS-1; tid++) { |
| 1492 | dp_rx_tid_setup_wifi3(peer, tid, 1, 0); |
| 1493 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1494 | "Setting up TID %d for peer %pK peer->local_id %d\n", |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 1495 | tid, peer, peer->local_id); |
| 1496 | } |
| 1497 | } |
| 1498 | #else |
| 1499 | static void dp_peer_setup_remaining_tids(struct dp_peer *peer) {}; |
| 1500 | #endif |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1501 | /* |
| 1502 | * dp_peer_rx_init() – Initialize receive TID state |
| 1503 | * @pdev: Datapath pdev |
| 1504 | * @peer: Datapath peer |
| 1505 | * |
| 1506 | */ |
| 1507 | void dp_peer_rx_init(struct dp_pdev *pdev, struct dp_peer *peer) |
| 1508 | { |
| 1509 | int tid; |
| 1510 | struct dp_rx_tid *rx_tid; |
| 1511 | for (tid = 0; tid < DP_MAX_TIDS; tid++) { |
| 1512 | rx_tid = &peer->rx_tid[tid]; |
| 1513 | rx_tid->array = &rx_tid->base; |
| 1514 | rx_tid->base.head = rx_tid->base.tail = NULL; |
| 1515 | rx_tid->tid = tid; |
| 1516 | rx_tid->defrag_timeout_ms = 0; |
| 1517 | rx_tid->ba_win_size = 0; |
| 1518 | rx_tid->ba_status = DP_RX_BA_INACTIVE; |
| 1519 | |
| 1520 | rx_tid->defrag_waitlist_elem.tqe_next = NULL; |
| 1521 | rx_tid->defrag_waitlist_elem.tqe_prev = NULL; |
| 1522 | |
| 1523 | #ifdef notyet /* TODO: See if this is required for exception handling */ |
| 1524 | /* invalid sequence number */ |
| 1525 | peer->tids_last_seq[tid] = 0xffff; |
| 1526 | #endif |
| 1527 | } |
| 1528 | |
| 1529 | /* Setup default (non-qos) rx tid queue */ |
| 1530 | dp_rx_tid_setup_wifi3(peer, DP_NON_QOS_TID, 1, 0); |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1531 | |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1532 | /* Setup rx tid queue for TID 0. |
| 1533 | * Other queues will be setup on receiving first packet, which will cause |
| 1534 | * NULL REO queue error |
| 1535 | */ |
| 1536 | dp_rx_tid_setup_wifi3(peer, 0, 1, 0); |
| 1537 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1538 | /* |
Pramod Simha | b17d067 | 2017-03-06 17:20:13 -0800 | [diff] [blame] | 1539 | * Setup the rest of TID's to handle LFR |
| 1540 | */ |
| 1541 | dp_peer_setup_remaining_tids(peer); |
| 1542 | |
| 1543 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1544 | * Set security defaults: no PN check, no security. The target may |
| 1545 | * send a HTT SEC_IND message to overwrite these defaults. |
| 1546 | */ |
| 1547 | peer->security[dp_sec_ucast].sec_type = |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1548 | peer->security[dp_sec_mcast].sec_type = cdp_sec_type_none; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1549 | } |
| 1550 | |
| 1551 | /* |
| 1552 | * dp_peer_rx_cleanup() – Cleanup receive TID state |
| 1553 | * @vdev: Datapath vdev |
| 1554 | * @peer: Datapath peer |
| 1555 | * |
| 1556 | */ |
| 1557 | void dp_peer_rx_cleanup(struct dp_vdev *vdev, struct dp_peer *peer) |
| 1558 | { |
| 1559 | int tid; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1560 | uint32_t tid_delete_mask = 0; |
| 1561 | for (tid = 0; tid < DP_MAX_TIDS; tid++) { |
Karunakar Dasineni | a0f09ea | 2016-11-21 17:41:31 -0800 | [diff] [blame] | 1562 | if (peer->rx_tid[tid].hw_qdesc_vaddr_unaligned != NULL) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1563 | dp_rx_tid_delete_wifi3(peer, tid); |
| 1564 | tid_delete_mask |= (1 << tid); |
| 1565 | } |
| 1566 | } |
| 1567 | #ifdef notyet /* See if FW can remove queues as part of peer cleanup */ |
| 1568 | if (soc->ol_ops->peer_rx_reorder_queue_remove) { |
Manoj Ekbote | 1f2c0b5 | 2017-02-11 23:24:43 -0800 | [diff] [blame] | 1569 | soc->ol_ops->peer_rx_reorder_queue_remove(vdev->pdev->osif_pdev, |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1570 | peer->vdev->vdev_id, peer->mac_addr.raw, |
| 1571 | tid_delete_mask); |
| 1572 | } |
| 1573 | #endif |
| 1574 | } |
| 1575 | |
| 1576 | /* |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 1577 | * dp_peer_cleanup() – Cleanup peer information |
| 1578 | * @vdev: Datapath vdev |
| 1579 | * @peer: Datapath peer |
| 1580 | * |
| 1581 | */ |
| 1582 | void dp_peer_cleanup(struct dp_vdev *vdev, struct dp_peer *peer) |
| 1583 | { |
| 1584 | peer->last_assoc_rcvd = 0; |
| 1585 | peer->last_disassoc_rcvd = 0; |
| 1586 | peer->last_deauth_rcvd = 0; |
| 1587 | |
| 1588 | /* cleanup the Rx reorder queues for this peer */ |
| 1589 | dp_peer_rx_cleanup(vdev, peer); |
| 1590 | } |
| 1591 | |
| 1592 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1593 | * dp_rx_addba_requestprocess_wifi3() – Process ADDBA request from peer |
| 1594 | * |
| 1595 | * @peer: Datapath peer handle |
| 1596 | * @dialogtoken: dialogtoken from ADDBA frame |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1597 | * @tid: TID number |
| 1598 | * @startseqnum: Start seq. number received in BA sequence control |
| 1599 | * in ADDBA frame |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1600 | * |
| 1601 | * Return: 0 on success, error code on failure |
| 1602 | */ |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1603 | int dp_addba_requestprocess_wifi3(void *peer_handle, |
| 1604 | uint8_t dialogtoken, uint16_t tid, uint16_t batimeout, |
| 1605 | uint16_t buffersize, uint16_t startseqnum) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1606 | { |
| 1607 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1608 | struct dp_rx_tid *rx_tid = &peer->rx_tid[tid]; |
| 1609 | |
| 1610 | if ((rx_tid->ba_status == DP_RX_BA_ACTIVE) && |
| 1611 | (rx_tid->hw_qdesc_vaddr_unaligned != NULL)) |
| 1612 | rx_tid->ba_status = DP_RX_BA_INACTIVE; |
| 1613 | |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1614 | if (dp_rx_tid_setup_wifi3(peer, tid, buffersize, |
| 1615 | startseqnum)) { |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1616 | /* TODO: Should we send addba reject in this case */ |
| 1617 | return QDF_STATUS_E_FAILURE; |
| 1618 | } |
| 1619 | |
Gyanranjan Hazarika | 99a58d3 | 2017-12-22 21:56:17 -0800 | [diff] [blame] | 1620 | if (rx_tid->userstatuscode != IEEE80211_STATUS_SUCCESS) |
| 1621 | rx_tid->statuscode = rx_tid->userstatuscode; |
| 1622 | else |
| 1623 | rx_tid->statuscode = IEEE80211_STATUS_SUCCESS; |
| 1624 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1625 | rx_tid->dialogtoken = dialogtoken; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1626 | rx_tid->ba_status = DP_RX_BA_ACTIVE; |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1627 | rx_tid->num_of_addba_req++; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1628 | |
| 1629 | return 0; |
| 1630 | } |
| 1631 | |
| 1632 | /* |
| 1633 | * dp_rx_addba_responsesetup_wifi3() – Process ADDBA request from peer |
| 1634 | * |
| 1635 | * @peer: Datapath peer handle |
| 1636 | * @tid: TID number |
| 1637 | * @dialogtoken: output dialogtoken |
| 1638 | * @statuscode: output dialogtoken |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1639 | * @buffersize: Ouput BA window sizze |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1640 | * @batimeout: Ouput BA timeout |
| 1641 | */ |
| 1642 | void dp_addba_responsesetup_wifi3(void *peer_handle, uint8_t tid, |
| 1643 | uint8_t *dialogtoken, uint16_t *statuscode, |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1644 | uint16_t *buffersize, uint16_t *batimeout) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1645 | { |
| 1646 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 1647 | struct dp_rx_tid *rx_tid = &peer->rx_tid[tid]; |
| 1648 | |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1649 | rx_tid->num_of_addba_resp++; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1650 | /* setup ADDBA response paramters */ |
| 1651 | *dialogtoken = rx_tid->dialogtoken; |
| 1652 | *statuscode = rx_tid->statuscode; |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1653 | *buffersize = rx_tid->ba_win_size; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1654 | *batimeout = 0; |
| 1655 | } |
| 1656 | |
| 1657 | /* |
Gyanranjan Hazarika | 99a58d3 | 2017-12-22 21:56:17 -0800 | [diff] [blame] | 1658 | * dp_set_addba_response() – Set a user defined ADDBA response status code |
| 1659 | * |
| 1660 | * @peer: Datapath peer handle |
| 1661 | * @tid: TID number |
| 1662 | * @statuscode: response status code to be set |
| 1663 | */ |
| 1664 | void dp_set_addba_response(void *peer_handle, uint8_t tid, |
| 1665 | uint16_t statuscode) |
| 1666 | { |
| 1667 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 1668 | struct dp_rx_tid *rx_tid = &peer->rx_tid[tid]; |
| 1669 | |
| 1670 | rx_tid->userstatuscode = statuscode; |
| 1671 | } |
| 1672 | |
| 1673 | /* |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1674 | * dp_rx_delba_process_wifi3() – Process DELBA from peer |
| 1675 | * @peer: Datapath peer handle |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1676 | * @tid: TID number |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1677 | * @reasoncode: Reason code received in DELBA frame |
| 1678 | * |
| 1679 | * Return: 0 on success, error code on failure |
| 1680 | */ |
| 1681 | int dp_delba_process_wifi3(void *peer_handle, |
Karunakar Dasineni | ed1de12 | 2016-08-02 11:57:59 -0700 | [diff] [blame] | 1682 | int tid, uint16_t reasoncode) |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1683 | { |
| 1684 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1685 | struct dp_rx_tid *rx_tid = &peer->rx_tid[tid]; |
| 1686 | |
| 1687 | if (rx_tid->ba_status != DP_RX_BA_ACTIVE) |
| 1688 | return QDF_STATUS_E_FAILURE; |
| 1689 | |
| 1690 | /* TODO: See if we can delete the existing REO queue descriptor and |
| 1691 | * replace with a new one without queue extenstion descript to save |
| 1692 | * memory |
| 1693 | */ |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1694 | rx_tid->num_of_delba_req++; |
Karunakar Dasineni | 7957fa9 | 2017-02-23 23:05:40 -0800 | [diff] [blame] | 1695 | dp_rx_tid_update_wifi3(peer, tid, 1, 0); |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1696 | |
| 1697 | rx_tid->ba_status = DP_RX_BA_INACTIVE; |
| 1698 | |
| 1699 | return 0; |
| 1700 | } |
| 1701 | |
| 1702 | void dp_rx_discard(struct dp_vdev *vdev, struct dp_peer *peer, unsigned tid, |
| 1703 | qdf_nbuf_t msdu_list) |
| 1704 | { |
| 1705 | while (msdu_list) { |
| 1706 | qdf_nbuf_t msdu = msdu_list; |
| 1707 | |
| 1708 | msdu_list = qdf_nbuf_next(msdu_list); |
| 1709 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1710 | "discard rx %pK from partly-deleted peer %pK " |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1711 | "(%02x:%02x:%02x:%02x:%02x:%02x)\n", |
| 1712 | msdu, peer, |
| 1713 | peer->mac_addr.raw[0], peer->mac_addr.raw[1], |
| 1714 | peer->mac_addr.raw[2], peer->mac_addr.raw[3], |
| 1715 | peer->mac_addr.raw[4], peer->mac_addr.raw[5]); |
| 1716 | qdf_nbuf_free(msdu); |
| 1717 | } |
| 1718 | } |
| 1719 | |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1720 | |
| 1721 | /** |
| 1722 | * dp_set_pn_check_wifi3() - enable PN check in REO for security |
| 1723 | * @peer: Datapath peer handle |
| 1724 | * @vdev: Datapath vdev |
| 1725 | * @pdev - data path device instance |
| 1726 | * @sec_type - security type |
| 1727 | * @rx_pn - Receive pn starting number |
| 1728 | * |
| 1729 | */ |
| 1730 | |
| 1731 | void |
| 1732 | dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle, struct cdp_peer *peer_handle, enum cdp_sec_type sec_type, uint32_t *rx_pn) |
| 1733 | { |
| 1734 | struct dp_peer *peer = (struct dp_peer *)peer_handle; |
| 1735 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
| 1736 | struct dp_pdev *pdev; |
| 1737 | struct dp_soc *soc; |
| 1738 | int i; |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1739 | uint8_t pn_size; |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1740 | struct hal_reo_cmd_params params; |
| 1741 | |
| 1742 | /* preconditions */ |
| 1743 | qdf_assert(vdev); |
| 1744 | |
| 1745 | pdev = vdev->pdev; |
| 1746 | soc = pdev->soc; |
| 1747 | |
| 1748 | |
| 1749 | qdf_mem_zero(¶ms, sizeof(params)); |
| 1750 | |
| 1751 | params.std.need_status = 1; |
| 1752 | params.u.upd_queue_params.update_pn_valid = 1; |
| 1753 | params.u.upd_queue_params.update_pn_size = 1; |
| 1754 | params.u.upd_queue_params.update_pn = 1; |
| 1755 | params.u.upd_queue_params.update_pn_check_needed = 1; |
| 1756 | |
| 1757 | peer->security[dp_sec_ucast].sec_type = sec_type; |
| 1758 | |
| 1759 | switch (sec_type) { |
| 1760 | case cdp_sec_type_tkip_nomic: |
| 1761 | case cdp_sec_type_aes_ccmp: |
| 1762 | case cdp_sec_type_aes_ccmp_256: |
| 1763 | case cdp_sec_type_aes_gcmp: |
| 1764 | case cdp_sec_type_aes_gcmp_256: |
| 1765 | params.u.upd_queue_params.pn_check_needed = 1; |
| 1766 | params.u.upd_queue_params.pn_size = 48; |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1767 | pn_size = 48; |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1768 | break; |
| 1769 | case cdp_sec_type_wapi: |
| 1770 | params.u.upd_queue_params.pn_check_needed = 1; |
| 1771 | params.u.upd_queue_params.pn_size = 128; |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1772 | pn_size = 128; |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1773 | if (vdev->opmode == wlan_op_mode_ap) { |
| 1774 | params.u.upd_queue_params.pn_even = 1; |
| 1775 | params.u.upd_queue_params.update_pn_even = 1; |
| 1776 | } else { |
| 1777 | params.u.upd_queue_params.pn_uneven = 1; |
| 1778 | params.u.upd_queue_params.update_pn_uneven = 1; |
| 1779 | } |
| 1780 | break; |
| 1781 | default: |
| 1782 | params.u.upd_queue_params.pn_check_needed = 0; |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1783 | pn_size = 0; |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1784 | break; |
| 1785 | } |
| 1786 | |
| 1787 | |
| 1788 | for (i = 0; i < DP_MAX_TIDS; i++) { |
| 1789 | struct dp_rx_tid *rx_tid = &peer->rx_tid[i]; |
| 1790 | if (rx_tid->hw_qdesc_vaddr_unaligned != NULL) { |
| 1791 | params.std.addr_lo = |
| 1792 | rx_tid->hw_qdesc_paddr & 0xffffffff; |
| 1793 | params.std.addr_hi = |
| 1794 | (uint64_t)(rx_tid->hw_qdesc_paddr) >> 32; |
| 1795 | |
| 1796 | if (sec_type != cdp_sec_type_wapi) { |
| 1797 | params.u.upd_queue_params.update_pn_valid = 0; |
| 1798 | } else { |
| 1799 | /* |
| 1800 | * Setting PN valid bit for WAPI sec_type, |
| 1801 | * since WAPI PN has to be started with |
| 1802 | * predefined value |
| 1803 | */ |
| 1804 | params.u.upd_queue_params.update_pn_valid = 1; |
| 1805 | params.u.upd_queue_params.pn_31_0 = rx_pn[0]; |
| 1806 | params.u.upd_queue_params.pn_63_32 = rx_pn[1]; |
| 1807 | params.u.upd_queue_params.pn_95_64 = rx_pn[2]; |
| 1808 | params.u.upd_queue_params.pn_127_96 = rx_pn[3]; |
| 1809 | } |
sumedh baikady | e3947bd | 2017-11-29 19:19:25 -0800 | [diff] [blame] | 1810 | rx_tid->pn_size = pn_size; |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 1811 | dp_reo_send_cmd(soc, CMD_UPDATE_RX_REO_QUEUE, ¶ms, |
| 1812 | dp_rx_tid_update_cb, rx_tid); |
| 1813 | } else { |
| 1814 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 1815 | "PN Check not setup for TID :%d \n", i); |
| 1816 | } |
| 1817 | } |
| 1818 | } |
| 1819 | |
| 1820 | |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1821 | void |
| 1822 | dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id, |
| 1823 | enum htt_sec_type sec_type, int is_unicast, u_int32_t *michael_key, |
| 1824 | u_int32_t *rx_pn) |
| 1825 | { |
| 1826 | struct dp_soc *soc = (struct dp_soc *)soc_handle; |
| 1827 | struct dp_peer *peer; |
| 1828 | int sec_index; |
| 1829 | |
| 1830 | peer = dp_peer_find_by_id(soc, peer_id); |
| 1831 | if (!peer) { |
| 1832 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 1833 | "Couldn't find peer from ID %d - skipping security inits\n", |
| 1834 | peer_id); |
| 1835 | return; |
| 1836 | } |
| 1837 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1838 | "sec spec for peer %pK (%02x:%02x:%02x:%02x:%02x:%02x): " |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1839 | "%s key of type %d\n", |
| 1840 | peer, |
| 1841 | peer->mac_addr.raw[0], peer->mac_addr.raw[1], |
| 1842 | peer->mac_addr.raw[2], peer->mac_addr.raw[3], |
| 1843 | peer->mac_addr.raw[4], peer->mac_addr.raw[5], |
| 1844 | is_unicast ? "ucast" : "mcast", |
| 1845 | sec_type); |
| 1846 | sec_index = is_unicast ? dp_sec_ucast : dp_sec_mcast; |
| 1847 | peer->security[sec_index].sec_type = sec_type; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1848 | #ifdef notyet /* TODO: See if this is required for defrag support */ |
Karunakar Dasineni | 9b814ce | 2016-09-01 15:00:09 -0700 | [diff] [blame] | 1849 | /* michael key only valid for TKIP, but for simplicity, |
| 1850 | * copy it anyway |
| 1851 | */ |
| 1852 | qdf_mem_copy( |
| 1853 | &peer->security[sec_index].michael_key[0], |
| 1854 | michael_key, |
| 1855 | sizeof(peer->security[sec_index].michael_key)); |
| 1856 | #ifdef BIG_ENDIAN_HOST |
| 1857 | OL_IF_SWAPBO(peer->security[sec_index].michael_key[0], |
| 1858 | sizeof(peer->security[sec_index].michael_key)); |
| 1859 | #endif /* BIG_ENDIAN_HOST */ |
| 1860 | #endif |
| 1861 | |
| 1862 | #ifdef notyet /* TODO: Check if this is required for wifi3.0 */ |
| 1863 | if (sec_type != htt_sec_type_wapi) { |
| 1864 | qdf_mem_set(peer->tids_last_pn_valid, _EXT_TIDS, 0x00); |
| 1865 | } else { |
| 1866 | for (i = 0; i < DP_MAX_TIDS; i++) { |
| 1867 | /* |
| 1868 | * Setting PN valid bit for WAPI sec_type, |
| 1869 | * since WAPI PN has to be started with predefined value |
| 1870 | */ |
| 1871 | peer->tids_last_pn_valid[i] = 1; |
| 1872 | qdf_mem_copy( |
| 1873 | (u_int8_t *) &peer->tids_last_pn[i], |
| 1874 | (u_int8_t *) rx_pn, sizeof(union htt_rx_pn_t)); |
| 1875 | peer->tids_last_pn[i].pn128[1] = |
| 1876 | qdf_cpu_to_le64(peer->tids_last_pn[i].pn128[1]); |
| 1877 | peer->tids_last_pn[i].pn128[0] = |
| 1878 | qdf_cpu_to_le64(peer->tids_last_pn[i].pn128[0]); |
| 1879 | } |
| 1880 | } |
| 1881 | #endif |
| 1882 | /* TODO: Update HW TID queue with PN check parameters (pn type for |
| 1883 | * all security types and last pn for WAPI) once REO command API |
| 1884 | * is available |
| 1885 | */ |
| 1886 | } |
| 1887 | |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 1888 | #ifndef CONFIG_WIN |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1889 | /** |
| 1890 | * dp_register_peer() - Register peer into physical device |
| 1891 | * @pdev - data path device instance |
| 1892 | * @sta_desc - peer description |
| 1893 | * |
| 1894 | * Register peer into physical device |
| 1895 | * |
| 1896 | * Return: QDF_STATUS_SUCCESS registration success |
| 1897 | * QDF_STATUS_E_FAULT peer not found |
| 1898 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1899 | QDF_STATUS dp_register_peer(struct cdp_pdev *pdev_handle, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1900 | struct ol_txrx_desc_type *sta_desc) |
| 1901 | { |
| 1902 | struct dp_peer *peer; |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1903 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1904 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1905 | peer = dp_peer_find_by_local_id((struct cdp_pdev *)pdev, |
| 1906 | sta_desc->sta_id); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1907 | if (!peer) |
| 1908 | return QDF_STATUS_E_FAULT; |
| 1909 | |
| 1910 | qdf_spin_lock_bh(&peer->peer_info_lock); |
| 1911 | peer->state = OL_TXRX_PEER_STATE_CONN; |
| 1912 | qdf_spin_unlock_bh(&peer->peer_info_lock); |
| 1913 | |
| 1914 | return QDF_STATUS_SUCCESS; |
| 1915 | } |
| 1916 | |
| 1917 | /** |
| 1918 | * dp_clear_peer() - remove peer from physical device |
| 1919 | * @pdev - data path device instance |
| 1920 | * @sta_id - local peer id |
| 1921 | * |
| 1922 | * remove peer from physical device |
| 1923 | * |
| 1924 | * Return: QDF_STATUS_SUCCESS registration success |
| 1925 | * QDF_STATUS_E_FAULT peer not found |
| 1926 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1927 | QDF_STATUS dp_clear_peer(struct cdp_pdev *pdev_handle, uint8_t local_id) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1928 | { |
| 1929 | struct dp_peer *peer; |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1930 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1931 | |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1932 | peer = dp_peer_find_by_local_id((struct cdp_pdev *)pdev, local_id); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1933 | if (!peer) |
| 1934 | return QDF_STATUS_E_FAULT; |
| 1935 | |
| 1936 | qdf_spin_lock_bh(&peer->peer_info_lock); |
| 1937 | peer->state = OL_TXRX_PEER_STATE_DISC; |
| 1938 | qdf_spin_unlock_bh(&peer->peer_info_lock); |
| 1939 | |
| 1940 | return QDF_STATUS_SUCCESS; |
| 1941 | } |
| 1942 | |
| 1943 | /** |
| 1944 | * dp_find_peer_by_addr_and_vdev() - Find peer by peer mac address within vdev |
| 1945 | * @pdev - data path device instance |
| 1946 | * @vdev - virtual interface instance |
| 1947 | * @peer_addr - peer mac address |
| 1948 | * @peer_id - local peer id with target mac address |
| 1949 | * |
| 1950 | * Find peer by peer mac address within vdev |
| 1951 | * |
| 1952 | * Return: peer instance void pointer |
| 1953 | * NULL cannot find target peer |
| 1954 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1955 | void *dp_find_peer_by_addr_and_vdev(struct cdp_pdev *pdev_handle, |
| 1956 | struct cdp_vdev *vdev_handle, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1957 | uint8_t *peer_addr, uint8_t *local_id) |
| 1958 | { |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 1959 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
| 1960 | struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1961 | struct dp_peer *peer; |
| 1962 | |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1963 | DP_TRACE(INFO, "vdev %pK peer_addr %pK", vdev, peer_addr); |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 1964 | peer = dp_peer_find_hash_find(pdev->soc, peer_addr, 0, 0); |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 1965 | DP_TRACE(INFO, "peer %pK vdev %pK", peer, vdev); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1966 | |
| 1967 | if (!peer) |
| 1968 | return NULL; |
| 1969 | |
| 1970 | if (peer->vdev != vdev) |
| 1971 | return NULL; |
| 1972 | |
| 1973 | *local_id = peer->local_id; |
Yun Park | 11d46e0 | 2017-11-27 10:51:53 -0800 | [diff] [blame] | 1974 | DP_TRACE(INFO, "peer %pK vdev %pK local id %d", peer, vdev, *local_id); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1975 | |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 1976 | /* ref_cnt is incremented inside dp_peer_find_hash_find(). |
| 1977 | * Decrement it here. |
| 1978 | */ |
| 1979 | qdf_atomic_dec(&peer->ref_cnt); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 1980 | |
| 1981 | return peer; |
| 1982 | } |
| 1983 | |
| 1984 | /** |
| 1985 | * dp_local_peer_id() - Find local peer id within peer instance |
| 1986 | * @peer - peer instance |
| 1987 | * |
| 1988 | * Find local peer id within peer instance |
| 1989 | * |
| 1990 | * Return: local peer id |
| 1991 | */ |
| 1992 | uint16_t dp_local_peer_id(void *peer) |
| 1993 | { |
| 1994 | return ((struct dp_peer *)peer)->local_id; |
| 1995 | } |
| 1996 | |
| 1997 | /** |
| 1998 | * dp_peer_find_by_local_id() - Find peer by local peer id |
| 1999 | * @pdev - data path device instance |
| 2000 | * @local_peer_id - local peer id want to find |
| 2001 | * |
| 2002 | * Find peer by local peer id within physical device |
| 2003 | * |
| 2004 | * Return: peer instance void pointer |
| 2005 | * NULL cannot find target peer |
| 2006 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2007 | void *dp_peer_find_by_local_id(struct cdp_pdev *pdev_handle, uint8_t local_id) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2008 | { |
| 2009 | struct dp_peer *peer; |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2010 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2011 | |
| 2012 | qdf_spin_lock_bh(&pdev->local_peer_ids.lock); |
| 2013 | peer = pdev->local_peer_ids.map[local_id]; |
| 2014 | qdf_spin_unlock_bh(&pdev->local_peer_ids.lock); |
Yun Park | 11d46e0 | 2017-11-27 10:51:53 -0800 | [diff] [blame] | 2015 | DP_TRACE(DEBUG, "peer %pK local id %d", peer, local_id); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2016 | return peer; |
| 2017 | } |
| 2018 | |
| 2019 | /** |
| 2020 | * dp_peer_state_update() - update peer local state |
| 2021 | * @pdev - data path device instance |
| 2022 | * @peer_addr - peer mac address |
| 2023 | * @state - new peer local state |
| 2024 | * |
| 2025 | * update peer local state |
| 2026 | * |
| 2027 | * Return: QDF_STATUS_SUCCESS registration success |
| 2028 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2029 | QDF_STATUS dp_peer_state_update(struct cdp_pdev *pdev_handle, uint8_t *peer_mac, |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2030 | enum ol_txrx_peer_state state) |
| 2031 | { |
| 2032 | struct dp_peer *peer; |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2033 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2034 | |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 2035 | peer = dp_peer_find_hash_find(pdev->soc, peer_mac, 0, 0); |
Ankit Gupta | 6fb389b | 2017-01-03 12:23:45 -0800 | [diff] [blame] | 2036 | if (NULL == peer) { |
| 2037 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2038 | "Failed to find peer for: [%pM]", peer_mac); |
| 2039 | return QDF_STATUS_E_FAILURE; |
| 2040 | } |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2041 | peer->state = state; |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 2042 | |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2043 | DP_TRACE(INFO, "peer %pK state %d", peer, peer->state); |
Krishna Kumaar Natarajan | 71e5b83 | 2017-01-26 08:04:13 -0800 | [diff] [blame] | 2044 | /* ref_cnt is incremented inside dp_peer_find_hash_find(). |
| 2045 | * Decrement it here. |
| 2046 | */ |
| 2047 | qdf_atomic_dec(&peer->ref_cnt); |
| 2048 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2049 | return QDF_STATUS_SUCCESS; |
| 2050 | } |
| 2051 | |
| 2052 | /** |
| 2053 | * dp_get_vdevid() - Get virtaul interface id which peer registered |
| 2054 | * @peer - peer instance |
| 2055 | * @vdev_id - virtaul interface id which peer registered |
| 2056 | * |
| 2057 | * Get virtaul interface id which peer registered |
| 2058 | * |
| 2059 | * Return: QDF_STATUS_SUCCESS registration success |
| 2060 | */ |
| 2061 | QDF_STATUS dp_get_vdevid(void *peer_handle, uint8_t *vdev_id) |
| 2062 | { |
| 2063 | struct dp_peer *peer = peer_handle; |
| 2064 | |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2065 | DP_TRACE(INFO, "peer %pK vdev %pK vdev id %d", |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2066 | peer, peer->vdev, peer->vdev->vdev_id); |
| 2067 | *vdev_id = peer->vdev->vdev_id; |
| 2068 | return QDF_STATUS_SUCCESS; |
| 2069 | } |
| 2070 | |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2071 | struct cdp_vdev *dp_get_vdev_by_sta_id(struct cdp_pdev *pdev_handle, |
| 2072 | uint8_t sta_id) |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2073 | { |
Yun Park | 601d0d8 | 2017-08-28 21:49:31 -0700 | [diff] [blame] | 2074 | struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle; |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2075 | struct dp_peer *peer = NULL; |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2076 | |
| 2077 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
| 2078 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 2079 | "Invalid sta id passed"); |
| 2080 | return NULL; |
| 2081 | } |
| 2082 | |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 2083 | if (!pdev) { |
| 2084 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 2085 | "PDEV not found for sta_id [%d]", sta_id); |
| 2086 | return NULL; |
| 2087 | } |
| 2088 | |
| 2089 | peer = dp_peer_find_by_local_id((struct cdp_pdev *)pdev, sta_id); |
| 2090 | if (!peer) { |
| 2091 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH, |
| 2092 | "PEER [%d] not found", sta_id); |
| 2093 | return NULL; |
| 2094 | } |
| 2095 | |
| 2096 | return (struct cdp_vdev *)peer->vdev; |
| 2097 | } |
| 2098 | |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2099 | /** |
| 2100 | * dp_get_vdev_for_peer() - Get virtual interface instance which peer belongs |
| 2101 | * @peer - peer instance |
| 2102 | * |
| 2103 | * Get virtual interface instance which peer belongs |
| 2104 | * |
| 2105 | * Return: virtual interface instance pointer |
| 2106 | * NULL in case cannot find |
| 2107 | */ |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2108 | struct cdp_vdev *dp_get_vdev_for_peer(void *peer_handle) |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2109 | { |
| 2110 | struct dp_peer *peer = peer_handle; |
| 2111 | |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2112 | DP_TRACE(INFO, "peer %pK vdev %pK", peer, peer->vdev); |
Venkata Sharath Chandra Manchala | f2a125a | 2016-11-28 18:10:11 -0800 | [diff] [blame] | 2113 | return (struct cdp_vdev *)peer->vdev; |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2114 | } |
| 2115 | |
| 2116 | /** |
| 2117 | * dp_peer_get_peer_mac_addr() - Get peer mac address |
| 2118 | * @peer - peer instance |
| 2119 | * |
| 2120 | * Get peer mac address |
| 2121 | * |
| 2122 | * Return: peer mac address pointer |
| 2123 | * NULL in case cannot find |
| 2124 | */ |
| 2125 | uint8_t *dp_peer_get_peer_mac_addr(void *peer_handle) |
| 2126 | { |
| 2127 | struct dp_peer *peer = peer_handle; |
| 2128 | uint8_t *mac; |
| 2129 | |
| 2130 | mac = peer->mac_addr.raw; |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2131 | DP_TRACE(INFO, "peer %pK mac 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2132 | peer, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); |
| 2133 | return peer->mac_addr.raw; |
| 2134 | } |
| 2135 | |
| 2136 | /** |
| 2137 | * dp_get_peer_state() - Get local peer state |
| 2138 | * @peer - peer instance |
| 2139 | * |
| 2140 | * Get local peer state |
| 2141 | * |
| 2142 | * Return: peer status |
| 2143 | */ |
| 2144 | int dp_get_peer_state(void *peer_handle) |
| 2145 | { |
| 2146 | struct dp_peer *peer = peer_handle; |
| 2147 | |
Yun Park | 11d46e0 | 2017-11-27 10:51:53 -0800 | [diff] [blame] | 2148 | DP_TRACE(DEBUG, "peer %pK stats %d", peer, peer->state); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2149 | return peer->state; |
| 2150 | } |
| 2151 | |
| 2152 | /** |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 2153 | * dp_get_last_assoc_received() - get time of last assoc received |
| 2154 | * @peer_handle: peer handle |
| 2155 | * |
| 2156 | * Return: pointer for the time of last assoc received |
| 2157 | */ |
| 2158 | qdf_time_t *dp_get_last_assoc_received(void *peer_handle) |
| 2159 | { |
| 2160 | struct dp_peer *peer = peer_handle; |
| 2161 | |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2162 | DP_TRACE(INFO, "peer %pK last_assoc_rcvd: %lu", peer, |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 2163 | peer->last_assoc_rcvd); |
| 2164 | return &peer->last_assoc_rcvd; |
| 2165 | } |
| 2166 | |
| 2167 | /** |
| 2168 | * dp_get_last_disassoc_received() - get time of last disassoc received |
| 2169 | * @peer_handle: peer handle |
| 2170 | * |
| 2171 | * Return: pointer for the time of last disassoc received |
| 2172 | */ |
| 2173 | qdf_time_t *dp_get_last_disassoc_received(void *peer_handle) |
| 2174 | { |
| 2175 | struct dp_peer *peer = peer_handle; |
| 2176 | |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2177 | DP_TRACE(INFO, "peer %pK last_disassoc_rcvd: %lu", peer, |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 2178 | peer->last_disassoc_rcvd); |
| 2179 | return &peer->last_disassoc_rcvd; |
| 2180 | } |
| 2181 | |
| 2182 | /** |
| 2183 | * dp_get_last_deauth_received() - get time of last deauth received |
| 2184 | * @peer_handle: peer handle |
| 2185 | * |
| 2186 | * Return: pointer for the time of last deauth received |
| 2187 | */ |
| 2188 | qdf_time_t *dp_get_last_deauth_received(void *peer_handle) |
| 2189 | { |
| 2190 | struct dp_peer *peer = peer_handle; |
| 2191 | |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2192 | DP_TRACE(INFO, "peer %pK last_deauth_rcvd: %lu", peer, |
Krishna Kumaar Natarajan | d684ba2 | 2017-01-25 15:48:43 -0800 | [diff] [blame] | 2193 | peer->last_deauth_rcvd); |
| 2194 | return &peer->last_deauth_rcvd; |
| 2195 | } |
| 2196 | |
| 2197 | /** |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2198 | * dp_local_peer_id_pool_init() - local peer id pool alloc for physical device |
| 2199 | * @pdev - data path device instance |
| 2200 | * |
| 2201 | * local peer id pool alloc for physical device |
| 2202 | * |
| 2203 | * Return: none |
| 2204 | */ |
| 2205 | void dp_local_peer_id_pool_init(struct dp_pdev *pdev) |
| 2206 | { |
| 2207 | int i; |
| 2208 | |
| 2209 | /* point the freelist to the first ID */ |
| 2210 | pdev->local_peer_ids.freelist = 0; |
| 2211 | |
| 2212 | /* link each ID to the next one */ |
| 2213 | for (i = 0; i < OL_TXRX_NUM_LOCAL_PEER_IDS; i++) { |
| 2214 | pdev->local_peer_ids.pool[i] = i + 1; |
| 2215 | pdev->local_peer_ids.map[i] = NULL; |
| 2216 | } |
| 2217 | |
| 2218 | /* link the last ID to itself, to mark the end of the list */ |
| 2219 | i = OL_TXRX_NUM_LOCAL_PEER_IDS; |
| 2220 | pdev->local_peer_ids.pool[i] = i; |
| 2221 | |
| 2222 | qdf_spinlock_create(&pdev->local_peer_ids.lock); |
| 2223 | DP_TRACE(INFO, "Peer pool init"); |
| 2224 | } |
| 2225 | |
| 2226 | /** |
| 2227 | * dp_local_peer_id_alloc() - allocate local peer id |
| 2228 | * @pdev - data path device instance |
| 2229 | * @peer - new peer instance |
| 2230 | * |
| 2231 | * allocate local peer id |
| 2232 | * |
| 2233 | * Return: none |
| 2234 | */ |
| 2235 | void dp_local_peer_id_alloc(struct dp_pdev *pdev, struct dp_peer *peer) |
| 2236 | { |
| 2237 | int i; |
| 2238 | |
| 2239 | qdf_spin_lock_bh(&pdev->local_peer_ids.lock); |
| 2240 | i = pdev->local_peer_ids.freelist; |
| 2241 | if (pdev->local_peer_ids.pool[i] == i) { |
| 2242 | /* the list is empty, except for the list-end marker */ |
| 2243 | peer->local_id = OL_TXRX_INVALID_LOCAL_PEER_ID; |
| 2244 | } else { |
| 2245 | /* take the head ID and advance the freelist */ |
| 2246 | peer->local_id = i; |
| 2247 | pdev->local_peer_ids.freelist = pdev->local_peer_ids.pool[i]; |
| 2248 | pdev->local_peer_ids.map[i] = peer; |
| 2249 | } |
| 2250 | qdf_spin_unlock_bh(&pdev->local_peer_ids.lock); |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2251 | DP_TRACE(INFO, "peer %pK, local id %d", peer, peer->local_id); |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 2252 | } |
| 2253 | |
| 2254 | /** |
| 2255 | * dp_local_peer_id_free() - remove local peer id |
| 2256 | * @pdev - data path device instance |
| 2257 | * @peer - peer instance should be removed |
| 2258 | * |
| 2259 | * remove local peer id |
| 2260 | * |
| 2261 | * Return: none |
| 2262 | */ |
| 2263 | void dp_local_peer_id_free(struct dp_pdev *pdev, struct dp_peer *peer) |
| 2264 | { |
| 2265 | int i = peer->local_id; |
| 2266 | if ((i == OL_TXRX_INVALID_LOCAL_PEER_ID) || |
| 2267 | (i >= OL_TXRX_NUM_LOCAL_PEER_IDS)) { |
| 2268 | return; |
| 2269 | } |
| 2270 | |
| 2271 | /* put this ID on the head of the freelist */ |
| 2272 | qdf_spin_lock_bh(&pdev->local_peer_ids.lock); |
| 2273 | pdev->local_peer_ids.pool[i] = pdev->local_peer_ids.freelist; |
| 2274 | pdev->local_peer_ids.freelist = i; |
| 2275 | pdev->local_peer_ids.map[i] = NULL; |
| 2276 | qdf_spin_unlock_bh(&pdev->local_peer_ids.lock); |
| 2277 | } |
Nandha Kishore Easwaran | fd7832e | 2016-11-20 18:22:48 +0530 | [diff] [blame] | 2278 | #endif |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 2279 | |
| 2280 | /** |
| 2281 | * dp_get_peer_mac_addr_frm_id(): get mac address of the peer |
| 2282 | * @soc_handle: DP SOC handle |
| 2283 | * @peer_id:peer_id of the peer |
| 2284 | * |
| 2285 | * return: vdev_id of the vap |
| 2286 | */ |
| 2287 | uint8_t dp_get_peer_mac_addr_frm_id(struct cdp_soc_t *soc_handle, |
| 2288 | uint16_t peer_id, uint8_t *peer_mac) |
| 2289 | { |
| 2290 | struct dp_soc *soc = (struct dp_soc *)soc_handle; |
| 2291 | struct dp_peer *peer; |
| 2292 | |
| 2293 | peer = dp_peer_find_by_id(soc, peer_id); |
| 2294 | |
| 2295 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 3f217e2 | 2017-09-18 10:13:35 -0700 | [diff] [blame] | 2296 | "soc %pK peer_id %d", soc, peer_id); |
Ishank Jain | 1e7401c | 2017-02-17 15:38:39 +0530 | [diff] [blame] | 2297 | |
| 2298 | if (!peer) { |
| 2299 | QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, |
| 2300 | "peer not found "); |
| 2301 | return CDP_INVALID_VDEV_ID; |
| 2302 | } |
| 2303 | |
| 2304 | qdf_mem_copy(peer_mac, peer->mac_addr.raw, 6); |
| 2305 | return peer->vdev->vdev_id; |
| 2306 | } |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 2307 | |
| 2308 | /** |
| 2309 | * dp_peer_rxtid_stats: Retried Rx TID (REO queue) stats from HW |
| 2310 | * @peer: DP peer handle |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 2311 | * @dp_stats_cmd_cb: REO command callback function |
| 2312 | * @cb_ctxt: Callback context |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 2313 | * |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 2314 | * Return: none |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 2315 | */ |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 2316 | void dp_peer_rxtid_stats(struct dp_peer *peer, void (*dp_stats_cmd_cb), |
| 2317 | void *cb_ctxt) |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 2318 | { |
| 2319 | struct dp_soc *soc = peer->vdev->pdev->soc; |
| 2320 | struct hal_reo_cmd_params params; |
| 2321 | int i; |
| 2322 | |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 2323 | if (!dp_stats_cmd_cb) |
| 2324 | return; |
| 2325 | |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 2326 | qdf_mem_zero(¶ms, sizeof(params)); |
| 2327 | for (i = 0; i < DP_MAX_TIDS; i++) { |
| 2328 | struct dp_rx_tid *rx_tid = &peer->rx_tid[i]; |
| 2329 | if (rx_tid->hw_qdesc_vaddr_unaligned != NULL) { |
| 2330 | params.std.need_status = 1; |
| 2331 | params.std.addr_lo = |
| 2332 | rx_tid->hw_qdesc_paddr & 0xffffffff; |
| 2333 | params.std.addr_hi = |
| 2334 | (uint64_t)(rx_tid->hw_qdesc_paddr) >> 32; |
Pratik Gandhi | 51b6b6d | 2017-09-18 15:02:43 +0530 | [diff] [blame] | 2335 | |
| 2336 | if (cb_ctxt) { |
| 2337 | dp_reo_send_cmd(soc, CMD_GET_QUEUE_STATS, |
| 2338 | ¶ms, dp_stats_cmd_cb, cb_ctxt); |
| 2339 | } else { |
| 2340 | dp_reo_send_cmd(soc, CMD_GET_QUEUE_STATS, |
| 2341 | ¶ms, dp_stats_cmd_cb, rx_tid); |
| 2342 | } |
Karunakar Dasineni | 3da0811 | 2017-06-15 14:42:39 -0700 | [diff] [blame] | 2343 | |
| 2344 | /* Flush REO descriptor from HW cache to update stats |
| 2345 | * in descriptor memory. This is to help debugging */ |
| 2346 | qdf_mem_zero(¶ms, sizeof(params)); |
| 2347 | params.std.need_status = 0; |
| 2348 | params.std.addr_lo = |
| 2349 | rx_tid->hw_qdesc_paddr & 0xffffffff; |
| 2350 | params.std.addr_hi = |
| 2351 | (uint64_t)(rx_tid->hw_qdesc_paddr) >> 32; |
Karunakar Dasineni | 25f1b04 | 2018-02-15 23:26:17 -0800 | [diff] [blame] | 2352 | params.u.fl_cache_params.flush_no_inval = 1; |
Karunakar Dasineni | 3da0811 | 2017-06-15 14:42:39 -0700 | [diff] [blame] | 2353 | dp_reo_send_cmd(soc, CMD_FLUSH_CACHE, ¶ms, NULL, |
| 2354 | NULL); |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 2355 | } |
| 2356 | } |
Karunakar Dasineni | 93f633c | 2017-06-02 19:04:46 -0700 | [diff] [blame] | 2357 | } |
Chaithanya Garrepalli | 0323f80 | 2018-03-14 17:45:21 +0530 | [diff] [blame] | 2358 | |