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