Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Himanshu Agarwal | a79c676 | 2017-12-28 21:25:00 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 20 | * This file lim_utils.cc contains the utility functions |
| 21 | * LIM uses. |
| 22 | * Author: Chandra Modumudi |
| 23 | * Date: 02/13/02 |
| 24 | * History:- |
| 25 | * Date Modified by Modification Information |
| 26 | * -------------------------------------------------------------------- |
| 27 | */ |
| 28 | |
| 29 | #include "sch_api.h" |
| 30 | #include "lim_utils.h" |
| 31 | #include "lim_types.h" |
| 32 | #include "lim_security_utils.h" |
| 33 | #include "lim_prop_exts_utils.h" |
| 34 | #include "lim_send_messages.h" |
| 35 | #include "lim_ser_des_utils.h" |
| 36 | #include "lim_admit_control.h" |
| 37 | #include "lim_sta_hash_api.h" |
| 38 | #include "dot11f.h" |
| 39 | #include "dot11fdefs.h" |
| 40 | #include "wmm_apsd.h" |
| 41 | #include "lim_trace.h" |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 42 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 43 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 44 | #include "host_diag_core_event.h" |
| 45 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 46 | #include "lim_ibss_peer_mgmt.h" |
| 47 | #include "lim_session_utils.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | #include "lim_session.h" |
| 50 | #include "cds_reg_service.h" |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 51 | #include "nan_datapath.h" |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 52 | #include "wma.h" |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 53 | #include "wlan_reg_services_api.h" |
Ajit Pal Singh | 7ae88fb | 2017-09-06 16:14:35 +0530 | [diff] [blame] | 54 | #include "wlan_policy_mgr_api.h" |
Vignesh Viswanathan | 21c58cb | 2018-05-24 15:53:58 +0530 | [diff] [blame] | 55 | #include "wlan_mlme_public_struct.h" |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 56 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 57 | #include "wma_he.h" |
| 58 | #endif |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 59 | #include "wlan_utility.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 60 | |
| 61 | #ifdef WLAN_FEATURE_11W |
| 62 | #include "wni_cfg.h" |
| 63 | #endif |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 64 | #include "cfg_mlme_obss_ht40.h" |
| 65 | #include "cfg_ucfg_api.h" |
Jianmin Zhu | 0923660 | 2018-10-15 15:36:10 +0800 | [diff] [blame] | 66 | #include "lim_ft.h" |
gaurank kathpalia | 24ed0f4 | 2018-11-13 15:37:49 +0530 | [diff] [blame] | 67 | #include "wlan_mlme_main.h" |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 68 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | #define ASCII_SPACE_CHARACTER 0x20 |
| 70 | |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 71 | /* A DFS channel can be ACTIVE for max 9000 msec, from the last |
| 72 | received Beacon/Prpbe Resp. */ |
| 73 | #define MAX_TIME_TO_BE_ACTIVE_CHANNEL 9000 |
| 74 | |
| 75 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 76 | /** ------------------------------------------------------------- |
| 77 | \fn lim_delete_dialogue_token_list |
| 78 | \brief deletes the complete lim dialogue token linked list. |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 79 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | \return None |
| 81 | -------------------------------------------------------------*/ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 82 | void lim_delete_dialogue_token_list(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 83 | { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 84 | tpDialogueToken pCurrNode = mac->lim.pDialogueTokenHead; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 85 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 86 | while (NULL != mac->lim.pDialogueTokenHead) { |
| 87 | pCurrNode = mac->lim.pDialogueTokenHead; |
| 88 | mac->lim.pDialogueTokenHead = |
| 89 | mac->lim.pDialogueTokenHead->next; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 90 | qdf_mem_free(pCurrNode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 91 | pCurrNode = NULL; |
| 92 | } |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 93 | mac->lim.pDialogueTokenTail = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | char *lim_dot11_reason_str(uint16_t reasonCode) |
| 97 | { |
| 98 | switch (reasonCode) { |
| 99 | case 0: |
| 100 | return " "; |
| 101 | CASE_RETURN_STRING(eSIR_MAC_UNSPEC_FAILURE_REASON); |
| 102 | CASE_RETURN_STRING(eSIR_MAC_PREV_AUTH_NOT_VALID_REASON); |
| 103 | CASE_RETURN_STRING(eSIR_MAC_DEAUTH_LEAVING_BSS_REASON); |
| 104 | CASE_RETURN_STRING(eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON); |
| 105 | CASE_RETURN_STRING(eSIR_MAC_DISASSOC_DUE_TO_DISABILITY_REASON); |
| 106 | CASE_RETURN_STRING |
| 107 | (eSIR_MAC_CLASS2_FRAME_FROM_NON_AUTH_STA_REASON); |
| 108 | CASE_RETURN_STRING |
| 109 | (eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON); |
| 110 | CASE_RETURN_STRING(eSIR_MAC_DISASSOC_LEAVING_BSS_REASON); |
| 111 | CASE_RETURN_STRING(eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON); |
| 112 | CASE_RETURN_STRING(eSIR_MAC_PWR_CAPABILITY_BAD_REASON); |
| 113 | CASE_RETURN_STRING(eSIR_MAC_SPRTD_CHANNELS_BAD_REASON); |
| 114 | |
| 115 | CASE_RETURN_STRING(eSIR_MAC_INVALID_IE_REASON); |
| 116 | CASE_RETURN_STRING(eSIR_MAC_MIC_FAILURE_REASON); |
| 117 | CASE_RETURN_STRING(eSIR_MAC_4WAY_HANDSHAKE_TIMEOUT_REASON); |
| 118 | CASE_RETURN_STRING(eSIR_MAC_GR_KEY_UPDATE_TIMEOUT_REASON); |
| 119 | CASE_RETURN_STRING(eSIR_MAC_RSN_IE_MISMATCH_REASON); |
| 120 | |
| 121 | CASE_RETURN_STRING(eSIR_MAC_INVALID_MC_CIPHER_REASON); |
| 122 | CASE_RETURN_STRING(eSIR_MAC_INVALID_UC_CIPHER_REASON); |
| 123 | CASE_RETURN_STRING(eSIR_MAC_INVALID_AKMP_REASON); |
| 124 | CASE_RETURN_STRING(eSIR_MAC_UNSUPPORTED_RSN_IE_VER_REASON); |
| 125 | CASE_RETURN_STRING(eSIR_MAC_INVALID_RSN_CAPABILITIES_REASON); |
| 126 | CASE_RETURN_STRING(eSIR_MAC_1X_AUTH_FAILURE_REASON); |
| 127 | CASE_RETURN_STRING(eSIR_MAC_CIPHER_SUITE_REJECTED_REASON); |
| 128 | #ifdef FEATURE_WLAN_TDLS |
| 129 | CASE_RETURN_STRING(eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE); |
| 130 | CASE_RETURN_STRING(eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
| 131 | #endif |
| 132 | /* Reserved 27 - 30 */ |
| 133 | #ifdef WLAN_FEATURE_11W |
| 134 | CASE_RETURN_STRING |
| 135 | (eSIR_MAC_ROBUST_MGMT_FRAMES_POLICY_VIOLATION); |
| 136 | #endif |
| 137 | CASE_RETURN_STRING(eSIR_MAC_QOS_UNSPECIFIED_REASON); |
| 138 | CASE_RETURN_STRING(eSIR_MAC_QAP_NO_BANDWIDTH_REASON); |
| 139 | CASE_RETURN_STRING(eSIR_MAC_XS_UNACKED_FRAMES_REASON); |
| 140 | CASE_RETURN_STRING(eSIR_MAC_BAD_TXOP_USE_REASON); |
| 141 | CASE_RETURN_STRING(eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON); |
| 142 | CASE_RETURN_STRING(eSIR_MAC_PEER_REJECT_MECHANISIM_REASON); |
| 143 | CASE_RETURN_STRING(eSIR_MAC_MECHANISM_NOT_SETUP_REASON); |
| 144 | |
| 145 | CASE_RETURN_STRING(eSIR_MAC_PEER_TIMEDOUT_REASON); |
| 146 | CASE_RETURN_STRING(eSIR_MAC_CIPHER_NOT_SUPPORTED_REASON); |
| 147 | CASE_RETURN_STRING(eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON); |
| 148 | /* Reserved 47 - 65535 */ |
| 149 | default: |
| 150 | return "Unknown"; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | char *lim_mlm_state_str(tLimMlmStates state) |
| 155 | { |
| 156 | switch (state) { |
| 157 | case eLIM_MLM_OFFLINE_STATE: |
| 158 | return "eLIM_MLM_OFFLINE_STATE"; |
| 159 | case eLIM_MLM_IDLE_STATE: |
| 160 | return "eLIM_MLM_IDLE_STATE"; |
| 161 | case eLIM_MLM_WT_PROBE_RESP_STATE: |
| 162 | return "eLIM_MLM_WT_PROBE_RESP_STATE"; |
| 163 | case eLIM_MLM_PASSIVE_SCAN_STATE: |
| 164 | return "eLIM_MLM_PASSIVE_SCAN_STATE"; |
| 165 | case eLIM_MLM_WT_JOIN_BEACON_STATE: |
| 166 | return "eLIM_MLM_WT_JOIN_BEACON_STATE"; |
| 167 | case eLIM_MLM_JOINED_STATE: |
| 168 | return "eLIM_MLM_JOINED_STATE"; |
| 169 | case eLIM_MLM_BSS_STARTED_STATE: |
| 170 | return "eLIM_MLM_BSS_STARTED_STATE"; |
| 171 | case eLIM_MLM_WT_AUTH_FRAME2_STATE: |
| 172 | return "eLIM_MLM_WT_AUTH_FRAME2_STATE"; |
| 173 | case eLIM_MLM_WT_AUTH_FRAME3_STATE: |
| 174 | return "eLIM_MLM_WT_AUTH_FRAME3_STATE"; |
| 175 | case eLIM_MLM_WT_AUTH_FRAME4_STATE: |
| 176 | return "eLIM_MLM_WT_AUTH_FRAME4_STATE"; |
| 177 | case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE: |
| 178 | return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE"; |
| 179 | case eLIM_MLM_AUTHENTICATED_STATE: |
| 180 | return "eLIM_MLM_AUTHENTICATED_STATE"; |
| 181 | case eLIM_MLM_WT_ASSOC_RSP_STATE: |
| 182 | return "eLIM_MLM_WT_ASSOC_RSP_STATE"; |
| 183 | case eLIM_MLM_WT_REASSOC_RSP_STATE: |
| 184 | return "eLIM_MLM_WT_REASSOC_RSP_STATE"; |
| 185 | case eLIM_MLM_WT_FT_REASSOC_RSP_STATE: |
| 186 | return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE"; |
| 187 | case eLIM_MLM_WT_DEL_STA_RSP_STATE: |
| 188 | return "eLIM_MLM_WT_DEL_STA_RSP_STATE"; |
| 189 | case eLIM_MLM_WT_DEL_BSS_RSP_STATE: |
| 190 | return "eLIM_MLM_WT_DEL_BSS_RSP_STATE"; |
| 191 | case eLIM_MLM_WT_ADD_STA_RSP_STATE: |
| 192 | return "eLIM_MLM_WT_ADD_STA_RSP_STATE"; |
| 193 | case eLIM_MLM_WT_ADD_BSS_RSP_STATE: |
| 194 | return "eLIM_MLM_WT_ADD_BSS_RSP_STATE"; |
| 195 | case eLIM_MLM_REASSOCIATED_STATE: |
| 196 | return "eLIM_MLM_REASSOCIATED_STATE"; |
| 197 | case eLIM_MLM_LINK_ESTABLISHED_STATE: |
| 198 | return "eLIM_MLM_LINK_ESTABLISHED_STATE"; |
| 199 | case eLIM_MLM_WT_ASSOC_CNF_STATE: |
| 200 | return "eLIM_MLM_WT_ASSOC_CNF_STATE"; |
| 201 | case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE: |
| 202 | return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE"; |
| 203 | case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE: |
| 204 | return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE"; |
| 205 | case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE: |
| 206 | return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE"; |
| 207 | case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE: |
| 208 | return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE"; |
| 209 | case eLIM_MLM_WT_SET_BSS_KEY_STATE: |
| 210 | return "eLIM_MLM_WT_SET_BSS_KEY_STATE"; |
| 211 | case eLIM_MLM_WT_SET_STA_KEY_STATE: |
| 212 | return "eLIM_MLM_WT_SET_STA_KEY_STATE"; |
| 213 | default: |
| 214 | return "INVALID MLM state"; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 219 | lim_print_mlm_state(struct mac_context *mac, uint16_t logLevel, tLimMlmStates state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 220 | { |
Srinivas Girigowda | 4bc512b | 2017-03-26 22:12:58 -0700 | [diff] [blame] | 221 | pe_debug("Mlm state: %s", lim_mlm_state_str(state)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | char *lim_sme_state_str(tLimSmeStates state) |
| 225 | { |
| 226 | switch (state) { |
| 227 | case eLIM_SME_OFFLINE_STATE: |
| 228 | return "eLIM_SME_OFFLINE_STATE"; |
| 229 | case eLIM_SME_IDLE_STATE: |
| 230 | return "eLIM_SME_OFFLINE_STATE"; |
| 231 | case eLIM_SME_SUSPEND_STATE: |
| 232 | return "eLIM_SME_SUSPEND_STATE"; |
| 233 | case eLIM_SME_WT_SCAN_STATE: |
| 234 | return "eLIM_SME_WT_SCAN_STATE"; |
| 235 | case eLIM_SME_WT_JOIN_STATE: |
| 236 | return "eLIM_SME_WT_JOIN_STATE"; |
| 237 | case eLIM_SME_WT_AUTH_STATE: |
| 238 | return "eLIM_SME_WT_AUTH_STATE"; |
| 239 | case eLIM_SME_WT_ASSOC_STATE: |
| 240 | return "eLIM_SME_WT_ASSOC_STATE"; |
| 241 | case eLIM_SME_WT_REASSOC_STATE: |
| 242 | return "eLIM_SME_WT_REASSOC_STATE"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 243 | case eLIM_SME_JOIN_FAILURE_STATE: |
| 244 | return "eLIM_SME_JOIN_FAILURE_STATE"; |
| 245 | case eLIM_SME_ASSOCIATED_STATE: |
| 246 | return "eLIM_SME_ASSOCIATED_STATE"; |
| 247 | case eLIM_SME_REASSOCIATED_STATE: |
| 248 | return "eLIM_SME_REASSOCIATED_STATE"; |
| 249 | case eLIM_SME_LINK_EST_STATE: |
| 250 | return "eLIM_SME_LINK_EST_STATE"; |
| 251 | case eLIM_SME_LINK_EST_WT_SCAN_STATE: |
| 252 | return "eLIM_SME_LINK_EST_WT_SCAN_STATE"; |
| 253 | case eLIM_SME_WT_PRE_AUTH_STATE: |
| 254 | return "eLIM_SME_WT_PRE_AUTH_STATE"; |
| 255 | case eLIM_SME_WT_DISASSOC_STATE: |
| 256 | return "eLIM_SME_WT_DISASSOC_STATE"; |
| 257 | case eLIM_SME_WT_DEAUTH_STATE: |
| 258 | return "eLIM_SME_WT_DEAUTH_STATE"; |
| 259 | case eLIM_SME_WT_START_BSS_STATE: |
| 260 | return "eLIM_SME_WT_START_BSS_STATE"; |
| 261 | case eLIM_SME_WT_STOP_BSS_STATE: |
| 262 | return "eLIM_SME_WT_STOP_BSS_STATE"; |
| 263 | case eLIM_SME_NORMAL_STATE: |
| 264 | return "eLIM_SME_NORMAL_STATE"; |
| 265 | case eLIM_SME_CHANNEL_SCAN_STATE: |
| 266 | return "eLIM_SME_CHANNEL_SCAN_STATE"; |
| 267 | case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: |
| 268 | return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE"; |
| 269 | default: |
| 270 | return "INVALID SME STATE"; |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 275 | lim_print_sme_state(struct mac_context *mac, uint16_t logLevel, tLimSmeStates state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 276 | { |
Srinivas Girigowda | 4bc512b | 2017-03-26 22:12:58 -0700 | [diff] [blame] | 277 | pe_debug("SME state: %s", lim_sme_state_str(state)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | char *lim_msg_str(uint32_t msgType) |
| 281 | { |
| 282 | #ifdef FIXME_GEN6 |
| 283 | switch (msgType) { |
| 284 | case eWNI_SME_SYS_READY_IND: |
| 285 | return "eWNI_SME_SYS_READY_IND"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 286 | case eWNI_SME_JOIN_REQ: |
| 287 | return "eWNI_SME_JOIN_REQ"; |
| 288 | case eWNI_SME_JOIN_RSP: |
| 289 | return "eWNI_SME_JOIN_RSP"; |
| 290 | case eWNI_SME_SETCONTEXT_REQ: |
| 291 | return "eWNI_SME_SETCONTEXT_REQ"; |
| 292 | case eWNI_SME_SETCONTEXT_RSP: |
| 293 | return "eWNI_SME_SETCONTEXT_RSP"; |
| 294 | case eWNI_SME_REASSOC_REQ: |
| 295 | return "eWNI_SME_REASSOC_REQ"; |
| 296 | case eWNI_SME_REASSOC_RSP: |
| 297 | return "eWNI_SME_REASSOC_RSP"; |
| 298 | case eWNI_SME_DISASSOC_REQ: |
| 299 | return "eWNI_SME_DISASSOC_REQ"; |
| 300 | case eWNI_SME_DISASSOC_RSP: |
| 301 | return "eWNI_SME_DISASSOC_RSP"; |
| 302 | case eWNI_SME_DISASSOC_IND: |
| 303 | return "eWNI_SME_DISASSOC_IND"; |
| 304 | case eWNI_SME_DISASSOC_CNF: |
| 305 | return "eWNI_SME_DISASSOC_CNF"; |
| 306 | case eWNI_SME_DEAUTH_REQ: |
| 307 | return "eWNI_SME_DEAUTH_REQ"; |
| 308 | case eWNI_SME_DEAUTH_RSP: |
| 309 | return "eWNI_SME_DEAUTH_RSP"; |
| 310 | case eWNI_SME_DEAUTH_IND: |
| 311 | return "eWNI_SME_DEAUTH_IND"; |
| 312 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 313 | return "eWNI_SME_WM_STATUS_CHANGE_NTF"; |
| 314 | case eWNI_SME_START_BSS_REQ: |
| 315 | return "eWNI_SME_START_BSS_REQ"; |
| 316 | case eWNI_SME_START_BSS_RSP: |
| 317 | return "eWNI_SME_START_BSS_RSP"; |
| 318 | case eWNI_SME_ASSOC_IND: |
| 319 | return "eWNI_SME_ASSOC_IND"; |
| 320 | case eWNI_SME_ASSOC_CNF: |
| 321 | return "eWNI_SME_ASSOC_CNF"; |
| 322 | case eWNI_SME_SWITCH_CHL_IND: |
| 323 | return "eWNI_SME_SWITCH_CHL_IND"; |
| 324 | case eWNI_SME_STOP_BSS_REQ: |
| 325 | return "eWNI_SME_STOP_BSS_REQ"; |
| 326 | case eWNI_SME_STOP_BSS_RSP: |
| 327 | return "eWNI_SME_STOP_BSS_RSP"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 328 | case eWNI_SME_DEAUTH_CNF: |
| 329 | return "eWNI_SME_DEAUTH_CNF"; |
| 330 | case eWNI_SME_ADDTS_REQ: |
| 331 | return "eWNI_SME_ADDTS_REQ"; |
| 332 | case eWNI_SME_ADDTS_RSP: |
| 333 | return "eWNI_SME_ADDTS_RSP"; |
| 334 | case eWNI_SME_DELTS_REQ: |
| 335 | return "eWNI_SME_DELTS_REQ"; |
| 336 | case eWNI_SME_DELTS_RSP: |
| 337 | return "eWNI_SME_DELTS_RSP"; |
| 338 | case eWNI_SME_DELTS_IND: |
| 339 | return "eWNI_SME_DELTS_IND"; |
| 340 | case WMA_SUSPEND_ACTIVITY_RSP: |
| 341 | return "WMA_SUSPEND_ACTIVITY_RSP"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 342 | case SIR_BB_XPORT_MGMT_MSG: |
| 343 | return "SIR_BB_XPORT_MGMT_MSG"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | case SIR_LIM_JOIN_FAIL_TIMEOUT: |
| 345 | return "SIR_LIM_JOIN_FAIL_TIMEOUT"; |
| 346 | case SIR_LIM_AUTH_FAIL_TIMEOUT: |
| 347 | return "SIR_LIM_AUTH_FAIL_TIMEOUT"; |
| 348 | case SIR_LIM_AUTH_RSP_TIMEOUT: |
| 349 | return "SIR_LIM_AUTH_RSP_TIMEOUT"; |
| 350 | case SIR_LIM_ASSOC_FAIL_TIMEOUT: |
| 351 | return "SIR_LIM_ASSOC_FAIL_TIMEOUT"; |
| 352 | case SIR_LIM_REASSOC_FAIL_TIMEOUT: |
| 353 | return "SIR_LIM_REASSOC_FAIL_TIMEOUT"; |
| 354 | case SIR_LIM_HEART_BEAT_TIMEOUT: |
| 355 | return "SIR_LIM_HEART_BEAT_TIMEOUT"; |
| 356 | case SIR_LIM_ADDTS_RSP_TIMEOUT: |
| 357 | return "SIR_LIM_ADDTS_RSP_TIMEOUT"; |
| 358 | case SIR_LIM_LINK_TEST_DURATION_TIMEOUT: |
| 359 | return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT"; |
| 360 | case SIR_LIM_HASH_MISS_THRES_TIMEOUT: |
| 361 | return "SIR_LIM_HASH_MISS_THRES_TIMEOUT"; |
| 362 | case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT: |
| 363 | return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT"; |
| 364 | case SIR_LIM_CNF_WAIT_TIMEOUT: |
| 365 | return "SIR_LIM_CNF_WAIT_TIMEOUT"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 366 | case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT: |
| 367 | return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 368 | case WNI_CFG_PARAM_UPDATE_IND: |
| 369 | return "WNI_CFG_PARAM_UPDATE_IND"; |
| 370 | case WNI_CFG_DNLD_REQ: |
| 371 | return "WNI_CFG_DNLD_REQ"; |
| 372 | case WNI_CFG_DNLD_CNF: |
| 373 | return "WNI_CFG_DNLD_CNF"; |
| 374 | case WNI_CFG_GET_RSP: |
| 375 | return "WNI_CFG_GET_RSP"; |
| 376 | case WNI_CFG_SET_CNF: |
| 377 | return "WNI_CFG_SET_CNF"; |
| 378 | case WNI_CFG_GET_ATTRIB_RSP: |
| 379 | return "WNI_CFG_GET_ATTRIB_RSP"; |
| 380 | case WNI_CFG_ADD_GRP_ADDR_CNF: |
| 381 | return "WNI_CFG_ADD_GRP_ADDR_CNF"; |
| 382 | case WNI_CFG_DEL_GRP_ADDR_CNF: |
| 383 | return "WNI_CFG_DEL_GRP_ADDR_CNF"; |
| 384 | case ANI_CFG_GET_RADIO_STAT_RSP: |
| 385 | return "ANI_CFG_GET_RADIO_STAT_RSP"; |
| 386 | case ANI_CFG_GET_PER_STA_STAT_RSP: |
| 387 | return "ANI_CFG_GET_PER_STA_STAT_RSP"; |
| 388 | case ANI_CFG_GET_AGG_STA_STAT_RSP: |
| 389 | return "ANI_CFG_GET_AGG_STA_STAT_RSP"; |
| 390 | case ANI_CFG_CLEAR_STAT_RSP: |
| 391 | return "ANI_CFG_CLEAR_STAT_RSP"; |
| 392 | case WNI_CFG_DNLD_RSP: |
| 393 | return "WNI_CFG_DNLD_RSP"; |
| 394 | case WNI_CFG_GET_REQ: |
| 395 | return "WNI_CFG_GET_REQ"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 396 | case eWNI_PMC_ENTER_IMPS_RSP: |
| 397 | return "eWNI_PMC_ENTER_IMPS_RSP"; |
| 398 | case eWNI_PMC_EXIT_IMPS_RSP: |
| 399 | return "eWNI_PMC_EXIT_IMPS_RSP"; |
| 400 | case eWNI_PMC_ENTER_BMPS_RSP: |
| 401 | return "eWNI_PMC_ENTER_BMPS_RSP"; |
| 402 | case eWNI_PMC_EXIT_BMPS_RSP: |
| 403 | return "eWNI_PMC_EXIT_BMPS_RSP"; |
| 404 | case eWNI_PMC_EXIT_BMPS_IND: |
| 405 | return "eWNI_PMC_EXIT_BMPS_IND"; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 406 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 407 | case eWNI_SME_GET_TSM_STATS_REQ: |
| 408 | return "eWNI_SME_GET_TSM_STATS_REQ"; |
| 409 | case eWNI_SME_GET_TSM_STATS_RSP: |
| 410 | return "eWNI_SME_GET_TSM_STATS_RSP"; |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 411 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 412 | case eWNI_SME_CSA_OFFLOAD_EVENT: |
| 413 | return "eWNI_SME_CSA_OFFLOAD_EVENT"; |
| 414 | case eWNI_SME_SET_HW_MODE_REQ: |
| 415 | return "eWNI_SME_SET_HW_MODE_REQ"; |
| 416 | case eWNI_SME_SET_HW_MODE_RESP: |
| 417 | return "eWNI_SME_SET_HW_MODE_RESP"; |
| 418 | case eWNI_SME_HW_MODE_TRANS_IND: |
| 419 | return "eWNI_SME_HW_MODE_TRANS_IND"; |
| 420 | default: |
| 421 | return "INVALID SME message"; |
| 422 | } |
| 423 | #endif |
| 424 | return ""; |
| 425 | } |
| 426 | |
| 427 | char *lim_result_code_str(tSirResultCodes resultCode) |
| 428 | { |
| 429 | switch (resultCode) { |
| 430 | case eSIR_SME_SUCCESS: |
| 431 | return "eSIR_SME_SUCCESS"; |
Abhishek Singh | 4294f80 | 2017-08-10 16:37:07 +0530 | [diff] [blame] | 432 | case eSIR_LOGE_EXCEPTION: |
| 433 | return "eSIR_LOGE_EXCEPTION"; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 434 | case eSIR_SME_INVALID_PARAMETERS: |
| 435 | return "eSIR_SME_INVALID_PARAMETERS"; |
| 436 | case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE: |
| 437 | return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE"; |
| 438 | case eSIR_SME_RESOURCES_UNAVAILABLE: |
| 439 | return "eSIR_SME_RESOURCES_UNAVAILABLE"; |
| 440 | case eSIR_SME_SCAN_FAILED: |
| 441 | return "eSIR_SME_SCAN_FAILED"; |
| 442 | case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED: |
| 443 | return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED"; |
| 444 | case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE: |
| 445 | return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE"; |
| 446 | case eSIR_SME_REFUSED: |
| 447 | return "eSIR_SME_REFUSED"; |
| 448 | case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE: |
| 449 | return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE"; |
| 450 | case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE: |
| 451 | return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE"; |
| 452 | case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE: |
| 453 | return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE"; |
| 454 | case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE: |
| 455 | return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE"; |
| 456 | case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED: |
| 457 | return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED"; |
| 458 | case eSIR_SME_AUTH_REFUSED: |
| 459 | return "eSIR_SME_AUTH_REFUSED"; |
| 460 | case eSIR_SME_INVALID_WEP_DEFAULT_KEY: |
| 461 | return "eSIR_SME_INVALID_WEP_DEFAULT_KEY"; |
| 462 | case eSIR_SME_ASSOC_REFUSED: |
| 463 | return "eSIR_SME_ASSOC_REFUSED"; |
| 464 | case eSIR_SME_REASSOC_REFUSED: |
| 465 | return "eSIR_SME_REASSOC_REFUSED"; |
| 466 | case eSIR_SME_STA_NOT_AUTHENTICATED: |
| 467 | return "eSIR_SME_STA_NOT_AUTHENTICATED"; |
| 468 | case eSIR_SME_STA_NOT_ASSOCIATED: |
| 469 | return "eSIR_SME_STA_NOT_ASSOCIATED"; |
| 470 | case eSIR_SME_ALREADY_JOINED_A_BSS: |
| 471 | return "eSIR_SME_ALREADY_JOINED_A_BSS"; |
| 472 | case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW: |
| 473 | return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW"; |
| 474 | case eSIR_SME_INVALID_ASSOC_RSP_RXED: |
| 475 | return "eSIR_SME_INVALID_ASSOC_RSP_RXED"; |
| 476 | case eSIR_SME_MIC_COUNTER_MEASURES: |
| 477 | return "eSIR_SME_MIC_COUNTER_MEASURES"; |
| 478 | case eSIR_SME_ADDTS_RSP_TIMEOUT: |
| 479 | return "eSIR_SME_ADDTS_RSP_TIMEOUT"; |
| 480 | case eSIR_SME_CHANNEL_SWITCH_FAIL: |
| 481 | return "eSIR_SME_CHANNEL_SWITCH_FAIL"; |
| 482 | case eSIR_SME_HAL_SCAN_INIT_FAILED: |
| 483 | return "eSIR_SME_HAL_SCAN_INIT_FAILED"; |
| 484 | case eSIR_SME_HAL_SCAN_END_FAILED: |
| 485 | return "eSIR_SME_HAL_SCAN_END_FAILED"; |
| 486 | case eSIR_SME_HAL_SCAN_FINISH_FAILED: |
| 487 | return "eSIR_SME_HAL_SCAN_FINISH_FAILED"; |
| 488 | case eSIR_SME_HAL_SEND_MESSAGE_FAIL: |
| 489 | return "eSIR_SME_HAL_SEND_MESSAGE_FAIL"; |
| 490 | |
| 491 | default: |
| 492 | return "INVALID resultCode"; |
| 493 | } |
| 494 | } |
| 495 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 496 | void lim_print_msg_name(struct mac_context *mac, uint16_t logLevel, uint32_t msgType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 497 | { |
Srinivas Girigowda | 4bc512b | 2017-03-26 22:12:58 -0700 | [diff] [blame] | 498 | pe_debug("Msg: %s", lim_msg_str(msgType)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | /** |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 502 | * lim_init_mlm() - This function is called by limProcessSmeMessages() to |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 503 | * initialize MLM state machine on STA |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 504 | * @mac: Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 505 | * |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 506 | * @Return: Status of operation |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 507 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 508 | QDF_STATUS lim_init_mlm(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 509 | { |
| 510 | uint32_t retVal; |
| 511 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 512 | mac->lim.gLimTimersCreated = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 513 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 514 | MTRACE(mac_trace(mac, TRACE_CODE_MLM_STATE, NO_SESSION, |
| 515 | mac->lim.gLimMlmState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 516 | |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 517 | /* Initialize number of pre-auth contexts */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 518 | mac->lim.gLimNumPreAuthContexts = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 519 | |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 520 | /* Initialize MAC based Authentication STA list */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 521 | lim_init_pre_auth_list(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 522 | |
| 523 | /* Create timers used by LIM */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 524 | retVal = lim_create_timers(mac); |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 525 | if (retVal != TX_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 526 | pe_err("lim_create_timers Failed"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 527 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 528 | } |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 529 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 530 | mac->lim.gLimTimersCreated = 1; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 531 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 532 | } /*** end lim_init_mlm() ***/ |
| 533 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 534 | void lim_deactivate_timers(struct mac_context *mac_ctx) |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 535 | { |
| 536 | uint32_t n; |
| 537 | tLimTimers *lim_timer = &mac_ctx->lim.limTimers; |
| 538 | |
Abhishek Singh | 748d8a2 | 2017-08-21 15:19:37 +0530 | [diff] [blame] | 539 | lim_deactivate_timers_host_roam(mac_ctx); |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 540 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 541 | /* Deactivate channel switch timer. */ |
| 542 | tx_timer_deactivate(&lim_timer->gLimChannelSwitchTimer); |
| 543 | |
| 544 | /* Deactivate addts response timer. */ |
| 545 | tx_timer_deactivate(&lim_timer->gLimAddtsRspTimer); |
| 546 | |
Abhishek Singh | 6a73017 | 2017-12-29 14:07:21 +0530 | [diff] [blame] | 547 | if (tx_timer_running(&lim_timer->gLimJoinFailureTimer)) { |
| 548 | pe_err("Join failure timer running call the timeout API"); |
| 549 | /* Cleanup as if join timer expired */ |
Abhishek Singh | 99c70a0 | 2018-02-05 11:59:53 +0530 | [diff] [blame] | 550 | lim_timer_handler(mac_ctx, SIR_LIM_JOIN_FAIL_TIMEOUT); |
Abhishek Singh | 6a73017 | 2017-12-29 14:07:21 +0530 | [diff] [blame] | 551 | } |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 552 | /* Deactivate Join failure timer. */ |
| 553 | tx_timer_deactivate(&lim_timer->gLimJoinFailureTimer); |
| 554 | |
| 555 | /* Deactivate Periodic Join Probe Request timer. */ |
| 556 | tx_timer_deactivate(&lim_timer->gLimPeriodicJoinProbeReqTimer); |
| 557 | |
| 558 | /* Deactivate Auth Retry timer. */ |
| 559 | tx_timer_deactivate |
| 560 | (&lim_timer->g_lim_periodic_auth_retry_timer); |
| 561 | |
Abhishek Singh | 6a73017 | 2017-12-29 14:07:21 +0530 | [diff] [blame] | 562 | if (tx_timer_running(&lim_timer->gLimAssocFailureTimer)) { |
| 563 | pe_err("Assoc failure timer running call the timeout API"); |
| 564 | /* Cleanup as if assoc timer expired */ |
Abhishek Singh | 99c70a0 | 2018-02-05 11:59:53 +0530 | [diff] [blame] | 565 | lim_assoc_failure_timer_handler(mac_ctx, LIM_ASSOC); |
Abhishek Singh | 6a73017 | 2017-12-29 14:07:21 +0530 | [diff] [blame] | 566 | } |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 567 | /* Deactivate Association failure timer. */ |
| 568 | tx_timer_deactivate(&lim_timer->gLimAssocFailureTimer); |
| 569 | |
Abhishek Singh | 6a73017 | 2017-12-29 14:07:21 +0530 | [diff] [blame] | 570 | if (tx_timer_running(&mac_ctx->lim.limTimers.gLimAuthFailureTimer)) { |
| 571 | pe_err("Auth failure timer running call the timeout API"); |
| 572 | /* Cleanup as if auth timer expired */ |
Abhishek Singh | 99c70a0 | 2018-02-05 11:59:53 +0530 | [diff] [blame] | 573 | lim_timer_handler(mac_ctx, SIR_LIM_AUTH_FAIL_TIMEOUT); |
Abhishek Singh | 6a73017 | 2017-12-29 14:07:21 +0530 | [diff] [blame] | 574 | } |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 575 | /* Deactivate Authentication failure timer. */ |
| 576 | tx_timer_deactivate(&lim_timer->gLimAuthFailureTimer); |
| 577 | |
| 578 | /* Deactivate wait-for-probe-after-Heartbeat timer. */ |
| 579 | tx_timer_deactivate(&lim_timer->gLimProbeAfterHBTimer); |
| 580 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 581 | /* Deactivate cnf wait timer */ |
| 582 | for (n = 0; n < (mac_ctx->lim.maxStation + 1); n++) { |
| 583 | tx_timer_deactivate(&lim_timer->gpLimCnfWaitTimer[n]); |
| 584 | } |
| 585 | |
| 586 | /* Deactivate any Authentication response timers */ |
| 587 | lim_delete_pre_auth_list(mac_ctx); |
| 588 | |
| 589 | tx_timer_deactivate(&lim_timer->gLimUpdateOlbcCacheTimer); |
| 590 | tx_timer_deactivate(&lim_timer->gLimPreAuthClnupTimer); |
| 591 | |
Yeshwanth Sriram Guntuka | 0e5b1eb | 2018-11-01 14:25:40 +0530 | [diff] [blame] | 592 | if (tx_timer_running(&lim_timer->gLimDisassocAckTimer)) { |
| 593 | pe_err("Disassoc timer running call the timeout API"); |
| 594 | lim_timer_handler(mac_ctx, SIR_LIM_DISASSOC_ACK_TIMEOUT); |
| 595 | } |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 596 | tx_timer_deactivate(&lim_timer->gLimDisassocAckTimer); |
| 597 | |
Yeshwanth Sriram Guntuka | 0e5b1eb | 2018-11-01 14:25:40 +0530 | [diff] [blame] | 598 | if (tx_timer_running(&lim_timer->gLimDeauthAckTimer)) { |
| 599 | pe_err("Deauth timer running call the timeout API"); |
| 600 | lim_timer_handler(mac_ctx, SIR_LIM_DEAUTH_ACK_TIMEOUT); |
| 601 | } |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 602 | tx_timer_deactivate(&lim_timer->gLimDeauthAckTimer); |
| 603 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 604 | tx_timer_deactivate(&lim_timer-> |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 605 | gLimActiveToPassiveChannelTimer); |
Padma, Santhosh Kumar | c56735f | 2017-09-13 18:14:26 +0530 | [diff] [blame] | 606 | |
| 607 | tx_timer_deactivate(&lim_timer->sae_auth_timer); |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 608 | } |
| 609 | |
| 610 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 611 | /** |
| 612 | * lim_cleanup_mlm() - This function is called to cleanup |
| 613 | * @mac_ctx: Pointer to Global MAC structure |
| 614 | * |
| 615 | * Function is called to cleanup any resources allocated by the MLM |
| 616 | * state machine. |
| 617 | * |
| 618 | * Return: none |
| 619 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 620 | void lim_cleanup_mlm(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 621 | { |
| 622 | uint32_t n; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 623 | |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 624 | tLimPreAuthNode **pAuthNode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 625 | tLimTimers *lim_timer = NULL; |
| 626 | |
| 627 | if (mac_ctx->lim.gLimTimersCreated == 1) { |
| 628 | lim_timer = &mac_ctx->lim.limTimers; |
| 629 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 630 | lim_deactivate_timers(mac_ctx); |
Abhishek Singh | 748d8a2 | 2017-08-21 15:19:37 +0530 | [diff] [blame] | 631 | |
| 632 | lim_delete_timers_host_roam(mac_ctx); |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 633 | /* Delete channel switch timer. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 634 | tx_timer_delete(&lim_timer->gLimChannelSwitchTimer); |
| 635 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 636 | /* Delete addts response timer. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 637 | tx_timer_delete(&lim_timer->gLimAddtsRspTimer); |
| 638 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 639 | /* Delete Join failure timer. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 640 | tx_timer_delete(&lim_timer->gLimJoinFailureTimer); |
| 641 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 642 | /* Delete Periodic Join Probe Request timer. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 643 | tx_timer_delete(&lim_timer->gLimPeriodicJoinProbeReqTimer); |
| 644 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 645 | /* Delete Auth Retry timer. */ |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 646 | tx_timer_delete(&lim_timer->g_lim_periodic_auth_retry_timer); |
| 647 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 648 | /* Delete Association failure timer. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 649 | tx_timer_delete(&lim_timer->gLimAssocFailureTimer); |
| 650 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 651 | /* Delete Authentication failure timer. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 652 | tx_timer_delete(&lim_timer->gLimAuthFailureTimer); |
| 653 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 654 | /* Delete wait-for-probe-after-Heartbeat timer. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 655 | tx_timer_delete(&lim_timer->gLimProbeAfterHBTimer); |
| 656 | |
yeshwanth sriram guntuka | 7112fad | 2017-07-27 19:00:08 +0530 | [diff] [blame] | 657 | /* Delete cnf wait timer */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 658 | for (n = 0; n < (mac_ctx->lim.maxStation + 1); n++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 659 | tx_timer_delete(&lim_timer->gpLimCnfWaitTimer[n]); |
| 660 | } |
| 661 | |
| 662 | pAuthNode = mac_ctx->lim.gLimPreAuthTimerTable.pTable; |
| 663 | |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 664 | /* Delete any Auth rsp timers, which might have been started */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 665 | for (n = 0; n < mac_ctx->lim.gLimPreAuthTimerTable.numEntry; |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 666 | n++) |
| 667 | tx_timer_delete(&pAuthNode[n]->timer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 668 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 669 | tx_timer_delete(&lim_timer->gLimUpdateOlbcCacheTimer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 670 | tx_timer_delete(&lim_timer->gLimPreAuthClnupTimer); |
| 671 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 672 | tx_timer_delete(&lim_timer->gLimDisassocAckTimer); |
| 673 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 674 | tx_timer_delete(&lim_timer->gLimDeauthAckTimer); |
| 675 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 676 | tx_timer_delete(&lim_timer-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 677 | gLimActiveToPassiveChannelTimer); |
| 678 | |
Padma, Santhosh Kumar | c56735f | 2017-09-13 18:14:26 +0530 | [diff] [blame] | 679 | tx_timer_delete(&lim_timer->sae_auth_timer); |
| 680 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 681 | mac_ctx->lim.gLimTimersCreated = 0; |
| 682 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 683 | } /*** end lim_cleanup_mlm() ***/ |
| 684 | |
| 685 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 686 | * lim_is_addr_bc() |
| 687 | * |
| 688 | ***FUNCTION: |
| 689 | * This function is called in various places within LIM code |
| 690 | * to determine whether passed MAC address is a broadcast or not |
| 691 | * |
| 692 | ***LOGIC: |
| 693 | * |
| 694 | ***ASSUMPTIONS: |
| 695 | * NA |
| 696 | * |
| 697 | ***NOTE: |
| 698 | * NA |
| 699 | * |
| 700 | * @param macAddr Indicates MAC address that need to be determined |
| 701 | * whether it is Broadcast address or not |
| 702 | * |
| 703 | * @return true if passed address is Broadcast address else false |
| 704 | */ |
| 705 | |
| 706 | uint8_t lim_is_addr_bc(tSirMacAddr macAddr) |
| 707 | { |
| 708 | int i; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 709 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 710 | for (i = 0; i < 6; i++) { |
| 711 | if ((macAddr[i] & 0xFF) != 0xFF) |
| 712 | return false; |
| 713 | } |
| 714 | |
| 715 | return true; |
| 716 | } /****** end lim_is_addr_bc() ******/ |
| 717 | |
| 718 | /** |
| 719 | * lim_is_group_addr() |
| 720 | * |
| 721 | ***FUNCTION: |
| 722 | * This function is called in various places within LIM code |
| 723 | * to determine whether passed MAC address is a group address or not |
| 724 | * |
| 725 | ***LOGIC: |
| 726 | * If least significant bit of first octet of the MAC address is |
| 727 | * set to 1, it is a Group address. |
| 728 | * |
| 729 | ***ASSUMPTIONS: |
| 730 | * NA |
| 731 | * |
| 732 | ***NOTE: |
| 733 | * NA |
| 734 | * |
| 735 | * @param macAddr Indicates MAC address that need to be determined |
| 736 | * whether it is Group address or not |
| 737 | * |
| 738 | * @return true if passed address is Group address else false |
| 739 | */ |
| 740 | |
| 741 | uint8_t lim_is_group_addr(tSirMacAddr macAddr) |
| 742 | { |
| 743 | if ((macAddr[0] & 0x01) == 0x01) |
| 744 | return true; |
| 745 | else |
| 746 | return false; |
| 747 | } /****** end lim_is_group_addr() ******/ |
| 748 | |
| 749 | /** |
| 750 | * lim_print_mac_addr() |
| 751 | * |
| 752 | ***FUNCTION: |
| 753 | * This function is called to print passed MAC address |
| 754 | * in : format. |
| 755 | * |
| 756 | ***LOGIC: |
| 757 | * |
| 758 | ***ASSUMPTIONS: |
| 759 | * NA |
| 760 | * |
| 761 | ***NOTE: |
| 762 | * @param macAddr - MacAddr to be printed |
| 763 | * @param logLevel - Loglevel to be used |
| 764 | * |
| 765 | * @return None. |
| 766 | */ |
| 767 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 768 | void lim_print_mac_addr(struct mac_context *mac, tSirMacAddr macAddr, uint8_t logLevel) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 769 | { |
Srinivas Girigowda | 4bc512b | 2017-03-26 22:12:58 -0700 | [diff] [blame] | 770 | pe_debug(MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 771 | } /****** end lim_print_mac_addr() ******/ |
| 772 | |
| 773 | /* |
| 774 | * lim_reset_deferred_msg_q() |
| 775 | * |
| 776 | ***FUNCTION: |
| 777 | * This function resets the deferred message queue parameters. |
| 778 | * |
| 779 | ***PARAMS: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 780 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 781 | * |
| 782 | ***LOGIC: |
| 783 | * |
| 784 | ***ASSUMPTIONS: |
| 785 | * NA |
| 786 | * |
| 787 | ***NOTE: |
| 788 | * NA |
| 789 | * |
| 790 | ***RETURNS: |
| 791 | * None |
| 792 | */ |
| 793 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 794 | void lim_reset_deferred_msg_q(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 795 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 796 | struct scheduler_msg *read_msg = {0}; |
Nirav Shah | 9bf8157 | 2016-04-19 16:42:52 +0530 | [diff] [blame] | 797 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 798 | if (mac->lim.gLimDeferredMsgQ.size > 0) { |
| 799 | while ((read_msg = lim_read_deferred_msg_q(mac)) != NULL) { |
| 800 | pe_free_msg(mac, read_msg); |
Nirav Shah | 9bf8157 | 2016-04-19 16:42:52 +0530 | [diff] [blame] | 801 | } |
| 802 | } |
| 803 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 804 | mac->lim.gLimDeferredMsgQ.size = |
| 805 | mac->lim.gLimDeferredMsgQ.write = |
| 806 | mac->lim.gLimDeferredMsgQ.read = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 807 | |
| 808 | } |
| 809 | |
| 810 | #define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2) |
| 811 | #define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2) |
| 812 | |
| 813 | /** |
| 814 | * lim_write_deferred_msg_q() - This function queues up a deferred message |
| 815 | * |
| 816 | * @mac_ctx: Pointer to Global MAC structure |
| 817 | * @lim_msg: a LIM message |
| 818 | * |
| 819 | * Function queues up a deferred message for later processing on the |
| 820 | * STA side. |
| 821 | * |
| 822 | * Return: none |
| 823 | */ |
| 824 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 825 | uint8_t lim_write_deferred_msg_q(struct mac_context *mac_ctx, |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 826 | struct scheduler_msg *lim_msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 827 | { |
Nirav Shah | 99923a8 | 2018-06-23 14:35:49 +0530 | [diff] [blame] | 828 | uint8_t type = 0, subtype = 0; |
Sandeep Puligilla | d9f88ce | 2017-04-11 19:41:57 -0700 | [diff] [blame] | 829 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 830 | pe_debug("Queue a deferred message size: %d write: %d - type: 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 831 | mac_ctx->lim.gLimDeferredMsgQ.size, |
| 832 | mac_ctx->lim.gLimDeferredMsgQ.write, |
| 833 | lim_msg->type); |
| 834 | |
| 835 | /* check if the deferred message queue is full */ |
| 836 | if (mac_ctx->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN) { |
| 837 | if (!(mac_ctx->lim.deferredMsgCnt & 0xF)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 838 | pe_err("queue->MsgQ full Msg: %d Msgs Failed: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 839 | lim_msg->type, |
| 840 | ++mac_ctx->lim.deferredMsgCnt); |
Abhishek Singh | 5ea8653 | 2016-04-27 14:10:53 +0530 | [diff] [blame] | 841 | cds_flush_logs(WLAN_LOG_TYPE_NON_FATAL, |
| 842 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 843 | WLAN_LOG_REASON_QUEUE_FULL, |
| 844 | true, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 845 | } else { |
| 846 | mac_ctx->lim.deferredMsgCnt++; |
| 847 | } |
| 848 | return TX_QUEUE_FULL; |
| 849 | } |
| 850 | |
| 851 | /* |
| 852 | * In the application, there should not be more than 1 message get |
| 853 | * queued up. If happens, flags a warning. In the future, this can |
| 854 | * happen. |
| 855 | */ |
| 856 | if (mac_ctx->lim.gLimDeferredMsgQ.size > 0) |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 857 | pe_debug("%d Deferred Msg type: 0x%x scan: %d global sme: %d global mlme: %d addts: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 858 | mac_ctx->lim.gLimDeferredMsgQ.size, |
| 859 | lim_msg->type, |
| 860 | lim_is_system_in_scan_state(mac_ctx), |
| 861 | mac_ctx->lim.gLimSmeState, |
| 862 | mac_ctx->lim.gLimMlmState, |
| 863 | mac_ctx->lim.gLimAddtsSent); |
| 864 | |
Sandeep Puligilla | d9f88ce | 2017-04-11 19:41:57 -0700 | [diff] [blame] | 865 | if (SIR_BB_XPORT_MGMT_MSG == lim_msg->type) { |
| 866 | lim_util_get_type_subtype(lim_msg->bodyptr, |
| 867 | &type, &subtype); |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 868 | pe_debug(" Deferred management type %d subtype %d ", |
Sandeep Puligilla | d9f88ce | 2017-04-11 19:41:57 -0700 | [diff] [blame] | 869 | type, subtype); |
| 870 | } |
| 871 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 872 | /* |
| 873 | * To prevent the deferred Q is full of management frames, only give |
| 874 | * them certain space |
| 875 | */ |
| 876 | if ((SIR_BB_XPORT_MGMT_MSG == lim_msg->type) && |
| 877 | (LIM_DEFERRED_Q_CHECK_THRESHOLD < |
| 878 | mac_ctx->lim.gLimDeferredMsgQ.size)) { |
| 879 | uint16_t idx, count = 0; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 880 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 881 | for (idx = 0; idx < mac_ctx->lim.gLimDeferredMsgQ.size; |
| 882 | idx++) { |
| 883 | if (SIR_BB_XPORT_MGMT_MSG == |
| 884 | mac_ctx->lim.gLimDeferredMsgQ. |
| 885 | deferredQueue[idx].type) { |
| 886 | count++; |
| 887 | } |
| 888 | } |
| 889 | if (LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count) { |
| 890 | /* |
| 891 | * We reach the quota for management frames, |
| 892 | * drop this one |
| 893 | */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 894 | pe_warn("Too many queue->MsgQ Msg: %d count: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 895 | lim_msg->type, count); |
| 896 | /* Return error, caller knows what to do */ |
| 897 | return TX_QUEUE_FULL; |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | ++mac_ctx->lim.gLimDeferredMsgQ.size; |
| 902 | |
| 903 | /* reset the count here since we are able to defer the message */ |
| 904 | if (mac_ctx->lim.deferredMsgCnt != 0) |
| 905 | mac_ctx->lim.deferredMsgCnt = 0; |
| 906 | |
| 907 | /* if the write pointer hits the end of the queue, rewind it */ |
| 908 | if (mac_ctx->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN) |
| 909 | mac_ctx->lim.gLimDeferredMsgQ.write = 0; |
| 910 | |
| 911 | /* save the message to the queue and advanced the write pointer */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 912 | qdf_mem_copy((uint8_t *) &mac_ctx->lim.gLimDeferredMsgQ. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 913 | deferredQueue[mac_ctx->lim.gLimDeferredMsgQ.write++], |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 914 | (uint8_t *) lim_msg, |
| 915 | sizeof(struct scheduler_msg)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 916 | return TX_SUCCESS; |
| 917 | |
| 918 | } |
| 919 | |
| 920 | /* |
| 921 | * lim_read_deferred_msg_q() |
| 922 | * |
| 923 | ***FUNCTION: |
| 924 | * This function dequeues a deferred message for processing on the |
| 925 | * STA side. |
| 926 | * |
| 927 | ***PARAMS: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 928 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 929 | * |
| 930 | ***LOGIC: |
| 931 | * |
| 932 | ***ASSUMPTIONS: |
| 933 | * NA |
| 934 | * |
| 935 | ***NOTE: |
| 936 | * |
| 937 | * |
| 938 | ***RETURNS: |
| 939 | * Returns the message at the head of the deferred message queue |
| 940 | */ |
| 941 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 942 | struct scheduler_msg *lim_read_deferred_msg_q(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 943 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 944 | struct scheduler_msg *msg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 945 | |
| 946 | /* |
| 947 | ** check any messages left. If no, return |
| 948 | **/ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 949 | if (mac->lim.gLimDeferredMsgQ.size <= 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | return NULL; |
| 951 | |
| 952 | /* |
| 953 | ** decrement the queue size |
| 954 | **/ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 955 | mac->lim.gLimDeferredMsgQ.size--; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 956 | |
| 957 | /* |
| 958 | ** retrieve the message from the head of the queue |
| 959 | **/ |
| 960 | msg = |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 961 | &mac->lim.gLimDeferredMsgQ.deferredQueue[mac->lim. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 962 | gLimDeferredMsgQ.read]; |
| 963 | |
| 964 | /* |
| 965 | ** advance the read pointer |
| 966 | **/ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 967 | mac->lim.gLimDeferredMsgQ.read++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 968 | |
| 969 | /* |
| 970 | ** if the read pointer hits the end of the queue, rewind it |
| 971 | **/ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 972 | if (mac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN) |
| 973 | mac->lim.gLimDeferredMsgQ.read = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 974 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 975 | pe_debug("DeQueue a deferred message size: %d read: %d - type: 0x%x", |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 976 | mac->lim.gLimDeferredMsgQ.size, |
| 977 | mac->lim.gLimDeferredMsgQ.read, msg->type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 978 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 979 | pe_debug("DQ msg -- scan: %d global sme: %d global mlme: %d addts: %d", |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 980 | lim_is_system_in_scan_state(mac), mac->lim.gLimSmeState, |
| 981 | mac->lim.gLimMlmState, mac->lim.gLimAddtsSent); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | |
| 983 | return msg; |
| 984 | } |
| 985 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 986 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 987 | lim_sys_process_mmh_msg_api(struct mac_context *mac, |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 988 | struct scheduler_msg *pMsg, uint8_t qType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 989 | { |
| 990 | /* FIXME */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 991 | sys_process_mmh_msg(mac, pMsg); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 992 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 993 | } |
| 994 | |
| 995 | /* |
| 996 | * lim_handle_update_olbc_cache() - This function update olbc cache |
| 997 | * |
| 998 | * @mac_ctx: Pointer to Global MAC structure |
| 999 | * |
| 1000 | * Function updates olbc cache |
| 1001 | * |
| 1002 | * Return: none |
| 1003 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1004 | void lim_handle_update_olbc_cache(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1005 | { |
| 1006 | int i; |
| 1007 | static int enable; |
| 1008 | tUpdateBeaconParams beaconParams; |
| 1009 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1010 | struct pe_session *pe_session = lim_is_ap_session_active(mac_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1011 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1012 | if (pe_session == NULL) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1013 | pe_err(" Session not found"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1014 | return; |
| 1015 | } |
| 1016 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1017 | if (pe_session->is_session_obss_offload_enabled) { |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 1018 | pe_debug("protection offloaded"); |
| 1019 | return; |
| 1020 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1021 | qdf_mem_set((uint8_t *) &beaconParams, sizeof(tUpdateBeaconParams), 0); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1022 | beaconParams.bssIdx = pe_session->bssIdx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1023 | |
| 1024 | beaconParams.paramChangeBitmap = 0; |
| 1025 | /* |
| 1026 | * This is doing a 2 pass check. The first pass is to invalidate |
| 1027 | * all the cache entries. The second pass is to decide whether to |
| 1028 | * disable protection. |
| 1029 | */ |
| 1030 | if (!enable) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1031 | pe_debug("Resetting OLBC cache"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1032 | pe_session->gLimOlbcParams.numSta = 0; |
| 1033 | pe_session->gLimOverlap11gParams.numSta = 0; |
| 1034 | pe_session->gLimOverlapHt20Params.numSta = 0; |
| 1035 | pe_session->gLimNonGfParams.numSta = 0; |
| 1036 | pe_session->gLimLsigTxopParams.numSta = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1037 | |
| 1038 | for (i = 0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++) |
| 1039 | mac_ctx->lim.protStaOverlapCache[i].active = false; |
| 1040 | |
| 1041 | enable = 1; |
| 1042 | } else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1043 | if ((!pe_session->gLimOlbcParams.numSta) && |
| 1044 | (pe_session->gLimOlbcParams.protectionEnabled) && |
| 1045 | (!pe_session->gLim11bParams.protectionEnabled)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1046 | pe_debug("Overlap cache clear and no 11B STA set"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1047 | lim_enable11g_protection(mac_ctx, false, true, |
| 1048 | &beaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1049 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1050 | } |
| 1051 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1052 | if ((!pe_session->gLimOverlap11gParams.numSta) && |
| 1053 | (pe_session->gLimOverlap11gParams.protectionEnabled) |
| 1054 | && (!pe_session->gLim11gParams.protectionEnabled)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1055 | pe_debug("Overlap cache clear and no 11G STA set"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1056 | lim_enable_ht_protection_from11g(mac_ctx, false, true, |
| 1057 | &beaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1058 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1059 | } |
| 1060 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1061 | if ((!pe_session->gLimOverlapHt20Params.numSta) && |
| 1062 | (pe_session->gLimOverlapHt20Params.protectionEnabled) |
| 1063 | && (!pe_session->gLimHt20Params.protectionEnabled)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1064 | pe_debug("Overlap cache clear and no HT20 STA set"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1065 | lim_enable11g_protection(mac_ctx, false, true, |
| 1066 | &beaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1067 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1068 | } |
| 1069 | |
| 1070 | enable = 0; |
| 1071 | } |
| 1072 | |
| 1073 | if ((false == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) |
| 1074 | && beaconParams.paramChangeBitmap) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1075 | sch_set_fixed_beacon_fields(mac_ctx, pe_session); |
| 1076 | lim_send_beacon_params(mac_ctx, &beaconParams, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1077 | } |
| 1078 | /* Start OLBC timer */ |
| 1079 | if (tx_timer_activate(&mac_ctx->lim.limTimers.gLimUpdateOlbcCacheTimer) |
| 1080 | != TX_SUCCESS) |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1081 | pe_err("tx_timer_activate failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1082 | } |
| 1083 | |
| 1084 | /** |
| 1085 | * lim_is_null_ssid() - This function checks if ssid supplied is Null SSID |
| 1086 | * @ssid: pointer to tSirMacSSid |
| 1087 | * |
| 1088 | * Function checks if ssid supplied is Null SSID |
| 1089 | * |
| 1090 | * Return: none |
| 1091 | */ |
| 1092 | |
| 1093 | uint8_t lim_is_null_ssid(tSirMacSSid *ssid) |
| 1094 | { |
| 1095 | uint8_t fnull_ssid = false; |
| 1096 | uint32_t ssid_len; |
| 1097 | uint8_t *ssid_str; |
| 1098 | |
| 1099 | if (0 == ssid->length) { |
| 1100 | fnull_ssid = true; |
| 1101 | return fnull_ssid; |
| 1102 | } |
| 1103 | /* If the first charactes is space, then check if all |
| 1104 | * characters in SSID are spaces to consider it as NULL SSID |
| 1105 | */ |
| 1106 | if ((ASCII_SPACE_CHARACTER == ssid->ssId[0]) && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1107 | (ssid->length == 1)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1108 | fnull_ssid = true; |
| 1109 | return fnull_ssid; |
| 1110 | } else { |
| 1111 | /* check if all the charactes in SSID are NULL */ |
| 1112 | ssid_len = ssid->length; |
| 1113 | ssid_str = ssid->ssId; |
| 1114 | |
| 1115 | while (ssid_len) { |
| 1116 | if (*ssid_str) |
| 1117 | return fnull_ssid; |
| 1118 | |
| 1119 | ssid_str++; |
| 1120 | ssid_len--; |
| 1121 | } |
| 1122 | |
| 1123 | if (0 == ssid_len) { |
| 1124 | fnull_ssid = true; |
| 1125 | return fnull_ssid; |
| 1126 | } |
| 1127 | } |
| 1128 | |
| 1129 | return fnull_ssid; |
| 1130 | } |
| 1131 | |
| 1132 | /** ------------------------------------------------------------- |
| 1133 | \fn lim_update_prot_sta_params |
| 1134 | \brief updates protection related counters. |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1135 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1136 | \param tSirMacAddr peerMacAddr |
| 1137 | \param tLimProtStaCacheType protStaCacheType |
| 1138 | \param tHalBitVal gfSupported |
| 1139 | \param tHalBitVal lsigTxopSupported |
| 1140 | \return None |
| 1141 | -------------------------------------------------------------*/ |
Jeff Johnson | 2249644 | 2016-10-07 07:34:46 -0700 | [diff] [blame] | 1142 | static void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1143 | lim_update_prot_sta_params(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1144 | tSirMacAddr peerMacAddr, |
| 1145 | tLimProtStaCacheType protStaCacheType, |
| 1146 | tHalBitVal gfSupported, tHalBitVal lsigTxopSupported, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1147 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1148 | { |
| 1149 | uint32_t i; |
| 1150 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1151 | pe_debug("Associated STA addr is:"); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1152 | lim_print_mac_addr(mac, peerMacAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | |
| 1154 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1155 | if (pe_session->protStaCache[i].active) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1156 | pe_debug("Addr:"); |
| 1157 | lim_print_mac_addr |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1158 | (mac, pe_session->protStaCache[i].addr, |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1159 | LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1160 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1161 | if (!qdf_mem_cmp |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1162 | (pe_session->protStaCache[i].addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1163 | peerMacAddr, sizeof(tSirMacAddr))) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1164 | pe_debug("matching cache entry at: %d already active", |
| 1165 | i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1166 | return; |
| 1167 | } |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1172 | if (!pe_session->protStaCache[i].active) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1173 | break; |
| 1174 | } |
| 1175 | |
| 1176 | if (i >= LIM_PROT_STA_CACHE_SIZE) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1177 | pe_err("No space in ProtStaCache"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1178 | return; |
| 1179 | } |
| 1180 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1181 | qdf_mem_copy(pe_session->protStaCache[i].addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1182 | peerMacAddr, sizeof(tSirMacAddr)); |
| 1183 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1184 | pe_session->protStaCache[i].protStaCacheType = protStaCacheType; |
| 1185 | pe_session->protStaCache[i].active = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1186 | if (eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1187 | pe_session->gLim11bParams.numSta++; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1188 | pe_debug("11B,"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1189 | } else if (eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1190 | pe_session->gLim11gParams.numSta++; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1191 | pe_debug("11G,"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1192 | } else if (eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1193 | pe_session->gLimHt20Params.numSta++; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1194 | pe_debug("HT20,"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1195 | } |
| 1196 | |
| 1197 | if (!gfSupported) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1198 | pe_session->gLimNonGfParams.numSta++; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1199 | pe_debug("NonGf,"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1200 | } |
| 1201 | if (!lsigTxopSupported) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1202 | pe_session->gLimLsigTxopParams.numSta++; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1203 | pe_debug("!lsigTxopSupported"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | } |
| 1205 | } /* --------------------------------------------------------------------- */ |
| 1206 | |
| 1207 | /** ------------------------------------------------------------- |
| 1208 | \fn lim_decide_ap_protection |
| 1209 | \brief Decides all the protection related staiton coexistence and also sets |
| 1210 | \ short preamble and short slot appropriately. This function will be called |
| 1211 | \ when AP is ready to send assocRsp tp the station joining right now. |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1212 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1213 | \param tSirMacAddr peerMacAddr |
| 1214 | \return None |
| 1215 | -------------------------------------------------------------*/ |
| 1216 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1217 | lim_decide_ap_protection(struct mac_context *mac, tSirMacAddr peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1218 | tpUpdateBeaconParams pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1219 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1220 | { |
| 1221 | uint16_t tmpAid; |
| 1222 | tpDphHashNode pStaDs; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1223 | enum band_info rfBand = BAND_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1224 | uint32_t phyMode; |
| 1225 | tLimProtStaCacheType protStaCacheType = |
| 1226 | eLIM_PROT_STA_CACHE_TYPE_INVALID; |
| 1227 | tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET; |
| 1228 | |
| 1229 | pBeaconParams->paramChangeBitmap = 0; |
| 1230 | /* check whether to enable protection or not */ |
| 1231 | pStaDs = |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1232 | dph_lookup_hash_entry(mac, peerMacAddr, &tmpAid, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1233 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1234 | if (NULL == pStaDs) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1235 | pe_err("pStaDs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1236 | return; |
| 1237 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1238 | lim_get_rf_band_new(mac, &rfBand, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1239 | /* if we are in 5 GHZ band */ |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1240 | if (BAND_5G == rfBand) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1241 | /* We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ. */ |
| 1242 | /* HT20 case is common between both the bands and handled down as common code. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1243 | if (true == pe_session->htCapability) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1244 | /* we are 11N and 11A station is joining. */ |
| 1245 | /* protection from 11A required. */ |
| 1246 | if (false == pStaDs->mlmStaContext.htCapability) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1247 | lim_update_11a_protection(mac, true, false, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1248 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1249 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1250 | return; |
| 1251 | } |
| 1252 | } |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1253 | } else if (BAND_2G == rfBand) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1254 | lim_get_phy_mode(mac, &phyMode, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1255 | |
| 1256 | /* We are 11G. Check if we need protection from 11b Stations. */ |
| 1257 | if ((phyMode == WNI_CFG_PHY_MODE_11G) && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1258 | (false == pe_session->htCapability)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1259 | |
| 1260 | if (pStaDs->erpEnabled == eHAL_CLEAR) { |
| 1261 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB; |
| 1262 | /* enable protection */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1263 | pe_debug("Enabling protection from 11B"); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1264 | lim_enable11g_protection(mac, true, false, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1265 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1266 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1267 | } |
| 1268 | } |
| 1269 | /* HT station. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1270 | if (true == pe_session->htCapability) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1271 | /* check if we need protection from 11b station */ |
| 1272 | if ((pStaDs->erpEnabled == eHAL_CLEAR) && |
| 1273 | (!pStaDs->mlmStaContext.htCapability)) { |
| 1274 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB; |
| 1275 | /* enable protection */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1276 | pe_debug("Enabling protection from 11B"); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1277 | lim_enable11g_protection(mac, true, false, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1278 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1279 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1280 | } |
| 1281 | /* station being joined is non-11b and non-ht ==> 11g device */ |
| 1282 | else if (!pStaDs->mlmStaContext.htCapability) { |
| 1283 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG; |
| 1284 | /* enable protection */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1285 | lim_enable_ht_protection_from11g(mac, true, false, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1286 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1287 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1288 | } |
| 1289 | /* ERP mode is enabled for the latest station joined */ |
| 1290 | /* latest station joined is HT capable */ |
| 1291 | /* This case is being handled in common code (commn between both the bands) below. */ |
| 1292 | } |
| 1293 | } |
| 1294 | /* we are HT and HT station is joining. This code is common for both the bands. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1295 | if ((true == pe_session->htCapability) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1296 | (true == pStaDs->mlmStaContext.htCapability)) { |
| 1297 | if (!pStaDs->htGreenfield) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1298 | lim_enable_ht_non_gf_protection(mac, true, false, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1299 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1300 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1301 | gfSupported = eHAL_CLEAR; |
| 1302 | } |
| 1303 | /* Station joining is HT 20Mhz */ |
| 1304 | if ((eHT_CHANNEL_WIDTH_20MHZ == |
| 1305 | pStaDs->htSupportedChannelWidthSet) && |
| 1306 | (eHT_CHANNEL_WIDTH_20MHZ != |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1307 | pe_session->htSupportedChannelWidthSet)){ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1308 | protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20; |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1309 | lim_enable_ht20_protection(mac, true, false, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1310 | pBeaconParams, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1311 | } |
| 1312 | /* Station joining does not support LSIG TXOP Protection */ |
| 1313 | if (!pStaDs->htLsigTXOPProtection) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1314 | lim_enable_ht_lsig_txop_protection(mac, false, false, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1315 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1316 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1317 | lsigTxopSupported = eHAL_CLEAR; |
| 1318 | } |
| 1319 | } |
| 1320 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1321 | lim_update_prot_sta_params(mac, peerMacAddr, protStaCacheType, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1322 | gfSupported, lsigTxopSupported, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1323 | |
| 1324 | return; |
| 1325 | } |
| 1326 | |
| 1327 | /** ------------------------------------------------------------- |
| 1328 | \fn lim_enable_overlap11g_protection |
| 1329 | \brief wrapper function for setting overlap 11g protection. |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1330 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1331 | \param tpUpdateBeaconParams pBeaconParams |
| 1332 | \param tpSirMacMgmtHdr pMh |
| 1333 | \return None |
| 1334 | -------------------------------------------------------------*/ |
| 1335 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1336 | lim_enable_overlap11g_protection(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1337 | tpUpdateBeaconParams pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1338 | tpSirMacMgmtHdr pMh, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1339 | { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1340 | lim_update_overlap_sta_param(mac, pMh->bssId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1341 | &(pe_session->gLimOlbcParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1342 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1343 | if (pe_session->gLimOlbcParams.numSta && |
| 1344 | !pe_session->gLimOlbcParams.protectionEnabled) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1345 | /* enable protection */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1346 | pe_debug("OLBC happens!!!"); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1347 | lim_enable11g_protection(mac, true, true, pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1348 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1349 | } |
| 1350 | } |
| 1351 | |
| 1352 | /** |
| 1353 | * lim_update_short_preamble() - This function Updates short preamble |
| 1354 | * @mac_ctx: pointer to Global MAC structure |
| 1355 | * @peer_mac_addr: pointer to tSirMacAddr |
| 1356 | * @pbeaconparams: pointer to tpUpdateBeaconParams |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 1357 | * @psession_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1358 | * |
| 1359 | * Function Updates short preamble if needed when a new station joins |
| 1360 | * |
| 1361 | * Return: none |
| 1362 | */ |
| 1363 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1364 | lim_update_short_preamble(struct mac_context *mac_ctx, tSirMacAddr peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1365 | tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 1366 | struct pe_session *psession_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1367 | { |
| 1368 | uint16_t aid; |
| 1369 | tpDphHashNode sta_ds; |
| 1370 | uint32_t phy_mode; |
| 1371 | uint16_t i; |
| 1372 | |
| 1373 | /* check whether to enable protection or not */ |
| 1374 | sta_ds = |
| 1375 | dph_lookup_hash_entry(mac_ctx, peer_mac_addr, &aid, |
| 1376 | &psession_entry->dph.dphHashTable); |
| 1377 | |
| 1378 | lim_get_phy_mode(mac_ctx, &phy_mode, psession_entry); |
| 1379 | |
| 1380 | if (sta_ds == NULL || phy_mode != WNI_CFG_PHY_MODE_11G) |
| 1381 | return; |
| 1382 | |
| 1383 | if (sta_ds->shortPreambleEnabled != eHAL_CLEAR) |
| 1384 | return; |
| 1385 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1386 | pe_debug("Short Preamble is not enabled in Assoc Req from"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1387 | |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 1388 | lim_print_mac_addr(mac_ctx, peer_mac_addr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1389 | |
| 1390 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1391 | if (LIM_IS_AP_ROLE(psession_entry) && |
| 1392 | (psession_entry->gLimNoShortParams. |
| 1393 | staNoShortCache[i].active) && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1394 | (!qdf_mem_cmp |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1395 | (psession_entry->gLimNoShortParams. |
| 1396 | staNoShortCache[i].addr, |
| 1397 | peer_mac_addr, sizeof(tSirMacAddr)))) |
| 1398 | return; |
| 1399 | else if (!LIM_IS_AP_ROLE(psession_entry) && |
| 1400 | (mac_ctx->lim.gLimNoShortParams. |
| 1401 | staNoShortCache[i].active) && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1402 | (!qdf_mem_cmp(mac_ctx->lim.gLimNoShortParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1403 | staNoShortCache[i].addr, |
| 1404 | peer_mac_addr, |
| 1405 | sizeof(tSirMacAddr)))) |
| 1406 | return; |
| 1407 | } |
| 1408 | |
| 1409 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1410 | if (LIM_IS_AP_ROLE(psession_entry) && |
| 1411 | !psession_entry->gLimNoShortParams. |
| 1412 | staNoShortCache[i].active) |
| 1413 | break; |
| 1414 | else if (!mac_ctx->lim.gLimNoShortParams. |
| 1415 | staNoShortCache[i].active) |
| 1416 | break; |
| 1417 | } |
| 1418 | |
| 1419 | if (i >= LIM_PROT_STA_CACHE_SIZE) { |
| 1420 | tLimNoShortParams *lim_params = |
| 1421 | &psession_entry->gLimNoShortParams; |
| 1422 | if (LIM_IS_AP_ROLE(psession_entry)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1423 | pe_err("No space in Short cache active: %d sta: %d for sta", |
| 1424 | i, lim_params->numNonShortPreambleSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1425 | lim_print_mac_addr(mac_ctx, peer_mac_addr, LOGE); |
| 1426 | return; |
| 1427 | } else { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1428 | pe_err("No space in Short cache active: %d sta: %d for sta", |
| 1429 | i, lim_params->numNonShortPreambleSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1430 | lim_print_mac_addr(mac_ctx, peer_mac_addr, LOGE); |
| 1431 | return; |
| 1432 | } |
| 1433 | |
| 1434 | } |
| 1435 | |
| 1436 | if (LIM_IS_AP_ROLE(psession_entry)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1437 | qdf_mem_copy(psession_entry->gLimNoShortParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1438 | staNoShortCache[i].addr, |
| 1439 | peer_mac_addr, sizeof(tSirMacAddr)); |
| 1440 | psession_entry->gLimNoShortParams.staNoShortCache[i]. |
| 1441 | active = true; |
| 1442 | psession_entry->gLimNoShortParams.numNonShortPreambleSta++; |
| 1443 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1444 | qdf_mem_copy(mac_ctx->lim.gLimNoShortParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1445 | staNoShortCache[i].addr, |
| 1446 | peer_mac_addr, sizeof(tSirMacAddr)); |
| 1447 | mac_ctx->lim.gLimNoShortParams.staNoShortCache[i].active = true; |
| 1448 | mac_ctx->lim.gLimNoShortParams.numNonShortPreambleSta++; |
| 1449 | } |
| 1450 | |
| 1451 | /* enable long preamble */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1452 | pe_debug("Disabling short preamble"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1453 | |
| 1454 | if (lim_enable_short_preamble(mac_ctx, false, beaconparams, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1455 | psession_entry) != QDF_STATUS_SUCCESS) |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1456 | pe_err("Cannot enable long preamble"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1457 | } |
| 1458 | |
| 1459 | /** |
| 1460 | * lim_update_short_slot_time() - This function Updates short slot time |
| 1461 | * @mac_ctx: pointer to Global MAC structure |
| 1462 | * @peer_mac_addr: pointer to tSirMacAddr |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1463 | * @beacon_params: pointer to tpUpdateBeaconParams |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 1464 | * @psession_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1465 | * |
| 1466 | * Function Updates short slot time if needed when a new station joins |
| 1467 | * |
| 1468 | * Return: None |
| 1469 | */ |
| 1470 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1471 | lim_update_short_slot_time(struct mac_context *mac_ctx, tSirMacAddr peer_mac_addr, |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1472 | tpUpdateBeaconParams beacon_params, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 1473 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1474 | { |
| 1475 | uint16_t aid; |
| 1476 | tpDphHashNode sta_ds; |
| 1477 | uint32_t phy_mode; |
| 1478 | uint32_t val; |
| 1479 | uint16_t i; |
| 1480 | |
| 1481 | /* check whether to enable protection or not */ |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1482 | sta_ds = dph_lookup_hash_entry(mac_ctx, peer_mac_addr, &aid, |
| 1483 | &session_entry->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1484 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 1485 | |
| 1486 | if (sta_ds == NULL || phy_mode != WNI_CFG_PHY_MODE_11G) |
| 1487 | return; |
| 1488 | |
| 1489 | /* |
| 1490 | * Only in case of softap in 11g mode, slot time might change |
| 1491 | * depending on the STA being added. In 11a case, it should |
| 1492 | * be always 1 and in 11b case, it should be always 0. |
| 1493 | * Only when the new STA has short slot time disabled, we need to |
| 1494 | * change softap's overall slot time settings else the default for |
| 1495 | * softap is always short slot enabled. When the last long slot STA |
| 1496 | * leaves softAP, we take care of it in lim_decide_short_slot |
| 1497 | */ |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1498 | if (sta_ds->shortSlotTimeEnabled != eHAL_CLEAR) |
| 1499 | return; |
| 1500 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1501 | pe_debug("Short Slot Time is not enabled in Assoc Req from"); |
| 1502 | lim_print_mac_addr(mac_ctx, peer_mac_addr, LOGD); |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1503 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1504 | if (LIM_IS_AP_ROLE(session_entry) && |
| 1505 | session_entry->gLimNoShortSlotParams. |
| 1506 | staNoShortSlotCache[i].active) { |
| 1507 | if (!qdf_mem_cmp(session_entry-> |
| 1508 | gLimNoShortSlotParams.staNoShortSlotCache[i].addr, |
| 1509 | peer_mac_addr, sizeof(tSirMacAddr))) |
| 1510 | return; |
| 1511 | } else if (!LIM_IS_AP_ROLE(session_entry)) { |
| 1512 | if (mac_ctx->lim.gLimNoShortSlotParams. |
| 1513 | staNoShortSlotCache[i].active) { |
| 1514 | if (!qdf_mem_cmp(mac_ctx-> |
| 1515 | lim.gLimNoShortSlotParams. |
| 1516 | staNoShortSlotCache[i].addr, |
| 1517 | peer_mac_addr, sizeof(tSirMacAddr))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1518 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1519 | } |
| 1520 | } |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1521 | } |
| 1522 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1523 | if (LIM_IS_AP_ROLE(session_entry) && |
| 1524 | !session_entry->gLimNoShortSlotParams. |
| 1525 | staNoShortSlotCache[i].active) |
| 1526 | break; |
| 1527 | else |
| 1528 | if (!mac_ctx->lim.gLimNoShortSlotParams. |
| 1529 | staNoShortSlotCache[i].active) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1530 | break; |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1531 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1532 | |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1533 | if (i >= LIM_PROT_STA_CACHE_SIZE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1534 | if (LIM_IS_AP_ROLE(session_entry)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1535 | pe_err("No space in ShortSlot cache active: %d sta: %d for sta", |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1536 | i, session_entry->gLimNoShortSlotParams. |
| 1537 | numNonShortSlotSta); |
| 1538 | lim_print_mac_addr(mac_ctx, peer_mac_addr, LOGE); |
| 1539 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1540 | } else { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1541 | pe_err("No space in ShortSlot cache active: %d sta: %d for sta", |
| 1542 | i, mac_ctx->lim.gLimNoShortSlotParams. |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1543 | numNonShortSlotSta); |
| 1544 | lim_print_mac_addr(mac_ctx, peer_mac_addr, LOGE); |
| 1545 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1546 | } |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1547 | } |
| 1548 | |
| 1549 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 1550 | qdf_mem_copy(session_entry->gLimNoShortSlotParams. |
| 1551 | staNoShortSlotCache[i].addr, |
| 1552 | peer_mac_addr, sizeof(tSirMacAddr)); |
| 1553 | session_entry->gLimNoShortSlotParams. |
| 1554 | staNoShortSlotCache[i].active = true; |
| 1555 | session_entry->gLimNoShortSlotParams.numNonShortSlotSta++; |
| 1556 | } else { |
| 1557 | qdf_mem_copy(mac_ctx->lim.gLimNoShortSlotParams. |
| 1558 | staNoShortSlotCache[i].addr, |
| 1559 | peer_mac_addr, sizeof(tSirMacAddr)); |
| 1560 | mac_ctx->lim.gLimNoShortSlotParams. |
| 1561 | staNoShortSlotCache[i].active = true; |
| 1562 | mac_ctx->lim.gLimNoShortSlotParams. |
| 1563 | numNonShortSlotSta++; |
| 1564 | } |
gaurank kathpalia | e5a17e4 | 2018-09-10 10:05:25 +0530 | [diff] [blame] | 1565 | val = mac_ctx->mlme_cfg->feature_flags.enable_short_slot_time_11g; |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1566 | /* |
| 1567 | * Here we check if we are AP role and short slot enabled |
| 1568 | * (both admin and oper modes) but we have atleast one STA |
| 1569 | * connected with only long slot enabled, we need to change |
| 1570 | * our beacon/pb rsp to broadcast short slot disabled |
| 1571 | */ |
| 1572 | if ((LIM_IS_AP_ROLE(session_entry)) && (val && |
| 1573 | session_entry->gLimNoShortSlotParams.numNonShortSlotSta |
| 1574 | && session_entry->shortSlotTimeSupported)) { |
| 1575 | /* enable long slot time */ |
| 1576 | beacon_params->fShortSlotTime = false; |
| 1577 | beacon_params->paramChangeBitmap |= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1578 | PARAM_SHORT_SLOT_TIME_CHANGED; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1579 | pe_debug("Disable short slot time. Enable long slot time"); |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1580 | session_entry->shortSlotTimeSupported = false; |
| 1581 | } else if (!LIM_IS_AP_ROLE(session_entry) && |
| 1582 | (val && mac_ctx->lim.gLimNoShortSlotParams. |
| 1583 | numNonShortSlotSta && |
| 1584 | session_entry->shortSlotTimeSupported)) { |
| 1585 | /* enable long slot time */ |
| 1586 | beacon_params->fShortSlotTime = false; |
| 1587 | beacon_params->paramChangeBitmap |= |
| 1588 | PARAM_SHORT_SLOT_TIME_CHANGED; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1589 | pe_debug("Disable short slot time. Enable long slot time"); |
Sreelakshmi Konamki | f611d1a | 2016-02-19 17:47:42 +0530 | [diff] [blame] | 1590 | session_entry->shortSlotTimeSupported = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1591 | } |
| 1592 | } |
| 1593 | |
| 1594 | /** ------------------------------------------------------------- |
| 1595 | \fn lim_decide_sta_protection_on_assoc |
| 1596 | \brief Decide protection related settings on Sta while association. |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1597 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1598 | \param tpSchBeaconStruct pBeaconStruct |
| 1599 | \return None |
| 1600 | -------------------------------------------------------------*/ |
| 1601 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1602 | lim_decide_sta_protection_on_assoc(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1603 | tpSchBeaconStruct pBeaconStruct, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1604 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1605 | { |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1606 | enum band_info rfBand = BAND_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1607 | uint32_t phyMode = WNI_CFG_PHY_MODE_NONE; |
| 1608 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1609 | lim_get_rf_band_new(mac, &rfBand, pe_session); |
| 1610 | lim_get_phy_mode(mac, &phyMode, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1611 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1612 | if (BAND_5G == rfBand) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1613 | if ((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) || |
| 1614 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == |
| 1615 | pBeaconStruct->HTInfo.opMode)) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1616 | if (mac->lim.cfgProtection.fromlla) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1617 | pe_session->beaconParams.llaCoexist = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1618 | } else if (eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == |
| 1619 | pBeaconStruct->HTInfo.opMode) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1620 | if (mac->lim.cfgProtection.ht20) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1621 | pe_session->beaconParams.ht20Coexist = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1622 | } |
| 1623 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1624 | } else if (BAND_2G == rfBand) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1625 | /* spec 7.3.2.13 */ |
| 1626 | /* UseProtection will be set when nonERP STA is associated. */ |
| 1627 | /* NonERPPresent bit will be set when: */ |
| 1628 | /* --nonERP Sta is associated OR */ |
| 1629 | /* --nonERP Sta exists in overlapping BSS */ |
| 1630 | /* when useProtection is not set then protection from nonERP stations is optional. */ |
| 1631 | |
| 1632 | /* CFG protection from 11b is enabled and */ |
| 1633 | /* 11B device in the BSS */ |
| 1634 | /* TODO, This is not sessionized */ |
| 1635 | if (phyMode != WNI_CFG_PHY_MODE_11B) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1636 | if (mac->lim.cfgProtection.fromllb && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1637 | pBeaconStruct->erpPresent && |
| 1638 | (pBeaconStruct->erpIEInfo.useProtection || |
| 1639 | pBeaconStruct->erpIEInfo.nonErpPresent)) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1640 | pe_session->beaconParams.llbCoexist = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1641 | } |
| 1642 | /* AP has no 11b station associated. */ |
| 1643 | else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1644 | pe_session->beaconParams.llbCoexist = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1645 | } |
| 1646 | } |
| 1647 | /* following code block is only for HT station. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1648 | if ((pe_session->htCapability) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1649 | (pBeaconStruct->HTInfo.present)) { |
| 1650 | tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo; |
| 1651 | |
| 1652 | /* Obss Non HT STA present mode */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1653 | pe_session->beaconParams.gHTObssMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1654 | (uint8_t) htInfo.obssNonHTStaPresent; |
| 1655 | |
| 1656 | /* CFG protection from 11G is enabled and */ |
| 1657 | /* our AP has at least one 11G station associated. */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1658 | if (mac->lim.cfgProtection.fromllg && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1659 | ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) || |
| 1660 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode)) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1661 | && (!pe_session->beaconParams.llbCoexist)) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1662 | if (mac->lim.cfgProtection.fromllg) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1663 | pe_session->beaconParams.llgCoexist = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1664 | true; |
| 1665 | } |
| 1666 | /* AP has only HT stations associated and at least one station is HT 20 */ |
| 1667 | /* disable protection from any non-HT devices. */ |
| 1668 | /* decision for disabling protection from 11b has already been taken above. */ |
| 1669 | if (eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode) { |
| 1670 | /* Disable protection from 11G station. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1671 | pe_session->beaconParams.llgCoexist = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1672 | /* CFG protection from HT 20 is enabled. */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1673 | if (mac->lim.cfgProtection.ht20) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1674 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | ht20Coexist = true; |
| 1676 | } |
| 1677 | /* Disable protection from non-HT and HT20 devices. */ |
| 1678 | /* decision for disabling protection from 11b has already been taken above. */ |
| 1679 | if (eSIR_HT_OP_MODE_PURE == htInfo.opMode) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1680 | pe_session->beaconParams.llgCoexist = false; |
| 1681 | pe_session->beaconParams.ht20Coexist = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1682 | } |
| 1683 | |
| 1684 | } |
| 1685 | } |
| 1686 | /* protection related factors other than HT operating mode. Applies to 2.4 GHZ as well as 5 GHZ. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1687 | if ((pe_session->htCapability) && (pBeaconStruct->HTInfo.present)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 1689 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1690 | pe_session->beaconParams.fRIFSMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1691 | (uint8_t) htInfo.rifsMode; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1692 | pe_session->beaconParams.llnNonGFCoexist = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1693 | (uint8_t) htInfo.nonGFDevicesPresent; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1694 | pe_session->beaconParams.fLsigTXOPProtectionFullSupport = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1695 | (uint8_t) htInfo.lsigTXOPProtectionFullSupport; |
| 1696 | } |
| 1697 | } |
| 1698 | |
| 1699 | |
| 1700 | /** |
| 1701 | * lim_decide_sta_11bg_protection() - decides protection related settings on sta |
| 1702 | * @mac_ctx: pointer to global mac structure |
| 1703 | * @beacon_struct: pointer to tpschbeaconstruct |
| 1704 | * @beaconparams: pointer to tpupdatebeaconparams |
| 1705 | * @psession_entry: pointer to tppesession |
| 1706 | * @phy_mode: phy mode index |
| 1707 | * |
| 1708 | * decides 11bg protection related settings on sta while processing beacon |
| 1709 | * |
| 1710 | * Return: none |
| 1711 | */ |
| 1712 | static void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1713 | lim_decide_sta_11bg_protection(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1714 | tpSchBeaconStruct beacon_struct, |
| 1715 | tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 1716 | struct pe_session *psession_entry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1717 | uint32_t phy_mode) |
| 1718 | { |
| 1719 | |
| 1720 | tDot11fIEHTInfo htInfo; |
| 1721 | |
| 1722 | /* |
| 1723 | * spec 7.3.2.13 |
| 1724 | * UseProtection will be set when nonERP STA is associated. |
| 1725 | * NonERPPresent bit will be set when: |
| 1726 | * --nonERP Sta is associated OR |
| 1727 | * --nonERP Sta exists in overlapping BSS |
| 1728 | * when useProtection is not set then protection from |
| 1729 | * nonERP stations is optional. |
| 1730 | */ |
| 1731 | if (phy_mode != WNI_CFG_PHY_MODE_11B) { |
| 1732 | if (beacon_struct->erpPresent && |
| 1733 | (beacon_struct->erpIEInfo.useProtection || |
| 1734 | beacon_struct->erpIEInfo.nonErpPresent)) { |
| 1735 | lim_enable11g_protection(mac_ctx, true, false, |
| 1736 | beaconparams, |
| 1737 | psession_entry); |
| 1738 | } |
| 1739 | /* AP has no 11b station associated. */ |
| 1740 | else { |
| 1741 | /* disable protection from 11b station */ |
| 1742 | lim_enable11g_protection(mac_ctx, false, false, |
| 1743 | beaconparams, |
| 1744 | psession_entry); |
| 1745 | } |
| 1746 | } |
| 1747 | |
| 1748 | if (!(psession_entry->htCapability) || |
| 1749 | !(beacon_struct->HTInfo.present)) |
| 1750 | return; |
| 1751 | |
| 1752 | /* following code is only for HT station. */ |
| 1753 | |
| 1754 | htInfo = beacon_struct->HTInfo; |
| 1755 | /* AP has at least one 11G station associated. */ |
| 1756 | if (((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) || |
| 1757 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode)) && |
| 1758 | (!psession_entry->beaconParams.llbCoexist)) { |
| 1759 | lim_enable_ht_protection_from11g(mac_ctx, true, false, |
| 1760 | beaconparams, psession_entry); |
| 1761 | |
| 1762 | } |
| 1763 | /* |
| 1764 | * no HT operating mode change ==> no change in |
| 1765 | * protection settings except for MIXED_MODE/Legacy |
| 1766 | * Mode. |
| 1767 | */ |
| 1768 | /* |
| 1769 | * in Mixed mode/legacy Mode even if there is no |
| 1770 | * change in HT operating mode, there might be |
| 1771 | * change in 11bCoexist or 11gCoexist. Hence this |
| 1772 | * check is being done after mixed/legacy mode |
| 1773 | * check. |
| 1774 | */ |
| 1775 | if (mac_ctx->lim.gHTOperMode != |
| 1776 | (tSirMacHTOperatingMode)htInfo.opMode) { |
| 1777 | mac_ctx->lim.gHTOperMode = |
| 1778 | (tSirMacHTOperatingMode) htInfo.opMode; |
| 1779 | /* |
| 1780 | * AP has only HT stations associated and |
| 1781 | * at least one station is HT 20 |
| 1782 | */ |
| 1783 | |
| 1784 | /* disable protection from any non-HT devices. */ |
| 1785 | |
| 1786 | /* |
| 1787 | * decision for disabling protection from |
| 1788 | * 11b has already been taken above. |
| 1789 | */ |
| 1790 | if (eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == |
| 1791 | htInfo.opMode) { |
| 1792 | /* Disable protection from 11G station. */ |
| 1793 | lim_enable_ht_protection_from11g(mac_ctx, false, |
| 1794 | false, beaconparams, |
| 1795 | psession_entry); |
| 1796 | |
| 1797 | lim_enable_ht20_protection(mac_ctx, true, false, |
| 1798 | beaconparams, |
| 1799 | psession_entry); |
| 1800 | } |
| 1801 | /* |
| 1802 | * Disable protection from non-HT and |
| 1803 | * HT20 devices. |
| 1804 | */ |
| 1805 | /* |
| 1806 | * decision for disabling protection from |
| 1807 | * 11b has already been taken above. |
| 1808 | */ |
| 1809 | else if (eSIR_HT_OP_MODE_PURE == htInfo.opMode) { |
| 1810 | lim_enable_ht_protection_from11g(mac_ctx, false, |
| 1811 | false, beaconparams, |
| 1812 | psession_entry); |
| 1813 | |
| 1814 | lim_enable_ht20_protection(mac_ctx, false, |
| 1815 | false, beaconparams, |
| 1816 | psession_entry); |
| 1817 | |
| 1818 | } |
| 1819 | } |
| 1820 | |
| 1821 | } |
| 1822 | |
| 1823 | /** |
| 1824 | * lim_decide_sta_protection() - decides protection related settings on sta |
| 1825 | * @mac_ctx: pointer to global mac structure |
| 1826 | * @beacon_struct: pointer to tpschbeaconstruct |
| 1827 | * @beaconparams: pointer to tpupdatebeaconparams |
| 1828 | * @psession_entry: pointer to tppesession |
| 1829 | * |
| 1830 | * decides protection related settings on sta while processing beacon |
| 1831 | * |
| 1832 | * Return: none |
| 1833 | */ |
| 1834 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1835 | lim_decide_sta_protection(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1836 | tpSchBeaconStruct beacon_struct, |
| 1837 | tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 1838 | struct pe_session *psession_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1839 | { |
| 1840 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1841 | enum band_info rfband = BAND_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1842 | uint32_t phy_mode = WNI_CFG_PHY_MODE_NONE; |
| 1843 | |
| 1844 | lim_get_rf_band_new(mac_ctx, &rfband, psession_entry); |
| 1845 | lim_get_phy_mode(mac_ctx, &phy_mode, psession_entry); |
| 1846 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1847 | if ((BAND_5G == rfband) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | /* we are HT capable. */ |
| 1849 | (true == psession_entry->htCapability) && |
| 1850 | (beacon_struct->HTInfo.present)) { |
| 1851 | /* |
| 1852 | * we are HT capable, AP's HT OPMode is |
| 1853 | * mixed / overlap legacy ==> need protection |
| 1854 | * from 11A. |
| 1855 | */ |
| 1856 | if ((eSIR_HT_OP_MODE_MIXED == |
| 1857 | beacon_struct->HTInfo.opMode) || |
| 1858 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == |
| 1859 | beacon_struct->HTInfo.opMode)) { |
| 1860 | lim_update_11a_protection(mac_ctx, true, false, |
| 1861 | beaconparams, psession_entry); |
| 1862 | } |
| 1863 | /* |
| 1864 | * we are HT capable, AP's HT OPMode is |
| 1865 | * HT20 ==> disable protection from 11A if |
| 1866 | * enabled. |
| 1867 | */ |
| 1868 | /* protection from HT20 if needed. */ |
| 1869 | else if (eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == |
| 1870 | beacon_struct->HTInfo.opMode) { |
| 1871 | lim_update_11a_protection(mac_ctx, false, false, |
| 1872 | beaconparams, psession_entry); |
| 1873 | lim_enable_ht20_protection(mac_ctx, true, false, |
| 1874 | beaconparams, psession_entry); |
| 1875 | } else if (eSIR_HT_OP_MODE_PURE == |
| 1876 | beacon_struct->HTInfo.opMode) { |
| 1877 | lim_update_11a_protection(mac_ctx, false, false, |
| 1878 | beaconparams, psession_entry); |
| 1879 | lim_enable_ht20_protection(mac_ctx, false, |
| 1880 | false, beaconparams, |
| 1881 | psession_entry); |
| 1882 | } |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1883 | } else if (BAND_2G == rfband) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1884 | lim_decide_sta_11bg_protection(mac_ctx, beacon_struct, |
| 1885 | beaconparams, psession_entry, phy_mode); |
| 1886 | } |
| 1887 | /* |
| 1888 | * following code block is only for HT station. |
| 1889 | * (2.4 GHZ as well as 5 GHZ) |
| 1890 | */ |
| 1891 | if ((psession_entry->htCapability) && (beacon_struct->HTInfo.present)) { |
| 1892 | tDot11fIEHTInfo htInfo = beacon_struct->HTInfo; |
| 1893 | /* |
| 1894 | * Check for changes in protection related factors other |
| 1895 | * than HT operating mode. |
| 1896 | */ |
| 1897 | /* |
| 1898 | * Check for changes in RIFS mode, nonGFDevicesPresent, |
| 1899 | * lsigTXOPProtectionFullSupport. |
| 1900 | */ |
| 1901 | if (psession_entry->beaconParams.fRIFSMode != |
| 1902 | (uint8_t) htInfo.rifsMode) { |
| 1903 | beaconparams->fRIFSMode = |
| 1904 | psession_entry->beaconParams.fRIFSMode = |
| 1905 | (uint8_t) htInfo.rifsMode; |
| 1906 | beaconparams->paramChangeBitmap |= |
| 1907 | PARAM_RIFS_MODE_CHANGED; |
| 1908 | } |
| 1909 | |
| 1910 | if (psession_entry->beaconParams.llnNonGFCoexist != |
| 1911 | htInfo.nonGFDevicesPresent) { |
| 1912 | beaconparams->llnNonGFCoexist = |
| 1913 | psession_entry->beaconParams.llnNonGFCoexist = |
| 1914 | (uint8_t) htInfo.nonGFDevicesPresent; |
| 1915 | beaconparams->paramChangeBitmap |= |
| 1916 | PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 1917 | } |
| 1918 | |
| 1919 | if (psession_entry->beaconParams. |
| 1920 | fLsigTXOPProtectionFullSupport != |
| 1921 | (uint8_t) htInfo.lsigTXOPProtectionFullSupport) { |
| 1922 | beaconparams->fLsigTXOPProtectionFullSupport = |
| 1923 | psession_entry->beaconParams. |
| 1924 | fLsigTXOPProtectionFullSupport = |
| 1925 | (uint8_t) htInfo. |
| 1926 | lsigTXOPProtectionFullSupport; |
| 1927 | beaconparams->paramChangeBitmap |= |
| 1928 | PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 1929 | } |
| 1930 | /* |
| 1931 | * For Station just update the global lim variable, |
| 1932 | * no need to send message to HAL since Station already |
| 1933 | * taking care of HT OPR Mode=01, |
| 1934 | * meaning AP is seeing legacy |
| 1935 | */ |
| 1936 | /* stations in overlapping BSS. */ |
| 1937 | if (psession_entry->beaconParams.gHTObssMode != |
| 1938 | (uint8_t) htInfo.obssNonHTStaPresent) |
| 1939 | psession_entry->beaconParams.gHTObssMode = |
| 1940 | (uint8_t) htInfo.obssNonHTStaPresent; |
| 1941 | |
| 1942 | } |
| 1943 | } |
| 1944 | |
| 1945 | /** |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 1946 | * __lim_process_channel_switch_timeout() |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1947 | * |
| 1948 | ***FUNCTION: |
| 1949 | * This function is invoked when Channel Switch Timer expires at |
| 1950 | * the STA. Now, STA must stop traffic, and then change/disable |
| 1951 | * primary or secondary channel. |
| 1952 | * |
| 1953 | * |
| 1954 | ***NOTE: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1955 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1956 | * @return None |
| 1957 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 1958 | static void __lim_process_channel_switch_timeout(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1959 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1960 | struct pe_session *pe_session = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1961 | uint8_t channel; /* This is received and stored from channelSwitch Action frame */ |
| 1962 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1963 | pe_session = pe_find_session_by_session_id(mac, |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1964 | mac->lim.limTimers.gLimChannelSwitchTimer.sessionId); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1965 | if (pe_session == NULL) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1966 | pe_err("Session Does not exist for given sessionID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1967 | return; |
| 1968 | } |
| 1969 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1970 | if (!LIM_IS_STA_ROLE(pe_session)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1971 | pe_warn("Channel switch can be done only in STA role, Current Role: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1972 | GET_LIM_SYSTEM_ROLE(pe_session)); |
Abhishek Singh | 4927556 | 2016-09-13 12:35:22 +0530 | [diff] [blame] | 1973 | return; |
| 1974 | } |
| 1975 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1976 | if (pe_session->gLimSpecMgmt.dot11hChanSwState != |
Abhishek Singh | 4927556 | 2016-09-13 12:35:22 +0530 | [diff] [blame] | 1977 | eLIM_11H_CHANSW_RUNNING) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1978 | pe_warn("Channel switch timer should not have been running in state: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1979 | pe_session->gLimSpecMgmt.dot11hChanSwState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1980 | return; |
| 1981 | } |
| 1982 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1983 | channel = pe_session->gLimChannelSwitch.primaryChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1984 | /* Restore Channel Switch parameters to default */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1985 | pe_session->gLimChannelSwitch.switchTimeoutValue = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1986 | |
| 1987 | /* Channel-switch timeout has occurred. reset the state */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1988 | pe_session->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1989 | |
| 1990 | /* Check if the AP is switching to a channel that we support. |
| 1991 | * Else, just don't bother to switch. Indicate HDD to look for a |
| 1992 | * better AP to associate |
| 1993 | */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 1994 | if (!lim_is_channel_valid_for_channel_switch(mac, channel)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | /* We need to restore pre-channelSwitch state on the STA */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1996 | if (lim_restore_pre_channel_switch_state(mac, pe_session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1997 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 1998 | pe_err("Could not restore pre-channelSwitch (11h) state, resetting the system"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1999 | return; |
| 2000 | } |
| 2001 | |
Abhishek Singh | 4927556 | 2016-09-13 12:35:22 +0530 | [diff] [blame] | 2002 | /* |
| 2003 | * If the channel-list that AP is asking us to switch is invalid |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2004 | * then we cannot switch the channel. Just disassociate from AP. |
| 2005 | * We will find a better AP !!! |
| 2006 | */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2007 | if ((pe_session->limMlmState == |
Abhishek Singh | 4927556 | 2016-09-13 12:35:22 +0530 | [diff] [blame] | 2008 | eLIM_MLM_LINK_ESTABLISHED_STATE) && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2009 | (pe_session->limSmeState != eLIM_SME_WT_DISASSOC_STATE) && |
| 2010 | (pe_session->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2011 | pe_err("Invalid channel! Disconnect"); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2012 | lim_tear_down_link_with_ap(mac, |
| 2013 | mac->lim.limTimers. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2014 | gLimChannelSwitchTimer.sessionId, |
| 2015 | eSIR_MAC_UNSPEC_FAILURE_REASON); |
Abhishek Singh | 4927556 | 2016-09-13 12:35:22 +0530 | [diff] [blame] | 2016 | return; |
| 2017 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2018 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2019 | lim_covert_channel_scan_type(mac, pe_session->currentOperChannel, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2020 | false); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2021 | mac->lim.dfschannelList.timeStamp[pe_session->currentOperChannel] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2022 | 0; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2023 | switch (pe_session->gLimChannelSwitch.state) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2024 | case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY: |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2025 | pe_warn("CHANNEL_SWITCH_PRIMARY_ONLY"); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2026 | lim_switch_primary_channel(mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2027 | pe_session->gLimChannelSwitch. |
| 2028 | primaryChannel, pe_session); |
| 2029 | pe_session->gLimChannelSwitch.state = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2030 | eLIM_CHANNEL_SWITCH_IDLE; |
| 2031 | break; |
| 2032 | case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY: |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2033 | pe_warn("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2034 | lim_switch_primary_secondary_channel(mac, pe_session, |
| 2035 | pe_session->gLimChannelSwitch.primaryChannel, |
| 2036 | pe_session->gLimChannelSwitch.ch_center_freq_seg0, |
| 2037 | pe_session->gLimChannelSwitch.ch_center_freq_seg1, |
| 2038 | pe_session->gLimChannelSwitch.ch_width); |
| 2039 | pe_session->gLimChannelSwitch.state = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2040 | eLIM_CHANNEL_SWITCH_IDLE; |
| 2041 | break; |
| 2042 | |
| 2043 | case eLIM_CHANNEL_SWITCH_IDLE: |
| 2044 | default: |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2045 | pe_err("incorrect state"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2046 | if (lim_restore_pre_channel_switch_state(mac, pe_session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2047 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2048 | pe_err("Could not restore pre-channelSwitch (11h) state, resetting the system"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2049 | } |
| 2050 | return; /* Please note, this is 'return' and not 'break' */ |
| 2051 | } |
| 2052 | } |
| 2053 | |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 2054 | #ifdef CONFIG_VDEV_SM |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2055 | void lim_process_channel_switch_timeout(struct mac_context *mac_ctx) |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 2056 | { |
| 2057 | tpPESession session_entry = NULL; |
| 2058 | QDF_STATUS status; |
| 2059 | |
| 2060 | session_entry = pe_find_session_by_session_id( |
| 2061 | mac_ctx, |
| 2062 | mac_ctx->lim.limTimers.gLimChannelSwitchTimer.sessionId); |
| 2063 | mlme_set_chan_switch_in_progress(session_entry->vdev, true); |
| 2064 | status = wlan_vdev_mlme_sm_deliver_evt( |
| 2065 | session_entry->vdev, |
| 2066 | WLAN_VDEV_SM_EV_FW_VDEV_RESTART, |
| 2067 | sizeof(*mac_ctx), |
| 2068 | mac_ctx); |
| 2069 | if (QDF_IS_STATUS_ERROR(status)) { |
| 2070 | pe_err("Failed to post WLAN_VDEV_SM_EV_FW_VDEV_RESTART for vdevid %d", |
| 2071 | session_entry->smeSessionId); |
| 2072 | mlme_set_chan_switch_in_progress(session_entry->vdev, false); |
| 2073 | } |
| 2074 | } |
| 2075 | #else |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2076 | void lim_process_channel_switch_timeout(struct mac_context *mac) |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 2077 | { |
| 2078 | __lim_process_channel_switch_timeout(mac); |
| 2079 | } |
| 2080 | #endif |
| 2081 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2082 | /** |
| 2083 | * lim_update_channel_switch() - This Function updates channel switch |
| 2084 | * @mac_ctx: pointer to Global MAC structure |
| 2085 | * @beacon: pointer to tpSirProbeRespBeacon |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2086 | * @psessionentry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2087 | * |
| 2088 | * This function is invoked whenever Station receives |
| 2089 | * either 802.11h channel switch IE or airgo proprietary |
| 2090 | * channel switch IE. |
| 2091 | * |
| 2092 | * Return: none |
| 2093 | */ |
| 2094 | void |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 2095 | lim_update_channel_switch(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2096 | tpSirProbeRespBeacon beacon, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2097 | struct pe_session *psession_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2098 | { |
| 2099 | uint16_t beacon_period; |
| 2100 | tDot11fIEChanSwitchAnn *chnl_switch; |
| 2101 | tLimChannelSwitchInfo *ch_switch_params; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2102 | tDot11fIEWiderBWChanSwitchAnn *widerchnl_switch; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2103 | |
| 2104 | beacon_period = psession_entry->beaconParams.beaconInterval; |
| 2105 | |
| 2106 | /* 802.11h standard channel switch IE */ |
| 2107 | chnl_switch = &(beacon->channelSwitchIE); |
| 2108 | ch_switch_params = &psession_entry->gLimChannelSwitch; |
| 2109 | ch_switch_params->primaryChannel = |
| 2110 | chnl_switch->newChannel; |
| 2111 | ch_switch_params->switchCount = chnl_switch->switchCount; |
| 2112 | ch_switch_params->switchTimeoutValue = |
| 2113 | SYS_MS_TO_TICKS(beacon_period) * (chnl_switch->switchCount); |
| 2114 | ch_switch_params->switchMode = chnl_switch->switchMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2115 | widerchnl_switch = &(beacon->WiderBWChanSwitchAnn); |
| 2116 | if (beacon->WiderBWChanSwitchAnnPresent) { |
| 2117 | psession_entry->gLimWiderBWChannelSwitch.newChanWidth = |
| 2118 | widerchnl_switch->newChanWidth; |
| 2119 | psession_entry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = |
| 2120 | widerchnl_switch->newCenterChanFreq0; |
| 2121 | psession_entry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = |
| 2122 | widerchnl_switch->newCenterChanFreq1; |
| 2123 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2124 | /* Only primary channel switch element is present */ |
| 2125 | ch_switch_params->state = |
| 2126 | eLIM_CHANNEL_SWITCH_PRIMARY_ONLY; |
| 2127 | ch_switch_params->ch_width = CH_WIDTH_20MHZ; |
| 2128 | |
| 2129 | /* |
| 2130 | * Do not bother to look and operate on extended channel switch element |
| 2131 | * if our own channel-bonding state is not enabled |
| 2132 | */ |
| 2133 | if (psession_entry->htSupportedChannelWidthSet && |
| 2134 | beacon->sec_chan_offset_present) { |
| 2135 | if (beacon->sec_chan_offset.secondaryChannelOffset == |
| 2136 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) { |
| 2137 | ch_switch_params->state = |
| 2138 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2139 | ch_switch_params->ch_width = CH_WIDTH_40MHZ; |
| 2140 | ch_switch_params->ch_center_freq_seg0 = |
| 2141 | ch_switch_params->primaryChannel + 2; |
| 2142 | } else if (beacon->sec_chan_offset.secondaryChannelOffset == |
| 2143 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) { |
| 2144 | ch_switch_params->state = |
| 2145 | eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY; |
| 2146 | ch_switch_params->ch_width = CH_WIDTH_40MHZ; |
| 2147 | ch_switch_params->ch_center_freq_seg0 = |
| 2148 | ch_switch_params->primaryChannel - 2; |
| 2149 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2150 | if (psession_entry->vhtCapability && |
| 2151 | beacon->WiderBWChanSwitchAnnPresent) { |
| 2152 | ch_switch_params->ch_width = |
| 2153 | widerchnl_switch->newChanWidth + 1; |
| 2154 | ch_switch_params->ch_center_freq_seg0 = |
| 2155 | psession_entry->gLimWiderBWChannelSwitch. |
| 2156 | newCenterChanFreq0; |
| 2157 | ch_switch_params->ch_center_freq_seg1 = |
| 2158 | psession_entry->gLimWiderBWChannelSwitch. |
| 2159 | newCenterChanFreq1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2160 | } |
| 2161 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2162 | if (QDF_STATUS_SUCCESS != lim_start_channel_switch(mac_ctx, psession_entry)) |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2163 | pe_warn("Could not start Channel Switch"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2164 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2165 | pe_debug("session: %d primary chl: %d ch_width: %d count: %d (%d ticks)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2166 | psession_entry->peSessionId, |
| 2167 | psession_entry->gLimChannelSwitch.primaryChannel, |
| 2168 | psession_entry->gLimChannelSwitch.ch_width, |
| 2169 | psession_entry->gLimChannelSwitch.switchCount, |
| 2170 | psession_entry->gLimChannelSwitch.switchTimeoutValue); |
| 2171 | return; |
| 2172 | } |
| 2173 | |
| 2174 | /** |
| 2175 | * lim_cancel_dot11h_channel_switch |
| 2176 | * |
| 2177 | ***FUNCTION: |
| 2178 | * This function is called when STA does not send updated channel-swith IE |
| 2179 | * after indicating channel-switch start. This will cancel the channel-swith |
| 2180 | * timer which is already running. |
| 2181 | * |
| 2182 | ***LOGIC: |
| 2183 | * |
| 2184 | ***ASSUMPTIONS: |
| 2185 | * |
| 2186 | ***NOTE: |
| 2187 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2188 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2189 | * |
| 2190 | * @return None |
| 2191 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2192 | void lim_cancel_dot11h_channel_switch(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2193 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2194 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2195 | if (!LIM_IS_STA_ROLE(pe_session)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2196 | return; |
| 2197 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2198 | pe_debug("Received a beacon without channel switch IE"); |
Nishank Aggarwal | e59eb39 | 2017-03-10 17:34:42 +0530 | [diff] [blame] | 2199 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2200 | MTRACE(mac_trace |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2201 | (mac, TRACE_CODE_TIMER_DEACTIVATE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2202 | pe_session->peSessionId, eLIM_CHANNEL_SWITCH_TIMER)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2203 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2204 | if (tx_timer_deactivate(&mac->lim.limTimers.gLimChannelSwitchTimer) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2205 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2206 | pe_err("tx_timer_deactivate failed!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2207 | } |
| 2208 | |
| 2209 | /* We need to restore pre-channelSwitch state on the STA */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2210 | if (lim_restore_pre_channel_switch_state(mac, pe_session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2211 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2212 | pe_err("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2213 | } |
| 2214 | } |
| 2215 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2216 | /** ------------------------------------------------------------------------ **/ |
| 2217 | /** |
| 2218 | * keep track of the number of ANI peers associated in the BSS |
| 2219 | * For the first and last ANI peer, we have to update EDCA params as needed |
| 2220 | * |
| 2221 | * When the first ANI peer joins the BSS, we notify SCH |
| 2222 | * When the last ANI peer leaves the BSS, we notfiy SCH |
| 2223 | */ |
| 2224 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2225 | lim_util_count_sta_add(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2226 | tpDphHashNode pSta, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2227 | { |
| 2228 | |
| 2229 | if ((!pSta) || (!pSta->valid) || (pSta->fAniCount)) |
| 2230 | return; |
| 2231 | |
| 2232 | pSta->fAniCount = 1; |
| 2233 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2234 | if (mac->lim.gLimNumOfAniSTAs++ != 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2235 | return; |
| 2236 | |
| 2237 | /* get here only if this is the first ANI peer in the BSS */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2238 | sch_edca_profile_update(mac, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2239 | } |
| 2240 | |
| 2241 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2242 | lim_util_count_sta_del(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2243 | tpDphHashNode pSta, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2244 | { |
| 2245 | |
| 2246 | if ((pSta == NULL) || (!pSta->fAniCount)) |
| 2247 | return; |
| 2248 | |
| 2249 | /* Only if sta is invalid and the validInDummyState bit is set to 1, |
| 2250 | * then go ahead and update the count and profiles. This ensures |
| 2251 | * that the "number of ani station" count is properly incremented/decremented. |
| 2252 | */ |
| 2253 | if (pSta->valid == 1) |
| 2254 | return; |
| 2255 | |
| 2256 | pSta->fAniCount = 0; |
| 2257 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2258 | if (mac->lim.gLimNumOfAniSTAs <= 0) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2259 | pe_err("CountStaDel: ignoring Delete Req when AniPeer count: %d", |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2260 | mac->lim.gLimNumOfAniSTAs); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2261 | return; |
| 2262 | } |
| 2263 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2264 | mac->lim.gLimNumOfAniSTAs--; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2265 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2266 | if (mac->lim.gLimNumOfAniSTAs != 0) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2267 | return; |
| 2268 | |
| 2269 | /* get here only if this is the last ANI peer in the BSS */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2270 | sch_edca_profile_update(mac, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2271 | } |
| 2272 | |
| 2273 | /** |
| 2274 | * lim_switch_channel_cback() |
| 2275 | * |
| 2276 | ***FUNCTION: |
| 2277 | * This is the callback function registered while requesting to switch channel |
| 2278 | * after AP indicates a channel switch for spectrum management (11h). |
| 2279 | * |
| 2280 | ***NOTE: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2281 | * @param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2282 | * @param status Status of channel switch request |
| 2283 | * @param data User data |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2284 | * @param pe_session Session information |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2285 | * @return NONE |
| 2286 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2287 | void lim_switch_channel_cback(struct mac_context *mac, QDF_STATUS status, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2288 | uint32_t *data, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2289 | { |
Rajeev Kumar | 416b73f | 2017-01-21 16:45:21 -0800 | [diff] [blame] | 2290 | struct scheduler_msg mmhMsg = { 0 }; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2291 | tSirSmeSwitchChannelInd *pSirSmeSwitchChInd; |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 2292 | #ifdef CONFIG_VDEV_SM |
| 2293 | QDF_STATUS evt_status; |
| 2294 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2295 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2296 | pe_session->currentOperChannel = pe_session->currentReqChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2297 | |
| 2298 | /* We need to restore pre-channelSwitch state on the STA */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2299 | if (lim_restore_pre_channel_switch_state(mac, pe_session) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2300 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2301 | pe_err("Could not restore pre-channelSwitch (11h) state, resetting the system"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2302 | return; |
| 2303 | } |
| 2304 | |
| 2305 | mmhMsg.type = eWNI_SME_SWITCH_CHL_IND; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2306 | pSirSmeSwitchChInd = qdf_mem_malloc(sizeof(tSirSmeSwitchChannelInd)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2307 | if (!pSirSmeSwitchChInd) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2308 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2309 | |
| 2310 | pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_IND; |
| 2311 | pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd); |
| 2312 | pSirSmeSwitchChInd->newChannelId = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2313 | pe_session->gLimChannelSwitch.primaryChannel; |
| 2314 | pSirSmeSwitchChInd->sessionId = pe_session->smeSessionId; |
Manishekar Chandrasekaran | ec26759 | 2016-05-26 19:10:04 +0530 | [diff] [blame] | 2315 | pSirSmeSwitchChInd->chan_params.ch_width = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2316 | pe_session->gLimChannelSwitch.ch_width; |
Manishekar Chandrasekaran | ec26759 | 2016-05-26 19:10:04 +0530 | [diff] [blame] | 2317 | pSirSmeSwitchChInd->chan_params.sec_ch_offset = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2318 | pe_session->gLimChannelSwitch.sec_ch_offset; |
Manishekar Chandrasekaran | ec26759 | 2016-05-26 19:10:04 +0530 | [diff] [blame] | 2319 | pSirSmeSwitchChInd->chan_params.center_freq_seg0 = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2320 | pe_session->gLimChannelSwitch.ch_center_freq_seg0; |
Manishekar Chandrasekaran | ec26759 | 2016-05-26 19:10:04 +0530 | [diff] [blame] | 2321 | pSirSmeSwitchChInd->chan_params.center_freq_seg1 = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2322 | pe_session->gLimChannelSwitch.ch_center_freq_seg1; |
Manishekar Chandrasekaran | ec26759 | 2016-05-26 19:10:04 +0530 | [diff] [blame] | 2323 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2324 | pe_debug("session: %d chan: %d width: %d sec offset: %d seg0: %d seg1: %d", |
Manishekar Chandrasekaran | ec26759 | 2016-05-26 19:10:04 +0530 | [diff] [blame] | 2325 | pSirSmeSwitchChInd->sessionId, |
| 2326 | pSirSmeSwitchChInd->newChannelId, |
| 2327 | pSirSmeSwitchChInd->chan_params.ch_width, |
| 2328 | pSirSmeSwitchChInd->chan_params.sec_ch_offset, |
| 2329 | pSirSmeSwitchChInd->chan_params.center_freq_seg0, |
| 2330 | pSirSmeSwitchChInd->chan_params.center_freq_seg1); |
| 2331 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2332 | qdf_mem_copy(pSirSmeSwitchChInd->bssid.bytes, pe_session->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2333 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2334 | mmhMsg.bodyptr = pSirSmeSwitchChInd; |
| 2335 | mmhMsg.bodyval = 0; |
| 2336 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2337 | MTRACE(mac_trace(mac, TRACE_CODE_TX_SME_MSG, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2338 | pe_session->peSessionId, mmhMsg.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2339 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2340 | sys_process_mmh_msg(mac, &mmhMsg); |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 2341 | #ifdef CONFIG_VDEV_SM |
| 2342 | evt_status = wlan_vdev_mlme_sm_deliver_evt( |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2343 | pe_session->vdev, |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 2344 | WLAN_VDEV_SM_EV_START_SUCCESS, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2345 | sizeof(*pe_session), pe_session); |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 2346 | if (QDF_IS_STATUS_ERROR(evt_status)) { |
| 2347 | pe_err("Failed to post WLAN_VDEV_SM_EV_START_SUCCESS for vdevid %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2348 | pe_session->smeSessionId); |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 2349 | } |
| 2350 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2351 | } |
| 2352 | |
| 2353 | /** |
| 2354 | * lim_switch_primary_channel() |
| 2355 | * |
| 2356 | ***FUNCTION: |
| 2357 | * This function changes the current operating channel |
| 2358 | * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL. |
| 2359 | * |
| 2360 | ***NOTE: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2361 | * @param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2362 | * @param newChannel new chnannel ID |
| 2363 | * @return NONE |
| 2364 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2365 | void lim_switch_primary_channel(struct mac_context *mac, uint8_t newChannel, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2366 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2367 | { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2368 | pe_debug("old chnl: %d --> new chnl: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2369 | pe_session->currentOperChannel, newChannel); |
Nishank Aggarwal | e59eb39 | 2017-03-10 17:34:42 +0530 | [diff] [blame] | 2370 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2371 | pe_session->currentReqChannel = newChannel; |
| 2372 | pe_session->limRFBand = lim_get_rf_band(newChannel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2373 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2374 | pe_session->channelChangeReasonCode = LIM_SWITCH_CHANNEL_OPERATION; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2375 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2376 | mac->lim.gpchangeChannelCallback = lim_switch_channel_cback; |
| 2377 | mac->lim.gpchangeChannelData = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2378 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2379 | lim_send_switch_chnl_params(mac, newChannel, 0, 0, CH_WIDTH_20MHZ, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2380 | pe_session->maxTxPower, |
| 2381 | pe_session->peSessionId, false, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2382 | return; |
| 2383 | } |
| 2384 | |
| 2385 | /** |
| 2386 | * lim_switch_primary_secondary_channel() |
| 2387 | * |
| 2388 | ***FUNCTION: |
| 2389 | * This function changes the primary and secondary channel. |
| 2390 | * If 11h is enabled and user provides a "new channel ID" |
| 2391 | * that is different from the current operating channel, |
| 2392 | * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL, |
| 2393 | * assign notify LIM of such change. |
| 2394 | * |
| 2395 | ***NOTE: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2396 | * @param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2397 | * @param newChannel New chnannel ID (or current channel ID) |
| 2398 | * @param subband CB secondary info: |
| 2399 | * - eANI_CB_SECONDARY_NONE |
| 2400 | * - eANI_CB_SECONDARY_UP |
| 2401 | * - eANI_CB_SECONDARY_DOWN |
| 2402 | * @return NONE |
| 2403 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2404 | void lim_switch_primary_secondary_channel(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2405 | struct pe_session *pe_session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2406 | uint8_t newChannel, |
| 2407 | uint8_t ch_center_freq_seg0, |
| 2408 | uint8_t ch_center_freq_seg1, |
Kiran Kumar Lokere | 1364467 | 2016-02-29 15:40:10 -0800 | [diff] [blame] | 2409 | enum phy_ch_width ch_width) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2410 | { |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 2411 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2412 | /* Assign the callback to resume TX once channel is changed. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2413 | pe_session->currentReqChannel = newChannel; |
| 2414 | pe_session->limRFBand = lim_get_rf_band(newChannel); |
| 2415 | pe_session->channelChangeReasonCode = LIM_SWITCH_CHANNEL_OPERATION; |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2416 | mac->lim.gpchangeChannelCallback = lim_switch_channel_cback; |
| 2417 | mac->lim.gpchangeChannelData = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2418 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2419 | lim_send_switch_chnl_params(mac, newChannel, ch_center_freq_seg0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2420 | ch_center_freq_seg1, ch_width, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2421 | pe_session->maxTxPower, |
| 2422 | pe_session->peSessionId, |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 2423 | false, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2424 | |
| 2425 | /* Store the new primary and secondary channel in session entries if different */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2426 | if (pe_session->currentOperChannel != newChannel) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2427 | pe_warn("switch old chnl: %d --> new chnl: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2428 | pe_session->currentOperChannel, newChannel); |
| 2429 | pe_session->currentOperChannel = newChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2430 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2431 | if (pe_session->htSecondaryChannelOffset != |
| 2432 | pe_session->gLimChannelSwitch.sec_ch_offset) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2433 | pe_warn("switch old sec chnl: %d --> new sec chnl: %d", |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2434 | pe_session->htSecondaryChannelOffset, |
| 2435 | pe_session->gLimChannelSwitch.sec_ch_offset); |
| 2436 | pe_session->htSecondaryChannelOffset = |
| 2437 | pe_session->gLimChannelSwitch.sec_ch_offset; |
| 2438 | if (pe_session->htSecondaryChannelOffset == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2439 | PHY_SINGLE_CHANNEL_CENTERED) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2440 | pe_session->htSupportedChannelWidthSet = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2441 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 2442 | } else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2443 | pe_session->htSupportedChannelWidthSet = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2444 | WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
| 2445 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2446 | pe_session->htRecommendedTxWidthSet = |
| 2447 | pe_session->htSupportedChannelWidthSet; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2448 | } |
| 2449 | |
| 2450 | return; |
| 2451 | } |
| 2452 | |
| 2453 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2454 | * lim_get_ht_capability() |
| 2455 | * |
| 2456 | ***FUNCTION: |
| 2457 | * A utility function that returns the "current HT capability state" for the HT |
| 2458 | * capability of interest (as requested in the API) |
| 2459 | * |
| 2460 | ***LOGIC: |
| 2461 | * This routine will return with the "current" setting of a requested HT |
| 2462 | * capability. This state info could be retrieved from - |
| 2463 | * a) CFG (for static entries) |
| 2464 | * b) Run time info |
| 2465 | * - Dynamic state maintained by LIM |
| 2466 | * - Configured at radio init time by SME |
| 2467 | * |
| 2468 | * |
| 2469 | ***ASSUMPTIONS: |
| 2470 | * NA |
| 2471 | * |
| 2472 | ***NOTE: |
| 2473 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2474 | * @param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2475 | * @param htCap The HT capability being queried |
| 2476 | * @return uint8_t The current state of the requested HT capability is returned in a |
| 2477 | * uint8_t variable |
| 2478 | */ |
| 2479 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2480 | uint8_t lim_get_ht_capability(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2481 | uint32_t htCap, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2482 | { |
| 2483 | uint8_t retVal = 0; |
| 2484 | uint8_t *ptr; |
| 2485 | uint32_t cfgValue; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2486 | tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = { 0 }; |
| 2487 | tSirMacASCapabilityInfo macASCapabilityInfo = { 0 }; |
| 2488 | |
| 2489 | /* */ |
| 2490 | /* Determine which CFG to read from. Not ALL of the HT */ |
| 2491 | /* related CFG's need to be read each time this API is */ |
| 2492 | /* accessed */ |
| 2493 | /* */ |
| 2494 | if (htCap >= eHT_ANTENNA_SELECTION && htCap < eHT_SI_GRANULARITY) { |
| 2495 | /* Get Antenna Seletion HT Capabilities */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2496 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2497 | wlan_cfg_get_int(mac, WNI_CFG_AS_CAP, &cfgValue)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2498 | cfgValue = 0; |
| 2499 | ptr = (uint8_t *) &macASCapabilityInfo; |
| 2500 | *((uint8_t *) ptr) = (uint8_t) (cfgValue & 0xff); |
Vignesh Viswanathan | ddc89e5 | 2018-11-02 18:43:42 +0530 | [diff] [blame] | 2501 | } else if (htCap >= eHT_TX_BEAMFORMING && |
| 2502 | htCap < eHT_ANTENNA_SELECTION) { |
| 2503 | /* Get Transmit Beam Forming HT Capabilities */ |
| 2504 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2505 | wlan_cfg_get_int(mac, WNI_CFG_TX_BF_CAP, &cfgValue)) |
Vignesh Viswanathan | ddc89e5 | 2018-11-02 18:43:42 +0530 | [diff] [blame] | 2506 | cfgValue = 0; |
| 2507 | ptr = (uint8_t *)&macTxBFCapabilityInfo; |
| 2508 | *((uint32_t *)ptr) = (uint32_t)(cfgValue); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2509 | } |
| 2510 | |
| 2511 | switch (htCap) { |
| 2512 | case eHT_LSIG_TXOP_PROTECTION: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2513 | retVal = mac->lim.gHTLsigTXOPProtection; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2514 | break; |
| 2515 | |
| 2516 | case eHT_STBC_CONTROL_FRAME: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2517 | retVal = (uint8_t)mac->mlme_cfg->ht_caps.ht_cap_info. |
Vignesh Viswanathan | ddc89e5 | 2018-11-02 18:43:42 +0530 | [diff] [blame] | 2518 | stbc_control_frame; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2519 | break; |
| 2520 | |
| 2521 | case eHT_PSMP: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2522 | retVal = mac->lim.gHTPSMPSupport; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2523 | break; |
| 2524 | |
| 2525 | case eHT_DSSS_CCK_MODE_40MHZ: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2526 | retVal = mac->lim.gHTDsssCckRate40MHzSupport; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2527 | break; |
| 2528 | |
| 2529 | case eHT_MAX_AMSDU_LENGTH: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2530 | retVal = (uint8_t)mac->mlme_cfg->ht_caps.ht_cap_info. |
Vignesh Viswanathan | ddc89e5 | 2018-11-02 18:43:42 +0530 | [diff] [blame] | 2531 | maximal_amsdu_size; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2532 | break; |
| 2533 | |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 2534 | case eHT_MAX_AMSDU_NUM: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2535 | retVal = (uint8_t) pe_session->max_amsdu_num; |
Deepak Dhamdhere | 612392c | 2016-08-28 02:56:51 -0700 | [diff] [blame] | 2536 | break; |
| 2537 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2538 | case eHT_RX_STBC: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2539 | retVal = (uint8_t) pe_session->htConfig.ht_rx_stbc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2540 | break; |
| 2541 | |
| 2542 | case eHT_TX_STBC: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2543 | retVal = (uint8_t) pe_session->htConfig.ht_tx_stbc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2544 | break; |
| 2545 | |
| 2546 | case eHT_SHORT_GI_40MHZ: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2547 | retVal = (uint8_t)(pe_session->htConfig.ht_sgi40) ? |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2548 | mac->mlme_cfg->ht_caps.ht_cap_info.short_gi_40_mhz : 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2549 | break; |
| 2550 | |
| 2551 | case eHT_SHORT_GI_20MHZ: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2552 | retVal = (uint8_t)(pe_session->htConfig.ht_sgi20) ? |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2553 | mac->mlme_cfg->ht_caps.ht_cap_info.short_gi_20_mhz : 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2554 | break; |
| 2555 | |
| 2556 | case eHT_GREENFIELD: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2557 | retVal = (uint8_t)mac->mlme_cfg->ht_caps.ht_cap_info. |
Vignesh Viswanathan | ddc89e5 | 2018-11-02 18:43:42 +0530 | [diff] [blame] | 2558 | green_field; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2559 | break; |
| 2560 | |
| 2561 | case eHT_MIMO_POWER_SAVE: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2562 | retVal = (uint8_t) mac->lim.gHTMIMOPSState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2563 | break; |
| 2564 | |
| 2565 | case eHT_SUPPORTED_CHANNEL_WIDTH_SET: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2566 | retVal = (uint8_t) pe_session->htSupportedChannelWidthSet; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2567 | break; |
| 2568 | |
| 2569 | case eHT_ADVANCED_CODING: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2570 | retVal = (uint8_t) pe_session->htConfig.ht_rx_ldpc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2571 | break; |
| 2572 | |
| 2573 | case eHT_MAX_RX_AMPDU_FACTOR: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2574 | retVal = mac->lim.gHTMaxRxAMpduFactor; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2575 | break; |
| 2576 | |
| 2577 | case eHT_MPDU_DENSITY: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2578 | retVal = mac->lim.gHTAMpduDensity; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2579 | break; |
| 2580 | |
| 2581 | case eHT_PCO: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2582 | retVal = (uint8_t)mac->mlme_cfg->ht_caps.ext_cap_info.pco; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2583 | break; |
| 2584 | |
| 2585 | case eHT_TRANSITION_TIME: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2586 | retVal = (uint8_t)mac->mlme_cfg->ht_caps.ext_cap_info. |
Vignesh Viswanathan | ddc89e5 | 2018-11-02 18:43:42 +0530 | [diff] [blame] | 2587 | transition_time; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2588 | break; |
| 2589 | |
| 2590 | case eHT_MCS_FEEDBACK: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2591 | retVal = (uint8_t)mac->mlme_cfg->ht_caps.ext_cap_info. |
Vignesh Viswanathan | ddc89e5 | 2018-11-02 18:43:42 +0530 | [diff] [blame] | 2592 | mcs_feedback; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2593 | break; |
| 2594 | |
| 2595 | case eHT_TX_BEAMFORMING: |
| 2596 | retVal = (uint8_t) macTxBFCapabilityInfo.txBF; |
| 2597 | break; |
| 2598 | |
| 2599 | case eHT_ANTENNA_SELECTION: |
| 2600 | retVal = (uint8_t) macASCapabilityInfo.antennaSelection; |
| 2601 | break; |
| 2602 | |
| 2603 | case eHT_SI_GRANULARITY: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2604 | retVal = mac->lim.gHTServiceIntervalGranularity; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2605 | break; |
| 2606 | |
| 2607 | case eHT_CONTROLLED_ACCESS: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2608 | retVal = mac->lim.gHTControlledAccessOnly; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2609 | break; |
| 2610 | |
| 2611 | case eHT_RIFS_MODE: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2612 | retVal = pe_session->beaconParams.fRIFSMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2613 | break; |
| 2614 | |
| 2615 | case eHT_RECOMMENDED_TX_WIDTH_SET: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2616 | retVal = pe_session->htRecommendedTxWidthSet; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2617 | break; |
| 2618 | |
| 2619 | case eHT_EXTENSION_CHANNEL_OFFSET: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2620 | retVal = pe_session->htSecondaryChannelOffset; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2621 | break; |
| 2622 | |
| 2623 | case eHT_OP_MODE: |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2624 | if (LIM_IS_AP_ROLE(pe_session)) |
| 2625 | retVal = pe_session->htOperMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2626 | else |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2627 | retVal = mac->lim.gHTOperMode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2628 | break; |
| 2629 | |
| 2630 | case eHT_BASIC_STBC_MCS: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2631 | retVal = mac->lim.gHTSTBCBasicMCS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2632 | break; |
| 2633 | |
| 2634 | case eHT_DUAL_CTS_PROTECTION: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2635 | retVal = mac->lim.gHTDualCTSProtection; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2636 | break; |
| 2637 | |
| 2638 | case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT: |
| 2639 | retVal = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2640 | pe_session->beaconParams.fLsigTXOPProtectionFullSupport; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2641 | break; |
| 2642 | |
| 2643 | case eHT_PCO_ACTIVE: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2644 | retVal = mac->lim.gHTPCOActive; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2645 | break; |
| 2646 | |
| 2647 | case eHT_PCO_PHASE: |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 2648 | retVal = mac->lim.gHTPCOPhase; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2649 | break; |
| 2650 | |
| 2651 | default: |
| 2652 | break; |
| 2653 | } |
| 2654 | |
| 2655 | return retVal; |
| 2656 | } |
| 2657 | |
| 2658 | /** |
| 2659 | * lim_enable_11a_protection() - updates protection params for enable 11a |
| 2660 | * protection request |
| 2661 | * @mac_ctx: pointer to Global MAC structure |
| 2662 | * @overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 2663 | * @bcn_prms: beacon parameters |
| 2664 | * @pe_session: pe session entry |
| 2665 | * |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 2666 | * This function updates protection params for enable 11a protection request |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2667 | * |
| 2668 | * @Return: void |
| 2669 | */ |
| 2670 | static void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2671 | lim_enable_11a_protection(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2672 | uint8_t overlap, |
| 2673 | tpUpdateBeaconParams bcn_prms, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2674 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2675 | { |
| 2676 | /* |
| 2677 | * If we are AP and HT capable, we need to set the HT OP mode |
| 2678 | * appropriately. |
| 2679 | */ |
Rajeev Kumar | 0ac9f2a | 2016-04-15 15:54:18 -0700 | [diff] [blame] | 2680 | if (LIM_IS_AP_ROLE(pe_session) && (true == pe_session->htCapability)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2681 | if (overlap) { |
Arif Hussain | 1cd8abf | 2017-12-17 19:37:50 -0800 | [diff] [blame] | 2682 | pe_session->gLimOverlap11aParams.protectionEnabled = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2683 | true; |
| 2684 | if ((eSIR_HT_OP_MODE_OVERLAP_LEGACY != |
| 2685 | mac_ctx->lim.gHTOperMode) |
| 2686 | && (eSIR_HT_OP_MODE_MIXED != |
| 2687 | mac_ctx->lim.gHTOperMode)) { |
| 2688 | mac_ctx->lim.gHTOperMode = |
| 2689 | eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 2690 | pe_session->htOperMode = |
| 2691 | eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 2692 | lim_enable_ht_rifs_protection(mac_ctx, true, |
| 2693 | overlap, bcn_prms, pe_session); |
| 2694 | lim_enable_ht_obss_protection(mac_ctx, true, |
| 2695 | overlap, bcn_prms, pe_session); |
| 2696 | } |
| 2697 | } else { |
| 2698 | pe_session->gLim11aParams.protectionEnabled = true; |
| 2699 | if (eSIR_HT_OP_MODE_MIXED != pe_session->htOperMode) { |
| 2700 | mac_ctx->lim.gHTOperMode = |
| 2701 | eSIR_HT_OP_MODE_MIXED; |
| 2702 | pe_session->htOperMode = eSIR_HT_OP_MODE_MIXED; |
| 2703 | lim_enable_ht_rifs_protection(mac_ctx, true, |
| 2704 | overlap, bcn_prms, pe_session); |
| 2705 | lim_enable_ht_obss_protection(mac_ctx, true, |
| 2706 | overlap, bcn_prms, pe_session); |
| 2707 | } |
| 2708 | } |
| 2709 | } |
| 2710 | /* This part is common for station as well. */ |
| 2711 | if (false == pe_session->beaconParams.llaCoexist) { |
Yeshwanth Sriram Guntuka | cbe6144 | 2018-08-23 18:08:44 +0530 | [diff] [blame] | 2712 | pe_debug(" => protection from 11A Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2713 | bcn_prms->llaCoexist = true; |
| 2714 | pe_session->beaconParams.llaCoexist = true; |
| 2715 | bcn_prms->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED; |
| 2716 | } |
| 2717 | } |
| 2718 | |
| 2719 | /** |
| 2720 | * lim_disable_11a_protection() - updates protection params for disable 11a |
| 2721 | * protection request |
| 2722 | * @mac_ctx: pointer to Global MAC structure |
| 2723 | * @overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 2724 | * @bcn_prms: beacon parameters |
| 2725 | * @pe_session: pe session entry |
| 2726 | * |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 2727 | * This function updates protection params for disable 11a protection request |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2728 | * |
| 2729 | * @Return: void |
| 2730 | */ |
| 2731 | static void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2732 | lim_disable_11a_protection(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2733 | uint8_t overlap, |
| 2734 | tpUpdateBeaconParams bcn_prms, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2735 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2736 | { |
| 2737 | if (false == pe_session->beaconParams.llaCoexist) |
| 2738 | return; |
| 2739 | |
| 2740 | /* for station role */ |
| 2741 | if (!LIM_IS_AP_ROLE(pe_session)) { |
yeshwanth sriram guntuka | ca71d03 | 2017-07-20 18:26:35 +0530 | [diff] [blame] | 2742 | pe_debug("===> Protection from 11A Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2743 | bcn_prms->llaCoexist = false; |
| 2744 | pe_session->beaconParams.llaCoexist = false; |
| 2745 | bcn_prms->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED; |
| 2746 | return; |
| 2747 | } |
| 2748 | /* |
| 2749 | * for AP role. |
| 2750 | * we need to take care of HT OP mode change if needed. |
| 2751 | * We need to take care of Overlap cases. |
| 2752 | */ |
| 2753 | if (overlap) { |
| 2754 | /* Overlap Legacy protection disabled. */ |
Arif Hussain | 1cd8abf | 2017-12-17 19:37:50 -0800 | [diff] [blame] | 2755 | pe_session->gLimOverlap11aParams.protectionEnabled = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2756 | |
| 2757 | /* |
| 2758 | * We need to take care of HT OP mode iff we are HT AP. |
| 2759 | * OR no HT op-mode change is needed if any of the overlap |
| 2760 | * protection enabled. |
| 2761 | */ |
| 2762 | if (!pe_session->htCapability || |
Arif Hussain | 1cd8abf | 2017-12-17 19:37:50 -0800 | [diff] [blame] | 2763 | (pe_session->gLimOverlap11aParams.protectionEnabled |
| 2764 | || pe_session->gLimOverlapHt20Params.protectionEnabled |
| 2765 | || pe_session->gLimOverlapNonGfParams.protectionEnabled)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2766 | goto disable_11a_end; |
| 2767 | |
| 2768 | /* Check if there is a need to change HT OP mode. */ |
| 2769 | if (eSIR_HT_OP_MODE_OVERLAP_LEGACY == |
| 2770 | mac_ctx->lim.gHTOperMode) { |
| 2771 | lim_enable_ht_rifs_protection(mac_ctx, false, overlap, |
| 2772 | bcn_prms, pe_session); |
| 2773 | lim_enable_ht_obss_protection(mac_ctx, false, overlap, |
| 2774 | bcn_prms, pe_session); |
| 2775 | |
| 2776 | if (pe_session->gLimHt20Params.protectionEnabled) |
| 2777 | mac_ctx->lim.gHTOperMode = |
| 2778 | eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 2779 | else |
| 2780 | mac_ctx->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 2781 | } |
| 2782 | } else { |
| 2783 | /* Disable protection from 11A stations. */ |
| 2784 | pe_session->gLim11aParams.protectionEnabled = false; |
| 2785 | lim_enable_ht_obss_protection(mac_ctx, false, overlap, |
| 2786 | bcn_prms, pe_session); |
| 2787 | |
| 2788 | /* |
| 2789 | * Check if any other non-HT protection enabled. Right now we |
| 2790 | * are in HT OP Mixed mode. Change HT op mode appropriately. |
| 2791 | */ |
| 2792 | |
| 2793 | /* Change HT OP mode to 01 if any overlap protection enabled */ |
Arif Hussain | 1cd8abf | 2017-12-17 19:37:50 -0800 | [diff] [blame] | 2794 | if (pe_session->gLimOverlap11aParams.protectionEnabled |
| 2795 | || pe_session->gLimOverlapHt20Params.protectionEnabled |
| 2796 | || pe_session->gLimOverlapNonGfParams.protectionEnabled) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2797 | mac_ctx->lim.gHTOperMode = |
| 2798 | eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 2799 | pe_session->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 2800 | lim_enable_ht_rifs_protection(mac_ctx, true, overlap, |
| 2801 | bcn_prms, pe_session); |
| 2802 | } else if (pe_session->gLimHt20Params.protectionEnabled) { |
| 2803 | mac_ctx->lim.gHTOperMode = |
| 2804 | eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 2805 | pe_session->htOperMode = |
| 2806 | eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 2807 | lim_enable_ht_rifs_protection(mac_ctx, false, overlap, |
| 2808 | bcn_prms, pe_session); |
| 2809 | } else { |
| 2810 | mac_ctx->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 2811 | pe_session->htOperMode = eSIR_HT_OP_MODE_PURE; |
| 2812 | lim_enable_ht_rifs_protection(mac_ctx, false, overlap, |
| 2813 | bcn_prms, pe_session); |
| 2814 | } |
| 2815 | } |
| 2816 | |
| 2817 | disable_11a_end: |
Arif Hussain | 1cd8abf | 2017-12-17 19:37:50 -0800 | [diff] [blame] | 2818 | if (!pe_session->gLimOverlap11aParams.protectionEnabled && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2819 | !pe_session->gLim11aParams.protectionEnabled) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2820 | pe_warn("===> Protection from 11A Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2821 | bcn_prms->llaCoexist = false; |
| 2822 | pe_session->beaconParams.llaCoexist = false; |
| 2823 | bcn_prms->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED; |
| 2824 | } |
| 2825 | } |
| 2826 | |
| 2827 | /** |
| 2828 | * lim_update_11a_protection() - based on config setting enables\disables 11a |
| 2829 | * protection. |
| 2830 | * @mac_ctx: pointer to Global MAC structure |
| 2831 | * @enable: 1=> enable protection, 0=> disable protection. |
| 2832 | * @overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 2833 | * @bcn_prms: beacon parameters |
| 2834 | * @session: pe session entry |
| 2835 | * |
| 2836 | * This based on config setting enables\disables 11a protection. |
| 2837 | * |
| 2838 | * @Return: success of failure of operation |
| 2839 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2840 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2841 | lim_update_11a_protection(struct mac_context *mac_ctx, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2842 | uint8_t overlap, tpUpdateBeaconParams bcn_prms, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2843 | struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2844 | { |
| 2845 | if (NULL == session) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2846 | pe_err("session is NULL"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2847 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2848 | } |
| 2849 | /* overlapping protection configuration check. */ |
| 2850 | if (!overlap) { |
| 2851 | /* normal protection config check */ |
| 2852 | if ((LIM_IS_AP_ROLE(session)) && |
| 2853 | (!session->cfgProtection.fromlla)) { |
| 2854 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2855 | pe_warn("protection from 11a is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2856 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2857 | } |
| 2858 | } |
| 2859 | |
| 2860 | if (enable) |
| 2861 | lim_enable_11a_protection(mac_ctx, overlap, bcn_prms, session); |
| 2862 | else |
| 2863 | lim_disable_11a_protection(mac_ctx, overlap, bcn_prms, session); |
| 2864 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2865 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2866 | } |
| 2867 | |
| 2868 | /** |
| 2869 | * lim_handle_enable11g_protection_enabled() - handle 11g protection enabled |
| 2870 | * @mac_ctx: pointer to Globale Mac structure |
| 2871 | * @beaconparams: pointer to tpUpdateBeaconParams |
| 2872 | * @overlap: 1=> called from overlap context, 0 => called from assoc context. |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2873 | * @session_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2874 | * |
| 2875 | * Function handles 11g protection enaled case |
| 2876 | * |
| 2877 | * Return: none |
| 2878 | */ |
| 2879 | static void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2880 | lim_handle_enable11g_protection_enabled(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2881 | tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2882 | uint8_t overlap, struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2883 | { |
| 2884 | /* |
| 2885 | * If we are AP and HT capable, we need to set the HT OP mode |
| 2886 | * appropriately. |
| 2887 | */ |
| 2888 | if (LIM_IS_AP_ROLE(session_entry) && overlap) { |
| 2889 | session_entry->gLimOlbcParams.protectionEnabled = true; |
| 2890 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2891 | pe_debug("protection from olbc is enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2892 | |
| 2893 | if (true == session_entry->htCapability) { |
| 2894 | if ((eSIR_HT_OP_MODE_OVERLAP_LEGACY != |
| 2895 | session_entry->htOperMode) && |
| 2896 | (eSIR_HT_OP_MODE_MIXED != |
| 2897 | session_entry->htOperMode)) { |
| 2898 | session_entry->htOperMode = |
| 2899 | eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 2900 | } |
| 2901 | /* |
| 2902 | * CR-263021: OBSS bit is not switching back to 0 after |
| 2903 | * disabling the overlapping legacy BSS |
| 2904 | */ |
| 2905 | /* |
| 2906 | * This fixes issue of OBSS bit not set after 11b, 11g |
| 2907 | * station leaves |
| 2908 | */ |
| 2909 | lim_enable_ht_rifs_protection(mac_ctx, true, |
| 2910 | overlap, beaconparams, session_entry); |
| 2911 | /* |
| 2912 | * Not processing OBSS bit from other APs, as we are |
| 2913 | * already taking care of Protection from overlapping |
| 2914 | * BSS based on erp IE or useProtection bit |
| 2915 | */ |
| 2916 | lim_enable_ht_obss_protection(mac_ctx, true, |
| 2917 | overlap, beaconparams, session_entry); |
| 2918 | } |
| 2919 | } else if (LIM_IS_AP_ROLE(session_entry) && !overlap) { |
| 2920 | session_entry->gLim11bParams.protectionEnabled = true; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2921 | pe_debug("protection from 11b is enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2922 | if (true == session_entry->htCapability) { |
| 2923 | if (eSIR_HT_OP_MODE_MIXED != |
| 2924 | session_entry->htOperMode) { |
| 2925 | session_entry->htOperMode = |
| 2926 | eSIR_HT_OP_MODE_MIXED; |
| 2927 | lim_enable_ht_rifs_protection(mac_ctx, |
| 2928 | true, overlap, beaconparams, |
| 2929 | session_entry); |
| 2930 | lim_enable_ht_obss_protection(mac_ctx, |
| 2931 | true, overlap, beaconparams, |
| 2932 | session_entry); |
| 2933 | } |
| 2934 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2935 | } |
Rajeev Kumar | 0ac9f2a | 2016-04-15 15:54:18 -0700 | [diff] [blame] | 2936 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2937 | /* This part is common for staiton as well. */ |
| 2938 | if (false == session_entry->beaconParams.llbCoexist) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 2939 | pe_debug("=> 11G Protection Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2940 | beaconparams->llbCoexist = |
| 2941 | session_entry->beaconParams.llbCoexist = true; |
| 2942 | beaconparams->paramChangeBitmap |= |
| 2943 | PARAM_llBCOEXIST_CHANGED; |
| 2944 | } |
| 2945 | } |
| 2946 | |
| 2947 | /** |
| 2948 | * lim_handle_11g_protection_for_11bcoexist() - 11g protection for 11b co-ex |
| 2949 | * @mac_ctx: pointer to Globale Mac structure |
| 2950 | * @beaconparams: pointer to tpUpdateBeaconParams |
| 2951 | * @overlap: 1=> called from overlap context, 0 => called from assoc context. |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2952 | * @session_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2953 | * |
| 2954 | * Function handles 11g protection for 11b co-exist |
| 2955 | * |
| 2956 | * Return: none |
| 2957 | */ |
| 2958 | static void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 2959 | lim_handle_11g_protection_for_11bcoexist(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2960 | tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 2961 | uint8_t overlap, struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2962 | { |
| 2963 | /* |
| 2964 | * For AP role: |
| 2965 | * we need to take care of HT OP mode change if needed. |
| 2966 | * We need to take care of Overlap cases. |
| 2967 | */ |
| 2968 | if (LIM_IS_AP_ROLE(session_entry) && overlap) { |
| 2969 | /* Overlap Legacy protection disabled. */ |
| 2970 | session_entry->gLimOlbcParams.protectionEnabled = false; |
| 2971 | |
| 2972 | /* We need to take care of HT OP mode if we are HT AP. */ |
| 2973 | if (session_entry->htCapability) { |
| 2974 | /* |
| 2975 | * no HT op mode change if any of the overlap |
| 2976 | * protection enabled. |
| 2977 | */ |
| 2978 | if (!(session_entry->gLimOverlap11gParams. |
| 2979 | protectionEnabled || |
| 2980 | session_entry->gLimOverlapHt20Params. |
| 2981 | protectionEnabled || |
| 2982 | session_entry->gLimOverlapNonGfParams. |
| 2983 | protectionEnabled) && |
| 2984 | /* |
| 2985 | * Check if there is a need to change HT |
| 2986 | * OP mode. |
| 2987 | */ |
| 2988 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == |
| 2989 | session_entry->htOperMode)) { |
| 2990 | lim_enable_ht_rifs_protection(mac_ctx, false, |
| 2991 | overlap, beaconparams, session_entry); |
| 2992 | lim_enable_ht_obss_protection(mac_ctx, false, |
| 2993 | overlap, beaconparams, session_entry); |
| 2994 | if (session_entry->gLimHt20Params. |
| 2995 | protectionEnabled) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2996 | if (eHT_CHANNEL_WIDTH_20MHZ == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2997 | session_entry->htSupportedChannelWidthSet) |
| 2998 | session_entry->htOperMode = |
| 2999 | eSIR_HT_OP_MODE_PURE; |
| 3000 | else |
| 3001 | session_entry->htOperMode = |
| 3002 | eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 3003 | } else |
| 3004 | session_entry->htOperMode = |
| 3005 | eSIR_HT_OP_MODE_PURE; |
| 3006 | } |
| 3007 | } |
| 3008 | } else if (LIM_IS_AP_ROLE(session_entry) && !overlap) { |
| 3009 | /* Disable protection from 11B stations. */ |
| 3010 | session_entry->gLim11bParams.protectionEnabled = false; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3011 | pe_debug("===> 11B Protection Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3012 | /* Check if any other non-HT protection enabled. */ |
| 3013 | if (!session_entry->gLim11gParams.protectionEnabled) { |
| 3014 | /* Right now we are in HT OP Mixed mode. */ |
| 3015 | /* Change HT op mode appropriately. */ |
| 3016 | lim_enable_ht_obss_protection(mac_ctx, false, overlap, |
| 3017 | beaconparams, session_entry); |
| 3018 | /* |
| 3019 | * Change HT OP mode to 01 if any overlap protection |
| 3020 | * enabled |
| 3021 | */ |
| 3022 | if (session_entry->gLimOlbcParams.protectionEnabled || |
| 3023 | session_entry->gLimOverlap11gParams. |
| 3024 | protectionEnabled || |
| 3025 | session_entry->gLimOverlapHt20Params. |
| 3026 | protectionEnabled || |
| 3027 | session_entry->gLimOverlapNonGfParams. |
| 3028 | protectionEnabled) { |
| 3029 | session_entry->htOperMode = |
| 3030 | eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3031 | pe_debug("===> 11G Protection Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3032 | lim_enable_ht_rifs_protection(mac_ctx, true, |
| 3033 | overlap, beaconparams, |
| 3034 | session_entry); |
| 3035 | } else if (session_entry->gLimHt20Params. |
| 3036 | protectionEnabled) { |
| 3037 | /* Commenting because of CR 258588 WFA cert */ |
| 3038 | /* session_entry->htOperMode = |
| 3039 | eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; */ |
| 3040 | session_entry->htOperMode = |
| 3041 | eSIR_HT_OP_MODE_PURE; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3042 | pe_debug("===> 11G Protection Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3043 | lim_enable_ht_rifs_protection(mac_ctx, false, |
| 3044 | overlap, beaconparams, |
| 3045 | session_entry); |
| 3046 | } else { |
| 3047 | session_entry->htOperMode = |
| 3048 | eSIR_HT_OP_MODE_PURE; |
| 3049 | lim_enable_ht_rifs_protection(mac_ctx, false, |
| 3050 | overlap, beaconparams, |
| 3051 | session_entry); |
| 3052 | } |
| 3053 | } |
| 3054 | } |
| 3055 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 3056 | if (!session_entry->gLimOlbcParams.protectionEnabled && |
| 3057 | !session_entry->gLim11bParams.protectionEnabled) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3058 | pe_debug("===> 11G Protection Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3059 | beaconparams->llbCoexist = |
| 3060 | session_entry->beaconParams.llbCoexist = |
| 3061 | false; |
| 3062 | beaconparams->paramChangeBitmap |= |
| 3063 | PARAM_llBCOEXIST_CHANGED; |
| 3064 | } |
| 3065 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3066 | /* For station role */ |
Rajeev Kumar | 0ac9f2a | 2016-04-15 15:54:18 -0700 | [diff] [blame] | 3067 | if (!LIM_IS_AP_ROLE(session_entry)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3068 | pe_debug("===> 11G Protection Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3069 | beaconparams->llbCoexist = |
| 3070 | session_entry->beaconParams.llbCoexist = false; |
| 3071 | beaconparams->paramChangeBitmap |= |
| 3072 | PARAM_llBCOEXIST_CHANGED; |
| 3073 | } |
| 3074 | } |
| 3075 | |
| 3076 | /** |
| 3077 | * lim_enable11g_protection() - Function to enable 11g protection |
| 3078 | * @mac_ctx: pointer to Global Mac structure |
| 3079 | * @enable: 1=> enable protection, 0=> disable protection. |
| 3080 | * @overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 3081 | * @beaconparams: pointer to tpUpdateBeaconParams |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 3082 | * @session_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3083 | * |
| 3084 | * based on config setting enables\disables 11g protection. |
| 3085 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3086 | * Return: Success - QDF_STATUS_SUCCESS - Success, Error number - Failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3087 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3088 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3089 | lim_enable11g_protection(struct mac_context *mac_ctx, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | uint8_t overlap, tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 3091 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3092 | { |
| 3093 | |
| 3094 | /* overlapping protection configuration check. */ |
| 3095 | if (!overlap) { |
| 3096 | /* normal protection config check */ |
| 3097 | if ((LIM_IS_AP_ROLE(session_entry)) && |
| 3098 | !session_entry->cfgProtection.fromllb) { |
| 3099 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3100 | pe_debug("protection from 11b is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3101 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3102 | } else if (!LIM_IS_AP_ROLE(session_entry)) { |
| 3103 | if (!mac_ctx->lim.cfgProtection.fromllb) { |
| 3104 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3105 | pe_debug("protection from 11b is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3106 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3107 | } |
| 3108 | } |
| 3109 | } |
| 3110 | |
| 3111 | if (enable) { |
| 3112 | lim_handle_enable11g_protection_enabled(mac_ctx, beaconparams, |
| 3113 | overlap, session_entry); |
| 3114 | } else if (true == session_entry->beaconParams.llbCoexist) { |
| 3115 | lim_handle_11g_protection_for_11bcoexist(mac_ctx, beaconparams, |
| 3116 | overlap, session_entry); |
| 3117 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3118 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3119 | } |
| 3120 | |
| 3121 | /** ------------------------------------------------------------- |
| 3122 | \fn lim_enable_ht_protection_from11g |
| 3123 | \brief based on cofig enables\disables protection from 11g. |
| 3124 | \param uint8_t enable : 1=> enable protection, 0=> disable protection. |
| 3125 | \param uint8_t overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 3126 | \param tpUpdateBeaconParams pBeaconParams |
| 3127 | \return None |
| 3128 | -------------------------------------------------------------*/ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3129 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3130 | lim_enable_ht_protection_from11g(struct mac_context *mac, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3131 | uint8_t overlap, |
| 3132 | tpUpdateBeaconParams pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3133 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3134 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3135 | if (!pe_session->htCapability) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3136 | return QDF_STATUS_SUCCESS; /* protection from 11g is only for HT stations. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3137 | |
| 3138 | /* overlapping protection configuration check. */ |
| 3139 | if (overlap) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3140 | if ((LIM_IS_AP_ROLE(pe_session)) |
| 3141 | && (!pe_session->cfgProtection.overlapFromllg)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3142 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3143 | pe_debug("overlap protection from 11g is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3144 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3145 | } |
| 3146 | } else { |
| 3147 | /* normal protection config check */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3148 | if (LIM_IS_AP_ROLE(pe_session) && |
| 3149 | !pe_session->cfgProtection.fromllg) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3150 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3151 | pe_debug("protection from 11g is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3152 | return QDF_STATUS_SUCCESS; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3153 | } else if (!LIM_IS_AP_ROLE(pe_session)) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3154 | if (!mac->lim.cfgProtection.fromllg) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3155 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3156 | pe_debug("protection from 11g is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3157 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3158 | } |
| 3159 | } |
| 3160 | } |
| 3161 | if (enable) { |
| 3162 | /* If we are AP and HT capable, we need to set the HT OP mode */ |
| 3163 | /* appropriately. */ |
| 3164 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3165 | if (LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3166 | if (overlap) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3167 | pe_session->gLimOverlap11gParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3168 | protectionEnabled = true; |
| 3169 | /* 11g exists in overlap BSS. */ |
| 3170 | /* need not to change the operating mode to overlap_legacy */ |
| 3171 | /* if higher or same protection operating mode is enabled right now. */ |
| 3172 | if ((eSIR_HT_OP_MODE_OVERLAP_LEGACY != |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3173 | pe_session->htOperMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3174 | && (eSIR_HT_OP_MODE_MIXED != |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3175 | pe_session->htOperMode)) { |
| 3176 | pe_session->htOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3177 | eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 3178 | } |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3179 | lim_enable_ht_rifs_protection(mac, true, overlap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3181 | pe_session); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3182 | lim_enable_ht_obss_protection(mac, true, overlap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3183 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3184 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3185 | } else { |
| 3186 | /* 11g is associated to an AP operating in 11n mode. */ |
| 3187 | /* Change the HT operating mode to 'mixed mode'. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3188 | pe_session->gLim11gParams.protectionEnabled = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3189 | true; |
| 3190 | if (eSIR_HT_OP_MODE_MIXED != |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3191 | pe_session->htOperMode) { |
| 3192 | pe_session->htOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3193 | eSIR_HT_OP_MODE_MIXED; |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3194 | lim_enable_ht_rifs_protection(mac, true, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3195 | overlap, |
| 3196 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3197 | pe_session); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3198 | lim_enable_ht_obss_protection(mac, true, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3199 | overlap, |
| 3200 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3201 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3202 | } |
| 3203 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3204 | } |
| 3205 | /* This part is common for staiton as well. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3206 | if (false == pe_session->beaconParams.llgCoexist) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3207 | pBeaconParams->llgCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3208 | pe_session->beaconParams.llgCoexist = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3209 | pBeaconParams->paramChangeBitmap |= |
| 3210 | PARAM_llGCOEXIST_CHANGED; |
| 3211 | } else if (true == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3212 | pe_session->gLimOverlap11gParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3213 | protectionEnabled) { |
| 3214 | /* As operating mode changed after G station assoc some way to update beacon */ |
| 3215 | /* This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3216 | /* mac->sch.schObject.fBeaconChanged = 1; */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3217 | pBeaconParams->paramChangeBitmap |= |
| 3218 | PARAM_llGCOEXIST_CHANGED; |
| 3219 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3220 | } else if (true == pe_session->beaconParams.llgCoexist) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | /* for AP role. */ |
| 3222 | /* we need to take care of HT OP mode change if needed. */ |
| 3223 | /* We need to take care of Overlap cases. */ |
| 3224 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3225 | if (LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3226 | if (overlap) { |
| 3227 | /* Overlap Legacy protection disabled. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3228 | if (pe_session->gLim11gParams.numSta == 0) |
| 3229 | pe_session->gLimOverlap11gParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3230 | protectionEnabled = false; |
| 3231 | |
| 3232 | /* no HT op mode change if any of the overlap protection enabled. */ |
| 3233 | if (! |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3234 | (pe_session->gLimOlbcParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3235 | protectionEnabled |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3236 | || pe_session->gLimOverlapHt20Params. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3237 | protectionEnabled |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3238 | || pe_session->gLimOverlapNonGfParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3239 | protectionEnabled)) { |
| 3240 | /* Check if there is a need to change HT OP mode. */ |
| 3241 | if (eSIR_HT_OP_MODE_OVERLAP_LEGACY == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3242 | pe_session->htOperMode) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3243 | lim_enable_ht_rifs_protection(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3244 | false, |
| 3245 | overlap, |
| 3246 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3247 | pe_session); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3248 | lim_enable_ht_obss_protection(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3249 | false, |
| 3250 | overlap, |
| 3251 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3252 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3253 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3254 | if (pe_session->gLimHt20Params.protectionEnabled) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3255 | if (eHT_CHANNEL_WIDTH_20MHZ == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3256 | pe_session->htSupportedChannelWidthSet) |
| 3257 | pe_session->htOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3258 | eSIR_HT_OP_MODE_PURE; |
| 3259 | else |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3260 | pe_session->htOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3261 | eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 3262 | } else |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3263 | pe_session->htOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3264 | eSIR_HT_OP_MODE_PURE; |
| 3265 | } |
| 3266 | } |
| 3267 | } else { |
| 3268 | /* Disable protection from 11G stations. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3269 | pe_session->gLim11gParams.protectionEnabled = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3270 | false; |
| 3271 | /* Check if any other non-HT protection enabled. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3272 | if (!pe_session->gLim11bParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3273 | protectionEnabled) { |
| 3274 | |
| 3275 | /* Right now we are in HT OP Mixed mode. */ |
| 3276 | /* Change HT op mode appropriately. */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3277 | lim_enable_ht_obss_protection(mac, false, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3278 | overlap, |
| 3279 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3280 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3281 | |
| 3282 | /* Change HT OP mode to 01 if any overlap protection enabled */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3283 | if (pe_session->gLimOlbcParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3284 | protectionEnabled |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3285 | || pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3286 | gLimOverlap11gParams. |
| 3287 | protectionEnabled |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3288 | || pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3289 | gLimOverlapHt20Params. |
| 3290 | protectionEnabled |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3291 | || pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3292 | gLimOverlapNonGfParams. |
| 3293 | protectionEnabled) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3294 | pe_session->htOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3296 | lim_enable_ht_rifs_protection(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3297 | true, |
| 3298 | overlap, |
| 3299 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3300 | pe_session); |
| 3301 | } else if (pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3302 | gLimHt20Params. |
| 3303 | protectionEnabled) { |
| 3304 | /* Commenting because of CR 258588 WFA cert */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3305 | /* pe_session->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; */ |
| 3306 | pe_session->htOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3307 | eSIR_HT_OP_MODE_PURE; |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3308 | lim_enable_ht_rifs_protection(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3309 | false, |
| 3310 | overlap, |
| 3311 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3312 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3313 | } else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3314 | pe_session->htOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3315 | eSIR_HT_OP_MODE_PURE; |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3316 | lim_enable_ht_rifs_protection(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3317 | false, |
| 3318 | overlap, |
| 3319 | pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3320 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3321 | } |
| 3322 | } |
| 3323 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3324 | if (!pe_session->gLimOverlap11gParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3325 | protectionEnabled |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3326 | && !pe_session->gLim11gParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3327 | protectionEnabled) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3328 | pe_debug("===> Protection from 11G Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3329 | pBeaconParams->llgCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3330 | pe_session->beaconParams.llgCoexist = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3331 | false; |
| 3332 | pBeaconParams->paramChangeBitmap |= |
| 3333 | PARAM_llGCOEXIST_CHANGED; |
| 3334 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3335 | } |
| 3336 | /* for station role */ |
| 3337 | else { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3338 | pe_debug("===> Protection from 11G Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3339 | pBeaconParams->llgCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3340 | pe_session->beaconParams.llgCoexist = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3341 | pBeaconParams->paramChangeBitmap |= |
| 3342 | PARAM_llGCOEXIST_CHANGED; |
| 3343 | } |
| 3344 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3345 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3346 | } |
| 3347 | |
| 3348 | /* FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection. */ |
| 3349 | /* This check will be done at the caller. */ |
| 3350 | |
| 3351 | /** ------------------------------------------------------------- |
| 3352 | \fn limEnableHtObssProtection |
| 3353 | \brief based on cofig enables\disables obss protection. |
| 3354 | \param uint8_t enable : 1=> enable protection, 0=> disable protection. |
| 3355 | \param uint8_t overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 3356 | \param tpUpdateBeaconParams pBeaconParams |
| 3357 | \return None |
| 3358 | -------------------------------------------------------------*/ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3359 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3360 | lim_enable_ht_obss_protection(struct mac_context *mac, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3361 | uint8_t overlap, tpUpdateBeaconParams pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3362 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3363 | { |
| 3364 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3365 | if (!pe_session->htCapability) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3366 | return QDF_STATUS_SUCCESS; /* this protection is only for HT stations. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3367 | |
| 3368 | /* overlapping protection configuration check. */ |
| 3369 | if (overlap) { |
| 3370 | /* overlapping protection configuration check. */ |
| 3371 | } else { |
| 3372 | /* normal protection config check */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3373 | if ((LIM_IS_AP_ROLE(pe_session)) && |
| 3374 | !pe_session->cfgProtection.obss) { /* ToDo Update this field */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3375 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3376 | pe_debug("protection from Obss is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3377 | return QDF_STATUS_SUCCESS; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3378 | } else if (!LIM_IS_AP_ROLE(pe_session)) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3379 | if (!mac->lim.cfgProtection.obss) { /* ToDo Update this field */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3380 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3381 | pe_debug("protection from Obss is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3382 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3383 | } |
| 3384 | } |
| 3385 | } |
| 3386 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3387 | if (LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3388 | if ((enable) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3389 | && (false == pe_session->beaconParams.gHTObssMode)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3390 | pe_debug("=>obss protection enabled"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3391 | pe_session->beaconParams.gHTObssMode = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3392 | pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; /* UPDATE AN ENUM FOR OBSS MODE <todo> */ |
| 3393 | |
| 3394 | } else if (!enable |
| 3395 | && (true == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3396 | pe_session->beaconParams.gHTObssMode)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3397 | pe_debug("===> obss Protection disabled"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3398 | pe_session->beaconParams.gHTObssMode = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3399 | pBeaconParams->paramChangeBitmap |= |
| 3400 | PARAM_OBSS_MODE_CHANGED; |
| 3401 | |
| 3402 | } |
| 3403 | /* CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS */ |
| 3404 | if (!enable && !overlap) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3405 | pe_session->gLimOverlap11gParams.protectionEnabled = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3406 | false; |
| 3407 | } |
| 3408 | } else { |
| 3409 | if ((enable) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3410 | && (false == pe_session->beaconParams.gHTObssMode)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3411 | pe_debug("=>obss protection enabled"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3412 | pe_session->beaconParams.gHTObssMode = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3413 | pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; /* UPDATE AN ENUM FOR OBSS MODE <todo> */ |
| 3414 | |
| 3415 | } else if (!enable |
| 3416 | && (true == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3417 | pe_session->beaconParams.gHTObssMode)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3418 | pe_debug("===> obss Protection disabled"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3419 | pe_session->beaconParams.gHTObssMode = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3420 | pBeaconParams->paramChangeBitmap |= |
| 3421 | PARAM_OBSS_MODE_CHANGED; |
| 3422 | |
| 3423 | } |
| 3424 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3425 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3426 | } |
| 3427 | |
| 3428 | /** |
| 3429 | * lim_handle_ht20protection_enabled() - Handle ht20 protection enabled |
| 3430 | * @mac_ctx: pointer to Gloal Mac Structure |
| 3431 | * @overlap: variable for overlap detection |
| 3432 | * @beaconparams: pointer to tpUpdateBeaconParams |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 3433 | * @session_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3434 | * |
| 3435 | * Function handles ht20 protection enabled |
| 3436 | * |
| 3437 | * Return: none |
| 3438 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3439 | static void lim_handle_ht20protection_enabled(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3440 | uint8_t overlap, tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 3441 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3442 | { |
| 3443 | /* |
| 3444 | * If we are AP and HT capable, we need to set the HT OP mode |
| 3445 | * appropriately. |
| 3446 | */ |
| 3447 | if (LIM_IS_AP_ROLE(session_entry) && overlap) { |
| 3448 | session_entry->gLimOverlapHt20Params.protectionEnabled = true; |
| 3449 | if ((eSIR_HT_OP_MODE_OVERLAP_LEGACY != |
| 3450 | session_entry->htOperMode) && |
| 3451 | (eSIR_HT_OP_MODE_MIXED != |
| 3452 | session_entry->htOperMode)) { |
| 3453 | session_entry->htOperMode = |
| 3454 | eSIR_HT_OP_MODE_OVERLAP_LEGACY; |
| 3455 | lim_enable_ht_rifs_protection(mac_ctx, true, |
| 3456 | overlap, beaconparams, session_entry); |
| 3457 | } |
| 3458 | } else if (LIM_IS_AP_ROLE(session_entry) && !overlap) { |
| 3459 | session_entry->gLimHt20Params.protectionEnabled = true; |
| 3460 | if (eSIR_HT_OP_MODE_PURE == session_entry->htOperMode) { |
Naveen Rawat | e702e9b | 2015-11-17 11:50:40 -0800 | [diff] [blame] | 3461 | if (session_entry->htSupportedChannelWidthSet != |
| 3462 | eHT_CHANNEL_WIDTH_20MHZ) |
| 3463 | session_entry->htOperMode = |
| 3464 | eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3465 | lim_enable_ht_rifs_protection(mac_ctx, false, |
| 3466 | overlap, beaconparams, session_entry); |
| 3467 | lim_enable_ht_obss_protection(mac_ctx, false, |
| 3468 | overlap, beaconparams, session_entry); |
| 3469 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3470 | } |
| 3471 | /* This part is common for staiton as well. */ |
| 3472 | if (false == session_entry->beaconParams.ht20Coexist) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3473 | pe_debug("=> Protection from HT20 Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3474 | beaconparams->ht20MhzCoexist = |
| 3475 | session_entry->beaconParams.ht20Coexist = true; |
| 3476 | beaconparams->paramChangeBitmap |= |
| 3477 | PARAM_HT20MHZCOEXIST_CHANGED; |
| 3478 | } |
| 3479 | } |
| 3480 | |
| 3481 | /** |
| 3482 | * lim_handle_ht20coexist_ht20protection() - ht20 protection for ht20 coexist |
| 3483 | * @mac_ctx: pointer to Gloal Mac Structure |
| 3484 | * @beaconparams: pointer to tpUpdateBeaconParams |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 3485 | * @session_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3486 | * @overlap: variable for overlap detection |
| 3487 | * |
| 3488 | * Function handles ht20 protection for ht20 coexist |
| 3489 | * |
| 3490 | * Return: none |
| 3491 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3492 | static void lim_handle_ht20coexist_ht20protection(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3493 | tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 3494 | struct pe_session *session_entry, uint8_t overlap) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3495 | { |
| 3496 | /* |
| 3497 | * For AP role: |
| 3498 | * we need to take care of HT OP mode change if needed. |
| 3499 | * We need to take care of Overlap cases. |
| 3500 | */ |
| 3501 | if (LIM_IS_AP_ROLE(session_entry) && overlap) { |
| 3502 | /* Overlap Legacy protection disabled. */ |
| 3503 | session_entry->gLimOverlapHt20Params.protectionEnabled = |
| 3504 | false; |
| 3505 | /* |
| 3506 | * no HT op mode change if any of the overlap |
| 3507 | * protection enabled. |
| 3508 | */ |
| 3509 | if (!(session_entry->gLimOlbcParams.protectionEnabled || |
| 3510 | session_entry->gLimOverlap11gParams.protectionEnabled || |
| 3511 | session_entry->gLimOverlapHt20Params.protectionEnabled |
| 3512 | || session_entry->gLimOverlapNonGfParams. |
| 3513 | protectionEnabled) && |
| 3514 | /* |
| 3515 | * Check if there is a need to change HT |
| 3516 | * OP mode. |
| 3517 | */ |
| 3518 | (eSIR_HT_OP_MODE_OVERLAP_LEGACY == |
| 3519 | session_entry->htOperMode)) { |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 3520 | if (session_entry->gLimHt20Params. |
| 3521 | protectionEnabled) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3522 | if (eHT_CHANNEL_WIDTH_20MHZ == |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 3523 | session_entry-> |
| 3524 | htSupportedChannelWidthSet) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3525 | session_entry->htOperMode = |
| 3526 | eSIR_HT_OP_MODE_PURE; |
| 3527 | else |
| 3528 | session_entry->htOperMode = |
| 3529 | eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT; |
| 3530 | |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 3531 | lim_enable_ht_rifs_protection(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3532 | false, overlap, beaconparams, |
| 3533 | session_entry); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 3534 | lim_enable_ht_obss_protection(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3535 | false, overlap, beaconparams, |
| 3536 | session_entry); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 3537 | } else { |
| 3538 | session_entry->htOperMode = |
| 3539 | eSIR_HT_OP_MODE_PURE; |
| 3540 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | } |
| 3542 | } else if (LIM_IS_AP_ROLE(session_entry) && !overlap) { |
| 3543 | /* Disable protection from 11G stations. */ |
| 3544 | session_entry->gLimHt20Params.protectionEnabled = false; |
| 3545 | /* Change HT op mode appropriately. */ |
| 3546 | if (eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == |
| 3547 | session_entry->htOperMode) { |
| 3548 | session_entry->htOperMode = |
| 3549 | eSIR_HT_OP_MODE_PURE; |
| 3550 | lim_enable_ht_rifs_protection(mac_ctx, false, |
| 3551 | overlap, beaconparams, session_entry); |
| 3552 | lim_enable_ht_obss_protection(mac_ctx, false, |
| 3553 | overlap, beaconparams, session_entry); |
| 3554 | } |
| 3555 | } |
| 3556 | if (LIM_IS_AP_ROLE(session_entry)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3557 | pe_debug("===> Protection from HT 20 Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3558 | beaconparams->ht20MhzCoexist = |
| 3559 | session_entry->beaconParams.ht20Coexist = false; |
| 3560 | beaconparams->paramChangeBitmap |= |
| 3561 | PARAM_HT20MHZCOEXIST_CHANGED; |
| 3562 | } |
Rajeev Kumar | 0ac9f2a | 2016-04-15 15:54:18 -0700 | [diff] [blame] | 3563 | if (!LIM_IS_AP_ROLE(session_entry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3564 | /* For station role */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3565 | pe_debug("===> Protection from HT20 Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3566 | beaconparams->ht20MhzCoexist = |
| 3567 | session_entry->beaconParams.ht20Coexist = false; |
| 3568 | beaconparams->paramChangeBitmap |= |
| 3569 | PARAM_HT20MHZCOEXIST_CHANGED; |
| 3570 | } |
| 3571 | } |
| 3572 | |
| 3573 | /** |
| 3574 | * lim_enable_ht20_protection() - Function to enable ht20 protection |
| 3575 | * @mac_ctx: pointer to Global Mac structure |
| 3576 | * @enable: 1=> enable protection, 0=> disable protection. |
| 3577 | * @overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 3578 | * @beaconparams: pointer to tpUpdateBeaconParams |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 3579 | * @session_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3580 | * |
| 3581 | * based on cofig enables\disables protection from Ht20 |
| 3582 | * |
| 3583 | * Return: 0 - success |
| 3584 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3585 | QDF_STATUS lim_enable_ht20_protection(struct mac_context *mac_ctx, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3586 | uint8_t overlap, tpUpdateBeaconParams beaconparams, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 3587 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3588 | { |
| 3589 | /* This protection is only for HT stations. */ |
| 3590 | if (!session_entry->htCapability) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3591 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3592 | |
| 3593 | /* overlapping protection configuration check. */ |
| 3594 | if (!overlap) { |
| 3595 | /* normal protection config check */ |
| 3596 | if ((LIM_IS_AP_ROLE(session_entry)) && |
| 3597 | !session_entry->cfgProtection.ht20) { |
| 3598 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3599 | pe_debug("protection from HT20 is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3600 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3601 | } else if (!LIM_IS_AP_ROLE(session_entry)) { |
| 3602 | if (!mac_ctx->lim.cfgProtection.ht20) { |
| 3603 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3604 | pe_debug("protection from HT20 is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3605 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3606 | } |
| 3607 | } |
| 3608 | } |
| 3609 | |
| 3610 | if (enable) |
| 3611 | lim_handle_ht20protection_enabled(mac_ctx, overlap, |
| 3612 | beaconparams, session_entry); |
| 3613 | else if (true == session_entry->beaconParams.ht20Coexist) |
| 3614 | lim_handle_ht20coexist_ht20protection(mac_ctx, beaconparams, |
| 3615 | session_entry, overlap); |
| 3616 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3617 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3618 | } |
| 3619 | |
| 3620 | /** ------------------------------------------------------------- |
| 3621 | \fn lim_enable_ht_non_gf_protection |
| 3622 | \brief based on cofig enables\disables protection from NonGf. |
| 3623 | \param uint8_t enable : 1=> enable protection, 0=> disable protection. |
| 3624 | \param uint8_t overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 3625 | \param tpUpdateBeaconParams pBeaconParams |
| 3626 | \return None |
| 3627 | -------------------------------------------------------------*/ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3628 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3629 | lim_enable_ht_non_gf_protection(struct mac_context *mac, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3630 | uint8_t overlap, tpUpdateBeaconParams pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3631 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3632 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3633 | if (!pe_session->htCapability) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3634 | return QDF_STATUS_SUCCESS; /* this protection is only for HT stations. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3635 | |
| 3636 | /* overlapping protection configuration check. */ |
| 3637 | if (overlap) { |
| 3638 | } else { |
| 3639 | /* normal protection config check */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3640 | if (LIM_IS_AP_ROLE(pe_session) && |
| 3641 | !pe_session->cfgProtection.nonGf) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3642 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3643 | pe_debug("protection from NonGf is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3644 | return QDF_STATUS_SUCCESS; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3645 | } else if (!LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3646 | /* normal protection config check */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3647 | if (!mac->lim.cfgProtection.nonGf) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3648 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3649 | pe_debug("protection from NonGf is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3650 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3651 | } |
| 3652 | } |
| 3653 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3654 | if (LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3655 | if ((enable) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3656 | && (false == pe_session->beaconParams.llnNonGFCoexist)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3657 | pe_debug(" => Protection from non GF Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3658 | pBeaconParams->llnNonGFCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3659 | pe_session->beaconParams.llnNonGFCoexist = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3660 | pBeaconParams->paramChangeBitmap |= |
| 3661 | PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 3662 | } else if (!enable |
| 3663 | && (true == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3664 | pe_session->beaconParams.llnNonGFCoexist)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3665 | pe_debug("===> Protection from Non GF Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3666 | pBeaconParams->llnNonGFCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3667 | pe_session->beaconParams.llnNonGFCoexist = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3668 | pBeaconParams->paramChangeBitmap |= |
| 3669 | PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 3670 | } |
| 3671 | } else { |
| 3672 | if ((enable) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3673 | && (false == pe_session->beaconParams.llnNonGFCoexist)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3674 | pe_debug(" => Protection from non GF Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3675 | pBeaconParams->llnNonGFCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3676 | pe_session->beaconParams.llnNonGFCoexist = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3677 | pBeaconParams->paramChangeBitmap |= |
| 3678 | PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 3679 | } else if (!enable |
| 3680 | && (true == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3681 | pe_session->beaconParams.llnNonGFCoexist)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3682 | pe_debug("===> Protection from Non GF Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3683 | pBeaconParams->llnNonGFCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3684 | pe_session->beaconParams.llnNonGFCoexist = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3685 | pBeaconParams->paramChangeBitmap |= |
| 3686 | PARAM_NON_GF_DEVICES_PRESENT_CHANGED; |
| 3687 | } |
| 3688 | } |
| 3689 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3690 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3691 | } |
| 3692 | |
| 3693 | /** ------------------------------------------------------------- |
| 3694 | \fn lim_enable_ht_lsig_txop_protection |
| 3695 | \brief based on cofig enables\disables LsigTxop protection. |
| 3696 | \param uint8_t enable : 1=> enable protection, 0=> disable protection. |
| 3697 | \param uint8_t overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 3698 | \param tpUpdateBeaconParams pBeaconParams |
| 3699 | \return None |
| 3700 | -------------------------------------------------------------*/ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3701 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3702 | lim_enable_ht_lsig_txop_protection(struct mac_context *mac, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3703 | uint8_t overlap, |
| 3704 | tpUpdateBeaconParams pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3705 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3706 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3707 | if (!pe_session->htCapability) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3708 | return QDF_STATUS_SUCCESS; /* this protection is only for HT stations. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3709 | |
| 3710 | /* overlapping protection configuration check. */ |
| 3711 | if (overlap) { |
| 3712 | } else { |
| 3713 | /* normal protection config check */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3714 | if (LIM_IS_AP_ROLE(pe_session) && |
| 3715 | !pe_session->cfgProtection.lsigTxop) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3716 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3717 | pe_debug("protection from LsigTxop not supported is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3718 | return QDF_STATUS_SUCCESS; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3719 | } else if (!LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3720 | /* normal protection config check */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3721 | if (!mac->lim.cfgProtection.lsigTxop) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3722 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3723 | pe_debug("protection from LsigTxop not supported is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3724 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3725 | } |
| 3726 | } |
| 3727 | } |
| 3728 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3729 | if (LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3730 | if ((enable) |
| 3731 | && (false == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3732 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3733 | fLsigTXOPProtectionFullSupport)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3734 | pe_debug(" => Protection from LsigTxop Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3735 | pBeaconParams->fLsigTXOPProtectionFullSupport = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3736 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3737 | fLsigTXOPProtectionFullSupport = true; |
| 3738 | pBeaconParams->paramChangeBitmap |= |
| 3739 | PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 3740 | } else if (!enable |
| 3741 | && (true == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3742 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3743 | fLsigTXOPProtectionFullSupport)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3744 | pe_debug("===> Protection from LsigTxop Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3745 | pBeaconParams->fLsigTXOPProtectionFullSupport = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3746 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3747 | fLsigTXOPProtectionFullSupport = false; |
| 3748 | pBeaconParams->paramChangeBitmap |= |
| 3749 | PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 3750 | } |
| 3751 | } else { |
| 3752 | if ((enable) |
| 3753 | && (false == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3754 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3755 | fLsigTXOPProtectionFullSupport)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3756 | pe_debug(" => Protection from LsigTxop Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3757 | pBeaconParams->fLsigTXOPProtectionFullSupport = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3758 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3759 | fLsigTXOPProtectionFullSupport = true; |
| 3760 | pBeaconParams->paramChangeBitmap |= |
| 3761 | PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 3762 | } else if (!enable |
| 3763 | && (true == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3764 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3765 | fLsigTXOPProtectionFullSupport)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3766 | pe_debug("===> Protection from LsigTxop Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3767 | pBeaconParams->fLsigTXOPProtectionFullSupport = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3768 | pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3769 | fLsigTXOPProtectionFullSupport = false; |
| 3770 | pBeaconParams->paramChangeBitmap |= |
| 3771 | PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED; |
| 3772 | } |
| 3773 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3774 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3775 | } |
| 3776 | |
| 3777 | /* FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection. */ |
| 3778 | /* This check will be done at the caller. */ |
| 3779 | /** ------------------------------------------------------------- |
| 3780 | \fn lim_enable_ht_rifs_protection |
| 3781 | \brief based on cofig enables\disables Rifs protection. |
| 3782 | \param uint8_t enable : 1=> enable protection, 0=> disable protection. |
| 3783 | \param uint8_t overlap: 1=> called from overlap context, 0 => called from assoc context. |
| 3784 | \param tpUpdateBeaconParams pBeaconParams |
| 3785 | \return None |
| 3786 | -------------------------------------------------------------*/ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3787 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3788 | lim_enable_ht_rifs_protection(struct mac_context *mac, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3789 | uint8_t overlap, tpUpdateBeaconParams pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3790 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3791 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3792 | if (!pe_session->htCapability) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3793 | return QDF_STATUS_SUCCESS; /* this protection is only for HT stations. */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3794 | |
| 3795 | /* overlapping protection configuration check. */ |
| 3796 | if (overlap) { |
| 3797 | } else { |
| 3798 | /* normal protection config check */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3799 | if (LIM_IS_AP_ROLE(pe_session) && |
| 3800 | !pe_session->cfgProtection.rifs) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3801 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3802 | pe_debug("protection from Rifs is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3803 | return QDF_STATUS_SUCCESS; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3804 | } else if (!LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3805 | /* normal protection config check */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3806 | if (!mac->lim.cfgProtection.rifs) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3807 | /* protection disabled. */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3808 | pe_debug("protection from Rifs is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3809 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3810 | } |
| 3811 | } |
| 3812 | } |
| 3813 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3814 | if (LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3815 | /* Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS */ |
| 3816 | if ((!enable) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3817 | && (false == pe_session->beaconParams.fRIFSMode)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3818 | pe_debug(" => Rifs protection Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3819 | pBeaconParams->fRIFSMode = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3820 | pe_session->beaconParams.fRIFSMode = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3821 | pBeaconParams->paramChangeBitmap |= |
| 3822 | PARAM_RIFS_MODE_CHANGED; |
| 3823 | } |
| 3824 | /* Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS */ |
| 3825 | else if (enable |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3826 | && (true == pe_session->beaconParams.fRIFSMode)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3827 | pe_debug("===> Rifs Protection Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3828 | pBeaconParams->fRIFSMode = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3829 | pe_session->beaconParams.fRIFSMode = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3830 | pBeaconParams->paramChangeBitmap |= |
| 3831 | PARAM_RIFS_MODE_CHANGED; |
| 3832 | } |
| 3833 | } else { |
| 3834 | /* Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS */ |
| 3835 | if ((!enable) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3836 | && (false == pe_session->beaconParams.fRIFSMode)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3837 | pe_debug(" => Rifs protection Disabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3838 | pBeaconParams->fRIFSMode = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3839 | pe_session->beaconParams.fRIFSMode = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3840 | pBeaconParams->paramChangeBitmap |= |
| 3841 | PARAM_RIFS_MODE_CHANGED; |
| 3842 | } |
| 3843 | /* Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS */ |
| 3844 | else if (enable |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3845 | && (true == pe_session->beaconParams.fRIFSMode)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3846 | pe_debug("===> Rifs Protection Enabled"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3847 | pBeaconParams->fRIFSMode = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3848 | pe_session->beaconParams.fRIFSMode = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3849 | pBeaconParams->paramChangeBitmap |= |
| 3850 | PARAM_RIFS_MODE_CHANGED; |
| 3851 | } |
| 3852 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3853 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3854 | } |
| 3855 | |
| 3856 | /* --------------------------------------------------------------------- */ |
| 3857 | /** |
| 3858 | * lim_enable_short_preamble |
| 3859 | * |
| 3860 | * FUNCTION: |
| 3861 | * Enable/Disable short preamble |
| 3862 | * |
| 3863 | * LOGIC: |
| 3864 | * |
| 3865 | * ASSUMPTIONS: |
| 3866 | * |
| 3867 | * NOTE: |
| 3868 | * |
| 3869 | * @param enable Flag to enable/disable short preamble |
| 3870 | * @return None |
| 3871 | */ |
| 3872 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3873 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3874 | lim_enable_short_preamble(struct mac_context *mac, uint8_t enable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3875 | tpUpdateBeaconParams pBeaconParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3876 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3877 | { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3878 | if (!mac->mlme_cfg->ht_caps.short_preamble) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3879 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3880 | |
gaurank kathpalia | e5a17e4 | 2018-09-10 10:05:25 +0530 | [diff] [blame] | 3881 | /* 11G short preamble switching is disabled. */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3882 | if (!mac->mlme_cfg->feature_flags.enable_short_preamble_11g) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3883 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3884 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3885 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 3886 | if (enable && (pe_session->beaconParams.fShortPreamble == 0)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3887 | pe_debug("===> Short Preamble Enabled"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3888 | pe_session->beaconParams.fShortPreamble = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3889 | pBeaconParams->fShortPreamble = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3890 | (uint8_t) pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3891 | fShortPreamble; |
| 3892 | pBeaconParams->paramChangeBitmap |= |
| 3893 | PARAM_SHORT_PREAMBLE_CHANGED; |
| 3894 | } else if (!enable |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3895 | && (pe_session->beaconParams.fShortPreamble == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3896 | 1)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3897 | pe_debug("===> Short Preamble Disabled"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3898 | pe_session->beaconParams.fShortPreamble = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3899 | pBeaconParams->fShortPreamble = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3900 | (uint8_t) pe_session->beaconParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3901 | fShortPreamble; |
| 3902 | pBeaconParams->paramChangeBitmap |= |
| 3903 | PARAM_SHORT_PREAMBLE_CHANGED; |
| 3904 | } |
| 3905 | } |
| 3906 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3907 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3908 | } |
| 3909 | |
| 3910 | /** |
| 3911 | * lim_tx_complete |
| 3912 | * |
| 3913 | * Function: |
| 3914 | * This is LIM's very own "TX MGMT frame complete" completion routine. |
| 3915 | * |
| 3916 | * Logic: |
| 3917 | * LIM wants to send a MGMT frame (broadcast or unicast) |
| 3918 | * LIM allocates memory using cds_packet_alloc( ..., **pData, **pPacket ) |
| 3919 | * LIM transmits the MGMT frame using the API: |
| 3920 | * wma_tx_frame( ... pPacket, ..., (void *) lim_tx_complete, pData ) |
| 3921 | * HDD, via wma_tx_frame/DXE, "transfers" the packet over to BMU |
| 3922 | * HDD, if it determines that a TX completion routine (in this case |
| 3923 | * lim_tx_complete) has been provided, will invoke this callback |
| 3924 | * LIM will try to free the TX MGMT packet that was earlier allocated, in order |
| 3925 | * to send this MGMT frame, using the PAL API cds_packet_free( ... pData, pPacket ) |
| 3926 | * |
| 3927 | * Assumptions: |
| 3928 | * Presently, this is ONLY being used for MGMT frames/packets |
| 3929 | * TODO: |
| 3930 | * Would it do good for LIM to have some sort of "signature" validation to |
| 3931 | * ensure that the pData argument passed in was a buffer that was actually |
| 3932 | * allocated by LIM and/or is not corrupted? |
| 3933 | * |
| 3934 | * Note: FIXME and TODO |
| 3935 | * Looks like cds_packet_free() is interested in pPacket. But, when this completion |
| 3936 | * routine is called, only pData is made available to LIM!! |
| 3937 | * |
| 3938 | * @param void A pointer to pData. Shouldn't it be pPacket?! |
| 3939 | * |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3940 | * @return QDF_STATUS_SUCCESS - in case of success |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3941 | */ |
Jeff Johnson | 8390fe2 | 2018-06-09 21:59:32 -0700 | [diff] [blame] | 3942 | QDF_STATUS lim_tx_complete(void *context, qdf_nbuf_t buf, bool free) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3943 | { |
| 3944 | if (free) |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3945 | cds_packet_free((void *)buf); |
| 3946 | |
| 3947 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3948 | } |
| 3949 | |
| 3950 | /** |
| 3951 | * \brief This function updates lim global structure, if CB parameters in the BSS |
| 3952 | * have changed, and sends an indication to HAL also with the |
| 3953 | * updated HT Parameters. |
| 3954 | * This function does not detect the change in the primary channel, that is done as part |
| 3955 | * of channel Swtich IE processing. |
| 3956 | * If STA is configured with '20Mhz only' mode, then this function does not do anything |
| 3957 | * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz' |
| 3958 | * |
| 3959 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3960 | * \param mac Pointer to global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3961 | * |
| 3962 | * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or |
| 3963 | * Probe Response |
| 3964 | * |
| 3965 | * \param bssIdx BSS Index of the Bss to which Station is associated. |
| 3966 | * |
| 3967 | * |
| 3968 | */ |
| 3969 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 3970 | void lim_update_sta_run_time_ht_switch_chnl_params(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3971 | tDot11fIEHTInfo *pHTInfo, |
| 3972 | uint8_t bssIdx, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3973 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3974 | { |
| 3975 | uint8_t center_freq = 0; |
Kiran Kumar Lokere | 05a0658a | 2018-02-01 21:34:27 -0800 | [diff] [blame] | 3976 | enum phy_ch_width ch_width = CH_WIDTH_20MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3977 | |
| 3978 | /* If self capability is set to '20Mhz only', then do not change the CB mode. */ |
| 3979 | if (!lim_get_ht_capability |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3980 | (mac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pe_session)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3981 | return; |
| 3982 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3983 | if (WLAN_REG_IS_24GHZ_CH(pe_session->currentOperChannel) && |
| 3984 | pe_session->force_24ghz_in_ht20) { |
Abhishek Singh | b59f8d4 | 2017-07-31 14:42:47 +0530 | [diff] [blame] | 3985 | pe_debug("force_24ghz_in_ht20 is set and channel is 2.4 Ghz"); |
| 3986 | return; |
| 3987 | } |
| 3988 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3989 | if (pe_session->ftPEContext.ftPreAuthSession) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 3990 | pe_err("FT PREAUTH channel change is in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3991 | return; |
| 3992 | } |
| 3993 | |
Kiran Kumar Lokere | a3e5e0b | 2015-11-03 14:17:26 -0800 | [diff] [blame] | 3994 | /* |
| 3995 | * Do not try to switch channel if RoC is in progress. RoC code path |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3996 | * uses mac->lim.gpLimRemainOnChanReq to notify the upper layers that |
Kiran Kumar Lokere | a3e5e0b | 2015-11-03 14:17:26 -0800 | [diff] [blame] | 3997 | * the device has started listening on the channel requested as part of |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 3998 | * RoC, if we set mac->lim.gpLimRemainOnChanReq to NULL as we do below |
Kiran Kumar Lokere | a3e5e0b | 2015-11-03 14:17:26 -0800 | [diff] [blame] | 3999 | * then the upper layers will think that the channel change is not |
| 4000 | * successful and the RoC from the upper layer perspective will never |
| 4001 | * end... |
| 4002 | */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4003 | if (mac->lim.gpLimRemainOnChanReq) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4004 | pe_debug("RoC is in progress"); |
Kiran Kumar Lokere | a3e5e0b | 2015-11-03 14:17:26 -0800 | [diff] [blame] | 4005 | return; |
| 4006 | } |
| 4007 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4008 | if (pe_session->ch_switch_in_progress == true) { |
Kiran Kumar Lokere | f9dc791 | 2017-06-28 18:10:58 -0700 | [diff] [blame] | 4009 | pe_debug("ch switch is in progress, ignore HT IE BW update"); |
| 4010 | return; |
| 4011 | } |
| 4012 | |
Abhishek Singh | 7889a7e | 2017-06-23 14:58:02 +0530 | [diff] [blame] | 4013 | if (!pHTInfo->primaryChannel) { |
| 4014 | pe_debug("Ignore as primary channel is 0 in HT info"); |
| 4015 | return; |
| 4016 | } |
| 4017 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4018 | if (pe_session->htSecondaryChannelOffset != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4019 | (uint8_t) pHTInfo->secondaryChannelOffset |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4020 | || pe_session->htRecommendedTxWidthSet != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4021 | (uint8_t) pHTInfo->recommendedTxWidthSet) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4022 | pe_session->htSecondaryChannelOffset = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4023 | (ePhyChanBondState) pHTInfo->secondaryChannelOffset; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4024 | pe_session->htRecommendedTxWidthSet = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4025 | (uint8_t) pHTInfo->recommendedTxWidthSet; |
| 4026 | if (eHT_CHANNEL_WIDTH_40MHZ == |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4027 | pe_session->htRecommendedTxWidthSet) { |
Kiran Kumar Lokere | 05a0658a | 2018-02-01 21:34:27 -0800 | [diff] [blame] | 4028 | ch_width = CH_WIDTH_40MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4029 | if (PHY_DOUBLE_CHANNEL_LOW_PRIMARY == |
| 4030 | pHTInfo->secondaryChannelOffset) |
| 4031 | center_freq = pHTInfo->primaryChannel + 2; |
| 4032 | else if (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == |
| 4033 | pHTInfo->secondaryChannelOffset) |
| 4034 | center_freq = pHTInfo->primaryChannel - 2; |
Kiran Kumar Lokere | 05a0658a | 2018-02-01 21:34:27 -0800 | [diff] [blame] | 4035 | else |
| 4036 | ch_width = CH_WIDTH_20MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4037 | } |
| 4038 | |
| 4039 | /* notify HAL */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4040 | pe_debug("Channel Information in HT IE change" |
| 4041 | "d; sending notification to HAL."); |
| 4042 | pe_debug("Primary Channel: %d Secondary Chan" |
| 4043 | "nel Offset: %d Channel Width: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4044 | pHTInfo->primaryChannel, center_freq, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4045 | pe_session->htRecommendedTxWidthSet); |
| 4046 | pe_session->channelChangeReasonCode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4047 | LIM_SWITCH_CHANNEL_OPERATION; |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4048 | mac->lim.gpchangeChannelCallback = NULL; |
| 4049 | mac->lim.gpchangeChannelData = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4050 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4051 | lim_send_switch_chnl_params(mac, (uint8_t) pHTInfo->primaryChannel, |
Kiran Kumar Lokere | 05a0658a | 2018-02-01 21:34:27 -0800 | [diff] [blame] | 4052 | center_freq, 0, ch_width, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4053 | pe_session->maxTxPower, |
| 4054 | pe_session->peSessionId, |
Arif Hussain | 671a190 | 2017-03-17 09:08:32 -0700 | [diff] [blame] | 4055 | true, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4056 | |
| 4057 | /* In case of IBSS, if STA should update HT Info IE in its beacons. */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4058 | if (LIM_IS_IBSS_ROLE(pe_session)) { |
| 4059 | sch_set_fixed_beacon_fields(mac, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4060 | } |
| 4061 | |
| 4062 | } |
| 4063 | } /* End limUpdateStaRunTimeHTParams. */ |
| 4064 | |
| 4065 | /** |
| 4066 | * \brief This function updates the lim global structure, if any of the |
| 4067 | * HT Capabilities have changed. |
| 4068 | * |
| 4069 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4070 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4071 | * |
| 4072 | * \param pHTCapability Pointer to HT Capability Information Element |
| 4073 | * obtained from a Beacon or Probe Response |
| 4074 | * |
| 4075 | * |
| 4076 | * |
| 4077 | */ |
| 4078 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4079 | void lim_update_sta_run_time_ht_capability(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4080 | tDot11fIEHTCaps *pHTCaps) |
| 4081 | { |
| 4082 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4083 | if (mac->lim.gHTLsigTXOPProtection != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4084 | (uint8_t) pHTCaps->lsigTXOPProtection) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4085 | mac->lim.gHTLsigTXOPProtection = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4086 | (uint8_t) pHTCaps->lsigTXOPProtection; |
| 4087 | /* Send change notification to HAL */ |
| 4088 | } |
| 4089 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4090 | if (mac->lim.gHTAMpduDensity != (uint8_t) pHTCaps->mpduDensity) { |
| 4091 | mac->lim.gHTAMpduDensity = (uint8_t) pHTCaps->mpduDensity; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4092 | /* Send change notification to HAL */ |
| 4093 | } |
| 4094 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4095 | if (mac->lim.gHTMaxRxAMpduFactor != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4096 | (uint8_t) pHTCaps->maxRxAMPDUFactor) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4097 | mac->lim.gHTMaxRxAMpduFactor = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4098 | (uint8_t) pHTCaps->maxRxAMPDUFactor; |
| 4099 | /* Send change notification to HAL */ |
| 4100 | } |
| 4101 | |
| 4102 | } /* End lim_update_sta_run_time_ht_capability. */ |
| 4103 | |
| 4104 | /** |
| 4105 | * \brief This function updates lim global structure, if any of the HT |
| 4106 | * Info Parameters have changed. |
| 4107 | * |
| 4108 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4109 | * \param mac Pointer to the global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4110 | * |
| 4111 | * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or |
| 4112 | * Probe Response |
| 4113 | * |
| 4114 | * |
| 4115 | */ |
| 4116 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4117 | void lim_update_sta_run_time_ht_info(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4118 | tDot11fIEHTInfo *pHTInfo, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4119 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4120 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4121 | if (pe_session->htRecommendedTxWidthSet != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4122 | (uint8_t) pHTInfo->recommendedTxWidthSet) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4123 | pe_session->htRecommendedTxWidthSet = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4124 | (uint8_t) pHTInfo->recommendedTxWidthSet; |
| 4125 | /* Send change notification to HAL */ |
| 4126 | } |
| 4127 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4128 | if (pe_session->beaconParams.fRIFSMode != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4129 | (uint8_t) pHTInfo->rifsMode) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4130 | pe_session->beaconParams.fRIFSMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4131 | (uint8_t) pHTInfo->rifsMode; |
| 4132 | /* Send change notification to HAL */ |
| 4133 | } |
| 4134 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4135 | if (mac->lim.gHTServiceIntervalGranularity != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4136 | (uint8_t) pHTInfo->serviceIntervalGranularity) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4137 | mac->lim.gHTServiceIntervalGranularity = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4138 | (uint8_t) pHTInfo->serviceIntervalGranularity; |
| 4139 | /* Send change notification to HAL */ |
| 4140 | } |
| 4141 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4142 | if (mac->lim.gHTOperMode != (tSirMacHTOperatingMode) pHTInfo->opMode) { |
| 4143 | mac->lim.gHTOperMode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4144 | (tSirMacHTOperatingMode) pHTInfo->opMode; |
| 4145 | /* Send change notification to HAL */ |
| 4146 | } |
| 4147 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4148 | if (pe_session->beaconParams.llnNonGFCoexist != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4149 | pHTInfo->nonGFDevicesPresent) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4150 | pe_session->beaconParams.llnNonGFCoexist = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4151 | (uint8_t) pHTInfo->nonGFDevicesPresent; |
| 4152 | } |
| 4153 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4154 | if (mac->lim.gHTSTBCBasicMCS != (uint8_t) pHTInfo->basicSTBCMCS) { |
| 4155 | mac->lim.gHTSTBCBasicMCS = (uint8_t) pHTInfo->basicSTBCMCS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4156 | /* Send change notification to HAL */ |
| 4157 | } |
| 4158 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4159 | if (mac->lim.gHTDualCTSProtection != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4160 | (uint8_t) pHTInfo->dualCTSProtection) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4161 | mac->lim.gHTDualCTSProtection = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4162 | (uint8_t) pHTInfo->dualCTSProtection; |
| 4163 | /* Send change notification to HAL */ |
| 4164 | } |
| 4165 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4166 | if (mac->lim.gHTSecondaryBeacon != (uint8_t) pHTInfo->secondaryBeacon) { |
| 4167 | mac->lim.gHTSecondaryBeacon = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4168 | (uint8_t) pHTInfo->secondaryBeacon; |
| 4169 | /* Send change notification to HAL */ |
| 4170 | } |
| 4171 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4172 | if (pe_session->beaconParams.fLsigTXOPProtectionFullSupport != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4173 | (uint8_t) pHTInfo->lsigTXOPProtectionFullSupport) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4174 | pe_session->beaconParams.fLsigTXOPProtectionFullSupport = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4175 | (uint8_t) pHTInfo->lsigTXOPProtectionFullSupport; |
| 4176 | /* Send change notification to HAL */ |
| 4177 | } |
| 4178 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4179 | if (mac->lim.gHTPCOActive != (uint8_t) pHTInfo->pcoActive) { |
| 4180 | mac->lim.gHTPCOActive = (uint8_t) pHTInfo->pcoActive; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4181 | /* Send change notification to HAL */ |
| 4182 | } |
| 4183 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4184 | if (mac->lim.gHTPCOPhase != (uint8_t) pHTInfo->pcoPhase) { |
| 4185 | mac->lim.gHTPCOPhase = (uint8_t) pHTInfo->pcoPhase; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4186 | /* Send change notification to HAL */ |
| 4187 | } |
| 4188 | |
| 4189 | } /* End lim_update_sta_run_time_ht_info. */ |
| 4190 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4191 | /** |
| 4192 | * lim_validate_delts_req() - This function validates DelTs req |
| 4193 | * @mac_ctx: pointer to Global Mac structure |
| 4194 | * @delts_req: pointer to delete traffic stream structure |
| 4195 | * @peer_mac_addr: variable for peer mac address |
| 4196 | * |
| 4197 | * Function validates DelTs req originated by SME or by HAL and also |
| 4198 | * sends halMsg_DelTs to HAL |
| 4199 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4200 | * Return: QDF_STATUS_SUCCESS - Success, QDF_STATUS_E_FAILURE - Failure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4201 | */ |
| 4202 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4203 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4204 | lim_validate_delts_req(struct mac_context *mac_ctx, tpSirDeltsReq delts_req, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 4205 | tSirMacAddr peer_mac_addr, struct pe_session *psession_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4206 | { |
| 4207 | tpDphHashNode sta; |
| 4208 | uint8_t ts_status; |
| 4209 | tSirMacTSInfo *tsinfo; |
| 4210 | uint32_t i; |
| 4211 | uint8_t tspec_idx; |
| 4212 | |
| 4213 | /* |
| 4214 | * if sta |
| 4215 | * - verify assoc state |
| 4216 | * - del tspec locally |
| 4217 | * if ap |
| 4218 | * - verify sta is in assoc state |
| 4219 | * - del sta tspec locally |
| 4220 | */ |
| 4221 | if (delts_req == NULL) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4222 | pe_err("Delete TS request pointer is NULL"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4223 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4224 | } |
| 4225 | |
Rajeev Kumar | 0ac9f2a | 2016-04-15 15:54:18 -0700 | [diff] [blame] | 4226 | if (LIM_IS_STA_ROLE(psession_entry)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4227 | uint32_t val; |
| 4228 | |
| 4229 | /* station always talks to the AP */ |
| 4230 | sta = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, |
| 4231 | &psession_entry->dph.dphHashTable); |
| 4232 | |
| 4233 | val = sizeof(tSirMacAddr); |
| 4234 | sir_copy_mac_addr(peer_mac_addr, psession_entry->bssId); |
| 4235 | |
| 4236 | } else { |
| 4237 | uint16_t associd; |
| 4238 | uint8_t *macaddr = (uint8_t *) peer_mac_addr; |
| 4239 | |
| 4240 | associd = delts_req->aid; |
| 4241 | if (associd != 0) |
| 4242 | sta = dph_get_hash_entry(mac_ctx, associd, |
| 4243 | &psession_entry->dph.dphHashTable); |
| 4244 | else |
| 4245 | sta = dph_lookup_hash_entry(mac_ctx, |
Srinivas Girigowda | bab8893 | 2015-12-03 19:18:11 -0800 | [diff] [blame] | 4246 | delts_req->macaddr.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4247 | &associd, |
| 4248 | &psession_entry->dph. |
| 4249 | dphHashTable); |
| 4250 | |
| 4251 | if (sta != NULL) |
| 4252 | /* TBD: check sta assoc state as well */ |
| 4253 | for (i = 0; i < sizeof(tSirMacAddr); i++) |
| 4254 | macaddr[i] = sta->staAddr[i]; |
| 4255 | } |
| 4256 | |
| 4257 | if (sta == NULL) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4258 | pe_err("Cannot find station context for delts req"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4259 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4260 | } |
| 4261 | |
| 4262 | if ((!sta->valid) || |
| 4263 | (sta->mlmStaContext.mlmState != |
| 4264 | eLIM_MLM_LINK_ESTABLISHED_STATE)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4265 | pe_err("Invalid Sta (or state) for DelTsReq"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4266 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4267 | } |
| 4268 | |
| 4269 | delts_req->req.wsmTspecPresent = 0; |
| 4270 | delts_req->req.wmeTspecPresent = 0; |
| 4271 | delts_req->req.lleTspecPresent = 0; |
| 4272 | |
| 4273 | if ((sta->wsmEnabled) && |
| 4274 | (delts_req->req.tspec.tsinfo.traffic.accessPolicy != |
| 4275 | SIR_MAC_ACCESSPOLICY_EDCA)) |
| 4276 | delts_req->req.wsmTspecPresent = 1; |
| 4277 | else if (sta->wmeEnabled) |
| 4278 | delts_req->req.wmeTspecPresent = 1; |
| 4279 | else if (sta->lleEnabled) |
| 4280 | delts_req->req.lleTspecPresent = 1; |
| 4281 | else { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4282 | pe_warn("DELTS_REQ ignore - qos is disabled"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4283 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4284 | } |
| 4285 | |
| 4286 | tsinfo = delts_req->req.wmeTspecPresent ? &delts_req->req.tspec.tsinfo |
| 4287 | : &delts_req->req.tsinfo; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4288 | pe_debug("received DELTS_REQ message wmeTspecPresent: %d lleTspecPresent: %d wsmTspecPresent: %d tsid: %d up: %d direction: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4289 | delts_req->req.wmeTspecPresent, |
| 4290 | delts_req->req.lleTspecPresent, |
| 4291 | delts_req->req.wsmTspecPresent, tsinfo->traffic.tsid, |
| 4292 | tsinfo->traffic.userPrio, tsinfo->traffic.direction); |
| 4293 | |
| 4294 | /* if no Access Control, ignore the request */ |
| 4295 | if (lim_admit_control_delete_ts(mac_ctx, sta->assocId, tsinfo, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4296 | &ts_status, &tspec_idx) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4297 | pe_err("DELTS request for sta assocId: %d tsid: %d up: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4298 | sta->assocId, tsinfo->traffic.tsid, |
| 4299 | tsinfo->traffic.userPrio); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4300 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4301 | } else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) |
| 4302 | || (tsinfo->traffic.accessPolicy == |
| 4303 | SIR_MAC_ACCESSPOLICY_BOTH)) { |
| 4304 | /* edca only now. */ |
| 4305 | } else if (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) { |
| 4306 | /* send message to HAL to delete TS */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4307 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4308 | lim_send_hal_msg_del_ts(mac_ctx, sta->staIndex, |
| 4309 | tspec_idx, delts_req->req, |
| 4310 | psession_entry->peSessionId, |
| 4311 | psession_entry->bssId)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4312 | pe_warn("DelTs with UP: %d failed in lim_send_hal_msg_del_ts - ignoring request", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4313 | tsinfo->traffic.userPrio); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4314 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4315 | } |
| 4316 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4317 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4318 | } |
| 4319 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4320 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4321 | * @function : lim_post_sm_state_update() |
| 4322 | * |
| 4323 | * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state. |
| 4324 | * |
| 4325 | * LOGIC: |
| 4326 | * |
| 4327 | * ASSUMPTIONS: |
| 4328 | * NA |
| 4329 | * |
| 4330 | * NOTE: |
| 4331 | * NA |
| 4332 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4333 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4334 | * @param limMsg - Lim Message structure object with the MimoPSparam in body |
| 4335 | * @return None |
| 4336 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4337 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4338 | lim_post_sm_state_update(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4339 | uint16_t staIdx, tSirMacHTMIMOPowerSaveState state, |
| 4340 | uint8_t *pPeerStaMac, uint8_t sessionId) |
| 4341 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4342 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4343 | struct scheduler_msg msgQ = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4344 | tpSetMIMOPS pMIMO_PSParams; |
| 4345 | |
| 4346 | msgQ.reserved = 0; |
| 4347 | msgQ.type = WMA_SET_MIMOPS_REQ; |
| 4348 | |
| 4349 | /* Allocate for WMA_SET_MIMOPS_REQ */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4350 | pMIMO_PSParams = qdf_mem_malloc(sizeof(tSetMIMOPS)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 4351 | if (!pMIMO_PSParams) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4352 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4353 | |
| 4354 | pMIMO_PSParams->htMIMOPSState = state; |
| 4355 | pMIMO_PSParams->staIdx = staIdx; |
| 4356 | pMIMO_PSParams->fsendRsp = true; |
| 4357 | pMIMO_PSParams->sessionId = sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4358 | qdf_mem_copy(pMIMO_PSParams->peerMac, pPeerStaMac, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | |
| 4360 | msgQ.bodyptr = pMIMO_PSParams; |
| 4361 | msgQ.bodyval = 0; |
| 4362 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4363 | pe_debug("Sending WMA_SET_MIMOPS_REQ"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4364 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4365 | MTRACE(mac_trace_msg_tx(mac, NO_SESSION, msgQ.type)); |
| 4366 | retCode = wma_post_ctrl_msg(mac, &msgQ); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4367 | if (QDF_STATUS_SUCCESS != retCode) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4368 | pe_err("Posting WMA_SET_MIMOPS_REQ to HAL failed! Reason: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4369 | retCode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4370 | qdf_mem_free(pMIMO_PSParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4371 | return retCode; |
| 4372 | } |
| 4373 | |
| 4374 | return retCode; |
| 4375 | } |
| 4376 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4377 | void lim_pkt_free(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4378 | eFrameType frmType, uint8_t *pRxPacketInfo, void *pBody) |
| 4379 | { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4380 | (void)mac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4381 | (void)frmType; |
| 4382 | (void)pRxPacketInfo; |
| 4383 | (void)pBody; |
| 4384 | } |
| 4385 | |
| 4386 | /** |
| 4387 | * lim_get_b_dfrom_rx_packet() |
| 4388 | * |
| 4389 | ***FUNCTION: |
| 4390 | * This function is called to get pointer to Polaris |
| 4391 | * Buffer Descriptor containing MAC header & other control |
| 4392 | * info from the body of the message posted to LIM. |
| 4393 | * |
| 4394 | ***LOGIC: |
| 4395 | * NA |
| 4396 | * |
| 4397 | ***ASSUMPTIONS: |
| 4398 | * NA |
| 4399 | * |
| 4400 | ***NOTE: |
| 4401 | * NA |
| 4402 | * |
| 4403 | * @param body - Received message body |
| 4404 | * @param pRxPacketInfo - Pointer to received BD |
| 4405 | * @return None |
| 4406 | */ |
| 4407 | |
| 4408 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4409 | lim_get_b_dfrom_rx_packet(struct mac_context *mac, void *body, uint32_t **pRxPacketInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4410 | { |
| 4411 | *pRxPacketInfo = (uint32_t *) body; |
| 4412 | } /*** end lim_get_b_dfrom_rx_packet() ***/ |
| 4413 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4414 | void lim_add_channel_status_info(struct mac_context *p_mac, |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 4415 | struct lim_channel_status *channel_stat, |
| 4416 | uint8_t channel_id) |
| 4417 | { |
| 4418 | uint8_t i; |
| 4419 | bool found = false; |
| 4420 | struct lim_scan_channel_status *channel_info = |
| 4421 | &p_mac->lim.scan_channel_status; |
| 4422 | struct lim_channel_status *channel_status_list = |
| 4423 | channel_info->channel_status_list; |
| 4424 | uint8_t total_channel = channel_info->total_channel; |
| 4425 | |
| 4426 | if (!p_mac->sap.acs_with_more_param) |
| 4427 | return; |
| 4428 | |
| 4429 | for (i = 0; i < total_channel; i++) { |
| 4430 | if (channel_status_list[i].channel_id == channel_id) { |
| 4431 | if (channel_stat->cmd_flags == |
| 4432 | WMI_CHAN_InFO_END_RESP && |
| 4433 | channel_status_list[i].cmd_flags == |
| 4434 | WMI_CHAN_InFO_START_RESP) { |
| 4435 | /* adjust to delta value for counts */ |
| 4436 | channel_stat->rx_clear_count -= |
| 4437 | channel_status_list[i].rx_clear_count; |
| 4438 | channel_stat->cycle_count -= |
| 4439 | channel_status_list[i].cycle_count; |
| 4440 | channel_stat->rx_frame_count -= |
| 4441 | channel_status_list[i].rx_frame_count; |
| 4442 | channel_stat->tx_frame_count -= |
| 4443 | channel_status_list[i].tx_frame_count; |
| 4444 | channel_stat->bss_rx_cycle_count -= |
| 4445 | channel_status_list[i].bss_rx_cycle_count; |
| 4446 | } |
| 4447 | qdf_mem_copy(&channel_status_list[i], channel_stat, |
| 4448 | sizeof(*channel_status_list)); |
| 4449 | found = true; |
| 4450 | break; |
| 4451 | } |
| 4452 | } |
| 4453 | |
| 4454 | if (!found) { |
| 4455 | if (total_channel < SIR_MAX_SUPPORTED_CHANNEL_LIST) { |
| 4456 | qdf_mem_copy(&channel_status_list[total_channel++], |
| 4457 | channel_stat, |
| 4458 | sizeof(*channel_status_list)); |
| 4459 | channel_info->total_channel = total_channel; |
| 4460 | } else { |
| 4461 | pe_warn("Chan cnt exceed, channel_id=%d", channel_id); |
| 4462 | } |
| 4463 | } |
| 4464 | |
| 4465 | return; |
| 4466 | } |
| 4467 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4468 | /** |
| 4469 | * @function : lim_is_channel_valid_for_channel_switch() |
| 4470 | * |
| 4471 | * @brief : This function checks if the channel to which AP |
| 4472 | * is expecting us to switch, is a valid channel for us. |
| 4473 | * LOGIC: |
| 4474 | * |
| 4475 | * ASSUMPTIONS: |
| 4476 | * NA |
| 4477 | * |
| 4478 | * NOTE: |
| 4479 | * NA |
| 4480 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4481 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4482 | * @param channel - New channel to which we are expected to move |
| 4483 | * @return None |
| 4484 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4485 | bool lim_is_channel_valid_for_channel_switch(struct mac_context *mac, uint8_t channel) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4486 | { |
| 4487 | uint8_t index; |
| 4488 | uint32_t validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 4489 | tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
Bala Venkatesh | 867d411 | 2018-06-08 12:53:31 +0530 | [diff] [blame] | 4490 | bool ok = false; |
Ajit Pal Singh | 7ae88fb | 2017-09-06 16:14:35 +0530 | [diff] [blame] | 4491 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4492 | if (policy_mgr_is_chan_ok_for_dnbs(mac->psoc, channel, &ok)) { |
Ajit Pal Singh | 7ae88fb | 2017-09-06 16:14:35 +0530 | [diff] [blame] | 4493 | pe_err("policy_mgr_is_chan_ok_for_dnbs() returned error"); |
| 4494 | return false; |
| 4495 | } |
| 4496 | |
| 4497 | if (!ok) { |
| 4498 | pe_debug("channel not ok for DNBS"); |
| 4499 | return false; |
| 4500 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4501 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4502 | if (wlan_cfg_get_str(mac, WNI_CFG_VALID_CHANNEL_LIST, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4503 | (uint8_t *) validChannelList, |
| 4504 | (uint32_t *) &validChannelListLen) != |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4505 | QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4506 | pe_err("could not retrieve valid channel list"); |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 4507 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4508 | } |
| 4509 | |
| 4510 | for (index = 0; index < validChannelListLen; index++) { |
Bala Venkatesh | 867d411 | 2018-06-08 12:53:31 +0530 | [diff] [blame] | 4511 | if (validChannelList[index] != channel) |
| 4512 | continue; |
| 4513 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4514 | ok = policy_mgr_is_valid_for_channel_switch(mac->psoc, |
Bala Venkatesh | 867d411 | 2018-06-08 12:53:31 +0530 | [diff] [blame] | 4515 | channel); |
| 4516 | return ok; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4517 | } |
| 4518 | |
| 4519 | /* channel does not belong to list of valid channels */ |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 4520 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4521 | } |
| 4522 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4523 | /** |
| 4524 | * @function : lim_restore_pre_channel_switch_state() |
| 4525 | * |
| 4526 | * @brief : This API is called by the user to undo any |
| 4527 | * specific changes done on the device during |
| 4528 | * channel switch. |
| 4529 | * LOGIC: |
| 4530 | * |
| 4531 | * ASSUMPTIONS: |
| 4532 | * NA |
| 4533 | * |
| 4534 | * NOTE: |
| 4535 | * NA |
| 4536 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4537 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4538 | * @return None |
| 4539 | */ |
| 4540 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4541 | QDF_STATUS |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4542 | lim_restore_pre_channel_switch_state(struct mac_context *mac, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4543 | { |
| 4544 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4545 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4546 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4547 | if (!LIM_IS_STA_ROLE(pe_session)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4548 | return retCode; |
| 4549 | |
| 4550 | /* Channel switch should be ready for the next time */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4551 | pe_session->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4552 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4553 | return retCode; |
| 4554 | } |
| 4555 | |
| 4556 | /** |
| 4557 | * @function: lim_prepare_for11h_channel_switch() |
| 4558 | * |
| 4559 | * @brief : This API is called by the user to prepare for |
| 4560 | * 11h channel switch. As of now, the API does |
| 4561 | * very minimal work. User can add more into the |
| 4562 | * same API if needed. |
| 4563 | * LOGIC: |
| 4564 | * |
| 4565 | * ASSUMPTIONS: |
| 4566 | * NA |
| 4567 | * |
| 4568 | * NOTE: |
| 4569 | * NA |
| 4570 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4571 | * @param mac - Pointer to Global MAC structure |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4572 | * @param pe_session |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4573 | * @return None |
| 4574 | */ |
| 4575 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4576 | lim_prepare_for11h_channel_switch(struct mac_context *mac, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4577 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4578 | if (!LIM_IS_STA_ROLE(pe_session)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4579 | return; |
| 4580 | |
| 4581 | /* Flag to indicate 11h channel switch in progress */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4582 | pe_session->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4583 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4584 | if (mac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE || |
| 4585 | mac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4586 | pe_debug("Posting finish scan as we are in scan state"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4587 | /* Stop ongoing scanning if any */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4588 | if (GET_LIM_PROCESS_DEFD_MESGS(mac)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4589 | /* Set the resume channel to Any valid channel (invalid). */ |
| 4590 | /* This will instruct HAL to set it to any previous valid channel. */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4591 | pe_set_resume_channel(mac, 0, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4592 | } else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4593 | lim_restore_pre_channel_switch_state(mac, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4594 | } |
| 4595 | return; |
| 4596 | } else { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4597 | pe_debug("Not in scan state, start channel switch timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4598 | /** We are safe to switch channel at this point */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4599 | lim_stop_tx_and_switch_channel(mac, pe_session->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4600 | } |
| 4601 | } |
| 4602 | |
| 4603 | /**---------------------------------------------------- |
| 4604 | \fn lim_get_nw_type |
| 4605 | |
| 4606 | \brief Get type of the network from data packet or beacon |
Jeff Johnson | 982fe96 | 2018-11-28 17:07:01 -0800 | [diff] [blame] | 4607 | \param mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4608 | \param channelNum - Channel number |
| 4609 | \param type - Type of packet. |
| 4610 | \param pBeacon - Pointer to beacon or probe response |
| 4611 | |
| 4612 | \return Network type a/b/g. |
| 4613 | -----------------------------------------------------*/ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4614 | tSirNwType lim_get_nw_type(struct mac_context *mac, uint8_t channelNum, uint32_t type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4615 | tpSchBeaconStruct pBeacon) |
| 4616 | { |
| 4617 | tSirNwType nwType = eSIR_11B_NW_TYPE; |
| 4618 | |
| 4619 | if (type == SIR_MAC_DATA_FRAME) { |
| 4620 | if ((channelNum > 0) && (channelNum < 15)) { |
| 4621 | nwType = eSIR_11G_NW_TYPE; |
| 4622 | } else { |
| 4623 | nwType = eSIR_11A_NW_TYPE; |
| 4624 | } |
| 4625 | } else { |
| 4626 | if ((channelNum > 0) && (channelNum < 15)) { |
| 4627 | int i; |
| 4628 | /* 11b or 11g packet */ |
| 4629 | /* 11g iff extended Rate IE is present or */ |
| 4630 | /* if there is an A rate in suppRate IE */ |
| 4631 | for (i = 0; i < pBeacon->supportedRates.numRates; i++) { |
| 4632 | if (sirIsArate |
| 4633 | (pBeacon->supportedRates.rate[i] & 0x7f)) { |
| 4634 | nwType = eSIR_11G_NW_TYPE; |
| 4635 | break; |
| 4636 | } |
| 4637 | } |
| 4638 | if (pBeacon->extendedRatesPresent) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4639 | nwType = eSIR_11G_NW_TYPE; |
yeshwanth sriram guntuka | 47f26e6 | 2017-03-07 12:43:02 +0530 | [diff] [blame] | 4640 | } else if (pBeacon->HTInfo.present || |
| 4641 | IS_BSS_VHT_CAPABLE(pBeacon->VHTCaps)) { |
| 4642 | nwType = eSIR_11G_NW_TYPE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4643 | } |
| 4644 | } else { |
| 4645 | /* 11a packet */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4646 | nwType = eSIR_11A_NW_TYPE; |
| 4647 | } |
| 4648 | } |
| 4649 | return nwType; |
| 4650 | } |
| 4651 | |
| 4652 | /**--------------------------------------------------------- |
| 4653 | \fn lim_get_channel_from_beacon |
| 4654 | \brief To extract channel number from beacon |
| 4655 | |
Jeff Johnson | 982fe96 | 2018-11-28 17:07:01 -0800 | [diff] [blame] | 4656 | \param mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4657 | \param pBeacon - Pointer to beacon or probe rsp |
| 4658 | \return channel number |
| 4659 | -----------------------------------------------------------*/ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4660 | uint8_t lim_get_channel_from_beacon(struct mac_context *mac, tpSchBeaconStruct pBeacon) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4661 | { |
| 4662 | uint8_t channelNum = 0; |
| 4663 | |
| 4664 | if (pBeacon->dsParamsPresent) |
| 4665 | channelNum = pBeacon->channelNumber; |
| 4666 | else if (pBeacon->HTInfo.present) |
| 4667 | channelNum = pBeacon->HTInfo.primaryChannel; |
| 4668 | else |
| 4669 | channelNum = pBeacon->channelNumber; |
| 4670 | |
| 4671 | return channelNum; |
| 4672 | } |
| 4673 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4674 | void lim_set_tspec_uapsd_mask_per_session(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4675 | struct pe_session *pe_session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4676 | tSirMacTSInfo *pTsInfo, uint32_t action) |
| 4677 | { |
| 4678 | uint8_t userPrio = (uint8_t) pTsInfo->traffic.userPrio; |
| 4679 | uint16_t direction = pTsInfo->traffic.direction; |
| 4680 | uint8_t ac = upToAc(userPrio); |
| 4681 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4682 | pe_debug("Set UAPSD mask for AC: %d dir: %d action: %d" |
| 4683 | , ac, direction, action); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4684 | |
| 4685 | /* Converting AC to appropriate Uapsd Bit Mask |
| 4686 | * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3) |
| 4687 | * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2) |
| 4688 | * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1) |
| 4689 | * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0) |
| 4690 | */ |
| 4691 | ac = ((~ac) & 0x3); |
| 4692 | |
| 4693 | if (action == CLEAR_UAPSD_MASK) { |
| 4694 | if (direction == SIR_MAC_DIRECTION_UPLINK) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4695 | pe_session->gUapsdPerAcTriggerEnableMask &= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4696 | ~(1 << ac); |
| 4697 | else if (direction == SIR_MAC_DIRECTION_DNLINK) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4698 | pe_session->gUapsdPerAcDeliveryEnableMask &= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4699 | ~(1 << ac); |
| 4700 | else if (direction == SIR_MAC_DIRECTION_BIDIR) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4701 | pe_session->gUapsdPerAcTriggerEnableMask &= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4702 | ~(1 << ac); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4703 | pe_session->gUapsdPerAcDeliveryEnableMask &= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4704 | ~(1 << ac); |
| 4705 | } |
| 4706 | } else if (action == SET_UAPSD_MASK) { |
| 4707 | if (direction == SIR_MAC_DIRECTION_UPLINK) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4708 | pe_session->gUapsdPerAcTriggerEnableMask |= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4709 | (1 << ac); |
| 4710 | else if (direction == SIR_MAC_DIRECTION_DNLINK) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4711 | pe_session->gUapsdPerAcDeliveryEnableMask |= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4712 | (1 << ac); |
| 4713 | else if (direction == SIR_MAC_DIRECTION_BIDIR) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4714 | pe_session->gUapsdPerAcTriggerEnableMask |= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4715 | (1 << ac); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4716 | pe_session->gUapsdPerAcDeliveryEnableMask |= |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4717 | (1 << ac); |
| 4718 | } |
| 4719 | } |
| 4720 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4721 | pe_debug("New pe_session->gUapsdPerAcTriggerEnableMask 0x%x pe_session->gUapsdPerAcDeliveryEnableMask 0x%x", |
| 4722 | pe_session->gUapsdPerAcTriggerEnableMask, |
| 4723 | pe_session->gUapsdPerAcDeliveryEnableMask); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4724 | |
| 4725 | return; |
| 4726 | } |
| 4727 | |
| 4728 | /** |
| 4729 | * lim_handle_heart_beat_timeout_for_session() - Handle heart beat time out |
| 4730 | * @mac_ctx: pointer to Global Mac Structure |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 4731 | * @psession_entry: pointer to struct pe_session * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4732 | * |
| 4733 | * Function handles heart beat time out for session |
| 4734 | * |
| 4735 | * Return: none |
| 4736 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4737 | void lim_handle_heart_beat_timeout_for_session(struct mac_context *mac_ctx, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 4738 | struct pe_session *psession_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4739 | { |
| 4740 | if (psession_entry->valid == true) { |
| 4741 | if (psession_entry->bssType == eSIR_IBSS_MODE) |
| 4742 | lim_ibss_heart_beat_handle(mac_ctx, psession_entry); |
| 4743 | |
| 4744 | if ((psession_entry->bssType == eSIR_INFRASTRUCTURE_MODE) && |
| 4745 | (LIM_IS_STA_ROLE(psession_entry))) |
| 4746 | lim_handle_heart_beat_failure(mac_ctx, psession_entry); |
| 4747 | } |
| 4748 | /* |
| 4749 | * In the function lim_handle_heart_beat_failure things can change |
| 4750 | * so check for the session entry valid and the other things |
| 4751 | * again |
| 4752 | */ |
| 4753 | if ((psession_entry->valid == true) && |
| 4754 | (psession_entry->bssType == eSIR_INFRASTRUCTURE_MODE) && |
| 4755 | (LIM_IS_STA_ROLE(psession_entry)) && |
| 4756 | (psession_entry->LimHBFailureStatus == true)) { |
| 4757 | tLimTimers *lim_timer = &mac_ctx->lim.limTimers; |
| 4758 | /* |
| 4759 | * Activate Probe After HeartBeat Timer incase HB |
| 4760 | * Failure detected |
| 4761 | */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4762 | pe_debug("Sending Probe for Session: %d", |
| 4763 | psession_entry->bssIdx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4764 | lim_deactivate_and_change_timer(mac_ctx, |
| 4765 | eLIM_PROBE_AFTER_HB_TIMER); |
| 4766 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE, 0, |
| 4767 | eLIM_PROBE_AFTER_HB_TIMER)); |
| 4768 | if (tx_timer_activate(&lim_timer->gLimProbeAfterHBTimer) |
| 4769 | != TX_SUCCESS) |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4770 | pe_err("Fail to re-activate Probe-after-hb timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4771 | } |
| 4772 | } |
| 4773 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4774 | uint8_t lim_get_current_operating_channel(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4775 | { |
| 4776 | uint8_t i; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 4777 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4778 | for (i = 0; i < mac->lim.maxBssId; i++) { |
| 4779 | if (mac->lim.gpSession[i].valid == true) { |
| 4780 | if ((mac->lim.gpSession[i].bssType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4781 | eSIR_INFRASTRUCTURE_MODE) |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4782 | && (mac->lim.gpSession[i].limSystemRole == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4783 | eLIM_STA_ROLE)) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4784 | return mac->lim.gpSession[i]. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4785 | currentOperChannel; |
| 4786 | } |
| 4787 | } |
| 4788 | } |
| 4789 | return 0; |
| 4790 | } |
| 4791 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 4792 | /** |
| 4793 | * lim_process_add_sta_rsp() - process WDA_ADD_STA_RSP from WMA |
| 4794 | * @mac_ctx: Pointer to Global MAC structure |
| 4795 | * @msg: msg from WMA |
| 4796 | * |
| 4797 | * @Return: void |
| 4798 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4799 | void lim_process_add_sta_rsp(struct mac_context *mac_ctx, struct scheduler_msg *msg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4800 | { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 4801 | struct pe_session *session; |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 4802 | tpAddStaParams add_sta_params; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4803 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 4804 | add_sta_params = (tpAddStaParams) msg->bodyptr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4805 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 4806 | session = pe_find_session_by_session_id(mac_ctx, |
| 4807 | add_sta_params->sessionId); |
| 4808 | if (session == NULL) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4809 | pe_err("Session Does not exist for given sessionID"); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 4810 | qdf_mem_free(add_sta_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4811 | return; |
| 4812 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 4813 | session->csaOffloadEnable = add_sta_params->csaOffloadEnable; |
| 4814 | if (LIM_IS_IBSS_ROLE(session)) |
| 4815 | (void)lim_ibss_add_sta_rsp(mac_ctx, msg->bodyptr, session); |
| 4816 | else if (LIM_IS_NDI_ROLE(session)) |
| 4817 | lim_ndp_add_sta_rsp(mac_ctx, session, msg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4818 | #ifdef FEATURE_WLAN_TDLS |
Bala Venkatesh | 6e3925b | 2018-07-19 12:31:21 +0530 | [diff] [blame] | 4819 | else if (add_sta_params->staType == STA_ENTRY_TDLS_PEER) |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 4820 | lim_process_tdls_add_sta_rsp(mac_ctx, msg->bodyptr, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4821 | #endif |
| 4822 | else |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 4823 | lim_process_mlm_add_sta_rsp(mac_ctx, msg, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4824 | |
| 4825 | } |
| 4826 | |
| 4827 | /** |
| 4828 | * lim_update_beacon() - This function updates beacon |
| 4829 | * @mac_ctx: pointer to Global Mac Structure |
| 4830 | * |
| 4831 | * This Function is invoked to update the beacon |
| 4832 | * |
| 4833 | * Return: none |
| 4834 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4835 | void lim_update_beacon(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4836 | { |
| 4837 | uint8_t i; |
| 4838 | |
| 4839 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 4840 | if (mac_ctx->lim.gpSession[i].valid != true) |
| 4841 | continue; |
| 4842 | if (((mac_ctx->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) |
| 4843 | || (mac_ctx->lim.gpSession[i].limSystemRole == |
| 4844 | eLIM_STA_IN_IBSS_ROLE)) |
| 4845 | && (eLIM_SME_NORMAL_STATE == |
| 4846 | mac_ctx->lim.gpSession[i].limSmeState)) { |
| 4847 | |
| 4848 | sch_set_fixed_beacon_fields(mac_ctx, |
| 4849 | &mac_ctx->lim.gpSession[i]); |
| 4850 | |
| 4851 | if (false == mac_ctx->sap.SapDfsInfo. |
| 4852 | is_dfs_cac_timer_running) |
| 4853 | lim_send_beacon_ind(mac_ctx, |
Abhishek Singh | fc740be | 2018-10-12 11:34:26 +0530 | [diff] [blame] | 4854 | &mac_ctx->lim.gpSession[i], |
| 4855 | REASON_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4856 | } |
| 4857 | } |
| 4858 | } |
| 4859 | |
| 4860 | /** |
| 4861 | * lim_handle_heart_beat_failure_timeout - handle heart beat failure |
| 4862 | * @mac_ctx: pointer to Global Mac Structure |
| 4863 | * |
| 4864 | * Function handle heart beat failure timeout |
| 4865 | * |
| 4866 | * Return: none |
| 4867 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4868 | void lim_handle_heart_beat_failure_timeout(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4869 | { |
| 4870 | uint8_t i; |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 4871 | struct pe_session *psession_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4872 | /* |
| 4873 | * Probe response is not received after HB failure. |
| 4874 | * This is handled by LMM sub module. |
| 4875 | */ |
| 4876 | for (i = 0; i < mac_ctx->lim.maxBssId; i++) { |
| 4877 | if (mac_ctx->lim.gpSession[i].valid != true) |
| 4878 | continue; |
| 4879 | psession_entry = &mac_ctx->lim.gpSession[i]; |
| 4880 | if (psession_entry->LimHBFailureStatus != true) |
| 4881 | continue; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4882 | pe_debug("SME: %d MLME: %d HB-Count: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4883 | psession_entry->limSmeState, |
| 4884 | psession_entry->limMlmState, |
| 4885 | psession_entry->LimRxedBeaconCntDuringHB); |
| 4886 | |
| 4887 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4888 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, |
| 4889 | psession_entry, 0, 0); |
| 4890 | #endif |
| 4891 | if ((psession_entry->limMlmState == |
| 4892 | eLIM_MLM_LINK_ESTABLISHED_STATE) && |
| 4893 | (psession_entry->limSmeState != |
| 4894 | eLIM_SME_WT_DISASSOC_STATE) && |
| 4895 | (psession_entry->limSmeState != |
| 4896 | eLIM_SME_WT_DEAUTH_STATE) && |
| 4897 | ((!LIM_IS_CONNECTION_ACTIVE(psession_entry)) || |
| 4898 | /* |
| 4899 | * Disconnect even if we have not received a single |
| 4900 | * beacon after connection. |
| 4901 | */ |
| 4902 | (psession_entry->currentBssBeaconCnt == 0))) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4903 | pe_debug("for session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4904 | psession_entry->peSessionId); |
Paul Zhang | e73d1a3 | 2017-05-09 23:08:17 +0800 | [diff] [blame] | 4905 | |
| 4906 | lim_send_deauth_mgmt_frame(mac_ctx, |
| 4907 | eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON, |
| 4908 | psession_entry->bssId, psession_entry, false); |
| 4909 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4910 | /* |
| 4911 | * AP did not respond to Probe Request. |
| 4912 | * Tear down link with it. |
| 4913 | */ |
| 4914 | lim_tear_down_link_with_ap(mac_ctx, |
| 4915 | psession_entry->peSessionId, |
| 4916 | eSIR_BEACON_MISSED); |
| 4917 | mac_ctx->lim.gLimProbeFailureAfterHBfailedCnt++; |
| 4918 | } else { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 4919 | pe_err("Unexpected wt-probe-timeout in state"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4920 | lim_print_mlm_state(mac_ctx, LOGE, |
| 4921 | psession_entry->limMlmState); |
Varun Reddy Yeturu | 076eaa8 | 2018-01-16 12:16:14 -0800 | [diff] [blame] | 4922 | if (mac_ctx->sme.tx_queue_cb) |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 4923 | mac_ctx->sme.tx_queue_cb(mac_ctx->hdd_handle, |
Varun Reddy Yeturu | 076eaa8 | 2018-01-16 12:16:14 -0800 | [diff] [blame] | 4924 | psession_entry->smeSessionId, |
| 4925 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 4926 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4927 | } |
| 4928 | } |
| 4929 | /* |
| 4930 | * Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, |
| 4931 | * need not deactivate the timer |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4932 | * tx_timer_deactivate(&mac->lim.limTimers.gLimProbeAfterHBTimer); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4933 | */ |
| 4934 | } |
| 4935 | |
| 4936 | /* |
| 4937 | * This function assumes there will not be more than one IBSS session active at any time. |
| 4938 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4939 | struct pe_session *lim_is_ibss_session_active(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4940 | { |
| 4941 | uint8_t i; |
| 4942 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4943 | for (i = 0; i < mac->lim.maxBssId; i++) { |
| 4944 | if ((mac->lim.gpSession[i].valid) && |
| 4945 | (mac->lim.gpSession[i].limSystemRole == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4946 | eLIM_STA_IN_IBSS_ROLE)) |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4947 | return &mac->lim.gpSession[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4948 | } |
| 4949 | |
| 4950 | return NULL; |
| 4951 | } |
| 4952 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4953 | struct pe_session *lim_is_ap_session_active(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4954 | { |
| 4955 | uint8_t i; |
| 4956 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4957 | for (i = 0; i < mac->lim.maxBssId; i++) { |
| 4958 | if (mac->lim.gpSession[i].valid && |
| 4959 | (mac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE)) |
| 4960 | return &mac->lim.gpSession[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4961 | } |
| 4962 | |
| 4963 | return NULL; |
| 4964 | } |
| 4965 | |
| 4966 | /**--------------------------------------------------------- |
| 4967 | \fn lim_handle_defer_msg_error |
| 4968 | \brief handles error scenario, when the msg can not be deferred. |
Jeff Johnson | 982fe96 | 2018-11-28 17:07:01 -0800 | [diff] [blame] | 4969 | \param mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4970 | \param pLimMsg LIM msg, which could not be deferred. |
| 4971 | \return void |
| 4972 | -----------------------------------------------------------*/ |
| 4973 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4974 | void lim_handle_defer_msg_error(struct mac_context *mac, |
Rajeev Kumar | feb9638 | 2017-01-22 19:42:09 -0800 | [diff] [blame] | 4975 | struct scheduler_msg *pLimMsg) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4976 | { |
| 4977 | if (SIR_BB_XPORT_MGMT_MSG == pLimMsg->type) { |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 4978 | lim_decrement_pending_mgmt_count(mac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4979 | cds_pkt_return_packet((cds_pkt_t *) pLimMsg->bodyptr); |
| 4980 | pLimMsg->bodyptr = NULL; |
| 4981 | } else if (pLimMsg->bodyptr != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4982 | qdf_mem_free(pLimMsg->bodyptr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4983 | pLimMsg->bodyptr = NULL; |
| 4984 | } |
| 4985 | |
| 4986 | } |
| 4987 | |
| 4988 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 4989 | /**--------------------------------------------------------- |
| 4990 | \fn lim_diag_event_report |
| 4991 | \brief This function reports Diag event |
Jeff Johnson | 982fe96 | 2018-11-28 17:07:01 -0800 | [diff] [blame] | 4992 | \param mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4993 | \param eventType |
| 4994 | \param bssid |
| 4995 | \param status |
| 4996 | \param reasonCode |
| 4997 | \return void |
| 4998 | -----------------------------------------------------------*/ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 4999 | void lim_diag_event_report(struct mac_context *mac, uint16_t eventType, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5000 | struct pe_session *pe_session, uint16_t status, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5001 | uint16_t reasonCode) |
| 5002 | { |
| 5003 | tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 }; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 5004 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5005 | WLAN_HOST_DIAG_EVENT_DEF(peEvent, host_event_wlan_pe_payload_type); |
| 5006 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5007 | qdf_mem_set(&peEvent, sizeof(host_event_wlan_pe_payload_type), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5008 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5009 | if (NULL == pe_session) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5010 | qdf_mem_copy(peEvent.bssid, nullBssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5011 | peEvent.sme_state = (uint16_t) mac->lim.gLimSmeState; |
| 5012 | peEvent.mlm_state = (uint16_t) mac->lim.gLimMlmState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5013 | |
| 5014 | } else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5015 | qdf_mem_copy(peEvent.bssid, pe_session->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5016 | sizeof(tSirMacAddr)); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5017 | peEvent.sme_state = (uint16_t) pe_session->limSmeState; |
| 5018 | peEvent.mlm_state = (uint16_t) pe_session->limMlmState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5019 | } |
| 5020 | peEvent.event_type = eventType; |
| 5021 | peEvent.status = status; |
| 5022 | peEvent.reason_code = reasonCode; |
| 5023 | |
| 5024 | WLAN_HOST_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE); |
| 5025 | return; |
| 5026 | } |
| 5027 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5028 | static void lim_diag_fill_mgmt_event_report(struct mac_context *mac_ctx, |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 5029 | tpSirMacMgmtHdr mac_hdr, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 5030 | struct pe_session *session, uint16_t result_code, |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 5031 | uint16_t reason_code, |
| 5032 | struct host_event_wlan_mgmt_payload_type *mgmt_event) |
| 5033 | { |
| 5034 | uint8_t length; |
| 5035 | |
| 5036 | qdf_mem_set(mgmt_event, sizeof(*mgmt_event), 0); |
| 5037 | mgmt_event->mgmt_type = mac_hdr->fc.type; |
| 5038 | mgmt_event->mgmt_subtype = mac_hdr->fc.subType; |
| 5039 | qdf_mem_copy(mgmt_event->self_mac_addr, session->selfMacAddr, |
| 5040 | QDF_MAC_ADDR_SIZE); |
| 5041 | qdf_mem_copy(mgmt_event->bssid, session->bssId, |
| 5042 | QDF_MAC_ADDR_SIZE); |
| 5043 | length = session->ssId.length; |
| 5044 | if (length > SIR_MAC_MAX_SSID_LENGTH) |
| 5045 | length = SIR_MAC_MAX_SSID_LENGTH; |
| 5046 | qdf_mem_copy(mgmt_event->ssid, session->ssId.ssId, length); |
| 5047 | mgmt_event->ssid_len = length; |
| 5048 | mgmt_event->operating_channel = session->currentOperChannel; |
| 5049 | mgmt_event->result_code = result_code; |
| 5050 | mgmt_event->reason_code = reason_code; |
| 5051 | } |
| 5052 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5053 | void lim_diag_mgmt_tx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 5054 | struct pe_session *session, uint16_t result_code, |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 5055 | uint16_t reason_code) |
| 5056 | { |
| 5057 | tpSirMacMgmtHdr mac_hdr = mgmt_hdr; |
| 5058 | |
| 5059 | WLAN_HOST_DIAG_EVENT_DEF(mgmt_event, |
| 5060 | struct host_event_wlan_mgmt_payload_type); |
| 5061 | if (!session || !mac_hdr) { |
| 5062 | pe_err("not valid input"); |
| 5063 | return; |
| 5064 | } |
| 5065 | lim_diag_fill_mgmt_event_report(mac_ctx, mac_hdr, session, |
| 5066 | result_code, reason_code, &mgmt_event); |
| 5067 | |
| 5068 | pe_debug("TX frame: type:%d sub_type:%d seq_num:%d ssid:%.*s selfmacaddr:%pM bssid:%pM channel:%d", |
| 5069 | mgmt_event.mgmt_type, mgmt_event.mgmt_subtype, |
| 5070 | ((mac_hdr->seqControl.seqNumHi << 4) | |
| 5071 | mac_hdr->seqControl.seqNumLo), |
| 5072 | mgmt_event.ssid_len, mgmt_event.ssid, |
| 5073 | mgmt_event.self_mac_addr, mgmt_event.bssid, |
| 5074 | mgmt_event.operating_channel); |
| 5075 | WLAN_HOST_DIAG_EVENT_REPORT(&mgmt_event, EVENT_WLAN_HOST_MGMT_TX_V2); |
| 5076 | } |
| 5077 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5078 | void lim_diag_mgmt_rx_event_report(struct mac_context *mac_ctx, void *mgmt_hdr, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 5079 | struct pe_session *session, uint16_t result_code, |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 5080 | uint16_t reason_code) |
| 5081 | { |
| 5082 | tpSirMacMgmtHdr mac_hdr = mgmt_hdr; |
| 5083 | |
| 5084 | WLAN_HOST_DIAG_EVENT_DEF(mgmt_event, |
| 5085 | struct host_event_wlan_mgmt_payload_type); |
| 5086 | if (!session || !mac_hdr) { |
Yeshwanth Sriram Guntuka | cbe6144 | 2018-08-23 18:08:44 +0530 | [diff] [blame] | 5087 | pe_debug("not valid input"); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 5088 | return; |
| 5089 | } |
| 5090 | lim_diag_fill_mgmt_event_report(mac_ctx, mac_hdr, session, |
| 5091 | result_code, reason_code, &mgmt_event); |
| 5092 | pe_debug("RX frame: type:%d sub_type:%d seq_num:%d ssid:%.*s selfmacaddr:%pM bssid:%pM channel:%d", |
| 5093 | mgmt_event.mgmt_type, mgmt_event.mgmt_subtype, |
| 5094 | ((mac_hdr->seqControl.seqNumHi << 4) | |
| 5095 | mac_hdr->seqControl.seqNumLo), |
| 5096 | mgmt_event.ssid_len, mgmt_event.ssid, |
| 5097 | mgmt_event.self_mac_addr, mgmt_event.bssid, |
| 5098 | mgmt_event.operating_channel); |
| 5099 | WLAN_HOST_DIAG_EVENT_REPORT(&mgmt_event, EVENT_WLAN_HOST_MGMT_RX_V2); |
| 5100 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5101 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 5102 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5103 | /* Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream */ |
| 5104 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5105 | uint8_t lim_build_p2p_ie(struct mac_context *mac, uint8_t *ie, uint8_t *data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5106 | uint8_t ie_len) |
| 5107 | { |
| 5108 | int length = 0; |
| 5109 | uint8_t *ptr = ie; |
| 5110 | |
| 5111 | ptr[length++] = SIR_MAC_EID_VENDOR; |
| 5112 | ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5113 | qdf_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE); |
| 5114 | qdf_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5115 | return ie_len + SIR_P2P_IE_HEADER_LEN; |
| 5116 | } |
| 5117 | |
| 5118 | /* Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream */ |
| 5119 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5120 | uint8_t lim_get_noa_attr_stream_in_mult_p2p_ies(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5121 | uint8_t *noaStream, uint8_t noaLen, |
| 5122 | uint8_t overFlowLen) |
| 5123 | { |
| 5124 | uint8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN]; |
| 5125 | |
| 5126 | if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN)) && |
| 5127 | (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5128 | qdf_mem_copy(overFlowP2pStream, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5129 | noaStream + noaLen - overFlowLen, overFlowLen); |
| 5130 | noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR; |
| 5131 | noaStream[noaLen - overFlowLen + 1] = |
| 5132 | overFlowLen + SIR_MAC_P2P_OUI_SIZE; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5133 | qdf_mem_copy(noaStream + noaLen - overFlowLen + 2, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5134 | SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5135 | qdf_mem_copy(noaStream + noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5136 | overFlowLen, overFlowP2pStream, overFlowLen); |
| 5137 | } |
| 5138 | |
| 5139 | return noaLen + SIR_P2P_IE_HEADER_LEN; |
| 5140 | |
| 5141 | } |
| 5142 | |
| 5143 | /* Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5144 | uint8_t lim_get_noa_attr_stream(struct mac_context *mac, uint8_t *pNoaStream, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5145 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5146 | { |
| 5147 | uint8_t len = 0; |
| 5148 | |
| 5149 | uint8_t *pBody = pNoaStream; |
| 5150 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5151 | if ((pe_session != NULL) && (pe_session->valid) && |
| 5152 | (pe_session->pePersona == QDF_P2P_GO_MODE)) { |
| 5153 | if ((!(pe_session->p2pGoPsUpdate.uNoa1Duration)) |
| 5154 | && (!(pe_session->p2pGoPsUpdate.uNoa2Duration)) |
| 5155 | && (!pe_session->p2pGoPsUpdate.oppPsFlag) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5156 | ) |
| 5157 | return 0; /* No NoA Descriptor then return 0 */ |
| 5158 | |
| 5159 | pBody[0] = SIR_P2P_NOA_ATTR; |
| 5160 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5161 | pBody[3] = pe_session->p2pGoPsUpdate.index; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5162 | pBody[4] = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5163 | pe_session->p2pGoPsUpdate.ctWin | (pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5164 | p2pGoPsUpdate. |
| 5165 | oppPsFlag << 7); |
| 5166 | len = 5; |
| 5167 | pBody += len; |
| 5168 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5169 | if (pe_session->p2pGoPsUpdate.uNoa1Duration) { |
| 5170 | *pBody = pe_session->p2pGoPsUpdate.uNoa1IntervalCnt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5171 | pBody += 1; |
| 5172 | len += 1; |
| 5173 | |
| 5174 | *((uint32_t *) (pBody)) = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5175 | sir_swap_u32if_needed(pe_session->p2pGoPsUpdate. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5176 | uNoa1Duration); |
| 5177 | pBody += sizeof(uint32_t); |
| 5178 | len += 4; |
| 5179 | |
| 5180 | *((uint32_t *) (pBody)) = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5181 | sir_swap_u32if_needed(pe_session->p2pGoPsUpdate. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5182 | uNoa1Interval); |
| 5183 | pBody += sizeof(uint32_t); |
| 5184 | len += 4; |
| 5185 | |
| 5186 | *((uint32_t *) (pBody)) = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5187 | sir_swap_u32if_needed(pe_session->p2pGoPsUpdate. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5188 | uNoa1StartTime); |
| 5189 | pBody += sizeof(uint32_t); |
| 5190 | len += 4; |
| 5191 | |
| 5192 | } |
| 5193 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5194 | if (pe_session->p2pGoPsUpdate.uNoa2Duration) { |
| 5195 | *pBody = pe_session->p2pGoPsUpdate.uNoa2IntervalCnt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5196 | pBody += 1; |
| 5197 | len += 1; |
| 5198 | |
| 5199 | *((uint32_t *) (pBody)) = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5200 | sir_swap_u32if_needed(pe_session->p2pGoPsUpdate. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5201 | uNoa2Duration); |
| 5202 | pBody += sizeof(uint32_t); |
| 5203 | len += 4; |
| 5204 | |
| 5205 | *((uint32_t *) (pBody)) = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5206 | sir_swap_u32if_needed(pe_session->p2pGoPsUpdate. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5207 | uNoa2Interval); |
| 5208 | pBody += sizeof(uint32_t); |
| 5209 | len += 4; |
| 5210 | |
| 5211 | *((uint32_t *) (pBody)) = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5212 | sir_swap_u32if_needed(pe_session->p2pGoPsUpdate. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5213 | uNoa2StartTime); |
| 5214 | pBody += sizeof(uint32_t); |
| 5215 | len += 4; |
| 5216 | |
| 5217 | } |
| 5218 | |
| 5219 | pBody = pNoaStream + 1; |
| 5220 | *((uint16_t *) (pBody)) = sir_swap_u16if_needed(len - 3); /*one byte for Attr and 2 bytes for length */ |
| 5221 | |
| 5222 | return len; |
| 5223 | |
| 5224 | } |
| 5225 | return 0; |
| 5226 | |
| 5227 | } |
| 5228 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5229 | void pe_set_resume_channel(struct mac_context *mac, uint16_t channel, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5230 | ePhyChanBondState phyCbState) |
| 5231 | { |
| 5232 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5233 | mac->lim.gResumeChannel = channel; |
| 5234 | mac->lim.gResumePhyCbState = phyCbState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5235 | } |
| 5236 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5237 | bool lim_is_noa_insert_reqd(struct mac_context *mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5238 | { |
| 5239 | uint8_t i; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 5240 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5241 | for (i = 0; i < mac->lim.maxBssId; i++) { |
| 5242 | if (mac->lim.gpSession[i].valid == true) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5243 | if ((eLIM_AP_ROLE == |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5244 | mac->lim.gpSession[i].limSystemRole) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5245 | && (QDF_P2P_GO_MODE == |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5246 | mac->lim.gpSession[i].pePersona) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5247 | ) { |
| 5248 | return true; |
| 5249 | } |
| 5250 | } |
| 5251 | } |
| 5252 | return false; |
| 5253 | } |
| 5254 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5255 | bool lim_isconnected_on_dfs_channel(struct mac_context *mac_ctx, |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 5256 | uint8_t currentChannel) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5257 | { |
| 5258 | if (CHANNEL_STATE_DFS == |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 5259 | wlan_reg_get_channel_state(mac_ctx->pdev, currentChannel)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5260 | return true; |
| 5261 | } else { |
| 5262 | return false; |
| 5263 | } |
| 5264 | } |
| 5265 | |
| 5266 | #ifdef WLAN_FEATURE_11W |
| 5267 | void lim_pmf_sa_query_timer_handler(void *pMacGlobal, uint32_t param) |
| 5268 | { |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5269 | struct mac_context *mac = (struct mac_context *) pMacGlobal; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5270 | tPmfSaQueryTimerId timerId; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5271 | struct pe_session *pe_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5272 | tpDphHashNode pSta; |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 5273 | uint8_t maxretries; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5274 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5275 | pe_debug("SA Query timer fires"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5276 | timerId.value = param; |
| 5277 | |
| 5278 | /* Check that SA Query is in progress */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5279 | pe_session = pe_find_session_by_session_id(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5280 | timerId.fields.sessionId); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5281 | if (pe_session == NULL) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5282 | pe_err("Session does not exist for given session ID: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5283 | timerId.fields.sessionId); |
| 5284 | return; |
| 5285 | } |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5286 | pSta = dph_get_hash_entry(mac, timerId.fields.peerIdx, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5287 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5288 | if (pSta == NULL) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5289 | pe_err("Entry does not exist for given peer index: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5290 | timerId.fields.peerIdx); |
| 5291 | return; |
| 5292 | } |
| 5293 | if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState) |
| 5294 | return; |
| 5295 | |
| 5296 | /* Increment the retry count, check if reached maximum */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5297 | maxretries = mac->mlme_cfg->gen.pmf_sa_query_max_retries; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5298 | pSta->pmfSaQueryRetryCount++; |
Karthik Kantamneni | 24f71bc | 2018-09-11 19:08:38 +0530 | [diff] [blame] | 5299 | if (pSta->pmfSaQueryRetryCount >= maxretries) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5300 | pe_err("SA Query timed out,Deleting STA"); |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5301 | lim_print_mac_addr(mac, pSta->staAddr, LOGE); |
| 5302 | lim_send_disassoc_mgmt_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5303 | eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5304 | pSta->staAddr, pe_session, false); |
| 5305 | lim_trigger_sta_deletion(mac, pSta, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5306 | pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT; |
| 5307 | return; |
| 5308 | } |
| 5309 | /* Retry SA Query */ |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5310 | lim_send_sa_query_request_frame(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5311 | (uint8_t *) &(pSta-> |
| 5312 | pmfSaQueryCurrentTransId), |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5313 | pSta->staAddr, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5314 | pSta->pmfSaQueryCurrentTransId++; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5315 | pe_debug("Starting SA Query retry: %d", pSta->pmfSaQueryRetryCount); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5316 | if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5317 | pe_err("PMF SA Query timer activation failed!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5318 | pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; |
| 5319 | } |
| 5320 | } |
| 5321 | #endif |
| 5322 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5323 | bool lim_check_vht_op_mode_change(struct mac_context *mac, struct pe_session *pe_session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5324 | uint8_t chanWidth, uint8_t staId, |
| 5325 | uint8_t *peerMac) |
| 5326 | { |
| 5327 | tUpdateVHTOpMode tempParam; |
| 5328 | |
| 5329 | tempParam.opMode = chanWidth; |
| 5330 | tempParam.staId = staId; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5331 | tempParam.smesessionId = pe_session->smeSessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5332 | qdf_mem_copy(tempParam.peer_mac, peerMac, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5333 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5334 | lim_send_mode_update(mac, &tempParam, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5335 | |
| 5336 | return true; |
| 5337 | } |
| 5338 | |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 5339 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5340 | bool lim_send_he_ie_update(struct mac_context *mac_ctx, struct pe_session *pe_session) |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 5341 | { |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 5342 | QDF_STATUS status; |
| 5343 | |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 5344 | status = wma_update_he_ops_ie(cds_get_context(QDF_MODULE_ID_WMA), |
Naveen Rawat | df221b7 | 2017-11-15 11:32:31 -0800 | [diff] [blame] | 5345 | pe_session->smeSessionId, |
| 5346 | &pe_session->he_op); |
| 5347 | if (QDF_IS_STATUS_ERROR(status)) |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 5348 | return false; |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 5349 | |
| 5350 | return true; |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 5351 | } |
| 5352 | #endif |
| 5353 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5354 | bool lim_set_nss_change(struct mac_context *mac, struct pe_session *pe_session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5355 | uint8_t rxNss, uint8_t staId, uint8_t *peerMac) |
| 5356 | { |
| 5357 | tUpdateRxNss tempParam; |
| 5358 | |
Himanshu Agarwal | a79c676 | 2017-12-28 21:25:00 +0530 | [diff] [blame] | 5359 | if (!rxNss) { |
| 5360 | pe_err("Invalid rxNss value: %u", rxNss); |
Dustin Brown | 83044c2 | 2018-08-13 15:00:44 -0700 | [diff] [blame] | 5361 | cds_trigger_recovery(QDF_REASON_UNSPECIFIED); |
Himanshu Agarwal | a79c676 | 2017-12-28 21:25:00 +0530 | [diff] [blame] | 5362 | } |
| 5363 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5364 | tempParam.rxNss = rxNss; |
| 5365 | tempParam.staId = staId; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5366 | tempParam.smesessionId = pe_session->smeSessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5367 | qdf_mem_copy(tempParam.peer_mac, peerMac, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5368 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5369 | lim_send_rx_nss_update(mac, &tempParam, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5370 | |
| 5371 | return true; |
| 5372 | } |
| 5373 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5374 | bool lim_check_membership_user_position(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5375 | struct pe_session *pe_session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5376 | uint32_t membership, uint32_t userPosition, |
| 5377 | uint8_t staId) |
| 5378 | { |
| 5379 | tUpdateMembership tempParamMembership; |
| 5380 | tUpdateUserPos tempParamUserPosition; |
| 5381 | |
| 5382 | tempParamMembership.membership = membership; |
| 5383 | tempParamMembership.staId = staId; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5384 | tempParamMembership.smesessionId = pe_session->smeSessionId; |
| 5385 | qdf_mem_copy(tempParamMembership.peer_mac, pe_session->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5386 | sizeof(tSirMacAddr)); |
| 5387 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5388 | lim_set_membership(mac, &tempParamMembership, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5389 | |
| 5390 | tempParamUserPosition.userPos = userPosition; |
| 5391 | tempParamUserPosition.staId = staId; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5392 | tempParamUserPosition.smesessionId = pe_session->smeSessionId; |
| 5393 | qdf_mem_copy(tempParamUserPosition.peer_mac, pe_session->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5394 | sizeof(tSirMacAddr)); |
| 5395 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5396 | lim_set_user_pos(mac, &tempParamUserPosition, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5397 | |
| 5398 | return true; |
| 5399 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5400 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5401 | void lim_get_short_slot_from_phy_mode(struct mac_context *mac, struct pe_session *pe_session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5402 | uint32_t phyMode, uint8_t *pShortSlotEnabled) |
| 5403 | { |
| 5404 | uint8_t val = 0; |
| 5405 | |
| 5406 | /* only 2.4G band should have short slot enable, rest it should be default */ |
| 5407 | if (phyMode == WNI_CFG_PHY_MODE_11G) { |
| 5408 | /* short slot is default in all other modes */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5409 | if ((pe_session->pePersona == QDF_SAP_MODE) || |
| 5410 | (pe_session->pePersona == QDF_IBSS_MODE) || |
| 5411 | (pe_session->pePersona == QDF_P2P_GO_MODE)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5412 | val = true; |
| 5413 | } |
| 5414 | /* Program Polaris based on AP capability */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5415 | if (pe_session->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5416 | /* Joining BSS. */ |
| 5417 | val = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5418 | SIR_MAC_GET_SHORT_SLOT_TIME(pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5419 | limCurrentBssCaps); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5420 | } else if (pe_session->limMlmState == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5421 | eLIM_MLM_WT_REASSOC_RSP_STATE) { |
| 5422 | /* Reassociating with AP. */ |
| 5423 | val = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5424 | SIR_MAC_GET_SHORT_SLOT_TIME(pe_session-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5425 | limReassocBssCaps); |
| 5426 | } |
| 5427 | } else { |
| 5428 | /* |
| 5429 | * 11B does not short slot and short slot is default |
| 5430 | * for 11A mode. Hence, not need to set this bit |
| 5431 | */ |
| 5432 | val = false; |
| 5433 | } |
| 5434 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5435 | pe_debug("phyMode: %u shortslotsupported: %u", phyMode, val); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5436 | *pShortSlotEnabled = val; |
| 5437 | } |
| 5438 | |
| 5439 | #ifdef WLAN_FEATURE_11W |
| 5440 | /** |
| 5441 | * |
| 5442 | * \brief This function is called by various LIM modules to correctly set |
| 5443 | * the Protected bit in the Frame Control Field of the 802.11 frame MAC header |
| 5444 | * |
| 5445 | * |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5446 | * \param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5447 | * |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5448 | * \param pe_session Pointer to session corresponding to the connection |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5449 | * |
| 5450 | * \param peer Peer address of the STA to which the frame is to be sent |
| 5451 | * |
| 5452 | * \param pMacHdr Pointer to the frame MAC header |
| 5453 | * |
| 5454 | * \return nothing |
| 5455 | * |
| 5456 | * |
| 5457 | */ |
| 5458 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5459 | lim_set_protected_bit(struct mac_context *mac, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5460 | struct pe_session *pe_session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5461 | tSirMacAddr peer, tpSirMacMgmtHdr pMacHdr) |
| 5462 | { |
| 5463 | uint16_t aid; |
| 5464 | tpDphHashNode pStaDs; |
| 5465 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5466 | if (LIM_IS_AP_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5467 | |
Jeff Johnson | 0a0f42a | 2018-11-21 20:42:36 -0800 | [diff] [blame] | 5468 | pStaDs = dph_lookup_hash_entry(mac, peer, &aid, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5469 | &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5470 | if (pStaDs != NULL) { |
| 5471 | /* rmfenabled will be set at the time of addbss. |
| 5472 | * but sometimes EAP auth fails and keys are not |
| 5473 | * installed then if we send any management frame |
| 5474 | * like deauth/disassoc with this bit set then |
| 5475 | * firmware crashes. so check for keys are |
| 5476 | * installed or not also before setting the bit |
| 5477 | */ |
| 5478 | if (pStaDs->rmfEnabled && pStaDs->is_key_installed) |
| 5479 | pMacHdr->fc.wep = 1; |
| 5480 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 5481 | } else if (pe_session->limRmfEnabled && |
| 5482 | pe_session->is_key_installed) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5483 | pMacHdr->fc.wep = 1; |
| 5484 | } |
| 5485 | } /*** end lim_set_protected_bit() ***/ |
| 5486 | #endif |
| 5487 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5488 | void lim_set_ht_caps(struct mac_context *p_mac, struct pe_session *p_session_entry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5489 | uint8_t *p_ie_start, uint32_t num_bytes) |
| 5490 | { |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 5491 | const uint8_t *p_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5492 | tDot11fIEHTCaps dot11_ht_cap = {0,}; |
| 5493 | |
| 5494 | populate_dot11f_ht_caps(p_mac, p_session_entry, &dot11_ht_cap); |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 5495 | p_ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_HTCAPS, |
| 5496 | p_ie_start, num_bytes); |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 5497 | pe_debug("p_ie: %pK dot11_ht_cap.supportedMCSSet[0]: 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5498 | p_ie, dot11_ht_cap.supportedMCSSet[0]); |
| 5499 | if (p_ie) { |
| 5500 | /* convert from unpacked to packed structure */ |
| 5501 | tHtCaps *p_ht_cap = (tHtCaps *) &p_ie[2]; |
| 5502 | |
| 5503 | p_ht_cap->advCodingCap = dot11_ht_cap.advCodingCap; |
| 5504 | p_ht_cap->supportedChannelWidthSet = |
| 5505 | dot11_ht_cap.supportedChannelWidthSet; |
| 5506 | p_ht_cap->mimoPowerSave = dot11_ht_cap.mimoPowerSave; |
| 5507 | p_ht_cap->greenField = dot11_ht_cap.greenField; |
| 5508 | p_ht_cap->shortGI20MHz = dot11_ht_cap.shortGI20MHz; |
| 5509 | p_ht_cap->shortGI40MHz = dot11_ht_cap.shortGI40MHz; |
| 5510 | p_ht_cap->txSTBC = dot11_ht_cap.txSTBC; |
| 5511 | p_ht_cap->rxSTBC = dot11_ht_cap.rxSTBC; |
| 5512 | p_ht_cap->delayedBA = dot11_ht_cap.delayedBA; |
| 5513 | p_ht_cap->maximalAMSDUsize = dot11_ht_cap.maximalAMSDUsize; |
| 5514 | p_ht_cap->dsssCckMode40MHz = dot11_ht_cap.dsssCckMode40MHz; |
| 5515 | p_ht_cap->psmp = dot11_ht_cap.psmp; |
| 5516 | p_ht_cap->stbcControlFrame = dot11_ht_cap.stbcControlFrame; |
| 5517 | p_ht_cap->lsigTXOPProtection = dot11_ht_cap.lsigTXOPProtection; |
| 5518 | p_ht_cap->maxRxAMPDUFactor = dot11_ht_cap.maxRxAMPDUFactor; |
| 5519 | p_ht_cap->mpduDensity = dot11_ht_cap.mpduDensity; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5520 | qdf_mem_copy((void *)p_ht_cap->supportedMCSSet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5521 | (void *)(dot11_ht_cap.supportedMCSSet), |
| 5522 | sizeof(p_ht_cap->supportedMCSSet)); |
| 5523 | p_ht_cap->pco = dot11_ht_cap.pco; |
| 5524 | p_ht_cap->transitionTime = dot11_ht_cap.transitionTime; |
| 5525 | p_ht_cap->mcsFeedback = dot11_ht_cap.mcsFeedback; |
| 5526 | p_ht_cap->txBF = dot11_ht_cap.txBF; |
| 5527 | p_ht_cap->rxStaggeredSounding = |
| 5528 | dot11_ht_cap.rxStaggeredSounding; |
| 5529 | p_ht_cap->txStaggeredSounding = |
| 5530 | dot11_ht_cap.txStaggeredSounding; |
| 5531 | p_ht_cap->rxZLF = dot11_ht_cap.rxZLF; |
| 5532 | p_ht_cap->txZLF = dot11_ht_cap.txZLF; |
| 5533 | p_ht_cap->implicitTxBF = dot11_ht_cap.implicitTxBF; |
| 5534 | p_ht_cap->calibration = dot11_ht_cap.calibration; |
| 5535 | p_ht_cap->explicitCSITxBF = dot11_ht_cap.explicitCSITxBF; |
| 5536 | p_ht_cap->explicitUncompressedSteeringMatrix = |
| 5537 | dot11_ht_cap.explicitUncompressedSteeringMatrix; |
| 5538 | p_ht_cap->explicitBFCSIFeedback = |
| 5539 | dot11_ht_cap.explicitBFCSIFeedback; |
| 5540 | p_ht_cap->explicitUncompressedSteeringMatrixFeedback = |
| 5541 | dot11_ht_cap.explicitUncompressedSteeringMatrixFeedback; |
| 5542 | p_ht_cap->explicitCompressedSteeringMatrixFeedback = |
| 5543 | dot11_ht_cap.explicitCompressedSteeringMatrixFeedback; |
| 5544 | p_ht_cap->csiNumBFAntennae = dot11_ht_cap.csiNumBFAntennae; |
| 5545 | p_ht_cap->uncompressedSteeringMatrixBFAntennae = |
| 5546 | dot11_ht_cap.uncompressedSteeringMatrixBFAntennae; |
| 5547 | p_ht_cap->compressedSteeringMatrixBFAntennae = |
| 5548 | dot11_ht_cap.compressedSteeringMatrixBFAntennae; |
| 5549 | p_ht_cap->antennaSelection = dot11_ht_cap.antennaSelection; |
| 5550 | p_ht_cap->explicitCSIFeedbackTx = |
| 5551 | dot11_ht_cap.explicitCSIFeedbackTx; |
| 5552 | p_ht_cap->antennaIndicesFeedbackTx = |
| 5553 | dot11_ht_cap.antennaIndicesFeedbackTx; |
| 5554 | p_ht_cap->explicitCSIFeedback = |
| 5555 | dot11_ht_cap.explicitCSIFeedback; |
| 5556 | p_ht_cap->antennaIndicesFeedback = |
| 5557 | dot11_ht_cap.antennaIndicesFeedback; |
| 5558 | p_ht_cap->rxAS = dot11_ht_cap.rxAS; |
| 5559 | p_ht_cap->txSoundingPPDUs = dot11_ht_cap.txSoundingPPDUs; |
| 5560 | } |
| 5561 | } |
| 5562 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5563 | void lim_set_vht_caps(struct mac_context *p_mac, struct pe_session *p_session_entry, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5564 | uint8_t *p_ie_start, uint32_t num_bytes) |
| 5565 | { |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 5566 | const uint8_t *p_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5567 | tDot11fIEVHTCaps dot11_vht_cap; |
| 5568 | |
| 5569 | populate_dot11f_vht_caps(p_mac, p_session_entry, &dot11_vht_cap); |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 5570 | p_ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_VHTCAPS, p_ie_start, |
| 5571 | num_bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5572 | if (p_ie) { |
| 5573 | tSirMacVHTCapabilityInfo *vht_cap = |
| 5574 | (tSirMacVHTCapabilityInfo *) &p_ie[2]; |
| 5575 | tSirVhtMcsInfo *vht_mcs = (tSirVhtMcsInfo *) &p_ie[2 + |
| 5576 | sizeof(tSirMacVHTCapabilityInfo)]; |
| 5577 | |
| 5578 | union { |
| 5579 | uint16_t u_value; |
| 5580 | tSirMacVHTRxSupDataRateInfo vht_rx_supp_rate; |
| 5581 | tSirMacVHTTxSupDataRateInfo vht_tx_supp_rate; |
| 5582 | } u_vht_data_rate_info; |
| 5583 | |
| 5584 | vht_cap->maxMPDULen = dot11_vht_cap.maxMPDULen; |
| 5585 | vht_cap->supportedChannelWidthSet = |
| 5586 | dot11_vht_cap.supportedChannelWidthSet; |
| 5587 | vht_cap->ldpcCodingCap = dot11_vht_cap.ldpcCodingCap; |
| 5588 | vht_cap->shortGI80MHz = dot11_vht_cap.shortGI80MHz; |
| 5589 | vht_cap->shortGI160and80plus80MHz = |
| 5590 | dot11_vht_cap.shortGI160and80plus80MHz; |
| 5591 | vht_cap->txSTBC = dot11_vht_cap.txSTBC; |
| 5592 | vht_cap->rxSTBC = dot11_vht_cap.rxSTBC; |
| 5593 | vht_cap->suBeamFormerCap = dot11_vht_cap.suBeamFormerCap; |
| 5594 | vht_cap->suBeamformeeCap = dot11_vht_cap.suBeamformeeCap; |
| 5595 | vht_cap->csnofBeamformerAntSup = |
| 5596 | dot11_vht_cap.csnofBeamformerAntSup; |
| 5597 | vht_cap->numSoundingDim = dot11_vht_cap.numSoundingDim; |
| 5598 | vht_cap->muBeamformerCap = dot11_vht_cap.muBeamformerCap; |
| 5599 | vht_cap->muBeamformeeCap = dot11_vht_cap.muBeamformeeCap; |
| 5600 | vht_cap->vhtTXOPPS = dot11_vht_cap.vhtTXOPPS; |
| 5601 | vht_cap->htcVHTCap = dot11_vht_cap.htcVHTCap; |
| 5602 | vht_cap->maxAMPDULenExp = dot11_vht_cap.maxAMPDULenExp; |
| 5603 | vht_cap->vhtLinkAdaptCap = dot11_vht_cap.vhtLinkAdaptCap; |
| 5604 | vht_cap->rxAntPattern = dot11_vht_cap.rxAntPattern; |
| 5605 | vht_cap->txAntPattern = dot11_vht_cap.txAntPattern; |
| 5606 | vht_cap->reserved1 = dot11_vht_cap.reserved1; |
| 5607 | |
| 5608 | /* Populate VHT MCS Information */ |
| 5609 | vht_mcs->rxMcsMap = dot11_vht_cap.rxMCSMap; |
| 5610 | u_vht_data_rate_info.vht_rx_supp_rate.rxSupDataRate = |
| 5611 | dot11_vht_cap.rxHighSupDataRate; |
| 5612 | u_vht_data_rate_info.vht_rx_supp_rate.reserved = |
| 5613 | dot11_vht_cap.reserved2; |
| 5614 | vht_mcs->rxHighest = u_vht_data_rate_info.u_value; |
| 5615 | |
| 5616 | vht_mcs->txMcsMap = dot11_vht_cap.txMCSMap; |
| 5617 | u_vht_data_rate_info.vht_tx_supp_rate.txSupDataRate = |
| 5618 | dot11_vht_cap.txSupDataRate; |
| 5619 | u_vht_data_rate_info.vht_tx_supp_rate.reserved = |
| 5620 | dot11_vht_cap.reserved3; |
| 5621 | vht_mcs->txHighest = u_vht_data_rate_info.u_value; |
| 5622 | } |
| 5623 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5624 | |
| 5625 | /** |
| 5626 | * lim_validate_received_frame_a1_addr() - To validate received frame's A1 addr |
| 5627 | * @mac_ctx: pointer to mac context |
| 5628 | * @a1: received frame's a1 address which is nothing but our self address |
| 5629 | * @session: PE session pointer |
| 5630 | * |
Jeff Johnson | be7f4fd | 2018-05-11 21:05:54 -0700 | [diff] [blame] | 5631 | * This routine will validate, A1 address of the received frame |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5632 | * |
| 5633 | * Return: true or false |
| 5634 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5635 | bool lim_validate_received_frame_a1_addr(struct mac_context *mac_ctx, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 5636 | tSirMacAddr a1, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5637 | { |
| 5638 | if (mac_ctx == NULL || session == NULL) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5639 | pe_err("mac or session context is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5640 | /* let main routine handle it */ |
| 5641 | return true; |
| 5642 | } |
| 5643 | if (lim_is_group_addr(a1) || lim_is_addr_bc(a1)) { |
| 5644 | /* just for fail safe, don't handle MC/BC a1 in this routine */ |
| 5645 | return true; |
| 5646 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5647 | if (qdf_mem_cmp(a1, session->selfMacAddr, 6)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5648 | pe_err("Invalid A1 address in received frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5649 | return false; |
| 5650 | } |
| 5651 | return true; |
| 5652 | } |
| 5653 | |
| 5654 | /** |
| 5655 | * lim_check_and_reset_protection_params() - reset protection related parameters |
| 5656 | * |
| 5657 | * @mac_ctx: pointer to global mac structure |
| 5658 | * |
| 5659 | * resets protection related global parameters if the pe active session count |
| 5660 | * is zero. |
| 5661 | * |
| 5662 | * Return: None |
| 5663 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5664 | void lim_check_and_reset_protection_params(struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5665 | { |
| 5666 | if (!pe_get_active_session_count(mac_ctx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5667 | mac_ctx->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE; |
| 5668 | } |
| 5669 | } |
| 5670 | |
| 5671 | /** |
| 5672 | * lim_set_stads_rtt_cap() - update station node RTT capability |
| 5673 | * @sta_ds: Station hash node |
| 5674 | * @ext_cap: Pointer to extended capability |
| 5675 | * @mac_ctx: global MAC context |
| 5676 | * |
| 5677 | * This funciton update hash node's RTT capability based on received |
| 5678 | * Extended capability IE. |
| 5679 | * |
| 5680 | * Return: None |
| 5681 | */ |
| 5682 | void lim_set_stads_rtt_cap(tpDphHashNode sta_ds, struct s_ext_cap *ext_cap, |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5683 | struct mac_context *mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5684 | { |
| 5685 | sta_ds->timingMeasCap = 0; |
| 5686 | sta_ds->timingMeasCap |= (ext_cap->timing_meas) ? |
| 5687 | RTT_TIMING_MEAS_CAPABILITY : |
| 5688 | RTT_INVALID; |
| 5689 | sta_ds->timingMeasCap |= (ext_cap->fine_time_meas_initiator) ? |
| 5690 | RTT_FINE_TIME_MEAS_INITIATOR_CAPABILITY : |
| 5691 | RTT_INVALID; |
| 5692 | sta_ds->timingMeasCap |= (ext_cap->fine_time_meas_responder) ? |
| 5693 | RTT_FINE_TIME_MEAS_RESPONDER_CAPABILITY : |
| 5694 | RTT_INVALID; |
| 5695 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5696 | pe_debug("ExtCap present, timingMeas: %d Initiator: %d Responder: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5697 | ext_cap->timing_meas, ext_cap->fine_time_meas_initiator, |
| 5698 | ext_cap->fine_time_meas_responder); |
| 5699 | } |
| 5700 | |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 5701 | #ifdef WLAN_SUPPORT_TWT |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 5702 | void lim_set_peer_twt_cap(struct pe_session *session, struct s_ext_cap *ext_cap) |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 5703 | { |
Arif Hussain | 6686c0b | 2018-08-21 18:21:05 -0700 | [diff] [blame] | 5704 | if (session->enable_session_twt_support) { |
| 5705 | session->peer_twt_requestor = ext_cap->twt_requestor_support; |
| 5706 | session->peer_twt_responder = ext_cap->twt_responder_support; |
| 5707 | } |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 5708 | |
Arif Hussain | 6686c0b | 2018-08-21 18:21:05 -0700 | [diff] [blame] | 5709 | pe_debug("Ext Cap peer TWT requestor: %d, responder: %d, enable_twt %d", |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 5710 | ext_cap->twt_requestor_support, |
Arif Hussain | 6686c0b | 2018-08-21 18:21:05 -0700 | [diff] [blame] | 5711 | ext_cap->twt_responder_support, |
| 5712 | session->enable_session_twt_support); |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 5713 | } |
| 5714 | #endif |
| 5715 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5716 | /** |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5717 | * lim_send_ie() - sends IE to wma |
| 5718 | * @mac_ctx: global MAC context |
| 5719 | * @sme_session_id: sme session id |
| 5720 | * @eid: IE id |
| 5721 | * @band: band for which IE is intended |
| 5722 | * @buf: buffer containing IE |
| 5723 | * @len: length of buffer |
| 5724 | * |
| 5725 | * This funciton sends the IE data to WMA. |
| 5726 | * |
| 5727 | * Return: status of operation |
| 5728 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5729 | static QDF_STATUS lim_send_ie(struct mac_context *mac_ctx, uint32_t sme_session_id, |
Jeff Johnson | 2249644 | 2016-10-07 07:34:46 -0700 | [diff] [blame] | 5730 | uint8_t eid, enum cds_band_type band, |
| 5731 | uint8_t *buf, uint32_t len) |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5732 | { |
| 5733 | struct vdev_ie_info *ie_msg; |
Rajeev Kumar | f7d8442 | 2017-01-21 15:45:44 -0800 | [diff] [blame] | 5734 | struct scheduler_msg msg = {0}; |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5735 | QDF_STATUS status; |
| 5736 | |
| 5737 | /* Allocate memory for the WMI request */ |
| 5738 | ie_msg = qdf_mem_malloc(sizeof(*ie_msg) + len); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 5739 | if (!ie_msg) |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5740 | return QDF_STATUS_E_NOMEM; |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5741 | |
| 5742 | ie_msg->vdev_id = sme_session_id; |
| 5743 | ie_msg->ie_id = eid; |
| 5744 | ie_msg->length = len; |
| 5745 | ie_msg->band = band; |
| 5746 | /* IE data buffer starts at end of the struct */ |
| 5747 | ie_msg->data = (uint8_t *)&ie_msg[1]; |
| 5748 | |
| 5749 | qdf_mem_copy(ie_msg->data, buf, len); |
| 5750 | msg.type = WMA_SET_IE_INFO; |
| 5751 | msg.bodyptr = ie_msg; |
| 5752 | msg.reserved = 0; |
| 5753 | |
gaurank kathpalia | 3a7f25b | 2018-08-28 16:26:39 +0530 | [diff] [blame] | 5754 | status = scheduler_post_message(QDF_MODULE_ID_PE, |
| 5755 | QDF_MODULE_ID_WMA, |
| 5756 | QDF_MODULE_ID_WMA, &msg); |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5757 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 5758 | pe_err("Not able to post WMA_SET_IE_INFO to WMA"); |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5759 | qdf_mem_free(ie_msg); |
| 5760 | return status; |
| 5761 | } |
| 5762 | |
| 5763 | return status; |
| 5764 | } |
| 5765 | |
| 5766 | /** |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5767 | * lim_get_rx_ldpc() - gets ldpc setting for given channel(band) |
| 5768 | * @mac_ctx: global mac context |
Krunal Soni | 3512f6b | 2017-06-30 12:43:40 -0700 | [diff] [blame] | 5769 | * @ch: channel enum for which ldpc setting is required |
| 5770 | * Note: ch param is not absolute channel number rather it is |
| 5771 | * channel number enum. |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5772 | * |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5773 | * Return: true if enabled and false otherwise |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5774 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5775 | static inline bool lim_get_rx_ldpc(struct mac_context *mac_ctx, enum channel_enum ch) |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5776 | { |
Vignesh Viswanathan | ecd4de7 | 2018-11-22 13:02:20 +0530 | [diff] [blame] | 5777 | if (mac_ctx->mlme_cfg->ht_caps.ht_cap_info.adv_coding_cap && |
| 5778 | wma_is_rx_ldpc_supported_for_channel(WLAN_REG_CH_NUM(ch))) |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5779 | return true; |
| 5780 | else |
| 5781 | return false; |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5782 | } |
| 5783 | |
| 5784 | /** |
gaurank kathpalia | ad98049 | 2018-10-31 19:22:30 +0530 | [diff] [blame] | 5785 | * lim_populate_mcs_set_ht_per_vdev() - update the MCS set according to vdev nss |
| 5786 | * @mac_ctx: global mac context |
| 5787 | * @ht_cap: pointer to ht caps |
| 5788 | * @vdev_id: vdev for which IE is targeted |
| 5789 | * @band: band for which the MCS set has to be updated |
| 5790 | * |
gaurank kathpalia | b414bce | 2018-11-09 18:44:46 +0530 | [diff] [blame] | 5791 | * This function updates the MCS set according to vdev nss |
gaurank kathpalia | ad98049 | 2018-10-31 19:22:30 +0530 | [diff] [blame] | 5792 | * |
| 5793 | * Return: None |
| 5794 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5795 | static void lim_populate_mcs_set_ht_per_vdev(struct mac_context *mac_ctx, |
gaurank kathpalia | ad98049 | 2018-10-31 19:22:30 +0530 | [diff] [blame] | 5796 | struct sHtCaps *ht_cap, |
| 5797 | uint8_t vdev_id, |
| 5798 | uint8_t band) |
| 5799 | { |
| 5800 | struct wlan_mlme_nss_chains *nss_chains_ini_cfg; |
| 5801 | struct wlan_objmgr_vdev *vdev = |
| 5802 | wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc, |
| 5803 | vdev_id, |
| 5804 | WLAN_MLME_SB_ID); |
| 5805 | if (!vdev) { |
| 5806 | pe_err("Got NULL vdev obj, returning"); |
| 5807 | return; |
| 5808 | } |
| 5809 | if (!ht_cap->supportedMCSSet[1]) |
| 5810 | goto end; |
| 5811 | nss_chains_ini_cfg = mlme_get_ini_vdev_config(vdev); |
| 5812 | if (!nss_chains_ini_cfg) { |
| 5813 | pe_err("nss chain dynamic config NULL"); |
| 5814 | goto end; |
| 5815 | } |
| 5816 | |
| 5817 | /* convert from unpacked to packed structure */ |
| 5818 | if (nss_chains_ini_cfg->rx_nss[band] == 1) |
| 5819 | ht_cap->supportedMCSSet[1] = 0; |
| 5820 | |
| 5821 | end: |
| 5822 | wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID); |
| 5823 | } |
| 5824 | |
| 5825 | /** |
| 5826 | * lim_populate_mcs_set_vht_per_vdev() - update MCS set according to vdev nss |
| 5827 | * @mac_ctx: global mac context |
| 5828 | * @vht_caps: pointer to vht_caps |
| 5829 | * @vdev_id: vdev for which IE is targeted |
| 5830 | * @band: band for which the MCS set has to be updated |
| 5831 | * |
gaurank kathpalia | b414bce | 2018-11-09 18:44:46 +0530 | [diff] [blame] | 5832 | * This function updates the MCS set according to vdev nss |
gaurank kathpalia | ad98049 | 2018-10-31 19:22:30 +0530 | [diff] [blame] | 5833 | * |
| 5834 | * Return: None |
| 5835 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5836 | static void lim_populate_mcs_set_vht_per_vdev(struct mac_context *mac_ctx, |
gaurank kathpalia | ad98049 | 2018-10-31 19:22:30 +0530 | [diff] [blame] | 5837 | uint8_t *vht_caps, |
| 5838 | uint8_t vdev_id, |
| 5839 | uint8_t band) |
| 5840 | { |
| 5841 | struct wlan_mlme_nss_chains *nss_chains_ini_cfg; |
| 5842 | tSirVhtMcsInfo *vht_mcs; |
| 5843 | struct wlan_objmgr_vdev *vdev = |
| 5844 | wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc, |
| 5845 | vdev_id, |
| 5846 | WLAN_MLME_SB_ID); |
| 5847 | if (!vdev) { |
| 5848 | pe_err("Got NULL vdev obj, returning"); |
| 5849 | return; |
| 5850 | } |
| 5851 | |
| 5852 | nss_chains_ini_cfg = mlme_get_ini_vdev_config(vdev); |
| 5853 | if (!nss_chains_ini_cfg) { |
| 5854 | pe_err("nss chain dynamic config NULL"); |
| 5855 | goto end; |
| 5856 | } |
| 5857 | |
| 5858 | vht_mcs = (tSirVhtMcsInfo *)&vht_caps[2 + |
| 5859 | sizeof(tSirMacVHTCapabilityInfo)]; |
| 5860 | if (nss_chains_ini_cfg->tx_nss[band] == 1) { |
| 5861 | /* Populate VHT MCS Information */ |
| 5862 | vht_mcs->txMcsMap |= DISABLE_NSS2_MCS; |
| 5863 | vht_mcs->txHighest = |
| 5864 | VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_1_1; |
| 5865 | } |
| 5866 | |
| 5867 | if (nss_chains_ini_cfg->rx_nss[band] == 1) { |
| 5868 | /* Populate VHT MCS Information */ |
| 5869 | vht_mcs->rxMcsMap |= DISABLE_NSS2_MCS; |
| 5870 | vht_mcs->rxHighest = |
| 5871 | VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_1_1; |
| 5872 | } |
| 5873 | |
| 5874 | end: |
| 5875 | wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID); |
| 5876 | } |
| 5877 | |
| 5878 | /** |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5879 | * lim_send_ies_per_band() - gets ht and vht capability and send to firmware via |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5880 | * wma |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5881 | * @mac_ctx: global mac context |
| 5882 | * @session: pe session. This can be NULL. In that case self cap will be sent |
| 5883 | * @vdev_id: vdev for which IE is targeted |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5884 | * |
| 5885 | * This funciton gets ht and vht capability and send to firmware via wma |
| 5886 | * |
| 5887 | * Return: status of operation |
| 5888 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5889 | QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 5890 | struct pe_session *session, |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5891 | uint8_t vdev_id) |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5892 | { |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5893 | uint8_t ht_caps[DOT11F_IE_HTCAPS_MIN_LEN + 2] = {0}; |
| 5894 | uint8_t vht_caps[DOT11F_IE_VHTCAPS_MAX_LEN + 2] = {0}; |
Naveen Rawat | 1620ecb | 2016-10-10 15:25:50 -0700 | [diff] [blame] | 5895 | tHtCaps *p_ht_cap = (tHtCaps *)(&ht_caps[2]); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5896 | tSirMacVHTCapabilityInfo *p_vht_cap = |
Naveen Rawat | 1620ecb | 2016-10-10 15:25:50 -0700 | [diff] [blame] | 5897 | (tSirMacVHTCapabilityInfo *)(&vht_caps[2]); |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 5898 | QDF_STATUS status; |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5899 | |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5900 | /* |
| 5901 | * Note: Do not use Dot11f VHT structure, since 1 byte present flag in |
| 5902 | * it is causing weird padding errors. Instead use Sir Mac VHT struct |
| 5903 | * to send IE to wma. |
| 5904 | */ |
| 5905 | ht_caps[0] = DOT11F_EID_HTCAPS; |
| 5906 | ht_caps[1] = DOT11F_IE_HTCAPS_MIN_LEN; |
| 5907 | lim_set_ht_caps(mac_ctx, session, ht_caps, |
| 5908 | DOT11F_IE_HTCAPS_MIN_LEN + 2); |
| 5909 | /* Get LDPC and over write for 2G */ |
| 5910 | p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_6); |
Naveen Rawat | 1620ecb | 2016-10-10 15:25:50 -0700 | [diff] [blame] | 5911 | /* Get self cap for HT40 support in 2G */ |
| 5912 | if (mac_ctx->roam.configParam.channelBondingMode24GHz) { |
| 5913 | p_ht_cap->supportedChannelWidthSet = 1; |
| 5914 | p_ht_cap->shortGI40MHz = 1; |
| 5915 | } else { |
| 5916 | p_ht_cap->supportedChannelWidthSet = 0; |
| 5917 | p_ht_cap->shortGI40MHz = 0; |
| 5918 | } |
gaurank kathpalia | b414bce | 2018-11-09 18:44:46 +0530 | [diff] [blame] | 5919 | lim_populate_mcs_set_ht_per_vdev(mac_ctx, p_ht_cap, vdev_id, |
| 5920 | NSS_CHAINS_BAND_2GHZ); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5921 | lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_HTCAPS, |
| 5922 | CDS_BAND_2GHZ, &ht_caps[2], DOT11F_IE_HTCAPS_MIN_LEN); |
| 5923 | /* |
| 5924 | * Get LDPC and over write for 5G - using channel 64 because it |
| 5925 | * is available in all reg domains. |
| 5926 | */ |
| 5927 | p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_64); |
Naveen Rawat | 1620ecb | 2016-10-10 15:25:50 -0700 | [diff] [blame] | 5928 | /* Get self cap for HT40 support in 5G */ |
| 5929 | if (mac_ctx->roam.configParam.channelBondingMode5GHz) { |
| 5930 | p_ht_cap->supportedChannelWidthSet = 1; |
| 5931 | p_ht_cap->shortGI40MHz = 1; |
| 5932 | } else { |
| 5933 | p_ht_cap->supportedChannelWidthSet = 0; |
| 5934 | p_ht_cap->shortGI40MHz = 0; |
| 5935 | } |
gaurank kathpalia | b414bce | 2018-11-09 18:44:46 +0530 | [diff] [blame] | 5936 | lim_populate_mcs_set_ht_per_vdev(mac_ctx, p_ht_cap, vdev_id, |
| 5937 | NSS_CHAINS_BAND_5GHZ); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5938 | lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_HTCAPS, |
| 5939 | CDS_BAND_5GHZ, &ht_caps[2], DOT11F_IE_HTCAPS_MIN_LEN); |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5940 | |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5941 | vht_caps[0] = DOT11F_EID_VHTCAPS; |
| 5942 | vht_caps[1] = DOT11F_IE_VHTCAPS_MAX_LEN; |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5943 | lim_set_vht_caps(mac_ctx, session, vht_caps, |
| 5944 | DOT11F_IE_VHTCAPS_MIN_LEN + 2); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5945 | /* |
| 5946 | * Get LDPC and over write for 5G - using channel 64 because it |
| 5947 | * is available in all reg domains. |
| 5948 | */ |
| 5949 | p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_64); |
gaurank kathpalia | ad98049 | 2018-10-31 19:22:30 +0530 | [diff] [blame] | 5950 | lim_populate_mcs_set_vht_per_vdev(mac_ctx, vht_caps, |
gaurank kathpalia | b414bce | 2018-11-09 18:44:46 +0530 | [diff] [blame] | 5951 | vdev_id, NSS_CHAINS_BAND_5GHZ); |
gaurank kathpalia | ad98049 | 2018-10-31 19:22:30 +0530 | [diff] [blame] | 5952 | |
Naveen Rawat | 1620ecb | 2016-10-10 15:25:50 -0700 | [diff] [blame] | 5953 | /* Self VHT channel width for 5G is already negotiated with FW */ |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 5954 | lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_VHTCAPS, |
| 5955 | CDS_BAND_5GHZ, &vht_caps[2], DOT11F_IE_VHTCAPS_MIN_LEN); |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5956 | |
Naveen Rawat | 2347f9d | 2016-11-21 12:55:12 -0800 | [diff] [blame] | 5957 | /* Get LDPC and over write for 2G */ |
| 5958 | p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_6); |
| 5959 | /* Self VHT 80/160/80+80 channel width for 2G is 0 */ |
| 5960 | p_vht_cap->supportedChannelWidthSet = 0; |
| 5961 | p_vht_cap->shortGI80MHz = 0; |
| 5962 | p_vht_cap->shortGI160and80plus80MHz = 0; |
gaurank kathpalia | ad98049 | 2018-10-31 19:22:30 +0530 | [diff] [blame] | 5963 | lim_populate_mcs_set_vht_per_vdev(mac_ctx, vht_caps, |
gaurank kathpalia | b414bce | 2018-11-09 18:44:46 +0530 | [diff] [blame] | 5964 | vdev_id, NSS_CHAINS_BAND_2GHZ); |
Naveen Rawat | 2347f9d | 2016-11-21 12:55:12 -0800 | [diff] [blame] | 5965 | lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_VHTCAPS, |
| 5966 | CDS_BAND_2GHZ, &vht_caps[2], DOT11F_IE_VHTCAPS_MIN_LEN); |
| 5967 | |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 5968 | status = lim_send_he_caps_ie(mac_ctx, session, vdev_id); |
| 5969 | |
| 5970 | return status; |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 5971 | } |
| 5972 | |
| 5973 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5974 | * lim_send_ext_cap_ie() - send ext cap IE to FW |
| 5975 | * @mac_ctx: global MAC context |
| 5976 | * @session_entry: PE session |
| 5977 | * @extra_extcap: extracted ext cap |
| 5978 | * @merge: merge extra ext cap |
| 5979 | * |
| 5980 | * This function is invoked after VDEV is created to update firmware |
| 5981 | * about the extended capabilities that the corresponding VDEV is capable |
| 5982 | * of. Since STA/SAP can have different Extended capabilities set, this function |
| 5983 | * is called per vdev creation. |
| 5984 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5985 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5986 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 5987 | QDF_STATUS lim_send_ext_cap_ie(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5988 | uint32_t session_id, |
| 5989 | tDot11fIEExtCap *extra_extcap, bool merge) |
| 5990 | { |
| 5991 | tDot11fIEExtCap ext_cap_data = {0}; |
| 5992 | uint32_t dot11mode, num_bytes; |
| 5993 | bool vht_enabled = false; |
| 5994 | struct vdev_ie_info *vdev_ie; |
Rajeev Kumar | f7d8442 | 2017-01-21 15:45:44 -0800 | [diff] [blame] | 5995 | struct scheduler_msg msg = {0}; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 5996 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5997 | |
| 5998 | wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &dot11mode); |
| 5999 | if (IS_DOT11_MODE_VHT(dot11mode)) |
| 6000 | vht_enabled = true; |
| 6001 | |
| 6002 | status = populate_dot11f_ext_cap(mac_ctx, vht_enabled, &ext_cap_data, |
| 6003 | NULL); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6004 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6005 | pe_err("Failed to populate ext cap IE"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6006 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6007 | } |
| 6008 | |
| 6009 | num_bytes = ext_cap_data.num_bytes; |
| 6010 | |
| 6011 | if (merge && NULL != extra_extcap && extra_extcap->num_bytes > 0) { |
| 6012 | if (extra_extcap->num_bytes > ext_cap_data.num_bytes) |
| 6013 | num_bytes = extra_extcap->num_bytes; |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 6014 | lim_merge_extcap_struct(&ext_cap_data, extra_extcap, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6015 | } |
| 6016 | |
| 6017 | /* Allocate memory for the WMI request, and copy the parameter */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6018 | vdev_ie = qdf_mem_malloc(sizeof(*vdev_ie) + num_bytes); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 6019 | if (!vdev_ie) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6020 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6021 | |
| 6022 | vdev_ie->vdev_id = session_id; |
| 6023 | vdev_ie->ie_id = DOT11F_EID_EXTCAP; |
| 6024 | vdev_ie->length = num_bytes; |
Naveen Rawat | 03e8d95 | 2016-08-01 15:22:20 -0700 | [diff] [blame] | 6025 | vdev_ie->band = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6026 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6027 | vdev_ie->data = (uint8_t *)vdev_ie + sizeof(*vdev_ie); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6028 | qdf_mem_copy(vdev_ie->data, ext_cap_data.bytes, num_bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6029 | |
| 6030 | msg.type = WMA_SET_IE_INFO; |
| 6031 | msg.bodyptr = vdev_ie; |
| 6032 | msg.reserved = 0; |
| 6033 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6034 | if (QDF_STATUS_SUCCESS != |
gaurank kathpalia | 3a7f25b | 2018-08-28 16:26:39 +0530 | [diff] [blame] | 6035 | scheduler_post_message(QDF_MODULE_ID_PE, |
| 6036 | QDF_MODULE_ID_WMA, |
| 6037 | QDF_MODULE_ID_WMA, &msg)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6038 | pe_err("Not able to post WMA_SET_IE_INFO to WDA"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6039 | qdf_mem_free(vdev_ie); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6040 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6041 | } |
| 6042 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6043 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6044 | } |
| 6045 | |
| 6046 | /** |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6047 | * lim_strip_ie() - strip requested IE from IE buffer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6048 | * @mac_ctx: global MAC context |
| 6049 | * @addn_ie: Additional IE buffer |
| 6050 | * @addn_ielen: Length of additional IE |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6051 | * @eid: EID of IE to strip |
Jeff Johnson | fe8e949 | 2018-05-06 15:40:52 -0700 | [diff] [blame] | 6052 | * @size_of_len_field: length of IE length field |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6053 | * @oui: if present matches OUI also |
| 6054 | * @oui_length: if previous present, this is length of oui |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6055 | * @extracted_ie: if not NULL, copy the stripped IE to this buffer |
| 6056 | * |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6057 | * This utility function is used to strip of the requested IE if present |
| 6058 | * in IE buffer. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6059 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6060 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6061 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6062 | QDF_STATUS lim_strip_ie(struct mac_context *mac_ctx, |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6063 | uint8_t *addn_ie, uint16_t *addn_ielen, |
| 6064 | uint8_t eid, eSizeOfLenField size_of_len_field, |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6065 | uint8_t *oui, uint8_t oui_length, uint8_t *extracted_ie, |
| 6066 | uint32_t eid_max_len) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6067 | { |
| 6068 | uint8_t *tempbuf = NULL; |
| 6069 | uint16_t templen = 0; |
| 6070 | int left = *addn_ielen; |
| 6071 | uint8_t *ptr = addn_ie; |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6072 | uint8_t elem_id; |
| 6073 | uint16_t elem_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6074 | |
| 6075 | if (NULL == addn_ie) { |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 6076 | pe_debug("NULL addn_ie pointer"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6077 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6078 | } |
| 6079 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6080 | tempbuf = qdf_mem_malloc(left); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 6081 | if (!tempbuf) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6082 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6083 | |
| 6084 | while (left >= 2) { |
| 6085 | elem_id = ptr[0]; |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6086 | left -= 1; |
| 6087 | if (size_of_len_field == TWO_BYTE) { |
| 6088 | elem_len = *((uint16_t *)&ptr[1]); |
| 6089 | left -= 2; |
| 6090 | } else { |
| 6091 | elem_len = ptr[1]; |
| 6092 | left -= 1; |
| 6093 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6094 | if (elem_len > left) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6095 | pe_err("Invalid IEs eid: %d elem_len: %d left: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6096 | elem_id, elem_len, left); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6097 | qdf_mem_free(tempbuf); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6098 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6099 | } |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6100 | |
| 6101 | if (eid != elem_id || |
| 6102 | (oui && qdf_mem_cmp(oui, |
| 6103 | &ptr[size_of_len_field + 1], |
| 6104 | oui_length))) { |
| 6105 | qdf_mem_copy(tempbuf + templen, &ptr[0], |
| 6106 | elem_len + size_of_len_field + 1); |
| 6107 | templen += (elem_len + size_of_len_field + 1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6108 | } else { |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6109 | /* |
| 6110 | * eid matched and if provided OUI also matched |
| 6111 | * take oui IE and store in provided buffer. |
| 6112 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6113 | if (NULL != extracted_ie) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6114 | qdf_mem_set(extracted_ie, |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6115 | eid_max_len + size_of_len_field + 1, |
| 6116 | 0); |
| 6117 | if (elem_len <= eid_max_len) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6118 | qdf_mem_copy(extracted_ie, &ptr[0], |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6119 | elem_len + size_of_len_field + 1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6120 | } |
| 6121 | } |
| 6122 | left -= elem_len; |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6123 | ptr += (elem_len + size_of_len_field + 1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6124 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6125 | qdf_mem_copy(addn_ie, tempbuf, templen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6126 | |
| 6127 | *addn_ielen = templen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6128 | qdf_mem_free(tempbuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6129 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6130 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6131 | } |
| 6132 | |
Krunal Soni | d3c86d4 | 2017-10-19 12:12:21 -0700 | [diff] [blame] | 6133 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6134 | void lim_del_pmf_sa_query_timer(struct mac_context *mac_ctx, struct pe_session *pe_session) |
Krunal Soni | d3c86d4 | 2017-10-19 12:12:21 -0700 | [diff] [blame] | 6135 | { |
| 6136 | uint32_t associated_sta; |
| 6137 | tpDphHashNode sta_ds = NULL; |
| 6138 | |
| 6139 | for (associated_sta = 1; |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 6140 | associated_sta < |
| 6141 | mac_ctx->mlme_cfg->sap_cfg.assoc_sta_limit; |
Krunal Soni | d3c86d4 | 2017-10-19 12:12:21 -0700 | [diff] [blame] | 6142 | associated_sta++) { |
| 6143 | sta_ds = dph_get_hash_entry(mac_ctx, associated_sta, |
| 6144 | &pe_session->dph.dphHashTable); |
| 6145 | if (NULL == sta_ds) |
| 6146 | continue; |
Krunal Soni | a59e8a4 | 2017-11-19 09:00:56 -0800 | [diff] [blame] | 6147 | if (!sta_ds->rmfEnabled) { |
| 6148 | pe_debug("no PMF timer for sta-idx:%d assoc-id:%d", |
| 6149 | sta_ds->staIndex, sta_ds->assocId); |
| 6150 | continue; |
| 6151 | } |
Krunal Soni | d3c86d4 | 2017-10-19 12:12:21 -0700 | [diff] [blame] | 6152 | |
Krunal Soni | a59e8a4 | 2017-11-19 09:00:56 -0800 | [diff] [blame] | 6153 | pe_debug("Deleting pmfSaQueryTimer for sta-idx:%d assoc-id:%d", |
| 6154 | sta_ds->staIndex, sta_ds->assocId); |
Krunal Soni | d3c86d4 | 2017-10-19 12:12:21 -0700 | [diff] [blame] | 6155 | tx_timer_deactivate(&sta_ds->pmfSaQueryTimer); |
| 6156 | tx_timer_delete(&sta_ds->pmfSaQueryTimer); |
| 6157 | } |
| 6158 | } |
| 6159 | #endif |
| 6160 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6161 | QDF_STATUS lim_strip_supp_op_class_update_struct(struct mac_context *mac_ctx, |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6162 | uint8_t *addn_ie, uint16_t *addn_ielen, |
| 6163 | tDot11fIESuppOperatingClasses *dst) |
| 6164 | { |
| 6165 | uint8_t extracted_buff[DOT11F_IE_SUPPOPERATINGCLASSES_MAX_LEN + 2]; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6166 | QDF_STATUS status; |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6167 | |
| 6168 | qdf_mem_set((uint8_t *)&extracted_buff[0], |
| 6169 | DOT11F_IE_SUPPOPERATINGCLASSES_MAX_LEN + 2, |
| 6170 | 0); |
| 6171 | status = lim_strip_ie(mac_ctx, addn_ie, addn_ielen, |
| 6172 | DOT11F_EID_SUPPOPERATINGCLASSES, ONE_BYTE, |
| 6173 | NULL, 0, extracted_buff, |
| 6174 | DOT11F_IE_SUPPOPERATINGCLASSES_MAX_LEN); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6175 | if (QDF_STATUS_SUCCESS != status) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6176 | pe_warn("Failed to strip supp_op_mode IE status: %d", |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6177 | status); |
| 6178 | return status; |
| 6179 | } |
| 6180 | |
| 6181 | if (DOT11F_EID_SUPPOPERATINGCLASSES != extracted_buff[0] || |
| 6182 | extracted_buff[1] > DOT11F_IE_SUPPOPERATINGCLASSES_MAX_LEN) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6183 | pe_warn("Invalid IEs eid: %d elem_len: %d", |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6184 | extracted_buff[0], extracted_buff[1]); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6185 | return QDF_STATUS_E_FAILURE; |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6186 | } |
| 6187 | |
| 6188 | /* update the extracted supp op class to struct*/ |
| 6189 | if (DOT11F_PARSE_SUCCESS != dot11f_unpack_ie_supp_operating_classes( |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 6190 | mac_ctx, &extracted_buff[2], extracted_buff[1], dst, false)) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6191 | pe_err("dot11f_unpack Parse Error"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6192 | return QDF_STATUS_E_FAILURE; |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6193 | } |
| 6194 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6195 | return QDF_STATUS_SUCCESS; |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6196 | } |
| 6197 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6198 | /** |
| 6199 | * lim_update_extcap_struct() - poputlate the dot11f structure |
| 6200 | * @mac_ctx: global MAC context |
| 6201 | * @buf: extracted IE buffer |
| 6202 | * @dst: extended capability IE structure to be updated |
| 6203 | * |
| 6204 | * This function is used to update the extended capability structure |
| 6205 | * with @buf. |
| 6206 | * |
| 6207 | * Return: None |
| 6208 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6209 | void lim_update_extcap_struct(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6210 | uint8_t *buf, tDot11fIEExtCap *dst) |
| 6211 | { |
| 6212 | uint8_t out[DOT11F_IE_EXTCAP_MAX_LEN]; |
Padma, Santhosh Kumar | 9223447 | 2017-04-19 18:20:02 +0530 | [diff] [blame] | 6213 | uint32_t status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6214 | |
| 6215 | if (NULL == buf) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6216 | pe_err("Invalid Buffer Address"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6217 | return; |
| 6218 | } |
| 6219 | |
| 6220 | if (NULL == dst) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6221 | pe_err("NULL dst pointer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6222 | return; |
| 6223 | } |
| 6224 | |
| 6225 | if (DOT11F_EID_EXTCAP != buf[0] || buf[1] > DOT11F_IE_EXTCAP_MAX_LEN) { |
Dustin Brown | 897dae4 | 2018-03-13 17:08:47 -0700 | [diff] [blame] | 6226 | pe_debug_rl("Invalid IEs eid: %d elem_len: %d", buf[0], buf[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6227 | return; |
| 6228 | } |
| 6229 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6230 | qdf_mem_set((uint8_t *)&out[0], DOT11F_IE_EXTCAP_MAX_LEN, 0); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 6231 | qdf_mem_copy(&out[0], &buf[2], buf[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6232 | |
Padma, Santhosh Kumar | 9223447 | 2017-04-19 18:20:02 +0530 | [diff] [blame] | 6233 | status = dot11f_unpack_ie_ext_cap(mac_ctx, &out[0], |
| 6234 | buf[1], dst, false); |
| 6235 | if (DOT11F_PARSE_SUCCESS != status) |
| 6236 | pe_err("dot11f_unpack Parse Error %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6237 | } |
| 6238 | |
| 6239 | /** |
| 6240 | * lim_strip_extcap_update_struct - strip extended capability IE and populate |
| 6241 | * the dot11f structure |
| 6242 | * @mac_ctx: global MAC context |
| 6243 | * @addn_ie: Additional IE buffer |
| 6244 | * @addn_ielen: Length of additional IE |
| 6245 | * @dst: extended capability IE structure to be updated |
| 6246 | * |
| 6247 | * This function is used to strip extended capability IE from IE buffer and |
| 6248 | * update the passed structure. |
| 6249 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6250 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6251 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6252 | QDF_STATUS lim_strip_extcap_update_struct(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6253 | uint8_t *addn_ie, uint16_t *addn_ielen, tDot11fIEExtCap *dst) |
| 6254 | { |
| 6255 | uint8_t extracted_buff[DOT11F_IE_EXTCAP_MAX_LEN + 2]; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6256 | QDF_STATUS status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6257 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6258 | qdf_mem_set((uint8_t *)&extracted_buff[0], DOT11F_IE_EXTCAP_MAX_LEN + 2, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6259 | 0); |
Naveen Rawat | 30b8450 | 2016-10-13 17:44:48 -0700 | [diff] [blame] | 6260 | status = lim_strip_ie(mac_ctx, addn_ie, addn_ielen, |
| 6261 | DOT11F_EID_EXTCAP, ONE_BYTE, |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 6262 | NULL, 0, extracted_buff, |
| 6263 | DOT11F_IE_EXTCAP_MAX_LEN); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6264 | if (QDF_STATUS_SUCCESS != status) { |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 6265 | pe_debug("Failed to strip extcap IE status: %d", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6266 | return status; |
| 6267 | } |
| 6268 | |
| 6269 | /* update the extracted ExtCap to struct*/ |
| 6270 | lim_update_extcap_struct(mac_ctx, extracted_buff, dst); |
| 6271 | return status; |
| 6272 | } |
| 6273 | |
| 6274 | /** |
| 6275 | * lim_merge_extcap_struct() - merge extended capabilities info |
| 6276 | * @dst: destination extended capabilities |
| 6277 | * @src: source extended capabilities |
Jeff Johnson | 118a4a0 | 2018-05-06 00:14:15 -0700 | [diff] [blame] | 6278 | * @add: true if add the capabilities, false if strip the capabilities. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6279 | * |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 6280 | * This function is used to take @src info and add/strip it to/from |
| 6281 | * @dst extended capabilities info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6282 | * |
| 6283 | * Return: None |
| 6284 | */ |
| 6285 | void lim_merge_extcap_struct(tDot11fIEExtCap *dst, |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 6286 | tDot11fIEExtCap *src, |
| 6287 | bool add) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6288 | { |
| 6289 | uint8_t *tempdst = (uint8_t *)dst->bytes; |
| 6290 | uint8_t *tempsrc = (uint8_t *)src->bytes; |
| 6291 | uint8_t structlen = member_size(tDot11fIEExtCap, bytes); |
| 6292 | |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 6293 | /* Return if @src not present */ |
| 6294 | if (!src->present) |
| 6295 | return; |
| 6296 | |
Jeff Johnson | 118a4a0 | 2018-05-06 00:14:15 -0700 | [diff] [blame] | 6297 | /* Return if strip the capabilities from @dst which not present */ |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 6298 | if (!dst->present && !add) |
| 6299 | return; |
| 6300 | |
Jeff Johnson | 118a4a0 | 2018-05-06 00:14:15 -0700 | [diff] [blame] | 6301 | /* Merge the capabilities info in other cases */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6302 | while (tempdst && tempsrc && structlen--) { |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 6303 | if (add) |
| 6304 | *tempdst |= *tempsrc; |
| 6305 | else |
| 6306 | *tempdst &= *tempsrc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6307 | tempdst++; |
| 6308 | tempsrc++; |
| 6309 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 6310 | dst->num_bytes = lim_compute_ext_cap_ie_length(dst); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 6311 | if (dst->num_bytes == 0) |
| 6312 | dst->present = 0; |
| 6313 | else |
| 6314 | dst->present = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6315 | } |
| 6316 | |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 6317 | /** |
Kiran Kumar Lokere | ee20577 | 2018-09-27 00:27:27 -0700 | [diff] [blame] | 6318 | * lim_send_action_frm_tb_ppdu_cfg_flush_cb() - flush TB PPDU cfg msg |
| 6319 | * @msg: Message pointer |
| 6320 | * |
| 6321 | * Flushes the send action frame in HE TB PPDU configuration message. |
| 6322 | * |
| 6323 | * Return: None |
| 6324 | */ |
| 6325 | static void lim_send_action_frm_tb_ppdu_cfg_flush_cb(struct scheduler_msg *msg) |
| 6326 | { |
| 6327 | if (msg->bodyptr) { |
| 6328 | qdf_mem_free(msg->bodyptr); |
| 6329 | msg->bodyptr = NULL; |
| 6330 | } |
| 6331 | } |
| 6332 | |
| 6333 | /** |
| 6334 | * lim_send_action_frm_tb_ppdu_cfg() - sets action frame in TB PPDU cfg to FW |
| 6335 | * @mac_ctx: global MAC context |
| 6336 | * @session_id: SME session id |
| 6337 | * @cfg: config setting |
| 6338 | * |
| 6339 | * Preapres the vendor action frame and send action frame in HE TB PPDU |
| 6340 | * configuration to FW. |
| 6341 | * |
| 6342 | * Return: QDF_STATUS |
| 6343 | */ |
| 6344 | QDF_STATUS lim_send_action_frm_tb_ppdu_cfg(struct mac_context *mac_ctx, |
| 6345 | uint32_t session_id, |
| 6346 | uint8_t cfg) |
| 6347 | { |
| 6348 | tDot11fvendor_action_frame *frm; |
| 6349 | uint8_t frm_len = sizeof(*frm); |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6350 | struct pe_session *session; |
Kiran Kumar Lokere | ee20577 | 2018-09-27 00:27:27 -0700 | [diff] [blame] | 6351 | struct cfg_action_frm_tb_ppdu *cfg_msg; |
| 6352 | struct scheduler_msg msg = {0}; |
| 6353 | uint8_t *data_buf; |
| 6354 | |
| 6355 | session = pe_find_session_by_sme_session_id(mac_ctx, session_id); |
| 6356 | |
| 6357 | if (!session) { |
| 6358 | pe_err("pe session does not exist for sme session id %d", |
| 6359 | session_id); |
| 6360 | return QDF_STATUS_E_FAILURE; |
| 6361 | } |
| 6362 | |
| 6363 | data_buf = qdf_mem_malloc(frm_len + sizeof(*cfg_msg)); |
| 6364 | if (!data_buf) |
| 6365 | return QDF_STATUS_E_FAILURE; |
| 6366 | |
| 6367 | cfg_msg = (struct cfg_action_frm_tb_ppdu *)data_buf; |
| 6368 | |
| 6369 | frm = (tDot11fvendor_action_frame *)(data_buf + sizeof(*cfg_msg)); |
| 6370 | |
| 6371 | frm->Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY; |
| 6372 | |
| 6373 | frm->vendor_oui.oui_data[0] = 0x00; |
| 6374 | frm->vendor_oui.oui_data[1] = 0xA0; |
| 6375 | frm->vendor_oui.oui_data[2] = 0xC6; |
| 6376 | |
| 6377 | frm->vendor_action_subtype.subtype = 0xFF; |
| 6378 | |
| 6379 | cfg_msg->vdev_id = session_id; |
| 6380 | cfg_msg->cfg = cfg; |
| 6381 | cfg_msg->frm_len = frm_len; |
| 6382 | cfg_msg->data = (uint8_t *)frm; |
| 6383 | |
| 6384 | msg.type = WMA_CFG_VENDOR_ACTION_TB_PPDU; |
| 6385 | msg.bodyptr = cfg_msg; |
| 6386 | msg.reserved = 0; |
| 6387 | msg.flush_callback = lim_send_action_frm_tb_ppdu_cfg_flush_cb; |
| 6388 | |
| 6389 | if (QDF_STATUS_SUCCESS != |
| 6390 | scheduler_post_message(QDF_MODULE_ID_PE, |
| 6391 | QDF_MODULE_ID_WMA, |
| 6392 | QDF_MODULE_ID_WMA, &msg)) { |
| 6393 | pe_err("Not able to post WMA_SET_IE_INFO to WDA"); |
| 6394 | qdf_mem_free(data_buf); |
| 6395 | return QDF_STATUS_E_FAILURE; |
| 6396 | } |
| 6397 | |
| 6398 | return QDF_STATUS_SUCCESS; |
| 6399 | } |
| 6400 | |
| 6401 | /** |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 6402 | * lim_get_80Mhz_center_channel - finds 80 Mhz center channel |
| 6403 | * |
| 6404 | * @primary_channel: Primary channel for given 80 MHz band |
| 6405 | * |
| 6406 | * There are fixed 80MHz band and for each fixed band there is only one center |
| 6407 | * valid channel. Also location of primary channel decides what 80 MHz band will |
| 6408 | * it use, hence it decides what center channel will be used. This function |
| 6409 | * does thus calculation and returns the center channel. |
| 6410 | * |
| 6411 | * Return: center channel |
| 6412 | */ |
| 6413 | uint8_t |
| 6414 | lim_get_80Mhz_center_channel(uint8_t primary_channel) |
| 6415 | { |
| 6416 | if (primary_channel >= 36 && primary_channel <= 48) |
| 6417 | return (36+48)/2; |
| 6418 | if (primary_channel >= 52 && primary_channel <= 64) |
| 6419 | return (52+64)/2; |
| 6420 | if (primary_channel >= 100 && primary_channel <= 112) |
| 6421 | return (100+112)/2; |
| 6422 | if (primary_channel >= 116 && primary_channel <= 128) |
| 6423 | return (116+128)/2; |
| 6424 | if (primary_channel >= 132 && primary_channel <= 144) |
| 6425 | return (132+144)/2; |
| 6426 | if (primary_channel >= 149 && primary_channel <= 161) |
| 6427 | return (149+161)/2; |
| 6428 | |
| 6429 | return INVALID_CHANNEL_ID; |
| 6430 | } |
Sreelakshmi Konamki | 39acb13 | 2015-12-16 13:06:22 +0530 | [diff] [blame] | 6431 | |
| 6432 | /** |
Sreelakshmi Konamki | 39acb13 | 2015-12-16 13:06:22 +0530 | [diff] [blame] | 6433 | * lim_bss_type_to_string(): converts bss type enum to string. |
| 6434 | * @bss_type: enum value of bss_type. |
| 6435 | * |
| 6436 | * Return: Printable string for bss_type |
| 6437 | */ |
| 6438 | const char *lim_bss_type_to_string(const uint16_t bss_type) |
| 6439 | { |
| 6440 | switch (bss_type) { |
| 6441 | CASE_RETURN_STRING(eSIR_INFRASTRUCTURE_MODE); |
| 6442 | CASE_RETURN_STRING(eSIR_INFRA_AP_MODE); |
| 6443 | CASE_RETURN_STRING(eSIR_IBSS_MODE); |
Sreelakshmi Konamki | 39acb13 | 2015-12-16 13:06:22 +0530 | [diff] [blame] | 6444 | CASE_RETURN_STRING(eSIR_AUTO_MODE); |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 6445 | CASE_RETURN_STRING(eSIR_NDI_MODE); |
Sreelakshmi Konamki | 39acb13 | 2015-12-16 13:06:22 +0530 | [diff] [blame] | 6446 | default: |
| 6447 | return "Unknown bss_type"; |
| 6448 | } |
| 6449 | } |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6450 | |
| 6451 | /** |
| 6452 | * lim_init_obss_params(): Initializes the OBSS Scan Parameters |
| 6453 | * @sesssion: LIM session |
| 6454 | * @mac_ctx: Mac context |
| 6455 | * |
| 6456 | * Return: None |
| 6457 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6458 | void lim_init_obss_params(struct mac_context *mac_ctx, struct pe_session *session) |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6459 | { |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6460 | struct wlan_mlme_obss_ht40 *obss_ht40; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6461 | |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6462 | if (!(mac_ctx->mlme_cfg)) { |
| 6463 | pe_err("invalid mlme cfg"); |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6464 | return; |
| 6465 | } |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6466 | |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6467 | obss_ht40 = &mac_ctx->mlme_cfg->obss_ht40; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6468 | |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6469 | session->obss_ht40_scanparam.obss_active_dwelltime = |
| 6470 | obss_ht40->active_dwelltime; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6471 | |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6472 | session->obss_ht40_scanparam.obss_passive_dwelltime = |
| 6473 | obss_ht40->passive_dwelltime; |
| 6474 | |
| 6475 | session->obss_ht40_scanparam.obss_width_trigger_interval = |
| 6476 | obss_ht40->width_trigger_interval; |
| 6477 | |
| 6478 | session->obss_ht40_scanparam.obss_active_total_per_channel = |
| 6479 | obss_ht40->active_per_channel; |
| 6480 | |
| 6481 | session->obss_ht40_scanparam.obss_passive_total_per_channel = |
| 6482 | obss_ht40->passive_per_channel; |
| 6483 | |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6484 | session->obss_ht40_scanparam.bsswidth_ch_trans_delay = |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6485 | obss_ht40->width_trans_delay; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6486 | |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6487 | session->obss_ht40_scanparam.obss_activity_threshold = |
| 6488 | obss_ht40->scan_activity_threshold; |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6489 | } |
| 6490 | |
| 6491 | /** |
| 6492 | * lim_update_obss_scanparams(): Updates OBSS SCAN IE parameters to session |
| 6493 | * @sesssion: LIM session |
| 6494 | * @scan_params: Scan parameters |
| 6495 | * |
| 6496 | * Return: None |
| 6497 | */ |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6498 | void lim_update_obss_scanparams(struct pe_session *session, |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6499 | tDot11fIEOBSSScanParameters *scan_params) |
| 6500 | { |
| 6501 | /* |
Jeff Johnson | 4ceed38 | 2018-05-06 16:24:57 -0700 | [diff] [blame] | 6502 | * If the received value is not in the range specified |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6503 | * by the Specification then it will be the default value |
| 6504 | * configured through cfg |
| 6505 | */ |
| 6506 | if ((scan_params->obssScanActiveDwell > |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6507 | cfg_min(CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME)) && |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6508 | (scan_params->obssScanActiveDwell < |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6509 | cfg_max(CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME))) |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6510 | session->obss_ht40_scanparam.obss_active_dwelltime = |
| 6511 | scan_params->obssScanActiveDwell; |
| 6512 | |
| 6513 | if ((scan_params->obssScanPassiveDwell > |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6514 | cfg_min(CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME)) && |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6515 | (scan_params->obssScanPassiveDwell < |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6516 | cfg_max(CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME))) |
Will Huang | 1655c22 | 2018-05-14 15:27:56 +0800 | [diff] [blame] | 6517 | session->obss_ht40_scanparam.obss_passive_dwelltime = |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6518 | scan_params->obssScanPassiveDwell; |
| 6519 | |
| 6520 | if ((scan_params->bssWidthChannelTransitionDelayFactor > |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6521 | cfg_min(CFG_OBSS_HT40_WIDTH_CH_TRANSITION_DELAY)) && |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6522 | (scan_params->bssWidthChannelTransitionDelayFactor < |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6523 | cfg_max(CFG_OBSS_HT40_WIDTH_CH_TRANSITION_DELAY))) |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6524 | session->obss_ht40_scanparam.bsswidth_ch_trans_delay = |
| 6525 | scan_params->bssWidthChannelTransitionDelayFactor; |
| 6526 | |
| 6527 | if ((scan_params->obssScanActiveTotalPerChannel > |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6528 | cfg_min(CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL)) && |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6529 | (scan_params->obssScanActiveTotalPerChannel < |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6530 | cfg_max(CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL))) |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6531 | session->obss_ht40_scanparam.obss_active_total_per_channel = |
| 6532 | scan_params->obssScanActiveTotalPerChannel; |
| 6533 | |
| 6534 | if ((scan_params->obssScanPassiveTotalPerChannel > |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6535 | cfg_min(CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL)) && |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6536 | (scan_params->obssScanPassiveTotalPerChannel < |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6537 | cfg_max(CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL))) |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6538 | session->obss_ht40_scanparam.obss_passive_total_per_channel = |
| 6539 | scan_params->obssScanPassiveTotalPerChannel; |
| 6540 | |
| 6541 | if ((scan_params->bssChannelWidthTriggerScanInterval > |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6542 | cfg_min(CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL)) && |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6543 | (scan_params->bssChannelWidthTriggerScanInterval < |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6544 | cfg_max(CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL))) |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6545 | session->obss_ht40_scanparam.obss_width_trigger_interval = |
| 6546 | scan_params->bssChannelWidthTriggerScanInterval; |
| 6547 | |
| 6548 | if ((scan_params->obssScanActivityThreshold > |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6549 | cfg_min(CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD)) && |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6550 | (scan_params->obssScanActivityThreshold < |
Wu Gao | d8f3db0 | 2018-07-24 19:18:45 +0800 | [diff] [blame] | 6551 | cfg_max(CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD))) |
Sandeep Puligilla | e087566 | 2016-02-12 16:09:21 -0800 | [diff] [blame] | 6552 | session->obss_ht40_scanparam.obss_activity_threshold = |
| 6553 | scan_params->obssScanActivityThreshold; |
| 6554 | return; |
| 6555 | } |
Rajeev Kumar | 0320080 | 2016-04-15 13:59:36 -0700 | [diff] [blame] | 6556 | |
| 6557 | /** |
| 6558 | * lim_is_robust_mgmt_action_frame() - Check if action category is |
| 6559 | * robust action frame |
| 6560 | * @action_category: Action frame category. |
| 6561 | * |
| 6562 | * This function is used to check if given action category is robust |
| 6563 | * action frame. |
| 6564 | * |
| 6565 | * Return: bool |
| 6566 | */ |
| 6567 | bool lim_is_robust_mgmt_action_frame(uint8_t action_category) |
| 6568 | { |
| 6569 | switch (action_category) { |
| 6570 | /* |
| 6571 | * NOTE: This function doesn't take care of the DMG |
| 6572 | * (Directional Multi-Gigatbit) BSS case as 8011ad |
| 6573 | * support is not yet added. In future, if the support |
| 6574 | * is required then this function need few more arguments |
| 6575 | * and little change in logic. |
| 6576 | */ |
| 6577 | case SIR_MAC_ACTION_SPECTRUM_MGMT: |
| 6578 | case SIR_MAC_ACTION_QOS_MGMT: |
| 6579 | case SIR_MAC_ACTION_DLP: |
| 6580 | case SIR_MAC_ACTION_BLKACK: |
| 6581 | case SIR_MAC_ACTION_RRM: |
| 6582 | case SIR_MAC_ACTION_FAST_BSS_TRNST: |
| 6583 | case SIR_MAC_ACTION_SA_QUERY: |
| 6584 | case SIR_MAC_ACTION_PROT_DUAL_PUB: |
| 6585 | case SIR_MAC_ACTION_WNM: |
| 6586 | case SIR_MAC_ACITON_MESH: |
| 6587 | case SIR_MAC_ACTION_MHF: |
| 6588 | case SIR_MAC_ACTION_FST: |
| 6589 | return true; |
| 6590 | default: |
Naveen Rawat | 170420a | 2017-12-21 14:33:55 -0800 | [diff] [blame] | 6591 | pe_debug("non-PMF action category: %d", action_category); |
Rajeev Kumar | 0320080 | 2016-04-15 13:59:36 -0700 | [diff] [blame] | 6592 | break; |
| 6593 | } |
| 6594 | return false; |
| 6595 | } |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 6596 | |
| 6597 | /** |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 6598 | * lim_compute_ext_cap_ie_length - compute the length of ext cap ie |
| 6599 | * based on the bits set |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 6600 | * @ext_cap: extended IEs structure |
| 6601 | * |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 6602 | * Return: length of the ext cap ie, 0 means should not present |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 6603 | */ |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 6604 | uint8_t lim_compute_ext_cap_ie_length(tDot11fIEExtCap *ext_cap) |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 6605 | { |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 6606 | uint8_t i = DOT11F_IE_EXTCAP_MAX_LEN; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 6607 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 6608 | while (i) { |
| 6609 | if (ext_cap->bytes[i-1]) |
| 6610 | break; |
| 6611 | i--; |
| 6612 | } |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 6613 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 6614 | return i; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 6615 | } |
Selvaraj, Sridhar | af54e2e | 2016-06-24 12:25:02 +0530 | [diff] [blame] | 6616 | |
| 6617 | /** |
| 6618 | * lim_update_caps_info_for_bss - Update capability info for this BSS |
| 6619 | * |
| 6620 | * @mac_ctx: mac context |
| 6621 | * @caps: Pointer to capability info to be updated |
| 6622 | * @bss_caps: Capability info of the BSS |
| 6623 | * |
| 6624 | * Update the capability info in Assoc/Reassoc request frames and reset |
| 6625 | * the spectrum management, short preamble, immediate block ack bits |
| 6626 | * if the BSS doesnot support it |
| 6627 | * |
| 6628 | * Return: None |
| 6629 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6630 | void lim_update_caps_info_for_bss(struct mac_context *mac_ctx, |
Selvaraj, Sridhar | af54e2e | 2016-06-24 12:25:02 +0530 | [diff] [blame] | 6631 | uint16_t *caps, uint16_t bss_caps) |
| 6632 | { |
| 6633 | if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) { |
| 6634 | *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6635 | pe_debug("Clearing spectrum management:no AP support"); |
Selvaraj, Sridhar | af54e2e | 2016-06-24 12:25:02 +0530 | [diff] [blame] | 6636 | } |
| 6637 | |
| 6638 | if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) { |
| 6639 | *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6640 | pe_debug("Clearing short preamble:no AP support"); |
Selvaraj, Sridhar | af54e2e | 2016-06-24 12:25:02 +0530 | [diff] [blame] | 6641 | } |
| 6642 | |
| 6643 | if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) { |
| 6644 | *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6645 | pe_debug("Clearing Immed Blk Ack:no AP support"); |
Selvaraj, Sridhar | af54e2e | 2016-06-24 12:25:02 +0530 | [diff] [blame] | 6646 | } |
| 6647 | } |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 6648 | /** |
| 6649 | * lim_send_set_dtim_period(): Send SIR_HAL_SET_DTIM_PERIOD message |
| 6650 | * to set dtim period. |
| 6651 | * |
| 6652 | * @sesssion: LIM session |
| 6653 | * @dtim_period: dtim value |
| 6654 | * @mac_ctx: Mac context |
| 6655 | * @return None |
| 6656 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6657 | void lim_send_set_dtim_period(struct mac_context *mac_ctx, uint8_t dtim_period, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6658 | struct pe_session *session) |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 6659 | { |
| 6660 | struct set_dtim_params *dtim_params = NULL; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6661 | QDF_STATUS ret = QDF_STATUS_SUCCESS; |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 6662 | struct scheduler_msg msg = {0}; |
| 6663 | |
| 6664 | if (!session) { |
| 6665 | pe_err("Inavalid parameters"); |
| 6666 | return; |
| 6667 | } |
| 6668 | dtim_params = qdf_mem_malloc(sizeof(*dtim_params)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 6669 | if (!dtim_params) |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 6670 | return; |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 6671 | dtim_params->dtim_period = dtim_period; |
| 6672 | dtim_params->session_id = session->smeSessionId; |
| 6673 | msg.type = WMA_SET_DTIM_PERIOD; |
| 6674 | msg.bodyptr = dtim_params; |
| 6675 | msg.bodyval = 0; |
| 6676 | pe_debug("Post WMA_SET_DTIM_PERIOD to WMA"); |
| 6677 | ret = wma_post_ctrl_msg(mac_ctx, &msg); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6678 | if (QDF_STATUS_SUCCESS != ret) { |
Kiran Kumar Lokere | 6d3a30d | 2018-01-15 18:18:29 -0800 | [diff] [blame] | 6679 | pe_err("wma_post_ctrl_msg() failed"); |
| 6680 | qdf_mem_free(dtim_params); |
| 6681 | } |
| 6682 | } |
Arif Hussain | 776ee7a | 2016-11-10 20:28:50 -0800 | [diff] [blame] | 6683 | |
| 6684 | /** |
| 6685 | * lim_is_valid_frame(): validate RX frame using last processed frame details |
| 6686 | * to find if it is duplicate frame. |
| 6687 | * |
| 6688 | * @last_processed_frm: last processed frame pointer. |
| 6689 | * @pRxPacketInfo: RX packet. |
| 6690 | * |
| 6691 | * Frame treat as duplicate: |
| 6692 | * if retry bit is set and |
Jeff Johnson | 560dc56 | 2017-03-17 15:19:31 -0700 | [diff] [blame] | 6693 | * if source address and seq number matches with the last processed frame |
Arif Hussain | 776ee7a | 2016-11-10 20:28:50 -0800 | [diff] [blame] | 6694 | * |
| 6695 | * Return: false if duplicate frame, else true. |
| 6696 | */ |
| 6697 | bool lim_is_valid_frame(last_processed_msg *last_processed_frm, |
| 6698 | uint8_t *pRxPacketInfo) |
| 6699 | { |
| 6700 | uint16_t seq_num; |
| 6701 | tpSirMacMgmtHdr pHdr; |
| 6702 | |
| 6703 | if (!pRxPacketInfo) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6704 | pe_err("Invalid RX frame"); |
Arif Hussain | 776ee7a | 2016-11-10 20:28:50 -0800 | [diff] [blame] | 6705 | return false; |
| 6706 | } |
| 6707 | |
| 6708 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 6709 | |
| 6710 | if (pHdr->fc.retry == 0) |
| 6711 | return true; |
| 6712 | |
| 6713 | seq_num = (((pHdr->seqControl.seqNumHi << |
| 6714 | HIGH_SEQ_NUM_OFFSET) | |
| 6715 | pHdr->seqControl.seqNumLo)); |
| 6716 | |
| 6717 | if (last_processed_frm->seq_num == seq_num && |
| 6718 | qdf_mem_cmp(last_processed_frm->sa, pHdr->sa, ETH_ALEN) == 0) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6719 | pe_err("Duplicate frame from "MAC_ADDRESS_STR " Seq Number %d", |
Arif Hussain | 776ee7a | 2016-11-10 20:28:50 -0800 | [diff] [blame] | 6720 | MAC_ADDR_ARRAY(pHdr->sa), seq_num); |
| 6721 | return false; |
| 6722 | } |
| 6723 | return true; |
| 6724 | } |
| 6725 | |
| 6726 | /** |
| 6727 | * lim_update_last_processed_frame(): update new processed frame info to cache. |
| 6728 | * |
| 6729 | * @last_processed_frm: last processed frame pointer. |
| 6730 | * @pRxPacketInfo: Successfully processed RX packet. |
| 6731 | * |
| 6732 | * Return: None. |
| 6733 | */ |
| 6734 | void lim_update_last_processed_frame(last_processed_msg *last_processed_frm, |
| 6735 | uint8_t *pRxPacketInfo) |
| 6736 | { |
| 6737 | uint16_t seq_num; |
| 6738 | tpSirMacMgmtHdr pHdr; |
| 6739 | |
| 6740 | if (!pRxPacketInfo) { |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6741 | pe_err("Invalid RX frame"); |
Arif Hussain | 776ee7a | 2016-11-10 20:28:50 -0800 | [diff] [blame] | 6742 | return; |
| 6743 | } |
| 6744 | |
| 6745 | pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 6746 | seq_num = (((pHdr->seqControl.seqNumHi << |
| 6747 | HIGH_SEQ_NUM_OFFSET) | |
| 6748 | pHdr->seqControl.seqNumLo)); |
| 6749 | |
| 6750 | qdf_mem_copy(last_processed_frm->sa, pHdr->sa, ETH_ALEN); |
| 6751 | last_processed_frm->seq_num = seq_num; |
| 6752 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6753 | |
| 6754 | #ifdef WLAN_FEATURE_11AX |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6755 | void lim_add_he_cap(tpAddStaParams add_sta_params, tpSirAssocReq assoc_req) |
| 6756 | { |
| 6757 | if (!add_sta_params->he_capable || !assoc_req) |
| 6758 | return; |
| 6759 | |
| 6760 | qdf_mem_copy(&add_sta_params->he_config, &assoc_req->he_cap, |
| 6761 | sizeof(add_sta_params->he_config)); |
| 6762 | } |
| 6763 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6764 | void lim_add_self_he_cap(tpAddStaParams add_sta_params, struct pe_session *session) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6765 | { |
| 6766 | if (!session) |
| 6767 | return; |
| 6768 | |
| 6769 | add_sta_params->he_capable = true; |
| 6770 | |
| 6771 | qdf_mem_copy(&add_sta_params->he_config, &session->he_config, |
| 6772 | sizeof(add_sta_params->he_config)); |
| 6773 | qdf_mem_copy(&add_sta_params->he_op, &session->he_op, |
| 6774 | sizeof(add_sta_params->he_op)); |
| 6775 | } |
| 6776 | |
| 6777 | /** |
| 6778 | * lim_intersect_he_caps() - Intersect peer capability and self capability |
| 6779 | * @rcvd_he: pointer to received peer capability |
| 6780 | * @session_he: pointer to self capability |
| 6781 | * @peer_he: pointer to Intersected capability |
| 6782 | * |
| 6783 | * Return: None |
| 6784 | */ |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6785 | static void lim_intersect_he_caps(tDot11fIEhe_cap *rcvd_he, |
| 6786 | tDot11fIEhe_cap *session_he, |
| 6787 | tDot11fIEhe_cap *peer_he) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6788 | { |
| 6789 | uint8_t val; |
| 6790 | |
| 6791 | qdf_mem_copy(peer_he, rcvd_he, sizeof(*peer_he)); |
| 6792 | |
| 6793 | peer_he->fragmentation &= session_he->fragmentation; |
| 6794 | |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 6795 | if (session_he->tx_stbc_lt_80mhz && peer_he->rx_stbc_lt_80mhz) |
| 6796 | peer_he->rx_stbc_lt_80mhz = 1; |
| 6797 | else |
| 6798 | peer_he->rx_stbc_lt_80mhz = 0; |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 6799 | |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 6800 | if (session_he->rx_stbc_lt_80mhz && peer_he->tx_stbc_lt_80mhz) |
| 6801 | peer_he->tx_stbc_lt_80mhz = 1; |
| 6802 | else |
| 6803 | peer_he->tx_stbc_lt_80mhz = 0; |
| 6804 | |
| 6805 | if (session_he->tx_stbc_gt_80mhz && peer_he->rx_stbc_gt_80mhz) |
| 6806 | peer_he->rx_stbc_gt_80mhz = 1; |
| 6807 | else |
| 6808 | peer_he->rx_stbc_gt_80mhz = 0; |
| 6809 | |
| 6810 | if (session_he->rx_stbc_gt_80mhz && peer_he->tx_stbc_gt_80mhz) |
| 6811 | peer_he->tx_stbc_gt_80mhz = 1; |
| 6812 | else |
| 6813 | peer_he->tx_stbc_gt_80mhz = 0; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6814 | |
| 6815 | /* Tx Doppler is first bit and Rx Doppler is second bit */ |
| 6816 | if (session_he->doppler) { |
| 6817 | val = 0; |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 6818 | if ((session_he->doppler & 0x1) && (peer_he->doppler & 0x10)) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6819 | val |= (1 << 1); |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 6820 | if ((session_he->doppler & 0x10) && (peer_he->doppler & 0x1)) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6821 | val |= (1 << 0); |
| 6822 | peer_he->doppler = val; |
| 6823 | } |
| 6824 | |
| 6825 | peer_he->su_beamformer = session_he->su_beamformee ? |
| 6826 | peer_he->su_beamformer : 0; |
| 6827 | peer_he->su_beamformee = (session_he->su_beamformer || |
| 6828 | session_he->mu_beamformer) ? |
| 6829 | peer_he->su_beamformee : 0; |
| 6830 | peer_he->mu_beamformer = session_he->su_beamformee ? |
| 6831 | peer_he->mu_beamformer : 0; |
| 6832 | |
| 6833 | peer_he->twt_request = session_he->twt_responder ? |
| 6834 | peer_he->twt_request : 0; |
| 6835 | peer_he->twt_responder = session_he->twt_request ? |
| 6836 | peer_he->twt_responder : 0; |
| 6837 | } |
| 6838 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6839 | void lim_intersect_sta_he_caps(tpSirAssocReq assoc_req, struct pe_session *session, |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6840 | tpDphHashNode sta_ds) |
| 6841 | { |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6842 | tDot11fIEhe_cap *rcvd_he = &assoc_req->he_cap; |
| 6843 | tDot11fIEhe_cap *session_he = &session->he_config; |
| 6844 | tDot11fIEhe_cap *peer_he = &sta_ds->he_config; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6845 | |
| 6846 | if (sta_ds->mlmStaContext.he_capable) |
| 6847 | lim_intersect_he_caps(rcvd_he, session_he, peer_he); |
| 6848 | } |
| 6849 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6850 | void lim_intersect_ap_he_caps(struct pe_session *session, tpAddBssParams add_bss, |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6851 | tSchBeaconStruct *beacon, tpSirAssocRsp assoc_rsp) |
| 6852 | { |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6853 | tDot11fIEhe_cap *rcvd_he; |
| 6854 | tDot11fIEhe_cap *session_he = &session->he_config; |
| 6855 | tDot11fIEhe_cap *peer_he = &add_bss->staContext.he_config; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6856 | |
| 6857 | if (beacon) |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6858 | rcvd_he = &beacon->he_cap; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6859 | else |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6860 | rcvd_he = &assoc_rsp->he_cap; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6861 | |
| 6862 | lim_intersect_he_caps(rcvd_he, session_he, peer_he); |
| 6863 | add_bss->staContext.he_capable = true; |
| 6864 | } |
| 6865 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6866 | void lim_add_bss_he_cap(tpAddBssParams add_bss, tpSirAssocRsp assoc_rsp) |
| 6867 | { |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6868 | tDot11fIEhe_cap *he_cap; |
| 6869 | tDot11fIEhe_op *he_op; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6870 | |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6871 | he_cap = &assoc_rsp->he_cap; |
| 6872 | he_op = &assoc_rsp->he_op; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6873 | add_bss->he_capable = he_cap->present; |
| 6874 | if (he_cap) |
| 6875 | qdf_mem_copy(&add_bss->staContext.he_config, |
| 6876 | he_cap, sizeof(*he_cap)); |
| 6877 | if (he_op) |
| 6878 | qdf_mem_copy(&add_bss->staContext.he_op, |
| 6879 | he_op, sizeof(*he_op)); |
| 6880 | } |
| 6881 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6882 | void lim_add_bss_he_cfg(tpAddBssParams add_bss, struct pe_session *session) |
Manikandan Mohan | 39accff | 2017-05-02 16:09:00 -0700 | [diff] [blame] | 6883 | { |
| 6884 | add_bss->he_sta_obsspd = session->he_sta_obsspd; |
| 6885 | } |
| 6886 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6887 | void lim_update_stads_he_caps(tpDphHashNode sta_ds, tpSirAssocRsp assoc_rsp, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6888 | struct pe_session *session_entry) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6889 | { |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6890 | tDot11fIEhe_cap *he_cap; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6891 | |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6892 | he_cap = &assoc_rsp->he_cap; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6893 | sta_ds->mlmStaContext.he_capable = he_cap->present; |
| 6894 | |
| 6895 | if (!he_cap->present) |
| 6896 | return; |
| 6897 | |
| 6898 | qdf_mem_copy(&sta_ds->he_config, he_cap, sizeof(*he_cap)); |
| 6899 | |
| 6900 | } |
| 6901 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6902 | void lim_update_usr_he_cap(struct mac_context *mac_ctx, struct pe_session *session) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6903 | { |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6904 | tSirAddIeParams *add_ie = &session->addIeParams; |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6905 | tDot11fIEhe_cap *he_cap = &session->he_config; |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6906 | struct he_cap_network_endian *he_cap_from_ie; |
Kiran Kumar Lokere | 3a5b424 | 2018-01-04 16:25:02 -0800 | [diff] [blame] | 6907 | uint8_t extracted_buff[DOT11F_IE_HE_CAP_MAX_LEN + 2]; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6908 | QDF_STATUS status; |
Kiran Kumar Lokere | 3a5b424 | 2018-01-04 16:25:02 -0800 | [diff] [blame] | 6909 | qdf_mem_zero(extracted_buff, sizeof(extracted_buff)); |
| 6910 | status = lim_strip_ie(mac_ctx, add_ie->probeRespBCNData_buff, |
| 6911 | &add_ie->probeRespBCNDataLen, |
| 6912 | DOT11F_EID_HE_CAP, ONE_BYTE, |
| 6913 | HE_CAP_OUI_TYPE, (uint8_t)HE_CAP_OUI_SIZE, |
| 6914 | extracted_buff, DOT11F_IE_HE_CAP_MAX_LEN); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6915 | if (QDF_STATUS_SUCCESS != status) { |
Kiran Kumar Lokere | 3a5b424 | 2018-01-04 16:25:02 -0800 | [diff] [blame] | 6916 | pe_debug("Failed to strip HE cap IE status: %d", status); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6917 | return; |
| 6918 | } |
| 6919 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6920 | pe_debug("Before update: su_beamformer: %d, su_beamformee: %d, mu_beamformer: %d", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6921 | he_cap->su_beamformer, he_cap->su_beamformee, he_cap->mu_beamformer); |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6922 | |
Kiran Kumar Lokere | 3a5b424 | 2018-01-04 16:25:02 -0800 | [diff] [blame] | 6923 | he_cap_from_ie = (struct he_cap_network_endian *) |
| 6924 | &extracted_buff[HE_CAP_OUI_SIZE + 2]; |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6925 | |
| 6926 | he_cap->su_beamformer = |
| 6927 | he_cap->su_beamformer & he_cap_from_ie->su_beamformer; |
| 6928 | he_cap->su_beamformee = |
| 6929 | he_cap->su_beamformee & he_cap_from_ie->su_beamformee; |
| 6930 | he_cap->mu_beamformer = |
| 6931 | he_cap->mu_beamformer & he_cap_from_ie->mu_beamformer; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6932 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 6933 | pe_debug("After update: su_beamformer: %d, su_beamformee: %d, mu_beamformer: %d", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6934 | he_cap->su_beamformer, he_cap->su_beamformee, he_cap->mu_beamformer); |
| 6935 | } |
| 6936 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 6937 | void lim_decide_he_op(struct mac_context *mac_ctx, tpAddBssParams add_bss, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6938 | struct pe_session *session) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6939 | { |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6940 | uint32_t val; |
Naveen Rawat | 807b6d0 | 2018-03-07 18:19:06 -0800 | [diff] [blame] | 6941 | uint8_t color; |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6942 | struct he_ops_network_endian *he_ops_from_ie; |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 6943 | tDot11fIEhe_op *he_ops = &add_bss->he_op; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6944 | tSirAddIeParams *add_ie = &session->addIeParams; |
Kiran Kumar Lokere | 3a5b424 | 2018-01-04 16:25:02 -0800 | [diff] [blame] | 6945 | uint8_t extracted_buff[DOT11F_IE_HE_OP_MAX_LEN + 2]; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6946 | QDF_STATUS status; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6947 | |
Kiran Kumar Lokere | 3a5b424 | 2018-01-04 16:25:02 -0800 | [diff] [blame] | 6948 | qdf_mem_zero(extracted_buff, sizeof(extracted_buff)); |
| 6949 | status = lim_strip_ie(mac_ctx, add_ie->probeRespBCNData_buff, |
| 6950 | &add_ie->probeRespBCNDataLen, |
| 6951 | DOT11F_EID_HE_OP, ONE_BYTE, |
| 6952 | HE_OP_OUI_TYPE, (uint8_t)HE_OP_OUI_SIZE, |
| 6953 | extracted_buff, DOT11F_IE_HE_OP_MAX_LEN); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 6954 | if (QDF_STATUS_SUCCESS != status) { |
Kiran Kumar Lokere | 3a5b424 | 2018-01-04 16:25:02 -0800 | [diff] [blame] | 6955 | pe_debug("Failed to strip HE OP IE status: %d", status); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6956 | return; |
| 6957 | } |
Kiran Kumar Lokere | 3a5b424 | 2018-01-04 16:25:02 -0800 | [diff] [blame] | 6958 | he_ops_from_ie = (struct he_ops_network_endian *) |
| 6959 | &extracted_buff[HE_OP_OUI_SIZE + 2]; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6960 | |
Naveen Rawat | 807b6d0 | 2018-03-07 18:19:06 -0800 | [diff] [blame] | 6961 | if (he_ops_from_ie->bss_color) { |
| 6962 | he_ops->bss_color = he_ops_from_ie->bss_color; |
| 6963 | } else { |
| 6964 | cds_rand_get_bytes(0, &color, 1); |
| 6965 | /* make sure color is within 1-63*/ |
| 6966 | he_ops->bss_color = (color % WNI_CFG_HE_OPS_BSS_COLOR_MAX) + 1; |
| 6967 | } |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6968 | he_ops->default_pe = he_ops_from_ie->default_pe; |
| 6969 | he_ops->twt_required = he_ops_from_ie->twt_required; |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 6970 | he_ops->txop_rts_threshold = he_ops_from_ie->txop_rts_threshold; |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6971 | he_ops->partial_bss_col = he_ops_from_ie->partial_bss_col; |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6972 | he_ops->bss_col_disabled = he_ops_from_ie->bss_col_disabled; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6973 | |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 6974 | val = mac_ctx->mlme_cfg->he_caps.he_ops_basic_mcs_nss; |
| 6975 | |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6976 | *((uint16_t *)he_ops->basic_mcs_nss) = (uint16_t)val; |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6977 | |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6978 | qdf_mem_copy(&session->he_op, he_ops, sizeof(*he_ops)); |
| 6979 | |
| 6980 | pe_debug("HE Op: bss_color: 0x%0x, default_pe_duration: 0x%0x", |
| 6981 | he_ops->bss_color, he_ops->default_pe); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 6982 | pe_debug("He Op: twt_required: 0x%0x, txop_rts_threshold: 0x%0x", |
| 6983 | he_ops->twt_required, he_ops->txop_rts_threshold); |
| 6984 | pe_debug("HE Op: partial_bss_color: 0x%0x", |
| 6985 | he_ops->partial_bss_col); |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6986 | pe_debug("HE Op: BSS color disabled: 0x%0x", |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 6987 | he_ops->bss_col_disabled); |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 6988 | pe_debug("HE Op: Basic MCS NSS: 0x%04x", |
| 6989 | *((uint16_t *)he_ops->basic_mcs_nss)); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6990 | } |
| 6991 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6992 | void lim_copy_bss_he_cap(struct pe_session *session, |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 6993 | tpSirSmeStartBssReq sme_start_bss_req) |
| 6994 | { |
| 6995 | qdf_mem_copy(&(session->he_config), &(sme_start_bss_req->he_config), |
| 6996 | sizeof(session->he_config)); |
| 6997 | } |
| 6998 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 6999 | void lim_copy_join_req_he_cap(struct pe_session *session, |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7000 | tpSirSmeJoinReq sme_join_req) |
| 7001 | { |
| 7002 | qdf_mem_copy(&(session->he_config), &(sme_join_req->he_config), |
| 7003 | sizeof(session->he_config)); |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7004 | |
| 7005 | if (session->ch_width <= CH_WIDTH_80MHZ) { |
| 7006 | *(uint16_t *)session->he_config.rx_he_mcs_map_160 = |
| 7007 | HE_MCS_ALL_DISABLED; |
| 7008 | *(uint16_t *)session->he_config.tx_he_mcs_map_160 = |
| 7009 | HE_MCS_ALL_DISABLED; |
| 7010 | *(uint16_t *)session->he_config.rx_he_mcs_map_80_80 = |
| 7011 | HE_MCS_ALL_DISABLED; |
| 7012 | *(uint16_t *)session->he_config.tx_he_mcs_map_80_80 = |
| 7013 | HE_MCS_ALL_DISABLED; |
| 7014 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7015 | } |
| 7016 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7017 | void lim_log_he_cap(struct mac_context *mac, tDot11fIEhe_cap *he_cap) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7018 | { |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7019 | uint8_t chan_width; |
Naveen Rawat | 819158d | 2018-01-16 10:56:45 -0800 | [diff] [blame] | 7020 | struct ppet_hdr *hdr; |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7021 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7022 | if (!he_cap->present) |
| 7023 | return; |
| 7024 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7025 | pe_debug("HE Capabilities:"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7026 | |
| 7027 | /* HE MAC capabilities */ |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7028 | pe_debug("\tHTC-HE conrol: 0x%01x", he_cap->htc_he); |
| 7029 | pe_debug("\tTWT Requestor support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7030 | he_cap->twt_request); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7031 | pe_debug("\tTWT Responder support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7032 | he_cap->twt_responder); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7033 | pe_debug("\tFragmentation support: 0x%02x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7034 | he_cap->fragmentation); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7035 | pe_debug("\tMax no.of frag MSDUs: 0x%03x", |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7036 | he_cap->max_num_frag_msdu_amsdu_exp); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7037 | pe_debug("\tMin. frag size: 0x%02x", he_cap->min_frag_size); |
| 7038 | pe_debug("\tTrigger MAC pad duration: 0x%02x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7039 | he_cap->trigger_frm_mac_pad); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7040 | pe_debug("\tMulti-TID aggr Rx support: 0x%03x", |
| 7041 | he_cap->multi_tid_aggr_rx_supp); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7042 | pe_debug("\tLink adaptation: 0x%02x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7043 | he_cap->he_link_adaptation); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7044 | pe_debug("\tAll ACK support: 0x%01x", he_cap->all_ack); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7045 | pe_debug("\tTriggered resp. scheduling: 0x%01x", |
| 7046 | he_cap->trigd_rsp_sched); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7047 | pe_debug("\tA-Buff status report: 0x%01x", he_cap->a_bsr); |
| 7048 | pe_debug("\tBroadcast TWT support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7049 | he_cap->broadcast_twt); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7050 | pe_debug("\t32bit BA bitmap support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7051 | he_cap->ba_32bit_bitmap); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7052 | pe_debug("\tMU Cascading support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7053 | he_cap->mu_cascade); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7054 | pe_debug("\tACK enabled Multi-TID: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7055 | he_cap->ack_enabled_multitid); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7056 | pe_debug("\tOMI A-Control support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7057 | he_cap->omi_a_ctrl); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7058 | pe_debug("\tOFDMA RA support: 0x%01x", he_cap->ofdma_ra); |
| 7059 | pe_debug("\tMax A-MPDU Length: 0x%02x", |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7060 | he_cap->max_ampdu_len_exp_ext); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7061 | pe_debug("\tA-MSDU Fragmentation: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7062 | he_cap->amsdu_frag); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7063 | pe_debug("\tFlex. TWT sched support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7064 | he_cap->flex_twt_sched); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7065 | pe_debug("\tRx Ctrl frame to MBSS: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7066 | he_cap->rx_ctrl_frame); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7067 | pe_debug("\tBSRP A-MPDU Aggregation: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7068 | he_cap->bsrp_ampdu_aggr); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7069 | pe_debug("\tQuite Time Period support: 0x%01x", he_cap->qtp); |
| 7070 | pe_debug("\tA-BQR support: 0x%01x", he_cap->a_bqr); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7071 | pe_debug("\tSR Reponder support: 0x%01x", |
| 7072 | he_cap->spatial_reuse_param_rspder); |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7073 | pe_debug("\tNDP Feedback support: 0x%01x", he_cap->ndp_feedback_supp); |
| 7074 | pe_debug("\tOPS support: 0x%01x", he_cap->ops_supp); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7075 | pe_debug("\tAMSDU in AMPDU: 0x%01x", he_cap->amsdu_in_ampdu); |
| 7076 | pe_debug("\tMulti-TID aggr Tx support: 0x%03x", |
| 7077 | he_cap->multi_tid_aggr_tx_supp); |
| 7078 | pe_debug("\tHE sub ch sel tx supp: 0x%01x", |
| 7079 | he_cap->he_sub_ch_sel_tx_supp); |
| 7080 | pe_debug("\tUL 2x996 tone RU supp: 0x%01x", |
| 7081 | he_cap->ul_2x996_tone_ru_supp); |
| 7082 | pe_debug("\tOM ctrl UL MU data dis rx supp: 0x%01x", |
| 7083 | he_cap->om_ctrl_ul_mu_data_dis_rx); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7084 | /* HE PHY capabilities */ |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7085 | chan_width = HE_CH_WIDTH_COMBINE(he_cap->chan_width_0, |
| 7086 | he_cap->chan_width_1, he_cap->chan_width_2, |
| 7087 | he_cap->chan_width_3, he_cap->chan_width_4, |
| 7088 | he_cap->chan_width_5, he_cap->chan_width_6); |
| 7089 | |
| 7090 | pe_debug("\tChannel width support: 0x%07x", chan_width); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7091 | pe_debug("\tPreamble puncturing Rx: 0x%04x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7092 | he_cap->rx_pream_puncturing); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7093 | pe_debug("\tClass of device: 0x%01x", he_cap->device_class); |
| 7094 | pe_debug("\tLDPC coding support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7095 | he_cap->ldpc_coding); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7096 | pe_debug("\tLTF and GI for HE PPDUs: 0x%02x", |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7097 | he_cap->he_1x_ltf_800_gi_ppdu); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7098 | pe_debug("\tMidamble TX Rx MAX NSTS: 0x%02x", |
| 7099 | he_cap->midamble_tx_rx_max_nsts); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7100 | pe_debug("\tLTF and GI for NDP: 0x%02x", |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7101 | he_cap->he_4x_ltf_3200_gi_ndp); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 7102 | pe_debug("\tSTBC Tx support (<= 80MHz): 0x%01x", |
| 7103 | he_cap->tx_stbc_lt_80mhz); |
| 7104 | pe_debug("\tSTBC Rx support (<= 80MHz): 0x%01x", |
| 7105 | he_cap->rx_stbc_lt_80mhz); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7106 | pe_debug("\tDoppler support: 0x%02x", he_cap->doppler); |
| 7107 | pe_debug("\tUL MU: 0x%02x", he_cap->ul_mu); |
| 7108 | pe_debug("\tDCM encoding Tx: 0x%03x", he_cap->dcm_enc_tx); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7109 | pe_debug("\tDCM encoding Rx: 0x%03x", he_cap->dcm_enc_rx); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7110 | pe_debug("\tHE MU PPDU payload support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7111 | he_cap->ul_he_mu); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7112 | pe_debug("\tSU Beamformer: 0x%01x", he_cap->su_beamformer); |
| 7113 | pe_debug("\tSU Beamformee: 0x%01x", he_cap->su_beamformee); |
| 7114 | pe_debug("\tMU Beamformer: 0x%01x", he_cap->mu_beamformer); |
| 7115 | pe_debug("\tBeamformee STS for <= 80Mhz: 0x%03x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7116 | he_cap->bfee_sts_lt_80); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7117 | pe_debug("\tBeamformee STS for > 80Mhz: 0x%03x", |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7118 | he_cap->bfee_sts_gt_80); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7119 | pe_debug("\tNo. of sounding dim <= 80Mhz: 0x%03x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7120 | he_cap->num_sounding_lt_80); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7121 | pe_debug("\tNo. of sounding dim > 80Mhz: 0x%03x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7122 | he_cap->num_sounding_gt_80); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7123 | pe_debug("\tNg=16 for SU feedback support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7124 | he_cap->su_feedback_tone16); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7125 | pe_debug("\tNg=16 for MU feedback support: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7126 | he_cap->mu_feedback_tone16); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7127 | pe_debug("\tCodebook size for SU: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7128 | he_cap->codebook_su); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7129 | pe_debug("\tCodebook size for MU: 0x%01x ", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7130 | he_cap->codebook_mu); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7131 | pe_debug("\tBeamforming trigger w/ Trigger: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7132 | he_cap->beamforming_feedback); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7133 | pe_debug("\tHE ER SU PPDU payload: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7134 | he_cap->he_er_su_ppdu); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7135 | pe_debug("\tDL MUMIMO on partial BW: 0x%01x", |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7136 | he_cap->dl_mu_mimo_part_bw); |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7137 | pe_debug("\tPPET present: 0x%01x", he_cap->ppet_present); |
| 7138 | pe_debug("\tSRP based SR-support: 0x%01x", he_cap->srp); |
| 7139 | pe_debug("\tPower boost factor: 0x%01x", he_cap->power_boost); |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7140 | pe_debug("\t4x HE LTF support: 0x%01x", he_cap->he_ltf_800_gi_4x); |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 7141 | pe_debug("\tSTBC Tx support (> 80MHz): 0x%01x", |
| 7142 | he_cap->tx_stbc_gt_80mhz); |
| 7143 | pe_debug("\tSTBC Rx support (> 80MHz): 0x%01x", |
| 7144 | he_cap->rx_stbc_gt_80mhz); |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7145 | pe_debug("\tMax Nc: 0x%03x", he_cap->max_nc); |
| 7146 | pe_debug("\tER 4x HE LTF support: 0x%01x", he_cap->er_he_ltf_800_gi_4x); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7147 | pe_debug("\tHE ppdu 20 in 40M in 2.4G: 0x%01x", |
Naveen Rawat | fc53031 | 2017-10-23 14:34:12 -0700 | [diff] [blame] | 7148 | he_cap->he_ppdu_20_in_40Mhz_2G); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7149 | pe_debug("\tHE ppdu 20 in 160 and 80p80: 0x%01x", |
Naveen Rawat | fc53031 | 2017-10-23 14:34:12 -0700 | [diff] [blame] | 7150 | he_cap->he_ppdu_20_in_160_80p80Mhz); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7151 | pe_debug("\tHE ppdu 80 in 160 and 80p80: 0x%01x", |
Naveen Rawat | fc53031 | 2017-10-23 14:34:12 -0700 | [diff] [blame] | 7152 | he_cap->he_ppdu_80_in_160_80p80Mhz); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7153 | pe_debug("\tER 1x HE LTF GI support: 0x%01x", |
Naveen Rawat | fc53031 | 2017-10-23 14:34:12 -0700 | [diff] [blame] | 7154 | he_cap->er_1x_he_ltf_gi); |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7155 | pe_debug("\tmidamble txrx 1x he LTF: 0x%01x", |
| 7156 | he_cap->midamble_tx_rx_1x_he_ltf); |
| 7157 | pe_debug("\tDCM max BW: 0x%02x", |
| 7158 | he_cap->dcm_max_bw); |
| 7159 | pe_debug("\tlonger_than_16_he_sigb_ofdm_sym: 0x%01x", |
| 7160 | he_cap->longer_than_16_he_sigb_ofdm_sym); |
| 7161 | pe_debug("\tnon_trig_cqi_feedback: 0x%01x", |
| 7162 | he_cap->non_trig_cqi_feedback); |
| 7163 | pe_debug("\ttx_1024_qam_lt_242_tone_ru: 0x%01x", |
| 7164 | he_cap->tx_1024_qam_lt_242_tone_ru); |
| 7165 | pe_debug("\trx_1024_qam_lt_242_tone_ru: 0x%01x", |
| 7166 | he_cap->rx_1024_qam_lt_242_tone_ru); |
| 7167 | pe_debug("\trx_full_bw_su_he_mu_compress_sigb: 0x%01x", |
| 7168 | he_cap->rx_full_bw_su_he_mu_compress_sigb); |
| 7169 | pe_debug("\trx_full_bw_su_he_mu_non_cmpr_sigb: 0x%01x", |
| 7170 | he_cap->rx_full_bw_su_he_mu_non_cmpr_sigb); |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7171 | pe_debug("\tRx MCS map for <= 80 Mhz: 0x%04x", |
| 7172 | he_cap->rx_he_mcs_map_lt_80); |
| 7173 | pe_debug("\tTx MCS map for <= 80 Mhz: 0x%04x", |
| 7174 | he_cap->tx_he_mcs_map_lt_80); |
| 7175 | pe_debug("\tRx MCS map for <= 160 Mhz: 0x%04x", |
| 7176 | *((uint16_t *)he_cap->rx_he_mcs_map_160)); |
| 7177 | pe_debug("\tTx MCS map for <= 160 Mhz: 0x%04x", |
| 7178 | *((uint16_t *)he_cap->tx_he_mcs_map_160)); |
| 7179 | pe_debug("\tRx MCS map for <= 80+80 Mhz: 0x%04x", |
| 7180 | *((uint16_t *)he_cap->rx_he_mcs_map_80_80)); |
| 7181 | pe_debug("\tTx MCS map for <= 80+80 Mhz: 0x%04x", |
| 7182 | *((uint16_t *)he_cap->tx_he_mcs_map_80_80)); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7183 | |
Naveen Rawat | 819158d | 2018-01-16 10:56:45 -0800 | [diff] [blame] | 7184 | hdr = (struct ppet_hdr *)&he_cap->ppet; |
| 7185 | pe_debug("\t ppe_th:: nss_count: %d, ru_idx_msk: %d", |
| 7186 | hdr->nss, hdr->ru_idx_mask); |
Naveen Rawat | 0121376 | 2018-01-04 17:25:31 -0800 | [diff] [blame] | 7187 | |
| 7188 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 819158d | 2018-01-16 10:56:45 -0800 | [diff] [blame] | 7189 | &he_cap->ppet, HE_MAX_PPET_SIZE); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7190 | } |
| 7191 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7192 | void lim_log_he_op(struct mac_context *mac, tDot11fIEhe_op *he_ops) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7193 | { |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7194 | pe_debug("bss_color: %0x, default_pe_duration: %0x, twt_required: %0x, txop_rts_threshold: %0x, vht_oper_present: %0x", |
| 7195 | he_ops->bss_color, he_ops->default_pe, |
| 7196 | he_ops->twt_required, he_ops->txop_rts_threshold, |
| 7197 | he_ops->vht_oper_present); |
| 7198 | pe_debug("\tpart_bss_color %0x, Co-located BSS %0x, BSS color dis %0x", |
| 7199 | he_ops->partial_bss_col, he_ops->co_located_bss, |
| 7200 | he_ops->bss_col_disabled); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7201 | |
Naveen Rawat | 436979b | 2017-11-15 14:53:30 -0800 | [diff] [blame] | 7202 | pe_debug("he basic mcs nss: 0x%04x", |
| 7203 | *((uint16_t *)he_ops->basic_mcs_nss)); |
| 7204 | |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7205 | if (he_ops->vht_oper_present) |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7206 | pe_debug("VHT Info not present in HE Operation"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7207 | else |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7208 | pe_debug("VHT Info: chan_width: %d, center_freq0: %d, center_freq1: %d", |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7209 | he_ops->vht_oper.info.chan_width, |
| 7210 | he_ops->vht_oper.info.center_freq_seg0, |
| 7211 | he_ops->vht_oper.info.center_freq_seg1); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7212 | } |
| 7213 | |
Peng Xu | 6363ec6 | 2017-05-15 11:06:33 -0700 | [diff] [blame] | 7214 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7215 | void lim_log_he_bss_color(struct mac_context *mac, |
Peng Xu | 6363ec6 | 2017-05-15 11:06:33 -0700 | [diff] [blame] | 7216 | tDot11fIEbss_color_change *he_bss_color) |
| 7217 | { |
| 7218 | pe_debug("countdown: %d, new_color: %d", |
| 7219 | he_bss_color->countdown, he_bss_color->new_color); |
| 7220 | } |
| 7221 | #endif |
| 7222 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7223 | void lim_update_sta_he_capable(struct mac_context *mac, |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7224 | tpAddStaParams add_sta_params, tpDphHashNode sta_ds, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 7225 | struct pe_session *session_entry) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7226 | { |
| 7227 | if (LIM_IS_AP_ROLE(session_entry) || LIM_IS_IBSS_ROLE(session_entry)) |
| 7228 | add_sta_params->he_capable = sta_ds->mlmStaContext.he_capable; |
| 7229 | else |
| 7230 | add_sta_params->he_capable = session_entry->he_capable; |
| 7231 | |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7232 | pe_debug("he_capable: %d", add_sta_params->he_capable); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7233 | } |
| 7234 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7235 | void lim_update_bss_he_capable(struct mac_context *mac, tpAddBssParams add_bss) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7236 | { |
| 7237 | add_bss->he_capable = true; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7238 | pe_debug("he_capable: %d", add_bss->he_capable); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7239 | } |
| 7240 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7241 | void lim_update_stads_he_capable(tpDphHashNode sta_ds, tpSirAssocReq assoc_req) |
| 7242 | { |
| 7243 | sta_ds->mlmStaContext.he_capable = assoc_req->he_cap.present; |
| 7244 | } |
| 7245 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7246 | void lim_update_session_he_capable(struct mac_context *mac, struct pe_session *session) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7247 | { |
| 7248 | session->he_capable = true; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7249 | pe_debug("he_capable: %d", session->he_capable); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7250 | } |
| 7251 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7252 | void lim_update_chan_he_capable(struct mac_context *mac, tpSwitchChannelParams chan) |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7253 | { |
| 7254 | chan->he_capable = true; |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7255 | pe_debug("he_capable: %d", chan->he_capable); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7256 | } |
| 7257 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7258 | void lim_set_he_caps(struct mac_context *mac, struct pe_session *session, uint8_t *ie_start, |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7259 | uint32_t num_bytes) |
| 7260 | { |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 7261 | const uint8_t *ie = NULL; |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 7262 | tDot11fIEhe_cap dot11_cap; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7263 | struct he_capability_info *he_cap; |
| 7264 | |
| 7265 | populate_dot11f_he_caps(mac, session, &dot11_cap); |
| 7266 | lim_log_he_cap(mac, &dot11_cap); |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 7267 | ie = wlan_get_ext_ie_ptr_from_ext_id(HE_CAP_OUI_TYPE, |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7268 | HE_CAP_OUI_SIZE, ie_start, num_bytes); |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7269 | if (ie) { |
| 7270 | /* convert from unpacked to packed structure */ |
| 7271 | he_cap = (struct he_capability_info *) &ie[2 + HE_CAP_OUI_SIZE]; |
| 7272 | |
| 7273 | he_cap->htc_he = dot11_cap.htc_he; |
| 7274 | he_cap->twt_request = dot11_cap.twt_request; |
| 7275 | he_cap->twt_responder = dot11_cap.twt_responder; |
| 7276 | he_cap->fragmentation = dot11_cap.fragmentation; |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7277 | he_cap->max_num_frag_msdu_amsdu_exp = |
| 7278 | dot11_cap.max_num_frag_msdu_amsdu_exp; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7279 | he_cap->min_frag_size = dot11_cap.min_frag_size; |
| 7280 | he_cap->trigger_frm_mac_pad = dot11_cap.trigger_frm_mac_pad; |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7281 | he_cap->multi_tid_aggr_rx_supp = |
| 7282 | dot11_cap.multi_tid_aggr_rx_supp; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7283 | he_cap->he_link_adaptation = dot11_cap.he_link_adaptation; |
| 7284 | he_cap->all_ack = dot11_cap.all_ack; |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7285 | he_cap->trigd_rsp_sched = dot11_cap.trigd_rsp_sched; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7286 | he_cap->a_bsr = dot11_cap.a_bsr; |
| 7287 | he_cap->broadcast_twt = dot11_cap.broadcast_twt; |
| 7288 | he_cap->ba_32bit_bitmap = dot11_cap.ba_32bit_bitmap; |
| 7289 | he_cap->mu_cascade = dot11_cap.mu_cascade; |
| 7290 | he_cap->ack_enabled_multitid = dot11_cap.ack_enabled_multitid; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7291 | he_cap->omi_a_ctrl = dot11_cap.omi_a_ctrl; |
| 7292 | he_cap->ofdma_ra = dot11_cap.ofdma_ra; |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7293 | he_cap->max_ampdu_len_exp_ext = dot11_cap.max_ampdu_len_exp_ext; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7294 | he_cap->amsdu_frag = dot11_cap.amsdu_frag; |
| 7295 | he_cap->flex_twt_sched = dot11_cap.flex_twt_sched; |
| 7296 | he_cap->rx_ctrl_frame = dot11_cap.rx_ctrl_frame; |
| 7297 | |
| 7298 | he_cap->bsrp_ampdu_aggr = dot11_cap.bsrp_ampdu_aggr; |
| 7299 | he_cap->qtp = dot11_cap.qtp; |
| 7300 | he_cap->a_bqr = dot11_cap.a_bqr; |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7301 | he_cap->spatial_reuse_param_rspder = |
| 7302 | dot11_cap.spatial_reuse_param_rspder; |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7303 | he_cap->ops_supp = dot11_cap.ops_supp; |
| 7304 | he_cap->ndp_feedback_supp = dot11_cap.ndp_feedback_supp; |
Naveen Rawat | fc53031 | 2017-10-23 14:34:12 -0700 | [diff] [blame] | 7305 | he_cap->amsdu_in_ampdu = dot11_cap.amsdu_in_ampdu; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7306 | he_cap->reserved1 = dot11_cap.reserved1; |
| 7307 | |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7308 | he_cap->chan_width = HE_CH_WIDTH_COMBINE(dot11_cap.chan_width_0, |
| 7309 | dot11_cap.chan_width_1, dot11_cap.chan_width_2, |
| 7310 | dot11_cap.chan_width_3, dot11_cap.chan_width_4, |
| 7311 | dot11_cap.chan_width_5, dot11_cap.chan_width_6); |
| 7312 | |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7313 | he_cap->rx_pream_puncturing = dot11_cap.rx_pream_puncturing; |
| 7314 | he_cap->device_class = dot11_cap.device_class; |
| 7315 | he_cap->ldpc_coding = dot11_cap.ldpc_coding; |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7316 | he_cap->he_1x_ltf_800_gi_ppdu = dot11_cap.he_1x_ltf_800_gi_ppdu; |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7317 | he_cap->midamble_tx_rx_max_nsts = |
| 7318 | dot11_cap.midamble_tx_rx_max_nsts; |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7319 | he_cap->he_4x_ltf_3200_gi_ndp = dot11_cap.he_4x_ltf_3200_gi_ndp; |
Kiran Kumar Lokere | 13dedac | 2018-02-05 19:51:59 -0800 | [diff] [blame] | 7320 | he_cap->tx_stbc_lt_80mhz = dot11_cap.tx_stbc_lt_80mhz; |
| 7321 | he_cap->rx_stbc_lt_80mhz = dot11_cap.rx_stbc_lt_80mhz; |
| 7322 | he_cap->tx_stbc_gt_80mhz = dot11_cap.tx_stbc_gt_80mhz; |
| 7323 | he_cap->rx_stbc_gt_80mhz = dot11_cap.rx_stbc_gt_80mhz; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7324 | he_cap->doppler = dot11_cap.doppler; |
| 7325 | he_cap->ul_mu = dot11_cap.ul_mu; |
| 7326 | he_cap->dcm_enc_tx = dot11_cap.dcm_enc_tx; |
| 7327 | he_cap->dcm_enc_rx = dot11_cap.dcm_enc_rx; |
| 7328 | he_cap->ul_he_mu = dot11_cap.ul_he_mu; |
| 7329 | he_cap->su_beamformer = dot11_cap.su_beamformer; |
| 7330 | |
| 7331 | he_cap->su_beamformee = dot11_cap.su_beamformee; |
| 7332 | he_cap->mu_beamformer = dot11_cap.mu_beamformer; |
| 7333 | he_cap->bfee_sts_lt_80 = dot11_cap.bfee_sts_lt_80; |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7334 | he_cap->bfee_sts_gt_80 = dot11_cap.bfee_sts_gt_80; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7335 | he_cap->num_sounding_lt_80 = dot11_cap.num_sounding_lt_80; |
| 7336 | he_cap->num_sounding_gt_80 = dot11_cap.num_sounding_gt_80; |
| 7337 | he_cap->su_feedback_tone16 = dot11_cap.su_feedback_tone16; |
| 7338 | he_cap->mu_feedback_tone16 = dot11_cap.mu_feedback_tone16; |
| 7339 | he_cap->codebook_su = dot11_cap.codebook_su; |
| 7340 | he_cap->codebook_mu = dot11_cap.codebook_mu; |
| 7341 | he_cap->beamforming_feedback = dot11_cap.beamforming_feedback; |
| 7342 | he_cap->he_er_su_ppdu = dot11_cap.he_er_su_ppdu; |
| 7343 | he_cap->dl_mu_mimo_part_bw = dot11_cap.dl_mu_mimo_part_bw; |
| 7344 | he_cap->ppet_present = dot11_cap.ppet_present; |
| 7345 | he_cap->srp = dot11_cap.srp; |
| 7346 | he_cap->power_boost = dot11_cap.power_boost; |
| 7347 | |
Naveen Rawat | 4051b02 | 2017-09-08 16:17:54 -0700 | [diff] [blame] | 7348 | he_cap->he_ltf_800_gi_4x = dot11_cap.he_ltf_800_gi_4x; |
| 7349 | he_cap->max_nc = dot11_cap.max_nc; |
| 7350 | he_cap->er_he_ltf_800_gi_4x = dot11_cap.er_he_ltf_800_gi_4x; |
Naveen Rawat | fc53031 | 2017-10-23 14:34:12 -0700 | [diff] [blame] | 7351 | he_cap->he_ppdu_20_in_40Mhz_2G = |
| 7352 | dot11_cap.he_ppdu_20_in_40Mhz_2G; |
| 7353 | he_cap->he_ppdu_20_in_160_80p80Mhz = |
| 7354 | dot11_cap.he_ppdu_20_in_160_80p80Mhz; |
| 7355 | he_cap->he_ppdu_80_in_160_80p80Mhz = |
| 7356 | dot11_cap.he_ppdu_80_in_160_80p80Mhz; |
| 7357 | he_cap->er_1x_he_ltf_gi = |
| 7358 | dot11_cap.er_1x_he_ltf_gi; |
Kiran Kumar Lokere | 1f96b4a | 2018-08-22 14:47:11 -0700 | [diff] [blame] | 7359 | he_cap->midamble_tx_rx_1x_he_ltf = |
| 7360 | dot11_cap.midamble_tx_rx_1x_he_ltf; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7361 | he_cap->reserved2 = dot11_cap.reserved2; |
| 7362 | |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7363 | he_cap->rx_he_mcs_map_lt_80 = dot11_cap.rx_he_mcs_map_lt_80; |
| 7364 | he_cap->tx_he_mcs_map_lt_80 = dot11_cap.tx_he_mcs_map_lt_80; |
| 7365 | he_cap->rx_he_mcs_map_160 = |
| 7366 | *((uint16_t *)dot11_cap.rx_he_mcs_map_160); |
| 7367 | he_cap->tx_he_mcs_map_160 = |
| 7368 | *((uint16_t *)dot11_cap.tx_he_mcs_map_160); |
| 7369 | he_cap->rx_he_mcs_map_80_80 = |
| 7370 | *((uint16_t *)dot11_cap.rx_he_mcs_map_80_80); |
| 7371 | he_cap->tx_he_mcs_map_80_80 = |
| 7372 | *((uint16_t *)dot11_cap.tx_he_mcs_map_80_80); |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7373 | } |
| 7374 | } |
| 7375 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7376 | QDF_STATUS lim_send_he_caps_ie(struct mac_context *mac_ctx, struct pe_session *session, |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7377 | uint8_t vdev_id) |
| 7378 | { |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7379 | uint8_t he_caps[SIR_MAC_HE_CAP_MIN_LEN + 3]; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7380 | struct he_capability_info *he_cap; |
| 7381 | QDF_STATUS status_5g, status_2g; |
| 7382 | |
| 7383 | /* Sending only minimal info(no PPET) to FW now, update if required */ |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7384 | qdf_mem_zero(he_caps, SIR_MAC_HE_CAP_MIN_LEN + 3); |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 7385 | he_caps[0] = DOT11F_EID_HE_CAP; |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7386 | he_caps[1] = SIR_MAC_HE_CAP_MIN_LEN; |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7387 | qdf_mem_copy(&he_caps[2], HE_CAP_OUI_TYPE, HE_CAP_OUI_SIZE); |
| 7388 | lim_set_he_caps(mac_ctx, session, he_caps, |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7389 | SIR_MAC_HE_CAP_MIN_LEN + 3); |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7390 | he_cap = (struct he_capability_info *) (&he_caps[2 + HE_CAP_OUI_SIZE]); |
| 7391 | he_cap->ppet_present = 0; |
| 7392 | |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 7393 | status_5g = lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_HE_CAP, |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7394 | CDS_BAND_5GHZ, &he_caps[2], |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7395 | SIR_MAC_HE_CAP_MIN_LEN + 1); |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7396 | if (QDF_IS_STATUS_ERROR(status_5g)) |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7397 | pe_err("Unable send HE Cap IE for 5GHZ band, status: %d", |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7398 | status_5g); |
| 7399 | |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 7400 | status_2g = lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_HE_CAP, |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7401 | CDS_BAND_2GHZ, &he_caps[2], |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7402 | SIR_MAC_HE_CAP_MIN_LEN + 1); |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7403 | if (QDF_IS_STATUS_ERROR(status_2g)) |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7404 | pe_err("Unable send HE Cap IE for 2GHZ band, status: %d", |
Krishna Kumaar Natarajan | 1cd73ae | 2017-02-22 15:56:00 -0800 | [diff] [blame] | 7405 | status_2g); |
| 7406 | |
| 7407 | if (QDF_IS_STATUS_SUCCESS(status_2g) && |
| 7408 | QDF_IS_STATUS_SUCCESS(status_5g)) |
| 7409 | return QDF_STATUS_SUCCESS; |
| 7410 | |
| 7411 | return QDF_STATUS_E_FAILURE; |
| 7412 | } |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7413 | |
| 7414 | /** |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7415 | * lim_populate_he_mcs_per_bw() - pouldate HE mcs set per BW (le 80, 160, 80+80) |
| 7416 | * @mac_ctx: Global MAC context |
| 7417 | * @self_rx: self rx mcs set |
| 7418 | * @self_tx: self tx mcs set |
| 7419 | * @peer_rx: peer rx mcs set |
| 7420 | * @peer_tx: peer tx mcs set |
| 7421 | * @nss: nss |
| 7422 | * @cfg_rx_param: rx wni param to read |
| 7423 | * @cfg_tx_param: tx wni param to read |
| 7424 | * |
| 7425 | * MCS values are interpreted as in IEEE 11ax-D1.4 spec onwards |
| 7426 | * +-----------------------------------------------------+ |
| 7427 | * | SS8 | SS7 | SS6 | SS5 | SS4 | SS3 | SS2 | SS1 | |
| 7428 | * +-----------------------------------------------------+ |
| 7429 | * | 15-14 | 13-12 | 11-10 | 9-8 | 7-6 | 5-4 | 3-2 | 1-0 | |
| 7430 | * +-----------------------------------------------------+ |
| 7431 | * |
| 7432 | * Return: status of operation |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7433 | */ |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7434 | static QDF_STATUS lim_populate_he_mcs_per_bw(struct mac_context *mac_ctx, |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7435 | uint16_t *self_rx, uint16_t *self_tx, |
| 7436 | uint16_t peer_rx, uint16_t peer_tx, uint8_t nss, |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 7437 | uint16_t rx_mcs, uint16_t tx_mcs) |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7438 | { |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7439 | |
| 7440 | pe_debug("peer rates: rx_mcs - 0x%04x tx_mcs - 0x%04x", |
| 7441 | peer_rx, peer_tx); |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 7442 | |
| 7443 | *self_rx = rx_mcs; |
| 7444 | *self_tx = tx_mcs; |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7445 | |
| 7446 | *self_rx = HE_INTERSECT_MCS(*self_rx, peer_tx); |
| 7447 | *self_tx = HE_INTERSECT_MCS(*self_tx, peer_rx); |
| 7448 | |
| 7449 | if (nss == NSS_1x1_MODE) { |
| 7450 | *self_rx |= HE_MCS_INV_MSK_4_NSS(1); |
| 7451 | *self_tx |= HE_MCS_INV_MSK_4_NSS(1); |
| 7452 | } |
| 7453 | /* if nss is 2, disable higher NSS */ |
| 7454 | if (nss == NSS_2x2_MODE) { |
| 7455 | *self_rx |= (HE_MCS_INV_MSK_4_NSS(1) & HE_MCS_INV_MSK_4_NSS(2)); |
| 7456 | *self_tx |= (HE_MCS_INV_MSK_4_NSS(1) & HE_MCS_INV_MSK_4_NSS(2)); |
| 7457 | } |
| 7458 | |
| 7459 | return QDF_STATUS_SUCCESS; |
| 7460 | } |
| 7461 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7462 | QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7463 | tpSirSupportedRates rates, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 7464 | tDot11fIEhe_cap *peer_he_caps, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 7465 | struct pe_session *session_entry, uint8_t nss) |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7466 | { |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7467 | bool support_2x2 = false; |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7468 | uint32_t self_sta_dot11mode = 0; |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7469 | |
| 7470 | wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &self_sta_dot11mode); |
| 7471 | |
| 7472 | if (!IS_DOT11_MODE_HE(self_sta_dot11mode)) |
| 7473 | return QDF_STATUS_SUCCESS; |
| 7474 | |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7475 | if ((peer_he_caps == NULL) || (!peer_he_caps->present)) { |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7476 | pe_debug("peer not he capable or he_caps NULL"); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7477 | return QDF_STATUS_SUCCESS; |
| 7478 | } |
| 7479 | |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7480 | pe_debug("peer rates lt 80: rx_mcs - 0x%04x tx_mcs - 0x%04x", |
| 7481 | peer_he_caps->rx_he_mcs_map_lt_80, |
| 7482 | peer_he_caps->tx_he_mcs_map_lt_80); |
| 7483 | pe_debug("peer rates 160: rx_mcs - 0x%04x tx_mcs - 0x%04x", |
| 7484 | (*(uint16_t *)peer_he_caps->rx_he_mcs_map_160), |
| 7485 | (*(uint16_t *)peer_he_caps->tx_he_mcs_map_160)); |
| 7486 | pe_debug("peer rates 80+80: rx_mcs - 0x%04x tx_mcs - 0x%04x", |
| 7487 | (*(uint16_t *)peer_he_caps->rx_he_mcs_map_80_80), |
| 7488 | (*(uint16_t *)peer_he_caps->tx_he_mcs_map_80_80)); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7489 | |
| 7490 | if (session_entry && session_entry->nss == NSS_2x2_MODE) { |
| 7491 | if (mac_ctx->lteCoexAntShare && |
| 7492 | IS_24G_CH(session_entry->currentOperChannel)) { |
| 7493 | if (IS_2X2_CHAIN(session_entry->chainMask)) |
| 7494 | support_2x2 = true; |
| 7495 | else |
Nishank Aggarwal | 0402b43 | 2017-03-24 19:17:36 +0530 | [diff] [blame] | 7496 | pe_err("2x2 not enabled %d", |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7497 | session_entry->chainMask); |
| 7498 | } else { |
| 7499 | support_2x2 = true; |
| 7500 | } |
| 7501 | } |
| 7502 | |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7503 | lim_populate_he_mcs_per_bw(mac_ctx, |
| 7504 | &rates->rx_he_mcs_map_lt_80, &rates->tx_he_mcs_map_lt_80, |
| 7505 | peer_he_caps->rx_he_mcs_map_lt_80, |
| 7506 | peer_he_caps->tx_he_mcs_map_lt_80, nss, |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 7507 | mac_ctx->mlme_cfg->he_caps.dot11_he_cap.rx_he_mcs_map_lt_80, |
| 7508 | mac_ctx->mlme_cfg->he_caps.dot11_he_cap.tx_he_mcs_map_lt_80); |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7509 | lim_populate_he_mcs_per_bw(mac_ctx, |
| 7510 | &rates->rx_he_mcs_map_160, &rates->tx_he_mcs_map_160, |
| 7511 | *((uint16_t *)peer_he_caps->rx_he_mcs_map_160), |
| 7512 | *((uint16_t *)peer_he_caps->tx_he_mcs_map_160), nss, |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 7513 | *((uint16_t *)mac_ctx->mlme_cfg->he_caps.dot11_he_cap. |
| 7514 | rx_he_mcs_map_160), |
| 7515 | *((uint16_t *)mac_ctx->mlme_cfg->he_caps.dot11_he_cap. |
| 7516 | tx_he_mcs_map_160)); |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7517 | lim_populate_he_mcs_per_bw(mac_ctx, |
| 7518 | &rates->rx_he_mcs_map_80_80, &rates->tx_he_mcs_map_80_80, |
| 7519 | *((uint16_t *)peer_he_caps->rx_he_mcs_map_80_80), |
| 7520 | *((uint16_t *)peer_he_caps->tx_he_mcs_map_80_80), nss, |
Bala Venkatesh | 6d53709 | 2018-09-25 10:38:36 +0530 | [diff] [blame] | 7521 | *((uint16_t *)mac_ctx->mlme_cfg->he_caps.dot11_he_cap. |
| 7522 | rx_he_mcs_map_80_80), |
| 7523 | *((uint16_t *)mac_ctx->mlme_cfg->he_caps.dot11_he_cap. |
| 7524 | tx_he_mcs_map_80_80)); |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7525 | if (!support_2x2) { |
| 7526 | /* disable 2 and higher NSS MCS sets */ |
Naveen Rawat | cbcc654 | 2017-10-30 17:55:03 -0700 | [diff] [blame] | 7527 | rates->rx_he_mcs_map_lt_80 |= HE_MCS_INV_MSK_4_NSS(1); |
| 7528 | rates->tx_he_mcs_map_lt_80 |= HE_MCS_INV_MSK_4_NSS(1); |
| 7529 | rates->rx_he_mcs_map_160 |= HE_MCS_INV_MSK_4_NSS(1); |
| 7530 | rates->tx_he_mcs_map_160 |= HE_MCS_INV_MSK_4_NSS(1); |
| 7531 | rates->rx_he_mcs_map_80_80 |= HE_MCS_INV_MSK_4_NSS(1); |
| 7532 | rates->tx_he_mcs_map_80_80 |= HE_MCS_INV_MSK_4_NSS(1); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7533 | } |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7534 | |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7535 | pe_debug("enable2x2 - %d nss %d", |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 7536 | mac_ctx->mlme_cfg->vht_caps.vht_cap_info.enable2x2, nss); |
Naveen Rawat | aeca1b9 | 2017-10-16 16:55:31 -0700 | [diff] [blame] | 7537 | pe_debug("he_rx_lt_80 - 0x%x he_tx_lt_80 0x%x", |
| 7538 | rates->rx_he_mcs_map_lt_80, rates->tx_he_mcs_map_lt_80); |
| 7539 | pe_debug("he_rx_160 - 0x%x he_tx_160 0x%x", |
| 7540 | rates->rx_he_mcs_map_160, rates->tx_he_mcs_map_160); |
| 7541 | pe_debug("he_rx_80_80 - 0x%x he_tx_80_80 0x%x", |
| 7542 | rates->rx_he_mcs_map_80_80, rates->tx_he_mcs_map_80_80); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7543 | return QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 7544 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 7545 | #endif |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 7546 | |
Abhishek Singh | f3756fc | 2017-06-28 16:04:06 +0530 | [diff] [blame] | 7547 | /** |
| 7548 | * lim_assoc_rej_get_remaining_delta() - Get remaining time delta for |
| 7549 | * the rssi based disallowed list entry |
| 7550 | * @node: rssi based disallowed list entry |
| 7551 | * |
| 7552 | * Return: remaining delta, can be -ve if time has already expired. |
| 7553 | */ |
| 7554 | static inline int |
| 7555 | lim_assoc_rej_get_remaining_delta(struct sir_rssi_disallow_lst *node) |
| 7556 | { |
| 7557 | qdf_time_t cur_time; |
| 7558 | uint32_t time_diff; |
| 7559 | |
| 7560 | cur_time = qdf_do_div(qdf_get_monotonic_boottime(), |
| 7561 | QDF_MC_TIMER_TO_MS_UNIT); |
| 7562 | time_diff = cur_time - node->time_during_rejection; |
| 7563 | |
| 7564 | return node->retry_delay - time_diff; |
| 7565 | } |
| 7566 | |
| 7567 | /** |
| 7568 | * lim_assoc_rej_rem_entry_with_lowest_delta() - Remove the entry |
| 7569 | * with lowest time delta |
| 7570 | * @list: rssi based rejected BSSID list |
| 7571 | * |
| 7572 | * Return: QDF_STATUS |
| 7573 | */ |
| 7574 | static QDF_STATUS |
| 7575 | lim_assoc_rej_rem_entry_with_lowest_delta(qdf_list_t *list) |
| 7576 | { |
| 7577 | struct sir_rssi_disallow_lst *oldest_node = NULL; |
| 7578 | struct sir_rssi_disallow_lst *cur_node; |
| 7579 | qdf_list_node_t *cur_list = NULL; |
| 7580 | qdf_list_node_t *next_list = NULL; |
| 7581 | |
| 7582 | qdf_list_peek_front(list, &cur_list); |
| 7583 | while (cur_list) { |
| 7584 | cur_node = qdf_container_of(cur_list, |
| 7585 | struct sir_rssi_disallow_lst, node); |
| 7586 | if (!oldest_node || |
| 7587 | (lim_assoc_rej_get_remaining_delta(oldest_node) > |
| 7588 | lim_assoc_rej_get_remaining_delta(cur_node))) |
| 7589 | oldest_node = cur_node; |
| 7590 | |
| 7591 | qdf_list_peek_next(list, cur_list, &next_list); |
| 7592 | cur_list = next_list; |
| 7593 | next_list = NULL; |
| 7594 | } |
| 7595 | |
| 7596 | if (oldest_node) { |
| 7597 | pe_debug("remove node %pM with lowest delta %d", |
| 7598 | oldest_node->bssid.bytes, |
| 7599 | lim_assoc_rej_get_remaining_delta(oldest_node)); |
| 7600 | qdf_list_remove_node(list, &oldest_node->node); |
| 7601 | qdf_mem_free(oldest_node); |
| 7602 | return QDF_STATUS_SUCCESS; |
| 7603 | } |
| 7604 | |
| 7605 | return QDF_STATUS_E_INVAL; |
| 7606 | } |
| 7607 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7608 | void lim_assoc_rej_add_to_rssi_based_reject_list(struct mac_context *mac_ctx, |
Abhishek Singh | f3756fc | 2017-06-28 16:04:06 +0530 | [diff] [blame] | 7609 | tDot11fTLVrssi_assoc_rej *rssi_assoc_rej, |
| 7610 | tSirMacAddr bssid, int8_t rssi) |
| 7611 | { |
| 7612 | struct sir_rssi_disallow_lst *entry; |
| 7613 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 7614 | |
| 7615 | entry = qdf_mem_malloc(sizeof(*entry)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 7616 | if (!entry) |
Abhishek Singh | f3756fc | 2017-06-28 16:04:06 +0530 | [diff] [blame] | 7617 | return; |
Abhishek Singh | f3756fc | 2017-06-28 16:04:06 +0530 | [diff] [blame] | 7618 | |
| 7619 | pe_debug("%pM: assoc resp rssi %d, delta rssi %d retry delay %d sec and list size %d", |
| 7620 | bssid, rssi, rssi_assoc_rej->delta_rssi, |
| 7621 | rssi_assoc_rej->retry_delay, |
| 7622 | qdf_list_size(&mac_ctx->roam.rssi_disallow_bssid)); |
| 7623 | |
| 7624 | qdf_mem_copy(entry->bssid.bytes, |
| 7625 | bssid, QDF_MAC_ADDR_SIZE); |
| 7626 | entry->retry_delay = rssi_assoc_rej->retry_delay * |
| 7627 | QDF_MC_TIMER_TO_MS_UNIT; |
| 7628 | entry->expected_rssi = rssi + rssi_assoc_rej->delta_rssi; |
| 7629 | entry->time_during_rejection = |
| 7630 | qdf_do_div(qdf_get_monotonic_boottime(), |
| 7631 | QDF_MC_TIMER_TO_MS_UNIT); |
| 7632 | |
| 7633 | if (qdf_list_size(&mac_ctx->roam.rssi_disallow_bssid) >= |
| 7634 | MAX_RSSI_AVOID_BSSID_LIST) { |
| 7635 | status = lim_assoc_rej_rem_entry_with_lowest_delta( |
| 7636 | &mac_ctx->roam.rssi_disallow_bssid); |
| 7637 | if (QDF_IS_STATUS_ERROR(status)) |
| 7638 | pe_err("Failed to remove entry with lowest delta"); |
| 7639 | } |
| 7640 | |
| 7641 | if (QDF_IS_STATUS_SUCCESS(status)) |
| 7642 | status = qdf_list_insert_back( |
| 7643 | &mac_ctx->roam.rssi_disallow_bssid, |
| 7644 | &entry->node); |
| 7645 | |
| 7646 | if (QDF_IS_STATUS_ERROR(status)) { |
| 7647 | pe_err("Failed to enqueue bssid entry"); |
| 7648 | qdf_mem_free(entry); |
| 7649 | } |
| 7650 | } |
| 7651 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7652 | void lim_decrement_pending_mgmt_count(struct mac_context *mac_ctx) |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 7653 | { |
| 7654 | qdf_spin_lock(&mac_ctx->sys.bbt_mgmt_lock); |
| 7655 | if (!mac_ctx->sys.sys_bbt_pending_mgmt_count) { |
| 7656 | qdf_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); |
Sreelakshmi Konamki | 6d478cd | 2017-03-28 11:59:25 +0530 | [diff] [blame] | 7657 | return; |
| 7658 | } |
| 7659 | mac_ctx->sys.sys_bbt_pending_mgmt_count--; |
| 7660 | qdf_spin_unlock(&mac_ctx->sys.bbt_mgmt_lock); |
| 7661 | } |
Arif Hussain | 7631afa | 2017-02-08 14:35:00 -0800 | [diff] [blame] | 7662 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7663 | struct csr_roam_session *lim_get_session_by_macaddr(struct mac_context *mac_ctx, |
Arif Hussain | 7631afa | 2017-02-08 14:35:00 -0800 | [diff] [blame] | 7664 | tSirMacAddr self_mac) |
| 7665 | { |
| 7666 | int i = 0; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 7667 | struct csr_roam_session *session; |
Arif Hussain | 7631afa | 2017-02-08 14:35:00 -0800 | [diff] [blame] | 7668 | |
| 7669 | if (!mac_ctx || !self_mac) { |
| 7670 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, |
| 7671 | FL("Invalid arguments")); |
| 7672 | return NULL; |
| 7673 | } |
| 7674 | |
| 7675 | for (i = 0; i < mac_ctx->sme.max_intf_count; i++) { |
| 7676 | session = CSR_GET_SESSION(mac_ctx, i); |
| 7677 | if (!session) |
| 7678 | continue; |
| 7679 | else if (!qdf_mem_cmp(&session->selfMacAddr, |
| 7680 | self_mac, sizeof(tSirMacAddr))) { |
| 7681 | |
| 7682 | QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_INFO, |
| 7683 | FL("session %d exists with mac address " |
| 7684 | MAC_ADDRESS_STR), session->sessionId, |
| 7685 | MAC_ADDR_ARRAY(self_mac)); |
| 7686 | |
| 7687 | return session; |
| 7688 | } |
| 7689 | } |
| 7690 | |
| 7691 | return NULL; |
| 7692 | } |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 7693 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7694 | bool lim_check_if_vendor_oui_match(struct mac_context *mac_ctx, |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 7695 | uint8_t *oui, uint8_t oui_len, |
| 7696 | uint8_t *ie, uint8_t ie_len) |
| 7697 | { |
| 7698 | uint8_t *ptr = ie; |
Abhishek Singh | e4b6b4e | 2017-05-05 19:00:17 +0530 | [diff] [blame] | 7699 | uint8_t elem_id; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 7700 | |
| 7701 | if (NULL == ie || 0 == ie_len) { |
| 7702 | pe_err("IE Null or ie len zero %d", ie_len); |
| 7703 | return false; |
| 7704 | } |
| 7705 | |
Abhishek Singh | e4b6b4e | 2017-05-05 19:00:17 +0530 | [diff] [blame] | 7706 | elem_id = *ie; |
| 7707 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 7708 | if (elem_id == IE_EID_VENDOR && |
| 7709 | !qdf_mem_cmp(&ptr[2], oui, oui_len)) |
| 7710 | return true; |
| 7711 | else |
| 7712 | return false; |
| 7713 | } |
Sandeep Puligilla | d9f88ce | 2017-04-11 19:41:57 -0700 | [diff] [blame] | 7714 | |
| 7715 | QDF_STATUS lim_util_get_type_subtype(void *pkt, uint8_t *type, |
| 7716 | uint8_t *subtype) |
| 7717 | { |
| 7718 | cds_pkt_t *cds_pkt; |
| 7719 | QDF_STATUS status; |
| 7720 | tpSirMacMgmtHdr hdr; |
| 7721 | uint8_t *rxpktinfor; |
| 7722 | |
| 7723 | cds_pkt = (cds_pkt_t *) pkt; |
| 7724 | if (!cds_pkt) { |
| 7725 | pe_err("NULL packet received"); |
| 7726 | return QDF_STATUS_E_FAILURE; |
| 7727 | } |
| 7728 | status = |
| 7729 | wma_ds_peek_rx_packet_info(cds_pkt, (void *)&rxpktinfor, false); |
| 7730 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 7731 | pe_err("Failed extract cds packet. status %d", status); |
| 7732 | return QDF_STATUS_E_FAILURE; |
| 7733 | } |
| 7734 | |
| 7735 | hdr = WMA_GET_RX_MAC_HEADER(rxpktinfor); |
| 7736 | if (hdr->fc.type == SIR_MAC_MGMT_FRAME) { |
Arif Hussain | da9ba08 | 2017-11-02 23:33:54 -0700 | [diff] [blame] | 7737 | pe_debug("RxBd: %pK mHdr: %pK Type: %d Subtype: %d SizeFC: %zu", |
| 7738 | rxpktinfor, hdr, hdr->fc.type, hdr->fc.subType, |
| 7739 | sizeof(tSirMacFrameCtl)); |
Sandeep Puligilla | d9f88ce | 2017-04-11 19:41:57 -0700 | [diff] [blame] | 7740 | *type = hdr->fc.type; |
| 7741 | *subtype = hdr->fc.subType; |
| 7742 | } else { |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 7743 | pe_err("Not a management packet type %d", hdr->fc.type); |
Sandeep Puligilla | d9f88ce | 2017-04-11 19:41:57 -0700 | [diff] [blame] | 7744 | return QDF_STATUS_E_INVAL; |
| 7745 | } |
| 7746 | return QDF_STATUS_SUCCESS; |
| 7747 | } |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 7748 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 7749 | enum rateid lim_get_min_session_txrate(struct pe_session *session) |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 7750 | { |
| 7751 | enum rateid rid = RATEID_DEFAULT; |
| 7752 | uint8_t min_rate = SIR_MAC_RATE_54, curr_rate, i; |
| 7753 | tSirMacRateSet *rateset = &session->rateSet; |
| 7754 | |
| 7755 | if (!session) |
| 7756 | return rid; |
| 7757 | |
| 7758 | for (i = 0; i < rateset->numRates; i++) { |
| 7759 | /* Ignore MSB - set to indicate basic rate */ |
| 7760 | curr_rate = rateset->rate[i] & 0x7F; |
| 7761 | min_rate = (curr_rate < min_rate) ? curr_rate : min_rate; |
| 7762 | } |
| 7763 | pe_debug("supported min_rate: %0x(%d)", min_rate, min_rate); |
| 7764 | |
| 7765 | switch (min_rate) { |
| 7766 | case SIR_MAC_RATE_1: |
| 7767 | rid = RATEID_1MBPS; |
| 7768 | break; |
| 7769 | case SIR_MAC_RATE_2: |
| 7770 | rid = RATEID_2MBPS; |
| 7771 | break; |
| 7772 | case SIR_MAC_RATE_5_5: |
| 7773 | rid = RATEID_5_5MBPS; |
| 7774 | break; |
| 7775 | case SIR_MAC_RATE_11: |
| 7776 | rid = RATEID_11MBPS; |
| 7777 | break; |
| 7778 | case SIR_MAC_RATE_6: |
| 7779 | rid = RATEID_6MBPS; |
| 7780 | break; |
| 7781 | case SIR_MAC_RATE_9: |
| 7782 | rid = RATEID_9MBPS; |
| 7783 | break; |
| 7784 | case SIR_MAC_RATE_12: |
| 7785 | rid = RATEID_12MBPS; |
| 7786 | break; |
| 7787 | case SIR_MAC_RATE_18: |
| 7788 | rid = RATEID_18MBPS; |
| 7789 | break; |
| 7790 | case SIR_MAC_RATE_24: |
| 7791 | rid = RATEID_24MBPS; |
| 7792 | break; |
| 7793 | case SIR_MAC_RATE_36: |
| 7794 | rid = RATEID_36MBPS; |
| 7795 | break; |
| 7796 | case SIR_MAC_RATE_48: |
| 7797 | rid = RATEID_48MBPS; |
| 7798 | break; |
| 7799 | case SIR_MAC_RATE_54: |
| 7800 | rid = RATEID_54MBPS; |
| 7801 | break; |
| 7802 | default: |
| 7803 | rid = RATEID_DEFAULT; |
| 7804 | break; |
| 7805 | } |
| 7806 | |
| 7807 | return rid; |
| 7808 | } |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 7809 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7810 | void lim_convert_active_channel_to_passive_channel(struct mac_context *mac_ctx) |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 7811 | { |
| 7812 | uint64_t current_time; |
| 7813 | uint64_t last_time = 0; |
| 7814 | uint64_t time_diff; |
| 7815 | uint8_t i; |
| 7816 | |
| 7817 | current_time = (uint64_t)qdf_mc_timer_get_system_time(); |
| 7818 | for (i = 1; i < SIR_MAX_24G_5G_CHANNEL_RANGE; i++) { |
| 7819 | if ((mac_ctx->lim.dfschannelList.timeStamp[i]) != 0) { |
| 7820 | last_time = mac_ctx->lim.dfschannelList.timeStamp[i]; |
| 7821 | if (current_time >= last_time) { |
| 7822 | time_diff = (current_time - last_time); |
| 7823 | } else { |
| 7824 | time_diff = |
| 7825 | (0xFFFFFFFF - last_time) + current_time; |
| 7826 | } |
| 7827 | |
| 7828 | if (time_diff >= MAX_TIME_TO_BE_ACTIVE_CHANNEL) { |
| 7829 | lim_covert_channel_scan_type(mac_ctx, i, false); |
| 7830 | mac_ctx->lim.dfschannelList.timeStamp[i] = 0; |
| 7831 | } |
| 7832 | } |
| 7833 | } |
| 7834 | /* |
| 7835 | * last_time is zero if there is no DFS active channels in the list. |
| 7836 | * If this is non zero then we have active DFS channels so restart |
| 7837 | * the timer. |
| 7838 | */ |
| 7839 | if (last_time != 0) { |
| 7840 | if (tx_timer_activate |
| 7841 | (&mac_ctx->lim.limTimers.gLimActiveToPassiveChannelTimer) |
| 7842 | != TX_SUCCESS) { |
| 7843 | pe_err("Active to Passive Channel timer not activated"); |
| 7844 | } |
| 7845 | } |
| 7846 | return; |
| 7847 | } |
| 7848 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7849 | void lim_send_sme_mgmt_frame_ind(struct mac_context *mac_ctx, uint8_t frame_type, |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 7850 | uint8_t *frame, uint32_t frame_len, |
| 7851 | uint16_t session_id, uint32_t rx_channel, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 7852 | struct pe_session *psession_entry, int8_t rx_rssi) |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 7853 | { |
| 7854 | tpSirSmeMgmtFrameInd sme_mgmt_frame = NULL; |
| 7855 | uint16_t length; |
| 7856 | |
| 7857 | length = sizeof(tSirSmeMgmtFrameInd) + frame_len; |
| 7858 | |
| 7859 | sme_mgmt_frame = qdf_mem_malloc(length); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 7860 | if (!sme_mgmt_frame) |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 7861 | return; |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 7862 | |
| 7863 | if (qdf_is_macaddr_broadcast( |
Varun Reddy Yeturu | 8e94f72 | 2018-05-17 14:57:18 -0700 | [diff] [blame] | 7864 | (struct qdf_mac_addr *)(frame + 4)) && |
Abhinav Kumar | 49d08a7 | 2018-02-14 17:36:12 +0530 | [diff] [blame] | 7865 | !session_id) { |
| 7866 | pe_debug("Broadcast action frame"); |
| 7867 | session_id = SME_SESSION_ID_BROADCAST; |
| 7868 | } |
| 7869 | |
| 7870 | sme_mgmt_frame->frame_len = frame_len; |
| 7871 | sme_mgmt_frame->sessionId = session_id; |
| 7872 | sme_mgmt_frame->frameType = frame_type; |
| 7873 | sme_mgmt_frame->rxRssi = rx_rssi; |
| 7874 | sme_mgmt_frame->rxChan = rx_channel; |
| 7875 | |
| 7876 | qdf_mem_zero(sme_mgmt_frame->frameBuf, frame_len); |
| 7877 | qdf_mem_copy(sme_mgmt_frame->frameBuf, frame, frame_len); |
| 7878 | |
| 7879 | if (mac_ctx->mgmt_frame_ind_cb) |
| 7880 | mac_ctx->mgmt_frame_ind_cb(sme_mgmt_frame); |
| 7881 | else |
| 7882 | pe_debug_rl("Management indication callback not registered!!"); |
| 7883 | qdf_mem_free(sme_mgmt_frame); |
| 7884 | return; |
| 7885 | } |
| 7886 | |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7887 | void |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7888 | lim_send_dfs_chan_sw_ie_update(struct mac_context *mac_ctx, struct pe_session *session) |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7889 | { |
| 7890 | /* Update the beacon template and send to FW */ |
| 7891 | if (sch_set_fixed_beacon_fields(mac_ctx, session) != |
| 7892 | QDF_STATUS_SUCCESS) { |
| 7893 | pe_err("Unable to set CSA IE in beacon"); |
| 7894 | return; |
| 7895 | } |
| 7896 | |
| 7897 | /* Send update beacon template message */ |
Abhishek Singh | fc740be | 2018-10-12 11:34:26 +0530 | [diff] [blame] | 7898 | lim_send_beacon_ind(mac_ctx, session, REASON_CHANNEL_SWITCH); |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7899 | pe_debug("Updated CSA IE, IE COUNT: %d", |
| 7900 | session->gLimChannelSwitch.switchCount); |
| 7901 | } |
| 7902 | |
| 7903 | void lim_process_ap_ecsa_timeout(void *data) |
| 7904 | { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 7905 | struct pe_session *session = (struct pe_session *)data; |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7906 | struct mac_context *mac_ctx; |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7907 | uint8_t bcn_int, ch, ch_width; |
| 7908 | QDF_STATUS status; |
| 7909 | |
| 7910 | if (!session) { |
| 7911 | pe_err("Session is NULL"); |
| 7912 | return; |
| 7913 | } |
| 7914 | |
Abhishek Singh | dfa69c3 | 2018-08-30 15:39:34 +0530 | [diff] [blame] | 7915 | mac_ctx = session->mac_ctx; |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7916 | |
| 7917 | if (!session->dfsIncludeChanSwIe) { |
| 7918 | pe_debug("session->dfsIncludeChanSwIe not set"); |
| 7919 | return; |
| 7920 | } |
| 7921 | |
| 7922 | if (session->gLimChannelSwitch.switchCount) { |
| 7923 | /* Decrement the beacon switch count */ |
| 7924 | session->gLimChannelSwitch.switchCount--; |
| 7925 | pe_debug("current beacon count %d", |
| 7926 | session->gLimChannelSwitch.switchCount); |
| 7927 | } |
| 7928 | |
| 7929 | /* |
| 7930 | * Send only g_sap_chanswitch_beacon_cnt beacons with CSA IE Set in |
| 7931 | * when a radar is detected |
| 7932 | */ |
| 7933 | if (session->gLimChannelSwitch.switchCount > 0) { |
| 7934 | /* Send the next beacon with updated CSA IE count */ |
| 7935 | lim_send_dfs_chan_sw_ie_update(mac_ctx, session); |
| 7936 | |
| 7937 | ch = session->gLimChannelSwitch.primaryChannel; |
| 7938 | ch_width = session->gLimChannelSwitch.ch_width; |
Arif Hussain | 224d381 | 2018-11-16 17:58:38 -0800 | [diff] [blame] | 7939 | if (mac_ctx->mlme_cfg->dfs_cfg.dfs_beacon_tx_enhanced) |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7940 | /* Send Action frame after updating beacon */ |
| 7941 | lim_send_chan_switch_action_frame(mac_ctx, ch, ch_width, |
| 7942 | session); |
| 7943 | |
| 7944 | /* Restart the timer */ |
| 7945 | if (session->beaconParams.beaconInterval) |
| 7946 | bcn_int = session->beaconParams.beaconInterval; |
| 7947 | else |
Pragaspathi Thilagaraj | 3cf0f65 | 2018-10-29 16:40:35 +0530 | [diff] [blame] | 7948 | bcn_int = MLME_CFG_BEACON_INTERVAL_DEF; |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7949 | |
Dustin Brown | 7dede43 | 2018-08-15 17:26:31 -0700 | [diff] [blame] | 7950 | status = qdf_mc_timer_start(&session->ap_ecsa_timer, |
| 7951 | bcn_int); |
| 7952 | if (QDF_IS_STATUS_ERROR(status)) { |
| 7953 | pe_err("cannot start ap_ecsa_timer"); |
| 7954 | lim_process_ap_ecsa_timeout(session); |
| 7955 | } |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7956 | } else { |
| 7957 | tSirSmeCSAIeTxCompleteRsp *chan_switch_tx_rsp; |
| 7958 | struct scheduler_msg msg = {0}; |
| 7959 | uint8_t length = sizeof(*chan_switch_tx_rsp); |
| 7960 | |
| 7961 | /* Done with CSA IE update, send response back to SME */ |
| 7962 | session->gLimChannelSwitch.switchCount = 0; |
| 7963 | if (mac_ctx->sap.SapDfsInfo.disable_dfs_ch_switch == false) |
| 7964 | session->gLimChannelSwitch.switchMode = 0; |
| 7965 | session->dfsIncludeChanSwIe = false; |
| 7966 | session->dfsIncludeChanWrapperIe = false; |
| 7967 | |
| 7968 | chan_switch_tx_rsp = qdf_mem_malloc(length); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 7969 | if (!chan_switch_tx_rsp) |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7970 | return; |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7971 | |
| 7972 | chan_switch_tx_rsp->sessionId = session->smeSessionId; |
| 7973 | chan_switch_tx_rsp->chanSwIeTxStatus = QDF_STATUS_SUCCESS; |
| 7974 | |
| 7975 | msg.type = eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND; |
| 7976 | msg.bodyptr = chan_switch_tx_rsp; |
| 7977 | |
gaurank kathpalia | 3a7f25b | 2018-08-28 16:26:39 +0530 | [diff] [blame] | 7978 | status = scheduler_post_message(QDF_MODULE_ID_PE, |
| 7979 | QDF_MODULE_ID_SME, |
| 7980 | QDF_MODULE_ID_SME, &msg); |
Pragaspathi Thilagaraj | 934275c | 2018-08-07 14:55:35 +0530 | [diff] [blame] | 7981 | if (QDF_IS_STATUS_ERROR(status)) { |
| 7982 | sme_err("Failed to post eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND"); |
| 7983 | qdf_mem_free(chan_switch_tx_rsp); |
| 7984 | } |
| 7985 | } |
| 7986 | } |
Abhishek Singh | dfa69c3 | 2018-08-30 15:39:34 +0530 | [diff] [blame] | 7987 | |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 7988 | #ifdef CONFIG_VDEV_SM |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 7989 | QDF_STATUS lim_sta_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme, |
| 7990 | uint16_t data_len, void *data) |
| 7991 | { |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 7992 | struct mac_context *mac_ctx; |
Jianmin Zhu | 0923660 | 2018-10-15 15:36:10 +0800 | [diff] [blame] | 7993 | enum vdev_assoc_type assoc_type; |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 7994 | |
| 7995 | mac_ctx = cds_get_context(QDF_MODULE_ID_PE); |
| 7996 | if (!mac_ctx) { |
| 7997 | pe_err("mac_ctx is NULL"); |
| 7998 | if (data) |
| 7999 | qdf_mem_free(data); |
| 8000 | return QDF_STATUS_E_INVAL; |
| 8001 | } |
| 8002 | |
Jianmin Zhu | 0923660 | 2018-10-15 15:36:10 +0800 | [diff] [blame] | 8003 | assoc_type = mlme_get_assoc_type(vdev_mlme->vdev); |
| 8004 | switch (assoc_type) { |
| 8005 | case VDEV_ASSOC: |
| 8006 | lim_process_mlm_join_req(mac_ctx, (tLimMlmJoinReq *)data); |
| 8007 | break; |
| 8008 | case VDEV_REASSOC: |
| 8009 | lim_process_mlm_reassoc_req(mac_ctx, (tLimMlmReassocReq *)data); |
| 8010 | break; |
| 8011 | case VDEV_FT_REASSOC: |
Abhishek Singh | 254d551 | 2018-10-30 12:17:05 +0530 | [diff] [blame] | 8012 | lim_process_mlm_ft_reassoc_req(mac_ctx, |
| 8013 | (tLimMlmReassocReq *)data); |
Jianmin Zhu | 0923660 | 2018-10-15 15:36:10 +0800 | [diff] [blame] | 8014 | break; |
| 8015 | default: |
| 8016 | pe_err("assoc_type %d is invalid", assoc_type); |
| 8017 | } |
Sandeep Puligilla | 45e0c5e | 2018-09-21 00:38:23 -0700 | [diff] [blame] | 8018 | return QDF_STATUS_SUCCESS; |
| 8019 | } |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8020 | |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 8021 | QDF_STATUS lim_sta_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme, |
| 8022 | uint16_t data_len, void *data) |
| 8023 | { |
| 8024 | if (!vdev_mlme) { |
| 8025 | pe_err("vdev_mlme is NULL"); |
| 8026 | return QDF_STATUS_E_INVAL; |
| 8027 | } |
| 8028 | if (!data) { |
| 8029 | pe_err("event_data is NULL"); |
| 8030 | return QDF_STATUS_E_INVAL; |
| 8031 | } |
| 8032 | if (mlme_is_chan_switch_in_progress(vdev_mlme->vdev)) |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 8033 | __lim_process_channel_switch_timeout((struct mac_context *)data); |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 8034 | |
| 8035 | return QDF_STATUS_SUCCESS; |
| 8036 | } |
| 8037 | |
Sandeep Puligilla | 30bb840 | 2018-09-23 22:01:08 -0700 | [diff] [blame] | 8038 | QDF_STATUS lim_sta_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme, |
| 8039 | uint16_t data_len, void *data) |
| 8040 | { |
Sandeep Puligilla | 2a7fa84 | 2018-10-02 01:00:56 -0700 | [diff] [blame] | 8041 | QDF_STATUS status; |
| 8042 | bool connection_fail; |
| 8043 | |
Jianmin Zhu | 69e7bf3 | 2018-11-22 11:56:10 +0800 | [diff] [blame] | 8044 | if (!vdev_mlme) { |
| 8045 | pe_err("vdev_mlme is NULL"); |
| 8046 | return QDF_STATUS_E_INVAL; |
| 8047 | } |
Sandeep Puligilla | 2a7fa84 | 2018-10-02 01:00:56 -0700 | [diff] [blame] | 8048 | if (!data) { |
| 8049 | pe_err("event_data is NULL"); |
| 8050 | return QDF_STATUS_E_INVAL; |
| 8051 | } |
| 8052 | |
| 8053 | connection_fail = mlme_is_connection_fail(vdev_mlme->vdev); |
| 8054 | pe_info("Send vdev stop, connection_fail %d", connection_fail); |
| 8055 | if (connection_fail) { |
| 8056 | status = lim_sta_send_down_link((join_params *)data); |
| 8057 | mlme_set_connection_fail(vdev_mlme->vdev, false); |
| 8058 | } else { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8059 | status = lim_sta_send_del_bss((struct pe_session *)data); |
Sandeep Puligilla | 2a7fa84 | 2018-10-02 01:00:56 -0700 | [diff] [blame] | 8060 | } |
| 8061 | |
| 8062 | return status; |
Sandeep Puligilla | 30bb840 | 2018-09-23 22:01:08 -0700 | [diff] [blame] | 8063 | } |
| 8064 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 8065 | void lim_send_beacon(struct mac_context *mac_ctx, struct pe_session *session) |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8066 | { |
| 8067 | if (wlan_vdev_mlme_get_state(session->vdev) == |
| 8068 | WLAN_VDEV_S_DFS_CAC_WAIT) |
| 8069 | wlan_vdev_mlme_sm_deliver_evt(session->vdev, |
| 8070 | WLAN_VDEV_SM_EV_DFS_CAC_COMPLETED, |
| 8071 | sizeof(*session), session); |
| 8072 | else |
| 8073 | wlan_vdev_mlme_sm_deliver_evt(session->vdev, |
| 8074 | WLAN_VDEV_SM_EV_START_SUCCESS, |
| 8075 | sizeof(*session), session); |
| 8076 | } |
| 8077 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8078 | void lim_ndi_mlme_vdev_up_transition(struct pe_session *session) |
Manikandan Mohan | 4cc1c5a | 2018-10-09 13:25:30 -0700 | [diff] [blame] | 8079 | { |
| 8080 | if (!LIM_IS_NDI_ROLE(session)) |
| 8081 | return; |
| 8082 | |
| 8083 | wlan_vdev_mlme_sm_deliver_evt(session->vdev, |
| 8084 | WLAN_VDEV_SM_EV_START_SUCCESS, |
| 8085 | sizeof(*session), session); |
| 8086 | } |
| 8087 | |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8088 | QDF_STATUS lim_ap_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme, |
| 8089 | uint16_t data_len, void *data) |
| 8090 | { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8091 | struct pe_session *session; |
Rajeev Kumar Sirasanagandla | 2f17f8d | 2018-10-03 17:24:20 +0530 | [diff] [blame] | 8092 | tSirResultCodes ret; |
| 8093 | tpLimMlmStartReq start_req = (tLimMlmStartReq *)data; |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 8094 | struct mac_context *mac_ctx; |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8095 | |
Rajeev Kumar Sirasanagandla | 2f17f8d | 2018-10-03 17:24:20 +0530 | [diff] [blame] | 8096 | if (!data) { |
| 8097 | pe_err("data is NULL"); |
| 8098 | return QDF_STATUS_E_INVAL; |
| 8099 | } |
| 8100 | |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8101 | mac_ctx = cds_get_context(QDF_MODULE_ID_PE); |
| 8102 | if (!mac_ctx) { |
| 8103 | pe_err("mac_ctx is NULL"); |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8104 | return QDF_STATUS_E_INVAL; |
| 8105 | } |
| 8106 | |
Rajeev Kumar Sirasanagandla | 2f17f8d | 2018-10-03 17:24:20 +0530 | [diff] [blame] | 8107 | session = pe_find_session_by_session_id(mac_ctx, |
| 8108 | start_req->sessionId); |
| 8109 | if (!session) { |
| 8110 | pe_err("session is NULL"); |
| 8111 | return QDF_STATUS_E_INVAL; |
| 8112 | } |
| 8113 | |
| 8114 | if (LIM_IS_IBSS_ROLE(session) && |
| 8115 | session->mac_ctx->lim.gLimIbssCoalescingHappened) { |
| 8116 | ibss_bss_add(session->mac_ctx, session); |
| 8117 | ret = lim_mlm_add_bss(session->mac_ctx, start_req, session); |
| 8118 | if (ret != eSIR_SME_SUCCESS) { |
| 8119 | pe_err("AddBss failure"); |
| 8120 | return QDF_STATUS_E_INVAL; |
| 8121 | } |
| 8122 | } else { |
| 8123 | lim_process_mlm_start_req(session->mac_ctx, start_req); |
| 8124 | } |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8125 | |
| 8126 | return QDF_STATUS_SUCCESS; |
| 8127 | } |
| 8128 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 8129 | static inline void lim_send_csa_restart_resp(struct mac_context *mac_ctx, |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8130 | struct pe_session *session) |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 8131 | { |
| 8132 | struct scheduler_msg msg = {0}; |
| 8133 | QDF_STATUS status; |
| 8134 | |
| 8135 | msg.type = eWNI_SME_CSA_RESTART_RSP; |
| 8136 | msg.bodyptr = NULL; |
| 8137 | msg.bodyval = session->smeSessionId; |
| 8138 | |
| 8139 | status = scheduler_post_msg(QDF_MODULE_ID_SME, &msg); |
| 8140 | if (QDF_IS_STATUS_ERROR(status)) |
| 8141 | sme_err("Failed to post eWNI_SME_CSA_RESTART_RSP"); |
| 8142 | } |
| 8143 | |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8144 | QDF_STATUS lim_ap_mlme_vdev_update_beacon(struct vdev_mlme_obj *vdev_mlme, |
| 8145 | enum beacon_update_op op, |
| 8146 | uint16_t data_len, void *data) |
| 8147 | { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8148 | struct pe_session *session; |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8149 | |
| 8150 | if (!data) { |
| 8151 | pe_err("event_data is NULL"); |
| 8152 | return QDF_STATUS_E_INVAL; |
| 8153 | } |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8154 | session = (struct pe_session *)data; |
Manikandan Mohan | 4cc1c5a | 2018-10-09 13:25:30 -0700 | [diff] [blame] | 8155 | if (LIM_IS_NDI_ROLE(session)) |
| 8156 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8157 | |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 8158 | if (op == BEACON_INIT) |
Abhishek Singh | fc740be | 2018-10-12 11:34:26 +0530 | [diff] [blame] | 8159 | lim_send_beacon_ind(session->mac_ctx, session, REASON_DEFAULT); |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 8160 | else if (op == BEACON_CSA) |
| 8161 | lim_send_csa_restart_resp(session->mac_ctx, session); |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8162 | |
| 8163 | return QDF_STATUS_SUCCESS; |
| 8164 | } |
| 8165 | |
| 8166 | QDF_STATUS lim_ap_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme, |
| 8167 | uint16_t data_len, void *data) |
| 8168 | { |
| 8169 | struct scheduler_msg msg = {0}; |
| 8170 | QDF_STATUS status; |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8171 | struct pe_session *session = (struct pe_session *)data; |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8172 | |
| 8173 | if (!session) { |
| 8174 | pe_err("session is NULL"); |
| 8175 | return QDF_STATUS_E_INVAL; |
| 8176 | } |
Manikandan Mohan | 4cc1c5a | 2018-10-09 13:25:30 -0700 | [diff] [blame] | 8177 | if (LIM_IS_NDI_ROLE(session)) |
| 8178 | return QDF_STATUS_SUCCESS; |
| 8179 | |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8180 | |
| 8181 | msg.type = SIR_HAL_SEND_AP_VDEV_UP; |
| 8182 | msg.bodyval = session->smeSessionId; |
| 8183 | |
| 8184 | status = scheduler_post_msg(QDF_MODULE_ID_WMA, &msg); |
| 8185 | if (QDF_IS_STATUS_ERROR(status)) |
| 8186 | WMA_LOGE("Failed to post SIR_HAL_SEND_AP_VDEV_UP"); |
| 8187 | |
| 8188 | return status; |
| 8189 | } |
| 8190 | |
Abhishek Singh | caa6185 | 2018-09-12 15:50:04 +0530 | [diff] [blame] | 8191 | QDF_STATUS lim_ap_mlme_vdev_disconnect_peers(struct vdev_mlme_obj *vdev_mlme, |
| 8192 | uint16_t data_len, void *data) |
| 8193 | { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8194 | struct pe_session *session = (struct pe_session *)data; |
Rajeev Kumar Sirasanagandla | 2f17f8d | 2018-10-03 17:24:20 +0530 | [diff] [blame] | 8195 | |
| 8196 | if (!data) { |
| 8197 | pe_err("data is NULL"); |
| 8198 | return QDF_STATUS_E_INVAL; |
| 8199 | } |
| 8200 | |
| 8201 | if (LIM_IS_IBSS_ROLE(session)) |
| 8202 | lim_ibss_delete_all_peers(session->mac_ctx, session); |
| 8203 | else |
| 8204 | lim_delete_all_peers(session); |
Abhishek Singh | caa6185 | 2018-09-12 15:50:04 +0530 | [diff] [blame] | 8205 | |
| 8206 | return QDF_STATUS_SUCCESS; |
| 8207 | } |
| 8208 | |
| 8209 | QDF_STATUS lim_ap_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme, |
| 8210 | uint16_t data_len, void *data) |
| 8211 | { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8212 | struct pe_session *session = (struct pe_session *)data; |
Rajeev Kumar Sirasanagandla | 2f17f8d | 2018-10-03 17:24:20 +0530 | [diff] [blame] | 8213 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 8214 | |
| 8215 | if (!data) { |
| 8216 | pe_err("data is NULL"); |
| 8217 | return QDF_STATUS_E_INVAL; |
| 8218 | } |
| 8219 | |
| 8220 | if (LIM_IS_IBSS_ROLE(session) && |
| 8221 | session->mac_ctx->lim.gLimIbssCoalescingHappened) |
| 8222 | ibss_bss_delete(session->mac_ctx, session); |
| 8223 | else |
| 8224 | status = lim_send_vdev_stop(session); |
| 8225 | |
| 8226 | return status; |
Abhishek Singh | caa6185 | 2018-09-12 15:50:04 +0530 | [diff] [blame] | 8227 | } |
| 8228 | |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 8229 | QDF_STATUS lim_ap_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme, |
| 8230 | uint16_t data_len, void *data) |
| 8231 | { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8232 | struct pe_session *session = (struct pe_session *)data; |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 8233 | |
| 8234 | if (!data) { |
| 8235 | pe_err("data is NULL"); |
| 8236 | return QDF_STATUS_E_INVAL; |
| 8237 | } |
| 8238 | |
Abhishek Singh | a063f1c | 2018-09-19 11:37:51 +0530 | [diff] [blame] | 8239 | if (ap_mlme_is_hidden_ssid_restart_in_progress(vdev_mlme->vdev)) |
Abhishek Singh | 6c681f4 | 2018-09-12 15:52:36 +0530 | [diff] [blame] | 8240 | lim_send_vdev_restart(session->mac_ctx, session, |
| 8241 | session->smeSessionId); |
| 8242 | else |
| 8243 | lim_set_channel(session->mac_ctx, session->currentOperChannel, |
| 8244 | session->ch_center_freq_seg0, |
| 8245 | session->ch_center_freq_seg1, |
| 8246 | session->ch_width, session->maxTxPower, |
| 8247 | session->peSessionId, session->cac_duration_ms, |
| 8248 | session->dfs_regdomain); |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 8249 | |
| 8250 | return QDF_STATUS_SUCCESS; |
| 8251 | } |
| 8252 | |
Abhishek Singh | c5a5408 | 2018-09-12 16:08:03 +0530 | [diff] [blame] | 8253 | QDF_STATUS lim_ap_mlme_vdev_start_req_failed(struct vdev_mlme_obj *vdev_mlme, |
| 8254 | uint16_t data_len, void *data) |
| 8255 | { |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 8256 | struct mac_context *mac_ctx; |
Abhishek Singh | c5a5408 | 2018-09-12 16:08:03 +0530 | [diff] [blame] | 8257 | |
| 8258 | /* store mac ctx in vdev_mlme legacy_vdev_ptr?*/ |
| 8259 | mac_ctx = cds_get_context(QDF_MODULE_ID_PE); |
| 8260 | if (!mac_ctx) { |
| 8261 | pe_err("mac_ctx is NULL"); |
| 8262 | if (data) |
| 8263 | qdf_mem_free(data); |
| 8264 | return QDF_STATUS_E_INVAL; |
| 8265 | } |
| 8266 | |
| 8267 | lim_process_mlm_start_cnf(mac_ctx, data); |
| 8268 | |
| 8269 | return QDF_STATUS_SUCCESS; |
| 8270 | } |
| 8271 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 8272 | void lim_send_start_bss_confirm(struct mac_context *mac_ctx, |
Abhishek Singh | c5a5408 | 2018-09-12 16:08:03 +0530 | [diff] [blame] | 8273 | tLimMlmStartCnf *start_cnf) |
| 8274 | { |
| 8275 | if (start_cnf->resultCode == eSIR_SME_SUCCESS) { |
| 8276 | lim_post_sme_message(mac_ctx, LIM_MLM_START_CNF, |
| 8277 | (uint32_t *)start_cnf); |
| 8278 | } else { |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8279 | struct pe_session *session; |
Abhishek Singh | c5a5408 | 2018-09-12 16:08:03 +0530 | [diff] [blame] | 8280 | |
| 8281 | session = pe_find_session_by_session_id(mac_ctx, |
| 8282 | start_cnf->sessionId); |
| 8283 | if (!session) { |
| 8284 | pe_err("session is NULL"); |
| 8285 | return; |
| 8286 | } |
Abhishek Singh | a063f1c | 2018-09-19 11:37:51 +0530 | [diff] [blame] | 8287 | mlme_set_vdev_start_failed(session->vdev, true); |
Abhishek Singh | c5a5408 | 2018-09-12 16:08:03 +0530 | [diff] [blame] | 8288 | wlan_vdev_mlme_sm_deliver_evt(session->vdev, |
| 8289 | WLAN_VDEV_SM_EV_START_REQ_FAIL, |
| 8290 | sizeof(*start_cnf), start_cnf); |
| 8291 | } |
| 8292 | } |
| 8293 | |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8294 | #else |
| 8295 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 8296 | void lim_send_start_bss_confirm(struct mac_context *mac_ctx, |
Abhishek Singh | c5a5408 | 2018-09-12 16:08:03 +0530 | [diff] [blame] | 8297 | tLimMlmStartCnf *start_cnf) |
| 8298 | { |
| 8299 | lim_post_sme_message(mac_ctx, LIM_MLM_START_CNF, |
| 8300 | (uint32_t *)start_cnf); |
| 8301 | } |
| 8302 | |
Jeff Johnson | d01da6b | 2018-12-02 12:10:22 -0800 | [diff] [blame] | 8303 | void lim_send_beacon(struct mac_context *mac_ctx, struct pe_session *session) |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8304 | { |
Abhishek Singh | fc740be | 2018-10-12 11:34:26 +0530 | [diff] [blame] | 8305 | lim_send_beacon_ind(mac_ctx, session, REASON_DEFAULT); |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8306 | } |
Manikandan Mohan | 4cc1c5a | 2018-10-09 13:25:30 -0700 | [diff] [blame] | 8307 | |
Jeff Johnson | c8baa90 | 2018-11-18 21:59:07 -0800 | [diff] [blame] | 8308 | void lim_ndi_mlme_vdev_up_transition(struct pe_session *session) |
Manikandan Mohan | 4cc1c5a | 2018-10-09 13:25:30 -0700 | [diff] [blame] | 8309 | { |
| 8310 | } |
Abhishek Singh | 3d30a3b | 2018-09-12 15:49:18 +0530 | [diff] [blame] | 8311 | #endif |