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