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