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