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