Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /** |
| 20 | * \file lim_send_management_frames.c |
| 21 | * |
| 22 | * \brief Code for preparing and sending 802.11 Management frames |
| 23 | * |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #include "sir_api.h" |
| 28 | #include "ani_global.h" |
| 29 | #include "sir_mac_prot_def.h" |
| 30 | #include "cfg_api.h" |
| 31 | #include "utils_api.h" |
| 32 | #include "lim_types.h" |
| 33 | #include "lim_utils.h" |
| 34 | #include "lim_security_utils.h" |
| 35 | #include "lim_prop_exts_utils.h" |
| 36 | #include "dot11f.h" |
| 37 | #include "lim_sta_hash_api.h" |
| 38 | #include "sch_api.h" |
| 39 | #include "lim_send_messages.h" |
| 40 | #include "lim_assoc_utils.h" |
| 41 | #include "lim_ft.h" |
| 42 | #ifdef WLAN_FEATURE_11W |
| 43 | #include "wni_cfg.h" |
| 44 | #endif |
| 45 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #include "lim_session.h" |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 48 | #include "qdf_types.h" |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 49 | #include "qdf_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | #include "cds_utils.h" |
| 51 | #include "sme_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 52 | #include "rrm_api.h" |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 53 | #include "qdf_crypto.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 54 | |
| 55 | #include "wma_types.h" |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 56 | #include <cdp_txrx_cmn.h> |
Tushnim Bhattacharyya | 45ed04f | 2017-03-15 10:15:05 -0700 | [diff] [blame] | 57 | #include <cdp_txrx_peer_ops.h> |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 58 | #include "lim_process_fils.h" |
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 | /** |
| 62 | * |
| 63 | * \brief This function is called to add the sequence number to the |
| 64 | * management frames |
| 65 | * |
| 66 | * \param pMac Pointer to Global MAC structure |
| 67 | * |
| 68 | * \param pMacHdr Pointer to MAC management header |
| 69 | * |
| 70 | * The pMacHdr argument points to the MAC management header. The |
| 71 | * sequence number stored in the pMac structure will be incremented |
| 72 | * and updated to the MAC management header. The start sequence |
| 73 | * number is WLAN_HOST_SEQ_NUM_MIN and the end value is |
| 74 | * WLAN_HOST_SEQ_NUM_MAX. After reaching the MAX value, the sequence |
| 75 | * number will roll over. |
| 76 | * |
| 77 | */ |
Jeff Johnson | 38112a3 | 2016-10-07 07:30:50 -0700 | [diff] [blame] | 78 | static void lim_add_mgmt_seq_num(tpAniSirGlobal pMac, tpSirMacMgmtHdr pMacHdr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 79 | { |
| 80 | if (pMac->mgmtSeqNum >= WLAN_HOST_SEQ_NUM_MAX) { |
| 81 | pMac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN - 1; |
| 82 | } |
| 83 | |
| 84 | pMac->mgmtSeqNum++; |
| 85 | |
| 86 | pMacHdr->seqControl.seqNumLo = (pMac->mgmtSeqNum & LOW_SEQ_NUM_MASK); |
| 87 | pMacHdr->seqControl.seqNumHi = |
| 88 | ((pMac->mgmtSeqNum & HIGH_SEQ_NUM_MASK) >> HIGH_SEQ_NUM_OFFSET); |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * |
| 93 | * \brief This function is called before sending a p2p action frame |
| 94 | * inorder to add sequence numbers to action packets |
| 95 | * |
| 96 | * \param pMac Pointer to Global MAC structure |
| 97 | * |
| 98 | * \param pBD Pointer to the frame buffer that needs to be populate |
| 99 | * |
| 100 | * The pMacHdr argument points to the MAC management header. The |
| 101 | * sequence number stored in the pMac structure will be incremented |
| 102 | * and updated to the MAC management header. The start sequence |
| 103 | * number is WLAN_HOST_SEQ_NUM_MIN and the end value is |
| 104 | * WLAN_HOST_SEQ_NUM_MAX. After reaching the MAX value, the sequence |
| 105 | * number will roll over. |
| 106 | * |
| 107 | */ |
| 108 | void lim_populate_p2p_mac_header(tpAniSirGlobal pMac, uint8_t *pBD) |
| 109 | { |
| 110 | tpSirMacMgmtHdr pMacHdr; |
| 111 | |
| 112 | /* / Prepare MAC management header */ |
| 113 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 114 | |
| 115 | /* Prepare sequence number */ |
| 116 | lim_add_mgmt_seq_num(pMac, pMacHdr); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 117 | pe_debug("seqNumLo=%d, seqNumHi=%d, mgmtSeqNum=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 118 | pMacHdr->seqControl.seqNumLo, |
| 119 | pMacHdr->seqControl.seqNumHi, pMac->mgmtSeqNum); |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * lim_populate_mac_header() - Fill in 802.11 header of frame |
| 124 | * |
| 125 | * @mac_ctx: Pointer to Global MAC structure |
| 126 | * @buf: Pointer to the frame buffer that needs to be populate |
| 127 | * @type: 802.11 Type of the frame |
| 128 | * @sub_type: 802.11 Subtype of the frame |
| 129 | * @peer_addr: dst address |
| 130 | * @self_mac_addr: local mac address |
| 131 | * |
| 132 | * This function is called by various LIM modules to prepare the |
| 133 | * 802.11 frame MAC header |
| 134 | * |
| 135 | * The buf argument points to the beginning of the frame buffer to |
| 136 | * which - a) The 802.11 MAC header is set b) Following this MAC header |
| 137 | * will be the MGMT frame payload The payload itself is populated by the |
| 138 | * caller API |
| 139 | * |
| 140 | * Return: None |
| 141 | */ |
| 142 | |
| 143 | void lim_populate_mac_header(tpAniSirGlobal mac_ctx, uint8_t *buf, |
| 144 | uint8_t type, uint8_t sub_type, tSirMacAddr peer_addr, |
| 145 | tSirMacAddr self_mac_addr) |
| 146 | { |
| 147 | tpSirMacMgmtHdr mac_hdr; |
| 148 | |
| 149 | /* Prepare MAC management header */ |
| 150 | mac_hdr = (tpSirMacMgmtHdr) (buf); |
| 151 | |
| 152 | /* Prepare FC */ |
| 153 | mac_hdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 154 | mac_hdr->fc.type = type; |
| 155 | mac_hdr->fc.subType = sub_type; |
| 156 | |
| 157 | /* Prepare Address 1 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 158 | qdf_mem_copy((uint8_t *) mac_hdr->da, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 159 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 160 | |
| 161 | /* Prepare Address 2 */ |
| 162 | sir_copy_mac_addr(mac_hdr->sa, self_mac_addr); |
| 163 | |
| 164 | /* Prepare Address 3 */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 165 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 166 | (uint8_t *) peer_addr, sizeof(tSirMacAddr)); |
| 167 | |
| 168 | /* Prepare sequence number */ |
| 169 | lim_add_mgmt_seq_num(mac_ctx, mac_hdr); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 170 | pe_debug("seqNumLo=%d, seqNumHi=%d, mgmtSeqNum=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 171 | mac_hdr->seqControl.seqNumLo, |
| 172 | mac_hdr->seqControl.seqNumHi, mac_ctx->mgmtSeqNum); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * lim_send_probe_req_mgmt_frame() - send probe request management frame |
| 177 | * @mac_ctx: Pointer to Global MAC structure |
| 178 | * @ssid: SSID to be sent in Probe Request frame |
| 179 | * @bssid: BSSID to be sent in Probe Request frame |
| 180 | * @channel: Channel # on which the Probe Request is going out |
| 181 | * @self_macaddr: self MAC address |
| 182 | * @dot11mode: self dotllmode |
| 183 | * @additional_ielen: if non-zero, include additional_ie in the Probe Request |
| 184 | * frame |
| 185 | * @additional_ie: if additional_ielen is non zero, include this field in the |
| 186 | * Probe Request frame |
| 187 | * |
| 188 | * This function is called by various LIM modules to send Probe Request frame |
| 189 | * during active scan/learn phase. |
| 190 | * Probe request is sent out in the following scenarios: |
| 191 | * --heartbeat failure: session needed |
| 192 | * --join req: session needed |
| 193 | * --foreground scan: no session |
| 194 | * --background scan: no session |
| 195 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 196 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 197 | * Return: QDF_STATUS (QDF_STATUS_SUCCESS on success and error codes otherwise) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 198 | */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 199 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 200 | lim_send_probe_req_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 201 | tSirMacSSid *ssid, |
| 202 | tSirMacAddr bssid, |
| 203 | uint8_t channel, |
| 204 | tSirMacAddr self_macaddr, |
| 205 | uint32_t dot11mode, |
Sandeep Puligilla | 06ae890 | 2018-04-16 19:02:47 -0700 | [diff] [blame] | 206 | uint16_t *additional_ielen, uint8_t *additional_ie) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 207 | { |
| 208 | tDot11fProbeRequest pr; |
| 209 | uint32_t status, bytes, payload; |
| 210 | uint8_t *frame; |
| 211 | void *packet; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 212 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 213 | tpPESession pesession; |
| 214 | uint8_t sessionid; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 215 | const uint8_t *p2pie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 216 | uint8_t txflag = 0; |
| 217 | uint8_t sme_sessionid = 0; |
| 218 | bool is_vht_enabled = false; |
| 219 | uint8_t txPower; |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 220 | uint16_t addn_ielen = 0; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 221 | bool extracted_ext_cap_flag = false; |
| 222 | tDot11fIEExtCap extracted_ext_cap; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 223 | QDF_STATUS sir_status; |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 224 | const uint8_t *qcn_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 225 | |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 226 | if (additional_ielen) |
| 227 | addn_ielen = *additional_ielen; |
| 228 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 229 | /* The probe req should not send 11ac capabilieties if band is 2.4GHz, |
| 230 | * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz |
| 231 | * is false and dot11mode is 11ac set it to 11n. |
| 232 | */ |
| 233 | if (channel <= SIR_11B_CHANNEL_END && |
| 234 | (false == mac_ctx->roam.configParam.enableVhtFor24GHz) && |
| 235 | (WNI_CFG_DOT11_MODE_11AC == dot11mode || |
| 236 | WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode)) |
| 237 | dot11mode = WNI_CFG_DOT11_MODE_11N; |
| 238 | /* |
| 239 | * session context may or may not be present, when probe request needs |
| 240 | * to be sent out. Following cases exist: |
| 241 | * --heartbeat failure: session needed |
| 242 | * --join req: session needed |
| 243 | * --foreground scan: no session |
| 244 | * --background scan: no session |
| 245 | * --sch_beacon_processing: to get EDCA parameters: session needed |
| 246 | * If session context does not exist, some IEs will be populated from |
| 247 | * CFGs, e.g. Supported and Extended rate set IEs |
| 248 | */ |
| 249 | pesession = pe_find_session_by_bssid(mac_ctx, bssid, &sessionid); |
| 250 | |
| 251 | if (pesession != NULL) |
| 252 | sme_sessionid = pesession->smeSessionId; |
| 253 | |
| 254 | /* The scheme here is to fill out a 'tDot11fProbeRequest' structure */ |
| 255 | /* and then hand it off to 'dot11f_pack_probe_request' (for */ |
| 256 | /* serialization). We start by zero-initializing the structure: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 257 | qdf_mem_set((uint8_t *) &pr, sizeof(pr), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | |
| 259 | /* & delegating to assorted helpers: */ |
| 260 | populate_dot11f_ssid(mac_ctx, ssid, &pr.SSID); |
| 261 | |
| 262 | if (addn_ielen && additional_ie) |
| 263 | p2pie = limGetP2pIEPtr(mac_ctx, additional_ie, addn_ielen); |
| 264 | |
| 265 | /* |
| 266 | * Don't include 11b rate if it is a P2P serach or probe request is |
| 267 | * sent by P2P Client |
| 268 | */ |
| 269 | if ((WNI_CFG_DOT11_MODE_11B != dot11mode) && (p2pie != NULL) && |
Abhishek Singh | 221cf99 | 2018-02-22 13:44:53 +0530 | [diff] [blame] | 270 | ((pesession != NULL) && |
| 271 | (QDF_P2P_CLIENT_MODE == pesession->pePersona))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 272 | /* |
| 273 | * In the below API pass channel number > 14, do that it fills |
| 274 | * only 11a rates in supported rates |
| 275 | */ |
| 276 | populate_dot11f_supp_rates(mac_ctx, 15, &pr.SuppRates, |
| 277 | pesession); |
| 278 | } else { |
| 279 | populate_dot11f_supp_rates(mac_ctx, channel, |
| 280 | &pr.SuppRates, pesession); |
| 281 | |
| 282 | if (WNI_CFG_DOT11_MODE_11B != dot11mode) { |
| 283 | populate_dot11f_ext_supp_rates1(mac_ctx, channel, |
| 284 | &pr.ExtSuppRates); |
| 285 | } |
| 286 | } |
| 287 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 288 | /* |
| 289 | * Table 7-14 in IEEE Std. 802.11k-2008 says |
| 290 | * DS params "can" be present in RRM is disabled and "is" present if |
| 291 | * RRM is enabled. It should be ok even if we add it into probe req when |
| 292 | * RRM is not enabled. |
| 293 | */ |
| 294 | populate_dot11f_ds_params(mac_ctx, &pr.DSParams, channel); |
| 295 | /* Call RRM module to get the tx power for management used. */ |
| 296 | txPower = (uint8_t) rrm_get_mgmt_tx_power(mac_ctx, pesession); |
| 297 | populate_dot11f_wfatpc(mac_ctx, &pr.WFATPC, txPower, 0); |
| 298 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 299 | |
| 300 | if (pesession != NULL) { |
| 301 | pesession->htCapability = IS_DOT11_MODE_HT(dot11mode); |
| 302 | /* Include HT Capability IE */ |
| 303 | if (pesession->htCapability) |
| 304 | populate_dot11f_ht_caps(mac_ctx, pesession, &pr.HTCaps); |
| 305 | } else { /* pesession == NULL */ |
| 306 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 307 | populate_dot11f_ht_caps(mac_ctx, NULL, &pr.HTCaps); |
| 308 | } |
| 309 | |
| 310 | /* |
| 311 | * Set channelbonding information as "disabled" when tunned to a |
| 312 | * 2.4 GHz channel |
| 313 | */ |
| 314 | if (channel <= SIR_11B_CHANNEL_END) { |
| 315 | if (mac_ctx->roam.configParam.channelBondingMode24GHz |
| 316 | == PHY_SINGLE_CHANNEL_CENTERED) { |
| 317 | pr.HTCaps.supportedChannelWidthSet = |
| 318 | eHT_CHANNEL_WIDTH_20MHZ; |
| 319 | pr.HTCaps.shortGI40MHz = 0; |
| 320 | } else { |
| 321 | pr.HTCaps.supportedChannelWidthSet = |
| 322 | eHT_CHANNEL_WIDTH_40MHZ; |
| 323 | } |
| 324 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 325 | if (pesession != NULL) { |
| 326 | pesession->vhtCapability = IS_DOT11_MODE_VHT(dot11mode); |
| 327 | /* Include VHT Capability IE */ |
| 328 | if (pesession->vhtCapability) { |
| 329 | populate_dot11f_vht_caps(mac_ctx, pesession, |
| 330 | &pr.VHTCaps); |
| 331 | is_vht_enabled = true; |
| 332 | } |
| 333 | } else { |
| 334 | if (IS_DOT11_MODE_VHT(dot11mode)) { |
| 335 | populate_dot11f_vht_caps(mac_ctx, pesession, |
| 336 | &pr.VHTCaps); |
| 337 | is_vht_enabled = true; |
| 338 | } |
| 339 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 340 | if (pesession != NULL) |
| 341 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &pr.ExtCap, |
| 342 | pesession); |
| 343 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 344 | if (IS_DOT11_MODE_HE(dot11mode) && NULL != pesession) |
| 345 | lim_update_session_he_capable(mac_ctx, pesession); |
| 346 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 347 | pe_debug("Populate HE IEs"); |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 348 | populate_dot11f_he_caps(mac_ctx, pesession, &pr.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 349 | |
Sandeep Puligilla | 493fea2 | 2018-04-30 15:31:17 -0700 | [diff] [blame] | 350 | if (addn_ielen && additional_ie) { |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 351 | qdf_mem_zero((uint8_t *)&extracted_ext_cap, |
| 352 | sizeof(tDot11fIEExtCap)); |
| 353 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 354 | additional_ie, |
| 355 | &addn_ielen, |
| 356 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 357 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 358 | pe_debug("Unable to Stripoff ExtCap IE from Probe Req"); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 359 | } else { |
| 360 | struct s_ext_cap *p_ext_cap = |
| 361 | (struct s_ext_cap *) |
| 362 | extracted_ext_cap.bytes; |
| 363 | if (p_ext_cap->interworking_service) |
| 364 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 365 | extracted_ext_cap.num_bytes = |
| 366 | lim_compute_ext_cap_ie_length |
| 367 | (&extracted_ext_cap); |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 368 | extracted_ext_cap_flag = |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 369 | (extracted_ext_cap.num_bytes > 0); |
Arif Hussain | 4c26513 | 2018-04-23 18:55:26 -0700 | [diff] [blame] | 370 | if (additional_ielen) |
| 371 | *additional_ielen = addn_ielen; |
Kapil Gupta | c03eb07 | 2016-08-09 14:01:36 +0530 | [diff] [blame] | 372 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 373 | qcn_ie = wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_QCN_OUI_TYPE, |
| 374 | SIR_MAC_QCN_OUI_TYPE_SIZE, |
| 375 | additional_ie, addn_ielen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 376 | } |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 377 | /* Add qcn_ie only if qcn ie is not present in additional_ie */ |
Wu Gao | 9381621 | 2018-08-31 16:49:54 +0800 | [diff] [blame] | 378 | if (mac_ctx->mlme_cfg->sta.qcn_ie_support && !qcn_ie) |
Abhishek Singh | 67e02bd | 2017-12-11 10:47:12 +0530 | [diff] [blame] | 379 | populate_dot11f_qcn_ie(&pr.QCN_IE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 380 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 381 | /* |
| 382 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 383 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 384 | * dot11f get packed payload size. |
| 385 | */ |
| 386 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 387 | lim_merge_extcap_struct(&pr.ExtCap, &extracted_ext_cap, true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 388 | |
| 389 | /* That's it-- now we pack it. First, how much space are we going to */ |
| 390 | status = dot11f_get_packed_probe_request_size(mac_ctx, &pr, &payload); |
| 391 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 392 | pe_err("Failed to calculate the packed size for a Probe Request (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 393 | status); |
| 394 | /* We'll fall back on the worst case scenario: */ |
| 395 | payload = sizeof(tDot11fProbeRequest); |
| 396 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 397 | pe_warn("There were warnings while calculating the packed size for a Probe Request (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 398 | status); |
| 399 | } |
| 400 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 401 | bytes = payload + sizeof(tSirMacMgmtHdr) + addn_ielen; |
| 402 | |
| 403 | /* Ok-- try to allocate some memory: */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 404 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 405 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 406 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 407 | pe_err("Failed to allocate %d bytes for a Probe Request", bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 408 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 409 | } |
| 410 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 411 | qdf_mem_set(frame, bytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 412 | |
| 413 | /* Next, we fill out the buffer descriptor: */ |
| 414 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 415 | SIR_MAC_MGMT_PROBE_REQ, bssid, self_macaddr); |
| 416 | |
| 417 | /* That done, pack the Probe Request: */ |
| 418 | status = dot11f_pack_probe_request(mac_ctx, &pr, frame + |
| 419 | sizeof(tSirMacMgmtHdr), |
| 420 | payload, &payload); |
| 421 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 422 | pe_err("Failed to pack a Probe Request (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 423 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 424 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 425 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 426 | pe_warn("There were warnings while packing a Probe Request (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | } |
| 428 | /* Append any AddIE if present. */ |
| 429 | if (addn_ielen) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 430 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 431 | additional_ie, addn_ielen); |
| 432 | payload += addn_ielen; |
| 433 | } |
| 434 | |
| 435 | /* If this probe request is sent during P2P Search State, then we need |
| 436 | * to send it at OFDM rate. |
| 437 | */ |
Abhishek Singh | 221cf99 | 2018-02-22 13:44:53 +0530 | [diff] [blame] | 438 | if ((BAND_5G == lim_get_rf_band(channel)) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 439 | /* |
| 440 | * For unicast probe req mgmt from Join function we don't set |
| 441 | * above variables. So we need to add one more check whether it |
| 442 | * is pePersona is P2P_CLIENT or not |
| 443 | */ |
Abhishek Singh | 221cf99 | 2018-02-22 13:44:53 +0530 | [diff] [blame] | 444 | ((pesession != NULL) && |
| 445 | (QDF_P2P_CLIENT_MODE == pesession->pePersona))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 446 | txflag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 447 | } |
| 448 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 449 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | wma_tx_frame(mac_ctx, packet, |
| 451 | (uint16_t) sizeof(tSirMacMgmtHdr) + payload, |
| 452 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
| 453 | lim_tx_complete, frame, txflag, sme_sessionid, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 454 | 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 455 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 456 | pe_err("could not send Probe Request frame!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 457 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 458 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 459 | } |
| 460 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 461 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 462 | } /* End lim_send_probe_req_mgmt_frame. */ |
| 463 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 464 | static QDF_STATUS lim_get_addn_ie_for_probe_resp(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 465 | uint8_t *addIE, uint16_t *addnIELen, |
| 466 | uint8_t probeReqP2pIe) |
| 467 | { |
| 468 | /* If Probe request doesn't have P2P IE, then take out P2P IE |
| 469 | from additional IE */ |
| 470 | if (!probeReqP2pIe) { |
| 471 | uint8_t *tempbuf = NULL; |
| 472 | uint16_t tempLen = 0; |
| 473 | int left = *addnIELen; |
| 474 | uint8_t *ptr = addIE; |
| 475 | uint8_t elem_id, elem_len; |
| 476 | |
| 477 | if (NULL == addIE) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 478 | pe_err("NULL addIE pointer"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 479 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 480 | } |
| 481 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 482 | tempbuf = qdf_mem_malloc(left); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 483 | if (NULL == tempbuf) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 484 | pe_err("Unable to allocate memory to store addn IE"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 485 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 486 | } |
| 487 | |
| 488 | while (left >= 2) { |
| 489 | elem_id = ptr[0]; |
| 490 | elem_len = ptr[1]; |
| 491 | left -= 2; |
| 492 | if (elem_len > left) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 493 | pe_err("Invalid IEs eid: %d elem_len: %d left: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 494 | elem_id, elem_len, left); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 495 | qdf_mem_free(tempbuf); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 496 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 497 | } |
| 498 | if (!((SIR_MAC_EID_VENDOR == elem_id) && |
| 499 | (memcmp |
| 500 | (&ptr[2], SIR_MAC_P2P_OUI, |
| 501 | SIR_MAC_P2P_OUI_SIZE) == 0))) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 502 | qdf_mem_copy(tempbuf + tempLen, &ptr[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 503 | elem_len + 2); |
| 504 | tempLen += (elem_len + 2); |
| 505 | } |
| 506 | left -= elem_len; |
| 507 | ptr += (elem_len + 2); |
| 508 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 509 | qdf_mem_copy(addIE, tempbuf, tempLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 510 | *addnIELen = tempLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 511 | qdf_mem_free(tempbuf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 512 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 513 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | /** |
| 517 | * lim_send_probe_rsp_mgmt_frame() - Send probe response |
| 518 | * |
| 519 | * @mac_ctx: Handle for mac context |
| 520 | * @peer_macaddr: Mac address of requesting peer |
| 521 | * @ssid: SSID for response |
| 522 | * @n_staid: Station ID, currently unused. |
| 523 | * @pe_session: PE session id |
| 524 | * @keepalive: Keep alive flag. Currently unused. |
| 525 | * @preq_p2pie: P2P IE in incoming probe request |
| 526 | * |
| 527 | * Builds and sends probe response frame to the requesting peer |
| 528 | * |
| 529 | * Return: void |
| 530 | */ |
| 531 | |
| 532 | void |
| 533 | lim_send_probe_rsp_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 534 | tSirMacAddr peer_macaddr, |
| 535 | tpAniSSID ssid, |
| 536 | short n_staid, |
| 537 | uint8_t keepalive, |
| 538 | tpPESession pe_session, uint8_t preq_p2pie) |
| 539 | { |
| 540 | tDot11fProbeResponse *frm; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 541 | QDF_STATUS sir_status; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 542 | uint32_t cfg, payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 543 | tpSirMacMgmtHdr mac_hdr; |
| 544 | uint8_t *frame; |
Arif Hussain | fbf5068 | 2016-06-15 12:57:43 -0700 | [diff] [blame] | 545 | void *packet = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 546 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 547 | uint32_t addn_ie_present = false; |
| 548 | |
| 549 | uint16_t addn_ie_len = 0; |
| 550 | uint32_t wps_ap = 0, tmp; |
| 551 | uint8_t tx_flag = 0; |
| 552 | uint8_t *add_ie = NULL; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 553 | const uint8_t *p2p_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 554 | uint8_t noalen = 0; |
| 555 | uint8_t total_noalen = 0; |
| 556 | uint8_t noa_stream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 557 | uint8_t noa_ie[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; |
| 558 | uint8_t sme_sessionid = 0; |
| 559 | bool is_vht_enabled = false; |
Padma, Santhosh Kumar | 9223447 | 2017-04-19 18:20:02 +0530 | [diff] [blame] | 560 | tDot11fIEExtCap extracted_ext_cap = {0}; |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 561 | bool extracted_ext_cap_flag = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 562 | |
| 563 | /* We don't answer requests in this case*/ |
Srinivas Girigowda | 35b0031 | 2017-06-27 21:52:03 -0700 | [diff] [blame] | 564 | if (ANI_DRIVER_TYPE(mac_ctx) == QDF_DRIVER_TYPE_MFG) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 565 | return; |
| 566 | |
| 567 | if (NULL == pe_session) |
| 568 | return; |
| 569 | |
| 570 | /* |
| 571 | * In case when cac timer is running for this SAP session then |
| 572 | * avoid sending probe rsp out. It is violation of dfs specification. |
| 573 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 574 | if (((pe_session->pePersona == QDF_SAP_MODE) || |
| 575 | (pe_session->pePersona == QDF_P2P_GO_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 576 | (true == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 577 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 578 | FL("CAC timer is running, probe response dropped")); |
| 579 | return; |
| 580 | } |
| 581 | sme_sessionid = pe_session->smeSessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 582 | frm = qdf_mem_malloc(sizeof(tDot11fProbeResponse)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 583 | if (NULL == frm) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 584 | pe_err("Unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 585 | return; |
| 586 | } |
| 587 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 588 | /* |
| 589 | * Fill out 'frm', after which we'll just hand the struct off to |
| 590 | * 'dot11f_pack_probe_response'. |
| 591 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 592 | qdf_mem_set((uint8_t *) frm, sizeof(tDot11fProbeResponse), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 593 | |
| 594 | /* |
| 595 | * Timestamp to be updated by TFP, below. |
| 596 | * |
| 597 | * Beacon Interval: |
| 598 | */ |
| 599 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 600 | frm->BeaconInterval.interval = |
| 601 | mac_ctx->sch.schObject.gSchBeaconInterval; |
| 602 | } else { |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame^] | 603 | cfg = mac_ctx->mlme_cfg->sap_cfg.beacon_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 604 | frm->BeaconInterval.interval = (uint16_t) cfg; |
| 605 | } |
| 606 | |
| 607 | populate_dot11f_capabilities(mac_ctx, &frm->Capabilities, pe_session); |
| 608 | populate_dot11f_ssid(mac_ctx, (tSirMacSSid *) ssid, &frm->SSID); |
| 609 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 610 | &frm->SuppRates, pe_session); |
| 611 | |
| 612 | populate_dot11f_ds_params(mac_ctx, &frm->DSParams, |
| 613 | pe_session->currentOperChannel); |
| 614 | populate_dot11f_ibss_params(mac_ctx, &frm->IBSSParams, pe_session); |
| 615 | |
| 616 | if (LIM_IS_AP_ROLE(pe_session)) { |
| 617 | if (pe_session->wps_state != SAP_WPS_DISABLED) |
| 618 | populate_dot11f_probe_res_wpsi_es(mac_ctx, |
| 619 | &frm->WscProbeRes, |
| 620 | pe_session); |
| 621 | } else { |
| 622 | if (wlan_cfg_get_int(mac_ctx, (uint16_t) WNI_CFG_WPS_ENABLE, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 623 | &tmp) != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 624 | pe_err("Failed to cfg get id %d", WNI_CFG_WPS_ENABLE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 625 | |
| 626 | wps_ap = tmp & WNI_CFG_WPS_ENABLE_AP; |
| 627 | |
| 628 | if (wps_ap) |
| 629 | populate_dot11f_wsc_in_probe_res(mac_ctx, |
| 630 | &frm->WscProbeRes); |
| 631 | |
| 632 | if (mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState == |
| 633 | eLIM_WSC_ENROLL_BEGIN) { |
| 634 | populate_dot11f_wsc_registrar_info_in_probe_res(mac_ctx, |
| 635 | &frm->WscProbeRes); |
| 636 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 637 | eLIM_WSC_ENROLL_IN_PROGRESS; |
| 638 | } |
| 639 | |
| 640 | if (mac_ctx->lim.wscIeInfo.wscEnrollmentState == |
| 641 | eLIM_WSC_ENROLL_END) { |
| 642 | de_populate_dot11f_wsc_registrar_info_in_probe_res( |
| 643 | mac_ctx, &frm->WscProbeRes); |
| 644 | mac_ctx->lim.wscIeInfo.probeRespWscEnrollmentState = |
| 645 | eLIM_WSC_ENROLL_NOOP; |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | populate_dot11f_country(mac_ctx, &frm->Country, pe_session); |
| 650 | populate_dot11f_edca_param_set(mac_ctx, &frm->EDCAParamSet, pe_session); |
| 651 | |
| 652 | if (pe_session->dot11mode != WNI_CFG_DOT11_MODE_11B) |
| 653 | populate_dot11f_erp_info(mac_ctx, &frm->ERPInfo, pe_session); |
| 654 | |
| 655 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 656 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 657 | &frm->ExtSuppRates, pe_session); |
| 658 | |
| 659 | /* Populate HT IEs, when operating in 11n */ |
| 660 | if (pe_session->htCapability) { |
| 661 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
| 662 | populate_dot11f_ht_info(mac_ctx, &frm->HTInfo, pe_session); |
| 663 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 664 | if (pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 665 | pe_debug("Populate VHT IE in Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 666 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
| 667 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 668 | &frm->VHTOperation); |
| 669 | /* |
| 670 | * we do not support multi users yet. |
| 671 | * populate_dot11f_vht_ext_bss_load( mac_ctx, |
| 672 | * &frm.VHTExtBssLoad ); |
| 673 | */ |
| 674 | is_vht_enabled = true; |
| 675 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 676 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 677 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 678 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 679 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 680 | &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 681 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 682 | &frm->he_op); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 683 | } |
| 684 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 685 | populate_dot11f_ext_cap(mac_ctx, is_vht_enabled, &frm->ExtCap, |
| 686 | pe_session); |
| 687 | |
| 688 | if (pe_session->pLimStartBssReq) { |
| 689 | populate_dot11f_wpa(mac_ctx, |
| 690 | &(pe_session->pLimStartBssReq->rsnIE), |
| 691 | &frm->WPA); |
| 692 | populate_dot11f_rsn_opaque(mac_ctx, |
| 693 | &(pe_session->pLimStartBssReq->rsnIE), |
| 694 | &frm->RSNOpaque); |
| 695 | } |
| 696 | |
| 697 | populate_dot11f_wmm(mac_ctx, &frm->WMMInfoAp, &frm->WMMParams, |
| 698 | &frm->WMMCaps, pe_session); |
| 699 | |
| 700 | #if defined(FEATURE_WLAN_WAPI) |
| 701 | if (pe_session->pLimStartBssReq) |
| 702 | populate_dot11f_wapi(mac_ctx, |
| 703 | &(pe_session->pLimStartBssReq->rsnIE), |
| 704 | &frm->WAPI); |
| 705 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 706 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 707 | if (mac_ctx->lim.gpLimRemainOnChanReq) |
| 708 | bytes += (mac_ctx->lim.gpLimRemainOnChanReq->length - |
| 709 | sizeof(tSirRemainOnChnReq)); |
| 710 | else |
| 711 | /* |
| 712 | * Only use CFG for non-listen mode. This CFG is not working for |
| 713 | * concurrency. In listening mode, probe rsp IEs is passed in |
| 714 | * the message from SME to PE. |
| 715 | */ |
| 716 | addn_ie_present = |
| 717 | (pe_session->addIeParams.probeRespDataLen != 0); |
| 718 | |
| 719 | if (addn_ie_present) { |
| 720 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 721 | add_ie = qdf_mem_malloc( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 722 | pe_session->addIeParams.probeRespDataLen); |
| 723 | if (NULL == add_ie) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 724 | pe_err("add_ie allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 725 | goto err_ret; |
| 726 | } |
| 727 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 728 | qdf_mem_copy(add_ie, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 729 | pe_session->addIeParams.probeRespData_buff, |
| 730 | pe_session->addIeParams.probeRespDataLen); |
| 731 | addn_ie_len = pe_session->addIeParams.probeRespDataLen; |
| 732 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 733 | if (QDF_STATUS_SUCCESS != lim_get_addn_ie_for_probe_resp(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 734 | add_ie, &addn_ie_len, preq_p2pie)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 735 | pe_err("Unable to get addn_ie"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 736 | goto err_ret; |
| 737 | } |
| 738 | |
| 739 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 740 | add_ie, &addn_ie_len, |
| 741 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 742 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 743 | pe_debug("Unable to strip off ExtCap IE"); |
Selvaraj, Sridhar | 94ece20 | 2016-06-23 20:44:09 +0530 | [diff] [blame] | 744 | } else { |
| 745 | extracted_ext_cap_flag = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | bytes = bytes + addn_ie_len; |
| 749 | |
| 750 | if (preq_p2pie) |
| 751 | p2p_ie = limGetP2pIEPtr(mac_ctx, &add_ie[0], |
| 752 | addn_ie_len); |
| 753 | |
| 754 | if (p2p_ie != NULL) { |
| 755 | /* get NoA attribute stream P2P IE */ |
| 756 | noalen = lim_get_noa_attr_stream(mac_ctx, |
| 757 | noa_stream, pe_session); |
| 758 | if (noalen != 0) { |
| 759 | total_noalen = |
| 760 | lim_build_p2p_ie(mac_ctx, &noa_ie[0], |
| 761 | &noa_stream[0], noalen); |
| 762 | bytes = bytes + total_noalen; |
| 763 | } |
| 764 | } |
| 765 | } |
| 766 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 767 | /* |
| 768 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 769 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 770 | * dot11f get packed payload size. |
| 771 | */ |
| 772 | if (extracted_ext_cap_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 773 | lim_merge_extcap_struct(&frm->ExtCap, &extracted_ext_cap, |
| 774 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 775 | |
| 776 | status = dot11f_get_packed_probe_response_size(mac_ctx, frm, &payload); |
| 777 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 778 | pe_err("Probe Response size error (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 779 | status); |
| 780 | /* We'll fall back on the worst case scenario: */ |
| 781 | payload = sizeof(tDot11fProbeResponse); |
| 782 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 783 | pe_warn("Probe Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 784 | status); |
| 785 | } |
| 786 | |
| 787 | bytes += payload + sizeof(tSirMacMgmtHdr); |
| 788 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 789 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 790 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 791 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 792 | pe_err("Probe Response allocation failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 793 | goto err_ret; |
| 794 | } |
| 795 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 796 | qdf_mem_set(frame, bytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 797 | |
| 798 | /* Next, we fill out the buffer descriptor: */ |
| 799 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 800 | SIR_MAC_MGMT_PROBE_RSP, peer_macaddr, |
| 801 | pe_session->selfMacAddr); |
| 802 | |
| 803 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 804 | |
| 805 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 806 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 807 | /* That done, pack the Probe Response: */ |
| 808 | status = |
| 809 | dot11f_pack_probe_response(mac_ctx, frm, |
| 810 | frame + sizeof(tSirMacMgmtHdr), |
| 811 | payload, &payload); |
| 812 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 813 | pe_err("Probe Response pack failure (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 814 | status); |
| 815 | goto err_ret; |
| 816 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 817 | pe_warn("Probe Response pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 818 | } |
| 819 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 820 | pe_debug("Sending Probe Response frame to"); |
Nishank Aggarwal | 46bd31a | 2017-03-10 16:23:53 +0530 | [diff] [blame] | 821 | lim_print_mac_addr(mac_ctx, peer_macaddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 822 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 823 | if (mac_ctx->lim.gpLimRemainOnChanReq) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 824 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 825 | mac_ctx->lim.gpLimRemainOnChanReq->probeRspIe, |
| 826 | (mac_ctx->lim.gpLimRemainOnChanReq->length - |
| 827 | sizeof(tSirRemainOnChnReq))); |
| 828 | |
| 829 | if (addn_ie_present) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 830 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 831 | &add_ie[0], addn_ie_len); |
| 832 | |
| 833 | if (noalen != 0) { |
| 834 | if (total_noalen > |
| 835 | (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 836 | pe_err("Not able to insert NoA, total len=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 837 | total_noalen); |
| 838 | goto err_ret; |
| 839 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 840 | qdf_mem_copy(&frame[bytes - (total_noalen)], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | &noa_ie[0], total_noalen); |
| 842 | } |
| 843 | } |
| 844 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 845 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 846 | || (pe_session->pePersona == QDF_P2P_CLIENT_MODE) || |
| 847 | (pe_session->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | ) |
| 849 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 850 | |
| 851 | /* Queue Probe Response frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 852 | qdf_status = wma_tx_frame((tHalHandle) mac_ctx, packet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 853 | (uint16_t) bytes, |
| 854 | TXRX_FRM_802_11_MGMT, |
| 855 | ANI_TXDIR_TODS, |
| 856 | 7, lim_tx_complete, frame, tx_flag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 857 | sme_sessionid, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 858 | |
| 859 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 860 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 861 | pe_err("Could not send Probe Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 862 | |
| 863 | if (add_ie != NULL) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 864 | qdf_mem_free(add_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 865 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 866 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 867 | return; |
| 868 | |
| 869 | err_ret: |
| 870 | if (add_ie != NULL) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 871 | qdf_mem_free(add_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 872 | if (frm != NULL) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 873 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 874 | if (packet != NULL) |
| 875 | cds_packet_free((void *)packet); |
| 876 | return; |
| 877 | |
| 878 | } /* End lim_send_probe_rsp_mgmt_frame. */ |
| 879 | |
| 880 | void |
| 881 | lim_send_addts_req_action_frame(tpAniSirGlobal pMac, |
| 882 | tSirMacAddr peerMacAddr, |
| 883 | tSirAddtsReqInfo *pAddTS, tpPESession psessionEntry) |
| 884 | { |
| 885 | uint16_t i; |
| 886 | uint8_t *pFrame; |
| 887 | tDot11fAddTSRequest AddTSReq; |
| 888 | tDot11fWMMAddTSRequest WMMAddTSReq; |
| 889 | uint32_t nPayload, nBytes, nStatus; |
| 890 | tpSirMacMgmtHdr pMacHdr; |
| 891 | void *pPacket; |
| 892 | #ifdef FEATURE_WLAN_ESE |
| 893 | uint32_t phyMode; |
| 894 | #endif |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 895 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 896 | uint8_t txFlag = 0; |
| 897 | uint8_t smeSessionId = 0; |
| 898 | |
| 899 | if (NULL == psessionEntry) { |
| 900 | return; |
| 901 | } |
| 902 | |
| 903 | smeSessionId = psessionEntry->smeSessionId; |
| 904 | |
| 905 | if (!pAddTS->wmeTspecPresent) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 906 | qdf_mem_set((uint8_t *) &AddTSReq, sizeof(AddTSReq), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 907 | |
| 908 | AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 909 | AddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 910 | AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 911 | if (pAddTS->lleTspecPresent) { |
| 912 | populate_dot11f_tspec(&pAddTS->tspec, &AddTSReq.TSPEC); |
| 913 | } else { |
| 914 | populate_dot11f_wmmtspec(&pAddTS->tspec, |
| 915 | &AddTSReq.WMMTSPEC); |
| 916 | } |
| 917 | |
| 918 | if (pAddTS->lleTspecPresent) { |
| 919 | AddTSReq.num_WMMTCLAS = 0; |
| 920 | AddTSReq.num_TCLAS = pAddTS->numTclas; |
| 921 | for (i = 0; i < pAddTS->numTclas; ++i) { |
| 922 | populate_dot11f_tclas(pMac, &pAddTS->tclasInfo[i], |
| 923 | &AddTSReq.TCLAS[i]); |
| 924 | } |
| 925 | } else { |
| 926 | AddTSReq.num_TCLAS = 0; |
| 927 | AddTSReq.num_WMMTCLAS = pAddTS->numTclas; |
| 928 | for (i = 0; i < pAddTS->numTclas; ++i) { |
| 929 | populate_dot11f_wmmtclas(pMac, |
| 930 | &pAddTS->tclasInfo[i], |
| 931 | &AddTSReq.WMMTCLAS[i]); |
| 932 | } |
| 933 | } |
| 934 | |
| 935 | if (pAddTS->tclasProcPresent) { |
| 936 | if (pAddTS->lleTspecPresent) { |
| 937 | AddTSReq.TCLASSPROC.processing = |
| 938 | pAddTS->tclasProc; |
| 939 | AddTSReq.TCLASSPROC.present = 1; |
| 940 | } else { |
| 941 | AddTSReq.WMMTCLASPROC.version = 1; |
| 942 | AddTSReq.WMMTCLASPROC.processing = |
| 943 | pAddTS->tclasProc; |
| 944 | AddTSReq.WMMTCLASPROC.present = 1; |
| 945 | } |
| 946 | } |
| 947 | |
| 948 | nStatus = |
| 949 | dot11f_get_packed_add_ts_request_size(pMac, &AddTSReq, &nPayload); |
| 950 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 951 | pe_err("Failed to calculate the packed size for an Add TS Request (0x%08x)", |
| 952 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | /* We'll fall back on the worst case scenario: */ |
| 954 | nPayload = sizeof(tDot11fAddTSRequest); |
| 955 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 956 | pe_warn("There were warnings while calculating the packed size for an Add TS Request (0x%08x)", |
| 957 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 958 | } |
| 959 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 960 | qdf_mem_set((uint8_t *) &WMMAddTSReq, sizeof(WMMAddTSReq), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 961 | |
| 962 | WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ; |
| 963 | WMMAddTSReq.DialogToken.token = pAddTS->dialogToken; |
| 964 | WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME; |
| 965 | |
| 966 | /* WMM spec 2.2.10 - status code is only filled in for ADDTS response */ |
| 967 | WMMAddTSReq.StatusCode.statusCode = 0; |
| 968 | |
| 969 | populate_dot11f_wmmtspec(&pAddTS->tspec, &WMMAddTSReq.WMMTSPEC); |
| 970 | #ifdef FEATURE_WLAN_ESE |
| 971 | lim_get_phy_mode(pMac, &phyMode, psessionEntry); |
| 972 | |
| 973 | if (phyMode == WNI_CFG_PHY_MODE_11G |
| 974 | || phyMode == WNI_CFG_PHY_MODE_11A) { |
| 975 | pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS; |
| 976 | } else { |
| 977 | pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS; |
| 978 | } |
| 979 | populate_dot11_tsrsie(pMac, &pAddTS->tsrsIE, |
| 980 | &WMMAddTSReq.ESETrafStrmRateSet, |
| 981 | sizeof(uint8_t)); |
| 982 | #endif |
| 983 | /* fillWmeTspecIE */ |
| 984 | |
| 985 | nStatus = |
| 986 | dot11f_get_packed_wmm_add_ts_request_size(pMac, &WMMAddTSReq, |
| 987 | &nPayload); |
| 988 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 989 | pe_err("Failed to calculate the packed size for a WMM Add TS Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 990 | nStatus); |
| 991 | /* We'll fall back on the worst case scenario: */ |
| 992 | nPayload = sizeof(tDot11fAddTSRequest); |
| 993 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 994 | pe_warn("There were warnings while calculating the packed size for a WMM Add TS Request (0x%08x)", |
| 995 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 996 | } |
| 997 | } |
| 998 | |
| 999 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 1000 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1001 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1002 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1003 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1004 | pe_err("Failed to allocate %d bytes for an Add TS Request", |
| 1005 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1006 | return; |
| 1007 | } |
| 1008 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1009 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1010 | |
| 1011 | /* Next, we fill out the buffer descriptor: */ |
| 1012 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1013 | SIR_MAC_MGMT_ACTION, peerMacAddr, psessionEntry->selfMacAddr); |
| 1014 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 1015 | |
| 1016 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 1017 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1018 | lim_set_protected_bit(pMac, psessionEntry, peerMacAddr, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1019 | |
| 1020 | /* That done, pack the struct: */ |
| 1021 | if (!pAddTS->wmeTspecPresent) { |
| 1022 | nStatus = dot11f_pack_add_ts_request(pMac, &AddTSReq, |
| 1023 | pFrame + |
| 1024 | sizeof(tSirMacMgmtHdr), |
| 1025 | nPayload, &nPayload); |
| 1026 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1027 | pe_err("Failed to pack an Add TS Request " |
| 1028 | "(0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1029 | cds_packet_free((void *)pPacket); |
| 1030 | return; /* allocated! */ |
| 1031 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1032 | pe_warn("There were warnings while packing an Add TS Request (0x%08x)", |
| 1033 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1034 | } |
| 1035 | } else { |
| 1036 | nStatus = dot11f_pack_wmm_add_ts_request(pMac, &WMMAddTSReq, |
| 1037 | pFrame + |
| 1038 | sizeof(tSirMacMgmtHdr), |
| 1039 | nPayload, &nPayload); |
| 1040 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1041 | pe_err("Failed to pack a WMM Add TS Request (0x%08x)", |
| 1042 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1043 | cds_packet_free((void *)pPacket); |
| 1044 | return; /* allocated! */ |
| 1045 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1046 | pe_warn("There were warnings while packing a WMM Add TS Request (0x%08x)", |
| 1047 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1048 | } |
| 1049 | } |
| 1050 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1051 | pe_debug("Sending an Add TS Request frame to"); |
| 1052 | lim_print_mac_addr(pMac, peerMacAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1053 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1054 | if ((BAND_5G == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1056 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) |
| 1057 | || (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1058 | ) { |
| 1059 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1060 | } |
| 1061 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1062 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1063 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 1064 | lim_diag_mgmt_tx_event_report(pMac, pMacHdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1065 | psessionEntry, QDF_STATUS_SUCCESS, |
| 1066 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1067 | |
| 1068 | /* Queue Addts Response frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1069 | qdf_status = wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1070 | TXRX_FRM_802_11_MGMT, |
| 1071 | ANI_TXDIR_TODS, |
| 1072 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1073 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1074 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1075 | psessionEntry->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1076 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1077 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
| 1078 | pe_err("Could not send an Add TS Request (%X", |
| 1079 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | } /* End lim_send_addts_req_action_frame. */ |
| 1081 | |
| 1082 | /** |
| 1083 | * lim_send_assoc_rsp_mgmt_frame() - Send assoc response |
| 1084 | * @mac_ctx: Handle for mac context |
| 1085 | * @status_code: Status code for assoc response frame |
| 1086 | * @aid: Association ID |
| 1087 | * @peer_addr: Mac address of requesting peer |
| 1088 | * @subtype: Assoc/Reassoc |
| 1089 | * @sta: Pointer to station node |
| 1090 | * @pe_session: PE session id. |
| 1091 | * |
| 1092 | * Builds and sends association response frame to the requesting peer. |
| 1093 | * |
| 1094 | * Return: void |
| 1095 | */ |
| 1096 | |
| 1097 | void |
| 1098 | lim_send_assoc_rsp_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 1099 | uint16_t status_code, uint16_t aid, tSirMacAddr peer_addr, |
| 1100 | uint8_t subtype, tpDphHashNode sta, tpPESession pe_session) |
| 1101 | { |
| 1102 | static tDot11fAssocResponse frm; |
| 1103 | uint8_t *frame; |
| 1104 | tpSirMacMgmtHdr mac_hdr; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1105 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1106 | uint8_t lle_mode = 0, addts; |
| 1107 | tHalBitVal qos_mode, wme_mode; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1108 | uint32_t payload, bytes = 0, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1109 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1110 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1111 | tUpdateBeaconParams beacon_params; |
| 1112 | uint8_t tx_flag = 0; |
| 1113 | uint32_t addn_ie_len = 0; |
| 1114 | uint8_t add_ie[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN]; |
| 1115 | tpSirAssocReq assoc_req = NULL; |
| 1116 | uint8_t sme_session = 0; |
| 1117 | bool is_vht = false; |
| 1118 | uint16_t stripoff_len = 0; |
| 1119 | tDot11fIEExtCap extracted_ext_cap; |
| 1120 | bool extracted_flag = false; |
| 1121 | #ifdef WLAN_FEATURE_11W |
| 1122 | uint32_t retry_int; |
| 1123 | uint32_t max_retries; |
| 1124 | #endif |
| 1125 | |
| 1126 | if (NULL == pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1127 | pe_err("pe_session is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1128 | return; |
| 1129 | } |
| 1130 | |
| 1131 | sme_session = pe_session->smeSessionId; |
| 1132 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1133 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1134 | |
| 1135 | limGetQosMode(pe_session, &qos_mode); |
| 1136 | limGetWmeMode(pe_session, &wme_mode); |
| 1137 | |
| 1138 | /* |
| 1139 | * An Add TS IE is added only if the AP supports it and |
| 1140 | * the requesting STA sent a traffic spec. |
| 1141 | */ |
| 1142 | addts = (qos_mode && sta && sta->qos.addtsPresent) ? 1 : 0; |
| 1143 | |
| 1144 | frm.Status.status = status_code; |
| 1145 | |
| 1146 | frm.AID.associd = aid | LIM_AID_MASK; |
| 1147 | |
| 1148 | if (NULL == sta) { |
| 1149 | populate_dot11f_supp_rates(mac_ctx, |
| 1150 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1151 | &frm.SuppRates, pe_session); |
| 1152 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1153 | POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1154 | &frm.ExtSuppRates, pe_session); |
| 1155 | } else { |
| 1156 | populate_dot11f_assoc_rsp_rates(mac_ctx, &frm.SuppRates, |
| 1157 | &frm.ExtSuppRates, |
| 1158 | sta->supportedRates.llbRates, |
| 1159 | sta->supportedRates.llaRates); |
| 1160 | } |
| 1161 | |
| 1162 | if (LIM_IS_AP_ROLE(pe_session) && sta != NULL && |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1163 | QDF_STATUS_SUCCESS == status_code) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1164 | assoc_req = (tpSirAssocReq) |
| 1165 | pe_session->parsedAssocReq[sta->assocId]; |
| 1166 | /* |
| 1167 | * populate P2P IE in AssocRsp when assocReq from the peer |
| 1168 | * includes P2P IE |
| 1169 | */ |
| 1170 | if (assoc_req != NULL && assoc_req->addIEPresent) |
| 1171 | populate_dot11_assoc_res_p2p_ie(mac_ctx, |
| 1172 | &frm.P2PAssocRes, |
| 1173 | assoc_req); |
| 1174 | } |
| 1175 | |
| 1176 | if (NULL != sta) { |
| 1177 | if (eHAL_SET == qos_mode) { |
| 1178 | if (sta->lleEnabled) { |
| 1179 | lle_mode = 1; |
| 1180 | populate_dot11f_edca_param_set(mac_ctx, |
| 1181 | &frm.EDCAParamSet, pe_session); |
| 1182 | } |
| 1183 | } |
| 1184 | |
| 1185 | if ((!lle_mode) && (eHAL_SET == wme_mode) && sta->wmeEnabled) { |
| 1186 | populate_dot11f_wmm_params(mac_ctx, &frm.WMMParams, |
| 1187 | pe_session); |
| 1188 | |
| 1189 | if (sta->wsmEnabled) |
| 1190 | populate_dot11f_wmm_caps(&frm.WMMCaps); |
| 1191 | } |
| 1192 | |
| 1193 | if (sta->mlmStaContext.htCapability && |
| 1194 | pe_session->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1195 | pe_debug("Populate HT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1196 | populate_dot11f_ht_caps(mac_ctx, pe_session, |
| 1197 | &frm.HTCaps); |
Krunal Soni | ef3294b | 2015-06-12 15:12:19 -0700 | [diff] [blame] | 1198 | /* |
| 1199 | * Check the STA capability and |
| 1200 | * update the HTCaps accordingly |
| 1201 | */ |
| 1202 | frm.HTCaps.supportedChannelWidthSet = ( |
| 1203 | sta->htSupportedChannelWidthSet < |
| 1204 | pe_session->htSupportedChannelWidthSet) ? |
| 1205 | sta->htSupportedChannelWidthSet : |
| 1206 | pe_session->htSupportedChannelWidthSet; |
| 1207 | if (!frm.HTCaps.supportedChannelWidthSet) |
| 1208 | frm.HTCaps.shortGI40MHz = 0; |
| 1209 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1210 | populate_dot11f_ht_info(mac_ctx, &frm.HTInfo, |
| 1211 | pe_session); |
| 1212 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1213 | pe_debug("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, short GI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x", |
Agrawal Ashish | c38e58d | 2015-09-16 17:17:29 +0530 | [diff] [blame] | 1214 | frm.HTCaps.supportedChannelWidthSet, |
| 1215 | frm.HTCaps.mimoPowerSave, |
| 1216 | frm.HTCaps.greenField, frm.HTCaps.shortGI20MHz, |
| 1217 | frm.HTCaps.shortGI40MHz, |
| 1218 | frm.HTCaps.dsssCckMode40MHz, |
| 1219 | frm.HTCaps.maxRxAMPDUFactor); |
| 1220 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1221 | if (sta->mlmStaContext.vhtCapability && |
| 1222 | pe_session->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1223 | pe_debug("Populate VHT IEs in Assoc Response"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1224 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1225 | &frm.VHTCaps); |
| 1226 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1227 | &frm.VHTOperation); |
| 1228 | is_vht = true; |
| 1229 | } |
Naveen Rawat | 903acca | 2017-09-15 17:32:13 -0700 | [diff] [blame] | 1230 | |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1231 | if (pe_session->vhtCapability && |
| 1232 | pe_session->vendor_vht_sap && |
| 1233 | (assoc_req != NULL) && |
| 1234 | assoc_req->vendor_vht_ie.VHTCaps.present) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1235 | pe_debug("Populate Vendor VHT IEs in Assoc Rsponse"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1236 | frm.vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 1237 | frm.vendor_vht_ie.sub_type = |
| 1238 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1239 | frm.vendor_vht_ie.VHTCaps.present = 1; |
| 1240 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
| 1241 | &frm.vendor_vht_ie.VHTCaps); |
Kiran Kumar Lokere | cc44868 | 2017-07-20 18:08:01 -0700 | [diff] [blame] | 1242 | populate_dot11f_vht_operation(mac_ctx, pe_session, |
| 1243 | &frm.vendor_vht_ie.VHTOperation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1244 | is_vht = true; |
| 1245 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1246 | populate_dot11f_ext_cap(mac_ctx, is_vht, &frm.ExtCap, |
| 1247 | pe_session); |
| 1248 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1249 | if (lim_is_sta_he_capable(sta) && |
| 1250 | lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1251 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1252 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1253 | &frm.he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1254 | populate_dot11f_he_operation(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1255 | &frm.he_op); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1256 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1257 | #ifdef WLAN_FEATURE_11W |
| 1258 | if (eSIR_MAC_TRY_AGAIN_LATER == status_code) { |
| 1259 | if (wlan_cfg_get_int |
| 1260 | (mac_ctx, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1261 | &max_retries) != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1262 | pe_err("get WNI_CFG_PMF_SA_QUERY_MAX_RETRIES failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1263 | else if (wlan_cfg_get_int |
| 1264 | (mac_ctx, |
| 1265 | WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1266 | &retry_int) != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1267 | pe_err("get WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1268 | else |
| 1269 | populate_dot11f_timeout_interval(mac_ctx, |
| 1270 | &frm.TimeoutInterval, |
| 1271 | SIR_MAC_TI_TYPE_ASSOC_COMEBACK, |
| 1272 | (max_retries - |
| 1273 | sta->pmfSaQueryRetryCount) |
| 1274 | * retry_int); |
| 1275 | } |
| 1276 | #endif |
Arif Hussain | 0c81692 | 2017-04-06 15:04:44 -0700 | [diff] [blame] | 1277 | |
| 1278 | if (LIM_IS_AP_ROLE(pe_session) && sta->non_ecsa_capable) |
| 1279 | pe_session->lim_non_ecsa_cap_num++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1280 | } |
| 1281 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1282 | qdf_mem_set((uint8_t *) &beacon_params, sizeof(beacon_params), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1283 | |
| 1284 | if (LIM_IS_AP_ROLE(pe_session) && |
| 1285 | (pe_session->gLimProtectionControl != |
| 1286 | WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)) |
| 1287 | lim_decide_ap_protection(mac_ctx, peer_addr, |
| 1288 | &beacon_params, pe_session); |
| 1289 | |
| 1290 | lim_update_short_preamble(mac_ctx, peer_addr, &beacon_params, |
| 1291 | pe_session); |
| 1292 | lim_update_short_slot_time(mac_ctx, peer_addr, &beacon_params, |
| 1293 | pe_session); |
| 1294 | |
| 1295 | /* |
| 1296 | * Populate Do11capabilities after updating session with |
| 1297 | * Assos req details |
| 1298 | */ |
| 1299 | populate_dot11f_capabilities(mac_ctx, &frm.Capabilities, pe_session); |
| 1300 | |
| 1301 | beacon_params.bssIdx = pe_session->bssIdx; |
| 1302 | |
| 1303 | /* Send message to HAL about beacon parameter change. */ |
| 1304 | if ((false == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) |
| 1305 | && beacon_params.paramChangeBitmap) { |
| 1306 | sch_set_fixed_beacon_fields(mac_ctx, pe_session); |
| 1307 | lim_send_beacon_params(mac_ctx, &beacon_params, pe_session); |
| 1308 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1309 | |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 1310 | lim_obss_send_detection_cfg(mac_ctx, pe_session, false); |
| 1311 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1312 | if (assoc_req != NULL) { |
Krishna Kumaar Natarajan | e4e3a14 | 2016-04-01 16:27:51 -0700 | [diff] [blame] | 1313 | addn_ie_len = pe_session->addIeParams.assocRespDataLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1314 | |
| 1315 | /* Nonzero length indicates Assoc rsp IE available */ |
Krishna Kumaar Natarajan | e4e3a14 | 2016-04-01 16:27:51 -0700 | [diff] [blame] | 1316 | if (addn_ie_len > 0 && |
| 1317 | addn_ie_len <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && |
| 1318 | (bytes + addn_ie_len) <= SIR_MAX_PACKET_SIZE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1319 | qdf_mem_copy(add_ie, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1320 | pe_session->addIeParams.assocRespData_buff, |
| 1321 | pe_session->addIeParams.assocRespDataLen); |
| 1322 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1323 | qdf_mem_set((uint8_t *) &extracted_ext_cap, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1324 | sizeof(extracted_ext_cap), 0); |
| 1325 | |
| 1326 | stripoff_len = addn_ie_len; |
| 1327 | sir_status = |
| 1328 | lim_strip_extcap_update_struct |
| 1329 | (mac_ctx, &add_ie[0], &stripoff_len, |
| 1330 | &extracted_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1331 | if (QDF_STATUS_SUCCESS != sir_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1332 | pe_debug("strip off extcap IE failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1333 | } else { |
| 1334 | addn_ie_len = stripoff_len; |
| 1335 | extracted_flag = true; |
| 1336 | } |
| 1337 | bytes = bytes + addn_ie_len; |
| 1338 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1339 | pe_debug("addn_ie_len: %d for Assoc Resp: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1340 | addn_ie_len, assoc_req->addIEPresent); |
| 1341 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1342 | |
| 1343 | /* |
| 1344 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 1345 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 1346 | * dot11f get packed payload size. |
| 1347 | */ |
| 1348 | if (extracted_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1349 | lim_merge_extcap_struct(&(frm.ExtCap), &extracted_ext_cap, |
| 1350 | true); |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1351 | |
| 1352 | /* Allocate a buffer for this frame: */ |
| 1353 | status = dot11f_get_packed_assoc_response_size(mac_ctx, &frm, &payload); |
| 1354 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1355 | pe_err("get Association Response size failure (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1356 | status); |
| 1357 | return; |
| 1358 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1359 | pe_warn("get Association Response size warning (0x%08x)", |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1360 | status); |
| 1361 | } |
| 1362 | |
| 1363 | bytes += sizeof(tSirMacMgmtHdr) + payload; |
| 1364 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1365 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1366 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1367 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1368 | pe_err("cds_packet_alloc failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1369 | return; |
| 1370 | } |
| 1371 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1372 | qdf_mem_set(frame, bytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1373 | |
| 1374 | /* Next, we fill out the buffer descriptor: */ |
| 1375 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 1376 | (LIM_ASSOC == subtype) ? |
| 1377 | SIR_MAC_MGMT_ASSOC_RSP : SIR_MAC_MGMT_REASSOC_RSP, |
| 1378 | peer_addr, |
| 1379 | pe_session->selfMacAddr); |
| 1380 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 1381 | |
| 1382 | sir_copy_mac_addr(mac_hdr->bssId, pe_session->bssId); |
| 1383 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1384 | status = dot11f_pack_assoc_response(mac_ctx, &frm, |
| 1385 | frame + sizeof(tSirMacMgmtHdr), |
| 1386 | payload, &payload); |
| 1387 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1388 | pe_err("Association Response pack failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1389 | status); |
| 1390 | cds_packet_free((void *)packet); |
| 1391 | return; |
| 1392 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1393 | pe_warn("Association Response pack warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1394 | status); |
| 1395 | } |
| 1396 | |
| 1397 | if (subtype == LIM_ASSOC) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1398 | pe_debug("*** Sending Assoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1399 | status_code, aid); |
| 1400 | else |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1401 | pe_debug("*** Sending ReAssoc Resp status %d aid %d to", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1402 | status_code, aid); |
| 1403 | |
Abhishek Singh | 5d8d733 | 2017-08-10 15:15:24 +0530 | [diff] [blame] | 1404 | lim_print_mac_addr(mac_ctx, mac_hdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1405 | |
| 1406 | if (addn_ie_len && addn_ie_len <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1407 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1408 | &add_ie[0], addn_ie_len); |
| 1409 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1410 | if ((BAND_5G == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1411 | lim_get_rf_band(pe_session->currentOperChannel)) || |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1412 | (pe_session->pePersona == QDF_P2P_CLIENT_MODE) || |
| 1413 | (pe_session->pePersona == QDF_P2P_GO_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1414 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1415 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1416 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1417 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 1418 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1419 | pe_session, QDF_STATUS_SUCCESS, status_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1420 | /* Queue Association Response frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1421 | qdf_status = wma_tx_frame(mac_ctx, packet, (uint16_t) bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1422 | TXRX_FRM_802_11_MGMT, |
| 1423 | ANI_TXDIR_TODS, |
| 1424 | 7, lim_tx_complete, frame, tx_flag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1425 | sme_session, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1426 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1427 | pe_session->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1428 | |
| 1429 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1430 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1431 | pe_err("Could not Send Re/AssocRsp, retCode=%X", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1432 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1433 | |
| 1434 | /* |
| 1435 | * update the ANI peer station count. |
| 1436 | * FIXME_PROTECTION : take care of different type of station |
| 1437 | * counter inside this function. |
| 1438 | */ |
| 1439 | lim_util_count_sta_add(mac_ctx, sta, pe_session); |
| 1440 | |
| 1441 | } |
| 1442 | |
| 1443 | void |
| 1444 | lim_send_delts_req_action_frame(tpAniSirGlobal pMac, |
| 1445 | tSirMacAddr peer, |
| 1446 | uint8_t wmmTspecPresent, |
| 1447 | tSirMacTSInfo *pTsinfo, |
| 1448 | tSirMacTspecIE *pTspecIe, tpPESession psessionEntry) |
| 1449 | { |
| 1450 | uint8_t *pFrame; |
| 1451 | tpSirMacMgmtHdr pMacHdr; |
| 1452 | tDot11fDelTS DelTS; |
| 1453 | tDot11fWMMDelTS WMMDelTS; |
| 1454 | uint32_t nBytes, nPayload, nStatus; |
| 1455 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1456 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1457 | uint8_t txFlag = 0; |
| 1458 | uint8_t smeSessionId = 0; |
| 1459 | |
| 1460 | if (NULL == psessionEntry) { |
| 1461 | return; |
| 1462 | } |
| 1463 | |
| 1464 | smeSessionId = psessionEntry->smeSessionId; |
| 1465 | |
| 1466 | if (!wmmTspecPresent) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1467 | qdf_mem_set((uint8_t *) &DelTS, sizeof(DelTS), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1468 | |
| 1469 | DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT; |
| 1470 | DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 1471 | populate_dot11f_ts_info(pTsinfo, &DelTS.TSInfo); |
| 1472 | |
| 1473 | nStatus = dot11f_get_packed_del_ts_size(pMac, &DelTS, &nPayload); |
| 1474 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1475 | pe_err("Failed to calculate the packed size for a Del TS (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1476 | /* We'll fall back on the worst case scenario: */ |
| 1477 | nPayload = sizeof(tDot11fDelTS); |
| 1478 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1479 | pe_warn("There were warnings while calculating the packed size for a Del TS (0x%08x)", |
| 1480 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1481 | } |
| 1482 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1483 | qdf_mem_set((uint8_t *) &WMMDelTS, sizeof(WMMDelTS), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1484 | |
| 1485 | WMMDelTS.Category.category = SIR_MAC_ACTION_WME; |
| 1486 | WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ; |
| 1487 | WMMDelTS.DialogToken.token = 0; |
| 1488 | WMMDelTS.StatusCode.statusCode = 0; |
| 1489 | populate_dot11f_wmmtspec(pTspecIe, &WMMDelTS.WMMTSPEC); |
| 1490 | nStatus = |
| 1491 | dot11f_get_packed_wmm_del_ts_size(pMac, &WMMDelTS, &nPayload); |
| 1492 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1493 | pe_err("Failed to calculate the packed size for a WMM Del TS (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1494 | /* We'll fall back on the worst case scenario: */ |
| 1495 | nPayload = sizeof(tDot11fDelTS); |
| 1496 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1497 | pe_warn("There were warnings while calculating the packed size for a WMM Del TS (0x%08x)", |
| 1498 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1499 | } |
| 1500 | } |
| 1501 | |
| 1502 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 1503 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1504 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1505 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 1506 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1507 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1508 | pe_err("Failed to allocate %d bytes for an Add TS Response", |
| 1509 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1510 | return; |
| 1511 | } |
| 1512 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1513 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1514 | |
| 1515 | /* Next, we fill out the buffer descriptor: */ |
| 1516 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 1517 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 1518 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 1519 | |
| 1520 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 1521 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1522 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1523 | |
| 1524 | /* That done, pack the struct: */ |
| 1525 | if (!wmmTspecPresent) { |
| 1526 | nStatus = dot11f_pack_del_ts(pMac, &DelTS, |
| 1527 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1528 | nPayload, &nPayload); |
| 1529 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1530 | pe_err("Failed to pack a Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1531 | nStatus); |
| 1532 | cds_packet_free((void *)pPacket); |
| 1533 | return; /* allocated! */ |
| 1534 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1535 | pe_warn("There were warnings while packing a Del TS frame (0x%08x)", |
| 1536 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1537 | } |
| 1538 | } else { |
| 1539 | nStatus = dot11f_pack_wmm_del_ts(pMac, &WMMDelTS, |
| 1540 | pFrame + sizeof(tSirMacMgmtHdr), |
| 1541 | nPayload, &nPayload); |
| 1542 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1543 | pe_err("Failed to pack a WMM Del TS frame (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1544 | nStatus); |
| 1545 | cds_packet_free((void *)pPacket); |
| 1546 | return; /* allocated! */ |
| 1547 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1548 | pe_warn("There were warnings while packing a WMM Del TS frame (0x%08x)", |
| 1549 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1550 | } |
| 1551 | } |
| 1552 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1553 | pe_debug("Sending DELTS REQ (size %d) to ", nBytes); |
| 1554 | lim_print_mac_addr(pMac, pMacHdr->da, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1555 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 1556 | if ((BAND_5G == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1557 | lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1558 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) |
| 1559 | || (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1560 | ) { |
| 1561 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1562 | } |
| 1563 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1564 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1565 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 1566 | lim_diag_mgmt_tx_event_report(pMac, pMacHdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1567 | psessionEntry, QDF_STATUS_SUCCESS, |
| 1568 | QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1569 | qdf_status = wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1570 | TXRX_FRM_802_11_MGMT, |
| 1571 | ANI_TXDIR_TODS, |
| 1572 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1573 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1574 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1575 | psessionEntry->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1576 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1577 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1578 | pe_err("Failed to send Del TS (%X)!", qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1579 | |
| 1580 | } /* End lim_send_delts_req_action_frame. */ |
| 1581 | |
| 1582 | /** |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1583 | * lim_assoc_tx_complete_cnf()- Confirmation for assoc sent over the air |
| 1584 | * @context: pointer to global mac |
| 1585 | * @buf: buffer |
| 1586 | * @tx_complete : Sent status |
| 1587 | * @params; tx completion params |
| 1588 | * |
| 1589 | * Return: This returns QDF_STATUS |
| 1590 | */ |
| 1591 | |
| 1592 | static QDF_STATUS lim_assoc_tx_complete_cnf(void *context, |
| 1593 | qdf_nbuf_t buf, |
| 1594 | uint32_t tx_complete, |
| 1595 | void *params) |
| 1596 | { |
| 1597 | uint16_t assoc_ack_status; |
| 1598 | uint16_t reason_code; |
| 1599 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
| 1600 | |
| 1601 | pe_debug("tx_complete= %d", tx_complete); |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 1602 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1603 | assoc_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1604 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1605 | } else { |
| 1606 | assoc_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1607 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 1608 | } |
| 1609 | if (buf) |
| 1610 | qdf_nbuf_free(buf); |
| 1611 | |
| 1612 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
| 1613 | NULL, assoc_ack_status, reason_code); |
| 1614 | return QDF_STATUS_SUCCESS; |
| 1615 | } |
| 1616 | |
| 1617 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1618 | * lim_send_assoc_req_mgmt_frame() - Send association request |
| 1619 | * @mac_ctx: Handle to MAC context |
| 1620 | * @mlm_assoc_req: Association request information |
| 1621 | * @pe_session: PE session information |
| 1622 | * |
| 1623 | * Builds and transmits association request frame to AP. |
| 1624 | * |
| 1625 | * Return: Void |
| 1626 | */ |
| 1627 | |
| 1628 | void |
| 1629 | lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 1630 | tLimMlmAssocReq *mlm_assoc_req, |
| 1631 | tpPESession pe_session) |
| 1632 | { |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 1633 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | tDot11fAssocRequest *frm; |
| 1635 | uint16_t caps; |
| 1636 | uint8_t *frame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1637 | QDF_STATUS sir_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1638 | tLimMlmAssocCnf assoc_cnf; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1639 | uint32_t bytes = 0, payload, status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1640 | uint8_t qos_enabled, wme_enabled, wsm_enabled; |
| 1641 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1642 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1643 | uint16_t add_ie_len; |
| 1644 | uint8_t *add_ie; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1645 | const uint8_t *wps_ie = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1646 | uint8_t power_caps = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1647 | uint8_t tx_flag = 0; |
| 1648 | uint8_t sme_sessionid = 0; |
| 1649 | bool vht_enabled = false; |
| 1650 | tDot11fIEExtCap extr_ext_cap; |
| 1651 | bool extr_ext_flag = true; |
| 1652 | tpSirMacMgmtHdr mac_hdr; |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1653 | uint32_t ie_offset = 0; |
| 1654 | uint8_t *p_ext_cap = NULL; |
| 1655 | tDot11fIEExtCap bcn_ext_cap; |
| 1656 | uint8_t *bcn_ie = NULL; |
| 1657 | uint32_t bcn_ie_len = 0; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1658 | uint32_t aes_block_size_len = 0; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 1659 | enum rateid min_rid = RATEID_DEFAULT; |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 1660 | uint8_t *mbo_ie = NULL; |
| 1661 | uint8_t mbo_ie_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1662 | |
| 1663 | if (NULL == pe_session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1664 | pe_err("pe_session is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1665 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1666 | return; |
| 1667 | } |
| 1668 | |
| 1669 | sme_sessionid = pe_session->smeSessionId; |
| 1670 | |
| 1671 | /* check this early to avoid unncessary operation */ |
| 1672 | if (NULL == pe_session->pLimJoinReq) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1673 | pe_err("pe_session->pLimJoinReq is NULL"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1674 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | return; |
| 1676 | } |
| 1677 | add_ie_len = pe_session->pLimJoinReq->addIEAssoc.length; |
| 1678 | add_ie = pe_session->pLimJoinReq->addIEAssoc.addIEdata; |
| 1679 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1680 | frm = qdf_mem_malloc(sizeof(tDot11fAssocRequest)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1681 | if (NULL == frm) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1682 | pe_err("Unable to allocate memory"); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 1683 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1684 | return; |
| 1685 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1686 | qdf_mem_set((uint8_t *) frm, sizeof(tDot11fAssocRequest), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1687 | |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 1688 | if (add_ie_len && pe_session->is_ext_caps_present) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1689 | qdf_mem_set((uint8_t *) &extr_ext_cap, sizeof(tDot11fIEExtCap), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1690 | 0); |
| 1691 | sir_status = lim_strip_extcap_update_struct(mac_ctx, |
| 1692 | add_ie, &add_ie_len, &extr_ext_cap); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1693 | if (QDF_STATUS_SUCCESS != sir_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1694 | extr_ext_flag = false; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1695 | pe_debug("Unable to Stripoff ExtCap IE from Assoc Req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1696 | } else { |
| 1697 | struct s_ext_cap *p_ext_cap = (struct s_ext_cap *) |
| 1698 | extr_ext_cap.bytes; |
| 1699 | |
| 1700 | if (p_ext_cap->interworking_service) |
| 1701 | p_ext_cap->qos_map = 1; |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1702 | extr_ext_cap.num_bytes = |
| 1703 | lim_compute_ext_cap_ie_length(&extr_ext_cap); |
| 1704 | extr_ext_flag = (extr_ext_cap.num_bytes > 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1705 | } |
| 1706 | } else { |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 1707 | pe_debug("No addn IE or peer doesn't support addnIE for Assoc Req"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1708 | extr_ext_flag = false; |
| 1709 | } |
| 1710 | |
| 1711 | caps = mlm_assoc_req->capabilityInfo; |
| 1712 | #if defined(FEATURE_WLAN_WAPI) |
| 1713 | /* |
| 1714 | * According to WAPI standard: |
| 1715 | * 7.3.1.4 Capability Information field |
| 1716 | * In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 |
| 1717 | * in transmitted Association or Reassociation management frames. |
| 1718 | * APs ignore the Privacy subfield within received Association and |
| 1719 | * Reassociation management frames. |
| 1720 | */ |
| 1721 | if (pe_session->encryptType == eSIR_ED_WPI) |
| 1722 | ((tSirMacCapabilityInfo *) &caps)->privacy = 0; |
| 1723 | #endif |
| 1724 | swap_bit_field16(caps, (uint16_t *) &frm->Capabilities); |
| 1725 | |
| 1726 | frm->ListenInterval.interval = mlm_assoc_req->listenInterval; |
| 1727 | populate_dot11f_ssid2(mac_ctx, &frm->SSID); |
| 1728 | populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, |
| 1729 | &frm->SuppRates, pe_session); |
| 1730 | |
| 1731 | qos_enabled = (pe_session->limQosEnabled) && |
| 1732 | SIR_MAC_GET_QOS(pe_session->limCurrentBssCaps); |
| 1733 | |
| 1734 | wme_enabled = (pe_session->limWmeEnabled) && |
| 1735 | LIM_BSS_CAPS_GET(WME, pe_session->limCurrentBssQosCaps); |
| 1736 | |
| 1737 | /* We prefer .11e asociations: */ |
| 1738 | if (qos_enabled) |
| 1739 | wme_enabled = false; |
| 1740 | |
| 1741 | wsm_enabled = (pe_session->limWsmEnabled) && wme_enabled && |
| 1742 | LIM_BSS_CAPS_GET(WSM, pe_session->limCurrentBssQosCaps); |
| 1743 | |
| 1744 | if (pe_session->lim11hEnable && |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 1745 | pe_session->pLimJoinReq->spectrumMgtIndicator == true) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1746 | power_caps = true; |
| 1747 | |
| 1748 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1749 | LIM_ASSOC, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1750 | populate_dot11f_supp_channels(mac_ctx, &frm->SuppChannels, |
| 1751 | LIM_ASSOC, pe_session); |
| 1752 | |
| 1753 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1754 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1755 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) { |
| 1756 | if (power_caps == false) { |
| 1757 | power_caps = true; |
| 1758 | populate_dot11f_power_caps(mac_ctx, &frm->PowerCaps, |
| 1759 | LIM_ASSOC, pe_session); |
| 1760 | } |
| 1761 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1762 | if (qos_enabled) |
Naveen Rawat | cd11831 | 2016-11-22 10:46:21 -0800 | [diff] [blame] | 1763 | populate_dot11f_qos_caps_station(mac_ctx, pe_session, |
| 1764 | &frm->QOSCapsStation); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1765 | |
| 1766 | populate_dot11f_ext_supp_rates(mac_ctx, |
| 1767 | POPULATE_DOT11F_RATES_OPERATIONAL, &frm->ExtSuppRates, |
| 1768 | pe_session); |
| 1769 | |
Gupta, Kapil | 54a1699 | 2016-01-13 19:34:02 +0530 | [diff] [blame] | 1770 | if (mac_ctx->rrm.rrmPEContext.rrmEnable && |
| 1771 | SIR_MAC_GET_RRM(pe_session->limCurrentBssCaps)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1772 | populate_dot11f_rrm_ie(mac_ctx, &frm->RRMEnabledCap, |
| 1773 | pe_session); |
Deepak Dhamdhere | 641bf32 | 2016-01-06 15:19:03 -0800 | [diff] [blame] | 1774 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1775 | /* |
| 1776 | * The join request *should* contain zero or one of the WPA and RSN |
| 1777 | * IEs. The payload send along with the request is a |
| 1778 | * 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie': |
| 1779 | * typedef struct sSirRSNie |
| 1780 | * { |
| 1781 | * uint16_t length; |
| 1782 | * uint8_t rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2]; |
| 1783 | * } tSirRSNie, *tpSirRSNie; |
| 1784 | * So, we should be able to make the following two calls harmlessly, |
| 1785 | * since they do nothing if they don't find the given IE in the |
| 1786 | * bytestream with which they're provided. |
| 1787 | * The net effect of this will be to faithfully transmit whatever |
| 1788 | * security IE is in the join request. |
| 1789 | * However, if we're associating for the purpose of WPS |
| 1790 | * enrollment, and we've been configured to indicate that by |
| 1791 | * eliding the WPA or RSN IE, we just skip this: |
| 1792 | */ |
| 1793 | if (add_ie_len && add_ie) |
| 1794 | wps_ie = limGetWscIEPtr(mac_ctx, add_ie, add_ie_len); |
| 1795 | |
| 1796 | if (NULL == wps_ie) { |
| 1797 | populate_dot11f_rsn_opaque(mac_ctx, |
| 1798 | &(pe_session->pLimJoinReq->rsnIE), |
| 1799 | &frm->RSNOpaque); |
| 1800 | populate_dot11f_wpa_opaque(mac_ctx, |
| 1801 | &(pe_session->pLimJoinReq->rsnIE), |
| 1802 | &frm->WPAOpaque); |
| 1803 | #if defined(FEATURE_WLAN_WAPI) |
| 1804 | populate_dot11f_wapi_opaque(mac_ctx, |
| 1805 | &(pe_session->pLimJoinReq->rsnIE), |
| 1806 | &frm->WAPIOpaque); |
| 1807 | #endif /* defined(FEATURE_WLAN_WAPI) */ |
| 1808 | } |
| 1809 | /* include WME EDCA IE as well */ |
| 1810 | if (wme_enabled) { |
| 1811 | populate_dot11f_wmm_info_station_per_session(mac_ctx, |
| 1812 | pe_session, &frm->WMMInfoStation); |
| 1813 | |
| 1814 | if (wsm_enabled) |
| 1815 | populate_dot11f_wmm_caps(&frm->WMMCaps); |
| 1816 | } |
| 1817 | |
| 1818 | /* |
| 1819 | * Populate HT IEs, when operating in 11n and |
| 1820 | * when AP is also operating in 11n mode |
| 1821 | */ |
| 1822 | if (pe_session->htCapability && |
| 1823 | mac_ctx->lim.htCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1824 | pe_debug("Populate HT Caps in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1825 | populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 1826 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 1827 | &frm->HTCaps, sizeof(frm->HTCaps)); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1828 | } else if (pe_session->he_with_wep_tkip) { |
| 1829 | pe_debug("Populate HT Caps in Assoc Request with WEP/TKIP"); |
| 1830 | populate_dot11f_ht_caps(mac_ctx, NULL, &frm->HTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1831 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1832 | pe_debug("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, short GI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x", |
Agrawal Ashish | c38e58d | 2015-09-16 17:17:29 +0530 | [diff] [blame] | 1833 | frm->HTCaps.supportedChannelWidthSet, |
| 1834 | frm->HTCaps.mimoPowerSave, |
| 1835 | frm->HTCaps.greenField, frm->HTCaps.shortGI20MHz, |
| 1836 | frm->HTCaps.shortGI40MHz, |
| 1837 | frm->HTCaps.dsssCckMode40MHz, |
| 1838 | frm->HTCaps.maxRxAMPDUFactor); |
| 1839 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1840 | if (pe_session->vhtCapability && |
| 1841 | pe_session->vhtCapabilityPresentInBeacon) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1842 | pe_debug("Populate VHT IEs in Assoc Request"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1843 | populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); |
Naveen Rawat | a410c5a | 2016-09-19 14:22:33 -0700 | [diff] [blame] | 1844 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 1845 | &frm->VHTCaps, sizeof(frm->VHTCaps)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1846 | vht_enabled = true; |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 1847 | if (pe_session->enableHtSmps && |
| 1848 | !pe_session->supported_nss_1x1) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1849 | pe_err("VHT OP mode IE in Assoc Req"); |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 1850 | populate_dot11f_operating_mode(mac_ctx, |
| 1851 | &frm->OperatingMode, pe_session); |
| 1852 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1853 | } else if (pe_session->he_with_wep_tkip) { |
| 1854 | pe_debug("Populate VHT IEs in Assoc Request with WEP/TKIP"); |
| 1855 | populate_dot11f_vht_caps(mac_ctx, NULL, &frm->VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1856 | } |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1857 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1858 | if (!vht_enabled && |
| 1859 | pe_session->is_vendor_specific_vhtcaps) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1860 | pe_debug("Populate Vendor VHT IEs in Assoc Request"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1861 | frm->vendor_vht_ie.present = 1; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 1862 | frm->vendor_vht_ie.sub_type = |
| 1863 | pe_session->vendor_specific_vht_ie_sub_type; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1864 | frm->vendor_vht_ie.VHTCaps.present = 1; |
Abhishek Singh | 6884428 | 2018-01-25 16:48:41 +0530 | [diff] [blame] | 1865 | if (!mac_ctx->roam.configParam.enable_subfee_vendor_vhtie && |
| 1866 | pe_session->vht_config.su_beam_formee) { |
| 1867 | pe_debug("Disable SU beamformee for vendor IE"); |
| 1868 | pe_session->vht_config.su_beam_formee = 0; |
| 1869 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1870 | populate_dot11f_vht_caps(mac_ctx, pe_session, |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1871 | &frm->vendor_vht_ie.VHTCaps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1872 | vht_enabled = true; |
| 1873 | } |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 1874 | if (pe_session->is_ext_caps_present) |
| 1875 | populate_dot11f_ext_cap(mac_ctx, vht_enabled, |
| 1876 | &frm->ExtCap, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1877 | |
Wu Gao | 9381621 | 2018-08-31 16:49:54 +0800 | [diff] [blame] | 1878 | if (mac_ctx->mlme_cfg->sta.qcn_ie_support) |
Selvaraj, Sridhar | a521aab | 2017-03-25 16:42:34 +0530 | [diff] [blame] | 1879 | populate_dot11f_qcn_ie(&frm->QCN_IE); |
| 1880 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1881 | if (lim_is_session_he_capable(pe_session)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 1882 | pe_debug("Populate HE IEs"); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1883 | populate_dot11f_he_caps(mac_ctx, pe_session, |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1884 | &frm->he_cap); |
Kiran Kumar Lokere | 722dccd | 2018-02-23 13:23:52 -0800 | [diff] [blame] | 1885 | } else if (pe_session->he_with_wep_tkip) { |
| 1886 | pe_debug("Populate HE IEs in Assoc Request with WEP/TKIP"); |
| 1887 | populate_dot11f_he_caps(mac_ctx, NULL, &frm->he_cap); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 1888 | } |
Selvaraj, Sridhar | c2fe7a3 | 2017-02-02 19:20:16 +0530 | [diff] [blame] | 1889 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1890 | if (pe_session->pLimJoinReq->is11Rconnection) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1891 | tSirBssDescription *bssdescr; |
| 1892 | |
| 1893 | bssdescr = &pe_session->pLimJoinReq->bssDescription; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1894 | pe_debug("mdie = %02x %02x %02x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1895 | (unsigned int) bssdescr->mdie[0], |
| 1896 | (unsigned int) bssdescr->mdie[1], |
| 1897 | (unsigned int) bssdescr->mdie[2]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1898 | populate_mdie(mac_ctx, &frm->MobilityDomain, |
| 1899 | pe_session->pLimJoinReq->bssDescription.mdie); |
| 1900 | } else { |
| 1901 | /* No 11r IEs dont send any MDIE */ |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1902 | pe_debug("MDIE not present"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1903 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1904 | |
| 1905 | #ifdef FEATURE_WLAN_ESE |
| 1906 | /* |
| 1907 | * ESE Version IE will be included in association request |
| 1908 | * when ESE is enabled on DUT through ini and it is also |
| 1909 | * advertised by the peer AP to which we are trying to |
| 1910 | * associate to. |
| 1911 | */ |
| 1912 | if (pe_session->is_ese_version_ie_present && |
| 1913 | mac_ctx->roam.configParam.isEseIniFeatureEnabled) |
| 1914 | populate_dot11f_ese_version(&frm->ESEVersion); |
| 1915 | /* For ESE Associations fill the ESE IEs */ |
| 1916 | if (pe_session->isESEconnection && |
| 1917 | pe_session->pLimJoinReq->isESEFeatureIniEnabled) { |
| 1918 | #ifndef FEATURE_DISABLE_RM |
| 1919 | populate_dot11f_ese_rad_mgmt_cap(&frm->ESERadMgmtCap); |
| 1920 | #endif |
| 1921 | } |
| 1922 | #endif |
| 1923 | |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1924 | /* |
| 1925 | * Extcap IE now support variable length, merge Extcap IE from addn_ie |
| 1926 | * may change the frame size. Therefore, MUST merge ExtCap IE before |
| 1927 | * dot11f get packed payload size. |
| 1928 | */ |
| 1929 | if (extr_ext_flag) |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1930 | lim_merge_extcap_struct(&frm->ExtCap, &extr_ext_cap, true); |
| 1931 | |
| 1932 | /* Clear the bits in EXTCAP IE if AP not advertise it in beacon */ |
| 1933 | if (frm->ExtCap.present && pe_session->is_ext_caps_present) { |
| 1934 | ie_offset = DOT11F_FF_TIMESTAMP_LEN + |
| 1935 | DOT11F_FF_BEACONINTERVAL_LEN + |
| 1936 | DOT11F_FF_CAPABILITIES_LEN; |
| 1937 | |
| 1938 | qdf_mem_zero((uint8_t *)&bcn_ext_cap, sizeof(tDot11fIEExtCap)); |
| 1939 | if (pe_session->beacon && pe_session->bcnLen > ie_offset) { |
| 1940 | bcn_ie = pe_session->beacon + ie_offset; |
| 1941 | bcn_ie_len = pe_session->bcnLen - ie_offset; |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1942 | p_ext_cap = (uint8_t *)wlan_get_ie_ptr_from_eid( |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1943 | DOT11F_EID_EXTCAP, |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 1944 | bcn_ie, bcn_ie_len); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1945 | lim_update_extcap_struct(mac_ctx, p_ext_cap, |
| 1946 | &bcn_ext_cap); |
| 1947 | lim_merge_extcap_struct(&frm->ExtCap, &bcn_ext_cap, |
| 1948 | false); |
| 1949 | } |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 1950 | /* |
| 1951 | * TWT extended capabilities should be populated after the |
| 1952 | * intersection of beacon caps and self caps is done because |
| 1953 | * the bits for TWT are unique to STA and AP and cannot be |
| 1954 | * intersected. |
| 1955 | */ |
| 1956 | populate_dot11f_twt_extended_caps(mac_ctx, pe_session, |
| 1957 | &frm->ExtCap); |
Hu Wang | fbd279d | 2016-10-31 18:24:34 +0800 | [diff] [blame] | 1958 | } |
Hu Wang | 411e0cc | 2016-10-28 14:56:01 +0800 | [diff] [blame] | 1959 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1960 | if (QDF_STATUS_SUCCESS != lim_strip_supp_op_class_update_struct(mac_ctx, |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 1961 | add_ie, &add_ie_len, &frm->SuppOperatingClasses)) |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 1962 | pe_debug("Unable to Stripoff supp op classes IE from Assoc Req"); |
Arif Hussain | 6cec6bc | 2017-02-14 13:46:26 -0800 | [diff] [blame] | 1963 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 1964 | if (lim_is_fils_connection(pe_session)) { |
| 1965 | populate_dot11f_fils_params(mac_ctx, frm, pe_session); |
| 1966 | aes_block_size_len = AES_BLOCK_SIZE; |
| 1967 | } |
| 1968 | |
| 1969 | /* |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 1970 | * MBO IE needs to be appendded at the end of the assoc request |
| 1971 | * frame and is not parsed and unpacked by the frame parser |
| 1972 | * as the supplicant can send multiple TLVs with same Attribute |
| 1973 | * in the MBO IE and the frame parser does not support multiple |
| 1974 | * TLVs with same attribute in a single IE. |
| 1975 | * Strip off the MBO IE from add_ie and append it at the end. |
| 1976 | */ |
| 1977 | if (wlan_get_vendor_ie_ptr_from_oui(SIR_MAC_MBO_OUI, |
| 1978 | SIR_MAC_MBO_OUI_SIZE, add_ie, add_ie_len)) { |
| 1979 | mbo_ie = qdf_mem_malloc(DOT11F_IE_MBO_IE_MAX_LEN + 2); |
| 1980 | if (!mbo_ie) { |
| 1981 | pe_err("Failed to allocate mbo_ie"); |
| 1982 | goto end; |
| 1983 | } |
| 1984 | |
| 1985 | qdf_status = lim_strip_ie(mac_ctx, add_ie, &add_ie_len, |
| 1986 | SIR_MAC_EID_VENDOR, ONE_BYTE, |
| 1987 | SIR_MAC_MBO_OUI, |
| 1988 | SIR_MAC_MBO_OUI_SIZE, |
| 1989 | mbo_ie, DOT11F_IE_MBO_IE_MAX_LEN); |
| 1990 | if (QDF_IS_STATUS_ERROR(qdf_status)) { |
| 1991 | pe_err("Failed to strip MBO IE"); |
| 1992 | goto free_mbo_ie; |
| 1993 | } |
| 1994 | |
| 1995 | /* Include the EID and length fields */ |
| 1996 | mbo_ie_len = mbo_ie[1] + 2; |
| 1997 | pe_debug("Stripped MBO IE of length %d", mbo_ie_len); |
| 1998 | } |
| 1999 | |
| 2000 | /* |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2001 | * Do unpack to populate the add_ie buffer to frm structure |
| 2002 | * before packing the frm structure. In this way, the IE ordering |
| 2003 | * which the latest 802.11 spec mandates is maintained. |
| 2004 | */ |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 2005 | if (add_ie_len) { |
| 2006 | ret = dot11f_unpack_assoc_request(mac_ctx, add_ie, |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2007 | add_ie_len, frm, true); |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 2008 | if (DOT11F_FAILED(ret)) { |
| 2009 | pe_err("unpack failed, ret: 0x%x", ret); |
| 2010 | goto end; |
| 2011 | } |
| 2012 | } |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2013 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2014 | status = dot11f_get_packed_assoc_request_size(mac_ctx, frm, &payload); |
| 2015 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2016 | pe_err("Association Request packet size failure(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2017 | status); |
| 2018 | /* We'll fall back on the worst case scenario: */ |
| 2019 | payload = sizeof(tDot11fAssocRequest); |
| 2020 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2021 | pe_warn("Association request packet size warning (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2022 | status); |
| 2023 | } |
| 2024 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2025 | bytes = payload + sizeof(tSirMacMgmtHdr) + |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2026 | aes_block_size_len + mbo_ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2027 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2028 | qdf_status = cds_packet_alloc((uint16_t) bytes, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2029 | (void **)&packet); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2030 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2031 | pe_err("Failed to allocate %d bytes", bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2032 | |
| 2033 | pe_session->limMlmState = pe_session->limPrevMlmState; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2034 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_MLM_STATE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2035 | pe_session->peSessionId, |
| 2036 | pe_session->limMlmState)); |
| 2037 | |
| 2038 | /* Update PE session id */ |
| 2039 | assoc_cnf.sessionId = pe_session->peSessionId; |
| 2040 | |
| 2041 | assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2042 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2043 | lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, |
| 2044 | (uint32_t *) &assoc_cnf); |
| 2045 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2046 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2047 | } |
| 2048 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2049 | qdf_mem_set(frame, bytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2050 | |
| 2051 | /* Next, we fill out the buffer descriptor: */ |
| 2052 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 2053 | SIR_MAC_MGMT_ASSOC_REQ, pe_session->bssId, |
| 2054 | pe_session->selfMacAddr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2055 | /* That done, pack the Assoc Request: */ |
| 2056 | status = dot11f_pack_assoc_request(mac_ctx, frm, |
| 2057 | frame + sizeof(tSirMacMgmtHdr), payload, &payload); |
| 2058 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2059 | pe_err("Assoc request pack failure (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2060 | cds_packet_free((void *)packet); |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2061 | goto end; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2062 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2063 | pe_warn("Assoc request pack warning (0x%08x)", status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2064 | } |
| 2065 | |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2066 | /* Copy the MBO IE to the end of the frame */ |
| 2067 | qdf_mem_copy(frame + sizeof(tSirMacMgmtHdr) + payload, |
| 2068 | mbo_ie, mbo_ie_len); |
| 2069 | payload = payload + mbo_ie_len; |
| 2070 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2071 | if (pe_session->assocReq != NULL) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2072 | qdf_mem_free(pe_session->assocReq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2073 | pe_session->assocReq = NULL; |
Naveen Rawat | 83102ef | 2015-11-03 10:42:34 -0800 | [diff] [blame] | 2074 | pe_session->assocReqLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2075 | } |
| 2076 | |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2077 | if (lim_is_fils_connection(pe_session)) { |
| 2078 | qdf_status = aead_encrypt_assoc_req(mac_ctx, pe_session, |
| 2079 | frame, &payload); |
| 2080 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2081 | cds_packet_free((void *)packet); |
| 2082 | qdf_mem_free(frm); |
| 2083 | return; |
| 2084 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2085 | } |
| 2086 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2087 | pe_session->assocReq = qdf_mem_malloc(payload); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2088 | if (NULL == pe_session->assocReq) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2089 | pe_err("Unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | } else { |
| 2091 | /* |
| 2092 | * Store the Assoc request. This is sent to csr/hdd in |
| 2093 | * join cnf response. |
| 2094 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2095 | qdf_mem_copy(pe_session->assocReq, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2096 | frame + sizeof(tSirMacMgmtHdr), payload); |
| 2097 | pe_session->assocReqLen = payload; |
| 2098 | } |
| 2099 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2100 | if ((BAND_5G == lim_get_rf_band(pe_session->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2101 | || (pe_session->pePersona == QDF_P2P_CLIENT_MODE) |
| 2102 | || (pe_session->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2103 | ) |
| 2104 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2105 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2106 | if (pe_session->pePersona == QDF_P2P_CLIENT_MODE || |
| 2107 | pe_session->pePersona == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2108 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2109 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2110 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2111 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2112 | pe_session->peSessionId, mac_hdr->fc.subType)); |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 2113 | |
| 2114 | pe_debug("Sending Association Request length %d to ", bytes); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2115 | min_rid = lim_get_min_session_txrate(pe_session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2116 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_START_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2117 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2118 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2119 | pe_session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2120 | qdf_status = |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2121 | wma_tx_frameWithTxComplete(mac_ctx, packet, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2122 | (uint16_t) (sizeof(tSirMacMgmtHdr) + payload), |
| 2123 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2124 | lim_tx_complete, frame, lim_assoc_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2125 | tx_flag, sme_sessionid, false, 0, min_rid); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2126 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2127 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2128 | pe_session->peSessionId, qdf_status)); |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2129 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2130 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2131 | pe_err("Failed to send Association Request (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2132 | qdf_status); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2133 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2134 | pe_session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2135 | /* Pkt will be freed up by the callback */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2136 | } |
Vignesh Viswanathan | dada793 | 2018-09-18 12:57:55 +0530 | [diff] [blame] | 2137 | free_mbo_ie: |
| 2138 | if (mbo_ie) |
| 2139 | qdf_mem_free(mbo_ie); |
| 2140 | |
yeshwanth sriram guntuka | 0783101 | 2017-06-30 12:26:57 +0530 | [diff] [blame] | 2141 | end: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2142 | /* Free up buffer allocated for mlm_assoc_req */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2143 | qdf_mem_free(mlm_assoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2144 | mlm_assoc_req = NULL; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2145 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2146 | return; |
| 2147 | } |
| 2148 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2149 | /** |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 2150 | * lim_addba_rsp_tx_complete_cnf() - Confirmation for add BA response OTA |
| 2151 | * @context: pointer to global mac |
| 2152 | * @buf: buffer which is nothing but entire ADD BA frame |
| 2153 | * @tx_complete : Sent status |
| 2154 | * @params; tx completion params |
| 2155 | * |
| 2156 | * Return: This returns QDF_STATUS |
| 2157 | */ |
| 2158 | static QDF_STATUS lim_addba_rsp_tx_complete_cnf(void *context, |
| 2159 | qdf_nbuf_t buf, |
| 2160 | uint32_t tx_complete, |
| 2161 | void *params) |
| 2162 | { |
| 2163 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
| 2164 | tSirMacMgmtHdr *mac_hdr; |
| 2165 | tDot11faddba_rsp rsp; |
| 2166 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2167 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 2168 | uint8_t peer_id; |
| 2169 | void *peer; |
| 2170 | uint32_t frame_len; |
| 2171 | QDF_STATUS status; |
| 2172 | uint8_t *data; |
| 2173 | |
| 2174 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) |
| 2175 | pe_debug("Add ba response successfully sent"); |
| 2176 | else |
| 2177 | pe_debug("Fail to send add ba response"); |
| 2178 | |
| 2179 | if (!buf) { |
| 2180 | pe_err("Addba response frame buffer is NULL"); |
| 2181 | return QDF_STATUS_E_FAILURE; |
| 2182 | } |
| 2183 | |
| 2184 | data = qdf_nbuf_data(buf); |
| 2185 | |
| 2186 | if (!data) { |
| 2187 | pe_err("Addba response frame is NULL"); |
| 2188 | return QDF_STATUS_E_FAILURE; |
| 2189 | } |
| 2190 | |
| 2191 | mac_hdr = (tSirMacMgmtHdr *)data; |
| 2192 | qdf_mem_zero((void *)&rsp, sizeof(tDot11faddba_rsp)); |
| 2193 | frame_len = sizeof(rsp); |
| 2194 | status = dot11f_unpack_addba_rsp(mac_ctx, (uint8_t *)data + |
| 2195 | sizeof(*mac_hdr), frame_len, |
| 2196 | &rsp, false); |
| 2197 | |
| 2198 | if (DOT11F_FAILED(status)) { |
| 2199 | pe_err("Failed to unpack and parse (0x%08x, %d bytes)", |
| 2200 | status, frame_len); |
| 2201 | goto error; |
| 2202 | } |
| 2203 | |
| 2204 | peer = cdp_peer_get_ref_by_addr(soc, pdev, mac_hdr->da, &peer_id, |
| 2205 | PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 2206 | if (!peer) { |
| 2207 | pe_debug("no PEER found for mac_addr:%pM", mac_hdr->da); |
| 2208 | goto error; |
| 2209 | } |
| 2210 | cdp_addba_resp_tx_completion(soc, peer, rsp.addba_param_set.tid, |
| 2211 | tx_complete); |
| 2212 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_WMA_ADDBA_REQ); |
| 2213 | error: |
| 2214 | if (buf) |
| 2215 | qdf_nbuf_free(buf); |
| 2216 | |
| 2217 | return QDF_STATUS_SUCCESS; |
| 2218 | } |
| 2219 | |
| 2220 | /** |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2221 | * lim_auth_tx_complete_cnf()- Confirmation for auth sent over the air |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2222 | * @context: pointer to global mac |
| 2223 | * @buf: buffer |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2224 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2225 | * @params; tx completion params |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2226 | * |
| 2227 | * Return: This returns QDF_STATUS |
| 2228 | */ |
| 2229 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2230 | static QDF_STATUS lim_auth_tx_complete_cnf(void *context, |
| 2231 | qdf_nbuf_t buf, |
| 2232 | uint32_t tx_complete, |
| 2233 | void *params) |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2234 | { |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2235 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2236 | uint16_t auth_ack_status; |
| 2237 | uint16_t reason_code; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2238 | |
Naveen Rawat | 684e8b1 | 2017-09-20 15:54:44 -0700 | [diff] [blame] | 2239 | pe_debug("tx_complete = %d %s", tx_complete, |
Zhu Jianmin | 5d8e3fe | 2018-01-04 16:16:20 +0800 | [diff] [blame] | 2240 | (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ? |
| 2241 | "success" : "fail"); |
| 2242 | if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) { |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2243 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_SUCCESS; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2244 | auth_ack_status = ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2245 | reason_code = QDF_STATUS_SUCCESS; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2246 | /* 'Change' timer for future activations */ |
| 2247 | lim_deactivate_and_change_timer(mac_ctx, eLIM_AUTH_RETRY_TIMER); |
| 2248 | } else { |
| 2249 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2250 | auth_ack_status = NOT_ACKED; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2251 | reason_code = QDF_STATUS_E_FAILURE; |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2252 | } |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2253 | |
| 2254 | if (buf) |
| 2255 | qdf_nbuf_free(buf); |
| 2256 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2257 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
| 2258 | NULL, auth_ack_status, reason_code); |
| 2259 | |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2260 | return QDF_STATUS_SUCCESS; |
| 2261 | } |
| 2262 | |
| 2263 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2264 | * lim_send_auth_mgmt_frame() - Send an Authentication frame |
| 2265 | * |
| 2266 | * @mac_ctx: Pointer to Global MAC structure |
| 2267 | * @auth_frame: Pointer to Authentication frame structure |
| 2268 | * @peer_addr: MAC address of destination peer |
| 2269 | * @wep_bit: wep bit in frame control for Authentication frame3 |
| 2270 | * @session: PE session information |
| 2271 | * |
| 2272 | * This function is called by lim_process_mlm_messages(). Authentication frame |
| 2273 | * is formatted and sent when this function is called. |
| 2274 | * |
| 2275 | * Return: void |
| 2276 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2277 | void |
| 2278 | lim_send_auth_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 2279 | tpSirMacAuthFrameBody auth_frame, |
| 2280 | tSirMacAddr peer_addr, |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2281 | uint8_t wep_challenge_len, |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2282 | tpPESession session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2283 | { |
| 2284 | uint8_t *frame, *body; |
| 2285 | uint32_t frame_len = 0, body_len = 0; |
| 2286 | tpSirMacMgmtHdr mac_hdr; |
| 2287 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2288 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2289 | uint8_t tx_flag = 0; |
| 2290 | uint8_t sme_sessionid = 0; |
| 2291 | uint16_t ft_ies_length = 0; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2292 | bool challenge_req = false; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2293 | enum rateid min_rid = RATEID_DEFAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2294 | |
| 2295 | if (NULL == session) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2296 | pe_err("Error: psession Entry is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2297 | return; |
| 2298 | } |
| 2299 | |
| 2300 | sme_sessionid = session->smeSessionId; |
| 2301 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2302 | if (wep_challenge_len) { |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2303 | /* |
| 2304 | * Auth frame3 to be sent with encrypted framebody |
| 2305 | * |
| 2306 | * Allocate buffer for Authenticaton frame of size |
| 2307 | * equal to management frame header length plus 2 bytes |
| 2308 | * each for auth algorithm number, transaction number, |
| 2309 | * status code, 128 bytes for challenge text and |
| 2310 | * 4 bytes each for IV & ICV. |
| 2311 | */ |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2312 | pe_debug("Sending encrypted auth frame to " MAC_ADDRESS_STR, |
| 2313 | MAC_ADDR_ARRAY(peer_addr)); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2314 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2315 | body_len = wep_challenge_len + LIM_ENCR_AUTH_INFO_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2316 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2317 | |
| 2318 | goto alloc_packet; |
| 2319 | } |
| 2320 | |
Tushnim Bhattacharyya | 332b74c | 2018-08-10 10:55:51 -0700 | [diff] [blame] | 2321 | pe_debug("Sending Auth seq# %d status %d (%d) to " |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2322 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2323 | auth_frame->authTransactionSeqNumber, |
| 2324 | auth_frame->authStatusCode, |
| 2325 | (auth_frame->authStatusCode == eSIR_MAC_SUCCESS_STATUS), |
| 2326 | MAC_ADDR_ARRAY(peer_addr)); |
| 2327 | |
| 2328 | switch (auth_frame->authTransactionSeqNumber) { |
| 2329 | case SIR_MAC_AUTH_FRAME_1: |
| 2330 | /* |
| 2331 | * Allocate buffer for Authenticaton frame of size |
| 2332 | * equal to management frame header length plus 2 bytes |
| 2333 | * each for auth algorithm number, transaction number |
| 2334 | * and status code. |
| 2335 | */ |
| 2336 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2337 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2338 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2339 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2340 | frame_len += lim_create_fils_auth_data(mac_ctx, |
| 2341 | auth_frame, session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2342 | if (auth_frame->authAlgoNumber == eSIR_FT_AUTH) { |
| 2343 | if (NULL != session->ftPEContext.pFTPreAuthReq && |
| 2344 | 0 != session->ftPEContext.pFTPreAuthReq-> |
| 2345 | ft_ies_length) { |
| 2346 | ft_ies_length = session->ftPEContext. |
| 2347 | pFTPreAuthReq->ft_ies_length; |
| 2348 | frame_len += ft_ies_length; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2349 | pe_debug("Auth frame, FTIES length added=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2350 | ft_ies_length); |
| 2351 | } else { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2352 | pe_debug("Auth frame, Does not contain FTIES!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2353 | frame_len += (2 + SIR_MDIE_SIZE); |
| 2354 | } |
| 2355 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2356 | break; |
| 2357 | |
| 2358 | case SIR_MAC_AUTH_FRAME_2: |
| 2359 | if ((auth_frame->authAlgoNumber == eSIR_OPEN_SYSTEM) || |
| 2360 | ((auth_frame->authAlgoNumber == eSIR_SHARED_KEY) && |
| 2361 | (auth_frame->authStatusCode != |
| 2362 | eSIR_MAC_SUCCESS_STATUS))) { |
| 2363 | /* |
| 2364 | * Allocate buffer for Authenticaton frame of size |
| 2365 | * equal to management frame header length plus |
| 2366 | * 2 bytes each for auth algorithm number, |
| 2367 | * transaction number and status code. |
| 2368 | */ |
| 2369 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2370 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2371 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2372 | } else { |
| 2373 | /* |
| 2374 | * Shared Key algorithm with challenge text |
| 2375 | * to be sent. |
| 2376 | * |
| 2377 | * Allocate buffer for Authenticaton frame of size |
| 2378 | * equal to management frame header length plus |
| 2379 | * 2 bytes each for auth algorithm number, |
| 2380 | * transaction number, status code and 128 bytes |
| 2381 | * for challenge text. |
| 2382 | */ |
| 2383 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2384 | challenge_req = true; |
| 2385 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN + |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2386 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2387 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2388 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2389 | } |
| 2390 | break; |
| 2391 | |
| 2392 | case SIR_MAC_AUTH_FRAME_3: |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2393 | /* |
| 2394 | * Auth frame3 to be sent without encrypted framebody |
| 2395 | * |
| 2396 | * Allocate buffer for Authenticaton frame of size equal |
| 2397 | * to management frame header length plus 2 bytes each |
| 2398 | * for auth algorithm number, transaction number and |
| 2399 | * status code. |
| 2400 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2401 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2402 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2403 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2404 | break; |
| 2405 | |
| 2406 | case SIR_MAC_AUTH_FRAME_4: |
| 2407 | /* |
| 2408 | * Allocate buffer for Authenticaton frame of size equal |
| 2409 | * to management frame header length plus 2 bytes each |
| 2410 | * for auth algorithm number, transaction number and |
| 2411 | * status code. |
| 2412 | */ |
| 2413 | |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2414 | body_len = SIR_MAC_AUTH_FRAME_INFO_LEN; |
| 2415 | frame_len = sizeof(tSirMacMgmtHdr) + body_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2416 | |
| 2417 | break; |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2418 | default: |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2419 | pe_err("Invalid auth transaction seq num"); |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2420 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2421 | } /* switch (auth_frame->authTransactionSeqNumber) */ |
| 2422 | |
Krishna Kumaar Natarajan | 7e6a23c | 2016-04-05 14:45:24 -0700 | [diff] [blame] | 2423 | alloc_packet: |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2424 | qdf_status = cds_packet_alloc((uint16_t) frame_len, (void **)&frame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2425 | (void **)&packet); |
| 2426 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2427 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2428 | pe_err("call to bufAlloc failed for AUTH frame"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2429 | return; |
| 2430 | } |
| 2431 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2432 | qdf_mem_zero(frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2433 | |
| 2434 | /* Prepare BD */ |
| 2435 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 2436 | SIR_MAC_MGMT_AUTH, peer_addr, session->selfMacAddr); |
| 2437 | mac_hdr = (tpSirMacMgmtHdr) frame; |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2438 | if (wep_challenge_len) |
| 2439 | mac_hdr->fc.wep = LIM_WEP_IN_FC; |
| 2440 | else |
| 2441 | mac_hdr->fc.wep = LIM_NO_WEP_IN_FC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2442 | |
| 2443 | /* Prepare BSSId */ |
Rajeev Kumar | cf835a0 | 2016-04-15 15:01:31 -0700 | [diff] [blame] | 2444 | if (LIM_IS_AP_ROLE(session)) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2445 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2446 | (uint8_t *) session->bssId, |
| 2447 | sizeof(tSirMacAddr)); |
| 2448 | |
| 2449 | /* Prepare Authentication frame body */ |
| 2450 | body = frame + sizeof(tSirMacMgmtHdr); |
| 2451 | |
yeshwanth sriram guntuka | 343a3f2 | 2017-07-27 18:30:18 +0530 | [diff] [blame] | 2452 | if (wep_challenge_len) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2453 | qdf_mem_copy(body, (uint8_t *) auth_frame, body_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2454 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2455 | pe_debug("Sending Auth seq# 3 to " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2456 | MAC_ADDR_ARRAY(mac_hdr->da)); |
| 2457 | |
| 2458 | } else { |
| 2459 | *((uint16_t *) (body)) = |
| 2460 | sir_swap_u16if_needed(auth_frame->authAlgoNumber); |
| 2461 | body += sizeof(uint16_t); |
| 2462 | body_len -= sizeof(uint16_t); |
| 2463 | |
| 2464 | *((uint16_t *) (body)) = |
| 2465 | sir_swap_u16if_needed( |
| 2466 | auth_frame->authTransactionSeqNumber); |
| 2467 | body += sizeof(uint16_t); |
| 2468 | body_len -= sizeof(uint16_t); |
| 2469 | |
| 2470 | *((uint16_t *) (body)) = |
| 2471 | sir_swap_u16if_needed(auth_frame->authStatusCode); |
| 2472 | body += sizeof(uint16_t); |
| 2473 | body_len -= sizeof(uint16_t); |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2474 | |
| 2475 | if (challenge_req) { |
| 2476 | if (body_len < SIR_MAC_AUTH_CHALLENGE_BODY_LEN) { |
Himanshu Agarwal | c422ca7 | 2017-09-19 11:07:36 +0530 | [diff] [blame] | 2477 | /* copy challenge IE id, len, challenge text */ |
| 2478 | *body = auth_frame->type; |
| 2479 | body++; |
| 2480 | body_len -= sizeof(uint8_t); |
| 2481 | *body = auth_frame->length; |
| 2482 | body++; |
| 2483 | body_len -= sizeof(uint8_t); |
| 2484 | qdf_mem_copy(body, auth_frame->challengeText, |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2485 | body_len); |
| 2486 | pe_err("Incomplete challenge info: length: %d, expected: %d", |
| 2487 | body_len, |
| 2488 | SIR_MAC_AUTH_CHALLENGE_BODY_LEN); |
| 2489 | body += body_len; |
| 2490 | body_len = 0; |
| 2491 | } else { |
| 2492 | /* copy challenge IE id, len, challenge text */ |
| 2493 | *body = auth_frame->type; |
| 2494 | body++; |
| 2495 | *body = auth_frame->length; |
| 2496 | body++; |
| 2497 | qdf_mem_copy(body, auth_frame->challengeText, |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2498 | SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH); |
| 2499 | body += SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2500 | |
yeshwanth sriram guntuka | 5c71a29 | 2017-08-24 15:51:19 +0530 | [diff] [blame] | 2501 | body_len -= SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH + |
| 2502 | SIR_MAC_CHALLENGE_ID_LEN; |
Krishna Kumaar Natarajan | 0517c60 | 2017-06-02 14:58:21 -0700 | [diff] [blame] | 2503 | } |
| 2504 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2505 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2506 | if ((auth_frame->authAlgoNumber == eSIR_FT_AUTH) && |
| 2507 | (auth_frame->authTransactionSeqNumber == |
| 2508 | SIR_MAC_AUTH_FRAME_1) && |
| 2509 | (session->ftPEContext.pFTPreAuthReq != NULL)) { |
| 2510 | |
| 2511 | if (ft_ies_length > 0) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2512 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2513 | session->ftPEContext. |
| 2514 | pFTPreAuthReq->ft_ies, |
| 2515 | ft_ies_length); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2516 | pe_debug("Auth1 Frame FTIE is: "); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2517 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2518 | QDF_TRACE_LEVEL_DEBUG, |
| 2519 | (uint8_t *) body, |
| 2520 | ft_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2521 | } else if (NULL != session->ftPEContext. |
| 2522 | pFTPreAuthReq->pbssDescription) { |
| 2523 | /* MDID attr is 54 */ |
| 2524 | *body = SIR_MDIE_ELEMENT_ID; |
| 2525 | body++; |
| 2526 | *body = SIR_MDIE_SIZE; |
| 2527 | body++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2528 | qdf_mem_copy(body, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2529 | &session->ftPEContext.pFTPreAuthReq-> |
| 2530 | pbssDescription->mdie[0], |
| 2531 | SIR_MDIE_SIZE); |
| 2532 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2533 | } else if (auth_frame->authAlgoNumber == |
Varun Reddy Yeturu | 5faa177 | 2017-10-23 11:22:01 -0700 | [diff] [blame] | 2534 | SIR_FILS_SK_WITHOUT_PFS) { |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2535 | /* TODO MDIE */ |
| 2536 | pe_debug("appending fils Auth data"); |
| 2537 | lim_add_fils_data_to_auth_frame(session, body); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2538 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2539 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2540 | pe_debug("*** Sending Auth seq# %d status %d (%d) to " |
| 2541 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2542 | auth_frame->authTransactionSeqNumber, |
| 2543 | auth_frame->authStatusCode, |
| 2544 | (auth_frame->authStatusCode == |
| 2545 | eSIR_MAC_SUCCESS_STATUS), |
| 2546 | MAC_ADDR_ARRAY(mac_hdr->da)); |
| 2547 | } |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 2548 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, |
| 2549 | QDF_TRACE_LEVEL_DEBUG, |
| 2550 | frame, frame_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2551 | |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2552 | if ((NULL != session->ftPEContext.pFTPreAuthReq) && |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2553 | (BAND_5G == lim_get_rf_band( |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2554 | session->ftPEContext.pFTPreAuthReq->preAuthchannelNum))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2555 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2556 | else if ((BAND_5G == |
Deepthi Gowri | 1de51e3 | 2016-09-01 15:47:28 +0530 | [diff] [blame] | 2557 | lim_get_rf_band(session->currentOperChannel)) |
| 2558 | || (session->pePersona == QDF_P2P_CLIENT_MODE) |
| 2559 | || (session->pePersona == QDF_P2P_GO_MODE)) |
| 2560 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2561 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2562 | if (session->pePersona == QDF_P2P_CLIENT_MODE || |
| 2563 | session->pePersona == QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2564 | tx_flag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
| 2565 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2566 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2567 | session->peSessionId, mac_hdr->fc.subType)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2568 | |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2569 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2570 | min_rid = lim_get_min_session_txrate(session); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2571 | lim_diag_mgmt_tx_event_report(mac_ctx, mac_hdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2572 | session, QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2573 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 2574 | (uint16_t)frame_len, |
| 2575 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 2576 | 7, lim_tx_complete, frame, |
| 2577 | lim_auth_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2578 | tx_flag, sme_sessionid, false, 0, min_rid); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2579 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 2580 | session->peSessionId, qdf_status)); |
| 2581 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 2582 | pe_err("*** Could not send Auth frame, retCode=%X ***", |
| 2583 | qdf_status); |
| 2584 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 2585 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2586 | session, SENT_FAIL, QDF_STATUS_E_FAILURE); |
Abhishek Singh | dd2cb57 | 2017-08-11 11:10:19 +0530 | [diff] [blame] | 2587 | /* Pkt will be freed up by the callback */ |
Abhishek Singh | 7d3bc3e | 2016-02-03 17:45:01 +0530 | [diff] [blame] | 2588 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2589 | return; |
| 2590 | } |
| 2591 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2592 | QDF_STATUS lim_send_deauth_cnf(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2593 | { |
| 2594 | uint16_t aid; |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2595 | tpDphHashNode sta_ds; |
| 2596 | tLimMlmDeauthReq *deauth_req; |
| 2597 | tLimMlmDeauthCnf deauth_cnf; |
| 2598 | tpPESession session_entry; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2599 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2600 | deauth_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 2601 | if (deauth_req) { |
| 2602 | if (tx_timer_running( |
| 2603 | &mac_ctx->lim.limTimers.gLimDeauthAckTimer)) |
| 2604 | lim_deactivate_and_change_timer(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2605 | eLIM_DEAUTH_ACK_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2606 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2607 | session_entry = pe_find_session_by_session_id(mac_ctx, |
| 2608 | deauth_req->sessionId); |
| 2609 | if (session_entry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2610 | pe_err("session does not exist for given sessionId"); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2611 | deauth_cnf.resultCode = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2612 | eSIR_SME_INVALID_PARAMETERS; |
| 2613 | goto end; |
| 2614 | } |
| 2615 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2616 | sta_ds = |
| 2617 | dph_lookup_hash_entry(mac_ctx, |
| 2618 | deauth_req->peer_macaddr.bytes, |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 2619 | &aid, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2620 | &session_entry->dph.dphHashTable); |
| 2621 | if (sta_ds == NULL) { |
| 2622 | deauth_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2623 | goto end; |
| 2624 | } |
| 2625 | |
| 2626 | /* / Receive path cleanup with dummy packet */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2627 | lim_ft_cleanup_pre_auth_info(mac_ctx, session_entry); |
| 2628 | lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry); |
| 2629 | if ((session_entry->limSystemRole == eLIM_STA_ROLE) && |
| 2630 | ( |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2631 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2632 | (session_entry->isESEconnection) || |
Abhishek Singh | e068085 | 2015-12-16 14:28:48 +0530 | [diff] [blame] | 2633 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2634 | (session_entry->isFastRoamIniFeatureEnabled) || |
| 2635 | (session_entry->is11Rconnection))) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2636 | pe_debug("FT Preauth (%pK,%d) Deauth rc %d src = %d", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2637 | session_entry, |
| 2638 | session_entry->peSessionId, |
| 2639 | deauth_req->reasonCode, |
| 2640 | deauth_req->deauthTrigger); |
| 2641 | lim_ft_cleanup(mac_ctx, session_entry); |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2642 | } else { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2643 | pe_debug("No FT Preauth Session Cleanup in role %d" |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2644 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2645 | " isESE %d" |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2646 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2647 | " isLFR %d" |
| 2648 | " is11r %d, Deauth reason %d Trigger = %d", |
| 2649 | session_entry->limSystemRole, |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2650 | #ifdef FEATURE_WLAN_ESE |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2651 | session_entry->isESEconnection, |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2652 | #endif |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2653 | session_entry->isFastRoamIniFeatureEnabled, |
| 2654 | session_entry->is11Rconnection, |
| 2655 | deauth_req->reasonCode, |
| 2656 | deauth_req->deauthTrigger); |
Deepak Dhamdhere | 262d95a | 2016-01-10 16:36:53 -0800 | [diff] [blame] | 2657 | } |
| 2658 | /* Free up buffer allocated for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2659 | qdf_mem_free(deauth_req); |
| 2660 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2661 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2662 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2663 | end: |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2664 | qdf_copy_macaddr(&deauth_cnf.peer_macaddr, |
| 2665 | &deauth_req->peer_macaddr); |
| 2666 | deauth_cnf.deauthTrigger = deauth_req->deauthTrigger; |
| 2667 | deauth_cnf.aid = deauth_req->aid; |
| 2668 | deauth_cnf.sessionId = deauth_req->sessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2669 | |
| 2670 | /* Free up buffer allocated */ |
| 2671 | /* for mlmDeauthReq */ |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2672 | qdf_mem_free(deauth_req); |
| 2673 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2674 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2675 | lim_post_sme_message(mac_ctx, |
| 2676 | LIM_MLM_DEAUTH_CNF, (uint32_t *) &deauth_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2677 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2678 | } |
| 2679 | |
| 2680 | /** |
| 2681 | * lim_send_disassoc_cnf() - Send disassoc confirmation to SME |
| 2682 | * |
| 2683 | * @mac_ctx: Handle to MAC context |
| 2684 | * |
| 2685 | * Sends disassoc confirmation to SME. Removes disassoc request stored |
| 2686 | * in lim. |
| 2687 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2688 | * Return: QDF_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2689 | */ |
| 2690 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2691 | QDF_STATUS lim_send_disassoc_cnf(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2692 | { |
| 2693 | uint16_t aid; |
| 2694 | tpDphHashNode sta_ds; |
| 2695 | tLimMlmDisassocCnf disassoc_cnf; |
| 2696 | tpPESession pe_session; |
| 2697 | tLimMlmDisassocReq *disassoc_req; |
| 2698 | |
| 2699 | disassoc_req = mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 2700 | if (disassoc_req) { |
| 2701 | if (tx_timer_running( |
| 2702 | &mac_ctx->lim.limTimers.gLimDisassocAckTimer)) |
| 2703 | lim_deactivate_and_change_timer(mac_ctx, |
| 2704 | eLIM_DISASSOC_ACK_TIMER); |
| 2705 | |
| 2706 | pe_session = pe_find_session_by_session_id( |
| 2707 | mac_ctx, disassoc_req->sessionId); |
| 2708 | if (pe_session == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2709 | pe_err("No session for given sessionId"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2710 | disassoc_cnf.resultCode = |
| 2711 | eSIR_SME_INVALID_PARAMETERS; |
| 2712 | goto end; |
| 2713 | } |
| 2714 | |
| 2715 | sta_ds = dph_lookup_hash_entry(mac_ctx, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 2716 | disassoc_req->peer_macaddr.bytes, &aid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2717 | &pe_session->dph.dphHashTable); |
| 2718 | if (sta_ds == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2719 | pe_err("StaDs Null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2720 | disassoc_cnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2721 | goto end; |
| 2722 | } |
| 2723 | /* Receive path cleanup with dummy packet */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2724 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2725 | lim_cleanup_rx_path(mac_ctx, sta_ds, pe_session)) { |
| 2726 | disassoc_cnf.resultCode = |
| 2727 | eSIR_SME_RESOURCES_UNAVAILABLE; |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2728 | pe_err("cleanup_rx_path error"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2729 | goto end; |
| 2730 | } |
Deepak Dhamdhere | 57c95ff | 2016-09-30 16:44:44 -0700 | [diff] [blame] | 2731 | if (LIM_IS_STA_ROLE(pe_session) && |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2732 | (disassoc_req->reasonCode != |
| 2733 | eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) { |
Jeff Johnson | 11bd4f3 | 2017-09-18 08:15:17 -0700 | [diff] [blame] | 2734 | pe_debug("FT Preauth Session (%pK %d) Clean up", |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2735 | pe_session, pe_session->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2736 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2737 | /* Delete FT session if there exists one */ |
| 2738 | lim_ft_cleanup_pre_auth_info(mac_ctx, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2739 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2740 | /* Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2741 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2742 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2743 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2745 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2746 | } |
| 2747 | end: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2748 | qdf_mem_copy((uint8_t *) &disassoc_cnf.peerMacAddr, |
Srinivas Girigowda | dd3c513 | 2016-01-05 19:41:27 -0800 | [diff] [blame] | 2749 | (uint8_t *) disassoc_req->peer_macaddr.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2750 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2751 | disassoc_cnf.aid = disassoc_req->aid; |
| 2752 | disassoc_cnf.disassocTrigger = disassoc_req->disassocTrigger; |
| 2753 | |
| 2754 | /* Update PE session ID */ |
| 2755 | disassoc_cnf.sessionId = disassoc_req->sessionId; |
| 2756 | |
| 2757 | if (disassoc_req != NULL) { |
| 2758 | /* / Free up buffer allocated for mlmDisassocReq */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2759 | qdf_mem_free(disassoc_req); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2760 | mac_ctx->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 2761 | } |
| 2762 | |
| 2763 | lim_post_sme_message(mac_ctx, LIM_MLM_DISASSOC_CNF, |
| 2764 | (uint32_t *) &disassoc_cnf); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2765 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2766 | } |
| 2767 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2768 | QDF_STATUS lim_disassoc_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2769 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2770 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2771 | { |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2772 | tpAniSirGlobal max_ctx = (tpAniSirGlobal)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2773 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2774 | pe_debug("tx_success: %d", tx_success); |
| 2775 | |
| 2776 | return lim_send_disassoc_cnf(max_ctx); |
| 2777 | } |
| 2778 | |
| 2779 | static QDF_STATUS lim_disassoc_tx_complete_cnf_handler(void *context, |
| 2780 | qdf_nbuf_t buf, |
| 2781 | uint32_t tx_success, |
| 2782 | void *params) |
| 2783 | { |
| 2784 | tpAniSirGlobal max_ctx = (tpAniSirGlobal)context; |
| 2785 | QDF_STATUS status_code; |
| 2786 | struct scheduler_msg msg = {0}; |
| 2787 | |
| 2788 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2789 | |
| 2790 | if (buf) |
| 2791 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2792 | msg.type = (uint16_t) WMA_DISASSOC_TX_COMP; |
| 2793 | msg.bodyptr = params; |
| 2794 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2795 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2796 | status_code = lim_post_msg_high_priority(max_ctx, &msg); |
| 2797 | if (status_code != QDF_STATUS_SUCCESS) |
| 2798 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 2799 | msg.type, status_code); |
| 2800 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2801 | } |
| 2802 | |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2803 | QDF_STATUS lim_deauth_tx_complete_cnf(void *context, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2804 | uint32_t tx_success, |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2805 | void *params) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2806 | { |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2807 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 2808 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2809 | pe_debug("tx_success: %d", tx_success); |
| 2810 | |
| 2811 | return lim_send_deauth_cnf(mac_ctx); |
| 2812 | } |
| 2813 | |
| 2814 | static QDF_STATUS lim_deauth_tx_complete_cnf_handler(void *context, |
| 2815 | qdf_nbuf_t buf, |
| 2816 | uint32_t tx_success, |
| 2817 | void *params) |
| 2818 | { |
| 2819 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal)context; |
| 2820 | QDF_STATUS status_code; |
| 2821 | struct scheduler_msg msg = {0}; |
| 2822 | |
| 2823 | pe_debug("tx_success: %d", tx_success); |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2824 | |
| 2825 | if (buf) |
| 2826 | qdf_nbuf_free(buf); |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2827 | msg.type = (uint16_t) WMA_DEAUTH_TX_COMP; |
| 2828 | msg.bodyptr = params; |
| 2829 | msg.bodyval = tx_success; |
Himanshu Agarwal | 8b472bc | 2017-01-20 20:49:41 +0530 | [diff] [blame] | 2830 | |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2831 | status_code = lim_post_msg_high_priority(mac_ctx, &msg); |
| 2832 | if (status_code != QDF_STATUS_SUCCESS) |
| 2833 | pe_err("posting message: %X to LIM failed, reason: %d", |
| 2834 | msg.type, status_code); |
| 2835 | return status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2836 | } |
| 2837 | |
| 2838 | /** |
| 2839 | * \brief This function is called to send Disassociate frame. |
| 2840 | * |
| 2841 | * |
| 2842 | * \param pMac Pointer to Global MAC structure |
| 2843 | * |
| 2844 | * \param nReason Indicates the reason that need to be sent in |
| 2845 | * Disassociation frame |
| 2846 | * |
| 2847 | * \param peerMacAddr MAC address of the STA to which Disassociation frame is |
| 2848 | * sent |
| 2849 | * |
| 2850 | * |
| 2851 | */ |
| 2852 | |
| 2853 | void |
| 2854 | lim_send_disassoc_mgmt_frame(tpAniSirGlobal pMac, |
| 2855 | uint16_t nReason, |
| 2856 | tSirMacAddr peer, |
| 2857 | tpPESession psessionEntry, bool waitForAck) |
| 2858 | { |
| 2859 | tDot11fDisassociation frm; |
| 2860 | uint8_t *pFrame; |
| 2861 | tpSirMacMgmtHdr pMacHdr; |
| 2862 | uint32_t nBytes, nPayload, nStatus; |
| 2863 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2864 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2865 | uint8_t txFlag = 0; |
| 2866 | uint32_t val = 0; |
| 2867 | uint8_t smeSessionId = 0; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 2868 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2869 | if (NULL == psessionEntry) { |
| 2870 | return; |
| 2871 | } |
| 2872 | |
| 2873 | /* |
| 2874 | * In case when cac timer is running for this SAP session then |
| 2875 | * avoid sending disassoc out. It is violation of dfs specification. |
| 2876 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2877 | if (((psessionEntry->pePersona == QDF_SAP_MODE) || |
| 2878 | (psessionEntry->pePersona == QDF_P2P_GO_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2879 | (true == pMac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2880 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2881 | FL |
| 2882 | ("CAC timer is running, drop disassoc from going out")); |
| 2883 | return; |
| 2884 | } |
| 2885 | smeSessionId = psessionEntry->smeSessionId; |
| 2886 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2887 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2888 | |
| 2889 | frm.Reason.code = nReason; |
| 2890 | |
| 2891 | nStatus = dot11f_get_packed_disassociation_size(pMac, &frm, &nPayload); |
| 2892 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2893 | pe_err("Failed to calculate the packed size for a Disassociation (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2894 | nStatus); |
| 2895 | /* We'll fall back on the worst case scenario: */ |
| 2896 | nPayload = sizeof(tDot11fDisassociation); |
| 2897 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2898 | pe_warn("There were warnings while calculating the packed size for a Disassociation (0x%08x)", |
| 2899 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2900 | } |
| 2901 | |
| 2902 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 2903 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2904 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2905 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2906 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2907 | pe_err("Failed to allocate %d bytes for a Disassociation", |
| 2908 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2909 | return; |
| 2910 | } |
| 2911 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2912 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2913 | |
| 2914 | /* Next, we fill out the buffer descriptor: */ |
| 2915 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 2916 | SIR_MAC_MGMT_DISASSOC, peer, psessionEntry->selfMacAddr); |
| 2917 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 2918 | |
| 2919 | /* Prepare the BSSID */ |
| 2920 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 2921 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2922 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2923 | |
| 2924 | nStatus = dot11f_pack_disassociation(pMac, &frm, pFrame + |
| 2925 | sizeof(tSirMacMgmtHdr), |
| 2926 | nPayload, &nPayload); |
| 2927 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2928 | pe_err("Failed to pack a Disassociation (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2929 | nStatus); |
| 2930 | cds_packet_free((void *)pPacket); |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2931 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2932 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2933 | pe_warn("There were warnings while packing a Disassociation (0x%08x)", |
| 2934 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2935 | } |
| 2936 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2937 | pe_debug("***Sessionid %d Sending Disassociation frame with " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2938 | "reason %u and waitForAck %d to " MAC_ADDRESS_STR " ,From " |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2939 | MAC_ADDRESS_STR, psessionEntry->peSessionId, nReason, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2940 | waitForAck, MAC_ADDR_ARRAY(pMacHdr->da), |
| 2941 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 2942 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2943 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2944 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 2945 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2946 | ) { |
| 2947 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 2948 | } |
| 2949 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 2950 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2951 | |
| 2952 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2953 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2954 | psessionEntry->peSessionId, |
| 2955 | pMacHdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2956 | lim_diag_mgmt_tx_event_report(pMac, pMacHdr, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2957 | psessionEntry, QDF_STATUS_SUCCESS, |
| 2958 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2959 | /* Queue Disassociation frame in high priority WQ */ |
| 2960 | /* get the duration from the request */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2961 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2962 | wma_tx_frameWithTxComplete(pMac, pPacket, (uint16_t) nBytes, |
| 2963 | TXRX_FRM_802_11_MGMT, |
| 2964 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 2965 | pFrame, lim_disassoc_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 2966 | txFlag, smeSessionId, false, 0, |
| 2967 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2968 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2969 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2970 | psessionEntry->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2971 | |
| 2972 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 2973 | |
| 2974 | if (tx_timer_change |
| 2975 | (&pMac->lim.limTimers.gLimDisassocAckTimer, val, 0) |
| 2976 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2977 | pe_err("Unable to change Disassoc ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2978 | return; |
| 2979 | } else if (TX_SUCCESS != |
| 2980 | tx_timer_activate(&pMac->lim.limTimers. |
| 2981 | gLimDisassocAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 2982 | pe_err("Unable to activate Disassoc ack Timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2983 | lim_deactivate_and_change_timer(pMac, |
| 2984 | eLIM_DISASSOC_ACK_TIMER); |
| 2985 | return; |
| 2986 | } |
| 2987 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2988 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2989 | psessionEntry->peSessionId, |
| 2990 | pMacHdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 2991 | lim_diag_mgmt_tx_event_report(pMac, pMacHdr, |
| 2992 | psessionEntry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2993 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2994 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2995 | qdf_status = wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2996 | TXRX_FRM_802_11_MGMT, |
| 2997 | ANI_TXDIR_TODS, |
| 2998 | 7, |
| 2999 | lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3000 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3001 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3002 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3003 | psessionEntry->peSessionId, qdf_status)); |
| 3004 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3005 | pe_err("Failed to send Disassociation (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3006 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3007 | /* Pkt will be freed up by the callback */ |
| 3008 | } |
| 3009 | } |
| 3010 | } /* End lim_send_disassoc_mgmt_frame. */ |
| 3011 | |
| 3012 | /** |
| 3013 | * \brief This function is called to send a Deauthenticate frame |
| 3014 | * |
| 3015 | * |
| 3016 | * \param pMac Pointer to global MAC structure |
| 3017 | * |
| 3018 | * \param nReason Indicates the reason that need to be sent in the |
| 3019 | * Deauthenticate frame |
| 3020 | * |
| 3021 | * \param peeer address of the STA to which the frame is to be sent |
| 3022 | * |
| 3023 | * |
| 3024 | */ |
| 3025 | |
| 3026 | void |
| 3027 | lim_send_deauth_mgmt_frame(tpAniSirGlobal pMac, |
| 3028 | uint16_t nReason, |
| 3029 | tSirMacAddr peer, |
| 3030 | tpPESession psessionEntry, bool waitForAck) |
| 3031 | { |
| 3032 | tDot11fDeAuth frm; |
| 3033 | uint8_t *pFrame; |
| 3034 | tpSirMacMgmtHdr pMacHdr; |
| 3035 | uint32_t nBytes, nPayload, nStatus; |
| 3036 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3037 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3038 | uint8_t txFlag = 0; |
| 3039 | uint32_t val = 0; |
| 3040 | #ifdef FEATURE_WLAN_TDLS |
| 3041 | uint16_t aid; |
| 3042 | tpDphHashNode pStaDs; |
| 3043 | #endif |
| 3044 | uint8_t smeSessionId = 0; |
| 3045 | |
| 3046 | if (NULL == psessionEntry) { |
| 3047 | return; |
| 3048 | } |
| 3049 | |
| 3050 | /* |
| 3051 | * In case when cac timer is running for this SAP session then |
| 3052 | * avoid deauth frame out. It is violation of dfs specification. |
| 3053 | */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3054 | if (((psessionEntry->pePersona == QDF_SAP_MODE) || |
| 3055 | (psessionEntry->pePersona == QDF_P2P_GO_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3056 | (true == pMac->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3057 | QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3058 | FL |
| 3059 | ("CAC timer is running, drop the deauth from going out")); |
| 3060 | return; |
| 3061 | } |
| 3062 | smeSessionId = psessionEntry->smeSessionId; |
| 3063 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3064 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3065 | |
| 3066 | frm.Reason.code = nReason; |
| 3067 | |
| 3068 | nStatus = dot11f_get_packed_de_auth_size(pMac, &frm, &nPayload); |
| 3069 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3070 | pe_err("Failed to calculate the packed size for a De-Authentication (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3071 | nStatus); |
| 3072 | /* We'll fall back on the worst case scenario: */ |
| 3073 | nPayload = sizeof(tDot11fDeAuth); |
| 3074 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3075 | pe_warn("There were warnings while calculating the packed size for a De-Authentication (0x%08x)", |
| 3076 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3077 | } |
| 3078 | |
| 3079 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3080 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3081 | qdf_status = cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3082 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3083 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3084 | pe_err("Failed to allocate %d bytes for a De-Authentication", |
| 3085 | nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3086 | return; |
| 3087 | } |
| 3088 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3089 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | |
| 3091 | /* Next, we fill out the buffer descriptor: */ |
| 3092 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3093 | SIR_MAC_MGMT_DEAUTH, peer, psessionEntry->selfMacAddr); |
| 3094 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3095 | |
| 3096 | /* Prepare the BSSID */ |
| 3097 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 3098 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3099 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3100 | |
| 3101 | nStatus = dot11f_pack_de_auth(pMac, &frm, pFrame + |
| 3102 | sizeof(tSirMacMgmtHdr), nPayload, &nPayload); |
| 3103 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3104 | pe_err("Failed to pack a DeAuthentication (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3105 | nStatus); |
| 3106 | cds_packet_free((void *)pPacket); |
| 3107 | return; |
| 3108 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3109 | pe_warn("There were warnings while packing a De-Authentication (0x%08x)", |
| 3110 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3111 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3112 | pe_debug("***Sessionid %d Sending Deauth frame with " |
| 3113 | "reason %u and waitForAck %d to " MAC_ADDRESS_STR |
| 3114 | " ,From " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3115 | psessionEntry->peSessionId, nReason, waitForAck, |
| 3116 | MAC_ADDR_ARRAY(pMacHdr->da), |
| 3117 | MAC_ADDR_ARRAY(psessionEntry->selfMacAddr)); |
| 3118 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3119 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3120 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 3121 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3122 | ) { |
| 3123 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3124 | } |
| 3125 | |
Sushant Kaushik | 4655606 | 2015-12-02 16:57:47 +0530 | [diff] [blame] | 3126 | txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3127 | #ifdef FEATURE_WLAN_TDLS |
| 3128 | pStaDs = |
| 3129 | dph_lookup_hash_entry(pMac, peer, &aid, |
| 3130 | &psessionEntry->dph.dphHashTable); |
| 3131 | #endif |
| 3132 | |
| 3133 | if (waitForAck) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3134 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3135 | psessionEntry->peSessionId, |
| 3136 | pMacHdr->fc.subType)); |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 3137 | lim_diag_mgmt_tx_event_report(pMac, pMacHdr, |
| 3138 | psessionEntry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3139 | QDF_STATUS_SUCCESS, QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3140 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3141 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3142 | wma_tx_frameWithTxComplete(pMac, pPacket, (uint16_t) nBytes, |
| 3143 | TXRX_FRM_802_11_MGMT, |
| 3144 | ANI_TXDIR_TODS, 7, lim_tx_complete, |
Liangwei Dong | c0b2e33 | 2017-11-16 06:04:46 -0500 | [diff] [blame] | 3145 | pFrame, lim_deauth_tx_complete_cnf_handler, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3146 | txFlag, smeSessionId, false, 0, |
| 3147 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3148 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3149 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3150 | psessionEntry->peSessionId, qdf_status)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3151 | /* Pkt will be freed up by the callback lim_tx_complete */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3152 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3153 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3154 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3155 | |
| 3156 | /* Call lim_process_deauth_ack_timeout which will send |
| 3157 | * DeauthCnf for this frame |
| 3158 | */ |
| 3159 | lim_process_deauth_ack_timeout(pMac); |
| 3160 | return; |
| 3161 | } |
| 3162 | |
| 3163 | val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT); |
| 3164 | |
| 3165 | if (tx_timer_change |
| 3166 | (&pMac->lim.limTimers.gLimDeauthAckTimer, val, 0) |
| 3167 | != TX_SUCCESS) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3168 | pe_err("Unable to change Deauth ack Timer val"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3169 | return; |
| 3170 | } else if (TX_SUCCESS != |
| 3171 | tx_timer_activate(&pMac->lim.limTimers. |
| 3172 | gLimDeauthAckTimer)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3173 | pe_err("Unable to activate Deauth ack Timer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3174 | lim_deactivate_and_change_timer(pMac, |
| 3175 | eLIM_DEAUTH_ACK_TIMER); |
| 3176 | return; |
| 3177 | } |
| 3178 | } else { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3179 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | psessionEntry->peSessionId, |
| 3181 | pMacHdr->fc.subType)); |
| 3182 | #ifdef FEATURE_WLAN_TDLS |
| 3183 | if ((NULL != pStaDs) |
| 3184 | && (STA_ENTRY_TDLS_PEER == pStaDs->staType)) { |
| 3185 | /* Queue Disassociation frame in high priority WQ */ |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 3186 | lim_diag_mgmt_tx_event_report(pMac, pMacHdr, |
| 3187 | psessionEntry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3188 | QDF_STATUS_SUCCESS, |
| 3189 | QDF_STATUS_SUCCESS); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3190 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3191 | wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
| 3192 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_IBSS, |
| 3193 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3194 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3195 | } else { |
| 3196 | #endif |
Krunal Soni | c65fc49 | 2018-03-09 15:53:28 -0800 | [diff] [blame] | 3197 | lim_diag_mgmt_tx_event_report(pMac, pMacHdr, |
| 3198 | psessionEntry, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3199 | QDF_STATUS_SUCCESS, |
| 3200 | QDF_STATUS_SUCCESS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3201 | /* Queue Disassociation frame in high priority WQ */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3202 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3203 | wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
| 3204 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3205 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3206 | smeSessionId, 0, RATEID_DEFAULT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3207 | #ifdef FEATURE_WLAN_TDLS |
| 3208 | } |
| 3209 | #endif |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3210 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3211 | psessionEntry->peSessionId, qdf_status)); |
| 3212 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3213 | pe_err("Failed to send De-Authentication (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3214 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3215 | /* Pkt will be freed up by the callback */ |
| 3216 | } |
| 3217 | } |
| 3218 | |
| 3219 | } /* End lim_send_deauth_mgmt_frame. */ |
| 3220 | |
| 3221 | #ifdef ANI_SUPPORT_11H |
| 3222 | /** |
| 3223 | * \brief Send a Measurement Report Action frame |
| 3224 | * |
| 3225 | * |
| 3226 | * \param pMac Pointer to the global MAC structure |
| 3227 | * |
| 3228 | * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame |
| 3229 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3230 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | * |
| 3232 | * |
| 3233 | */ |
| 3234 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3235 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3236 | lim_send_meas_report_frame(tpAniSirGlobal pMac, |
| 3237 | tpSirMacMeasReqActionFrame pMeasReqFrame, |
| 3238 | tSirMacAddr peer, tpPESession psessionEntry) |
| 3239 | { |
| 3240 | tDot11fMeasurementReport frm; |
| 3241 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3242 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3243 | tpSirMacMgmtHdr pMacHdr; |
| 3244 | uint32_t nBytes, nPayload, nStatus; |
| 3245 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3246 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3247 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3248 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3249 | |
| 3250 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 3251 | frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID; |
| 3252 | frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken; |
| 3253 | |
| 3254 | switch (pMeasReqFrame->measReqIE.measType) { |
| 3255 | case SIR_MAC_BASIC_MEASUREMENT_TYPE: |
| 3256 | nSirStatus = |
| 3257 | populate_dot11f_measurement_report0(pMac, pMeasReqFrame, |
| 3258 | &frm.MeasurementReport); |
| 3259 | break; |
| 3260 | case SIR_MAC_CCA_MEASUREMENT_TYPE: |
| 3261 | nSirStatus = |
| 3262 | populate_dot11f_measurement_report1(pMac, pMeasReqFrame, |
| 3263 | &frm.MeasurementReport); |
| 3264 | break; |
| 3265 | case SIR_MAC_RPI_MEASUREMENT_TYPE: |
| 3266 | nSirStatus = |
| 3267 | populate_dot11f_measurement_report2(pMac, pMeasReqFrame, |
| 3268 | &frm.MeasurementReport); |
| 3269 | break; |
| 3270 | default: |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3271 | pe_err("Unknown measurement type %d in limSen" |
| 3272 | "dMeasReportFrame", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3273 | pMeasReqFrame->measReqIE.measType); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3274 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3275 | } |
| 3276 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3277 | if (QDF_STATUS_SUCCESS != nSirStatus) |
| 3278 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3279 | |
| 3280 | nStatus = dot11f_get_packed_measurement_report_size(pMac, &frm, &nPayload); |
| 3281 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3282 | pe_err("Failed to calculate the packed size for a Measurement Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | nStatus); |
| 3284 | /* We'll fall back on the worst case scenario: */ |
| 3285 | nPayload = sizeof(tDot11fMeasurementReport); |
| 3286 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3287 | pe_warn("There were warnings while calculating the packed size for a Measurement Report (0x%08x)", |
| 3288 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3289 | } |
| 3290 | |
| 3291 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3292 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3293 | qdf_status = |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 3294 | cds_packet_alloc(pMac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | (uint16_t) nBytes, (void **)&pFrame, |
| 3296 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3297 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3298 | pe_err("Failed to allocate %d bytes for a " |
| 3299 | "De-Authentication", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3300 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3301 | } |
| 3302 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3303 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3304 | |
| 3305 | /* Next, we fill out the buffer descriptor: */ |
| 3306 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3307 | SIR_MAC_MGMT_ACTION, peer); |
| 3308 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3309 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3310 | qdf_mem_copy(pMacHdr->bssId, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3311 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3312 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3313 | |
| 3314 | nStatus = dot11f_pack_measurement_report(pMac, &frm, pFrame + |
| 3315 | sizeof(tSirMacMgmtHdr), |
| 3316 | nPayload, &nPayload); |
| 3317 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3318 | pe_err("Failed to pack a Measurement Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3319 | nStatus); |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 3320 | cds_packet_free(pMac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3321 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3322 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3323 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3324 | pe_warn("There were warnings while packing a Measurement Report (0x%08x)", |
| 3325 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3326 | } |
| 3327 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3328 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3329 | ((psessionEntry) ? psessionEntry-> |
| 3330 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3331 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3332 | wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
| 3333 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3334 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3335 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3336 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3337 | ((psessionEntry) ? psessionEntry->peSessionId : NO_SESSION), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3338 | qdf_status)); |
| 3339 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3340 | pe_err("Failed to send a Measurement Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3341 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3342 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3343 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3344 | } |
| 3345 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3346 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3347 | |
| 3348 | } /* End lim_send_meas_report_frame. */ |
| 3349 | |
| 3350 | /** |
| 3351 | * \brief Send a TPC Request Action frame |
| 3352 | * |
| 3353 | * |
| 3354 | * \param pMac Pointer to the global MAC datastructure |
| 3355 | * |
| 3356 | * \param peer MAC address to which the frame should be sent |
| 3357 | * |
| 3358 | * |
| 3359 | */ |
| 3360 | |
| 3361 | void |
| 3362 | lim_send_tpc_request_frame(tpAniSirGlobal pMac, |
| 3363 | tSirMacAddr peer, tpPESession psessionEntry) |
| 3364 | { |
| 3365 | tDot11fTPCRequest frm; |
| 3366 | uint8_t *pFrame; |
| 3367 | tpSirMacMgmtHdr pMacHdr; |
| 3368 | uint32_t nBytes, nPayload, nStatus; |
| 3369 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3370 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3371 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3372 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3373 | |
| 3374 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 3375 | frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID; |
| 3376 | frm.DialogToken.token = 1; |
| 3377 | frm.TPCRequest.present = 1; |
| 3378 | |
| 3379 | nStatus = dot11f_get_packed_tpc_request_size(pMac, &frm, &nPayload); |
| 3380 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3381 | pe_err("Failed to calculate the packed size for a TPC Request (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3382 | /* We'll fall back on the worst case scenario: */ |
| 3383 | nPayload = sizeof(tDot11fTPCRequest); |
| 3384 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3385 | pe_warn("There were warnings while calculating the packed size for a TPC Request (0x%08x)", |
| 3386 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3387 | } |
| 3388 | |
| 3389 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3390 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3391 | qdf_status = |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 3392 | cds_packet_alloc(pMac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3393 | (uint16_t) nBytes, (void **)&pFrame, |
| 3394 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3395 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3396 | pe_err("Failed to allocate %d bytes for a TPC" |
| 3397 | " Request", nBytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3398 | return; |
| 3399 | } |
| 3400 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3401 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3402 | |
| 3403 | /* Next, we fill out the buffer descriptor: */ |
| 3404 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3405 | SIR_MAC_MGMT_ACTION, peer); |
| 3406 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3407 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3408 | qdf_mem_copy(pMacHdr->bssId, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3409 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3410 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3411 | |
| 3412 | nStatus = dot11f_pack_tpc_request(pMac, &frm, pFrame + |
| 3413 | sizeof(tSirMacMgmtHdr), |
| 3414 | nPayload, &nPayload); |
| 3415 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3416 | pe_err("Failed to pack a TPC Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3417 | nStatus); |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 3418 | cds_packet_free(pMac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3419 | (void *)pFrame, (void *)pPacket); |
| 3420 | return; /* allocated! */ |
| 3421 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3422 | pe_warn("There were warnings while packing a TPC Request (0x%08x)", |
| 3423 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3424 | } |
| 3425 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3426 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3427 | ((psessionEntry) ? psessionEntry-> |
| 3428 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3429 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3430 | wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
| 3431 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3432 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3433 | MTRACE(qdf_trace |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3434 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3435 | ((psessionEntry) ? psessionEntry->peSessionId : NO_SESSION), |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3436 | qdf_status)); |
| 3437 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3438 | pe_err("Failed to send a TPC Request (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3439 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3440 | /* Pkt will be freed up by the callback */ |
| 3441 | } |
| 3442 | |
| 3443 | } /* End lim_send_tpc_request_frame. */ |
| 3444 | |
| 3445 | /** |
| 3446 | * \brief Send a TPC Report Action frame |
| 3447 | * |
| 3448 | * |
| 3449 | * \param pMac Pointer to the global MAC datastructure |
| 3450 | * |
| 3451 | * \param pTpcReqFrame Pointer to the received TPC Request |
| 3452 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3453 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3454 | * |
| 3455 | * |
| 3456 | */ |
| 3457 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3458 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3459 | lim_send_tpc_report_frame(tpAniSirGlobal pMac, |
| 3460 | tpSirMacTpcReqActionFrame pTpcReqFrame, |
| 3461 | tSirMacAddr peer, tpPESession psessionEntry) |
| 3462 | { |
| 3463 | tDot11fTPCReport frm; |
| 3464 | uint8_t *pFrame; |
| 3465 | tpSirMacMgmtHdr pMacHdr; |
| 3466 | uint32_t nBytes, nPayload, nStatus; |
| 3467 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3468 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3469 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3470 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3471 | |
| 3472 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 3473 | frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID; |
| 3474 | frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken; |
| 3475 | |
| 3476 | frm.TPCReport.tx_power = 0; |
| 3477 | frm.TPCReport.link_margin = 0; |
| 3478 | frm.TPCReport.present = 1; |
| 3479 | |
| 3480 | nStatus = dot11f_get_packed_tpc_report_size(pMac, &frm, &nPayload); |
| 3481 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3482 | pe_err("Failed to calculate the packed size for a TPC Report (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3483 | /* We'll fall back on the worst case scenario: */ |
| 3484 | nPayload = sizeof(tDot11fTPCReport); |
| 3485 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3486 | pe_warn("There were warnings while calculating the packed size for a TPC Report (0x%08x)", |
| 3487 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3488 | } |
| 3489 | |
| 3490 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3491 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3492 | qdf_status = |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 3493 | cds_packet_alloc(pMac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3494 | (uint16_t) nBytes, (void **)&pFrame, |
| 3495 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3496 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3497 | pe_err("Failed to allocate %d bytes for a TPC" |
| 3498 | " Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3499 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3500 | } |
| 3501 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3502 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3503 | |
| 3504 | /* Next, we fill out the buffer descriptor: */ |
| 3505 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3506 | SIR_MAC_MGMT_ACTION, peer); |
| 3507 | |
| 3508 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 3509 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3510 | qdf_mem_copy(pMacHdr->bssId, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3511 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3512 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3513 | |
| 3514 | nStatus = dot11f_pack_tpc_report(pMac, &frm, pFrame + |
| 3515 | sizeof(tSirMacMgmtHdr), |
| 3516 | nPayload, &nPayload); |
| 3517 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3518 | pe_err("Failed to pack a TPC Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3519 | nStatus); |
Jeff Johnson | 6aaaa99 | 2018-06-30 10:43:04 -0700 | [diff] [blame] | 3520 | cds_packet_free(pMac->hdd_handle, TXRX_FRM_802_11_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3521 | (void *)pFrame, (void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3522 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3523 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3524 | pe_warn("There were warnings while packing a TPC Report (0x%08x)", |
| 3525 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3526 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3527 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3528 | ((psessionEntry) ? psessionEntry-> |
| 3529 | peSessionId : NO_SESSION), pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3530 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3531 | wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
| 3532 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3533 | lim_tx_complete, pFrame, 0, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3534 | MTRACE(qdf_trace |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3535 | (QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 3536 | ((psessionEntry) ? psessionEntry->peSessionId : NO_SESSION), |
| 3537 | qdf_status)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3538 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3539 | pe_err("Failed to send a TPC Report (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3540 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3542 | return QDF_STATUS_E_FAILURE; /* just allocated... */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3543 | } |
| 3544 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3545 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3546 | |
| 3547 | } /* End lim_send_tpc_report_frame. */ |
| 3548 | #endif /* ANI_SUPPORT_11H */ |
| 3549 | |
| 3550 | /** |
| 3551 | * \brief Send a Channel Switch Announcement |
| 3552 | * |
| 3553 | * |
| 3554 | * \param pMac Pointer to the global MAC datastructure |
| 3555 | * |
| 3556 | * \param peer MAC address to which this frame will be sent |
| 3557 | * |
| 3558 | * \param nMode |
| 3559 | * |
| 3560 | * \param nNewChannel |
| 3561 | * |
| 3562 | * \param nCount |
| 3563 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3564 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3565 | * |
| 3566 | * |
| 3567 | */ |
| 3568 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3569 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3570 | lim_send_channel_switch_mgmt_frame(tpAniSirGlobal pMac, |
| 3571 | tSirMacAddr peer, |
| 3572 | uint8_t nMode, |
| 3573 | uint8_t nNewChannel, |
| 3574 | uint8_t nCount, tpPESession psessionEntry) |
| 3575 | { |
| 3576 | tDot11fChannelSwitch frm; |
| 3577 | uint8_t *pFrame; |
| 3578 | tpSirMacMgmtHdr pMacHdr; |
| 3579 | uint32_t nBytes, nPayload, nStatus; /* , nCfg; */ |
| 3580 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3581 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3582 | uint8_t txFlag = 0; |
| 3583 | |
| 3584 | uint8_t smeSessionId = 0; |
| 3585 | |
| 3586 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3587 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3588 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3589 | } |
| 3590 | smeSessionId = psessionEntry->smeSessionId; |
| 3591 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3592 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3593 | |
| 3594 | frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT; |
| 3595 | frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID; |
| 3596 | frm.ChanSwitchAnn.switchMode = nMode; |
| 3597 | frm.ChanSwitchAnn.newChannel = nNewChannel; |
| 3598 | frm.ChanSwitchAnn.switchCount = nCount; |
| 3599 | frm.ChanSwitchAnn.present = 1; |
| 3600 | |
| 3601 | nStatus = dot11f_get_packed_channel_switch_size(pMac, &frm, &nPayload); |
| 3602 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3603 | pe_err("Failed to calculate the packed size for a Channel Switch (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3604 | nStatus); |
| 3605 | /* We'll fall back on the worst case scenario: */ |
| 3606 | nPayload = sizeof(tDot11fChannelSwitch); |
| 3607 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3608 | pe_warn("There were warnings while calculating the packed size for a Channel Switch (0x%08x)", |
| 3609 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3610 | } |
| 3611 | |
| 3612 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 3613 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3614 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3615 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 3616 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3617 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3618 | pe_err("Failed to allocate %d bytes for a TPC Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3619 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3620 | } |
| 3621 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3622 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3623 | |
| 3624 | /* Next, we fill out the buffer descriptor: */ |
| 3625 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 3626 | SIR_MAC_MGMT_ACTION, peer, |
| 3627 | psessionEntry->selfMacAddr); |
| 3628 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3629 | qdf_mem_copy((uint8_t *) pMacHdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3630 | (uint8_t *) psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 3631 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3632 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3633 | |
| 3634 | nStatus = dot11f_pack_channel_switch(pMac, &frm, pFrame + |
| 3635 | sizeof(tSirMacMgmtHdr), |
| 3636 | nPayload, &nPayload); |
| 3637 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3638 | pe_err("Failed to pack a Channel Switch (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3639 | nStatus); |
| 3640 | cds_packet_free((void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3641 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3642 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3643 | pe_warn("There were warnings while packing a Channel Switch (0x%08x)", |
| 3644 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3645 | } |
| 3646 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3647 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3648 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 3649 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | ) { |
| 3651 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3652 | } |
| 3653 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3654 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3655 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3656 | qdf_status = wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3657 | TXRX_FRM_802_11_MGMT, |
| 3658 | ANI_TXDIR_TODS, |
| 3659 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3660 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3661 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3662 | psessionEntry->peSessionId, qdf_status)); |
| 3663 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3664 | pe_err("Failed to send a Channel Switch (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3665 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3666 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3667 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3668 | } |
| 3669 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3670 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3671 | |
| 3672 | } /* End lim_send_channel_switch_mgmt_frame. */ |
| 3673 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3674 | /** |
| 3675 | * lim_send_extended_chan_switch_action_frame()- function to send ECSA |
| 3676 | * action frame over the air . |
| 3677 | * @mac_ctx: pointer to global mac structure |
| 3678 | * @peer: Destination mac. |
| 3679 | * @mode: channel switch mode |
| 3680 | * @new_op_class: new op class |
| 3681 | * @new_channel: new channel to switch |
| 3682 | * @count: channel switch count |
| 3683 | * |
| 3684 | * This function is called to send ECSA frame. |
| 3685 | * |
| 3686 | * Return: success if frame is sent else return failure |
| 3687 | */ |
| 3688 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3689 | QDF_STATUS |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3690 | lim_send_extended_chan_switch_action_frame(tpAniSirGlobal mac_ctx, |
| 3691 | tSirMacAddr peer, uint8_t mode, uint8_t new_op_class, |
| 3692 | uint8_t new_channel, uint8_t count, tpPESession session_entry) |
| 3693 | { |
| 3694 | tDot11fext_channel_switch_action_frame frm; |
| 3695 | uint8_t *frame; |
| 3696 | tpSirMacMgmtHdr mac_hdr; |
| 3697 | uint32_t num_bytes, n_payload, status; |
| 3698 | void *packet; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3699 | QDF_STATUS qdf_status; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3700 | uint8_t txFlag = 0; |
| 3701 | uint8_t sme_session_id = 0; |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3702 | uint8_t ch_spacing; |
| 3703 | tLimWiderBWChannelSwitchInfo *wide_bw_ie; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3704 | |
| 3705 | if (session_entry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3706 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3707 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3708 | } |
| 3709 | |
| 3710 | sme_session_id = session_entry->smeSessionId; |
| 3711 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3712 | qdf_mem_set(&frm, sizeof(frm), 0); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3713 | |
| 3714 | frm.Category.category = SIR_MAC_ACTION_PUBLIC_USAGE; |
| 3715 | frm.Action.action = SIR_MAC_ACTION_EXT_CHANNEL_SWITCH_ID; |
| 3716 | |
| 3717 | frm.ext_chan_switch_ann_action.switch_mode = mode; |
| 3718 | frm.ext_chan_switch_ann_action.op_class = new_op_class; |
| 3719 | frm.ext_chan_switch_ann_action.new_channel = new_channel; |
| 3720 | frm.ext_chan_switch_ann_action.switch_count = count; |
| 3721 | |
Vignesh Viswanathan | 93b7f70 | 2017-12-19 17:48:45 +0530 | [diff] [blame] | 3722 | ch_spacing = wlan_reg_dmn_get_chanwidth_from_opclass( |
| 3723 | mac_ctx->scan.countryCodeCurrent, new_channel, |
| 3724 | new_op_class); |
| 3725 | pe_debug("wrapper: ch_spacing %hu", ch_spacing); |
| 3726 | |
| 3727 | if ((ch_spacing == 80) || (ch_spacing == 160)) { |
| 3728 | wide_bw_ie = &session_entry->gLimWiderBWChannelSwitch; |
| 3729 | frm.WiderBWChanSwitchAnn.newChanWidth = |
| 3730 | wide_bw_ie->newChanWidth; |
| 3731 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = |
| 3732 | wide_bw_ie->newCenterChanFreq0; |
| 3733 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = |
| 3734 | wide_bw_ie->newCenterChanFreq1; |
| 3735 | frm.WiderBWChanSwitchAnn.present = 1; |
| 3736 | pe_debug("wrapper: width:%d f0:%d f1:%d", |
| 3737 | frm.WiderBWChanSwitchAnn.newChanWidth, |
| 3738 | frm.WiderBWChanSwitchAnn.newCenterChanFreq0, |
| 3739 | frm.WiderBWChanSwitchAnn.newCenterChanFreq1); |
| 3740 | } |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3741 | |
| 3742 | status = dot11f_get_packed_ext_channel_switch_action_frame_size(mac_ctx, |
| 3743 | &frm, &n_payload); |
| 3744 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3745 | pe_err("Failed to get packed size for Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3746 | status); |
| 3747 | /* We'll fall back on the worst case scenario*/ |
| 3748 | n_payload = sizeof(tDot11fext_channel_switch_action_frame); |
| 3749 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3750 | pe_warn("There were warnings while calculating the packed size for a Ext Channel Switch (0x%08x)", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3751 | status); |
| 3752 | } |
| 3753 | |
| 3754 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 3755 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3756 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3757 | (void **) &frame, (void **) &packet); |
| 3758 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3759 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3760 | pe_err("Failed to allocate %d bytes for a Ext Channel Switch", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3761 | num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3762 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3763 | } |
| 3764 | |
| 3765 | /* Paranoia*/ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3766 | qdf_mem_set(frame, num_bytes, 0); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3767 | |
| 3768 | /* Next, we fill out the buffer descriptor */ |
| 3769 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 3770 | SIR_MAC_MGMT_ACTION, peer, session_entry->selfMacAddr); |
| 3771 | mac_hdr = (tpSirMacMgmtHdr) frame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3772 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3773 | (uint8_t *) session_entry->bssId, |
| 3774 | sizeof(tSirMacAddr)); |
| 3775 | |
gaolez | 4b62a9e | 2018-08-16 15:57:50 +0800 | [diff] [blame] | 3776 | lim_set_protected_bit(mac_ctx, session_entry, peer, mac_hdr); |
| 3777 | |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3778 | status = dot11f_pack_ext_channel_switch_action_frame(mac_ctx, &frm, |
| 3779 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 3780 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3781 | pe_err("Failed to pack a Channel Switch 0x%08x", status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3782 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3783 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3784 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3785 | pe_warn("There were warnings while packing a Channel Switch 0x%08x", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3786 | status); |
| 3787 | } |
| 3788 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3789 | if ((BAND_5G == |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3790 | lim_get_rf_band(session_entry->currentOperChannel)) || |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3791 | (session_entry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 3792 | (session_entry->pePersona == QDF_P2P_GO_MODE)) { |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3793 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3794 | } |
| 3795 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3796 | pe_debug("Send Ext channel Switch to :"MAC_ADDRESS_STR" with swcount %d, swmode %d , newchannel %d newops %d", |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3797 | MAC_ADDR_ARRAY(mac_hdr->da), |
| 3798 | frm.ext_chan_switch_ann_action.switch_count, |
| 3799 | frm.ext_chan_switch_ann_action.switch_mode, |
| 3800 | frm.ext_chan_switch_ann_action.new_channel, |
| 3801 | frm.ext_chan_switch_ann_action.op_class); |
| 3802 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3803 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3804 | session_entry->peSessionId, mac_hdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3805 | qdf_status = wma_tx_frame(mac_ctx, packet, (uint16_t) num_bytes, |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3806 | TXRX_FRM_802_11_MGMT, |
| 3807 | ANI_TXDIR_TODS, |
| 3808 | 7, |
| 3809 | lim_tx_complete, frame, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3810 | txFlag, sme_session_id, 0, |
| 3811 | RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3812 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3813 | session_entry->peSessionId, qdf_status)); |
| 3814 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3815 | pe_err("Failed to send a Ext Channel Switch %X!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3816 | qdf_status); |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3817 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3818 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3819 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3820 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 518323d | 2015-10-19 17:42:01 +0530 | [diff] [blame] | 3821 | } /* End lim_send_extended_chan_switch_action_frame */ |
| 3822 | |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3823 | |
| 3824 | /** |
| 3825 | * lim_oper_chan_change_confirm_tx_complete_cnf()- Confirmation for oper_chan_change_confirm |
| 3826 | * sent over the air |
| 3827 | * |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3828 | * @context: pointer to global mac |
| 3829 | * @buf: buffer |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3830 | * @tx_complete : Sent status |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3831 | * @params: tx completion params |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3832 | * |
| 3833 | * Return: This returns QDF_STATUS |
| 3834 | */ |
| 3835 | |
| 3836 | static QDF_STATUS lim_oper_chan_change_confirm_tx_complete_cnf( |
Himanshu Agarwal | 2fdf77a | 2016-12-29 11:41:00 +0530 | [diff] [blame] | 3837 | void *context, |
| 3838 | qdf_nbuf_t buf, |
| 3839 | uint32_t tx_complete, |
| 3840 | void *params) |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3841 | { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3842 | pe_debug("tx_complete: %d", tx_complete); |
Zhu Jianmin | 83e8b12 | 2018-05-18 19:24:45 +0800 | [diff] [blame] | 3843 | if (buf) |
| 3844 | qdf_nbuf_free(buf); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3845 | return QDF_STATUS_SUCCESS; |
| 3846 | } |
| 3847 | |
| 3848 | /** |
| 3849 | * lim_p2p_oper_chan_change_confirm_action_frame()- function to send |
| 3850 | * p2p oper chan change confirm action frame |
| 3851 | * @mac_ctx: pointer to global mac structure |
| 3852 | * @peer: Destination mac. |
| 3853 | * @session_entry: session entry |
| 3854 | * |
| 3855 | * This function is called to send p2p oper chan change confirm action frame. |
| 3856 | * |
| 3857 | * Return: success if frame is sent else return failure |
| 3858 | */ |
| 3859 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3860 | QDF_STATUS |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3861 | lim_p2p_oper_chan_change_confirm_action_frame(tpAniSirGlobal mac_ctx, |
| 3862 | tSirMacAddr peer, tpPESession session_entry) |
| 3863 | { |
| 3864 | tDot11fp2p_oper_chan_change_confirm frm; |
| 3865 | uint8_t *frame; |
| 3866 | tpSirMacMgmtHdr mac_hdr; |
| 3867 | uint32_t num_bytes, n_payload, status; |
| 3868 | void *packet; |
| 3869 | QDF_STATUS qdf_status; |
| 3870 | uint8_t tx_flag = 0; |
| 3871 | uint8_t sme_session_id = 0; |
| 3872 | |
| 3873 | if (session_entry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3874 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3875 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3876 | } |
| 3877 | |
| 3878 | sme_session_id = session_entry->smeSessionId; |
| 3879 | |
| 3880 | qdf_mem_set(&frm, sizeof(frm), 0); |
| 3881 | |
| 3882 | frm.Category.category = SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY; |
| 3883 | |
| 3884 | qdf_mem_copy(frm.p2p_action_oui.oui_data, |
| 3885 | SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE); |
| 3886 | frm.p2p_action_subtype.subtype = 0x04; |
| 3887 | frm.DialogToken.token = 0x0; |
| 3888 | |
| 3889 | if (session_entry->htCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3890 | pe_debug("Populate HT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3891 | populate_dot11f_ht_caps(mac_ctx, session_entry, &frm.HTCaps); |
| 3892 | } |
| 3893 | |
| 3894 | if (session_entry->vhtCapability) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3895 | pe_debug("Populate VHT Caps in Assoc Request"); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3896 | populate_dot11f_vht_caps(mac_ctx, session_entry, &frm.VHTCaps); |
| 3897 | populate_dot11f_operating_mode(mac_ctx, |
| 3898 | &frm.OperatingMode, session_entry); |
| 3899 | } |
| 3900 | |
| 3901 | status = dot11f_get_packed_p2p_oper_chan_change_confirmSize(mac_ctx, |
| 3902 | &frm, &n_payload); |
| 3903 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3904 | pe_err("Failed to get packed size 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3905 | /* We'll fall back on the worst case scenario*/ |
| 3906 | n_payload = sizeof(tDot11fp2p_oper_chan_change_confirm); |
| 3907 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3908 | pe_warn("There were warnings while calculating the packed size (0x%08x)", |
| 3909 | status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3910 | } |
| 3911 | |
| 3912 | num_bytes = n_payload + sizeof(tSirMacMgmtHdr); |
| 3913 | |
| 3914 | qdf_status = cds_packet_alloc((uint16_t)num_bytes, |
| 3915 | (void **) &frame, (void **) &packet); |
| 3916 | |
| 3917 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3918 | pe_err("Failed to allocate %d bytes", num_bytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3919 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3920 | } |
| 3921 | |
| 3922 | qdf_mem_set(frame, num_bytes, 0); |
| 3923 | |
| 3924 | /* Next, fill out the buffer descriptor */ |
| 3925 | lim_populate_mac_header(mac_ctx, frame, SIR_MAC_MGMT_FRAME, |
| 3926 | SIR_MAC_MGMT_ACTION, peer, session_entry->selfMacAddr); |
| 3927 | mac_hdr = (tpSirMacMgmtHdr) frame; |
| 3928 | qdf_mem_copy((uint8_t *) mac_hdr->bssId, |
| 3929 | (uint8_t *) session_entry->bssId, |
| 3930 | sizeof(tSirMacAddr)); |
| 3931 | |
| 3932 | status = dot11f_pack_p2p_oper_chan_change_confirm(mac_ctx, &frm, |
| 3933 | frame + sizeof(tSirMacMgmtHdr), n_payload, &n_payload); |
| 3934 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3935 | pe_err("Failed to pack 0x%08x", status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3936 | cds_packet_free((void *)packet); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3937 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3938 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3939 | pe_warn("There were warnings while packing 0x%08x", |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3940 | status); |
| 3941 | } |
| 3942 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 3943 | if ((BAND_5G == |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3944 | lim_get_rf_band(session_entry->currentOperChannel)) || |
| 3945 | (session_entry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 3946 | (session_entry->pePersona == QDF_P2P_GO_MODE)) { |
| 3947 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 3948 | } |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3949 | pe_debug("Send frame on channel %d to mac " |
| 3950 | MAC_ADDRESS_STR, session_entry->currentOperChannel, |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3951 | MAC_ADDR_ARRAY(peer)); |
| 3952 | |
| 3953 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 3954 | session_entry->peSessionId, mac_hdr->fc.subType)); |
| 3955 | |
| 3956 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 3957 | (uint16_t)num_bytes, |
| 3958 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 3959 | 7, lim_tx_complete, frame, |
| 3960 | lim_oper_chan_change_confirm_tx_complete_cnf, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 3961 | tx_flag, sme_session_id, false, 0, RATEID_DEFAULT); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3962 | |
| 3963 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 3964 | session_entry->peSessionId, qdf_status)); |
| 3965 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3966 | pe_err("Failed to send status %X!", qdf_status); |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3967 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3968 | return QDF_STATUS_E_FAILURE; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3969 | } |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3970 | return QDF_STATUS_SUCCESS; |
Abhishek Singh | 5695e2a | 2016-10-28 10:39:12 +0530 | [diff] [blame] | 3971 | } |
| 3972 | |
| 3973 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3974 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3975 | lim_send_vht_opmode_notification_frame(tpAniSirGlobal pMac, |
| 3976 | tSirMacAddr peer, |
| 3977 | uint8_t nMode, tpPESession psessionEntry) |
| 3978 | { |
| 3979 | tDot11fOperatingMode frm; |
| 3980 | uint8_t *pFrame; |
| 3981 | tpSirMacMgmtHdr pMacHdr; |
| 3982 | uint32_t nBytes, nPayload = 0, nStatus; /* , nCfg; */ |
| 3983 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3984 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | uint8_t txFlag = 0; |
| 3986 | |
| 3987 | uint8_t smeSessionId = 0; |
| 3988 | |
| 3989 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 3990 | pe_err("Session entry is NULL!!!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3991 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3992 | } |
| 3993 | smeSessionId = psessionEntry->smeSessionId; |
| 3994 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3995 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3996 | |
| 3997 | frm.Category.category = SIR_MAC_ACTION_VHT; |
| 3998 | frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION; |
| 3999 | frm.OperatingMode.chanWidth = nMode; |
| 4000 | frm.OperatingMode.rxNSS = 0; |
| 4001 | frm.OperatingMode.rxNSSType = 0; |
| 4002 | |
| 4003 | nStatus = dot11f_get_packed_operating_mode_size(pMac, &frm, &nPayload); |
| 4004 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4005 | pe_err("Failed to calculate the packed size for a Operating Mode (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4006 | nStatus); |
| 4007 | /* We'll fall back on the worst case scenario: */ |
| 4008 | nPayload = sizeof(tDot11fOperatingMode); |
| 4009 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4010 | pe_warn("There were warnings while calculating the packed size for a Operating Mode (0x%08x)", |
| 4011 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4012 | } |
| 4013 | |
| 4014 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4015 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4016 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4017 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4018 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4019 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4020 | pe_err("Failed to allocate %d bytes for a Operating Mode Report", |
| 4021 | nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4022 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4023 | } |
| 4024 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4025 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4026 | |
| 4027 | /* Next, we fill out the buffer descriptor: */ |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4028 | if (psessionEntry->pePersona == QDF_SAP_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4029 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4030 | SIR_MAC_MGMT_ACTION, peer, |
| 4031 | psessionEntry->selfMacAddr); |
| 4032 | else |
| 4033 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4034 | SIR_MAC_MGMT_ACTION, psessionEntry->bssId, |
| 4035 | psessionEntry->selfMacAddr); |
| 4036 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4037 | qdf_mem_copy((uint8_t *) pMacHdr->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4038 | (uint8_t *) psessionEntry->bssId, sizeof(tSirMacAddr)); |
| 4039 | nStatus = dot11f_pack_operating_mode(pMac, &frm, pFrame + |
| 4040 | sizeof(tSirMacMgmtHdr), |
| 4041 | nPayload, &nPayload); |
| 4042 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4043 | pe_err("Failed to pack a Operating Mode (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4044 | nStatus); |
| 4045 | cds_packet_free((void *)pPacket); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4046 | return QDF_STATUS_E_FAILURE; /* allocated! */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4047 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4048 | pe_warn("There were warnings while packing a Operating Mode (0x%08x)", |
| 4049 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4050 | } |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4051 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4052 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4053 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4054 | ) { |
| 4055 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4056 | } |
| 4057 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4058 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4059 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4060 | qdf_status = wma_tx_frame(pMac, pPacket, (uint16_t) nBytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4061 | TXRX_FRM_802_11_MGMT, |
| 4062 | ANI_TXDIR_TODS, |
| 4063 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4064 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4065 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4066 | psessionEntry->peSessionId, qdf_status)); |
| 4067 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4068 | pe_err("Failed to send a Channel Switch (%X)!", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4069 | qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4070 | /* Pkt will be freed up by the callback */ |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4071 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4072 | } |
| 4073 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4074 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4075 | } |
| 4076 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4077 | /** |
| 4078 | * \brief Send a Neighbor Report Request Action frame |
| 4079 | * |
| 4080 | * |
| 4081 | * \param pMac Pointer to the global MAC structure |
| 4082 | * |
| 4083 | * \param pNeighborReq Address of a tSirMacNeighborReportReq |
| 4084 | * |
| 4085 | * \param peer mac address of peer station. |
| 4086 | * |
| 4087 | * \param psessionEntry address of session entry. |
| 4088 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4089 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4090 | * |
| 4091 | * |
| 4092 | */ |
| 4093 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4094 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4095 | lim_send_neighbor_report_request_frame(tpAniSirGlobal pMac, |
| 4096 | tpSirMacNeighborReportReq pNeighborReq, |
| 4097 | tSirMacAddr peer, tpPESession psessionEntry) |
| 4098 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4099 | QDF_STATUS statusCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4100 | tDot11fNeighborReportRequest frm; |
| 4101 | uint8_t *pFrame; |
| 4102 | tpSirMacMgmtHdr pMacHdr; |
| 4103 | uint32_t nBytes, nPayload, nStatus; |
| 4104 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4105 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | uint8_t txFlag = 0; |
| 4107 | uint8_t smeSessionId = 0; |
| 4108 | |
| 4109 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4110 | pe_err("(psession == NULL) in Request to send Neighbor Report request action frame"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4111 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4112 | } |
| 4113 | smeSessionId = psessionEntry->smeSessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4114 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4115 | |
| 4116 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 4117 | frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ; |
| 4118 | frm.DialogToken.token = pNeighborReq->dialogToken; |
| 4119 | |
| 4120 | if (pNeighborReq->ssid_present) { |
| 4121 | populate_dot11f_ssid(pMac, &pNeighborReq->ssid, &frm.SSID); |
| 4122 | } |
| 4123 | |
| 4124 | nStatus = |
| 4125 | dot11f_get_packed_neighbor_report_request_size(pMac, &frm, &nPayload); |
| 4126 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4127 | pe_err("Failed to calculate the packed size for a Neighbor Report Request(0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4128 | nStatus); |
| 4129 | /* We'll fall back on the worst case scenario: */ |
| 4130 | nPayload = sizeof(tDot11fNeighborReportRequest); |
| 4131 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4132 | pe_warn("There were warnings while calculating the packed size for a Neighbor Report Request(0x%08x)", |
| 4133 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4134 | } |
| 4135 | |
| 4136 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4137 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4138 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4139 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4140 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4141 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4142 | pe_err("Failed to allocate %d bytes for a Neighbor " |
| 4143 | "Report Request", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4144 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4145 | } |
| 4146 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4147 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4148 | |
| 4149 | /* Copy necessary info to BD */ |
| 4150 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4151 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4152 | |
| 4153 | /* Update A3 with the BSSID */ |
| 4154 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4155 | |
| 4156 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4157 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4158 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4159 | |
| 4160 | /* Now, we're ready to "pack" the frames */ |
| 4161 | nStatus = dot11f_pack_neighbor_report_request(pMac, |
| 4162 | &frm, |
| 4163 | pFrame + |
| 4164 | sizeof(tSirMacMgmtHdr), |
| 4165 | nPayload, &nPayload); |
| 4166 | |
| 4167 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4168 | pe_err("Failed to pack an Neighbor Report Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4169 | nStatus); |
| 4170 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4171 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4172 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4173 | goto returnAfterError; |
| 4174 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4175 | pe_warn("There were warnings while packing Neighbor Report Request (0x%08x)", |
| 4176 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4177 | } |
| 4178 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4179 | pe_debug("Sending a Neighbor Report Request to"); |
Nishank Aggarwal | 46bd31a | 2017-03-10 16:23:53 +0530 | [diff] [blame] | 4180 | lim_print_mac_addr(pMac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4181 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4182 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4183 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4184 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4185 | ) { |
| 4186 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4187 | } |
| 4188 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4189 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4190 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4191 | qdf_status = wma_tx_frame(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4192 | pPacket, |
| 4193 | (uint16_t) nBytes, |
| 4194 | TXRX_FRM_802_11_MGMT, |
| 4195 | ANI_TXDIR_TODS, |
| 4196 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4197 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4198 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4199 | psessionEntry->peSessionId, qdf_status)); |
| 4200 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4201 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4202 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4203 | /* Pkt will be freed up by the callback */ |
| 4204 | return statusCode; |
| 4205 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4206 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4207 | |
| 4208 | returnAfterError: |
| 4209 | cds_packet_free((void *)pPacket); |
| 4210 | |
| 4211 | return statusCode; |
| 4212 | } /* End lim_send_neighbor_report_request_frame. */ |
| 4213 | |
| 4214 | /** |
| 4215 | * \brief Send a Link Report Action frame |
| 4216 | * |
| 4217 | * |
| 4218 | * \param pMac Pointer to the global MAC structure |
| 4219 | * |
| 4220 | * \param pLinkReport Address of a tSirMacLinkReport |
| 4221 | * |
| 4222 | * \param peer mac address of peer station. |
| 4223 | * |
| 4224 | * \param psessionEntry address of session entry. |
| 4225 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4226 | * \return QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4227 | * |
| 4228 | * |
| 4229 | */ |
| 4230 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4231 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4232 | lim_send_link_report_action_frame(tpAniSirGlobal pMac, |
| 4233 | tpSirMacLinkReport pLinkReport, |
| 4234 | tSirMacAddr peer, tpPESession psessionEntry) |
| 4235 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4236 | QDF_STATUS statusCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4237 | tDot11fLinkMeasurementReport frm; |
| 4238 | uint8_t *pFrame; |
| 4239 | tpSirMacMgmtHdr pMacHdr; |
| 4240 | uint32_t nBytes, nPayload, nStatus; |
| 4241 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4242 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4243 | uint8_t txFlag = 0; |
| 4244 | uint8_t smeSessionId = 0; |
| 4245 | |
| 4246 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4247 | pe_err("(psession == NULL) in Request to send Link Report action frame"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4248 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4249 | } |
| 4250 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4251 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4252 | |
| 4253 | frm.Category.category = SIR_MAC_ACTION_RRM; |
| 4254 | frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT; |
| 4255 | frm.DialogToken.token = pLinkReport->dialogToken; |
| 4256 | |
| 4257 | /* IEEE Std. 802.11 7.3.2.18. for the report element. */ |
| 4258 | /* Even though TPC report an IE, it is represented using fixed fields since it is positioned */ |
| 4259 | /* in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4 */ |
| 4260 | /* and frame parser always expects IEs to come after all fixed fields. It is easier to handle */ |
| 4261 | /* such case this way than changing the frame parser. */ |
| 4262 | frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID; |
| 4263 | frm.TPCEleLen.TPCLen = 2; |
| 4264 | frm.TxPower.txPower = pLinkReport->txPower; |
| 4265 | frm.LinkMargin.linkMargin = 0; |
| 4266 | |
| 4267 | frm.RxAntennaId.antennaId = pLinkReport->rxAntenna; |
| 4268 | frm.TxAntennaId.antennaId = pLinkReport->txAntenna; |
| 4269 | frm.RCPI.rcpi = pLinkReport->rcpi; |
| 4270 | frm.RSNI.rsni = pLinkReport->rsni; |
| 4271 | |
| 4272 | nStatus = |
| 4273 | dot11f_get_packed_link_measurement_report_size(pMac, &frm, &nPayload); |
| 4274 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4275 | pe_err("Failed to calculate the packed size for a Link Report (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4276 | /* We'll fall back on the worst case scenario: */ |
| 4277 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
| 4278 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4279 | pe_warn("There were warnings while calculating the packed size for a Link Report (0x%08x)", |
| 4280 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4281 | } |
| 4282 | |
| 4283 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4284 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4285 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4286 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4287 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4288 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4289 | pe_err("Failed to allocate %d bytes for a Link " |
| 4290 | "Report", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4291 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4292 | } |
| 4293 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4294 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4295 | |
| 4296 | /* Copy necessary info to BD */ |
| 4297 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4298 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4299 | |
| 4300 | /* Update A3 with the BSSID */ |
| 4301 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4302 | |
| 4303 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4304 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4305 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4306 | |
| 4307 | /* Now, we're ready to "pack" the frames */ |
| 4308 | nStatus = dot11f_pack_link_measurement_report(pMac, |
| 4309 | &frm, |
| 4310 | pFrame + |
| 4311 | sizeof(tSirMacMgmtHdr), |
| 4312 | nPayload, &nPayload); |
| 4313 | |
| 4314 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4315 | pe_err("Failed to pack an Link Report (0x%08x)", nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4316 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4317 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4318 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4319 | goto returnAfterError; |
| 4320 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4321 | pe_warn("There were warnings while packing Link Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4322 | nStatus); |
| 4323 | } |
| 4324 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4325 | pe_warn("Sending a Link Report to"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4326 | lim_print_mac_addr(pMac, peer, LOGW); |
| 4327 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4328 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4329 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4330 | (psessionEntry->pePersona == QDF_P2P_GO_MODE)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4331 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4332 | } |
| 4333 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4334 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4335 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4336 | qdf_status = wma_tx_frame(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4337 | pPacket, |
| 4338 | (uint16_t) nBytes, |
| 4339 | TXRX_FRM_802_11_MGMT, |
| 4340 | ANI_TXDIR_TODS, |
| 4341 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4342 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4343 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4344 | psessionEntry->peSessionId, qdf_status)); |
| 4345 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4346 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4347 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4348 | /* Pkt will be freed up by the callback */ |
| 4349 | return statusCode; |
| 4350 | } else |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4351 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4352 | |
| 4353 | returnAfterError: |
| 4354 | cds_packet_free((void *)pPacket); |
| 4355 | |
| 4356 | return statusCode; |
| 4357 | } /* End lim_send_link_report_action_frame. */ |
| 4358 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4359 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4360 | lim_send_radio_measure_report_action_frame(tpAniSirGlobal pMac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4361 | uint8_t dialog_token, |
| 4362 | uint8_t num_report, |
| 4363 | struct rrm_beacon_report_last_beacon_params |
| 4364 | *last_beacon_report_params, |
| 4365 | tpSirMacRadioMeasureReport pRRMReport, |
| 4366 | tSirMacAddr peer, |
| 4367 | tpPESession psessionEntry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4368 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4369 | QDF_STATUS statusCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4370 | uint8_t *pFrame; |
| 4371 | tpSirMacMgmtHdr pMacHdr; |
| 4372 | uint32_t nBytes, nPayload, nStatus; |
| 4373 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4374 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4375 | uint8_t i; |
| 4376 | uint8_t txFlag = 0; |
| 4377 | uint8_t smeSessionId = 0; |
| 4378 | |
| 4379 | tDot11fRadioMeasurementReport *frm = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4380 | qdf_mem_malloc(sizeof(tDot11fRadioMeasurementReport)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4381 | if (!frm) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4382 | pe_err("Not enough memory to allocate tDot11fRadioMeasurementReport"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4383 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4384 | } |
| 4385 | |
| 4386 | if (psessionEntry == NULL) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4387 | pe_err("(psession == NULL) in Request to send Beacon Report action frame"); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4388 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4389 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4390 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4391 | |
Deepak Dhamdhere | 6a02148 | 2017-04-20 17:59:58 -0700 | [diff] [blame] | 4392 | smeSessionId = psessionEntry->smeSessionId; |
| 4393 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4394 | pe_debug("dialog_token %d num_report %d", |
Padma, Santhosh Kumar | 93ec7d2 | 2016-12-26 15:58:37 +0530 | [diff] [blame] | 4395 | dialog_token, num_report); |
| 4396 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4397 | frm->Category.category = SIR_MAC_ACTION_RRM; |
| 4398 | frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT; |
| 4399 | frm->DialogToken.token = dialog_token; |
| 4400 | |
| 4401 | frm->num_MeasurementReport = |
| 4402 | (num_report > |
| 4403 | RADIO_REPORTS_MAX_IN_A_FRAME) ? RADIO_REPORTS_MAX_IN_A_FRAME : |
| 4404 | num_report; |
| 4405 | |
| 4406 | for (i = 0; i < frm->num_MeasurementReport; i++) { |
| 4407 | frm->MeasurementReport[i].type = pRRMReport[i].type; |
| 4408 | frm->MeasurementReport[i].token = pRRMReport[i].token; |
| 4409 | frm->MeasurementReport[i].late = 0; /* IEEE 802.11k section 7.3.22. (always zero in rrm) */ |
| 4410 | switch (pRRMReport[i].type) { |
| 4411 | case SIR_MAC_RRM_BEACON_TYPE: |
| 4412 | populate_dot11f_beacon_report(pMac, |
Vignesh Viswanathan | 3b4bf98 | 2018-06-05 15:04:23 +0530 | [diff] [blame] | 4413 | &frm->MeasurementReport[i], |
| 4414 | &pRRMReport[i].report. |
| 4415 | beaconReport, |
| 4416 | last_beacon_report_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4417 | frm->MeasurementReport[i].incapable = |
| 4418 | pRRMReport[i].incapable; |
| 4419 | frm->MeasurementReport[i].refused = |
| 4420 | pRRMReport[i].refused; |
| 4421 | frm->MeasurementReport[i].present = 1; |
| 4422 | break; |
| 4423 | default: |
| 4424 | frm->MeasurementReport[i].incapable = |
| 4425 | pRRMReport[i].incapable; |
| 4426 | frm->MeasurementReport[i].refused = |
| 4427 | pRRMReport[i].refused; |
| 4428 | frm->MeasurementReport[i].present = 1; |
| 4429 | break; |
| 4430 | } |
| 4431 | } |
| 4432 | |
| 4433 | nStatus = |
| 4434 | dot11f_get_packed_radio_measurement_report_size(pMac, frm, &nPayload); |
| 4435 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4436 | pe_err("Failed to calculate the packed size for a Radio Measure Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4437 | nStatus); |
| 4438 | /* We'll fall back on the worst case scenario: */ |
| 4439 | nPayload = sizeof(tDot11fLinkMeasurementReport); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4440 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4441 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4442 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4443 | pe_warn("There were warnings while calculating the packed size for a Radio Measure Report (0x%08x)", |
| 4444 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4445 | } |
| 4446 | |
| 4447 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
| 4448 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4449 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4450 | cds_packet_alloc((uint16_t) nBytes, (void **)&pFrame, |
| 4451 | (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4452 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4453 | pe_err("Failed to allocate %d bytes for a Radio Measure " |
| 4454 | "Report", nBytes); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4455 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4456 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4457 | } |
| 4458 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4459 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4460 | |
| 4461 | /* Copy necessary info to BD */ |
| 4462 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4463 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4464 | |
| 4465 | /* Update A3 with the BSSID */ |
| 4466 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4467 | |
| 4468 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4469 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4470 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4471 | |
| 4472 | /* Now, we're ready to "pack" the frames */ |
| 4473 | nStatus = dot11f_pack_radio_measurement_report(pMac, |
| 4474 | frm, |
| 4475 | pFrame + |
| 4476 | sizeof(tSirMacMgmtHdr), |
| 4477 | nPayload, &nPayload); |
| 4478 | |
| 4479 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4480 | pe_err("Failed to pack an Radio Measure Report (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | nStatus); |
| 4482 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4483 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4484 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4485 | goto returnAfterError; |
| 4486 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4487 | pe_warn("There were warnings while packing Radio Measure Report (0x%08x)", |
| 4488 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4489 | } |
| 4490 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4491 | pe_warn("Sending a Radio Measure Report to"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4492 | lim_print_mac_addr(pMac, peer, LOGW); |
| 4493 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4494 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4495 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4496 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4497 | ) { |
| 4498 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4499 | } |
| 4500 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4501 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4502 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4503 | qdf_status = wma_tx_frame(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4504 | pPacket, |
| 4505 | (uint16_t) nBytes, |
| 4506 | TXRX_FRM_802_11_MGMT, |
| 4507 | ANI_TXDIR_TODS, |
| 4508 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4509 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4510 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4511 | psessionEntry->peSessionId, qdf_status)); |
| 4512 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4513 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4514 | statusCode = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4515 | /* Pkt will be freed up by the callback */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4516 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4517 | return statusCode; |
| 4518 | } else { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4519 | qdf_mem_free(frm); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4520 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4521 | } |
| 4522 | |
| 4523 | returnAfterError: |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4524 | qdf_mem_free(frm); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4525 | cds_packet_free((void *)pPacket); |
| 4526 | return statusCode; |
| 4527 | } |
| 4528 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4529 | #ifdef WLAN_FEATURE_11W |
| 4530 | /** |
| 4531 | * \brief Send SA query request action frame to peer |
| 4532 | * |
| 4533 | * \sa lim_send_sa_query_request_frame |
| 4534 | * |
| 4535 | * |
| 4536 | * \param pMac The global tpAniSirGlobal object |
| 4537 | * |
| 4538 | * \param transId Transaction identifier |
| 4539 | * |
| 4540 | * \param peer The Mac address of the station to which this action frame is addressed |
| 4541 | * |
| 4542 | * \param psessionEntry The PE session entry |
| 4543 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4544 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4545 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4546 | */ |
| 4547 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4548 | QDF_STATUS lim_send_sa_query_request_frame(tpAniSirGlobal pMac, uint8_t *transId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4549 | tSirMacAddr peer, |
| 4550 | tpPESession psessionEntry) |
| 4551 | { |
| 4552 | |
| 4553 | tDot11fSaQueryReq frm; /* SA query request action frame */ |
| 4554 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4555 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4556 | tpSirMacMgmtHdr pMacHdr; |
| 4557 | uint32_t nBytes, nPayload, nStatus; |
| 4558 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4559 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4560 | uint8_t txFlag = 0; |
| 4561 | uint8_t smeSessionId = 0; |
| 4562 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4563 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4564 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 4565 | /* 11w action field is : |
| 4566 | action: 0 --> SA Query Request action frame |
| 4567 | action: 1 --> SA Query Response action frame */ |
| 4568 | frm.Action.action = SIR_MAC_SA_QUERY_REQ; |
| 4569 | /* 11w SA Query Request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4570 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4571 | |
| 4572 | nStatus = dot11f_get_packed_sa_query_req_size(pMac, &frm, &nPayload); |
| 4573 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4574 | pe_err("Failed to calculate the packed size for an SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4575 | nStatus); |
| 4576 | /* We'll fall back on the worst case scenario: */ |
| 4577 | nPayload = sizeof(tDot11fSaQueryReq); |
| 4578 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4579 | pe_warn("There were warnings while calculating the packed size for an SA Query Request (0x%08x)", |
| 4580 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4581 | } |
| 4582 | |
| 4583 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4584 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4585 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4586 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4587 | pe_err("Failed to allocate %d bytes for a SA Query Request " |
| 4588 | "action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4589 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4590 | } |
| 4591 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4592 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4593 | |
| 4594 | /* Copy necessary info to BD */ |
| 4595 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4596 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4597 | |
| 4598 | /* Update A3 with the BSSID */ |
| 4599 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4600 | |
| 4601 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4602 | |
| 4603 | /* Since this is a SA Query Request, set the "protect" (aka WEP) bit */ |
| 4604 | /* in the FC */ |
| 4605 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
| 4606 | |
| 4607 | /* Pack 11w SA Query Request frame */ |
| 4608 | nStatus = dot11f_pack_sa_query_req(pMac, |
| 4609 | &frm, |
| 4610 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4611 | nPayload, &nPayload); |
| 4612 | |
| 4613 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4614 | pe_err("Failed to pack an SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4615 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4616 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4617 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4618 | goto returnAfterError; |
| 4619 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4620 | pe_warn("There were warnings while packing SA Query Request (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4621 | nStatus); |
| 4622 | } |
| 4623 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4624 | pe_debug("Sending an SA Query Request to"); |
| 4625 | lim_print_mac_addr(pMac, peer, LOGD); |
| 4626 | pe_debug("Sending an SA Query Request from "); |
| 4627 | lim_print_mac_addr(pMac, psessionEntry->selfMacAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4628 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4629 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4630 | #ifdef WLAN_FEATURE_P2P |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4631 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4632 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4633 | #endif |
| 4634 | ) { |
| 4635 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4636 | } |
| 4637 | smeSessionId = psessionEntry->smeSessionId; |
| 4638 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4639 | qdf_status = wma_tx_frame(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4640 | pPacket, |
| 4641 | (uint16_t) nBytes, |
| 4642 | TXRX_FRM_802_11_MGMT, |
| 4643 | ANI_TXDIR_TODS, |
| 4644 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4645 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4646 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4647 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4648 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4649 | /* Pkt will be freed up by the callback */ |
| 4650 | return nSirStatus; |
| 4651 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4652 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4653 | } |
| 4654 | |
| 4655 | returnAfterError: |
| 4656 | cds_packet_free((void *)pPacket); |
| 4657 | return nSirStatus; |
| 4658 | } /* End lim_send_sa_query_request_frame */ |
| 4659 | |
| 4660 | /** |
| 4661 | * \brief Send SA query response action frame to peer |
| 4662 | * |
| 4663 | * \sa lim_send_sa_query_response_frame |
| 4664 | * |
| 4665 | * |
| 4666 | * \param pMac The global tpAniSirGlobal object |
| 4667 | * |
| 4668 | * \param transId Transaction identifier received in SA query request action frame |
| 4669 | * |
| 4670 | * \param peer The Mac address of the AP to which this action frame is addressed |
| 4671 | * |
| 4672 | * \param psessionEntry The PE session entry |
| 4673 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4674 | * \return QDF_STATUS_SUCCESS if setup completes successfully |
| 4675 | * QDF_STATUS_E_FAILURE is some problem is encountered |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4676 | */ |
| 4677 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4678 | QDF_STATUS lim_send_sa_query_response_frame(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4679 | uint8_t *transId, tSirMacAddr peer, |
| 4680 | tpPESession psessionEntry) |
| 4681 | { |
| 4682 | |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 4683 | tDot11fSaQueryRsp frm; /* SA query response action frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4684 | uint8_t *pFrame; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4685 | QDF_STATUS nSirStatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4686 | tpSirMacMgmtHdr pMacHdr; |
| 4687 | uint32_t nBytes, nPayload, nStatus; |
| 4688 | void *pPacket; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4689 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4690 | uint8_t txFlag = 0; |
| 4691 | uint8_t smeSessionId = 0; |
| 4692 | |
| 4693 | smeSessionId = psessionEntry->smeSessionId; |
| 4694 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4695 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4696 | frm.Category.category = SIR_MAC_ACTION_SA_QUERY; |
| 4697 | /*11w action field is : |
| 4698 | action: 0 --> SA query request action frame |
| 4699 | action: 1 --> SA query response action frame */ |
| 4700 | frm.Action.action = SIR_MAC_SA_QUERY_RSP; |
| 4701 | /*11w SA query response transId is same as |
| 4702 | SA query request transId */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4703 | qdf_mem_copy(&frm.TransactionId.transId[0], &transId[0], 2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4704 | |
| 4705 | nStatus = dot11f_get_packed_sa_query_rsp_size(pMac, &frm, &nPayload); |
| 4706 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4707 | pe_err("Failed to calculate the packed size for a SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4708 | nStatus); |
| 4709 | /* We'll fall back on the worst case scenario: */ |
| 4710 | nPayload = sizeof(tDot11fSaQueryRsp); |
| 4711 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4712 | pe_warn("There were warnings while calculating the packed size for an SA Query Response (0x%08x)", |
| 4713 | nStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4714 | } |
| 4715 | |
| 4716 | nBytes = nPayload + sizeof(tSirMacMgmtHdr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4717 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4718 | cds_packet_alloc(nBytes, (void **)&pFrame, (void **)&pPacket); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4719 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4720 | pe_err("Failed to allocate %d bytes for a SA query response" |
| 4721 | " action frame", nBytes); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4722 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4723 | } |
| 4724 | /* Paranoia: */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4725 | qdf_mem_set(pFrame, nBytes, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4726 | |
| 4727 | /* Copy necessary info to BD */ |
| 4728 | lim_populate_mac_header(pMac, pFrame, SIR_MAC_MGMT_FRAME, |
| 4729 | SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr); |
| 4730 | |
| 4731 | /* Update A3 with the BSSID */ |
| 4732 | pMacHdr = (tpSirMacMgmtHdr) pFrame; |
| 4733 | |
| 4734 | sir_copy_mac_addr(pMacHdr->bssId, psessionEntry->bssId); |
| 4735 | |
| 4736 | /* Since this is a SA Query Response, set the "protect" (aka WEP) bit */ |
| 4737 | /* in the FC */ |
| 4738 | lim_set_protected_bit(pMac, psessionEntry, peer, pMacHdr); |
| 4739 | |
| 4740 | /* Pack 11w SA query response frame */ |
| 4741 | nStatus = dot11f_pack_sa_query_rsp(pMac, |
| 4742 | &frm, |
| 4743 | pFrame + sizeof(tSirMacMgmtHdr), |
| 4744 | nPayload, &nPayload); |
| 4745 | |
| 4746 | if (DOT11F_FAILED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4747 | pe_err("Failed to pack an SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4748 | nStatus); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4749 | /* FIXME - Need to convert to QDF_STATUS */ |
| 4750 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4751 | goto returnAfterError; |
| 4752 | } else if (DOT11F_WARNED(nStatus)) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4753 | pe_warn("There were warnings while packing SA Query Response (0x%08x)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4754 | nStatus); |
| 4755 | } |
| 4756 | |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4757 | pe_debug("Sending a SA Query Response to"); |
Srinivas Girigowda | f936d82 | 2017-03-19 23:23:59 -0700 | [diff] [blame] | 4758 | lim_print_mac_addr(pMac, peer, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4759 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4760 | if ((BAND_5G == lim_get_rf_band(psessionEntry->currentOperChannel)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4761 | #ifdef WLAN_FEATURE_P2P |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4762 | || (psessionEntry->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4763 | (psessionEntry->pePersona == QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4764 | #endif |
| 4765 | ) { |
| 4766 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4767 | } |
| 4768 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4769 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4770 | psessionEntry->peSessionId, pMacHdr->fc.subType)); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4771 | qdf_status = wma_tx_frame(pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4772 | pPacket, |
| 4773 | (uint16_t) nBytes, |
| 4774 | TXRX_FRM_802_11_MGMT, |
| 4775 | ANI_TXDIR_TODS, |
| 4776 | 7, lim_tx_complete, pFrame, txFlag, |
Naveen Rawat | 296a518 | 2017-09-25 14:02:48 -0700 | [diff] [blame] | 4777 | smeSessionId, 0, RATEID_DEFAULT); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 4778 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4779 | psessionEntry->peSessionId, qdf_status)); |
| 4780 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 7034a8b | 2017-03-26 19:52:36 -0700 | [diff] [blame] | 4781 | pe_err("wma_tx_frame FAILED! Status [%d]", qdf_status); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4782 | nSirStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4783 | /* Pkt will be freed up by the callback */ |
| 4784 | return nSirStatus; |
| 4785 | } else { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4786 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4787 | } |
| 4788 | |
| 4789 | returnAfterError: |
| 4790 | cds_packet_free((void *)pPacket); |
| 4791 | return nSirStatus; |
| 4792 | } /* End lim_send_sa_query_response_frame */ |
| 4793 | #endif |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4794 | |
| 4795 | /** |
| 4796 | * lim_send_addba_response_frame(): Send ADDBA response action frame to peer |
| 4797 | * @mac_ctx: mac context |
| 4798 | * @peer_mac: Peer MAC address |
| 4799 | * @tid: TID for which addba response is being sent |
| 4800 | * @session: PE session entry |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4801 | * @addba_extn_present: ADDBA extension present flag |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4802 | * @amsdu_support: amsdu in ampdu support |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4803 | * |
| 4804 | * This function is called when ADDBA request is successful. ADDBA response is |
| 4805 | * setup by calling addba_response_setup API and frame is then sent out OTA. |
| 4806 | * |
| 4807 | * Return: QDF_STATUS |
| 4808 | */ |
| 4809 | QDF_STATUS lim_send_addba_response_frame(tpAniSirGlobal mac_ctx, |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4810 | tSirMacAddr peer_mac, uint16_t tid, |
Kiran Kumar Lokere | aee823a | 2018-03-22 15:27:05 -0700 | [diff] [blame] | 4811 | tpPESession session, uint8_t addba_extn_present, |
| 4812 | uint8_t amsdu_support) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4813 | { |
| 4814 | |
| 4815 | tDot11faddba_rsp frm; |
| 4816 | uint8_t *frame_ptr; |
| 4817 | tpSirMacMgmtHdr mgmt_hdr; |
| 4818 | uint32_t num_bytes, payload_size, status; |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 4819 | void *pkt_ptr = NULL; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4820 | QDF_STATUS qdf_status; |
| 4821 | uint8_t tx_flag = 0; |
| 4822 | uint8_t sme_sessionid = 0; |
| 4823 | uint16_t buff_size, status_code, batimeout; |
| 4824 | uint8_t peer_id, dialog_token; |
| 4825 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 4826 | void *peer, *pdev; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4827 | uint8_t he_frag = 0; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4828 | |
| 4829 | sme_sessionid = session->smeSessionId; |
| 4830 | |
| 4831 | pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 4832 | if (!pdev) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4833 | pe_err("pdev is NULL"); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4834 | return QDF_STATUS_E_FAILURE; |
| 4835 | } |
| 4836 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 4837 | peer = cdp_peer_get_ref_by_addr(soc, pdev, peer_mac, &peer_id, |
| 4838 | PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4839 | if (!peer) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4840 | pe_err("PEER [%pM] not found", peer_mac); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4841 | return QDF_STATUS_E_FAILURE; |
| 4842 | } |
| 4843 | |
| 4844 | cdp_addba_responsesetup(soc, peer, tid, &dialog_token, |
| 4845 | &status_code, &buff_size, &batimeout); |
| 4846 | |
Mohit Khanna | c4c2225 | 2017-11-20 11:06:33 -0800 | [diff] [blame] | 4847 | cdp_peer_release_ref(soc, peer, PEER_DEBUG_ID_LIM_SEND_ADDBA_RESP); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4848 | qdf_mem_set((uint8_t *) &frm, sizeof(frm), 0); |
| 4849 | frm.Category.category = SIR_MAC_ACTION_BLKACK; |
| 4850 | frm.Action.action = SIR_MAC_ADDBA_RSP; |
| 4851 | |
| 4852 | frm.DialogToken.token = dialog_token; |
| 4853 | frm.Status.status = status_code; |
Kiran Kumar Lokere | 08195ef | 2018-01-17 19:25:15 -0800 | [diff] [blame] | 4854 | if (mac_ctx->reject_addba_req) { |
| 4855 | frm.Status.status = eSIR_MAC_REQ_DECLINED_STATUS; |
| 4856 | pe_err("refused addba req"); |
| 4857 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4858 | frm.addba_param_set.tid = tid; |
Kiran Kumar Lokere | 96180e1 | 2018-03-12 17:58:23 -0700 | [diff] [blame] | 4859 | frm.addba_param_set.buff_size = SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 4860 | if (mac_ctx->usr_cfg_ba_buff_size) |
| 4861 | frm.addba_param_set.buff_size = mac_ctx->usr_cfg_ba_buff_size; |
Kiran Kumar Lokere | eac7fe9 | 2018-07-24 16:56:01 -0700 | [diff] [blame] | 4862 | |
| 4863 | if (frm.addba_param_set.buff_size > MAX_BA_BUFF_SIZE) |
| 4864 | frm.addba_param_set.buff_size = MAX_BA_BUFF_SIZE; |
| 4865 | |
| 4866 | if (frm.addba_param_set.buff_size > SIR_MAC_BA_DEFAULT_BUFF_SIZE) { |
| 4867 | if (session->active_ba_64_session) { |
| 4868 | frm.addba_param_set.buff_size = |
| 4869 | SIR_MAC_BA_DEFAULT_BUFF_SIZE; |
| 4870 | } |
| 4871 | } else if (!session->active_ba_64_session) { |
| 4872 | session->active_ba_64_session = true; |
| 4873 | } |
Arif Hussain | 0e24680 | 2018-05-01 18:13:44 -0700 | [diff] [blame] | 4874 | if (mac_ctx->is_usr_cfg_amsdu_enabled) |
| 4875 | frm.addba_param_set.amsdu_supp = amsdu_support; |
| 4876 | else |
| 4877 | frm.addba_param_set.amsdu_supp = 0; |
Kiran Kumar Lokere | bc87bec | 2018-02-27 20:06:42 -0800 | [diff] [blame] | 4878 | frm.addba_param_set.policy = SIR_MAC_BA_POLICY_IMMEDIATE; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4879 | frm.ba_timeout.timeout = batimeout; |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4880 | if (addba_extn_present) { |
| 4881 | frm.addba_extn_element.present = 1; |
| 4882 | frm.addba_extn_element.no_fragmentation = 1; |
| 4883 | if (lim_is_session_he_capable(session)) { |
| 4884 | he_frag = lim_get_session_he_frag_cap(session); |
| 4885 | if (he_frag != 0) { |
| 4886 | frm.addba_extn_element.no_fragmentation = 0; |
| 4887 | frm.addba_extn_element.he_frag_operation = |
| 4888 | he_frag; |
| 4889 | } |
| 4890 | } |
| 4891 | } |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4892 | |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4893 | pe_debug("Sending a ADDBA Response from %pM to %pM", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4894 | session->selfMacAddr, peer_mac); |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4895 | pe_debug("tid: %d, dialog_token: %d, status: %d, buff_size: %d", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4896 | tid, frm.DialogToken.token, frm.Status.status, |
| 4897 | frm.addba_param_set.buff_size); |
Kiran Kumar Lokere | 4087585 | 2018-01-15 12:36:19 -0800 | [diff] [blame] | 4898 | pe_debug("addba_extn %d he_capable %d no_frag %d he_frag %d", |
| 4899 | addba_extn_present, |
| 4900 | lim_is_session_he_capable(session), |
| 4901 | frm.addba_extn_element.no_fragmentation, |
| 4902 | frm.addba_extn_element.he_frag_operation); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4903 | |
| 4904 | status = dot11f_get_packed_addba_rsp_size(mac_ctx, &frm, &payload_size); |
| 4905 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4906 | pe_err("Failed to calculate the packed size for a ADDBA Response (0x%08x).", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4907 | status); |
| 4908 | /* We'll fall back on the worst case scenario: */ |
| 4909 | payload_size = sizeof(tDot11faddba_rsp); |
| 4910 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4911 | pe_warn("There were warnings while calculating the packed size for a ADDBA Response (0x%08x).", status); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4912 | } |
| 4913 | |
| 4914 | num_bytes = payload_size + sizeof(*mgmt_hdr); |
| 4915 | qdf_status = cds_packet_alloc(num_bytes, (void **)&frame_ptr, |
| 4916 | (void **)&pkt_ptr); |
Sandeep Puligilla | 39cec08 | 2018-04-30 15:18:45 -0700 | [diff] [blame] | 4917 | if (!QDF_IS_STATUS_SUCCESS(qdf_status) || (!pkt_ptr)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4918 | pe_err("Failed to allocate %d bytes for a ADDBA response action frame", |
| 4919 | num_bytes); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4920 | return QDF_STATUS_E_FAILURE; |
| 4921 | } |
| 4922 | qdf_mem_set(frame_ptr, num_bytes, 0); |
| 4923 | |
| 4924 | lim_populate_mac_header(mac_ctx, frame_ptr, SIR_MAC_MGMT_FRAME, |
| 4925 | SIR_MAC_MGMT_ACTION, peer_mac, session->selfMacAddr); |
| 4926 | |
| 4927 | /* Update A3 with the BSSID */ |
| 4928 | mgmt_hdr = (tpSirMacMgmtHdr) frame_ptr; |
| 4929 | sir_copy_mac_addr(mgmt_hdr->bssId, session->bssId); |
| 4930 | |
| 4931 | /* ADDBA Response is a robust mgmt action frame, |
| 4932 | * set the "protect" (aka WEP) bit in the FC |
| 4933 | */ |
| 4934 | lim_set_protected_bit(mac_ctx, session, peer_mac, mgmt_hdr); |
| 4935 | |
| 4936 | status = dot11f_pack_addba_rsp(mac_ctx, &frm, |
| 4937 | frame_ptr + sizeof(tSirMacMgmtHdr), payload_size, |
| 4938 | &payload_size); |
| 4939 | |
| 4940 | if (DOT11F_FAILED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4941 | pe_err("Failed to pack a ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4942 | status); |
| 4943 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4944 | goto error_addba_rsp; |
| 4945 | } else if (DOT11F_WARNED(status)) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4946 | pe_warn("There were warnings while packing ADDBA Response (0x%08x)", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4947 | status); |
| 4948 | } |
| 4949 | |
| 4950 | |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 4951 | if ((BAND_5G == lim_get_rf_band(session->currentOperChannel)) |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4952 | #ifdef WLAN_FEATURE_P2P |
| 4953 | || (session->pePersona == QDF_P2P_CLIENT_MODE) || |
| 4954 | (session->pePersona == QDF_P2P_GO_MODE) |
| 4955 | #endif |
| 4956 | ) { |
| 4957 | tx_flag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 4958 | } |
| 4959 | |
| 4960 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_MGMT, |
| 4961 | session->peSessionId, mgmt_hdr->fc.subType)); |
Krunal Soni | d2136c7 | 2018-06-01 17:26:39 -0700 | [diff] [blame] | 4962 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, pkt_ptr, |
| 4963 | (uint16_t)num_bytes, |
| 4964 | TXRX_FRM_802_11_MGMT, |
| 4965 | ANI_TXDIR_TODS, 7, |
| 4966 | NULL, frame_ptr, |
| 4967 | lim_addba_rsp_tx_complete_cnf, |
| 4968 | tx_flag, sme_sessionid, |
| 4969 | false, 0, RATEID_DEFAULT); |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4970 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 4971 | session->peSessionId, qdf_status)); |
| 4972 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 28fb012 | 2017-03-26 22:21:20 -0700 | [diff] [blame] | 4973 | pe_err("wma_tx_frame FAILED! Status [%d]", |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4974 | qdf_status); |
| 4975 | qdf_status = QDF_STATUS_E_FAILURE; |
| 4976 | /* |
| 4977 | * wma_tx_frame free memory in certain cases, free pkt_ptr |
| 4978 | * only if not freed already. |
| 4979 | */ |
| 4980 | if (pkt_ptr) |
| 4981 | cds_packet_free((void *)pkt_ptr); |
| 4982 | return qdf_status; |
| 4983 | } else { |
Tushnim Bhattacharyya | d58e4c9 | 2018-03-27 13:40:12 -0700 | [diff] [blame] | 4984 | return QDF_STATUS_SUCCESS; |
Krishna Kumaar Natarajan | 48a6b4c | 2017-01-06 16:30:55 -0800 | [diff] [blame] | 4985 | } |
| 4986 | |
| 4987 | error_addba_rsp: |
| 4988 | cds_packet_free((void *)pkt_ptr); |
| 4989 | return qdf_status; |
| 4990 | } |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 4991 | |
| 4992 | /** |
| 4993 | * lim_tx_mgmt_frame() - Transmits Auth mgmt frame |
| 4994 | * @mac_ctx Pointer to Global MAC structure |
| 4995 | * @mb_msg: Received message info |
| 4996 | * @msg_len: Received message length |
| 4997 | * @packet: Packet to be transmitted |
| 4998 | * @frame: Received frame |
| 4999 | * |
| 5000 | * Return: None |
| 5001 | */ |
| 5002 | static void lim_tx_mgmt_frame(tpAniSirGlobal mac_ctx, |
| 5003 | struct sir_mgmt_msg *mb_msg, uint32_t msg_len, |
| 5004 | void *packet, uint8_t *frame) |
| 5005 | { |
| 5006 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 5007 | QDF_STATUS qdf_status; |
| 5008 | uint8_t sme_session_id = 0; |
| 5009 | tpPESession session; |
| 5010 | uint16_t auth_ack_status; |
| 5011 | enum rateid min_rid = RATEID_DEFAULT; |
| 5012 | |
| 5013 | sme_session_id = mb_msg->session_id; |
| 5014 | session = pe_find_session_by_sme_session_id(mac_ctx, sme_session_id); |
| 5015 | if (session == NULL) { |
| 5016 | pe_err("session not found for given sme session"); |
| 5017 | return; |
| 5018 | } |
| 5019 | |
Ashish Kumar Dhanotiya | 9f72df0 | 2018-07-23 19:20:04 +0530 | [diff] [blame] | 5020 | qdf_mtrace(QDF_MODULE_ID_PE, QDF_MODULE_ID_WMA, TRACE_CODE_TX_MGMT, |
| 5021 | session->peSessionId, 0); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5022 | |
| 5023 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_NOT_RCD; |
| 5024 | min_rid = lim_get_min_session_txrate(session); |
| 5025 | |
| 5026 | qdf_status = wma_tx_frameWithTxComplete(mac_ctx, packet, |
| 5027 | (uint16_t)msg_len, |
| 5028 | TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 5029 | 7, lim_tx_complete, frame, |
| 5030 | lim_auth_tx_complete_cnf, |
| 5031 | 0, sme_session_id, false, 0, min_rid); |
| 5032 | MTRACE(qdf_trace(QDF_MODULE_ID_PE, TRACE_CODE_TX_COMPLETE, |
| 5033 | session->peSessionId, qdf_status)); |
| 5034 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Rachit Kankane | 0baf6e7 | 2018-01-19 15:01:50 +0530 | [diff] [blame] | 5035 | pe_err("*** Could not send Auth frame (subType: %d), retCode=%X ***", |
| 5036 | fc->subType, qdf_status); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5037 | mac_ctx->auth_ack_status = LIM_AUTH_ACK_RCD_FAILURE; |
| 5038 | auth_ack_status = SENT_FAIL; |
| 5039 | lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_AUTH_ACK_EVENT, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 5040 | session, auth_ack_status, QDF_STATUS_E_FAILURE); |
Padma, Santhosh Kumar | 22c462c | 2018-01-16 17:56:44 +0530 | [diff] [blame] | 5041 | /* Pkt will be freed up by the callback */ |
| 5042 | } |
| 5043 | } |
| 5044 | |
| 5045 | void lim_send_mgmt_frame_tx(tpAniSirGlobal mac_ctx, |
| 5046 | struct scheduler_msg *msg) |
| 5047 | { |
| 5048 | struct sir_mgmt_msg *mb_msg = (struct sir_mgmt_msg *)msg->bodyptr; |
| 5049 | uint32_t msg_len; |
| 5050 | tpSirMacFrameCtl fc = (tpSirMacFrameCtl) mb_msg->data; |
| 5051 | uint8_t sme_session_id; |
| 5052 | QDF_STATUS qdf_status; |
| 5053 | uint8_t *frame; |
| 5054 | void *packet; |
| 5055 | |
| 5056 | msg_len = mb_msg->msg_len - sizeof(*mb_msg); |
| 5057 | pe_debug("sending fc->type: %d fc->subType: %d", |
| 5058 | fc->type, fc->subType); |
| 5059 | |
| 5060 | sme_session_id = mb_msg->session_id; |
| 5061 | |
| 5062 | qdf_status = cds_packet_alloc((uint16_t) msg_len, (void **)&frame, |
| 5063 | (void **)&packet); |
| 5064 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
| 5065 | pe_err("call to bufAlloc failed for AUTH frame"); |
| 5066 | return; |
| 5067 | } |
| 5068 | |
| 5069 | qdf_mem_copy(frame, mb_msg->data, msg_len); |
| 5070 | |
| 5071 | lim_tx_mgmt_frame(mac_ctx, mb_msg, msg_len, packet, frame); |
| 5072 | } |