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