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