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