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